datatables.net 1.11.3 → 1.12.0
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 +333 -103
- package/js/jquery.dataTables.min.js +175 -171
- package/package.json +2 -2
- package/types/types.d.ts +11 -0
package/js/jquery.dataTables.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
/*! DataTables 1.
|
|
2
|
-
* ©2008-
|
|
1
|
+
/*! DataTables 1.12.0
|
|
2
|
+
* ©2008-2022 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.
|
|
9
|
-
* @file jquery.dataTables.js
|
|
8
|
+
* @version 1.12.0
|
|
10
9
|
* @author SpryMedia Ltd
|
|
11
10
|
* @contact www.datatables.net
|
|
12
|
-
* @copyright
|
|
11
|
+
* @copyright SpryMedia Ltd.
|
|
13
12
|
*
|
|
14
13
|
* This source file is free software, available under the following license:
|
|
15
14
|
* MIT license - http://datatables.net/license
|
|
@@ -59,38 +58,7 @@
|
|
|
59
58
|
(function( $, window, document, undefined ) {
|
|
60
59
|
"use strict";
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
* DataTables is a plug-in for the jQuery Javascript library. It is a highly
|
|
64
|
-
* flexible tool, based upon the foundations of progressive enhancement,
|
|
65
|
-
* which will add advanced interaction controls to any HTML table. For a
|
|
66
|
-
* full list of features please refer to
|
|
67
|
-
* [DataTables.net](href="http://datatables.net).
|
|
68
|
-
*
|
|
69
|
-
* Note that the `DataTable` object is not a global variable but is aliased
|
|
70
|
-
* to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may
|
|
71
|
-
* be accessed.
|
|
72
|
-
*
|
|
73
|
-
* @class
|
|
74
|
-
* @param {object} [init={}] Configuration object for DataTables. Options
|
|
75
|
-
* are defined by {@link DataTable.defaults}
|
|
76
|
-
* @requires jQuery 1.7+
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* // Basic initialisation
|
|
80
|
-
* $(document).ready( function {
|
|
81
|
-
* $('#example').dataTable();
|
|
82
|
-
* } );
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* // Initialisation with configuration options - in this case, disable
|
|
86
|
-
* // pagination and sorting.
|
|
87
|
-
* $(document).ready( function {
|
|
88
|
-
* $('#example').dataTable( {
|
|
89
|
-
* "paginate": false,
|
|
90
|
-
* "sort": false
|
|
91
|
-
* } );
|
|
92
|
-
* } );
|
|
93
|
-
*/
|
|
61
|
+
|
|
94
62
|
var DataTable = function ( selector, options )
|
|
95
63
|
{
|
|
96
64
|
// When creating with `new`, create a new DataTable, returning the API instance
|
|
@@ -101,7 +69,7 @@
|
|
|
101
69
|
// Argument switching
|
|
102
70
|
options = selector;
|
|
103
71
|
}
|
|
104
|
-
|
|
72
|
+
|
|
105
73
|
/**
|
|
106
74
|
* Perform a jQuery selector action on the table's TR elements (from the tbody) and
|
|
107
75
|
* return the resulting jQuery object.
|
|
@@ -857,24 +825,24 @@
|
|
|
857
825
|
*/
|
|
858
826
|
this.fnVersionCheck = _ext.fnVersionCheck;
|
|
859
827
|
|
|
860
|
-
|
|
828
|
+
|
|
861
829
|
var _that = this;
|
|
862
830
|
var emptyInit = options === undefined;
|
|
863
831
|
var len = this.length;
|
|
864
|
-
|
|
832
|
+
|
|
865
833
|
if ( emptyInit ) {
|
|
866
834
|
options = {};
|
|
867
835
|
}
|
|
868
|
-
|
|
836
|
+
|
|
869
837
|
this.oApi = this.internal = _ext.internal;
|
|
870
|
-
|
|
838
|
+
|
|
871
839
|
// Extend with old style plug-in API methods
|
|
872
840
|
for ( var fn in DataTable.ext.internal ) {
|
|
873
841
|
if ( fn ) {
|
|
874
842
|
this[fn] = _fnExternApiFunc(fn);
|
|
875
843
|
}
|
|
876
844
|
}
|
|
877
|
-
|
|
845
|
+
|
|
878
846
|
this.each(function() {
|
|
879
847
|
// For each initialisation we want to give it a clean initialisation
|
|
880
848
|
// object that can be bashed around
|
|
@@ -882,7 +850,7 @@
|
|
|
882
850
|
var oInit = len > 1 ? // optimisation for single table case
|
|
883
851
|
_fnExtend( o, options, true ) :
|
|
884
852
|
options;
|
|
885
|
-
|
|
853
|
+
|
|
886
854
|
/*global oInit,_that,emptyInit*/
|
|
887
855
|
var i=0, iLen, j, jLen, k, kLen;
|
|
888
856
|
var sId = this.getAttribute( 'id' );
|
|
@@ -1096,7 +1064,7 @@
|
|
|
1096
1064
|
success: function ( json ) {
|
|
1097
1065
|
_fnCamelToHungarian( defaults.oLanguage, json );
|
|
1098
1066
|
_fnLanguageCompat( json );
|
|
1099
|
-
$.extend( true, oLanguage, json );
|
|
1067
|
+
$.extend( true, oLanguage, json, oSettings.oInit.oLanguage );
|
|
1100
1068
|
|
|
1101
1069
|
_fnCallbackFire( oSettings, null, 'i18n', [oSettings]);
|
|
1102
1070
|
_fnInitialise( oSettings );
|
|
@@ -1325,7 +1293,7 @@
|
|
|
1325
1293
|
_that = null;
|
|
1326
1294
|
return this;
|
|
1327
1295
|
};
|
|
1328
|
-
|
|
1296
|
+
|
|
1329
1297
|
|
|
1330
1298
|
/*
|
|
1331
1299
|
* It is useful to have variables which are scoped locally so only the
|
|
@@ -2329,9 +2297,17 @@
|
|
|
2329
2297
|
th.addClass( oOptions.sClass );
|
|
2330
2298
|
}
|
|
2331
2299
|
|
|
2300
|
+
var origClass = oCol.sClass;
|
|
2301
|
+
|
|
2332
2302
|
$.extend( oCol, oOptions );
|
|
2333
2303
|
_fnMap( oCol, oOptions, "sWidth", "sWidthOrig" );
|
|
2334
2304
|
|
|
2305
|
+
// Merge class from previously defined classes with this one, rather than just
|
|
2306
|
+
// overwriting it in the extend above
|
|
2307
|
+
if (origClass !== oCol.sClass) {
|
|
2308
|
+
oCol.sClass = origClass + ' ' + oCol.sClass;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2335
2311
|
/* iDataSort to be applied (backwards compatibility), but aDataSort will take
|
|
2336
2312
|
* priority if defined
|
|
2337
2313
|
*/
|
|
@@ -2604,9 +2580,11 @@
|
|
|
2604
2580
|
def = aoColDefs[i];
|
|
2605
2581
|
|
|
2606
2582
|
/* Each definition can target multiple columns, as it is an array */
|
|
2607
|
-
var aTargets = def.
|
|
2608
|
-
def.
|
|
2609
|
-
def.
|
|
2583
|
+
var aTargets = def.target !== undefined
|
|
2584
|
+
? def.target
|
|
2585
|
+
: def.targets !== undefined
|
|
2586
|
+
? def.targets
|
|
2587
|
+
: def.aTargets;
|
|
2610
2588
|
|
|
2611
2589
|
if ( ! Array.isArray( aTargets ) )
|
|
2612
2590
|
{
|
|
@@ -3450,6 +3428,9 @@
|
|
|
3450
3428
|
*/
|
|
3451
3429
|
function _fnDraw( oSettings, ajaxComplete )
|
|
3452
3430
|
{
|
|
3431
|
+
// Allow for state saving and a custom start position
|
|
3432
|
+
_fnStart( oSettings );
|
|
3433
|
+
|
|
3453
3434
|
/* Provide a pre-callback function which can be used to cancel the draw is false is returned */
|
|
3454
3435
|
var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );
|
|
3455
3436
|
if ( $.inArray( false, aPreDraw ) !== -1 )
|
|
@@ -3458,34 +3439,18 @@
|
|
|
3458
3439
|
return;
|
|
3459
3440
|
}
|
|
3460
3441
|
|
|
3461
|
-
var i, iLen, n;
|
|
3462
3442
|
var anRows = [];
|
|
3463
3443
|
var iRowCount = 0;
|
|
3464
3444
|
var asStripeClasses = oSettings.asStripeClasses;
|
|
3465
3445
|
var iStripes = asStripeClasses.length;
|
|
3466
|
-
var iOpenRows = oSettings.aoOpenRows.length;
|
|
3467
3446
|
var oLang = oSettings.oLanguage;
|
|
3468
|
-
var iInitDisplayStart = oSettings.iInitDisplayStart;
|
|
3469
3447
|
var bServerSide = _fnDataSource( oSettings ) == 'ssp';
|
|
3470
3448
|
var aiDisplay = oSettings.aiDisplay;
|
|
3471
|
-
|
|
3472
|
-
oSettings.bDrawing = true;
|
|
3473
|
-
|
|
3474
|
-
/* Check and see if we have an initial draw position from state saving */
|
|
3475
|
-
if ( iInitDisplayStart !== undefined && iInitDisplayStart !== -1 )
|
|
3476
|
-
{
|
|
3477
|
-
oSettings._iDisplayStart = bServerSide ?
|
|
3478
|
-
iInitDisplayStart :
|
|
3479
|
-
iInitDisplayStart >= oSettings.fnRecordsDisplay() ?
|
|
3480
|
-
0 :
|
|
3481
|
-
iInitDisplayStart;
|
|
3482
|
-
|
|
3483
|
-
oSettings.iInitDisplayStart = -1;
|
|
3484
|
-
}
|
|
3485
|
-
|
|
3486
3449
|
var iDisplayStart = oSettings._iDisplayStart;
|
|
3487
3450
|
var iDisplayEnd = oSettings.fnDisplayEnd();
|
|
3488
3451
|
|
|
3452
|
+
oSettings.bDrawing = true;
|
|
3453
|
+
|
|
3489
3454
|
/* Server-side processing draw intercept */
|
|
3490
3455
|
if ( oSettings.bDeferLoading )
|
|
3491
3456
|
{
|
|
@@ -3887,6 +3852,28 @@
|
|
|
3887
3852
|
return aReturn;
|
|
3888
3853
|
}
|
|
3889
3854
|
|
|
3855
|
+
/**
|
|
3856
|
+
* Set the start position for draw
|
|
3857
|
+
* @param {object} oSettings dataTables settings object
|
|
3858
|
+
*/
|
|
3859
|
+
function _fnStart( oSettings )
|
|
3860
|
+
{
|
|
3861
|
+
var bServerSide = _fnDataSource( oSettings ) == 'ssp';
|
|
3862
|
+
var iInitDisplayStart = oSettings.iInitDisplayStart;
|
|
3863
|
+
|
|
3864
|
+
// Check and see if we have an initial draw position from state saving
|
|
3865
|
+
if ( iInitDisplayStart !== undefined && iInitDisplayStart !== -1 )
|
|
3866
|
+
{
|
|
3867
|
+
oSettings._iDisplayStart = bServerSide ?
|
|
3868
|
+
iInitDisplayStart :
|
|
3869
|
+
iInitDisplayStart >= oSettings.fnRecordsDisplay() ?
|
|
3870
|
+
0 :
|
|
3871
|
+
iInitDisplayStart;
|
|
3872
|
+
|
|
3873
|
+
oSettings.iInitDisplayStart = -1;
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3890
3877
|
/**
|
|
3891
3878
|
* Create an Ajax call based on the table's settings, taking into account that
|
|
3892
3879
|
* parameters can have multiple forms, and backwards compatibility.
|
|
@@ -3930,8 +3917,8 @@
|
|
|
3930
3917
|
var ajax = oSettings.ajax;
|
|
3931
3918
|
var instance = oSettings.oInstance;
|
|
3932
3919
|
var callback = function ( json ) {
|
|
3933
|
-
var status = oSettings.
|
|
3934
|
-
? oSettings.
|
|
3920
|
+
var status = oSettings.jqXHR
|
|
3921
|
+
? oSettings.jqXHR.status
|
|
3935
3922
|
: null;
|
|
3936
3923
|
|
|
3937
3924
|
if ( json === null || (typeof status === 'number' && status == 204 ) ) {
|
|
@@ -5099,6 +5086,7 @@
|
|
|
5099
5086
|
'class': settings.oClasses.sProcessing
|
|
5100
5087
|
} )
|
|
5101
5088
|
.html( settings.oLanguage.sProcessing )
|
|
5089
|
+
.append('<div><div></div><div></div><div></div><div></div></div>')
|
|
5102
5090
|
.insertBefore( settings.nTable )[0];
|
|
5103
5091
|
}
|
|
5104
5092
|
|
|
@@ -5428,7 +5416,7 @@
|
|
|
5428
5416
|
nToSize.style.width = headerWidths[i];
|
|
5429
5417
|
}, headerTrgEls );
|
|
5430
5418
|
|
|
5431
|
-
$(headerSrcEls).height
|
|
5419
|
+
$(headerSrcEls).css('height', 0);
|
|
5432
5420
|
|
|
5433
5421
|
/* Same again with the footer if we have one */
|
|
5434
5422
|
if ( footer )
|
|
@@ -5475,7 +5463,7 @@
|
|
|
5475
5463
|
|
|
5476
5464
|
// Sanity check that the table is of a sensible width. If not then we are going to get
|
|
5477
5465
|
// misalignment - try to prevent this by not allowing the table to shrink below its min width
|
|
5478
|
-
if ( table.outerWidth() < sanityWidth )
|
|
5466
|
+
if ( Math.round(table.outerWidth()) < Math.round(sanityWidth) )
|
|
5479
5467
|
{
|
|
5480
5468
|
// The min width depends upon if we have a vertical scrollbar visible or not */
|
|
5481
5469
|
correction = ((divBodyEl.scrollHeight > divBodyEl.offsetHeight ||
|
|
@@ -6481,16 +6469,27 @@
|
|
|
6481
6469
|
// Store the saved state so it might be accessed at any time
|
|
6482
6470
|
settings.oLoadedState = $.extend( true, {}, s );
|
|
6483
6471
|
|
|
6472
|
+
// Page Length
|
|
6473
|
+
if ( s.length !== undefined ) {
|
|
6474
|
+
// If already initialised just set the value directly so that the select element is also updated
|
|
6475
|
+
if (api) {
|
|
6476
|
+
api.page.len(s.length)
|
|
6477
|
+
}
|
|
6478
|
+
else {
|
|
6479
|
+
settings._iDisplayLength = s.length;
|
|
6480
|
+
}
|
|
6481
|
+
}
|
|
6482
|
+
|
|
6484
6483
|
// Restore key features - todo - for 1.11 this needs to be done by
|
|
6485
6484
|
// subscribed events
|
|
6486
6485
|
if ( s.start !== undefined ) {
|
|
6487
|
-
settings._iDisplayStart = s.start;
|
|
6488
6486
|
if(api === null) {
|
|
6487
|
+
settings._iDisplayStart = s.start;
|
|
6489
6488
|
settings.iInitDisplayStart = s.start;
|
|
6490
6489
|
}
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6490
|
+
else {
|
|
6491
|
+
_fnPageChange(settings, s.start/settings._iDisplayLength);
|
|
6492
|
+
}
|
|
6494
6493
|
}
|
|
6495
6494
|
|
|
6496
6495
|
// Order
|
|
@@ -6832,7 +6831,7 @@
|
|
|
6832
6831
|
return 'dom';
|
|
6833
6832
|
}
|
|
6834
6833
|
|
|
6835
|
-
|
|
6834
|
+
|
|
6836
6835
|
|
|
6837
6836
|
|
|
6838
6837
|
/**
|
|
@@ -7224,8 +7223,10 @@
|
|
|
7224
7223
|
|
|
7225
7224
|
pluck: function ( prop )
|
|
7226
7225
|
{
|
|
7226
|
+
let fn = DataTable.util.get(prop);
|
|
7227
|
+
|
|
7227
7228
|
return this.map( function ( el ) {
|
|
7228
|
-
return el
|
|
7229
|
+
return fn(el);
|
|
7229
7230
|
} );
|
|
7230
7231
|
},
|
|
7231
7232
|
|
|
@@ -8319,22 +8320,35 @@
|
|
|
8319
8320
|
|
|
8320
8321
|
$(document).on('plugin-init.dt', function (e, context) {
|
|
8321
8322
|
var api = new _Api( context );
|
|
8322
|
-
api.on( 'stateSaveParams', function ( e, settings, data ) {
|
|
8323
|
-
var indexes = api.rows().iterator( 'row', function ( settings, idx ) {
|
|
8324
|
-
return settings.aoData[idx]._detailsShow ? idx : undefined;
|
|
8325
|
-
});
|
|
8326
8323
|
|
|
8327
|
-
|
|
8324
|
+
api.on( 'stateSaveParams', function ( e, settings, d ) {
|
|
8325
|
+
// This could be more compact with the API, but it is a lot faster as a simple
|
|
8326
|
+
// internal loop
|
|
8327
|
+
var idFn = settings.rowIdFn;
|
|
8328
|
+
var data = settings.aoData;
|
|
8329
|
+
var ids = [];
|
|
8330
|
+
|
|
8331
|
+
for (var i=0 ; i<data.length ; i++) {
|
|
8332
|
+
if (data[i]._detailsShow) {
|
|
8333
|
+
ids.push( '#' + idFn(data[i]._aData) );
|
|
8334
|
+
}
|
|
8335
|
+
}
|
|
8336
|
+
|
|
8337
|
+
d.childRows = ids;
|
|
8328
8338
|
})
|
|
8329
8339
|
|
|
8330
8340
|
var loaded = api.state.loaded();
|
|
8331
8341
|
|
|
8332
8342
|
if ( loaded && loaded.childRows ) {
|
|
8333
|
-
api
|
|
8334
|
-
|
|
8335
|
-
|
|
8343
|
+
api
|
|
8344
|
+
.rows( $.map(loaded.childRows, function (id){
|
|
8345
|
+
return id.replace(/:/g, '\\:')
|
|
8346
|
+
}) )
|
|
8347
|
+
.every( function () {
|
|
8348
|
+
_fnCallbackFire( context, null, 'requestChild', [ this ] )
|
|
8349
|
+
});
|
|
8336
8350
|
}
|
|
8337
|
-
})
|
|
8351
|
+
});
|
|
8338
8352
|
|
|
8339
8353
|
var __details_add = function ( ctx, row, data, klass )
|
|
8340
8354
|
{
|
|
@@ -8381,6 +8395,15 @@
|
|
|
8381
8395
|
};
|
|
8382
8396
|
|
|
8383
8397
|
|
|
8398
|
+
// Make state saving of child row details async to allow them to be batch processed
|
|
8399
|
+
var __details_state = DataTable.util.throttle(
|
|
8400
|
+
function (ctx) {
|
|
8401
|
+
_fnSaveState( ctx[0] )
|
|
8402
|
+
},
|
|
8403
|
+
500
|
|
8404
|
+
);
|
|
8405
|
+
|
|
8406
|
+
|
|
8384
8407
|
var __details_remove = function ( api, idx )
|
|
8385
8408
|
{
|
|
8386
8409
|
var ctx = api.context;
|
|
@@ -8394,7 +8417,7 @@
|
|
|
8394
8417
|
row._detailsShow = undefined;
|
|
8395
8418
|
row._details = undefined;
|
|
8396
8419
|
$( row.nTr ).removeClass( 'dt-hasChild' );
|
|
8397
|
-
|
|
8420
|
+
__details_state( ctx );
|
|
8398
8421
|
}
|
|
8399
8422
|
}
|
|
8400
8423
|
};
|
|
@@ -8421,7 +8444,7 @@
|
|
|
8421
8444
|
_fnCallbackFire( ctx[0], null, 'childRow', [ show, api.row( api[0] ) ] )
|
|
8422
8445
|
|
|
8423
8446
|
__details_events( ctx[0] );
|
|
8424
|
-
|
|
8447
|
+
__details_state( ctx );
|
|
8425
8448
|
}
|
|
8426
8449
|
}
|
|
8427
8450
|
};
|
|
@@ -8432,7 +8455,7 @@
|
|
|
8432
8455
|
var api = new _Api( settings );
|
|
8433
8456
|
var namespace = '.dt.DT_details';
|
|
8434
8457
|
var drawEvent = 'draw'+namespace;
|
|
8435
|
-
var colvisEvent = 'column-
|
|
8458
|
+
var colvisEvent = 'column-sizing'+namespace;
|
|
8436
8459
|
var destroyEvent = 'destroy'+namespace;
|
|
8437
8460
|
var data = settings.aoData;
|
|
8438
8461
|
|
|
@@ -9484,7 +9507,6 @@
|
|
|
9484
9507
|
remove = remove || false;
|
|
9485
9508
|
|
|
9486
9509
|
return this.iterator( 'table', function ( settings ) {
|
|
9487
|
-
var orig = settings.nTableWrapper.parentNode;
|
|
9488
9510
|
var classes = settings.oClasses;
|
|
9489
9511
|
var table = settings.nTable;
|
|
9490
9512
|
var tbody = settings.nTBody;
|
|
@@ -9539,6 +9561,8 @@
|
|
|
9539
9561
|
jqTbody.children().detach();
|
|
9540
9562
|
jqTbody.append( rows );
|
|
9541
9563
|
|
|
9564
|
+
var orig = settings.nTableWrapper.parentNode;
|
|
9565
|
+
|
|
9542
9566
|
// Remove the DataTables generated nodes, events and classes
|
|
9543
9567
|
var removedMethod = remove ? 'remove' : 'detach';
|
|
9544
9568
|
jqTable[ removedMethod ]();
|
|
@@ -9623,7 +9647,7 @@
|
|
|
9623
9647
|
}
|
|
9624
9648
|
|
|
9625
9649
|
return resolved.replace( '%d', plural ); // nb: plural might be undefined,
|
|
9626
|
-
} );
|
|
9650
|
+
} );
|
|
9627
9651
|
/**
|
|
9628
9652
|
* Version string for plug-ins to check compatibility. Allowed format is
|
|
9629
9653
|
* `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
|
|
@@ -9632,8 +9656,8 @@
|
|
|
9632
9656
|
* @type string
|
|
9633
9657
|
* @default Version number
|
|
9634
9658
|
*/
|
|
9635
|
-
DataTable.version = "1.
|
|
9636
|
-
|
|
9659
|
+
DataTable.version = "1.12.0";
|
|
9660
|
+
|
|
9637
9661
|
/**
|
|
9638
9662
|
* Private data store, containing all of the settings objects that are
|
|
9639
9663
|
* created for the tables on a given page.
|
|
@@ -9647,7 +9671,7 @@
|
|
|
9647
9671
|
* @private
|
|
9648
9672
|
*/
|
|
9649
9673
|
DataTable.settings = [];
|
|
9650
|
-
|
|
9674
|
+
|
|
9651
9675
|
/**
|
|
9652
9676
|
* Object models container, for the various models that DataTables has
|
|
9653
9677
|
* available to it. These models define the objects that are used to hold
|
|
@@ -11837,7 +11861,6 @@
|
|
|
11837
11861
|
* Text which is displayed when the table is processing a user action
|
|
11838
11862
|
* (usually a sort command or similar).
|
|
11839
11863
|
* @type string
|
|
11840
|
-
* @default Processing...
|
|
11841
11864
|
*
|
|
11842
11865
|
* @dtopt Language
|
|
11843
11866
|
* @name DataTable.defaults.language.processing
|
|
@@ -11851,7 +11874,7 @@
|
|
|
11851
11874
|
* } );
|
|
11852
11875
|
* } );
|
|
11853
11876
|
*/
|
|
11854
|
-
"sProcessing": "
|
|
11877
|
+
"sProcessing": "",
|
|
11855
11878
|
|
|
11856
11879
|
|
|
11857
11880
|
/**
|
|
@@ -14005,7 +14028,7 @@
|
|
|
14005
14028
|
*/
|
|
14006
14029
|
"rowId": null
|
|
14007
14030
|
};
|
|
14008
|
-
|
|
14031
|
+
|
|
14009
14032
|
/**
|
|
14010
14033
|
* Extension object for DataTables that is used to provide all extension
|
|
14011
14034
|
* options.
|
|
@@ -15103,6 +15126,201 @@
|
|
|
15103
15126
|
d;
|
|
15104
15127
|
};
|
|
15105
15128
|
|
|
15129
|
+
// Common logic for moment, luxon or a date action
|
|
15130
|
+
function __mld( dt, momentFn, luxonFn, dateFn, arg1 ) {
|
|
15131
|
+
if (window.moment) {
|
|
15132
|
+
return dt[momentFn]( arg1 );
|
|
15133
|
+
}
|
|
15134
|
+
else if (window.luxon) {
|
|
15135
|
+
return dt[luxonFn]( arg1 );
|
|
15136
|
+
}
|
|
15137
|
+
|
|
15138
|
+
return dateFn ? dt[dateFn]( arg1 ) : dt;
|
|
15139
|
+
}
|
|
15140
|
+
|
|
15141
|
+
|
|
15142
|
+
var __mlWarning = false;
|
|
15143
|
+
function __mldObj (d, format, locale) {
|
|
15144
|
+
var dt;
|
|
15145
|
+
|
|
15146
|
+
if (window.moment) {
|
|
15147
|
+
dt = window.moment.utc( d, format, locale, true );
|
|
15148
|
+
|
|
15149
|
+
if (! dt.isValid()) {
|
|
15150
|
+
return null;
|
|
15151
|
+
}
|
|
15152
|
+
}
|
|
15153
|
+
else if (window.luxon) {
|
|
15154
|
+
dt = format
|
|
15155
|
+
? window.luxon.DateTime.fromFormat( d, format )
|
|
15156
|
+
: window.luxon.DateTime.fromISO( d );
|
|
15157
|
+
|
|
15158
|
+
if (! dt.isValid) {
|
|
15159
|
+
return null;
|
|
15160
|
+
}
|
|
15161
|
+
|
|
15162
|
+
dt.setLocale(locale);
|
|
15163
|
+
}
|
|
15164
|
+
else if (! format) {
|
|
15165
|
+
// No format given, must be ISO
|
|
15166
|
+
dt = new Date(d);
|
|
15167
|
+
}
|
|
15168
|
+
else {
|
|
15169
|
+
if (! __mlWarning) {
|
|
15170
|
+
alert('DataTables warning: Formatted date without Moment.js or Luxon - https://datatables.net/tn/17');
|
|
15171
|
+
}
|
|
15172
|
+
|
|
15173
|
+
__mlWarning = true;
|
|
15174
|
+
}
|
|
15175
|
+
|
|
15176
|
+
return dt;
|
|
15177
|
+
}
|
|
15178
|
+
|
|
15179
|
+
// Wrapper for date, datetime and time which all operate the same way with the exception of
|
|
15180
|
+
// the output string for auto locale support
|
|
15181
|
+
function __mlHelper (localeString) {
|
|
15182
|
+
return function ( from, to, locale, def ) {
|
|
15183
|
+
// Luxon and Moment support
|
|
15184
|
+
// Argument shifting
|
|
15185
|
+
if ( arguments.length === 0 ) {
|
|
15186
|
+
locale = 'en';
|
|
15187
|
+
to = null; // means toLocaleString
|
|
15188
|
+
from = null; // means iso8601
|
|
15189
|
+
}
|
|
15190
|
+
else if ( arguments.length === 1 ) {
|
|
15191
|
+
locale = 'en';
|
|
15192
|
+
to = from;
|
|
15193
|
+
from = null;
|
|
15194
|
+
}
|
|
15195
|
+
else if ( arguments.length === 2 ) {
|
|
15196
|
+
locale = to;
|
|
15197
|
+
to = from;
|
|
15198
|
+
from = null;
|
|
15199
|
+
}
|
|
15200
|
+
|
|
15201
|
+
var typeName = 'datetime-' + to;
|
|
15202
|
+
|
|
15203
|
+
// Add type detection and sorting specific to this date format - we need to be able to identify
|
|
15204
|
+
// date type columns as such, rather than as numbers in extensions. Hence the need for this.
|
|
15205
|
+
if (! DataTable.ext.type.order[typeName]) {
|
|
15206
|
+
// The renderer will give the value to type detect as the type!
|
|
15207
|
+
DataTable.ext.type.detect.unshift(function (d) {
|
|
15208
|
+
return d === typeName ? typeName : false;
|
|
15209
|
+
});
|
|
15210
|
+
|
|
15211
|
+
// The renderer gives us Moment, Luxon or Date obects for the sorting, all of which have a
|
|
15212
|
+
// `valueOf` which gives milliseconds epoch
|
|
15213
|
+
DataTable.ext.type.order[typeName + '-asc'] = function (a, b) {
|
|
15214
|
+
var x = a.valueOf();
|
|
15215
|
+
var y = b.valueOf();
|
|
15216
|
+
|
|
15217
|
+
return x === y
|
|
15218
|
+
? 0
|
|
15219
|
+
: x < y
|
|
15220
|
+
? -1
|
|
15221
|
+
: 1;
|
|
15222
|
+
}
|
|
15223
|
+
|
|
15224
|
+
DataTable.ext.type.order[typeName + '-desc'] = function (a, b) {
|
|
15225
|
+
var x = a.valueOf();
|
|
15226
|
+
var y = b.valueOf();
|
|
15227
|
+
|
|
15228
|
+
return x === y
|
|
15229
|
+
? 0
|
|
15230
|
+
: x > y
|
|
15231
|
+
? -1
|
|
15232
|
+
: 1;
|
|
15233
|
+
}
|
|
15234
|
+
}
|
|
15235
|
+
|
|
15236
|
+
return function ( d, type ) {
|
|
15237
|
+
// Allow for a default value
|
|
15238
|
+
if (d === null || d === undefined) {
|
|
15239
|
+
if (def === '--now') {
|
|
15240
|
+
// We treat everything as UTC further down, so no changes are
|
|
15241
|
+
// made, as such need to get the local date / time as if it were
|
|
15242
|
+
// UTC
|
|
15243
|
+
var local = new Date();
|
|
15244
|
+
d = new Date( Date.UTC(
|
|
15245
|
+
local.getFullYear(), local.getMonth(), local.getDate(),
|
|
15246
|
+
local.getHours(), local.getMinutes(), local.getSeconds()
|
|
15247
|
+
) );
|
|
15248
|
+
}
|
|
15249
|
+
else {
|
|
15250
|
+
d = '';
|
|
15251
|
+
}
|
|
15252
|
+
}
|
|
15253
|
+
|
|
15254
|
+
if (type === 'type') {
|
|
15255
|
+
// Typing uses the type name for fast matching
|
|
15256
|
+
return typeName;
|
|
15257
|
+
}
|
|
15258
|
+
|
|
15259
|
+
if (d === '') {
|
|
15260
|
+
return type !== 'sort'
|
|
15261
|
+
? ''
|
|
15262
|
+
: __mldObj('0000-01-01 00:00:00', null, locale);
|
|
15263
|
+
}
|
|
15264
|
+
|
|
15265
|
+
// Shortcut. If `from` and `to` are the same, we are using the renderer to
|
|
15266
|
+
// format for ordering, not display - its already in the display format.
|
|
15267
|
+
if ( to !== null && from === to && type !== 'sort' && type !== 'type' && ! (d instanceof Date) ) {
|
|
15268
|
+
return d;
|
|
15269
|
+
}
|
|
15270
|
+
|
|
15271
|
+
var dt = __mldObj(d, from, locale);
|
|
15272
|
+
|
|
15273
|
+
if (dt === null) {
|
|
15274
|
+
return d;
|
|
15275
|
+
}
|
|
15276
|
+
|
|
15277
|
+
if (type === 'sort') {
|
|
15278
|
+
return dt;
|
|
15279
|
+
}
|
|
15280
|
+
|
|
15281
|
+
var formatted = to === null
|
|
15282
|
+
? __mld(dt, 'toDate', 'toJSDate', '')[localeString]()
|
|
15283
|
+
: __mld(dt, 'format', 'toFormat', 'toISOString', to);
|
|
15284
|
+
|
|
15285
|
+
// XSS protection
|
|
15286
|
+
return type === 'display' ?
|
|
15287
|
+
__htmlEscapeEntities( formatted ) :
|
|
15288
|
+
formatted;
|
|
15289
|
+
};
|
|
15290
|
+
}
|
|
15291
|
+
}
|
|
15292
|
+
|
|
15293
|
+
// Based on locale, determine standard number formatting
|
|
15294
|
+
var __thousands = '';
|
|
15295
|
+
var __decimal = '';
|
|
15296
|
+
|
|
15297
|
+
if (Intl) {
|
|
15298
|
+
var num = new Intl.NumberFormat().formatToParts(1000.1);
|
|
15299
|
+
|
|
15300
|
+
__thousands = num[1].value;
|
|
15301
|
+
__decimal = num[3].value;
|
|
15302
|
+
}
|
|
15303
|
+
|
|
15304
|
+
// Formatted date time detection - use by declaring the formats you are going to use
|
|
15305
|
+
DataTable.datetime = function ( format, locale ) {
|
|
15306
|
+
var typeName = 'datetime-detect-' + format;
|
|
15307
|
+
|
|
15308
|
+
if (! locale) {
|
|
15309
|
+
locale = 'en';
|
|
15310
|
+
}
|
|
15311
|
+
|
|
15312
|
+
if (! DataTable.ext.type.order[typeName]) {
|
|
15313
|
+
DataTable.ext.type.detect.unshift(function (d) {
|
|
15314
|
+
var dt = __mldObj(d, format, locale);
|
|
15315
|
+
return d === '' || dt ? typeName : false;
|
|
15316
|
+
});
|
|
15317
|
+
|
|
15318
|
+
DataTable.ext.type.order[typeName + '-pre'] = function (d) {
|
|
15319
|
+
return __mldObj(d, format, locale) || 0;
|
|
15320
|
+
}
|
|
15321
|
+
}
|
|
15322
|
+
}
|
|
15323
|
+
|
|
15106
15324
|
/**
|
|
15107
15325
|
* Helpers for `columns.render`.
|
|
15108
15326
|
*
|
|
@@ -15130,7 +15348,19 @@
|
|
|
15130
15348
|
* @namespace
|
|
15131
15349
|
*/
|
|
15132
15350
|
DataTable.render = {
|
|
15351
|
+
date: __mlHelper('toLocaleDateString'),
|
|
15352
|
+
datetime: __mlHelper('toLocaleString'),
|
|
15353
|
+
time: __mlHelper('toLocaleTimeString'),
|
|
15133
15354
|
number: function ( thousands, decimal, precision, prefix, postfix ) {
|
|
15355
|
+
// Auto locale detection
|
|
15356
|
+
if (thousands === null || thousands === undefined) {
|
|
15357
|
+
thousands = __thousands;
|
|
15358
|
+
}
|
|
15359
|
+
|
|
15360
|
+
if (decimal === null || decimal === undefined) {
|
|
15361
|
+
decimal = __decimal;
|
|
15362
|
+
}
|
|
15363
|
+
|
|
15134
15364
|
return {
|
|
15135
15365
|
display: function ( d ) {
|
|
15136
15366
|
if ( typeof d !== 'number' && typeof d !== 'string' ) {
|
|
@@ -15305,28 +15535,28 @@
|
|
|
15305
15535
|
// added to prevent errors
|
|
15306
15536
|
} );
|
|
15307
15537
|
|
|
15308
|
-
|
|
15538
|
+
|
|
15309
15539
|
// jQuery access
|
|
15310
15540
|
$.fn.dataTable = DataTable;
|
|
15311
|
-
|
|
15541
|
+
|
|
15312
15542
|
// Provide access to the host jQuery object (circular reference)
|
|
15313
15543
|
DataTable.$ = $;
|
|
15314
|
-
|
|
15544
|
+
|
|
15315
15545
|
// Legacy aliases
|
|
15316
15546
|
$.fn.dataTableSettings = DataTable.settings;
|
|
15317
15547
|
$.fn.dataTableExt = DataTable.ext;
|
|
15318
|
-
|
|
15548
|
+
|
|
15319
15549
|
// With a capital `D` we return a DataTables API instance rather than a
|
|
15320
15550
|
// jQuery object
|
|
15321
15551
|
$.fn.DataTable = function ( opts ) {
|
|
15322
15552
|
return $(this).dataTable( opts ).api();
|
|
15323
15553
|
};
|
|
15324
|
-
|
|
15554
|
+
|
|
15325
15555
|
// All properties that are available to $.fn.dataTable should also be
|
|
15326
15556
|
// available on $.fn.DataTable
|
|
15327
15557
|
$.each( DataTable, function ( prop, val ) {
|
|
15328
15558
|
$.fn.DataTable[ prop ] = val;
|
|
15329
15559
|
} );
|
|
15330
|
-
|
|
15560
|
+
|
|
15331
15561
|
return DataTable;
|
|
15332
15562
|
}));
|