datatables.net-select
Advanced tools
Comparing version 1.7.0 to 2.0.0
@@ -1,2 +0,2 @@ | ||
/*! Select for DataTables 1.7.0 | ||
/*! Select for DataTables 2.0.0 | ||
* © SpryMedia Ltd - datatables.net/license/mit | ||
@@ -46,3 +46,3 @@ */ | ||
} | ||
}(function( $, window, document, undefined ) { | ||
}(function( $, window, document ) { | ||
'use strict'; | ||
@@ -56,3 +56,3 @@ var DataTable = $.fn.dataTable; | ||
DataTable.select.version = '1.7.0'; | ||
DataTable.select.version = '2.0.0'; | ||
@@ -62,2 +62,6 @@ DataTable.select.init = function (dt) { | ||
if (!DataTable.versionCheck('2')) { | ||
throw 'Warning: Select requires DataTables 2 or newer'; | ||
} | ||
if (ctx._select) { | ||
@@ -127,5 +131,8 @@ return; | ||
var className = 'selected'; | ||
var headerCheckbox = true; | ||
var setStyle = false; | ||
ctx._select = {}; | ||
ctx._select = { | ||
infoEls: [] | ||
}; | ||
@@ -174,2 +181,6 @@ // Initialisation customisations | ||
} | ||
if (opts.headerCheckbox !== undefined) { | ||
headerCheckbox = opts.headerCheckbox; | ||
} | ||
} | ||
@@ -185,18 +196,2 @@ | ||
// Sort table based on selected rows. Requires Select Datatables extension | ||
$.fn.dataTable.ext.order['select-checkbox'] = function (settings, col) { | ||
return this.api() | ||
.column(col, { order: 'index' }) | ||
.nodes() | ||
.map(function (td) { | ||
if (settings._select.items === 'row') { | ||
return $(td).parent().hasClass(settings._select.className); | ||
} | ||
else if (settings._select.items === 'cell') { | ||
return $(td).hasClass(settings._select.className); | ||
} | ||
return false; | ||
}); | ||
}; | ||
// If the init options haven't enabled select, but there is a selectable | ||
@@ -207,2 +202,12 @@ // class name, then enable | ||
} | ||
// Insert a checkbox into the header if needed - might need to wait | ||
// for init complete, or it might already be done | ||
if (headerCheckbox) { | ||
initCheckboxHeader(dt); | ||
dt.on('init', function () { | ||
initCheckboxHeader(dt); | ||
}); | ||
} | ||
}; | ||
@@ -259,2 +264,3 @@ | ||
information elements | ||
infoEls:element[] - List of HTML elements with info elements for a table | ||
} | ||
@@ -444,6 +450,6 @@ ``` | ||
var ctx = dt.settings()[0]; | ||
var wrapperClass = dt.settings()[0].oClasses.sWrapper.trim().replace(/ +/g, '.'); | ||
var container = dt.table().container(); | ||
// Ignore clicks inside a sub-table | ||
if ($(e.target).closest('div.' + wrapperClass)[0] != dt.table().container()) { | ||
if ($(e.target).closest('div.dt-container')[0] != container) { | ||
return; | ||
@@ -546,13 +552,7 @@ } | ||
*/ | ||
function info(api) { | ||
var ctx = api.settings()[0]; | ||
if (!ctx._select.info || !ctx.aanFeatures.i) { | ||
function info(api, node) { | ||
if (api.select.style() === 'api' || api.select.info() === false) { | ||
return; | ||
} | ||
if (api.select.style() === 'api') { | ||
return; | ||
} | ||
var rows = api.rows({ selected: true }).flatten().length; | ||
@@ -574,18 +574,77 @@ var columns = api.columns({ selected: true }).flatten().length; | ||
// Internal knowledge of DataTables to loop over all information elements | ||
$.each(ctx.aanFeatures.i, function (i, el) { | ||
el = $(el); | ||
var el = $(node); | ||
var output = $('<span class="select-info"/>'); | ||
var output = $('<span class="select-info"/>'); | ||
add(output, 'row', rows); | ||
add(output, 'column', columns); | ||
add(output, 'cell', cells); | ||
add(output, 'row', rows); | ||
add(output, 'column', columns); | ||
add(output, 'cell', cells); | ||
var exisiting = el.children('span.select-info'); | ||
if (exisiting.length) { | ||
exisiting.remove(); | ||
} | ||
var existing = el.children('span.select-info'); | ||
if (output.text() !== '') { | ||
el.append(output); | ||
if (existing.length) { | ||
existing.remove(); | ||
} | ||
if (output.text() !== '') { | ||
el.append(output); | ||
} | ||
} | ||
/** | ||
* Add a checkbox to the header for checkbox columns, allowing all rows to | ||
* be selected, deselected or just to show the state. | ||
* | ||
* @param {*} dt API | ||
*/ | ||
function initCheckboxHeader( dt ) { | ||
// Find any checkbox column(s) | ||
dt.columns('.dt-select').every(function () { | ||
var header = this.header(); | ||
if (! $('input', header).length) { | ||
// If no checkbox yet, insert one | ||
var input = $('<input>') | ||
.attr({ | ||
class: 'dt-select-checkbox', | ||
type: 'checkbox', | ||
'aria-label': dt.i18n('select.aria.headerCheckbox') || 'Select all rows' | ||
}) | ||
.appendTo(header) | ||
.on('change', function () { | ||
if (this.checked) { | ||
dt.rows({search: 'applied'}).select(); | ||
} | ||
else { | ||
dt.rows({selected: true}).deselect(); | ||
} | ||
}) | ||
.on('click', function (e) { | ||
e.stopPropagation(); | ||
}); | ||
// Update the header checkbox's state when the selection in the | ||
// table changes | ||
dt.on('draw select deselect', function (e, pass, type) { | ||
if (type === 'row' || ! type) { | ||
var count = dt.rows({selected: true}).count(); | ||
var search = dt.rows({search: 'applied', selected: true}).count(); | ||
var available = dt.rows({search: 'applied'}).count(); | ||
if (search && search <= count && search === available) { | ||
input | ||
.prop('checked', true) | ||
.prop('indeterminate', false); | ||
} | ||
else if (search === 0 && count === 0) { | ||
input | ||
.prop('checked', false) | ||
.prop('indeterminate', false); | ||
} | ||
else { | ||
input | ||
.prop('checked', false) | ||
.prop('indeterminate', true); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -616,4 +675,3 @@ }); | ||
// this code to create your own plug-ins, please do not do this! | ||
ctx.aoRowCreatedCallback.push({ | ||
fn: function (row, data, index) { | ||
ctx.aoRowCreatedCallback.push(function (row, data, index) { | ||
var i, ien; | ||
@@ -637,5 +695,4 @@ var d = ctx.aoData[index]; | ||
} | ||
}, | ||
sName: 'select-deferRender' | ||
}); | ||
} | ||
); | ||
@@ -684,4 +741,16 @@ // On Ajax reload we want to reselect all rows which are currently selected, | ||
// Update the table information element with selected item summary | ||
api.on('draw.dtSelect.dt select.dtSelect.dt deselect.dtSelect.dt info.dt', function () { | ||
info(api); | ||
api.on('info.dt', function (e, ctx, node) { | ||
// Store the info node for updating on select / deselect | ||
if (!ctx._select.infoEls.includes(node)) { | ||
ctx._select.infoEls.push(node); | ||
} | ||
info(api, node); | ||
}); | ||
api.on('select.dtSelect.dt deselect.dtSelect.dt', function () { | ||
ctx._select.infoEls.forEach(function (el) { | ||
info(api, el); | ||
}); | ||
api.state.save(); | ||
@@ -714,4 +783,4 @@ }); | ||
var indexes = dt[type + 's']({ search: 'applied' }).indexes(); | ||
var idx1 = $.inArray(last, indexes); | ||
var idx2 = $.inArray(idx, indexes); | ||
var idx1 = indexes.indexOf(last); | ||
var idx2 = indexes.indexOf(idx); | ||
@@ -721,3 +790,3 @@ if (!dt[type + 's']({ selected: true }).any() && idx1 === -1) { | ||
// do this | ||
indexes.splice($.inArray(idx, indexes) + 1, indexes.length); | ||
indexes.splice(indexes.indexOf(idx) + 1, indexes.length); | ||
} | ||
@@ -742,3 +811,3 @@ else { | ||
// Deselect range - need to keep the clicked on row selected | ||
indexes.splice($.inArray(idx, indexes), 1); | ||
indexes.splice(indexes.indexOf(idx), 1); | ||
dt[type + 's'](indexes).deselect(); | ||
@@ -870,4 +939,6 @@ } | ||
if ( | ||
(selected === true && data._select_selected === true) || | ||
(selected === false && !data._select_selected) | ||
data && ( | ||
(selected === true && data._select_selected === true) || | ||
(selected === false && !data._select_selected) | ||
) | ||
) { | ||
@@ -896,7 +967,9 @@ 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])) | ||
rowData && ( | ||
(selected === true && | ||
rowData._selected_cells && | ||
rowData._selected_cells[cells[i].column] === true) || | ||
(selected === false && | ||
(!rowData._selected_cells || !rowData._selected_cells[cells[i].column])) | ||
) | ||
) { | ||
@@ -1016,2 +1089,13 @@ out.push(cells[i]); | ||
apiRegister('select.last()', function (set) { | ||
let ctx = this.context[0]; | ||
if (set) { | ||
ctx._select_lastCell = set; | ||
return this; | ||
} | ||
return ctx._select_lastCell; | ||
}); | ||
apiRegisterPlural('rows().select()', 'row().select()', function (select) { | ||
@@ -1027,4 +1111,22 @@ var api = this; | ||
ctx.aoData[idx]._select_selected = true; | ||
$(ctx.aoData[idx].nTr).addClass(ctx._select.className); | ||
// There is a good amount of knowledge of DataTables internals in | ||
// this function. It _could_ be done without that, but it would hurt | ||
// performance (or DT would need new APIs for this work) | ||
var dtData = ctx.aoData[idx]; | ||
var dtColumns = ctx.aoColumns; | ||
$(dtData.nTr).addClass(ctx._select.className); | ||
dtData._select_selected = true; | ||
for (var i=0 ; i<dtColumns.length ; i++) { | ||
var col = dtColumns[i]; | ||
if (col.sType === 'select-checkbox') { | ||
// Make sure the checkbox shows the right state | ||
$('input.dt-select-checkbox', dtData.anCells[i]).prop('checked', true); | ||
// Invalidate the sort data for this column | ||
dtData._aSortData[i] = null; | ||
} | ||
} | ||
}); | ||
@@ -1134,5 +1236,21 @@ | ||
this.iterator('row', function (ctx, idx) { | ||
ctx.aoData[idx]._select_selected = false; | ||
// Like the select action, this has a lot of knowledge about DT internally | ||
var dtData = ctx.aoData[idx]; | ||
var dtColumns = ctx.aoColumns; | ||
$(dtData.nTr).removeClass(ctx._select.className); | ||
dtData._select_selected = false; | ||
ctx._select_lastCell = null; | ||
$(ctx.aoData[idx].nTr).removeClass(ctx._select.className); | ||
for (var i=0 ; i<dtColumns.length ; i++) { | ||
var col = dtColumns[i]; | ||
if (col.sType === 'select-checkbox') { | ||
// Make sure the checkbox shows the right state | ||
$('input.dt-select-checkbox', dtData.anCells[i]).prop('checked', false); | ||
// Invalidate the sort data for this column | ||
dtData._aSortData[i] = null; | ||
} | ||
} | ||
}); | ||
@@ -1223,11 +1341,11 @@ | ||
function enabled(dt, config) { | ||
if ($.inArray('rows', config.limitTo) !== -1 && dt.rows({ selected: true }).any()) { | ||
if (config.limitTo.indexOf('rows') !== -1 && dt.rows({ selected: true }).any()) { | ||
return true; | ||
} | ||
if ($.inArray('columns', config.limitTo) !== -1 && dt.columns({ selected: true }).any()) { | ||
if (config.limitTo.indexOf('columns') !== -1 && dt.columns({ selected: true }).any()) { | ||
return true; | ||
} | ||
if ($.inArray('cells', config.limitTo) !== -1 && dt.cells({ selected: true }).any()) { | ||
if (config.limitTo.indexOf('cells') !== -1 && dt.cells({ selected: true }).any()) { | ||
return true; | ||
@@ -1332,31 +1450,20 @@ } | ||
className: 'buttons-show-selected', | ||
action: function (e, dt, node, conf) { | ||
// Works by having a filtering function which will reduce to the selected | ||
// items only. So we can re-reference the function it gets stored in the | ||
// `conf` object | ||
if (conf._filter) { | ||
var idx = DataTable.ext.search.indexOf(conf._filter); | ||
action: function (e, dt) { | ||
if (dt.search.fixed('dt-select')) { | ||
// Remove existing function | ||
dt.search.fixed('dt-select', null); | ||
if (idx !== -1) { | ||
DataTable.ext.search.splice(idx, 1); | ||
conf._filter = null; | ||
} | ||
this.active(false); | ||
} | ||
else { | ||
var fn = function (s, data, idx) { | ||
// Need to be sure we are operating on our table! | ||
if (s !== dt.settings()[0]) { | ||
return true; | ||
} | ||
// Use a fixed filtering function to match on selected rows | ||
// This needs to reference the internal aoData since that is | ||
// where Select stores its reference for the selected state | ||
var dataSrc = dt.settings()[0].aoData; | ||
let row = s.aoData[idx]; | ||
dt.search.fixed('dt-select', function (text, data, idx) { | ||
// _select_selected is set by Select on the data object for the row | ||
return dataSrc[idx]._select_selected; | ||
}); | ||
return row._select_selected; | ||
}; | ||
conf._filter = fn; | ||
DataTable.ext.search.push(fn); | ||
this.active(true); | ||
@@ -1389,2 +1496,70 @@ } | ||
DataTable.type('select-checkbox', { | ||
className: 'dt-select', | ||
detect: function (data) { | ||
// Rendering function will tell us if it is a checkbox type | ||
return data === 'select-checkbox' ? data : false; | ||
}, | ||
order: { | ||
pre: function (d) { | ||
return d === 'X' ? -1 : 0; | ||
} | ||
} | ||
}); | ||
$.extend(true, DataTable.defaults.oLanguage, { | ||
select: { | ||
aria: { | ||
rowCheckbox: 'Select row' | ||
} | ||
} | ||
}); | ||
DataTable.render.select = function (valueProp, nameProp) { | ||
var valueFn = valueProp ? DataTable.util.get(valueProp) : null; | ||
var nameFn = nameProp ? DataTable.util.get(nameProp) : null; | ||
return function (data, type, row, meta) { | ||
var dtRow = meta.settings.aoData[meta.row]; | ||
var selected = dtRow._select_selected; | ||
var ariaLabel = meta.settings.oLanguage.select.aria.rowCheckbox; | ||
if (type === 'display') { | ||
return $('<input>') | ||
.attr({ | ||
'aria-label': ariaLabel, | ||
class: 'dt-select-checkbox', | ||
name: nameFn ? nameFn(row) : null, | ||
type: 'checkbox', | ||
value: valueFn ? valueFn(row) : null, | ||
checked: selected | ||
})[0]; | ||
} | ||
else if (type === 'type') { | ||
return 'select-checkbox'; | ||
} | ||
else if (type === 'filter') { | ||
return ''; | ||
} | ||
return selected ? 'X' : ''; | ||
} | ||
} | ||
// Legacy checkbox ordering | ||
DataTable.ext.order['select-checkbox'] = function (settings, col) { | ||
return this.api() | ||
.column(col, { order: 'index' }) | ||
.nodes() | ||
.map(function (td) { | ||
if (settings._select.items === 'row') { | ||
return $(td).parent().hasClass(settings._select.className); | ||
} | ||
else if (settings._select.items === 'cell') { | ||
return $(td).hasClass(settings._select.className); | ||
} | ||
return false; | ||
}); | ||
}; | ||
$.fn.DataTable.select = DataTable.select; | ||
@@ -1391,0 +1566,0 @@ |
@@ -1,4 +0,4 @@ | ||
/*! Select for DataTables 1.7.0 | ||
/*! Select for DataTables 2.0.0 | ||
* © SpryMedia Ltd - datatables.net/license/mit | ||
*/ | ||
!function(l){var s,c;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return l(e,window,document)}):"object"==typeof exports?(s=require("jquery"),c=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||s(e),c(e,t),l(t,e,e.document)}:(c(window,s),module.exports=l(s,window,window.document))):l(jQuery,window,document)}(function(m,i,e,h){"use strict";var _=m.fn.dataTable;function r(n,e,t){function l(t,l){l<t&&(e=l,l=t,t=e);var e,s=!1;return n.columns(":visible").indexes().filter(function(e){return e===t&&(s=!0),e===l?!(s=!1):s})}function s(t,l){var e,s=n.rows({search:"applied"}).indexes(),c=(s.indexOf(t)>s.indexOf(l)&&(e=l,l=t,t=e),!1);return s.filter(function(e){return e===t&&(c=!0),e===l?!(c=!1):c})}var c,t=n.cells({selected:!0}).any()||t?(c=l(t.column,e.column),s(t.row,e.row)):(c=l(0,e.column),s(0,e.row)),t=n.cells(t,c).flatten();n.cells(e,{selected:!0}).any()?n.cells(t).deselect():n.cells(t).select()}function s(e){var t=e.settings()[0]._select.selector;m(e.table().container()).off("mousedown.dtSelect",t).off("mouseup.dtSelect",t).off("click.dtSelect",t),m("body").off("click.dtSelect"+p(e.table().node()))}function c(o){var a,t=m(o.table().container()),l=o.settings()[0],s=l._select.selector;t.on("mousedown.dtSelect",s,function(e){(e.shiftKey||e.metaKey||e.ctrlKey)&&t.css("-moz-user-select","none").one("selectstart.dtSelect",s,function(){return!1}),i.getSelection&&(a=i.getSelection())}).on("mouseup.dtSelect",s,function(){t.css("-moz-user-select","")}).on("click.dtSelect",s,function(e){var t,l=o.select.items();if(a){var s=i.getSelection();if((!s.anchorNode||m(s.anchorNode).closest("table")[0]===o.table().node())&&s!==a)return}var c,s=o.settings()[0],n=o.settings()[0].oClasses.sWrapper.trim().replace(/ +/g,".");m(e.target).closest("div."+n)[0]==o.table().container()&&(n=o.cell(m(e.target).closest("td, th"))).any()&&(c=m.Event("user-select.dt"),u(o,c,[l,n,e]),c.isDefaultPrevented()||(c=n.index(),"row"===l?(t=c.row,w(e,o,s,"row",t)):"column"===l?(t=n.index().column,w(e,o,s,"column",t)):"cell"===l&&(t=n.index(),w(e,o,s,"cell",t)),s._select_lastCell=c))}),m("body").on("click.dtSelect"+p(o.table().node()),function(e){var t;!l._select.blurable||m(e.target).parents().filter(o.table().container()).length||0===m(e.target).parents("html").length||m(e.target).parents("div.DTE").length||(t=m.Event("select-blur.dt"),u(o,t,[e.target,e]),t.isDefaultPrevented()||f(l,!0))})}function u(e,t,l,s){s&&!e.flatten().length||("string"==typeof t&&(t+=".dt"),l.unshift(e),m(e.table().node()).trigger(t,l))}function n(o){var i=new _.Api(o);o._select_init=!0,o.aoRowCreatedCallback.push({fn:function(e,t,l){var s,c,n=o.aoData[l];for(n._select_selected&&m(e).addClass(o._select.className),s=0,c=o.aoColumns.length;s<c;s++)(o.aoColumns[s]._select_selected||n._selected_cells&&n._selected_cells[s])&&m(n.anCells[s]).addClass(o._select.className)},sName:"select-deferRender"}),i.on("preXhr.dt.dtSelect",function(e,t){var l,s;t===i.settings()[0]&&(l=i.rows({selected:!0}).ids(!0).filter(function(e){return e!==h}),s=i.cells({selected:!0}).eq(0).map(function(e){var t=i.row(e.row).id(!0);return t?{row:t,column:e.column}:h}).filter(function(e){return e!==h}),i.one("draw.dt.dtSelect",function(){i.rows(l).select(),s.any()&&s.each(function(e){i.cells(e.row,e.column).select()})}))}),i.on("draw.dtSelect.dt select.dtSelect.dt deselect.dtSelect.dt info.dt",function(){var s,c,n,o,a,e;(e=(s=i).settings()[0])._select.info&&e.aanFeatures.i&&"api"!==s.select.style()&&(c=s.rows({selected:!0}).flatten().length,n=s.columns({selected:!0}).flatten().length,o=s.cells({selected:!0}).flatten().length,a=function(e,t,l){e.append(m('<span class="select-item"/>').append(s.i18n("select."+t+"s",{_:"%d "+t+"s selected",0:"",1:"1 "+t+" selected"},l)))},m.each(e.aanFeatures.i,function(e,t){t=m(t);var l=m('<span class="select-info"/>'),s=(a(l,"row",c),a(l,"column",n),a(l,"cell",o),t.children("span.select-info"));s.length&&s.remove(),""!==l.text()&&t.append(l)})),i.state.save()}),i.on("destroy.dtSelect",function(){m(i.rows({selected:!0}).nodes()).removeClass(i.settings()[0]._select.className),s(i),i.off(".dtSelect"),m("body").off(".dtSelect"+p(i.table().node()))})}function d(e,t,l,s){var c,n=e[t+"s"]({search:"applied"}).indexes(),s=m.inArray(s,n),o=m.inArray(l,n);e[t+"s"]({selected:!0}).any()||-1!==s?(o<s&&(c=o,o=s,s=c),n.splice(o+1,n.length),n.splice(0,s)):n.splice(m.inArray(l,n)+1,n.length),e[t](l,{selected:!0}).any()?(n.splice(m.inArray(l,n),1),e[t+"s"](n).deselect()):e[t+"s"](n).select()}function f(e,t){!t&&"single"!==e._select.style||((t=new _.Api(e)).rows({selected:!0}).deselect(),t.columns({selected:!0}).deselect(),t.cells({selected:!0}).deselect())}function w(e,t,l,s,c){var n=t.select.style(),o=t.select.toggleable(),a=t[s](c,{selected:!0}).any();a&&!o||("os"===n?e.ctrlKey||e.metaKey?t[s](c).select(!a):e.shiftKey?"cell"===s?r(t,c,l._select_lastCell||null):d(t,s,c,l._select_lastCell?l._select_lastCell[s]:null):(o=t[s+"s"]({selected:!0}),a&&1===o.flatten().length?t[s](c).deselect():(o.deselect(),t[s](c).select())):"multi+shift"==n&&e.shiftKey?"cell"===s?r(t,c,l._select_lastCell||null):d(t,s,c,l._select_lastCell?l._select_lastCell[s]:null):t[s](c).select(!a))}function p(e){return e.id.replace(/[^a-zA-Z0-9\-\_]/g,"-")}_.select={},_.select.version="1.7.0",_.select.init=function(c){var e,t,l,s,n,o,a,i,r,u,d,f=c.settings()[0];f._select||(e=c.state.loaded(),t=function(e,t,l){if(null!==l&&l.select!==h){if(c.rows({selected:!0}).any()&&c.rows().deselect(),l.select.rows!==h&&c.rows(l.select.rows).select(),c.columns({selected:!0}).any()&&c.columns().deselect(),l.select.columns!==h&&c.columns(l.select.columns).select(),c.cells({selected:!0}).any()&&c.cells().deselect(),l.select.cells!==h)for(var s=0;s<l.select.cells.length;s++)c.cell(l.select.cells[s].row,l.select.cells[s].column).select();c.state.save()}},c.on("stateSaveParams",function(e,t,l){l.select={},l.select.rows=c.rows({selected:!0}).ids(!0).toArray(),l.select.columns=c.columns({selected:!0})[0],l.select.cells=c.cells({selected:!0})[0].map(function(e){return{row:c.row(e.row).id(!0),column:e.column}})}).on("stateLoadParams",t).one("init",function(){t(0,0,e)}),s=f.oInit.select,l=_.defaults.select,l=s===h?l:s,s="row",i=a=!(o=!(n="api")),r="td, th",d=!(u="selected"),f._select={},!0===l?(n="os",d=!0):"string"==typeof l?(n=l,d=!0):m.isPlainObject(l)&&(l.blurable!==h&&(o=l.blurable),l.toggleable!==h&&(a=l.toggleable),l.info!==h&&(i=l.info),l.items!==h&&(s=l.items),d=(n=l.style!==h?l.style:"os",!0),l.selector!==h&&(r=l.selector),l.className!==h&&(u=l.className)),c.select.selector(r),c.select.items(s),c.select.style(n),c.select.blurable(o),c.select.toggleable(a),c.select.info(i),f._select.className=u,m.fn.dataTable.ext.order["select-checkbox"]=function(t,e){return this.api().column(e,{order:"index"}).nodes().map(function(e){return"row"===t._select.items?m(e).parent().hasClass(t._select.className):"cell"===t._select.items&&m(e).hasClass(t._select.className)})},!d&&m(c.table().node()).hasClass("selectable")&&c.select.style("os"))},m.each([{type:"row",prop:"aoData"},{type:"column",prop:"aoColumns"}],function(e,i){_.ext.selector[i.type].push(function(e,t,l){var s,c=t.selected,n=[];if(!0!==c&&!1!==c)return l;for(var o=0,a=l.length;o<a;o++)s=e[i.prop][l[o]],(!0===c&&!0===s._select_selected||!1===c&&!s._select_selected)&&n.push(l[o]);return n})}),_.ext.selector.cell.push(function(e,t,l){var s,c=t.selected,n=[];if(c===h)return l;for(var o=0,a=l.length;o<a;o++)s=e.aoData[l[o].row],(!0!==c||!s._selected_cells||!0!==s._selected_cells[l[o].column])&&(!1!==c||s._selected_cells&&s._selected_cells[l[o].column])||n.push(l[o]);return n});var t=_.Api.register,l=_.Api.registerPlural;function o(t,l){return function(e){return e.i18n("buttons."+t,l)}}function a(e){e=e._eventNamespace;return"draw.dt.DT"+e+" select.dt.DT"+e+" deselect.dt.DT"+e}t("select()",function(){return this.iterator("table",function(e){_.select.init(new _.Api(e))})}),t("select.blurable()",function(t){return t===h?this.context[0]._select.blurable:this.iterator("table",function(e){e._select.blurable=t})}),t("select.toggleable()",function(t){return t===h?this.context[0]._select.toggleable:this.iterator("table",function(e){e._select.toggleable=t})}),t("select.info()",function(t){return t===h?this.context[0]._select.info:this.iterator("table",function(e){e._select.info=t})}),t("select.items()",function(t){return t===h?this.context[0]._select.items:this.iterator("table",function(e){e._select.items=t,u(new _.Api(e),"selectItems",[t])})}),t("select.style()",function(l){return l===h?this.context[0]._select.style:this.iterator("table",function(e){e._select||_.select.init(new _.Api(e)),e._select_init||n(e),e._select.style=l;var t=new _.Api(e);s(t),"api"!==l&&c(t),u(new _.Api(e),"selectStyle",[l])})}),t("select.selector()",function(t){return t===h?this.context[0]._select.selector:this.iterator("table",function(e){s(new _.Api(e)),e._select.selector=t,"api"!==e._select.style&&c(new _.Api(e))})}),l("rows().select()","row().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("row",function(e,t){f(e),e.aoData[t]._select_selected=!0,m(e.aoData[t].nTr).addClass(e._select.className)}),this.iterator("table",function(e,t){u(l,"select",["row",l[t]],!0)}),this)}),t("row().selected()",function(){var e=this.context[0];return!!(e&&this.length&&e.aoData[this[0]]&&e.aoData[this[0]]._select_selected)}),l("columns().select()","column().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("column",function(e,t){f(e),e.aoColumns[t]._select_selected=!0;t=new _.Api(e).column(t);m(t.header()).addClass(e._select.className),m(t.footer()).addClass(e._select.className),t.nodes().to$().addClass(e._select.className)}),this.iterator("table",function(e,t){u(l,"select",["column",l[t]],!0)}),this)}),t("column().selected()",function(){var e=this.context[0];return!!(e&&this.length&&e.aoColumns[this[0]]&&e.aoColumns[this[0]]._select_selected)}),l("cells().select()","cell().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("cell",function(e,t,l){f(e);t=e.aoData[t];t._selected_cells===h&&(t._selected_cells=[]),t._selected_cells[l]=!0,t.anCells&&m(t.anCells[l]).addClass(e._select.className)}),this.iterator("table",function(e,t){u(l,"select",["cell",l.cells(l[t]).indexes().toArray()],!0)}),this)}),t("cell().selected()",function(){var e=this.context[0];if(e&&this.length){e=e.aoData[this[0][0].row];if(e&&e._selected_cells&&e._selected_cells[this[0][0].column])return!0}return!1}),l("rows().deselect()","row().deselect()",function(){var l=this;return this.iterator("row",function(e,t){e.aoData[t]._select_selected=!1,e._select_lastCell=null,m(e.aoData[t].nTr).removeClass(e._select.className)}),this.iterator("table",function(e,t){u(l,"deselect",["row",l[t]],!0)}),this}),l("columns().deselect()","column().deselect()",function(){var l=this;return this.iterator("column",function(s,e){s.aoColumns[e]._select_selected=!1;var t=new _.Api(s),l=t.column(e);m(l.header()).removeClass(s._select.className),m(l.footer()).removeClass(s._select.className),t.cells(null,e).indexes().each(function(e){var t=s.aoData[e.row],l=t._selected_cells;!t.anCells||l&&l[e.column]||m(t.anCells[e.column]).removeClass(s._select.className)})}),this.iterator("table",function(e,t){u(l,"deselect",["column",l[t]],!0)}),this}),l("cells().deselect()","cell().deselect()",function(){var l=this;return this.iterator("cell",function(e,t,l){t=e.aoData[t];t._selected_cells!==h&&(t._selected_cells[l]=!1),t.anCells&&!e.aoColumns[l]._select_selected&&m(t.anCells[l]).removeClass(e._select.className)}),this.iterator("table",function(e,t){u(l,"deselect",["cell",l[t]],!0)}),this});var v=0;return m.extend(_.ext.buttons,{selected:{text:o("selected","Selected"),className:"buttons-selected",limitTo:["rows","columns","cells"],init:function(l,e,s){var c=this;s._eventNamespace=".select"+v++,l.on(a(s),function(){var e,t;c.enable((e=l,t=s,!(-1===m.inArray("rows",t.limitTo)||!e.rows({selected:!0}).any())||(!(-1===m.inArray("columns",t.limitTo)||!e.columns({selected:!0}).any())||!(-1===m.inArray("cells",t.limitTo)||!e.cells({selected:!0}).any()))))}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},selectedSingle:{text:o("selectedSingle","Selected single"),className:"buttons-selected-single",init:function(t,e,l){var s=this;l._eventNamespace=".select"+v++,t.on(a(l),function(){var e=t.rows({selected:!0}).flatten().length+t.columns({selected:!0}).flatten().length+t.cells({selected:!0}).flatten().length;s.enable(1===e)}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},selectAll:{text:o("selectAll","Select all"),className:"buttons-select-all",action:function(e,t,l,s){var c=this.select.items(),n=s.selectorModifier;(n?("function"==typeof n&&(n=n.call(t,e,t,l,s)),this[c+"s"](n)):this[c+"s"]()).select()}},selectNone:{text:o("selectNone","Deselect all"),className:"buttons-select-none",action:function(){f(this.settings()[0],!0)},init:function(t,e,l){var s=this;l._eventNamespace=".select"+v++,t.on(a(l),function(){var e=t.rows({selected:!0}).flatten().length+t.columns({selected:!0}).flatten().length+t.cells({selected:!0}).flatten().length;s.enable(0<e)}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},showSelected:{text:o("showSelected","Show only selected"),className:"buttons-show-selected",action:function(e,s,t,l){var c;l._filter?(-1!==(c=_.ext.search.indexOf(l._filter))&&(_.ext.search.splice(c,1),l._filter=null),this.active(!1)):(l._filter=c=function(e,t,l){return e!==s.settings()[0]||e.aoData[l]._select_selected},_.ext.search.push(c),this.active(!0)),s.draw()}}}),m.each(["Row","Column","Cell"],function(e,t){var c=t.toLowerCase();_.ext.buttons["select"+t+"s"]={text:o("select"+t+"s","Select "+c+"s"),className:"buttons-select-"+c+"s",action:function(){this.select.items(c)},init:function(e){var s=this;e.on("selectItems.dt.DT",function(e,t,l){s.active(l===c)})}}}),m.fn.DataTable.select=_.select,m(e).on("preInit.dt.dtSelect",function(e,t){"dt"===e.namespace&&_.select.init(new _.Api(t))}),_}); | ||
!function(l){var s,c;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return l(e,window,document)}):"object"==typeof exports?(s=require("jquery"),c=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||s(e),c(e,t),l(t,e,e.document)}:(c(window,s),module.exports=l(s,window,window.document))):l(jQuery,window,document)}(function(m,i,e){"use strict";var _=m.fn.dataTable;function r(n,e,t){function l(t,l){l<t&&(e=l,l=t,t=e);var e,s=!1;return n.columns(":visible").indexes().filter(function(e){return e===t&&(s=!0),e===l?!(s=!1):s})}function s(t,l){var e,s=n.rows({search:"applied"}).indexes(),c=(s.indexOf(t)>s.indexOf(l)&&(e=l,l=t,t=e),!1);return s.filter(function(e){return e===t&&(c=!0),e===l?!(c=!1):c})}var c,t=n.cells({selected:!0}).any()||t?(c=l(t.column,e.column),s(t.row,e.row)):(c=l(0,e.column),s(0,e.row)),t=n.cells(t,c).flatten();n.cells(e,{selected:!0}).any()?n.cells(t).deselect():n.cells(t).select()}function s(e){var t=e.settings()[0]._select.selector;m(e.table().container()).off("mousedown.dtSelect",t).off("mouseup.dtSelect",t).off("click.dtSelect",t),m("body").off("click.dtSelect"+v(e.table().node()))}function n(o){var a,t=m(o.table().container()),l=o.settings()[0],s=l._select.selector;t.on("mousedown.dtSelect",s,function(e){(e.shiftKey||e.metaKey||e.ctrlKey)&&t.css("-moz-user-select","none").one("selectstart.dtSelect",s,function(){return!1}),i.getSelection&&(a=i.getSelection())}).on("mouseup.dtSelect",s,function(){t.css("-moz-user-select","")}).on("click.dtSelect",s,function(e){var t,l=o.select.items();if(a){var s=i.getSelection();if((!s.anchorNode||m(s.anchorNode).closest("table")[0]===o.table().node())&&s!==a)return}var c,s=o.settings()[0],n=o.table().container();m(e.target).closest("div.dt-container")[0]==n&&(n=o.cell(m(e.target).closest("td, th"))).any()&&(c=m.Event("user-select.dt"),d(o,c,[l,n,e]),c.isDefaultPrevented()||(c=n.index(),"row"===l?(t=c.row,h(e,o,s,"row",t)):"column"===l?(t=n.index().column,h(e,o,s,"column",t)):"cell"===l&&(t=n.index(),h(e,o,s,"cell",t)),s._select_lastCell=c))}),m("body").on("click.dtSelect"+v(o.table().node()),function(e){var t;!l._select.blurable||m(e.target).parents().filter(o.table().container()).length||0===m(e.target).parents("html").length||m(e.target).parents("div.DTE").length||(t=m.Event("select-blur.dt"),d(o,t,[e.target,e]),t.isDefaultPrevented())||f(l,!0)})}function d(e,t,l,s){s&&!e.flatten().length||("string"==typeof t&&(t+=".dt"),l.unshift(e),m(e.table().node()).trigger(t,l))}function a(s,e){var t,l,c,n,o;"api"!==s.select.style()&&!1!==s.select.info()&&(o=s.rows({selected:!0}).flatten().length,t=s.columns({selected:!0}).flatten().length,l=s.cells({selected:!0}).flatten().length,c=function(e,t,l){e.append(m('<span class="select-item"/>').append(s.i18n("select."+t+"s",{_:"%d "+t+"s selected",0:"",1:"1 "+t+" selected"},l)))},e=m(e),c(n=m('<span class="select-info"/>'),"row",o),c(n,"column",t),c(n,"cell",l),(o=e.children("span.select-info")).length&&o.remove(),""!==n.text())&&e.append(n)}function p(o){o.columns(".dt-select").every(function(){var n,e=this.header();m("input",e).length||(n=m("<input>").attr({class:"dt-select-checkbox",type:"checkbox","aria-label":o.i18n("select.aria.headerCheckbox")||"Select all rows"}).appendTo(e).on("change",function(){this.checked?o.rows({search:"applied"}).select():o.rows({selected:!0}).deselect()}).on("click",function(e){e.stopPropagation()}),o.on("draw select deselect",function(e,t,l){var s,c;"row"!==l&&l||(l=o.rows({selected:!0}).count(),s=o.rows({search:"applied",selected:!0}).count(),c=o.rows({search:"applied"}).count(),s&&s<=l&&s===c?n.prop("checked",!0).prop("indeterminate",!1):0===s&&0===l?n.prop("checked",!1).prop("indeterminate",!1):n.prop("checked",!1).prop("indeterminate",!0))}))})}function u(e,t,l,s){var c,n=e[t+"s"]({search:"applied"}).indexes(),s=n.indexOf(s),o=n.indexOf(l);e[t+"s"]({selected:!0}).any()||-1!==s?(o<s&&(c=o,o=s,s=c),n.splice(o+1,n.length),n.splice(0,s)):n.splice(n.indexOf(l)+1,n.length),e[t](l,{selected:!0}).any()?(n.splice(n.indexOf(l),1),e[t+"s"](n).deselect()):e[t+"s"](n).select()}function f(e,t){!t&&"single"!==e._select.style||((t=new _.Api(e)).rows({selected:!0}).deselect(),t.columns({selected:!0}).deselect(),t.cells({selected:!0}).deselect())}function h(e,t,l,s,c){var n=t.select.style(),o=t.select.toggleable(),a=t[s](c,{selected:!0}).any();a&&!o||("os"===n?e.ctrlKey||e.metaKey?t[s](c).select(!a):e.shiftKey?"cell"===s?r(t,c,l._select_lastCell||null):u(t,s,c,l._select_lastCell?l._select_lastCell[s]:null):(o=t[s+"s"]({selected:!0}),a&&1===o.flatten().length?t[s](c).deselect():(o.deselect(),t[s](c).select())):"multi+shift"==n&&e.shiftKey?"cell"===s?r(t,c,l._select_lastCell||null):u(t,s,c,l._select_lastCell?l._select_lastCell[s]:null):t[s](c).select(!a))}function v(e){return e.id.replace(/[^a-zA-Z0-9\-\_]/g,"-")}_.select={},_.select.version="2.0.0",_.select.init=function(c){var e,t,l,s,n,o,a,i,r,d,u,f,h=c.settings()[0];if(!_.versionCheck("2"))throw"Warning: Select requires DataTables 2 or newer";h._select||(e=c.state.loaded(),t=function(e,t,l){if(null!==l&&void 0!==l.select){if(c.rows({selected:!0}).any()&&c.rows().deselect(),void 0!==l.select.rows&&c.rows(l.select.rows).select(),c.columns({selected:!0}).any()&&c.columns().deselect(),void 0!==l.select.columns&&c.columns(l.select.columns).select(),c.cells({selected:!0}).any()&&c.cells().deselect(),void 0!==l.select.cells)for(var s=0;s<l.select.cells.length;s++)c.cell(l.select.cells[s].row,l.select.cells[s].column).select();c.state.save()}},c.on("stateSaveParams",function(e,t,l){l.select={},l.select.rows=c.rows({selected:!0}).ids(!0).toArray(),l.select.columns=c.columns({selected:!0})[0],l.select.cells=c.cells({selected:!0})[0].map(function(e){return{row:c.row(e.row).id(!0),column:e.column}})}).on("stateLoadParams",t).one("init",function(){t(0,0,e)}),s=h.oInit.select,l=_.defaults.select,l=void 0===s?l:s,s="row",r="td, th",d="selected",f=!(u=i=a=!(o=!(n="api"))),h._select={infoEls:[]},!0===l?(n="os",f=!0):"string"==typeof l?(n=l,f=!0):m.isPlainObject(l)&&(void 0!==l.blurable&&(o=l.blurable),void 0!==l.toggleable&&(a=l.toggleable),void 0!==l.info&&(i=l.info),void 0!==l.items&&(s=l.items),f=(n=void 0!==l.style?l.style:"os",!0),void 0!==l.selector&&(r=l.selector),void 0!==l.className&&(d=l.className),void 0!==l.headerCheckbox)&&(u=l.headerCheckbox),c.select.selector(r),c.select.items(s),c.select.style(n),c.select.blurable(o),c.select.toggleable(a),c.select.info(i),h._select.className=d,!f&&m(c.table().node()).hasClass("selectable")&&c.select.style("os"),u&&(p(c),c.on("init",function(){p(c)})))},m.each([{type:"row",prop:"aoData"},{type:"column",prop:"aoColumns"}],function(e,i){_.ext.selector[i.type].push(function(e,t,l){var s,c=t.selected,n=[];if(!0!==c&&!1!==c)return l;for(var o=0,a=l.length;o<a;o++)(s=e[i.prop][l[o]])&&(!0===c&&!0===s._select_selected||!1===c&&!s._select_selected)&&n.push(l[o]);return n})}),_.ext.selector.cell.push(function(e,t,l){var s,c=t.selected,n=[];if(void 0===c)return l;for(var o=0,a=l.length;o<a;o++)(s=e.aoData[l[o].row])&&(!0===c&&s._selected_cells&&!0===s._selected_cells[l[o].column]||!1===c&&(!s._selected_cells||!s._selected_cells[l[o].column]))&&n.push(l[o]);return n});var t=_.Api.register,l=_.Api.registerPlural;function o(t,l){return function(e){return e.i18n("buttons."+t,l)}}function w(e){e=e._eventNamespace;return"draw.dt.DT"+e+" select.dt.DT"+e+" deselect.dt.DT"+e}t("select()",function(){return this.iterator("table",function(e){_.select.init(new _.Api(e))})}),t("select.blurable()",function(t){return void 0===t?this.context[0]._select.blurable:this.iterator("table",function(e){e._select.blurable=t})}),t("select.toggleable()",function(t){return void 0===t?this.context[0]._select.toggleable:this.iterator("table",function(e){e._select.toggleable=t})}),t("select.info()",function(t){return void 0===t?this.context[0]._select.info:this.iterator("table",function(e){e._select.info=t})}),t("select.items()",function(t){return void 0===t?this.context[0]._select.items:this.iterator("table",function(e){e._select.items=t,d(new _.Api(e),"selectItems",[t])})}),t("select.style()",function(l){return void 0===l?this.context[0]._select.style:this.iterator("table",function(e){e._select||_.select.init(new _.Api(e)),e._select_init||(o=e,c=new _.Api(o),o._select_init=!0,o.aoRowCreatedCallback.push(function(e,t,l){var s,c,n=o.aoData[l];for(n._select_selected&&m(e).addClass(o._select.className),s=0,c=o.aoColumns.length;s<c;s++)(o.aoColumns[s]._select_selected||n._selected_cells&&n._selected_cells[s])&&m(n.anCells[s]).addClass(o._select.className)}),c.on("preXhr.dt.dtSelect",function(e,t){var l,s;t===c.settings()[0]&&(l=c.rows({selected:!0}).ids(!0).filter(function(e){return void 0!==e}),s=c.cells({selected:!0}).eq(0).map(function(e){var t=c.row(e.row).id(!0);return t?{row:t,column:e.column}:void 0}).filter(function(e){return void 0!==e}),c.one("draw.dt.dtSelect",function(){c.rows(l).select(),s.any()&&s.each(function(e){c.cells(e.row,e.column).select()})}))}),c.on("info.dt",function(e,t,l){t._select.infoEls.includes(l)||t._select.infoEls.push(l),a(c,l)}),c.on("select.dtSelect.dt deselect.dtSelect.dt",function(){o._select.infoEls.forEach(function(e){a(c,e)}),c.state.save()}),c.on("destroy.dtSelect",function(){m(c.rows({selected:!0}).nodes()).removeClass(c.settings()[0]._select.className),s(c),c.off(".dtSelect"),m("body").off(".dtSelect"+v(c.table().node()))})),e._select.style=l;var o,c,t=new _.Api(e);s(t),"api"!==l&&n(t),d(new _.Api(e),"selectStyle",[l])})}),t("select.selector()",function(t){return void 0===t?this.context[0]._select.selector:this.iterator("table",function(e){s(new _.Api(e)),e._select.selector=t,"api"!==e._select.style&&n(new _.Api(e))})}),t("select.last()",function(e){var t=this.context[0];return e?(t._select_lastCell=e,this):t._select_lastCell}),l("rows().select()","row().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("row",function(e,t){f(e);var l=e.aoData[t],s=e.aoColumns;m(l.nTr).addClass(e._select.className),l._select_selected=!0;for(var c=0;c<s.length;c++)"select-checkbox"===s[c].sType&&(m("input.dt-select-checkbox",l.anCells[c]).prop("checked",!0),l._aSortData[c]=null)}),this.iterator("table",function(e,t){d(l,"select",["row",l[t]],!0)}),this)}),t("row().selected()",function(){var e=this.context[0];return!!(e&&this.length&&e.aoData[this[0]]&&e.aoData[this[0]]._select_selected)}),l("columns().select()","column().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("column",function(e,t){f(e),e.aoColumns[t]._select_selected=!0;t=new _.Api(e).column(t);m(t.header()).addClass(e._select.className),m(t.footer()).addClass(e._select.className),t.nodes().to$().addClass(e._select.className)}),this.iterator("table",function(e,t){d(l,"select",["column",l[t]],!0)}),this)}),t("column().selected()",function(){var e=this.context[0];return!!(e&&this.length&&e.aoColumns[this[0]]&&e.aoColumns[this[0]]._select_selected)}),l("cells().select()","cell().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("cell",function(e,t,l){f(e);t=e.aoData[t];void 0===t._selected_cells&&(t._selected_cells=[]),t._selected_cells[l]=!0,t.anCells&&m(t.anCells[l]).addClass(e._select.className)}),this.iterator("table",function(e,t){d(l,"select",["cell",l.cells(l[t]).indexes().toArray()],!0)}),this)}),t("cell().selected()",function(){var e=this.context[0];if(e&&this.length){e=e.aoData[this[0][0].row];if(e&&e._selected_cells&&e._selected_cells[this[0][0].column])return!0}return!1}),l("rows().deselect()","row().deselect()",function(){var l=this;return this.iterator("row",function(e,t){var l=e.aoData[t],s=e.aoColumns;m(l.nTr).removeClass(e._select.className),l._select_selected=!1,e._select_lastCell=null;for(var c=0;c<s.length;c++)"select-checkbox"===s[c].sType&&(m("input.dt-select-checkbox",l.anCells[c]).prop("checked",!1),l._aSortData[c]=null)}),this.iterator("table",function(e,t){d(l,"deselect",["row",l[t]],!0)}),this}),l("columns().deselect()","column().deselect()",function(){var l=this;return this.iterator("column",function(s,e){s.aoColumns[e]._select_selected=!1;var t=new _.Api(s),l=t.column(e);m(l.header()).removeClass(s._select.className),m(l.footer()).removeClass(s._select.className),t.cells(null,e).indexes().each(function(e){var t=s.aoData[e.row],l=t._selected_cells;!t.anCells||l&&l[e.column]||m(t.anCells[e.column]).removeClass(s._select.className)})}),this.iterator("table",function(e,t){d(l,"deselect",["column",l[t]],!0)}),this}),l("cells().deselect()","cell().deselect()",function(){var l=this;return this.iterator("cell",function(e,t,l){t=e.aoData[t];void 0!==t._selected_cells&&(t._selected_cells[l]=!1),t.anCells&&!e.aoColumns[l]._select_selected&&m(t.anCells[l]).removeClass(e._select.className)}),this.iterator("table",function(e,t){d(l,"deselect",["cell",l[t]],!0)}),this});var b=0;return m.extend(_.ext.buttons,{selected:{text:o("selected","Selected"),className:"buttons-selected",limitTo:["rows","columns","cells"],init:function(l,e,s){var c=this;s._eventNamespace=".select"+b++,l.on(w(s),function(){var e,t;c.enable((e=l,!(-1===(t=s).limitTo.indexOf("rows")||!e.rows({selected:!0}).any())||!(-1===t.limitTo.indexOf("columns")||!e.columns({selected:!0}).any())||!(-1===t.limitTo.indexOf("cells")||!e.cells({selected:!0}).any())))}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},selectedSingle:{text:o("selectedSingle","Selected single"),className:"buttons-selected-single",init:function(t,e,l){var s=this;l._eventNamespace=".select"+b++,t.on(w(l),function(){var e=t.rows({selected:!0}).flatten().length+t.columns({selected:!0}).flatten().length+t.cells({selected:!0}).flatten().length;s.enable(1===e)}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},selectAll:{text:o("selectAll","Select all"),className:"buttons-select-all",action:function(e,t,l,s){var c=this.select.items(),n=s.selectorModifier;(n?("function"==typeof n&&(n=n.call(t,e,t,l,s)),this[c+"s"](n)):this[c+"s"]()).select()}},selectNone:{text:o("selectNone","Deselect all"),className:"buttons-select-none",action:function(){f(this.settings()[0],!0)},init:function(t,e,l){var s=this;l._eventNamespace=".select"+b++,t.on(w(l),function(){var e=t.rows({selected:!0}).flatten().length+t.columns({selected:!0}).flatten().length+t.cells({selected:!0}).flatten().length;s.enable(0<e)}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},showSelected:{text:o("showSelected","Show only selected"),className:"buttons-show-selected",action:function(e,t){var s;t.search.fixed("dt-select")?(t.search.fixed("dt-select",null),this.active(!1)):(s=t.settings()[0].aoData,t.search.fixed("dt-select",function(e,t,l){return s[l]._select_selected}),this.active(!0)),t.draw()}}}),m.each(["Row","Column","Cell"],function(e,t){var c=t.toLowerCase();_.ext.buttons["select"+t+"s"]={text:o("select"+t+"s","Select "+c+"s"),className:"buttons-select-"+c+"s",action:function(){this.select.items(c)},init:function(e){var s=this;e.on("selectItems.dt.DT",function(e,t,l){s.active(l===c)})}}}),_.type("select-checkbox",{className:"dt-select",detect:function(e){return"select-checkbox"===e&&e},order:{pre:function(e){return"X"===e?-1:0}}}),m.extend(!0,_.defaults.oLanguage,{select:{aria:{rowCheckbox:"Select row"}}}),_.render.select=function(e,t){var n=e?_.util.get(e):null,o=t?_.util.get(t):null;return function(e,t,l,s){var c=s.settings.aoData[s.row]._select_selected,s=s.settings.oLanguage.select.aria.rowCheckbox;return"display"===t?m("<input>").attr({"aria-label":s,class:"dt-select-checkbox",name:o?o(l):null,type:"checkbox",value:n?n(l):null,checked:c})[0]:"type"===t?"select-checkbox":"filter"!==t&&c?"X":""}},_.ext.order["select-checkbox"]=function(t,e){return this.api().column(e,{order:"index"}).nodes().map(function(e){return"row"===t._select.items?m(e).parent().hasClass(t._select.className):"cell"===t._select.items&&m(e).hasClass(t._select.className)})},m.fn.DataTable.select=_.select,m(e).on("preInit.dt.dtSelect",function(e,t){"dt"===e.namespace&&_.select.init(new _.Api(t))}),_}); |
@@ -7,3 +7,3 @@ { | ||
"types": "./types/types.d.ts", | ||
"version": "1.7.0", | ||
"version": "2.0.0", | ||
"files": [ | ||
@@ -24,3 +24,3 @@ "js/**/*.js", | ||
"dependencies": { | ||
"datatables.net": ">=1.13.4", | ||
"datatables.net": ">=2.0.0", | ||
"jquery": ">=1.7" | ||
@@ -27,0 +27,0 @@ }, |
@@ -83,3 +83,3 @@ // Type definitions for DataTables Select | ||
interface ApiStatic { | ||
interface DataTablesStatic { | ||
/** | ||
@@ -156,3 +156,3 @@ * Select static methods | ||
*/ | ||
blurable(flag): Api; | ||
blurable(flag: boolean): Api; | ||
@@ -172,3 +172,3 @@ /** | ||
*/ | ||
info(flag): Api; | ||
info(flag: boolean): Api; | ||
@@ -232,4 +232,4 @@ /** | ||
*/ | ||
toggleable(set): Api; | ||
toggleable(set: boolean): Api; | ||
} | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121871
2762
Updateddatatables.net@>=2.0.0