Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datatables.net-select

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datatables.net-select - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

types/types.d.ts

63

js/dataTables.select.js

@@ -1,2 +0,2 @@

/*! Select for DataTables 1.3.3
/*! Select for DataTables 1.3.4-dev
* 2015-2021 SpryMedia Ltd - datatables.net/license/mit

@@ -9,3 +9,3 @@ */

* that provides selection options of the items in a DataTable
* @version 1.3.3
* @version 1.3.4-dev
* @file dataTables.select.js

@@ -58,6 +58,48 @@ * @author SpryMedia Ltd (www.sprymedia.co.uk)

DataTable.select.version = '1.3.3';
DataTable.select.version = '1.3.4-dev';
DataTable.select.init = function ( dt ) {
var ctx = dt.settings()[0];
if (ctx._select) {
return;
}
var savedSelected = dt.state.loaded();
var selectAndSave = function(e, settings, data) {
if(data === null || data.select === undefined) {
return;
}
dt.rows().deselect();
dt.columns().deselect();
dt.cells().deselect();
if (data.select.rows !== undefined) {
dt.rows(data.select.rows).select();
}
if (data.select.columns !== undefined) {
dt.columns(data.select.columns).select();
}
if (data.select.cells !== undefined) {
for(var i = 0; i < data.select.cells.length; i++) {
dt.cell(data.select.cells[i].row, data.select.cells[i].column).select();
}
}
dt.state.save();
}
dt.one('init', function() {
dt.on('stateSaveParams', function(e, settings, data) {
data.select = {};
data.select.rows = dt.rows({selected:true}).ids(true).toArray();
data.select.columns = dt.columns({selected:true})[0];
data.select.cells = dt.cells({selected:true})[0].map(function(coords) {
return {row: dt.row(coords.row).id(true), column: coords.column}
});
})
selectAndSave(undefined, undefined, savedSelected)
dt.on('stateLoaded stateLoadParams', selectAndSave)
})
var init = ctx.oInit.select;

@@ -534,2 +576,3 @@ var defaults = DataTable.defaults.select;

var api = new DataTable.Api( ctx );
ctx._select_init = true;

@@ -603,2 +646,3 @@ // Row callback so that classes can be added to rows and cells if the item

info( api );
api.state.save();
} );

@@ -612,2 +656,3 @@

api.off( '.dtSelect' );
$('body').off('.dtSelect' + _safeId(api.table().node()));
} );

@@ -881,8 +926,12 @@ }

