datatables.net 3.0.0 → 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 +114 -66
- package/js/dataTables.min.js +2 -2
- package/js/dataTables.min.mjs +2 -2
- package/js/dataTables.mjs +114 -66
- package/package.json +1 -1
- package/types/types.d.ts +44 -42
package/js/dataTables.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DataTables
|
|
1
|
+
/*! DataTables 3.0.2
|
|
2
2
|
* Copyright (c) SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*/
|
|
4
4
|
|
|
@@ -118,7 +118,7 @@ let _stripHtml = function (input, replacement = '') {
|
|
|
118
118
|
* This function is replaceable if the user wishes to use a different library
|
|
119
119
|
* for escaping HTML entities in a string.
|
|
120
120
|
*
|
|
121
|
-
* @param
|
|
121
|
+
* @param val Value to escape HTML in
|
|
122
122
|
* @returns Escaped value
|
|
123
123
|
*/
|
|
124
124
|
let _escapeHtml = function (val) {
|
|
@@ -517,7 +517,10 @@ function ajax(optionsIn) {
|
|
|
517
517
|
options.contentType = 'application/json; charset=utf-8';
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
|
-
xhr.open(method, options.url +
|
|
520
|
+
xhr.open(method, options.url +
|
|
521
|
+
(urlParams
|
|
522
|
+
? (options.url.includes('?') ? '&' : '?') + urlParams
|
|
523
|
+
: ''), true, options.username || null, options.password || null);
|
|
521
524
|
// Content type for FormData requests gets set by the browser.
|
|
522
525
|
if (options.contentType && !(options.data instanceof FormData)) {
|
|
523
526
|
xhr.setRequestHeader('Content-Type', options.contentType);
|
|
@@ -607,7 +610,9 @@ ajax.serialize = serialize;
|
|
|
607
610
|
* Run callback functions (allowing for none, one or array)
|
|
608
611
|
*
|
|
609
612
|
* @param fnIn Function(s) to run
|
|
610
|
-
* @param
|
|
613
|
+
* @param arg1 Parameters to pass to the function(s)
|
|
614
|
+
* @param arg2 Parameters to pass to the function(s)
|
|
615
|
+
* @param arg3 Parameters to pass to the function(s)
|
|
611
616
|
*/
|
|
612
617
|
function callback(fnIn, arg1, arg2, arg3) {
|
|
613
618
|
if (!fnIn) {
|
|
@@ -827,6 +832,7 @@ function pluck(a, prop, prop2) {
|
|
|
827
832
|
* as the indexes to pick from the source array
|
|
828
833
|
*
|
|
829
834
|
* @param a Array to get values from
|
|
835
|
+
* @param order Indexes to pick
|
|
830
836
|
* @param prop Property to read values from
|
|
831
837
|
* @param prop2 Inner property to get values from if a 2D array
|
|
832
838
|
* @returns Array of read values
|
|
@@ -1885,7 +1891,7 @@ class Dom {
|
|
|
1885
1891
|
/**
|
|
1886
1892
|
* Add an element (or multiple) to the instance. Will ensure uniqueness.
|
|
1887
1893
|
*
|
|
1888
|
-
* @param
|
|
1894
|
+
* @param selector Element(s) to add
|
|
1889
1895
|
* @param sort Indicate if the element should be added in document order.
|
|
1890
1896
|
* @returns Self for chaining
|
|
1891
1897
|
*/
|
|
@@ -2286,7 +2292,7 @@ class Dom {
|
|
|
2286
2292
|
/**
|
|
2287
2293
|
* Get all matching descendants
|
|
2288
2294
|
*
|
|
2289
|
-
* @param
|
|
2295
|
+
* @param input Elements to find
|
|
2290
2296
|
* @returns A new Dom instance with all matching elements
|
|
2291
2297
|
*/
|
|
2292
2298
|
find(input) {
|
|
@@ -3015,6 +3021,7 @@ const legacy = [];
|
|
|
3015
3021
|
* @param name The name of the new feature.
|
|
3016
3022
|
* @param cb A function that will create the elements and event listeners for
|
|
3017
3023
|
* the feature being added.
|
|
3024
|
+
* @param legacyChar
|
|
3018
3025
|
*/
|
|
3019
3026
|
function register$2(name, cb, legacyChar = '') {
|
|
3020
3027
|
features[name] = cb;
|
|
@@ -3879,7 +3886,7 @@ const ext = {
|
|
|
3879
3886
|
* Software version
|
|
3880
3887
|
* @type string
|
|
3881
3888
|
*/
|
|
3882
|
-
version: '3.0.
|
|
3889
|
+
version: '3.0.2'
|
|
3883
3890
|
};
|
|
3884
3891
|
//
|
|
3885
3892
|
// Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts
|
|
@@ -4784,7 +4791,7 @@ function create$1(parts = {}) {
|
|
|
4784
4791
|
* DOM source.
|
|
4785
4792
|
*
|
|
4786
4793
|
* @param settings DataTables settings object
|
|
4787
|
-
* @param
|
|
4794
|
+
* @param dataIn data array to be added
|
|
4788
4795
|
* @param tr TR element to add to the table - optional. If not given, DataTables
|
|
4789
4796
|
* will create a row automatically
|
|
4790
4797
|
* @param tds Array of TD|TH elements for the row - must be given if tr is.
|
|
@@ -4823,7 +4830,7 @@ function addData(settings, dataIn, tr, tds) {
|
|
|
4823
4830
|
* it is not cloned).
|
|
4824
4831
|
*
|
|
4825
4832
|
* @param settings DataTables settings object
|
|
4826
|
-
* @param
|
|
4833
|
+
* @param rows The TR element(s) to add to the table
|
|
4827
4834
|
* @returns Array of indexes for the added rows
|
|
4828
4835
|
*/
|
|
4829
4836
|
function addTr(settings, rows) {
|
|
@@ -4971,7 +4978,7 @@ function clearTable(settings) {
|
|
|
4971
4978
|
* @param colIdx Column index to invalidate. If undefined the whole row will be
|
|
4972
4979
|
* invalidated
|
|
4973
4980
|
*/
|
|
4974
|
-
function
|
|
4981
|
+
function invalidateRow(settings, rowIdx, src, colIdx) {
|
|
4975
4982
|
var row = settings.data[rowIdx];
|
|
4976
4983
|
var i, iLen;
|
|
4977
4984
|
if (!row) {
|
|
@@ -5001,6 +5008,18 @@ function invalidate(settings, rowIdx, src, colIdx) {
|
|
|
5001
5008
|
}
|
|
5002
5009
|
}
|
|
5003
5010
|
}
|
|
5011
|
+
invalidColumn(settings, colIdx);
|
|
5012
|
+
// Update DataTables special `DT_*` attributes for the row
|
|
5013
|
+
rowAttributes(settings, row);
|
|
5014
|
+
callbackFire(settings, null, 'rowInvalidate', [settings, rowIdx, colIdx], false);
|
|
5015
|
+
}
|
|
5016
|
+
/**
|
|
5017
|
+
* Column specific invalidation
|
|
5018
|
+
*
|
|
5019
|
+
* @param settings DataTables settings object
|
|
5020
|
+
* @param colIdx Column index to invalidate, or all columns if not given
|
|
5021
|
+
*/
|
|
5022
|
+
function invalidColumn(settings, colIdx) {
|
|
5004
5023
|
// Column specific invalidation
|
|
5005
5024
|
var cols = settings.columns;
|
|
5006
5025
|
if (colIdx !== undefined) {
|
|
@@ -5011,14 +5030,12 @@ function invalidate(settings, rowIdx, src, colIdx) {
|
|
|
5011
5030
|
cols[colIdx].wideStrings = null;
|
|
5012
5031
|
}
|
|
5013
5032
|
else {
|
|
5014
|
-
for (i = 0, iLen = cols.length; i < iLen; i++) {
|
|
5033
|
+
for (let i = 0, iLen = cols.length; i < iLen; i++) {
|
|
5015
5034
|
cols[i].type = null;
|
|
5016
5035
|
cols[i].wideStrings = null;
|
|
5017
5036
|
}
|
|
5018
|
-
// Update DataTables special `DT_*` attributes for the row
|
|
5019
|
-
rowAttributes(settings, row);
|
|
5020
5037
|
}
|
|
5021
|
-
|
|
5038
|
+
settings.containerWidth = -1;
|
|
5022
5039
|
}
|
|
5023
5040
|
/**
|
|
5024
5041
|
* Get the cells and data for a given row - from a <tr> element
|
|
@@ -5107,10 +5124,21 @@ function readCellData(settings, cell, data, colIdx) {
|
|
|
5107
5124
|
}
|
|
5108
5125
|
}
|
|
5109
5126
|
|
|
5127
|
+
/**
|
|
5128
|
+
* Recalculate the column widths, if needed (by a column having been
|
|
5129
|
+
* invalidated)
|
|
5130
|
+
*
|
|
5131
|
+
* @param settings DataTables settings object
|
|
5132
|
+
*/
|
|
5133
|
+
function columnWidths(settings) {
|
|
5134
|
+
if (settings.columns.map(c => c.wideStrings).includes(null)) {
|
|
5135
|
+
calculateColumnWidths(settings);
|
|
5136
|
+
}
|
|
5137
|
+
}
|
|
5110
5138
|
/**
|
|
5111
5139
|
* Calculate the width of columns for the table
|
|
5112
5140
|
*
|
|
5113
|
-
* @param settings
|
|
5141
|
+
* @param settings DataTables settings object
|
|
5114
5142
|
*/
|
|
5115
5143
|
function calculateColumnWidths(settings) {
|
|
5116
5144
|
// Not interested in doing column width calculation if auto-width is disabled
|
|
@@ -5405,7 +5433,7 @@ function getWideStrings(settings, colIdx) {
|
|
|
5405
5433
|
/**
|
|
5406
5434
|
* Append a CSS unit (only if required) to a string
|
|
5407
5435
|
*
|
|
5408
|
-
* @param
|
|
5436
|
+
* @param s Value to css-ify
|
|
5409
5437
|
* @returns Value with css unit
|
|
5410
5438
|
*/
|
|
5411
5439
|
function stringToCss(s) {
|
|
@@ -5658,12 +5686,9 @@ function scrollDraw(settings) {
|
|
|
5658
5686
|
// Check against what the colgroup > col is set to and correct if needed
|
|
5659
5687
|
for (let i = 0; i < colSizes.length; i++) {
|
|
5660
5688
|
let colEl = settings.columns[colSizes[i].idx].colEl;
|
|
5661
|
-
|
|
5662
|
-
if (
|
|
5663
|
-
colEl.css('
|
|
5664
|
-
if (scroll.x) {
|
|
5665
|
-
colEl.css('minWidth', colSizes[i].width + 'px');
|
|
5666
|
-
}
|
|
5689
|
+
colEl.css('width', colSizes[i].width + 'px');
|
|
5690
|
+
if (scroll.x) {
|
|
5691
|
+
colEl.css('minWidth', colSizes[i].width + 'px');
|
|
5667
5692
|
}
|
|
5668
5693
|
}
|
|
5669
5694
|
}
|
|
@@ -5961,13 +5986,15 @@ function _typeResult(typeDetect, res) {
|
|
|
5961
5986
|
* Calculate the 'type' of a column
|
|
5962
5987
|
* @param settings DataTables settings object
|
|
5963
5988
|
*/
|
|
5964
|
-
function columnTypes(settings) {
|
|
5989
|
+
function columnTypes(settings, originalTypes = '') {
|
|
5965
5990
|
var columns = settings.columns;
|
|
5966
5991
|
var data = settings.data;
|
|
5967
5992
|
var types = ext.type.detect;
|
|
5968
5993
|
var i, iLen, j, jen, k, ken;
|
|
5969
5994
|
var col, detectedType, cache;
|
|
5970
|
-
|
|
5995
|
+
if (!originalTypes) {
|
|
5996
|
+
originalTypes = columns.map(c => c.type).join(',');
|
|
5997
|
+
}
|
|
5971
5998
|
// For each column, spin over the data type detection functions, seeing if
|
|
5972
5999
|
// one matches
|
|
5973
6000
|
for (i = 0, iLen = columns.length; i < iLen; i++) {
|
|
@@ -6339,7 +6366,7 @@ function renderer(ctx, type) {
|
|
|
6339
6366
|
/**
|
|
6340
6367
|
* Add the options to the page HTML for the table
|
|
6341
6368
|
*
|
|
6342
|
-
* @param
|
|
6369
|
+
* @param ctx DataTables context
|
|
6343
6370
|
*/
|
|
6344
6371
|
function createLayout(ctx) {
|
|
6345
6372
|
var classes = ctx.classes;
|
|
@@ -6716,6 +6743,7 @@ function sortAttachListener(settings, node, selector, column, callback) {
|
|
|
6716
6743
|
* Sort the display array to match the master's order
|
|
6717
6744
|
*
|
|
6718
6745
|
* @param settings DataTables context
|
|
6746
|
+
* @param display The display array
|
|
6719
6747
|
*/
|
|
6720
6748
|
function sortDisplay(settings, display) {
|
|
6721
6749
|
if (display.length < 2) {
|
|
@@ -6943,7 +6971,6 @@ function sort(ctx, col, dir) {
|
|
|
6943
6971
|
* Function to run on user sort request
|
|
6944
6972
|
*
|
|
6945
6973
|
* @param settings dataTables settings object
|
|
6946
|
-
* @param attachTo node to attach the handler to
|
|
6947
6974
|
* @param colIdx column sorting index
|
|
6948
6975
|
* @param addIndex Counter
|
|
6949
6976
|
* @param shift Shift click add
|
|
@@ -7666,6 +7693,7 @@ function ajaxUpdateDraw(settings, json) {
|
|
|
7666
7693
|
var drawUnique = ajaxDataSrcParam(settings, 'draw', json);
|
|
7667
7694
|
var recordsTotal = ajaxDataSrcParam(settings, 'recordsTotal', json);
|
|
7668
7695
|
var recordsFiltered = ajaxDataSrcParam(settings, 'recordsFiltered', json);
|
|
7696
|
+
var existingTypes = settings.columns.map(c => c.type).join(',');
|
|
7669
7697
|
if (drawUnique !== undefined) {
|
|
7670
7698
|
// Protect against out of sequence returns
|
|
7671
7699
|
if (drawUnique * 1 < settings.drawCount) {
|
|
@@ -7685,7 +7713,7 @@ function ajaxUpdateDraw(settings, json) {
|
|
|
7685
7713
|
addData(settings, data[i]);
|
|
7686
7714
|
}
|
|
7687
7715
|
settings.display = settings.displayMaster.slice();
|
|
7688
|
-
columnTypes(settings);
|
|
7716
|
+
columnTypes(settings, existingTypes);
|
|
7689
7717
|
draw(settings, true);
|
|
7690
7718
|
initComplete(settings);
|
|
7691
7719
|
processingDisplay(settings, false);
|
|
@@ -7760,7 +7788,6 @@ const __filter_div_textContent = __filter_div.textContent !== undefined;
|
|
|
7760
7788
|
* Filter the table using both the global filter and column based filtering
|
|
7761
7789
|
*
|
|
7762
7790
|
* @param settings DataTables settings object
|
|
7763
|
-
* @param input search information
|
|
7764
7791
|
*/
|
|
7765
7792
|
function filterComplete(settings) {
|
|
7766
7793
|
settings.columns;
|
|
@@ -7824,7 +7851,6 @@ function filterCustom(settings) {
|
|
|
7824
7851
|
* @param settings
|
|
7825
7852
|
* @param input
|
|
7826
7853
|
* @param options
|
|
7827
|
-
* @param column
|
|
7828
7854
|
* @returns
|
|
7829
7855
|
*/
|
|
7830
7856
|
function filter(searchRows, settings, input, options) {
|
|
@@ -8399,6 +8425,7 @@ function reDraw(settings, holdPosition, recompute) {
|
|
|
8399
8425
|
// Resolve any column types that are unknown due to addition or
|
|
8400
8426
|
// invalidation
|
|
8401
8427
|
columnTypes(settings);
|
|
8428
|
+
columnWidths(settings);
|
|
8402
8429
|
if (doSort) {
|
|
8403
8430
|
sort(settings);
|
|
8404
8431
|
}
|
|
@@ -9177,7 +9204,7 @@ function getPrototypeNames(name) {
|
|
|
9177
9204
|
* Each of the input parameter types will be converted to a DataTables settings
|
|
9178
9205
|
* object where possible.
|
|
9179
9206
|
*
|
|
9180
|
-
* @param
|
|
9207
|
+
* @param mixedIn DataTable identifier. Can be one of:
|
|
9181
9208
|
* * `string` - jQuery selector. Any DataTables' matching the given selector
|
|
9182
9209
|
* with be found and used.
|
|
9183
9210
|
* * `node` - `TABLE` node which has already been formed into a DataTable.
|
|
@@ -9466,7 +9493,7 @@ const __reload = function (settings, holdPosition, callback) {
|
|
|
9466
9493
|
processingDisplay(settings, true);
|
|
9467
9494
|
// Cancel an existing request
|
|
9468
9495
|
var xhr = settings.jqXHR;
|
|
9469
|
-
if (xhr && xhr.readyState !== 4) {
|
|
9496
|
+
if (xhr && xhr.readyState !== 4 && typeof xhr.abort === 'function') {
|
|
9470
9497
|
xhr.abort();
|
|
9471
9498
|
}
|
|
9472
9499
|
// Trigger xhr
|
|
@@ -9715,7 +9742,7 @@ registerPlural('cells().indexes()', 'cell().index()', function () {
|
|
|
9715
9742
|
});
|
|
9716
9743
|
registerPlural('cells().invalidate()', 'cell().invalidate()', function (src) {
|
|
9717
9744
|
return this.iterator('cell', function (settings, row, column) {
|
|
9718
|
-
|
|
9745
|
+
invalidateRow(settings, row, src, column);
|
|
9719
9746
|
});
|
|
9720
9747
|
});
|
|
9721
9748
|
register('cell()', function (rowSelector, columnSelector, opts) {
|
|
@@ -9732,7 +9759,7 @@ register('cell().data()', function (data) {
|
|
|
9732
9759
|
}
|
|
9733
9760
|
// Set
|
|
9734
9761
|
setCellData(ctx[0], cell[0].row, cell[0].column, data);
|
|
9735
|
-
|
|
9762
|
+
invalidateRow(ctx[0], cell[0].row, 'data', cell[0].column);
|
|
9736
9763
|
return this;
|
|
9737
9764
|
});
|
|
9738
9765
|
|
|
@@ -9748,7 +9775,7 @@ register('cell().data()', function (data) {
|
|
|
9748
9775
|
*/
|
|
9749
9776
|
// can be an array of these items, comma separated list, or an array of comma
|
|
9750
9777
|
// separated lists
|
|
9751
|
-
const __re_column_selector = /^(
|
|
9778
|
+
const __re_column_selector = /^(.*?):(name|title|visIdx|visible)$/;
|
|
9752
9779
|
// r1 and r2 are redundant - but it means that the parameters match for the
|
|
9753
9780
|
// iterator callback in columns().data()
|
|
9754
9781
|
function columnData(settings, column, r1, r2, rows, type) {
|
|
@@ -10243,7 +10270,7 @@ registerPlural('columns().orderable()', 'column().orderable()', function (direct
|
|
|
10243
10270
|
/**
|
|
10244
10271
|
* Set the page length
|
|
10245
10272
|
*
|
|
10246
|
-
* @param
|
|
10273
|
+
* @param ctx DataTables context
|
|
10247
10274
|
* @param val Value to change to
|
|
10248
10275
|
*/
|
|
10249
10276
|
function lengthChange(ctx, val) {
|
|
@@ -10684,7 +10711,7 @@ register('rows().data()', function () {
|
|
|
10684
10711
|
});
|
|
10685
10712
|
registerPlural('rows().invalidate()', 'row().invalidate()', function (src) {
|
|
10686
10713
|
return this.iterator('row', function (settings, row) {
|
|
10687
|
-
|
|
10714
|
+
invalidateRow(settings, row, src);
|
|
10688
10715
|
});
|
|
10689
10716
|
});
|
|
10690
10717
|
registerPlural('rows().indexes()', 'row().index()', function () {
|
|
@@ -10771,7 +10798,7 @@ register('row().data()', function (data) {
|
|
|
10771
10798
|
util.set(ctx[0].rowId)(data, row.tr.id);
|
|
10772
10799
|
}
|
|
10773
10800
|
// Automatically invalidate
|
|
10774
|
-
|
|
10801
|
+
invalidateRow(ctx[0], this[0][0], 'data');
|
|
10775
10802
|
return this;
|
|
10776
10803
|
});
|
|
10777
10804
|
register('row().node()', function () {
|
|
@@ -10785,12 +10812,15 @@ register('row().node()', function () {
|
|
|
10785
10812
|
return null;
|
|
10786
10813
|
});
|
|
10787
10814
|
register('row.add()', function (row) {
|
|
10788
|
-
// Allow
|
|
10789
|
-
// it though - the first element in the set
|
|
10815
|
+
// Allow an array-like object to be passed in - only a single row is added
|
|
10816
|
+
// from it though - the first element in the set
|
|
10790
10817
|
if (row && row.fn && row.length) {
|
|
10791
10818
|
row = row[0];
|
|
10792
10819
|
}
|
|
10793
10820
|
var rows = this.iterator('table', function (settings) {
|
|
10821
|
+
// New column could cause a change in the cached column properties such
|
|
10822
|
+
// as type and width.
|
|
10823
|
+
invalidColumn(settings);
|
|
10794
10824
|
if (row.nodeName && row.nodeName.toUpperCase() === 'TR') {
|
|
10795
10825
|
return addTr(settings, Dom.s(row))[0];
|
|
10796
10826
|
}
|
|
@@ -11151,7 +11181,11 @@ function b64ToBuf(b64) {
|
|
|
11151
11181
|
*/
|
|
11152
11182
|
function check(releaseDate, software) {
|
|
11153
11183
|
let expires = _licenseInfo.expires;
|
|
11154
|
-
if (
|
|
11184
|
+
if (!getSubtle()) {
|
|
11185
|
+
noticePrep('Unable to validate license key');
|
|
11186
|
+
noticeDisplay();
|
|
11187
|
+
}
|
|
11188
|
+
else if (_licenseInfo.valid === false) {
|
|
11155
11189
|
noticePrep('License key invalid');
|
|
11156
11190
|
noticeDisplay();
|
|
11157
11191
|
}
|
|
@@ -11177,7 +11211,14 @@ function check(releaseDate, software) {
|
|
|
11177
11211
|
return true;
|
|
11178
11212
|
}
|
|
11179
11213
|
}
|
|
11180
|
-
else if (
|
|
11214
|
+
else if (software === null) {
|
|
11215
|
+
// Validating the key only - there hasn't been any specific software
|
|
11216
|
+
// calling the `plus` parameter yet. The key is good, so carry on.
|
|
11217
|
+
return true;
|
|
11218
|
+
}
|
|
11219
|
+
else if (
|
|
11220
|
+
// Checking if the build version can be used with this key
|
|
11221
|
+
_licenseInfo.type === 'plus' ||
|
|
11181
11222
|
(_licenseInfo.type === 'editor' && software === 'editor')) {
|
|
11182
11223
|
if (!expires || new Date(releaseDate) > expires) {
|
|
11183
11224
|
noticePrep('Upgrade required for this version');
|
|
@@ -11187,6 +11228,7 @@ function check(releaseDate, software) {
|
|
|
11187
11228
|
return true;
|
|
11188
11229
|
}
|
|
11189
11230
|
else if (_licenseInfo.type === 'editor' && software !== 'editor') {
|
|
11231
|
+
// Editor specific license
|
|
11190
11232
|
noticePrep('License for Editor only. Upgrade for Plus');
|
|
11191
11233
|
noticeDisplay();
|
|
11192
11234
|
return false;
|
|
@@ -11270,7 +11312,7 @@ function noticePrep(text) {
|
|
|
11270
11312
|
* Display the license notice
|
|
11271
11313
|
*/
|
|
11272
11314
|
function noticeDisplay() {
|
|
11273
|
-
if (!_processingKey && !document.body.contains(_wm[0])) {
|
|
11315
|
+
if (!_processingKey && document.body && !document.body.contains(_wm[0])) {
|
|
11274
11316
|
document.body.appendChild(_wm[0]);
|
|
11275
11317
|
}
|
|
11276
11318
|
}
|
|
@@ -11292,36 +11334,33 @@ function verify(licenseString) {
|
|
|
11292
11334
|
}
|
|
11293
11335
|
var payload = parts[0];
|
|
11294
11336
|
var signatureB64 = parts[1];
|
|
11295
|
-
//
|
|
11296
|
-
var
|
|
11297
|
-
|
|
11337
|
+
// Extract the payload to be useful
|
|
11338
|
+
var payloadParts = payload.match(/(plus|trial|editor)_(\d+)_(\d{4})(\d{2})(\d{2})/);
|
|
11339
|
+
if (!payloadParts || payloadParts.length !== 6) {
|
|
11340
|
+
_licenseInfo.valid = false;
|
|
11341
|
+
return resolve();
|
|
11342
|
+
}
|
|
11343
|
+
_licenseInfo.type = payloadParts[1];
|
|
11344
|
+
_licenseInfo.developers = parseInt(payloadParts[2]);
|
|
11345
|
+
_licenseInfo.expires = new Date(payloadParts[3] + '-' + payloadParts[4] + '-' + payloadParts[5]);
|
|
11346
|
+
var subtle = getSubtle();
|
|
11298
11347
|
var rawKey = b64ToBuf(_publicKey);
|
|
11299
11348
|
var rawSig = b64ToBuf(signatureB64);
|
|
11300
11349
|
var data = new TextEncoder().encode(payload);
|
|
11350
|
+
// Non-secure environments don't have cryptographic verification
|
|
11351
|
+
// available.
|
|
11352
|
+
if (!subtle) {
|
|
11353
|
+
_licenseInfo.valid = false;
|
|
11354
|
+
resolve();
|
|
11355
|
+
return;
|
|
11356
|
+
}
|
|
11301
11357
|
subtle
|
|
11302
11358
|
.importKey('raw', rawKey, { name: 'ECDSA', namedCurve: 'P-256' }, false, ['verify'])
|
|
11303
11359
|
.then(function (key) {
|
|
11304
11360
|
return subtle.verify({ name: 'ECDSA', hash: { name: 'SHA-256' } }, key, rawSig, data);
|
|
11305
11361
|
})
|
|
11306
11362
|
.then(function (isValid) {
|
|
11307
|
-
|
|
11308
|
-
_licenseInfo.valid = false;
|
|
11309
|
-
return resolve();
|
|
11310
|
-
}
|
|
11311
|
-
// Extract the payload to be useful
|
|
11312
|
-
var payloadParts = payload.match(/(plus|trial|editor)_(\d+)_(\d{4})(\d{2})(\d{2})/);
|
|
11313
|
-
if (!payloadParts || payloadParts.length !== 6) {
|
|
11314
|
-
_licenseInfo.valid = false;
|
|
11315
|
-
return resolve();
|
|
11316
|
-
}
|
|
11317
|
-
_licenseInfo.valid = true;
|
|
11318
|
-
_licenseInfo.type = payloadParts[1];
|
|
11319
|
-
_licenseInfo.developers = parseInt(payloadParts[2]);
|
|
11320
|
-
_licenseInfo.expires = new Date(payloadParts[3] +
|
|
11321
|
-
'-' +
|
|
11322
|
-
payloadParts[4] +
|
|
11323
|
-
'-' +
|
|
11324
|
-
payloadParts[5]);
|
|
11363
|
+
_licenseInfo.valid = isValid;
|
|
11325
11364
|
resolve();
|
|
11326
11365
|
})
|
|
11327
11366
|
.catch(function () {
|
|
@@ -11345,7 +11384,7 @@ function verify(licenseString) {
|
|
|
11345
11384
|
*/
|
|
11346
11385
|
function plus (DataTable) {
|
|
11347
11386
|
Object.defineProperty(DataTable, 'plus', {
|
|
11348
|
-
value: function (releaseDate, software =
|
|
11387
|
+
value: function (releaseDate, software = '') {
|
|
11349
11388
|
// Unsecure sites are only useful for development, so allow there
|
|
11350
11389
|
// and on the site.
|
|
11351
11390
|
let host = window.location.hostname;
|
|
@@ -11370,6 +11409,12 @@ function plus (DataTable) {
|
|
|
11370
11409
|
writable: false
|
|
11371
11410
|
});
|
|
11372
11411
|
}
|
|
11412
|
+
function getSubtle() {
|
|
11413
|
+
// Backwards compat for old browsers
|
|
11414
|
+
let cryptoObj = window.crypto || window.msCrypto;
|
|
11415
|
+
let subtle = cryptoObj.subtle || cryptoObj.webkitSubtle;
|
|
11416
|
+
return subtle;
|
|
11417
|
+
}
|
|
11373
11418
|
|
|
11374
11419
|
/**
|
|
11375
11420
|
* CommonJS factory function pass through. This will check if the arguments
|
|
@@ -11496,6 +11541,8 @@ register$2('info', function (settings, optsIn) {
|
|
|
11496
11541
|
/**
|
|
11497
11542
|
* Update the information elements in the display
|
|
11498
11543
|
* @param settings DataTables settings object
|
|
11544
|
+
* @param opts
|
|
11545
|
+
* @param node
|
|
11499
11546
|
*/
|
|
11500
11547
|
function updateInfo(settings, opts, node) {
|
|
11501
11548
|
var start = settings.displayStart + 1, end = displayEnd(settings), max = recordsTotal(settings), total = recordsDisplay(settings), out = total ? opts.text : opts.empty;
|
|
@@ -11568,7 +11615,7 @@ function _pagingDraw(settings, host, opts) {
|
|
|
11568
11615
|
if (!settings.initDone) {
|
|
11569
11616
|
return;
|
|
11570
11617
|
}
|
|
11571
|
-
let plugin = opts.type ? ext.pager[opts.type] : _pagingDynamic, aria = settings.language.aria.paginate || {}, start = settings.displayStart, len = settings.pageLength, visRecords = recordsDisplay(settings), all = len === -1, page = all ? 0 : Math.ceil(start / len), pages =
|
|
11618
|
+
let plugin = opts.type ? ext.pager[opts.type] : _pagingDynamic, aria = settings.language.aria.paginate || {}, start = settings.displayStart, len = settings.pageLength, visRecords = recordsDisplay(settings), all = len === -1, page = all ? 0 : Math.ceil(start / len), pages = all ? (visRecords ? 1 : 0) : Math.ceil(visRecords / len), buttons = [], buttonEls = [], buttonsNested = plugin(opts).map(function (val) {
|
|
11572
11619
|
return val === 'numbers'
|
|
11573
11620
|
? pagingNumbers(page, pages, opts.buttons, opts.boundaryNumbers)
|
|
11574
11621
|
: val;
|
|
@@ -12237,7 +12284,8 @@ const defaults = {
|
|
|
12237
12284
|
},
|
|
12238
12285
|
stateSaveParams: null,
|
|
12239
12286
|
tabIndex: 0,
|
|
12240
|
-
titleRow: null
|
|
12287
|
+
titleRow: null,
|
|
12288
|
+
typeDetect: true
|
|
12241
12289
|
};
|
|
12242
12290
|
|
|
12243
12291
|
const DataTable = function (selector, options) {
|