datatables.net-select
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -1,2 +0,2 @@ | ||
/*! Select for DataTables 1.1.2 | ||
/*! Select for DataTables 1.2.0 | ||
* 2015-2016 SpryMedia Ltd - datatables.net/license/mit | ||
@@ -9,3 +9,3 @@ */ | ||
* that provides selection options of the items in a DataTable | ||
* @version 1.1.2 | ||
* @version 1.2.0 | ||
* @file dataTables.select.js | ||
@@ -58,3 +58,3 @@ * @author SpryMedia Ltd (www.sprymedia.co.uk) | ||
DataTable.select.version = '1.1.2'; | ||
DataTable.select.version = '1.2.0'; | ||
@@ -330,3 +330,3 @@ DataTable.select.init = function ( dt ) { | ||
// element selection doesn't look terrible! | ||
if ( e.shiftKey ) { | ||
if ( e.shiftKey || e.metaKey || e.ctrlKey ) { | ||
body | ||
@@ -339,3 +339,3 @@ .css( '-moz-user-select', 'none' ) | ||
} ) | ||
.on( 'mouseup.dtSelect', selector, function(e) { | ||
.on( 'mouseup.dtSelect', selector, function() { | ||
// Allow text selection to occur again, Mozilla style (tested in FF | ||
@@ -362,11 +362,18 @@ // 35.0.1 - still required) | ||
var cell = $(e.target).closest('td, th'); | ||
var cellIndex = dt.cell( cell ).index(); | ||
var cell = dt.cell( $(e.target).closest('td, th') ); | ||
// Check the cell actually belongs to the host DataTable (so child rows, | ||
// etc, are ignored) | ||
if ( ! dt.cell( cell ).any() ) { | ||
// Check the cell actually belongs to the host DataTable (so child | ||
// rows, etc, are ignored) | ||
if ( ! cell.any() ) { | ||
return; | ||
} | ||
var event = $.Event('user-select.dt'); | ||
eventTrigger( dt, event, [ items, cell, e ] ); | ||
if ( event.isDefaultPrevented() ) { | ||
return; | ||
} | ||
var cellIndex = cell.index(); | ||
if ( items === 'row' ) { | ||
@@ -377,7 +384,7 @@ idx = cellIndex.row; | ||
else if ( items === 'column' ) { | ||
idx = dt.cell( cell ).index().column; | ||
idx = cell.index().column; | ||
typeSelect( e, dt, ctx, 'column', idx ); | ||
} | ||
else if ( items === 'cell' ) { | ||
idx = dt.cell( cell ).index(); | ||
idx = cell.index(); | ||
typeSelect( e, dt, ctx, 'cell', idx ); | ||
@@ -423,5 +430,9 @@ } | ||
if ( typeof type === 'string' ) { | ||
type = type +'.dt'; | ||
} | ||
args.unshift( api ); | ||
$(api.table().node()).triggerHandler( type+'.dt', args ); | ||
$(api.table().node()).triggerHandler( type, args ); | ||
} | ||
@@ -545,3 +556,3 @@ | ||
// Update the table information element with selected item summary | ||
api.on( 'draw.dtSelect.dt select.dtSelect.dt deselect.dtSelect.dt', function () { | ||
api.on( 'draw.dtSelect.dt select.dtSelect.dt deselect.dtSelect.dt info.dt', function () { | ||
info( api ); | ||
@@ -665,2 +676,17 @@ } ); | ||
} | ||
} else if ( style == 'multi+shift' ) { | ||
if ( e.shiftKey ) { | ||
if ( type === 'cell' ) { | ||
cellRange( dt, idx, ctx._select_lastCell || null ); | ||
} | ||
else { | ||
rowColumnRange( dt, type, idx, ctx._select_lastCell ? | ||
ctx._select_lastCell[type] : | ||
null | ||
); | ||
} | ||
} | ||
else { | ||
dt[ type ]( idx ).select( ! isSelected ); | ||
} | ||
} | ||
@@ -698,3 +724,3 @@ else { | ||
if ( (selected === true && data._select_selected === true) || | ||
(selected === false && ! data._select_selected ) | ||
(selected === false && ! data._select_selected ) | ||
) { | ||
@@ -722,3 +748,3 @@ out.push( indexes[i] ); | ||
if ( (selected === true && rowData._selected_cells && rowData._selected_cells[ cells[i].column ] === true) || | ||
(selected === false && ( ! rowData._selected_cells || ! rowData._selected_cells[ cells[i].column ] ) ) | ||
(selected === false && ( ! rowData._selected_cells || ! rowData._selected_cells[ cells[i].column ] ) ) | ||
) { | ||
@@ -992,3 +1018,3 @@ out.push( cells[i] ); | ||
className: 'buttons-selected', | ||
init: function ( dt, button, config ) { | ||
init: function ( dt ) { | ||
var that = this; | ||
@@ -1012,3 +1038,3 @@ | ||
className: 'buttons-selected-single', | ||
init: function ( dt, button, config ) { | ||
init: function ( dt ) { | ||
var that = this; | ||
@@ -1041,3 +1067,3 @@ | ||
}, | ||
init: function ( dt, button, config ) { | ||
init: function ( dt ) { | ||
var that = this; | ||
@@ -1067,3 +1093,3 @@ | ||
}, | ||
init: function ( dt, button, config ) { | ||
init: function ( dt ) { | ||
var that = this; | ||
@@ -1070,0 +1096,0 @@ |
{ | ||
"name": "datatables.net-select", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Select for DataTables ", | ||
@@ -27,3 +27,7 @@ "files": [ | ||
"datatables.net": ">=1.10.9" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/DataTables/Dist-DataTables-Select.git" | ||
} | ||
} |
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
33122
912
0