return this.iterator( 'table', function ( ctx ) {
ctx._select.style = style;
if ( ! ctx._select ) {
DataTable.select.init( new DataTable.Api(ctx) );
}
if ( ! ctx._select_init ) {
init( ctx );
init(ctx);
}
ctx._select.style = style;
// Add / remove mouse event handlers. They aren't required when only

@@ -1052,3 +1101,5 @@ // API selection is available

data._selected_cells[ colIdx ] = false;
if(data._selected_cells !== undefined) {
data._selected_cells[ colIdx ] = false;
}

@@ -1055,0 +1106,0 @@ // Remove class only if the cells exist, and the cell is not column

62

js/dataTables.select.min.js
/*!
Select for DataTables 1.3.3
Copyright 2015-2021 SpryMedia Ltd.
This source file is free software, available under the following license:
MIT license - http://datatables.net/license/mit
This source file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
For details please refer to: http://www.datatables.net/extensions/select
Select for DataTables 1.3.4-dev
2015-2021 SpryMedia Ltd - datatables.net/license/mit
*/
(function(e){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(i){return e(i,window,document)}):"object"===typeof exports?module.exports=function(i,m){i||(i=window);if(!m||!m.fn.dataTable)m=require("datatables.net")(i,m).$;return e(m,i,i.document)}:e(jQuery,window,document)})(function(e,i,m,h){function x(a,c,b){var d;d=function(b,c){if(b>c)var d=c,c=b,b=d;var f=!1;return a.columns(":visible").indexes().filter(function(a){a===b&&(f=!0);return a===c?(f=!1,!0):f})};var f=
function(b,c){var d=a.rows({search:"applied"}).indexes();if(d.indexOf(b)>d.indexOf(c))var f=c,c=b,b=f;var e=!1;return d.filter(function(a){a===b&&(e=!0);return a===c?(e=!1,!0):e})};!a.cells({selected:!0}).any()&&!b?(d=d(0,c.column),b=f(0,c.row)):(d=d(b.column,c.column),b=f(b.row,c.row));b=a.cells(b,d).flatten();a.cells(c,{selected:!0}).any()?a.cells(b).deselect():a.cells(b).select()}function t(a){var c=a.settings()[0]._select.selector;e(a.table().container()).off("mousedown.dtSelect",c).off("mouseup.dtSelect",
c).off("click.dtSelect",c);e("body").off("click.dtSelect"+z(a.table().node()))}function A(a){var c=e(a.table().container()),b=a.settings()[0],d=b._select.selector,f;c.on("mousedown.dtSelect",d,function(b){if(b.shiftKey||b.metaKey||b.ctrlKey)c.css("-moz-user-select","none").one("selectstart.dtSelect",d,function(){return!1});i.getSelection&&(f=i.getSelection())}).on("mouseup.dtSelect",d,function(){c.css("-moz-user-select","")}).on("click.dtSelect",d,function(b){var c=a.select.items();if(f){var d=i.getSelection();
if((!d.anchorNode||e(d.anchorNode).closest("table")[0]===a.table().node())&&d!==f)return}var d=a.settings()[0],k=a.settings()[0].oClasses.sWrapper.trim().replace(/ +/g,".");if(e(b.target).closest("div."+k)[0]==a.table().container()&&(k=a.cell(e(b.target).closest("td, th")),k.any())){var g=e.Event("user-select.dt");l(a,g,[c,k,b]);g.isDefaultPrevented()||(g=k.index(),"row"===c?(c=g.row,u(b,a,d,"row",c)):"column"===c?(c=k.index().column,u(b,a,d,"column",c)):"cell"===c&&(c=k.index(),u(b,a,d,"cell",c)),
d._select_lastCell=g)}});e("body").on("click.dtSelect"+z(a.table().node()),function(c){b._select.blurable&&!e(c.target).parents().filter(a.table().container()).length&&(0!==e(c.target).parents("html").length&&!e(c.target).parents("div.DTE").length)&&q(b,!0)})}function l(a,c,b,d){if(!d||a.flatten().length)"string"===typeof c&&(c+=".dt"),b.unshift(a),e(a.table().node()).trigger(c,b)}function B(a,c,b,d){var f=a[c+"s"]({search:"applied"}).indexes(),d=e.inArray(d,f),n=e.inArray(b,f);if(!a[c+"s"]({selected:!0}).any()&&
-1===d)f.splice(e.inArray(b,f)+1,f.length);else{if(d>n)var g=n,n=d,d=g;f.splice(n+1,f.length);f.splice(0,d)}a[c](b,{selected:!0}).any()?(f.splice(e.inArray(b,f),1),a[c+"s"](f).deselect()):a[c+"s"](f).select()}function q(a,c){if(c||"single"===a._select.style){var b=new g.Api(a);b.rows({selected:!0}).deselect();b.columns({selected:!0}).deselect();b.cells({selected:!0}).deselect()}}function u(a,c,b,d,f){var e=c.select.style(),g=c.select.toggleable(),j=c[d](f,{selected:!0}).any();if(!j||g)"os"===e?a.ctrlKey||
a.metaKey?c[d](f).select(!j):a.shiftKey?"cell"===d?x(c,f,b._select_lastCell||null):B(c,d,f,b._select_lastCell?b._select_lastCell[d]:null):(a=c[d+"s"]({selected:!0}),j&&1===a.flatten().length?c[d](f).deselect():(a.deselect(),c[d](f).select())):"multi+shift"==e?a.shiftKey?"cell"===d?x(c,f,b._select_lastCell||null):B(c,d,f,b._select_lastCell?b._select_lastCell[d]:null):c[d](f).select(!j):c[d](f).select(!j)}function z(a){return a.id.replace(/[^a-zA-Z0-9\-\_]/g,"-")}function r(a,c){return function(b){return b.i18n("buttons."+
a,c)}}function v(a){a=a._eventNamespace;return"draw.dt.DT"+a+" select.dt.DT"+a+" deselect.dt.DT"+a}var g=e.fn.dataTable;g.select={};g.select.version="1.3.3";g.select.init=function(a){var c=a.settings()[0],b=c.oInit.select,d=g.defaults.select,b=b===h?d:b,d="row",f="api",n=!1,y=!0,j=!0,k="td, th",i="selected",s=!1;c._select={};if(!0===b)f="os",s=!0;else if("string"===typeof b)f=b,s=!0;else if(e.isPlainObject(b)&&(b.blurable!==h&&(n=b.blurable),b.toggleable!==h&&(y=b.toggleable),b.info!==h&&(j=b.info),
b.items!==h&&(d=b.items),f=b.style!==h?b.style:"os",s=!0,b.selector!==h&&(k=b.selector),b.className!==h))i=b.className;a.select.selector(k);a.select.items(d);a.select.style(f);a.select.blurable(n);a.select.toggleable(y);a.select.info(j);c._select.className=i;e.fn.dataTable.ext.order["select-checkbox"]=function(b,c){return this.api().column(c,{order:"index"}).nodes().map(function(c){return"row"===b._select.items?e(c).parent().hasClass(b._select.className):"cell"===b._select.items?e(c).hasClass(b._select.className):
!1})};!s&&e(a.table().node()).hasClass("selectable")&&a.select.style("os")};e.each([{type:"row",prop:"aoData"},{type:"column",prop:"aoColumns"}],function(a,c){g.ext.selector[c.type].push(function(b,a,f){var a=a.selected,e,g=[];if(!0!==a&&!1!==a)return f;for(var j=0,k=f.length;j<k;j++)e=b[c.prop][f[j]],(!0===a&&!0===e._select_selected||!1===a&&!e._select_selected)&&g.push(f[j]);return g})});g.ext.selector.cell.push(function(a,c,b){var c=c.selected,d,f=[];if(c===h)return b;for(var e=0,g=b.length;e<
g;e++)d=a.aoData[b[e].row],(!0===c&&d._selected_cells&&!0===d._selected_cells[b[e].column]||!1===c&&(!d._selected_cells||!d._selected_cells[b[e].column]))&&f.push(b[e]);return f});var o=g.Api.register,p=g.Api.registerPlural;o("select()",function(){return this.iterator("table",function(a){g.select.init(new g.Api(a))})});o("select.blurable()",function(a){return a===h?this.context[0]._select.blurable:this.iterator("table",function(c){c._select.blurable=a})});o("select.toggleable()",function(a){return a===
h?this.context[0]._select.toggleable:this.iterator("table",function(c){c._select.toggleable=a})});o("select.info()",function(a){return a===h?this.context[0]._select.info:this.iterator("table",function(c){c._select.info=a})});o("select.items()",function(a){return a===h?this.context[0]._select.items:this.iterator("table",function(c){c._select.items=a;l(new g.Api(c),"selectItems",[a])})});o("select.style()",function(a){return a===h?this.context[0]._select.style:this.iterator("table",function(c){c._select.style=
a;if(!c._select_init){var b=new g.Api(c);c.aoRowCreatedCallback.push({fn:function(b,a,d){a=c.aoData[d];a._select_selected&&e(b).addClass(c._select.className);b=0;for(d=c.aoColumns.length;b<d;b++)(c.aoColumns[b]._select_selected||a._selected_cells&&a._selected_cells[b])&&e(a.anCells[b]).addClass(c._select.className)},sName:"select-deferRender"});b.on("preXhr.dt.dtSelect",function(c,a){if(a===b.settings()[0]){var d=b.rows({selected:!0}).ids(!0).filter(function(b){return b!==h}),e=b.cells({selected:!0}).eq(0).map(function(a){var c=
b.row(a.row).id(!0);return c?{row:c,column:a.column}:h}).filter(function(b){return b!==h});b.one("draw.dt.dtSelect",function(){b.rows(d).select();e.any()&&e.each(function(a){b.cells(a.row,a.column).select()})})}});b.on("draw.dtSelect.dt select.dtSelect.dt deselect.dtSelect.dt info.dt",function(){var a=b.settings()[0];if(a._select.info&&a.aanFeatures.i&&"api"!==b.select.style()){var c=b.rows({selected:!0}).flatten().length,d=b.columns({selected:!0}).flatten().length,g=b.cells({selected:!0}).flatten().length,
h=function(a,c,d){a.append(e('<span class="select-item"/>').append(b.i18n("select."+c+"s",{_:"%d "+c+"s selected","0":"",1:"1 "+c+" selected"},d)))};e.each(a.aanFeatures.i,function(b,a){var a=e(a),f=e('<span class="select-info"/>');h(f,"row",c);h(f,"column",d);h(f,"cell",g);var i=a.children("span.select-info");i.length&&i.remove();""!==f.text()&&a.append(f)})}});b.on("destroy.dtSelect",function(){b.rows({selected:!0}).deselect();t(b);b.off(".dtSelect")})}var d=new g.Api(c);t(d);"api"!==a&&A(d);l(new g.Api(c),
"selectStyle",[a])})});o("select.selector()",function(a){return a===h?this.context[0]._select.selector:this.iterator("table",function(c){t(new g.Api(c));c._select.selector=a;"api"!==c._select.style&&A(new g.Api(c))})});p("rows().select()","row().select()",function(a){var c=this;if(!1===a)return this.deselect();this.iterator("row",function(b,a){q(b);b.aoData[a]._select_selected=!0;e(b.aoData[a].nTr).addClass(b._select.className)});this.iterator("table",function(b,a){l(c,"select",["row",c[a]],!0)});
return this});p("columns().select()","column().select()",function(a){var c=this;if(!1===a)return this.deselect();this.iterator("column",function(b,a){q(b);b.aoColumns[a]._select_selected=!0;var c=(new g.Api(b)).column(a);e(c.header()).addClass(b._select.className);e(c.footer()).addClass(b._select.className);c.nodes().to$().addClass(b._select.className)});this.iterator("table",function(b,a){l(c,"select",["column",c[a]],!0)});return this});p("cells().select()","cell().select()",function(a){var c=this;
if(!1===a)return this.deselect();this.iterator("cell",function(b,a,c){q(b);a=b.aoData[a];a._selected_cells===h&&(a._selected_cells=[]);a._selected_cells[c]=!0;a.anCells&&e(a.anCells[c]).addClass(b._select.className)});this.iterator("table",function(a,d){l(c,"select",["cell",c.cells(c[d]).indexes().toArray()],!0)});return this});p("rows().deselect()","row().deselect()",function(){var a=this;this.iterator("row",function(a,b){a.aoData[b]._select_selected=!1;a._select_lastCell=null;e(a.aoData[b].nTr).removeClass(a._select.className)});
this.iterator("table",function(c,b){l(a,"deselect",["row",a[b]],!0)});return this});p("columns().deselect()","column().deselect()",function(){var a=this;this.iterator("column",function(a,b){a.aoColumns[b]._select_selected=!1;var d=new g.Api(a),f=d.column(b);e(f.header()).removeClass(a._select.className);e(f.footer()).removeClass(a._select.className);d.cells(null,b).indexes().each(function(b){var d=a.aoData[b.row],f=d._selected_cells;d.anCells&&(!f||!f[b.column])&&e(d.anCells[b.column]).removeClass(a._select.className)})});
this.iterator("table",function(c,b){l(a,"deselect",["column",a[b]],!0)});return this});p("cells().deselect()","cell().deselect()",function(){var a=this;this.iterator("cell",function(a,b,d){b=a.aoData[b];b._selected_cells[d]=!1;b.anCells&&!a.aoColumns[d]._select_selected&&e(b.anCells[d]).removeClass(a._select.className)});this.iterator("table",function(c,b){l(a,"deselect",["cell",a[b]],!0)});return this});var w=0;e.extend(g.ext.buttons,{selected:{text:r("selected","Selected"),className:"buttons-selected",
limitTo:["rows","columns","cells"],init:function(a,c,b){var d=this;b._eventNamespace=".select"+w++;a.on(v(b),function(){d.enable(-1!==e.inArray("rows",b.limitTo)&&a.rows({selected:!0}).any()||-1!==e.inArray("columns",b.limitTo)&&a.columns({selected:!0}).any()||-1!==e.inArray("cells",b.limitTo)&&a.cells({selected:!0}).any()?!0:!1)});this.disable()},destroy:function(a,c,b){a.off(b._eventNamespace)}},selectedSingle:{text:r("selectedSingle","Selected single"),className:"buttons-selected-single",init:function(a,
c,b){var d=this;b._eventNamespace=".select"+w++;a.on(v(b),function(){var b=a.rows({selected:!0}).flatten().length+a.columns({selected:!0}).flatten().length+a.cells({selected:!0}).flatten().length;d.enable(1===b)});this.disable()},destroy:function(a,c,b){a.off(b._eventNamespace)}},selectAll:{text:r("selectAll","Select all"),className:"buttons-select-all",action:function(){this[this.select.items()+"s"]().select()}},selectNone:{text:r("selectNone","Deselect all"),className:"buttons-select-none",action:function(){q(this.settings()[0],
!0)},init:function(a,c,b){var d=this;b._eventNamespace=".select"+w++;a.on(v(b),function(){var b=a.rows({selected:!0}).flatten().length+a.columns({selected:!0}).flatten().length+a.cells({selected:!0}).flatten().length;d.enable(0<b)});this.disable()},destroy:function(a,c,b){a.off(b._eventNamespace)}}});e.each(["Row","Column","Cell"],function(a,c){var b=c.toLowerCase();g.ext.buttons["select"+c+"s"]={text:r("select"+c+"s","Select "+b+"s"),className:"buttons-select-"+b+"s",action:function(){this.select.items(b)},
init:function(a){var c=this;a.on("selectItems.dt.DT",function(a,d,e){c.active(e===b)})}}});e(m).on("preInit.dt.dtSelect",function(a,c){"dt"===a.namespace&&g.select.init(new g.Api(c))});return g.select});
(function(h){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(r){return h(r,window,document)}):"object"===typeof exports?module.exports=function(r,v){r||(r=window);v&&v.fn.dataTable||(v=require("datatables.net")(r,v).$);return h(v,r,r.document)}:h(jQuery,window,document)})(function(h,r,v,l){function I(a,b,c){var d=function(g,f){if(g>f){var k=f;f=g;g=k}var n=!1;return a.columns(":visible").indexes().filter(function(q){q===g&&(n=!0);return q===f?(n=!1,!0):n})};var e=
function(g,f){var k=a.rows({search:"applied"}).indexes();if(k.indexOf(g)>k.indexOf(f)){var n=f;f=g;g=n}var q=!1;return k.filter(function(y){y===g&&(q=!0);return y===f?(q=!1,!0):q})};a.cells({selected:!0}).any()||c?(d=d(c.column,b.column),c=e(c.row,b.row)):(d=d(0,b.column),c=e(0,b.row));c=a.cells(c,d).flatten();a.cells(b,{selected:!0}).any()?a.cells(c).deselect():a.cells(c).select()}function C(a){var b=a.settings()[0]._select.selector;h(a.table().container()).off("mousedown.dtSelect",b).off("mouseup.dtSelect",
b).off("click.dtSelect",b);h("body").off("click.dtSelect"+D(a.table().node()))}function J(a){var b=h(a.table().container()),c=a.settings()[0],d=c._select.selector,e;b.on("mousedown.dtSelect",d,function(g){if(g.shiftKey||g.metaKey||g.ctrlKey)b.css("-moz-user-select","none").one("selectstart.dtSelect",d,function(){return!1});r.getSelection&&(e=r.getSelection())}).on("mouseup.dtSelect",d,function(){b.css("-moz-user-select","")}).on("click.dtSelect",d,function(g){var f=a.select.items();if(e){var k=r.getSelection();
if((!k.anchorNode||h(k.anchorNode).closest("table")[0]===a.table().node())&&k!==e)return}k=a.settings()[0];var n=a.settings()[0].oClasses.sWrapper.trim().replace(/ +/g,".");if(h(g.target).closest("div."+n)[0]==a.table().container()&&(n=a.cell(h(g.target).closest("td, th")),n.any())){var q=h.Event("user-select.dt");u(a,q,[f,n,g]);q.isDefaultPrevented()||(q=n.index(),"row"===f?(f=q.row,E(g,a,k,"row",f)):"column"===f?(f=n.index().column,E(g,a,k,"column",f)):"cell"===f&&(f=n.index(),E(g,a,k,"cell",f)),
k._select_lastCell=q)}});h("body").on("click.dtSelect"+D(a.table().node()),function(g){!c._select.blurable||h(g.target).parents().filter(a.table().container()).length||0===h(g.target).parents("html").length||h(g.target).parents("div.DTE").length||z(c,!0)})}function u(a,b,c,d){if(!d||a.flatten().length)"string"===typeof b&&(b+=".dt"),c.unshift(a),h(a.table().node()).trigger(b,c)}function N(a){var b=a.settings()[0];if(b._select.info&&b.aanFeatures.i&&"api"!==a.select.style()){var c=a.rows({selected:!0}).flatten().length,
d=a.columns({selected:!0}).flatten().length,e=a.cells({selected:!0}).flatten().length,g=function(f,k,n){f.append(h('<span class="select-item"/>').append(a.i18n("select."+k+"s",{_:"%d "+k+"s selected",0:"",1:"1 "+k+" selected"},n)))};h.each(b.aanFeatures.i,function(f,k){k=h(k);f=h('<span class="select-info"/>');g(f,"row",c);g(f,"column",d);g(f,"cell",e);var n=k.children("span.select-info");n.length&&n.remove();""!==f.text()&&k.append(f)})}}function O(a){var b=new m.Api(a);a._select_init=!0;a.aoRowCreatedCallback.push({fn:function(c,
d,e){d=a.aoData[e];d._select_selected&&h(c).addClass(a._select.className);c=0;for(e=a.aoColumns.length;c<e;c++)(a.aoColumns[c]._select_selected||d._selected_cells&&d._selected_cells[c])&&h(d.anCells[c]).addClass(a._select.className)},sName:"select-deferRender"});b.on("preXhr.dt.dtSelect",function(c,d){if(d===b.settings()[0]){var e=b.rows({selected:!0}).ids(!0).filter(function(f){return f!==l}),g=b.cells({selected:!0}).eq(0).map(function(f){var k=b.row(f.row).id(!0);return k?{row:k,column:f.column}:
l}).filter(function(f){return f!==l});b.one("draw.dt.dtSelect",function(){b.rows(e).select();g.any()&&g.each(function(f){b.cells(f.row,f.column).select()})})}});b.on("draw.dtSelect.dt select.dtSelect.dt deselect.dtSelect.dt info.dt",function(){N(b);b.state.save()});b.on("destroy.dtSelect",function(){b.rows({selected:!0}).deselect();C(b);b.off(".dtSelect");h("body").off(".dtSelect"+D(b.table().node()))})}function K(a,b,c,d){var e=a[b+"s"]({search:"applied"}).indexes();d=h.inArray(d,e);var g=h.inArray(c,
e);if(a[b+"s"]({selected:!0}).any()||-1!==d){if(d>g){var f=g;g=d;d=f}e.splice(g+1,e.length);e.splice(0,d)}else e.splice(h.inArray(c,e)+1,e.length);a[b](c,{selected:!0}).any()?(e.splice(h.inArray(c,e),1),a[b+"s"](e).deselect()):a[b+"s"](e).select()}function z(a,b){if(b||"single"===a._select.style)a=new m.Api(a),a.rows({selected:!0}).deselect(),a.columns({selected:!0}).deselect(),a.cells({selected:!0}).deselect()}function E(a,b,c,d,e){var g=b.select.style(),f=b.select.toggleable(),k=b[d](e,{selected:!0}).any();
if(!k||f)"os"===g?a.ctrlKey||a.metaKey?b[d](e).select(!k):a.shiftKey?"cell"===d?I(b,e,c._select_lastCell||null):K(b,d,e,c._select_lastCell?c._select_lastCell[d]:null):(a=b[d+"s"]({selected:!0}),k&&1===a.flatten().length?b[d](e).deselect():(a.deselect(),b[d](e).select())):"multi+shift"==g?a.shiftKey?"cell"===d?I(b,e,c._select_lastCell||null):K(b,d,e,c._select_lastCell?c._select_lastCell[d]:null):b[d](e).select(!k):b[d](e).select(!k)}function D(a){return a.id.replace(/[^a-zA-Z0-9\-_]/g,"-")}function A(a,
b){return function(c){return c.i18n("buttons."+a,b)}}function F(a){a=a._eventNamespace;return"draw.dt.DT"+a+" select.dt.DT"+a+" deselect.dt.DT"+a}function P(a,b){return-1!==h.inArray("rows",b.limitTo)&&a.rows({selected:!0}).any()||-1!==h.inArray("columns",b.limitTo)&&a.columns({selected:!0}).any()||-1!==h.inArray("cells",b.limitTo)&&a.cells({selected:!0}).any()?!0:!1}var m=h.fn.dataTable;m.select={};m.select.version="1.3.4-dev";m.select.init=function(a){var b=a.settings()[0];if(!b._select){var c=
a.state.loaded(),d=function(t,G,p){if(null!==p&&p.select!==l){a.rows().deselect();a.columns().deselect();a.cells().deselect();p.select.rows!==l&&a.rows(p.select.rows).select();p.select.columns!==l&&a.columns(p.select.columns).select();if(p.select.cells!==l)for(t=0;t<p.select.cells.length;t++)a.cell(p.select.cells[t].row,p.select.cells[t].column).select();a.state.save()}};a.one("init",function(){a.on("stateSaveParams",function(t,G,p){p.select={};p.select.rows=a.rows({selected:!0}).ids(!0).toArray();
p.select.columns=a.columns({selected:!0})[0];p.select.cells=a.cells({selected:!0})[0].map(function(L){return{row:a.row(L.row).id(!0),column:L.column}})});d(l,l,c);a.on("stateLoaded stateLoadParams",d)});var e=b.oInit.select,g=m.defaults.select;e=e===l?g:e;g="row";var f="api",k=!1,n=!0,q=!0,y="td, th",M="selected",B=!1;b._select={};!0===e?(f="os",B=!0):"string"===typeof e?(f=e,B=!0):h.isPlainObject(e)&&(e.blurable!==l&&(k=e.blurable),e.toggleable!==l&&(n=e.toggleable),e.info!==l&&(q=e.info),e.items!==
l&&(g=e.items),f=e.style!==l?e.style:"os",B=!0,e.selector!==l&&(y=e.selector),e.className!==l&&(M=e.className));a.select.selector(y);a.select.items(g);a.select.style(f);a.select.blurable(k);a.select.toggleable(n);a.select.info(q);b._select.className=M;h.fn.dataTable.ext.order["select-checkbox"]=function(t,G){return this.api().column(G,{order:"index"}).nodes().map(function(p){return"row"===t._select.items?h(p).parent().hasClass(t._select.className):"cell"===t._select.items?h(p).hasClass(t._select.className):
!1})};!B&&h(a.table().node()).hasClass("selectable")&&a.select.style("os")}};h.each([{type:"row",prop:"aoData"},{type:"column",prop:"aoColumns"}],function(a,b){m.ext.selector[b.type].push(function(c,d,e){d=d.selected;var g=[];if(!0!==d&&!1!==d)return e;for(var f=0,k=e.length;f<k;f++){var n=c[b.prop][e[f]];(!0===d&&!0===n._select_selected||!1===d&&!n._select_selected)&&g.push(e[f])}return g})});m.ext.selector.cell.push(function(a,b,c){b=b.selected;var d=[];if(b===l)return c;for(var e=0,g=c.length;e<
g;e++){var f=a.aoData[c[e].row];(!0===b&&f._selected_cells&&!0===f._selected_cells[c[e].column]||!(!1!==b||f._selected_cells&&f._selected_cells[c[e].column]))&&d.push(c[e])}return d});var w=m.Api.register,x=m.Api.registerPlural;w("select()",function(){return this.iterator("table",function(a){m.select.init(new m.Api(a))})});w("select.blurable()",function(a){return a===l?this.context[0]._select.blurable:this.iterator("table",function(b){b._select.blurable=a})});w("select.toggleable()",function(a){return a===
l?this.context[0]._select.toggleable:this.iterator("table",function(b){b._select.toggleable=a})});w("select.info()",function(a){return a===l?this.context[0]._select.info:this.iterator("table",function(b){b._select.info=a})});w("select.items()",function(a){return a===l?this.context[0]._select.items:this.iterator("table",function(b){b._select.items=a;u(new m.Api(b),"selectItems",[a])})});w("select.style()",function(a){return a===l?this.context[0]._select.style:this.iterator("table",function(b){b._select||
m.select.init(new m.Api(b));b._select_init||O(b);b._select.style=a;var c=new m.Api(b);C(c);"api"!==a&&J(c);u(new m.Api(b),"selectStyle",[a])})});w("select.selector()",function(a){return a===l?this.context[0]._select.selector:this.iterator("table",function(b){C(new m.Api(b));b._select.selector=a;"api"!==b._select.style&&J(new m.Api(b))})});x("rows().select()","row().select()",function(a){var b=this;if(!1===a)return this.deselect();this.iterator("row",function(c,d){z(c);c.aoData[d]._select_selected=
!0;h(c.aoData[d].nTr).addClass(c._select.className)});this.iterator("table",function(c,d){u(b,"select",["row",b[d]],!0)});return this});x("columns().select()","column().select()",function(a){var b=this;if(!1===a)return this.deselect();this.iterator("column",function(c,d){z(c);c.aoColumns[d]._select_selected=!0;d=(new m.Api(c)).column(d);h(d.header()).addClass(c._select.className);h(d.footer()).addClass(c._select.className);d.nodes().to$().addClass(c._select.className)});this.iterator("table",function(c,
d){u(b,"select",["column",b[d]],!0)});return this});x("cells().select()","cell().select()",function(a){var b=this;if(!1===a)return this.deselect();this.iterator("cell",function(c,d,e){z(c);d=c.aoData[d];d._selected_cells===l&&(d._selected_cells=[]);d._selected_cells[e]=!0;d.anCells&&h(d.anCells[e]).addClass(c._select.className)});this.iterator("table",function(c,d){u(b,"select",["cell",b.cells(b[d]).indexes().toArray()],!0)});return this});x("rows().deselect()","row().deselect()",function(){var a=
this;this.iterator("row",function(b,c){b.aoData[c]._select_selected=!1;b._select_lastCell=null;h(b.aoData[c].nTr).removeClass(b._select.className)});this.iterator("table",function(b,c){u(a,"deselect",["row",a[c]],!0)});return this});x("columns().deselect()","column().deselect()",function(){var a=this;this.iterator("column",function(b,c){b.aoColumns[c]._select_selected=!1;var d=new m.Api(b),e=d.column(c);h(e.header()).removeClass(b._select.className);h(e.footer()).removeClass(b._select.className);
d.cells(null,c).indexes().each(function(g){var f=b.aoData[g.row],k=f._selected_cells;!f.anCells||k&&k[g.column]||h(f.anCells[g.column]).removeClass(b._select.className)})});this.iterator("table",function(b,c){u(a,"deselect",["column",a[c]],!0)});return this});x("cells().deselect()","cell().deselect()",function(){var a=this;this.iterator("cell",function(b,c,d){c=b.aoData[c];c._selected_cells!==l&&(c._selected_cells[d]=!1);c.anCells&&!b.aoColumns[d]._select_selected&&h(c.anCells[d]).removeClass(b._select.className)});
this.iterator("table",function(b,c){u(a,"deselect",["cell",a[c]],!0)});return this});var H=0;h.extend(m.ext.buttons,{selected:{text:A("selected","Selected"),className:"buttons-selected",limitTo:["rows","columns","cells"],init:function(a,b,c){var d=this;c._eventNamespace=".select"+H++;a.on(F(c),function(){d.enable(P(a,c))});this.disable()},destroy:function(a,b,c){a.off(c._eventNamespace)}},selectedSingle:{text:A("selectedSingle","Selected single"),className:"buttons-selected-single",init:function(a,
b,c){var d=this;c._eventNamespace=".select"+H++;a.on(F(c),function(){var e=a.rows({selected:!0}).flatten().length+a.columns({selected:!0}).flatten().length+a.cells({selected:!0}).flatten().length;d.enable(1===e)});this.disable()},destroy:function(a,b,c){a.off(c._eventNamespace)}},selectAll:{text:A("selectAll","Select all"),className:"buttons-select-all",action:function(){this[this.select.items()+"s"]().select()}},selectNone:{text:A("selectNone","Deselect all"),className:"buttons-select-none",action:function(){z(this.settings()[0],
!0)},init:function(a,b,c){var d=this;c._eventNamespace=".select"+H++;a.on(F(c),function(){var e=a.rows({selected:!0}).flatten().length+a.columns({selected:!0}).flatten().length+a.cells({selected:!0}).flatten().length;d.enable(0<e)});this.disable()},destroy:function(a,b,c){a.off(c._eventNamespace)}}});h.each(["Row","Column","Cell"],function(a,b){var c=b.toLowerCase();m.ext.buttons["select"+b+"s"]={text:A("select"+b+"s","Select "+c+"s"),className:"buttons-select-"+c+"s",action:function(){this.select.items(c)},
init:function(d){var e=this;d.on("selectItems.dt.DT",function(g,f,k){e.active(k===c)})}}});h(v).on("preInit.dt.dtSelect",function(a,b){"dt"===a.namespace&&m.select.init(new m.Api(b))});return m.select});

