datatables.net 2.0.1 → 2.0.3
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/dataTables.js +86 -63
- package/js/dataTables.min.js +2 -2
- package/js/dataTables.min.mjs +2 -2
- package/js/dataTables.mjs +85 -62
- package/package.json +1 -1
- package/types/types.d.ts +135 -180
package/js/dataTables.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! DataTables 2.0.
|
|
1
|
+
/*! DataTables 2.0.3
|
|
2
2
|
* © 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 2.0.
|
|
8
|
+
* @version 2.0.3
|
|
9
9
|
* @author SpryMedia Ltd
|
|
10
10
|
* @contact www.datatables.net
|
|
11
11
|
* @copyright SpryMedia Ltd.
|
|
@@ -317,7 +317,7 @@
|
|
|
317
317
|
_fnCamelToHungarian( defaults.oLanguage, json );
|
|
318
318
|
$.extend( true, oLanguage, json, oSettings.oInit.oLanguage );
|
|
319
319
|
|
|
320
|
-
_fnCallbackFire( oSettings, null, 'i18n', [oSettings]);
|
|
320
|
+
_fnCallbackFire( oSettings, null, 'i18n', [oSettings], true);
|
|
321
321
|
_fnInitialise( oSettings );
|
|
322
322
|
},
|
|
323
323
|
error: function () {
|
|
@@ -2355,7 +2355,7 @@
|
|
|
2355
2355
|
*/
|
|
2356
2356
|
function _columnAutoClass(container, colIdx, className) {
|
|
2357
2357
|
container.forEach(function (row) {
|
|
2358
|
-
if (row[colIdx].unique) {
|
|
2358
|
+
if (row[colIdx] && row[colIdx].unique) {
|
|
2359
2359
|
_addClass(row[colIdx].cell, className);
|
|
2360
2360
|
}
|
|
2361
2361
|
});
|
|
@@ -2442,17 +2442,19 @@
|
|
|
2442
2442
|
else {
|
|
2443
2443
|
// Cell selector
|
|
2444
2444
|
headerLayout.forEach(function (row) {
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
target
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2445
|
+
if (row[k]) {
|
|
2446
|
+
var cell = $(row[k].cell);
|
|
2447
|
+
|
|
2448
|
+
// Legacy support. Note that it means that we don't support
|
|
2449
|
+
// an element name selector only, since they are treated as
|
|
2450
|
+
// class names for 1.x compat.
|
|
2451
|
+
if (target.match(/^[a-z][\w-]*$/i)) {
|
|
2452
|
+
target = '.' + target;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
if (cell.is( target )) {
|
|
2456
|
+
fn( k, def );
|
|
2457
|
+
}
|
|
2456
2458
|
}
|
|
2457
2459
|
});
|
|
2458
2460
|
}
|
|
@@ -3266,11 +3268,15 @@
|
|
|
3266
3268
|
colspan++;
|
|
3267
3269
|
}
|
|
3268
3270
|
|
|
3271
|
+
var titleSpan = $('span.dt-column-title', cell);
|
|
3272
|
+
|
|
3269
3273
|
structure[row][column] = {
|
|
3270
3274
|
cell: cell,
|
|
3271
3275
|
colspan: colspan,
|
|
3272
3276
|
rowspan: rowspan,
|
|
3273
|
-
title:
|
|
3277
|
+
title: titleSpan.length
|
|
3278
|
+
? titleSpan.html()
|
|
3279
|
+
: $(cell).html()
|
|
3274
3280
|
};
|
|
3275
3281
|
}
|
|
3276
3282
|
}
|
|
@@ -3411,8 +3417,15 @@
|
|
|
3411
3417
|
_fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
|
|
3412
3418
|
_fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] );
|
|
3413
3419
|
|
|
3414
|
-
|
|
3415
|
-
|
|
3420
|
+
// replaceChildren is faster, but only became widespread in 2020,
|
|
3421
|
+
// so a fall back in jQuery is provided for older browsers.
|
|
3422
|
+
if (body[0].replaceChildren) {
|
|
3423
|
+
body[0].replaceChildren.apply(body[0], anRows);
|
|
3424
|
+
}
|
|
3425
|
+
else {
|
|
3426
|
+
body.children().detach();
|
|
3427
|
+
body.append( $(anRows) );
|
|
3428
|
+
}
|
|
3416
3429
|
|
|
3417
3430
|
// Empty table needs a specific class
|
|
3418
3431
|
$(oSettings.nTableWrapper).toggleClass('dt-empty-footer', $('tr', oSettings.nTFoot).length === 0);
|
|
@@ -3680,15 +3693,15 @@
|
|
|
3680
3693
|
|
|
3681
3694
|
settings.nTableWrapper = insert[0];
|
|
3682
3695
|
|
|
3683
|
-
var top = _layoutArray( settings, settings.layout, 'top' );
|
|
3684
|
-
var bottom = _layoutArray( settings, settings.layout, 'bottom' );
|
|
3685
|
-
var renderer = _fnRenderer( settings, 'layout' );
|
|
3686
|
-
|
|
3687
3696
|
if (settings.sDom) {
|
|
3688
3697
|
// Legacy
|
|
3689
3698
|
_fnLayoutDom(settings, settings.sDom, insert);
|
|
3690
3699
|
}
|
|
3691
3700
|
else {
|
|
3701
|
+
var top = _layoutArray( settings, settings.layout, 'top' );
|
|
3702
|
+
var bottom = _layoutArray( settings, settings.layout, 'bottom' );
|
|
3703
|
+
var renderer = _fnRenderer( settings, 'layout' );
|
|
3704
|
+
|
|
3692
3705
|
// Everything above - the renderer will actually insert the contents into the document
|
|
3693
3706
|
top.forEach(function (item) {
|
|
3694
3707
|
renderer( settings, insert, item );
|
|
@@ -4055,7 +4068,12 @@
|
|
|
4055
4068
|
oSettings.jqXHR = ajax.call( instance, data, callback, oSettings );
|
|
4056
4069
|
}
|
|
4057
4070
|
else if (ajax.url === '') {
|
|
4058
|
-
|
|
4071
|
+
// No url, so don't load any data. Just apply an empty data array
|
|
4072
|
+
// to the object for the callback.
|
|
4073
|
+
var empty = {};
|
|
4074
|
+
|
|
4075
|
+
DataTable.util.set(ajax.dataSrc)(empty, []);
|
|
4076
|
+
callback(empty);
|
|
4059
4077
|
}
|
|
4060
4078
|
else {
|
|
4061
4079
|
// Object to extend the base settings
|
|
@@ -5057,12 +5075,12 @@
|
|
|
5057
5075
|
// the content of the cell so that the width applied to the header and body
|
|
5058
5076
|
// both match, but we want to hide it completely.
|
|
5059
5077
|
$('th, td', headerCopy).each(function () {
|
|
5060
|
-
$(this
|
|
5078
|
+
$(this.childNodes).wrapAll('<div class="dt-scroll-sizing">');
|
|
5061
5079
|
});
|
|
5062
5080
|
|
|
5063
5081
|
if ( footer ) {
|
|
5064
5082
|
$('th, td', footerCopy).each(function () {
|
|
5065
|
-
$(this
|
|
5083
|
+
$(this.childNodes).wrapAll('<div class="dt-scroll-sizing">');
|
|
5066
5084
|
});
|
|
5067
5085
|
}
|
|
5068
5086
|
|
|
@@ -5417,34 +5435,44 @@
|
|
|
5417
5435
|
|
|
5418
5436
|
function _fnSortAttachListener(settings, node, selector, column, callback) {
|
|
5419
5437
|
_fnBindAction( node, selector, function (e) {
|
|
5438
|
+
var run = false;
|
|
5420
5439
|
var columns = column === undefined
|
|
5421
5440
|
? _fnColumnsFromHeader( e.target )
|
|
5422
5441
|
: [column];
|
|
5423
5442
|
|
|
5424
5443
|
if ( columns.length ) {
|
|
5425
|
-
|
|
5444
|
+
for ( var i=0, ien=columns.length ; i<ien ; i++ ) {
|
|
5445
|
+
var ret = _fnSortAdd( settings, columns[i], i, e.shiftKey );
|
|
5426
5446
|
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
_fnSortAdd( settings, columns[i], i, e.shiftKey );
|
|
5447
|
+
if (ret !== false) {
|
|
5448
|
+
run = true;
|
|
5449
|
+
}
|
|
5431
5450
|
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
}
|
|
5451
|
+
// If the first entry is no sort, then subsequent
|
|
5452
|
+
// sort columns are ignored
|
|
5453
|
+
if (settings.aaSorting.length === 1 && settings.aaSorting[0][1] === '') {
|
|
5454
|
+
break;
|
|
5437
5455
|
}
|
|
5456
|
+
}
|
|
5438
5457
|
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
_fnReDraw( settings, false, false );
|
|
5442
|
-
_fnProcessingDisplay( settings, false );
|
|
5458
|
+
if (run) {
|
|
5459
|
+
_fnProcessingDisplay( settings, true );
|
|
5443
5460
|
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5461
|
+
// Allow the processing display to show
|
|
5462
|
+
setTimeout( function () {
|
|
5463
|
+
_fnSort( settings );
|
|
5464
|
+
_fnSortDisplay( settings, settings.aiDisplay );
|
|
5465
|
+
|
|
5466
|
+
// Sort processing done - redraw has its own processing display
|
|
5467
|
+
_fnProcessingDisplay( settings, false );
|
|
5468
|
+
|
|
5469
|
+
_fnReDraw( settings, false, false );
|
|
5470
|
+
|
|
5471
|
+
if (callback) {
|
|
5472
|
+
callback();
|
|
5473
|
+
}
|
|
5474
|
+
}, 0);
|
|
5475
|
+
}
|
|
5448
5476
|
}
|
|
5449
5477
|
} );
|
|
5450
5478
|
}
|
|
@@ -5453,8 +5481,7 @@
|
|
|
5453
5481
|
* Sort the display array to match the master's order
|
|
5454
5482
|
* @param {*} settings
|
|
5455
5483
|
*/
|
|
5456
|
-
function _fnSortDisplay(settings) {
|
|
5457
|
-
var display = settings.aiDisplay;
|
|
5484
|
+
function _fnSortDisplay(settings, display) {
|
|
5458
5485
|
var master = settings.aiDisplayMaster;
|
|
5459
5486
|
var masterMap = {};
|
|
5460
5487
|
var map = {};
|
|
@@ -5748,7 +5775,7 @@
|
|
|
5748
5775
|
};
|
|
5749
5776
|
|
|
5750
5777
|
if ( ! col.bSortable ) {
|
|
5751
|
-
return;
|
|
5778
|
+
return false;
|
|
5752
5779
|
}
|
|
5753
5780
|
|
|
5754
5781
|
// Convert to 2D array if needed
|
|
@@ -7675,11 +7702,7 @@
|
|
|
7675
7702
|
var matched = _selector_run( 'row', selector, run, settings, opts );
|
|
7676
7703
|
|
|
7677
7704
|
if (opts.order === 'current' || opts.order === 'applied') {
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
matched.sort(function(a, b) {
|
|
7681
|
-
return master.indexOf(a) - master.indexOf(b);
|
|
7682
|
-
});
|
|
7705
|
+
_fnSortDisplay(settings, matched);
|
|
7683
7706
|
}
|
|
7684
7707
|
|
|
7685
7708
|
return matched;
|
|
@@ -8073,7 +8096,7 @@
|
|
|
8073
8096
|
for ( var i=0, ien=data.length ; i<ien ; i++ ) {
|
|
8074
8097
|
row = data[i];
|
|
8075
8098
|
|
|
8076
|
-
if ( row._details ) {
|
|
8099
|
+
if ( row && row._details ) {
|
|
8077
8100
|
row._details.each(function () {
|
|
8078
8101
|
var el = $(this).children('td');
|
|
8079
8102
|
|
|
@@ -8092,7 +8115,7 @@
|
|
|
8092
8115
|
}
|
|
8093
8116
|
|
|
8094
8117
|
for ( var i=0, ien=data.length ; i<ien ; i++ ) {
|
|
8095
|
-
if ( data[i]._details ) {
|
|
8118
|
+
if ( data[i] && data[i]._details ) {
|
|
8096
8119
|
__details_remove( api, i );
|
|
8097
8120
|
}
|
|
8098
8121
|
}
|
|
@@ -8114,9 +8137,9 @@
|
|
|
8114
8137
|
|
|
8115
8138
|
if ( data === undefined ) {
|
|
8116
8139
|
// get
|
|
8117
|
-
return ctx.length && this.length
|
|
8118
|
-
ctx[0].aoData[ this[0] ]._details
|
|
8119
|
-
undefined;
|
|
8140
|
+
return ctx.length && this.length && ctx[0].aoData[ this[0] ]
|
|
8141
|
+
? ctx[0].aoData[ this[0] ]._details
|
|
8142
|
+
: undefined;
|
|
8120
8143
|
}
|
|
8121
8144
|
else if ( data === true ) {
|
|
8122
8145
|
// show
|
|
@@ -9540,7 +9563,7 @@
|
|
|
9540
9563
|
* @type string
|
|
9541
9564
|
* @default Version number
|
|
9542
9565
|
*/
|
|
9543
|
-
DataTable.version = "2.0.
|
|
9566
|
+
DataTable.version = "2.0.3";
|
|
9544
9567
|
|
|
9545
9568
|
/**
|
|
9546
9569
|
* Private data store, containing all of the settings objects that are
|
|
@@ -12676,7 +12699,7 @@
|
|
|
12676
12699
|
};
|
|
12677
12700
|
|
|
12678
12701
|
// prop is optional
|
|
12679
|
-
if (
|
|
12702
|
+
if (val === undefined) {
|
|
12680
12703
|
val = prop;
|
|
12681
12704
|
prop = null;
|
|
12682
12705
|
}
|
|
@@ -12942,9 +12965,9 @@
|
|
|
12942
12965
|
var ariaType = '';
|
|
12943
12966
|
var indexes = columns.indexes();
|
|
12944
12967
|
var sortDirs = columns.orderable(true).flatten();
|
|
12945
|
-
var orderedColumns = sorting.map( function (val) {
|
|
12968
|
+
var orderedColumns = ',' + sorting.map( function (val) {
|
|
12946
12969
|
return val.col;
|
|
12947
|
-
} ).join(',');
|
|
12970
|
+
} ).join(',') + ',';
|
|
12948
12971
|
|
|
12949
12972
|
cell
|
|
12950
12973
|
.removeClass(
|
|
@@ -12955,7 +12978,7 @@
|
|
|
12955
12978
|
.toggleClass( orderClasses.canAsc, orderable && sortDirs.includes('asc') )
|
|
12956
12979
|
.toggleClass( orderClasses.canDesc, orderable && sortDirs.includes('desc') );
|
|
12957
12980
|
|
|
12958
|
-
var sortIdx = orderedColumns.indexOf( indexes.toArray().join(',') );
|
|
12981
|
+
var sortIdx = orderedColumns.indexOf( ',' + indexes.toArray().join(',') + ',' );
|
|
12959
12982
|
|
|
12960
12983
|
if ( sortIdx !== -1 ) {
|
|
12961
12984
|
// Get the ordering direction for the columns under this cell
|
|
@@ -12970,7 +12993,7 @@
|
|
|
12970
12993
|
}
|
|
12971
12994
|
|
|
12972
12995
|
// The ARIA spec says that only one column should be marked with aria-sort
|
|
12973
|
-
if ( sortIdx === 0
|
|
12996
|
+
if ( sortIdx === 0 ) {
|
|
12974
12997
|
var firstSort = sorting[0];
|
|
12975
12998
|
var sortOrder = col.asSorting;
|
|
12976
12999
|
|
|
@@ -13335,7 +13358,7 @@
|
|
|
13335
13358
|
if (
|
|
13336
13359
|
buttonEls.length && // any buttons
|
|
13337
13360
|
opts.numbers > 1 && // prevent infinite
|
|
13338
|
-
$(host).
|
|
13361
|
+
$(host).height() >= ($(buttonEls[0]).outerHeight() * 2) - 10
|
|
13339
13362
|
) {
|
|
13340
13363
|
_pagingDraw(settings, host, $.extend({}, opts, { numbers: opts.numbers - 2 }));
|
|
13341
13364
|
}
|