datatables.net 1.11.0 → 1.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/jquery.dataTables.js +174 -102
- package/js/jquery.dataTables.min.js +166 -165
- package/package.json +1 -1
package/js/jquery.dataTables.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! DataTables 1.11.
|
|
1
|
+
/*! DataTables 1.11.4
|
|
2
2
|
* ©2008-2021 SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @summary DataTables
|
|
7
7
|
* @description Paginate, search and order HTML tables
|
|
8
|
-
* @version 1.11.
|
|
8
|
+
* @version 1.11.4
|
|
9
9
|
* @file jquery.dataTables.js
|
|
10
10
|
* @author SpryMedia Ltd
|
|
11
11
|
* @contact www.datatables.net
|
|
@@ -1094,8 +1094,8 @@
|
|
|
1094
1094
|
dataType: 'json',
|
|
1095
1095
|
url: oLanguage.sUrl,
|
|
1096
1096
|
success: function ( json ) {
|
|
1097
|
-
_fnLanguageCompat( json );
|
|
1098
1097
|
_fnCamelToHungarian( defaults.oLanguage, json );
|
|
1098
|
+
_fnLanguageCompat( json );
|
|
1099
1099
|
$.extend( true, oLanguage, json );
|
|
1100
1100
|
|
|
1101
1101
|
_fnCallbackFire( oSettings, null, 'i18n', [oSettings]);
|
|
@@ -1614,6 +1614,14 @@
|
|
|
1614
1614
|
return out;
|
|
1615
1615
|
}
|
|
1616
1616
|
|
|
1617
|
+
var _includes = function (search, start) {
|
|
1618
|
+
if (start === undefined) {
|
|
1619
|
+
start = 0;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
return this.indexOf(search, start) !== -1;
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1617
1625
|
// Array.isArray polyfill.
|
|
1618
1626
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
|
|
1619
1627
|
if (! Array.isArray) {
|
|
@@ -1622,6 +1630,10 @@
|
|
|
1622
1630
|
};
|
|
1623
1631
|
}
|
|
1624
1632
|
|
|
1633
|
+
if (! Array.prototype.includes) {
|
|
1634
|
+
Array.prototype.includes = _includes;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1625
1637
|
// .trim() polyfill
|
|
1626
1638
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim
|
|
1627
1639
|
if (!String.prototype.trim) {
|
|
@@ -1630,6 +1642,10 @@
|
|
|
1630
1642
|
};
|
|
1631
1643
|
}
|
|
1632
1644
|
|
|
1645
|
+
if (! String.prototype.includes) {
|
|
1646
|
+
String.prototype.includes = _includes;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1633
1649
|
/**
|
|
1634
1650
|
* DataTables utility methods
|
|
1635
1651
|
*
|
|
@@ -2796,9 +2812,18 @@
|
|
|
2796
2812
|
return cellData.call( rowData );
|
|
2797
2813
|
}
|
|
2798
2814
|
|
|
2799
|
-
if ( cellData === null && type
|
|
2815
|
+
if ( cellData === null && type === 'display' ) {
|
|
2800
2816
|
return '';
|
|
2801
2817
|
}
|
|
2818
|
+
|
|
2819
|
+
if ( type === 'filter' ) {
|
|
2820
|
+
var fomatters = DataTable.ext.type.search;
|
|
2821
|
+
|
|
2822
|
+
if ( fomatters[ col.sType ] ) {
|
|
2823
|
+
cellData = fomatters[ col.sType ]( cellData );
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2802
2827
|
return cellData;
|
|
2803
2828
|
}
|
|
2804
2829
|
|
|
@@ -3425,6 +3450,9 @@
|
|
|
3425
3450
|
*/
|
|
3426
3451
|
function _fnDraw( oSettings, ajaxComplete )
|
|
3427
3452
|
{
|
|
3453
|
+
// Allow for state saving and a custom start position
|
|
3454
|
+
_fnStart( oSettings );
|
|
3455
|
+
|
|
3428
3456
|
/* Provide a pre-callback function which can be used to cancel the draw is false is returned */
|
|
3429
3457
|
var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );
|
|
3430
3458
|
if ( $.inArray( false, aPreDraw ) !== -1 )
|
|
@@ -3433,34 +3461,18 @@
|
|
|
3433
3461
|
return;
|
|
3434
3462
|
}
|
|
3435
3463
|
|
|
3436
|
-
var i, iLen, n;
|
|
3437
3464
|
var anRows = [];
|
|
3438
3465
|
var iRowCount = 0;
|
|
3439
3466
|
var asStripeClasses = oSettings.asStripeClasses;
|
|
3440
3467
|
var iStripes = asStripeClasses.length;
|
|
3441
|
-
var iOpenRows = oSettings.aoOpenRows.length;
|
|
3442
3468
|
var oLang = oSettings.oLanguage;
|
|
3443
|
-
var iInitDisplayStart = oSettings.iInitDisplayStart;
|
|
3444
3469
|
var bServerSide = _fnDataSource( oSettings ) == 'ssp';
|
|
3445
3470
|
var aiDisplay = oSettings.aiDisplay;
|
|
3446
|
-
|
|
3447
|
-
oSettings.bDrawing = true;
|
|
3448
|
-
|
|
3449
|
-
/* Check and see if we have an initial draw position from state saving */
|
|
3450
|
-
if ( iInitDisplayStart !== undefined && iInitDisplayStart !== -1 )
|
|
3451
|
-
{
|
|
3452
|
-
oSettings._iDisplayStart = bServerSide ?
|
|
3453
|
-
iInitDisplayStart :
|
|
3454
|
-
iInitDisplayStart >= oSettings.fnRecordsDisplay() ?
|
|
3455
|
-
0 :
|
|
3456
|
-
iInitDisplayStart;
|
|
3457
|
-
|
|
3458
|
-
oSettings.iInitDisplayStart = -1;
|
|
3459
|
-
}
|
|
3460
|
-
|
|
3461
3471
|
var iDisplayStart = oSettings._iDisplayStart;
|
|
3462
3472
|
var iDisplayEnd = oSettings.fnDisplayEnd();
|
|
3463
3473
|
|
|
3474
|
+
oSettings.bDrawing = true;
|
|
3475
|
+
|
|
3464
3476
|
/* Server-side processing draw intercept */
|
|
3465
3477
|
if ( oSettings.bDeferLoading )
|
|
3466
3478
|
{
|
|
@@ -3862,6 +3874,28 @@
|
|
|
3862
3874
|
return aReturn;
|
|
3863
3875
|
}
|
|
3864
3876
|
|
|
3877
|
+
/**
|
|
3878
|
+
* Set the start position for draw
|
|
3879
|
+
* @param {object} oSettings dataTables settings object
|
|
3880
|
+
*/
|
|
3881
|
+
function _fnStart( oSettings )
|
|
3882
|
+
{
|
|
3883
|
+
var bServerSide = _fnDataSource( oSettings ) == 'ssp';
|
|
3884
|
+
var iInitDisplayStart = oSettings.iInitDisplayStart;
|
|
3885
|
+
|
|
3886
|
+
// Check and see if we have an initial draw position from state saving
|
|
3887
|
+
if ( iInitDisplayStart !== undefined && iInitDisplayStart !== -1 )
|
|
3888
|
+
{
|
|
3889
|
+
oSettings._iDisplayStart = bServerSide ?
|
|
3890
|
+
iInitDisplayStart :
|
|
3891
|
+
iInitDisplayStart >= oSettings.fnRecordsDisplay() ?
|
|
3892
|
+
0 :
|
|
3893
|
+
iInitDisplayStart;
|
|
3894
|
+
|
|
3895
|
+
oSettings.iInitDisplayStart = -1;
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3865
3899
|
/**
|
|
3866
3900
|
* Create an Ajax call based on the table's settings, taking into account that
|
|
3867
3901
|
* parameters can have multiple forms, and backwards compatibility.
|
|
@@ -3905,8 +3939,8 @@
|
|
|
3905
3939
|
var ajax = oSettings.ajax;
|
|
3906
3940
|
var instance = oSettings.oInstance;
|
|
3907
3941
|
var callback = function ( json ) {
|
|
3908
|
-
var status = oSettings.
|
|
3909
|
-
? oSettings.
|
|
3942
|
+
var status = oSettings.jqXHR
|
|
3943
|
+
? oSettings.jqXHR.status
|
|
3910
3944
|
: null;
|
|
3911
3945
|
|
|
3912
3946
|
if ( json === null || (typeof status === 'number' && status == 204 ) ) {
|
|
@@ -4553,7 +4587,6 @@
|
|
|
4553
4587
|
var columns = settings.aoColumns;
|
|
4554
4588
|
var column;
|
|
4555
4589
|
var i, j, ien, jen, filterData, cellData, row;
|
|
4556
|
-
var fomatters = DataTable.ext.type.search;
|
|
4557
4590
|
var wasInvalidated = false;
|
|
4558
4591
|
|
|
4559
4592
|
for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
|
|
@@ -4568,10 +4601,6 @@
|
|
|
4568
4601
|
if ( column.bSearchable ) {
|
|
4569
4602
|
cellData = _fnGetCellData( settings, i, j, 'filter' );
|
|
4570
4603
|
|
|
4571
|
-
if ( fomatters[ column.sType ] ) {
|
|
4572
|
-
cellData = fomatters[ column.sType ]( cellData );
|
|
4573
|
-
}
|
|
4574
|
-
|
|
4575
4604
|
// Search in DataTables 1.10 is string based. In 1.11 this
|
|
4576
4605
|
// should be altered to also allow strict type checking.
|
|
4577
4606
|
if ( cellData === null ) {
|
|
@@ -5395,7 +5424,7 @@
|
|
|
5395
5424
|
|
|
5396
5425
|
// Read all widths in next pass
|
|
5397
5426
|
_fnApplyToChildren( function(nSizer) {
|
|
5398
|
-
|
|
5427
|
+
var style = window.getComputedStyle ?
|
|
5399
5428
|
window.getComputedStyle(nSizer).width :
|
|
5400
5429
|
_fnStringToCss( $(nSizer).width() );
|
|
5401
5430
|
|
|
@@ -5455,7 +5484,7 @@
|
|
|
5455
5484
|
|
|
5456
5485
|
// Sanity check that the table is of a sensible width. If not then we are going to get
|
|
5457
5486
|
// misalignment - try to prevent this by not allowing the table to shrink below its min width
|
|
5458
|
-
if ( table.outerWidth() < sanityWidth )
|
|
5487
|
+
if ( Math.round(table.outerWidth()) < Math.round(sanityWidth) )
|
|
5459
5488
|
{
|
|
5460
5489
|
// The min width depends upon if we have a vertical scrollbar visible or not */
|
|
5461
5490
|
correction = ((divBodyEl.scrollHeight > divBodyEl.offsetHeight ||
|
|
@@ -6362,6 +6391,10 @@
|
|
|
6362
6391
|
*/
|
|
6363
6392
|
function _fnSaveState ( settings )
|
|
6364
6393
|
{
|
|
6394
|
+
if (settings._bLoadingState) {
|
|
6395
|
+
return;
|
|
6396
|
+
}
|
|
6397
|
+
|
|
6365
6398
|
/* Store the interesting variables */
|
|
6366
6399
|
var state = {
|
|
6367
6400
|
time: +new Date(),
|
|
@@ -6396,98 +6429,132 @@
|
|
|
6396
6429
|
*/
|
|
6397
6430
|
function _fnLoadState ( settings, oInit, callback )
|
|
6398
6431
|
{
|
|
6432
|
+
if ( ! settings.oFeatures.bStateSave ) {
|
|
6433
|
+
callback();
|
|
6434
|
+
return;
|
|
6435
|
+
}
|
|
6436
|
+
|
|
6437
|
+
var loaded = function(state) {
|
|
6438
|
+
_fnImplementState(settings, state, callback);
|
|
6439
|
+
}
|
|
6440
|
+
|
|
6441
|
+
var state = settings.fnStateLoadCallback.call( settings.oInstance, settings, loaded );
|
|
6442
|
+
|
|
6443
|
+
if ( state !== undefined ) {
|
|
6444
|
+
_fnImplementState( settings, state, callback );
|
|
6445
|
+
}
|
|
6446
|
+
// otherwise, wait for the loaded callback to be executed
|
|
6447
|
+
|
|
6448
|
+
return true;
|
|
6449
|
+
}
|
|
6450
|
+
|
|
6451
|
+
function _fnImplementState ( settings, s, callback) {
|
|
6399
6452
|
var i, ien;
|
|
6400
6453
|
var columns = settings.aoColumns;
|
|
6401
|
-
|
|
6402
|
-
if ( ! s || ! s.time ) {
|
|
6403
|
-
callback();
|
|
6404
|
-
return;
|
|
6405
|
-
}
|
|
6454
|
+
settings._bLoadingState = true;
|
|
6406
6455
|
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
if ( $.inArray( false, abStateLoad ) !== -1 ) {
|
|
6411
|
-
callback();
|
|
6412
|
-
return;
|
|
6413
|
-
}
|
|
6456
|
+
// When StateRestore was introduced the state could now be implemented at any time
|
|
6457
|
+
// Not just initialisation. To do this an api instance is required in some places
|
|
6458
|
+
var api = settings._bInitComplete ? new DataTable.Api(settings) : null;
|
|
6414
6459
|
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
}
|
|
6460
|
+
if ( ! s || ! s.time ) {
|
|
6461
|
+
settings._bLoadingState = false;
|
|
6462
|
+
callback();
|
|
6463
|
+
return;
|
|
6464
|
+
}
|
|
6421
6465
|
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6466
|
+
// Allow custom and plug-in manipulation functions to alter the saved data set and
|
|
6467
|
+
// cancelling of loading by returning false
|
|
6468
|
+
var abStateLoad = _fnCallbackFire( settings, 'aoStateLoadParams', 'stateLoadParams', [settings, s] );
|
|
6469
|
+
if ( $.inArray( false, abStateLoad ) !== -1 ) {
|
|
6470
|
+
settings._bLoadingState = false;
|
|
6471
|
+
callback();
|
|
6472
|
+
return;
|
|
6473
|
+
}
|
|
6474
|
+
|
|
6475
|
+
// Reject old data
|
|
6476
|
+
var duration = settings.iStateDuration;
|
|
6477
|
+
if ( duration > 0 && s.time < +new Date() - (duration*1000) ) {
|
|
6478
|
+
settings._bLoadingState = false;
|
|
6479
|
+
callback();
|
|
6480
|
+
return;
|
|
6481
|
+
}
|
|
6427
6482
|
|
|
6428
|
-
|
|
6429
|
-
|
|
6483
|
+
// Number of columns have changed - all bets are off, no restore of settings
|
|
6484
|
+
if ( s.columns && columns.length !== s.columns.length ) {
|
|
6485
|
+
settings._bLoadingState = false;
|
|
6486
|
+
callback();
|
|
6487
|
+
return;
|
|
6488
|
+
}
|
|
6489
|
+
|
|
6490
|
+
// Store the saved state so it might be accessed at any time
|
|
6491
|
+
settings.oLoadedState = $.extend( true, {}, s );
|
|
6430
6492
|
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6493
|
+
// Restore key features - todo - for 1.11 this needs to be done by
|
|
6494
|
+
// subscribed events
|
|
6495
|
+
if ( s.start !== undefined ) {
|
|
6496
|
+
if(api === null) {
|
|
6434
6497
|
settings._iDisplayStart = s.start;
|
|
6435
6498
|
settings.iInitDisplayStart = s.start;
|
|
6436
6499
|
}
|
|
6437
|
-
|
|
6438
|
-
settings
|
|
6439
|
-
}
|
|
6500
|
+
else {
|
|
6501
|
+
_fnPageChange(settings, s.start/s.length);
|
|
6440
6502
|
|
|
6441
|
-
// Order
|
|
6442
|
-
if ( s.order !== undefined ) {
|
|
6443
|
-
settings.aaSorting = [];
|
|
6444
|
-
$.each( s.order, function ( i, col ) {
|
|
6445
|
-
settings.aaSorting.push( col[0] >= columns.length ?
|
|
6446
|
-
[ 0, col[1] ] :
|
|
6447
|
-
col
|
|
6448
|
-
);
|
|
6449
|
-
} );
|
|
6450
6503
|
}
|
|
6504
|
+
}
|
|
6505
|
+
if ( s.length !== undefined ) {
|
|
6506
|
+
settings._iDisplayLength = s.length;
|
|
6507
|
+
}
|
|
6451
6508
|
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6509
|
+
// Order
|
|
6510
|
+
if ( s.order !== undefined ) {
|
|
6511
|
+
settings.aaSorting = [];
|
|
6512
|
+
$.each( s.order, function ( i, col ) {
|
|
6513
|
+
settings.aaSorting.push( col[0] >= columns.length ?
|
|
6514
|
+
[ 0, col[1] ] :
|
|
6515
|
+
col
|
|
6516
|
+
);
|
|
6517
|
+
} );
|
|
6518
|
+
}
|
|
6456
6519
|
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
var col = s.columns[i];
|
|
6520
|
+
// Search
|
|
6521
|
+
if ( s.search !== undefined ) {
|
|
6522
|
+
$.extend( settings.oPreviousSearch, _fnSearchToHung( s.search ) );
|
|
6523
|
+
}
|
|
6462
6524
|
|
|
6463
|
-
|
|
6464
|
-
|
|
6525
|
+
// Columns
|
|
6526
|
+
if ( s.columns ) {
|
|
6527
|
+
for ( i=0, ien=s.columns.length ; i<ien ; i++ ) {
|
|
6528
|
+
var col = s.columns[i];
|
|
6529
|
+
|
|
6530
|
+
// Visibility
|
|
6531
|
+
if ( col.visible !== undefined ) {
|
|
6532
|
+
// If the api is defined, the table has been initialised so we need to use it rather than internal settings
|
|
6533
|
+
if (api) {
|
|
6534
|
+
// Don't redraw the columns on every iteration of this loop, we will do this at the end instead
|
|
6535
|
+
api.column(i).visible(col.visible, false);
|
|
6536
|
+
}
|
|
6537
|
+
else {
|
|
6465
6538
|
columns[i].bVisible = col.visible;
|
|
6466
6539
|
}
|
|
6540
|
+
}
|
|
6467
6541
|
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
}
|
|
6542
|
+
// Search
|
|
6543
|
+
if ( col.search !== undefined ) {
|
|
6544
|
+
$.extend( settings.aoPreSearchCols[i], _fnSearchToHung( col.search ) );
|
|
6472
6545
|
}
|
|
6473
6546
|
}
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
if ( ! settings.oFeatures.bStateSave ) {
|
|
6480
|
-
callback();
|
|
6481
|
-
return;
|
|
6547
|
+
|
|
6548
|
+
// If the api is defined then we need to adjust the columns once the visibility has been changed
|
|
6549
|
+
if (api) {
|
|
6550
|
+
api.columns.adjust();
|
|
6551
|
+
}
|
|
6482
6552
|
}
|
|
6483
6553
|
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
}
|
|
6489
|
-
// otherwise, wait for the loaded callback to be executed
|
|
6490
|
-
}
|
|
6554
|
+
settings._bLoadingState = false;
|
|
6555
|
+
_fnCallbackFire( settings, 'aoStateLoaded', 'stateLoaded', [settings, s] );
|
|
6556
|
+
callback();
|
|
6557
|
+
};
|
|
6491
6558
|
|
|
6492
6559
|
|
|
6493
6560
|
/**
|
|
@@ -9578,7 +9645,7 @@
|
|
|
9578
9645
|
* @type string
|
|
9579
9646
|
* @default Version number
|
|
9580
9647
|
*/
|
|
9581
|
-
DataTable.version = "1.11.
|
|
9648
|
+
DataTable.version = "1.11.4";
|
|
9582
9649
|
|
|
9583
9650
|
/**
|
|
9584
9651
|
* Private data store, containing all of the settings objects that are
|
|
@@ -15036,6 +15103,10 @@
|
|
|
15036
15103
|
*/
|
|
15037
15104
|
|
|
15038
15105
|
var __htmlEscapeEntities = function ( d ) {
|
|
15106
|
+
if (Array.isArray(d)) {
|
|
15107
|
+
d = d.join(',');
|
|
15108
|
+
}
|
|
15109
|
+
|
|
15039
15110
|
return typeof d === 'string' ?
|
|
15040
15111
|
d
|
|
15041
15112
|
.replace(/&/g, '&')
|
|
@@ -15230,6 +15301,7 @@
|
|
|
15230
15301
|
_fnSortData: _fnSortData,
|
|
15231
15302
|
_fnSaveState: _fnSaveState,
|
|
15232
15303
|
_fnLoadState: _fnLoadState,
|
|
15304
|
+
_fnImplementState: _fnImplementState,
|
|
15233
15305
|
_fnSettingsFromNode: _fnSettingsFromNode,
|
|
15234
15306
|
_fnLog: _fnLog,
|
|
15235
15307
|
_fnMap: _fnMap,
|