@@ -0,1 +1,3 @@

The MIT License (MIT)
Copyright SpryMedia Limited and other contributors

@@ -20,2 +22,2 @@ http://datatables.net

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
{
"name": "datatables.net-select",
"version": "1.3.3",
"description": "Select for DataTables ",
"description": "Select for DataTables",
"main": "js/dataTables.select.js",
"types": "./types/types.d.ts",
"version": "1.3.4",
"files": [
"js/**/*.js"
"js/**/*.js",
"types/**/*.d.ts"
],
"main": "js/dataTables.select.js",
"type": "types.d.ts",
"keywords": [
"select",
"selection",
"DataTables",
"Datatables",
"jQuery",
"table",
"DataTables"
"filter",
"sort"
],
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"dependencies": {
"datatables.net": ">=1.11.3",
"jquery": ">=1.7"
},
"moduleType": [
"globals",
"amd",
"node"
],
"ignore": [
"composer.json",
"datatables.json",
"package.json"
],
"author": {

@@ -25,13 +38,9 @@ "name": "SpryMedia Ltd",

},
"dependencies": {
"jquery": ">=1.7",
"datatables.net": "^1.10.15"
},
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/DataTables/Dist-DataTables-Select.git"
},
"devDependencies": {
"@types/jquery": "^3.5.1"
}
}

@@ -20,2 +20,3 @@ # Select for DataTables

ES3 Syntax
```

@@ -26,2 +27,7 @@ var $ = require( 'jquery' );

ES6 Syntax
```
import 'datatables.net-select'
```
### bower

@@ -37,5 +43,4 @@

Full documentation of the DataTables options, API and plug-in interface are available on the DOCS_LINK. The site also contains information on the wide variety of plug-ins that are available for DataTables, which can be used to enhance and customise your table even further.
Full documentation and examples for Select can be found [on the website](https://datatables.net/extensions/select).
## Bug / Support

@@ -42,0 +47,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc