datatables.net 3.0.1 → 3.0.2
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 +79 -47
- package/js/dataTables.min.js +2 -2
- package/js/dataTables.min.mjs +2 -2
- package/js/dataTables.mjs +79 -47
- package/package.json +1 -1
- package/types/types.d.ts +2 -2
package/js/dataTables.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DataTables 3.0.
|
|
1
|
+
/*! DataTables 3.0.2
|
|
2
2
|
* Copyright (c) SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*/
|
|
4
4
|
|
|
@@ -3920,7 +3920,7 @@ const ext = {
|
|
|
3920
3920
|
* Software version
|
|
3921
3921
|
* @type string
|
|
3922
3922
|
*/
|
|
3923
|
-
version: '3.0.
|
|
3923
|
+
version: '3.0.2'
|
|
3924
3924
|
};
|
|
3925
3925
|
//
|
|
3926
3926
|
// Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts
|
|
@@ -5012,7 +5012,7 @@ function clearTable(settings) {
|
|
|
5012
5012
|
* @param colIdx Column index to invalidate. If undefined the whole row will be
|
|
5013
5013
|
* invalidated
|
|
5014
5014
|
*/
|
|
5015
|
-
function
|
|
5015
|
+
function invalidateRow(settings, rowIdx, src, colIdx) {
|
|
5016
5016
|
var row = settings.data[rowIdx];
|
|
5017
5017
|
var i, iLen;
|
|
5018
5018
|
if (!row) {
|
|
@@ -5042,6 +5042,18 @@ function invalidate(settings, rowIdx, src, colIdx) {
|
|
|
5042
5042
|
}
|
|
5043
5043
|
}
|
|
5044
5044
|
}
|
|
5045
|
+
invalidColumn(settings, colIdx);
|
|
5046
|
+
// Update DataTables special `DT_*` attributes for the row
|
|
5047
|
+
rowAttributes(settings, row);
|
|
5048
|
+
callbackFire(settings, null, 'rowInvalidate', [settings, rowIdx, colIdx], false);
|
|
5049
|
+
}
|
|
5050
|
+
/**
|
|
5051
|
+
* Column specific invalidation
|
|
5052
|
+
*
|
|
5053
|
+
* @param settings DataTables settings object
|
|
5054
|
+
* @param colIdx Column index to invalidate, or all columns if not given
|
|
5055
|
+
*/
|
|
5056
|
+
function invalidColumn(settings, colIdx) {
|
|
5045
5057
|
// Column specific invalidation
|
|
5046
5058
|
var cols = settings.columns;
|
|
5047
5059
|
if (colIdx !== undefined) {
|
|
@@ -5052,14 +5064,12 @@ function invalidate(settings, rowIdx, src, colIdx) {
|
|
|
5052
5064
|
cols[colIdx].wideStrings = null;
|
|
5053
5065
|
}
|
|
5054
5066
|
else {
|
|
5055
|
-
for (i = 0, iLen = cols.length; i < iLen; i++) {
|
|
5067
|
+
for (let i = 0, iLen = cols.length; i < iLen; i++) {
|
|
5056
5068
|
cols[i].type = null;
|
|
5057
5069
|
cols[i].wideStrings = null;
|
|
5058
5070
|
}
|
|
5059
|
-
// Update DataTables special `DT_*` attributes for the row
|
|
5060
|
-
rowAttributes(settings, row);
|
|
5061
5071
|
}
|
|
5062
|
-
|
|
5072
|
+
settings.containerWidth = -1;
|
|
5063
5073
|
}
|
|
5064
5074
|
/**
|
|
5065
5075
|
* Get the cells and data for a given row - from a <tr> element
|
|
@@ -5148,10 +5158,21 @@ function readCellData(settings, cell, data, colIdx) {
|
|
|
5148
5158
|
}
|
|
5149
5159
|
}
|
|
5150
5160
|
|
|
5161
|
+
/**
|
|
5162
|
+
* Recalculate the column widths, if needed (by a column having been
|
|
5163
|
+
* invalidated)
|
|
5164
|
+
*
|
|
5165
|
+
* @param settings DataTables settings object
|
|
5166
|
+
*/
|
|
5167
|
+
function columnWidths(settings) {
|
|
5168
|
+
if (settings.columns.map(c => c.wideStrings).includes(null)) {
|
|
5169
|
+
calculateColumnWidths(settings);
|
|
5170
|
+
}
|
|
5171
|
+
}
|
|
5151
5172
|
/**
|
|
5152
5173
|
* Calculate the width of columns for the table
|
|
5153
5174
|
*
|
|
5154
|
-
* @param settings
|
|
5175
|
+
* @param settings DataTables settings object
|
|
5155
5176
|
*/
|
|
5156
5177
|
function calculateColumnWidths(settings) {
|
|
5157
5178
|
// Not interested in doing column width calculation if auto-width is disabled
|
|
@@ -5699,12 +5720,9 @@ function scrollDraw(settings) {
|
|
|
5699
5720
|
// Check against what the colgroup > col is set to and correct if needed
|
|
5700
5721
|
for (let i = 0; i < colSizes.length; i++) {
|
|
5701
5722
|
let colEl = settings.columns[colSizes[i].idx].colEl;
|
|
5702
|
-
|
|
5703
|
-
if (
|
|
5704
|
-
colEl.css('
|
|
5705
|
-
if (scroll.x) {
|
|
5706
|
-
colEl.css('minWidth', colSizes[i].width + 'px');
|
|
5707
|
-
}
|
|
5723
|
+
colEl.css('width', colSizes[i].width + 'px');
|
|
5724
|
+
if (scroll.x) {
|
|
5725
|
+
colEl.css('minWidth', colSizes[i].width + 'px');
|
|
5708
5726
|
}
|
|
5709
5727
|
}
|
|
5710
5728
|
}
|
|
@@ -6002,13 +6020,15 @@ function _typeResult(typeDetect, res) {
|
|
|
6002
6020
|
* Calculate the 'type' of a column
|
|
6003
6021
|
* @param settings DataTables settings object
|
|
6004
6022
|
*/
|
|
6005
|
-
function columnTypes(settings) {
|
|
6023
|
+
function columnTypes(settings, originalTypes = '') {
|
|
6006
6024
|
var columns = settings.columns;
|
|
6007
6025
|
var data = settings.data;
|
|
6008
6026
|
var types = ext.type.detect;
|
|
6009
6027
|
var i, iLen, j, jen, k, ken;
|
|
6010
6028
|
var col, detectedType, cache;
|
|
6011
|
-
|
|
6029
|
+
if (!originalTypes) {
|
|
6030
|
+
originalTypes = columns.map(c => c.type).join(',');
|
|
6031
|
+
}
|
|
6012
6032
|
// For each column, spin over the data type detection functions, seeing if
|
|
6013
6033
|
// one matches
|
|
6014
6034
|
for (i = 0, iLen = columns.length; i < iLen; i++) {
|
|
@@ -7707,6 +7727,7 @@ function ajaxUpdateDraw(settings, json) {
|
|
|
7707
7727
|
var drawUnique = ajaxDataSrcParam(settings, 'draw', json);
|
|
7708
7728
|
var recordsTotal = ajaxDataSrcParam(settings, 'recordsTotal', json);
|
|
7709
7729
|
var recordsFiltered = ajaxDataSrcParam(settings, 'recordsFiltered', json);
|
|
7730
|
+
var existingTypes = settings.columns.map(c => c.type).join(',');
|
|
7710
7731
|
if (drawUnique !== undefined) {
|
|
7711
7732
|
// Protect against out of sequence returns
|
|
7712
7733
|
if (drawUnique * 1 < settings.drawCount) {
|
|
@@ -7726,7 +7747,7 @@ function ajaxUpdateDraw(settings, json) {
|
|
|
7726
7747
|
addData(settings, data[i]);
|
|
7727
7748
|
}
|
|
7728
7749
|
settings.display = settings.displayMaster.slice();
|
|
7729
|
-
columnTypes(settings);
|
|
7750
|
+
columnTypes(settings, existingTypes);
|
|
7730
7751
|
draw(settings, true);
|
|
7731
7752
|
initComplete(settings);
|
|
7732
7753
|
processingDisplay(settings, false);
|
|
@@ -8438,6 +8459,7 @@ function reDraw(settings, holdPosition, recompute) {
|
|
|
8438
8459
|
// Resolve any column types that are unknown due to addition or
|
|
8439
8460
|
// invalidation
|
|
8440
8461
|
columnTypes(settings);
|
|
8462
|
+
columnWidths(settings);
|
|
8441
8463
|
if (doSort) {
|
|
8442
8464
|
sort(settings);
|
|
8443
8465
|
}
|
|
@@ -9754,7 +9776,7 @@ registerPlural('cells().indexes()', 'cell().index()', function () {
|
|
|
9754
9776
|
});
|
|
9755
9777
|
registerPlural('cells().invalidate()', 'cell().invalidate()', function (src) {
|
|
9756
9778
|
return this.iterator('cell', function (settings, row, column) {
|
|
9757
|
-
|
|
9779
|
+
invalidateRow(settings, row, src, column);
|
|
9758
9780
|
});
|
|
9759
9781
|
});
|
|
9760
9782
|
register('cell()', function (rowSelector, columnSelector, opts) {
|
|
@@ -9771,7 +9793,7 @@ register('cell().data()', function (data) {
|
|
|
9771
9793
|
}
|
|
9772
9794
|
// Set
|
|
9773
9795
|
setCellData(ctx[0], cell[0].row, cell[0].column, data);
|
|
9774
|
-
|
|
9796
|
+
invalidateRow(ctx[0], cell[0].row, 'data', cell[0].column);
|
|
9775
9797
|
return this;
|
|
9776
9798
|
});
|
|
9777
9799
|
|
|
@@ -9787,7 +9809,7 @@ register('cell().data()', function (data) {
|
|
|
9787
9809
|
*/
|
|
9788
9810
|
// can be an array of these items, comma separated list, or an array of comma
|
|
9789
9811
|
// separated lists
|
|
9790
|
-
const __re_column_selector = /^(
|
|
9812
|
+
const __re_column_selector = /^(.*?):(name|title|visIdx|visible)$/;
|
|
9791
9813
|
// r1 and r2 are redundant - but it means that the parameters match for the
|
|
9792
9814
|
// iterator callback in columns().data()
|
|
9793
9815
|
function columnData(settings, column, r1, r2, rows, type) {
|
|
@@ -10723,7 +10745,7 @@ register('rows().data()', function () {
|
|
|
10723
10745
|
});
|
|
10724
10746
|
registerPlural('rows().invalidate()', 'row().invalidate()', function (src) {
|
|
10725
10747
|
return this.iterator('row', function (settings, row) {
|
|
10726
|
-
|
|
10748
|
+
invalidateRow(settings, row, src);
|
|
10727
10749
|
});
|
|
10728
10750
|
});
|
|
10729
10751
|
registerPlural('rows().indexes()', 'row().index()', function () {
|
|
@@ -10810,7 +10832,7 @@ register('row().data()', function (data) {
|
|
|
10810
10832
|
util.set(ctx[0].rowId)(data, row.tr.id);
|
|
10811
10833
|
}
|
|
10812
10834
|
// Automatically invalidate
|
|
10813
|
-
|
|
10835
|
+
invalidateRow(ctx[0], this[0][0], 'data');
|
|
10814
10836
|
return this;
|
|
10815
10837
|
});
|
|
10816
10838
|
register('row().node()', function () {
|
|
@@ -10824,12 +10846,15 @@ register('row().node()', function () {
|
|
|
10824
10846
|
return null;
|
|
10825
10847
|
});
|
|
10826
10848
|
register('row.add()', function (row) {
|
|
10827
|
-
// Allow
|
|
10828
|
-
// it though - the first element in the set
|
|
10849
|
+
// Allow an array-like object to be passed in - only a single row is added
|
|
10850
|
+
// from it though - the first element in the set
|
|
10829
10851
|
if (row && row.fn && row.length) {
|
|
10830
10852
|
row = row[0];
|
|
10831
10853
|
}
|
|
10832
10854
|
var rows = this.iterator('table', function (settings) {
|
|
10855
|
+
// New column could cause a change in the cached column properties such
|
|
10856
|
+
// as type and width.
|
|
10857
|
+
invalidColumn(settings);
|
|
10833
10858
|
if (row.nodeName && row.nodeName.toUpperCase() === 'TR') {
|
|
10834
10859
|
return addTr(settings, Dom.s(row))[0];
|
|
10835
10860
|
}
|
|
@@ -11190,7 +11215,11 @@ function b64ToBuf(b64) {
|
|
|
11190
11215
|
*/
|
|
11191
11216
|
function check(releaseDate, software) {
|
|
11192
11217
|
let expires = _licenseInfo.expires;
|
|
11193
|
-
if (
|
|
11218
|
+
if (!getSubtle()) {
|
|
11219
|
+
noticePrep('Unable to validate license key');
|
|
11220
|
+
noticeDisplay();
|
|
11221
|
+
}
|
|
11222
|
+
else if (_licenseInfo.valid === false) {
|
|
11194
11223
|
noticePrep('License key invalid');
|
|
11195
11224
|
noticeDisplay();
|
|
11196
11225
|
}
|
|
@@ -11317,7 +11346,7 @@ function noticePrep(text) {
|
|
|
11317
11346
|
* Display the license notice
|
|
11318
11347
|
*/
|
|
11319
11348
|
function noticeDisplay() {
|
|
11320
|
-
if (!_processingKey && !document.body.contains(_wm[0])) {
|
|
11349
|
+
if (!_processingKey && document.body && !document.body.contains(_wm[0])) {
|
|
11321
11350
|
document.body.appendChild(_wm[0]);
|
|
11322
11351
|
}
|
|
11323
11352
|
}
|
|
@@ -11339,36 +11368,33 @@ function verify(licenseString) {
|
|
|
11339
11368
|
}
|
|
11340
11369
|
var payload = parts[0];
|
|
11341
11370
|
var signatureB64 = parts[1];
|
|
11342
|
-
//
|
|
11343
|
-
var
|
|
11344
|
-
|
|
11371
|
+
// Extract the payload to be useful
|
|
11372
|
+
var payloadParts = payload.match(/(plus|trial|editor)_(\d+)_(\d{4})(\d{2})(\d{2})/);
|
|
11373
|
+
if (!payloadParts || payloadParts.length !== 6) {
|
|
11374
|
+
_licenseInfo.valid = false;
|
|
11375
|
+
return resolve();
|
|
11376
|
+
}
|
|
11377
|
+
_licenseInfo.type = payloadParts[1];
|
|
11378
|
+
_licenseInfo.developers = parseInt(payloadParts[2]);
|
|
11379
|
+
_licenseInfo.expires = new Date(payloadParts[3] + '-' + payloadParts[4] + '-' + payloadParts[5]);
|
|
11380
|
+
var subtle = getSubtle();
|
|
11345
11381
|
var rawKey = b64ToBuf(_publicKey);
|
|
11346
11382
|
var rawSig = b64ToBuf(signatureB64);
|
|
11347
11383
|
var data = new TextEncoder().encode(payload);
|
|
11384
|
+
// Non-secure environments don't have cryptographic verification
|
|
11385
|
+
// available.
|
|
11386
|
+
if (!subtle) {
|
|
11387
|
+
_licenseInfo.valid = false;
|
|
11388
|
+
resolve();
|
|
11389
|
+
return;
|
|
11390
|
+
}
|
|
11348
11391
|
subtle
|
|
11349
11392
|
.importKey('raw', rawKey, { name: 'ECDSA', namedCurve: 'P-256' }, false, ['verify'])
|
|
11350
11393
|
.then(function (key) {
|
|
11351
11394
|
return subtle.verify({ name: 'ECDSA', hash: { name: 'SHA-256' } }, key, rawSig, data);
|
|
11352
11395
|
})
|
|
11353
11396
|
.then(function (isValid) {
|
|
11354
|
-
|
|
11355
|
-
_licenseInfo.valid = false;
|
|
11356
|
-
return resolve();
|
|
11357
|
-
}
|
|
11358
|
-
// Extract the payload to be useful
|
|
11359
|
-
var payloadParts = payload.match(/(plus|trial|editor)_(\d+)_(\d{4})(\d{2})(\d{2})/);
|
|
11360
|
-
if (!payloadParts || payloadParts.length !== 6) {
|
|
11361
|
-
_licenseInfo.valid = false;
|
|
11362
|
-
return resolve();
|
|
11363
|
-
}
|
|
11364
|
-
_licenseInfo.valid = true;
|
|
11365
|
-
_licenseInfo.type = payloadParts[1];
|
|
11366
|
-
_licenseInfo.developers = parseInt(payloadParts[2]);
|
|
11367
|
-
_licenseInfo.expires = new Date(payloadParts[3] +
|
|
11368
|
-
'-' +
|
|
11369
|
-
payloadParts[4] +
|
|
11370
|
-
'-' +
|
|
11371
|
-
payloadParts[5]);
|
|
11397
|
+
_licenseInfo.valid = isValid;
|
|
11372
11398
|
resolve();
|
|
11373
11399
|
})
|
|
11374
11400
|
.catch(function () {
|
|
@@ -11417,6 +11443,12 @@ function plus (DataTable) {
|
|
|
11417
11443
|
writable: false
|
|
11418
11444
|
});
|
|
11419
11445
|
}
|
|
11446
|
+
function getSubtle() {
|
|
11447
|
+
// Backwards compat for old browsers
|
|
11448
|
+
let cryptoObj = window.crypto || window.msCrypto;
|
|
11449
|
+
let subtle = cryptoObj.subtle || cryptoObj.webkitSubtle;
|
|
11450
|
+
return subtle;
|
|
11451
|
+
}
|
|
11420
11452
|
|
|
11421
11453
|
/**
|
|
11422
11454
|
* CommonJS factory function pass through. This will check if the arguments
|