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.js
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
|
|
|
@@ -152,7 +152,7 @@ let _stripHtml = function (input, replacement = '') {
|
|
|
152
152
|
* This function is replaceable if the user wishes to use a different library
|
|
153
153
|
* for escaping HTML entities in a string.
|
|
154
154
|
*
|
|
155
|
-
* @param
|
|
155
|
+
* @param val Value to escape HTML in
|
|
156
156
|
* @returns Escaped value
|
|
157
157
|
*/
|
|
158
158
|
let _escapeHtml = function (val) {
|
|
@@ -551,7 +551,10 @@ function ajax(optionsIn) {
|
|
|
551
551
|
options.contentType = 'application/json; charset=utf-8';
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
|
-
xhr.open(method, options.url +
|
|
554
|
+
xhr.open(method, options.url +
|
|
555
|
+
(urlParams
|
|
556
|
+
? (options.url.includes('?') ? '&' : '?') + urlParams
|
|
557
|
+
: ''), true, options.username || null, options.password || null);
|
|
555
558
|
// Content type for FormData requests gets set by the browser.
|
|
556
559
|
if (options.contentType && !(options.data instanceof FormData)) {
|
|
557
560
|
xhr.setRequestHeader('Content-Type', options.contentType);
|
|
@@ -641,7 +644,9 @@ ajax.serialize = serialize;
|
|
|
641
644
|
* Run callback functions (allowing for none, one or array)
|
|
642
645
|
*
|
|
643
646
|
* @param fnIn Function(s) to run
|
|
644
|
-
* @param
|
|
647
|
+
* @param arg1 Parameters to pass to the function(s)
|
|
648
|
+
* @param arg2 Parameters to pass to the function(s)
|
|
649
|
+
* @param arg3 Parameters to pass to the function(s)
|
|
645
650
|
*/
|
|
646
651
|
function callback(fnIn, arg1, arg2, arg3) {
|
|
647
652
|
if (!fnIn) {
|
|
@@ -861,6 +866,7 @@ function pluck(a, prop, prop2) {
|
|
|
861
866
|
* as the indexes to pick from the source array
|
|
862
867
|
*
|
|
863
868
|
* @param a Array to get values from
|
|
869
|
+
* @param order Indexes to pick
|
|
864
870
|
* @param prop Property to read values from
|
|
865
871
|
* @param prop2 Inner property to get values from if a 2D array
|
|
866
872
|
* @returns Array of read values
|
|
@@ -1919,7 +1925,7 @@ class Dom {
|
|
|
1919
1925
|
/**
|
|
1920
1926
|
* Add an element (or multiple) to the instance. Will ensure uniqueness.
|
|
1921
1927
|
*
|
|
1922
|
-
* @param
|
|
1928
|
+
* @param selector Element(s) to add
|
|
1923
1929
|
* @param sort Indicate if the element should be added in document order.
|
|
1924
1930
|
* @returns Self for chaining
|
|
1925
1931
|
*/
|
|
@@ -2320,7 +2326,7 @@ class Dom {
|
|
|
2320
2326
|
/**
|
|
2321
2327
|
* Get all matching descendants
|
|
2322
2328
|
*
|
|
2323
|
-
* @param
|
|
2329
|
+
* @param input Elements to find
|
|
2324
2330
|
* @returns A new Dom instance with all matching elements
|
|
2325
2331
|
*/
|
|
2326
2332
|
find(input) {
|
|
@@ -3049,6 +3055,7 @@ const legacy = [];
|
|
|
3049
3055
|
* @param name The name of the new feature.
|
|
3050
3056
|
* @param cb A function that will create the elements and event listeners for
|
|
3051
3057
|
* the feature being added.
|
|
3058
|
+
* @param legacyChar
|
|
3052
3059
|
*/
|
|
3053
3060
|
function register$2(name, cb, legacyChar = '') {
|
|
3054
3061
|
features[name] = cb;
|
|
@@ -3913,7 +3920,7 @@ const ext = {
|
|
|
3913
3920
|
* Software version
|
|
3914
3921
|
* @type string
|
|
3915
3922
|
*/
|
|
3916
|
-
version: '3.0.
|
|
3923
|
+
version: '3.0.2'
|
|
3917
3924
|
};
|
|
3918
3925
|
//
|
|
3919
3926
|
// Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts
|
|
@@ -4818,7 +4825,7 @@ function create$1(parts = {}) {
|
|
|
4818
4825
|
* DOM source.
|
|
4819
4826
|
*
|
|
4820
4827
|
* @param settings DataTables settings object
|
|
4821
|
-
* @param
|
|
4828
|
+
* @param dataIn data array to be added
|
|
4822
4829
|
* @param tr TR element to add to the table - optional. If not given, DataTables
|
|
4823
4830
|
* will create a row automatically
|
|
4824
4831
|
* @param tds Array of TD|TH elements for the row - must be given if tr is.
|
|
@@ -4857,7 +4864,7 @@ function addData(settings, dataIn, tr, tds) {
|
|
|
4857
4864
|
* it is not cloned).
|
|
4858
4865
|
*
|
|
4859
4866
|
* @param settings DataTables settings object
|
|
4860
|
-
* @param
|
|
4867
|
+
* @param rows The TR element(s) to add to the table
|
|
4861
4868
|
* @returns Array of indexes for the added rows
|
|
4862
4869
|
*/
|
|
4863
4870
|
function addTr(settings, rows) {
|
|
@@ -5005,7 +5012,7 @@ function clearTable(settings) {
|
|
|
5005
5012
|
* @param colIdx Column index to invalidate. If undefined the whole row will be
|
|
5006
5013
|
* invalidated
|
|
5007
5014
|
*/
|
|
5008
|
-
function
|
|
5015
|
+
function invalidateRow(settings, rowIdx, src, colIdx) {
|
|
5009
5016
|
var row = settings.data[rowIdx];
|
|
5010
5017
|
var i, iLen;
|
|
5011
5018
|
if (!row) {
|
|
@@ -5035,6 +5042,18 @@ function invalidate(settings, rowIdx, src, colIdx) {
|
|
|
5035
5042
|
}
|
|
5036
5043
|
}
|
|
5037
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) {
|
|
5038
5057
|
// Column specific invalidation
|
|
5039
5058
|
var cols = settings.columns;
|
|
5040
5059
|
if (colIdx !== undefined) {
|
|
@@ -5045,14 +5064,12 @@ function invalidate(settings, rowIdx, src, colIdx) {
|
|
|
5045
5064
|
cols[colIdx].wideStrings = null;
|
|
5046
5065
|
}
|
|
5047
5066
|
else {
|
|
5048
|
-
for (i = 0, iLen = cols.length; i < iLen; i++) {
|
|
5067
|
+
for (let i = 0, iLen = cols.length; i < iLen; i++) {
|
|
5049
5068
|
cols[i].type = null;
|
|
5050
5069
|
cols[i].wideStrings = null;
|
|
5051
5070
|
}
|
|
5052
|
-
// Update DataTables special `DT_*` attributes for the row
|
|
5053
|
-
rowAttributes(settings, row);
|
|
5054
5071
|
}
|
|
5055
|
-
|
|
5072
|
+
settings.containerWidth = -1;
|
|
5056
5073
|
}
|
|
5057
5074
|
/**
|
|
5058
5075
|
* Get the cells and data for a given row - from a <tr> element
|
|
@@ -5141,10 +5158,21 @@ function readCellData(settings, cell, data, colIdx) {
|
|
|
5141
5158
|
}
|
|
5142
5159
|
}
|
|
5143
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
|
+
}
|
|
5144
5172
|
/**
|
|
5145
5173
|
* Calculate the width of columns for the table
|
|
5146
5174
|
*
|
|
5147
|
-
* @param settings
|
|
5175
|
+
* @param settings DataTables settings object
|
|
5148
5176
|
*/
|
|
5149
5177
|
function calculateColumnWidths(settings) {
|
|
5150
5178
|
// Not interested in doing column width calculation if auto-width is disabled
|
|
@@ -5439,7 +5467,7 @@ function getWideStrings(settings, colIdx) {
|
|
|
5439
5467
|
/**
|
|
5440
5468
|
* Append a CSS unit (only if required) to a string
|
|
5441
5469
|
*
|
|
5442
|
-
* @param
|
|
5470
|
+
* @param s Value to css-ify
|
|
5443
5471
|
* @returns Value with css unit
|
|
5444
5472
|
*/
|
|
5445
5473
|
function stringToCss(s) {
|
|
@@ -5692,12 +5720,9 @@ function scrollDraw(settings) {
|
|
|
5692
5720
|
// Check against what the colgroup > col is set to and correct if needed
|
|
5693
5721
|
for (let i = 0; i < colSizes.length; i++) {
|
|
5694
5722
|
let colEl = settings.columns[colSizes[i].idx].colEl;
|
|
5695
|
-
|
|
5696
|
-
if (
|
|
5697
|
-
colEl.css('
|
|
5698
|
-
if (scroll.x) {
|
|
5699
|
-
colEl.css('minWidth', colSizes[i].width + 'px');
|
|
5700
|
-
}
|
|
5723
|
+
colEl.css('width', colSizes[i].width + 'px');
|
|
5724
|
+
if (scroll.x) {
|
|
5725
|
+
colEl.css('minWidth', colSizes[i].width + 'px');
|
|
5701
5726
|
}
|
|
5702
5727
|
}
|
|
5703
5728
|
}
|
|
@@ -5995,13 +6020,15 @@ function _typeResult(typeDetect, res) {
|
|
|
5995
6020
|
* Calculate the 'type' of a column
|
|
5996
6021
|
* @param settings DataTables settings object
|
|
5997
6022
|
*/
|
|
5998
|
-
function columnTypes(settings) {
|
|
6023
|
+
function columnTypes(settings, originalTypes = '') {
|
|
5999
6024
|
var columns = settings.columns;
|
|
6000
6025
|
var data = settings.data;
|
|
6001
6026
|
var types = ext.type.detect;
|
|
6002
6027
|
var i, iLen, j, jen, k, ken;
|
|
6003
6028
|
var col, detectedType, cache;
|
|
6004
|
-
|
|
6029
|
+
if (!originalTypes) {
|
|
6030
|
+
originalTypes = columns.map(c => c.type).join(',');
|
|
6031
|
+
}
|
|
6005
6032
|
// For each column, spin over the data type detection functions, seeing if
|
|
6006
6033
|
// one matches
|
|
6007
6034
|
for (i = 0, iLen = columns.length; i < iLen; i++) {
|
|
@@ -6373,7 +6400,7 @@ function renderer(ctx, type) {
|
|
|
6373
6400
|
/**
|
|
6374
6401
|
* Add the options to the page HTML for the table
|
|
6375
6402
|
*
|
|
6376
|
-
* @param
|
|
6403
|
+
* @param ctx DataTables context
|
|
6377
6404
|
*/
|
|
6378
6405
|
function createLayout(ctx) {
|
|
6379
6406
|
var classes = ctx.classes;
|
|
@@ -6750,6 +6777,7 @@ function sortAttachListener(settings, node, selector, column, callback) {
|
|
|
6750
6777
|
* Sort the display array to match the master's order
|
|
6751
6778
|
*
|
|
6752
6779
|
* @param settings DataTables context
|
|
6780
|
+
* @param display The display array
|
|
6753
6781
|
*/
|
|
6754
6782
|
function sortDisplay(settings, display) {
|
|
6755
6783
|
if (display.length < 2) {
|
|
@@ -6977,7 +7005,6 @@ function sort(ctx, col, dir) {
|
|
|
6977
7005
|
* Function to run on user sort request
|
|
6978
7006
|
*
|
|
6979
7007
|
* @param settings dataTables settings object
|
|
6980
|
-
* @param attachTo node to attach the handler to
|
|
6981
7008
|
* @param colIdx column sorting index
|
|
6982
7009
|
* @param addIndex Counter
|
|
6983
7010
|
* @param shift Shift click add
|
|
@@ -7700,6 +7727,7 @@ function ajaxUpdateDraw(settings, json) {
|
|
|
7700
7727
|
var drawUnique = ajaxDataSrcParam(settings, 'draw', json);
|
|
7701
7728
|
var recordsTotal = ajaxDataSrcParam(settings, 'recordsTotal', json);
|
|
7702
7729
|
var recordsFiltered = ajaxDataSrcParam(settings, 'recordsFiltered', json);
|
|
7730
|
+
var existingTypes = settings.columns.map(c => c.type).join(',');
|
|
7703
7731
|
if (drawUnique !== undefined) {
|
|
7704
7732
|
// Protect against out of sequence returns
|
|
7705
7733
|
if (drawUnique * 1 < settings.drawCount) {
|
|
@@ -7719,7 +7747,7 @@ function ajaxUpdateDraw(settings, json) {
|
|
|
7719
7747
|
addData(settings, data[i]);
|
|
7720
7748
|
}
|
|
7721
7749
|
settings.display = settings.displayMaster.slice();
|
|
7722
|
-
columnTypes(settings);
|
|
7750
|
+
columnTypes(settings, existingTypes);
|
|
7723
7751
|
draw(settings, true);
|
|
7724
7752
|
initComplete(settings);
|
|
7725
7753
|
processingDisplay(settings, false);
|
|
@@ -7794,7 +7822,6 @@ const __filter_div_textContent = __filter_div.textContent !== undefined;
|
|
|
7794
7822
|
* Filter the table using both the global filter and column based filtering
|
|
7795
7823
|
*
|
|
7796
7824
|
* @param settings DataTables settings object
|
|
7797
|
-
* @param input search information
|
|
7798
7825
|
*/
|
|
7799
7826
|
function filterComplete(settings) {
|
|
7800
7827
|
settings.columns;
|
|
@@ -7858,7 +7885,6 @@ function filterCustom(settings) {
|
|
|
7858
7885
|
* @param settings
|
|
7859
7886
|
* @param input
|
|
7860
7887
|
* @param options
|
|
7861
|
-
* @param column
|
|
7862
7888
|
* @returns
|
|
7863
7889
|
*/
|
|
7864
7890
|
function filter(searchRows, settings, input, options) {
|
|
@@ -8433,6 +8459,7 @@ function reDraw(settings, holdPosition, recompute) {
|
|
|
8433
8459
|
// Resolve any column types that are unknown due to addition or
|
|
8434
8460
|
// invalidation
|
|
8435
8461
|
columnTypes(settings);
|
|
8462
|
+
columnWidths(settings);
|
|
8436
8463
|
if (doSort) {
|
|
8437
8464
|
sort(settings);
|
|
8438
8465
|
}
|
|
@@ -9211,7 +9238,7 @@ function getPrototypeNames(name) {
|
|
|
9211
9238
|
* Each of the input parameter types will be converted to a DataTables settings
|
|
9212
9239
|
* object where possible.
|
|
9213
9240
|
*
|
|
9214
|
-
* @param
|
|
9241
|
+
* @param mixedIn DataTable identifier. Can be one of:
|
|
9215
9242
|
* * `string` - jQuery selector. Any DataTables' matching the given selector
|
|
9216
9243
|
* with be found and used.
|
|
9217
9244
|
* * `node` - `TABLE` node which has already been formed into a DataTable.
|
|
@@ -9500,7 +9527,7 @@ const __reload = function (settings, holdPosition, callback) {
|
|
|
9500
9527
|
processingDisplay(settings, true);
|
|
9501
9528
|
// Cancel an existing request
|
|
9502
9529
|
var xhr = settings.jqXHR;
|
|
9503
|
-
if (xhr && xhr.readyState !== 4) {
|
|
9530
|
+
if (xhr && xhr.readyState !== 4 && typeof xhr.abort === 'function') {
|
|
9504
9531
|
xhr.abort();
|
|
9505
9532
|
}
|
|
9506
9533
|
// Trigger xhr
|
|
@@ -9749,7 +9776,7 @@ registerPlural('cells().indexes()', 'cell().index()', function () {
|
|
|
9749
9776
|
});
|
|
9750
9777
|
registerPlural('cells().invalidate()', 'cell().invalidate()', function (src) {
|
|
9751
9778
|
return this.iterator('cell', function (settings, row, column) {
|
|
9752
|
-
|
|
9779
|
+
invalidateRow(settings, row, src, column);
|
|
9753
9780
|
});
|
|
9754
9781
|
});
|
|
9755
9782
|
register('cell()', function (rowSelector, columnSelector, opts) {
|
|
@@ -9766,7 +9793,7 @@ register('cell().data()', function (data) {
|
|
|
9766
9793
|
}
|
|
9767
9794
|
// Set
|
|
9768
9795
|
setCellData(ctx[0], cell[0].row, cell[0].column, data);
|
|
9769
|
-
|
|
9796
|
+
invalidateRow(ctx[0], cell[0].row, 'data', cell[0].column);
|
|
9770
9797
|
return this;
|
|
9771
9798
|
});
|
|
9772
9799
|
|
|
@@ -9782,7 +9809,7 @@ register('cell().data()', function (data) {
|
|
|
9782
9809
|
*/
|
|
9783
9810
|
// can be an array of these items, comma separated list, or an array of comma
|
|
9784
9811
|
// separated lists
|
|
9785
|
-
const __re_column_selector = /^(
|
|
9812
|
+
const __re_column_selector = /^(.*?):(name|title|visIdx|visible)$/;
|
|
9786
9813
|
// r1 and r2 are redundant - but it means that the parameters match for the
|
|
9787
9814
|
// iterator callback in columns().data()
|
|
9788
9815
|
function columnData(settings, column, r1, r2, rows, type) {
|
|
@@ -10277,7 +10304,7 @@ registerPlural('columns().orderable()', 'column().orderable()', function (direct
|
|
|
10277
10304
|
/**
|
|
10278
10305
|
* Set the page length
|
|
10279
10306
|
*
|
|
10280
|
-
* @param
|
|
10307
|
+
* @param ctx DataTables context
|
|
10281
10308
|
* @param val Value to change to
|
|
10282
10309
|
*/
|
|
10283
10310
|
function lengthChange(ctx, val) {
|
|
@@ -10718,7 +10745,7 @@ register('rows().data()', function () {
|
|
|
10718
10745
|
});
|
|
10719
10746
|
registerPlural('rows().invalidate()', 'row().invalidate()', function (src) {
|
|
10720
10747
|
return this.iterator('row', function (settings, row) {
|
|
10721
|
-
|
|
10748
|
+
invalidateRow(settings, row, src);
|
|
10722
10749
|
});
|
|
10723
10750
|
});
|
|
10724
10751
|
registerPlural('rows().indexes()', 'row().index()', function () {
|
|
@@ -10805,7 +10832,7 @@ register('row().data()', function (data) {
|
|
|
10805
10832
|
util.set(ctx[0].rowId)(data, row.tr.id);
|
|
10806
10833
|
}
|
|
10807
10834
|
// Automatically invalidate
|
|
10808
|
-
|
|
10835
|
+
invalidateRow(ctx[0], this[0][0], 'data');
|
|
10809
10836
|
return this;
|
|
10810
10837
|
});
|
|
10811
10838
|
register('row().node()', function () {
|
|
@@ -10819,12 +10846,15 @@ register('row().node()', function () {
|
|
|
10819
10846
|
return null;
|
|
10820
10847
|
});
|
|
10821
10848
|
register('row.add()', function (row) {
|
|
10822
|
-
// Allow
|
|
10823
|
-
// 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
|
|
10824
10851
|
if (row && row.fn && row.length) {
|
|
10825
10852
|
row = row[0];
|
|
10826
10853
|
}
|
|
10827
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);
|
|
10828
10858
|
if (row.nodeName && row.nodeName.toUpperCase() === 'TR') {
|
|
10829
10859
|
return addTr(settings, Dom.s(row))[0];
|
|
10830
10860
|
}
|
|
@@ -11185,7 +11215,11 @@ function b64ToBuf(b64) {
|
|
|
11185
11215
|
*/
|
|
11186
11216
|
function check(releaseDate, software) {
|
|
11187
11217
|
let expires = _licenseInfo.expires;
|
|
11188
|
-
if (
|
|
11218
|
+
if (!getSubtle()) {
|
|
11219
|
+
noticePrep('Unable to validate license key');
|
|
11220
|
+
noticeDisplay();
|
|
11221
|
+
}
|
|
11222
|
+
else if (_licenseInfo.valid === false) {
|
|
11189
11223
|
noticePrep('License key invalid');
|
|
11190
11224
|
noticeDisplay();
|
|
11191
11225
|
}
|
|
@@ -11211,7 +11245,14 @@ function check(releaseDate, software) {
|
|
|
11211
11245
|
return true;
|
|
11212
11246
|
}
|
|
11213
11247
|
}
|
|
11214
|
-
else if (
|
|
11248
|
+
else if (software === null) {
|
|
11249
|
+
// Validating the key only - there hasn't been any specific software
|
|
11250
|
+
// calling the `plus` parameter yet. The key is good, so carry on.
|
|
11251
|
+
return true;
|
|
11252
|
+
}
|
|
11253
|
+
else if (
|
|
11254
|
+
// Checking if the build version can be used with this key
|
|
11255
|
+
_licenseInfo.type === 'plus' ||
|
|
11215
11256
|
(_licenseInfo.type === 'editor' && software === 'editor')) {
|
|
11216
11257
|
if (!expires || new Date(releaseDate) > expires) {
|
|
11217
11258
|
noticePrep('Upgrade required for this version');
|
|
@@ -11221,6 +11262,7 @@ function check(releaseDate, software) {
|
|
|
11221
11262
|
return true;
|
|
11222
11263
|
}
|
|
11223
11264
|
else if (_licenseInfo.type === 'editor' && software !== 'editor') {
|
|
11265
|
+
// Editor specific license
|
|
11224
11266
|
noticePrep('License for Editor only. Upgrade for Plus');
|
|
11225
11267
|
noticeDisplay();
|
|
11226
11268
|
return false;
|
|
@@ -11304,7 +11346,7 @@ function noticePrep(text) {
|
|
|
11304
11346
|
* Display the license notice
|
|
11305
11347
|
*/
|
|
11306
11348
|
function noticeDisplay() {
|
|
11307
|
-
if (!_processingKey && !document.body.contains(_wm[0])) {
|
|
11349
|
+
if (!_processingKey && document.body && !document.body.contains(_wm[0])) {
|
|
11308
11350
|
document.body.appendChild(_wm[0]);
|
|
11309
11351
|
}
|
|
11310
11352
|
}
|
|
@@ -11326,36 +11368,33 @@ function verify(licenseString) {
|
|
|
11326
11368
|
}
|
|
11327
11369
|
var payload = parts[0];
|
|
11328
11370
|
var signatureB64 = parts[1];
|
|
11329
|
-
//
|
|
11330
|
-
var
|
|
11331
|
-
|
|
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();
|
|
11332
11381
|
var rawKey = b64ToBuf(_publicKey);
|
|
11333
11382
|
var rawSig = b64ToBuf(signatureB64);
|
|
11334
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
|
+
}
|
|
11335
11391
|
subtle
|
|
11336
11392
|
.importKey('raw', rawKey, { name: 'ECDSA', namedCurve: 'P-256' }, false, ['verify'])
|
|
11337
11393
|
.then(function (key) {
|
|
11338
11394
|
return subtle.verify({ name: 'ECDSA', hash: { name: 'SHA-256' } }, key, rawSig, data);
|
|
11339
11395
|
})
|
|
11340
11396
|
.then(function (isValid) {
|
|
11341
|
-
|
|
11342
|
-
_licenseInfo.valid = false;
|
|
11343
|
-
return resolve();
|
|
11344
|
-
}
|
|
11345
|
-
// Extract the payload to be useful
|
|
11346
|
-
var payloadParts = payload.match(/(plus|trial|editor)_(\d+)_(\d{4})(\d{2})(\d{2})/);
|
|
11347
|
-
if (!payloadParts || payloadParts.length !== 6) {
|
|
11348
|
-
_licenseInfo.valid = false;
|
|
11349
|
-
return resolve();
|
|
11350
|
-
}
|
|
11351
|
-
_licenseInfo.valid = true;
|
|
11352
|
-
_licenseInfo.type = payloadParts[1];
|
|
11353
|
-
_licenseInfo.developers = parseInt(payloadParts[2]);
|
|
11354
|
-
_licenseInfo.expires = new Date(payloadParts[3] +
|
|
11355
|
-
'-' +
|
|
11356
|
-
payloadParts[4] +
|
|
11357
|
-
'-' +
|
|
11358
|
-
payloadParts[5]);
|
|
11397
|
+
_licenseInfo.valid = isValid;
|
|
11359
11398
|
resolve();
|
|
11360
11399
|
})
|
|
11361
11400
|
.catch(function () {
|
|
@@ -11379,7 +11418,7 @@ function verify(licenseString) {
|
|
|
11379
11418
|
*/
|
|
11380
11419
|
function plus (DataTable) {
|
|
11381
11420
|
Object.defineProperty(DataTable, 'plus', {
|
|
11382
|
-
value: function (releaseDate, software =
|
|
11421
|
+
value: function (releaseDate, software = '') {
|
|
11383
11422
|
// Unsecure sites are only useful for development, so allow there
|
|
11384
11423
|
// and on the site.
|
|
11385
11424
|
let host = window.location.hostname;
|
|
@@ -11404,6 +11443,12 @@ function plus (DataTable) {
|
|
|
11404
11443
|
writable: false
|
|
11405
11444
|
});
|
|
11406
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
|
+
}
|
|
11407
11452
|
|
|
11408
11453
|
/**
|
|
11409
11454
|
* CommonJS factory function pass through. This will check if the arguments
|
|
@@ -11530,6 +11575,8 @@ register$2('info', function (settings, optsIn) {
|
|
|
11530
11575
|
/**
|
|
11531
11576
|
* Update the information elements in the display
|
|
11532
11577
|
* @param settings DataTables settings object
|
|
11578
|
+
* @param opts
|
|
11579
|
+
* @param node
|
|
11533
11580
|
*/
|
|
11534
11581
|
function updateInfo(settings, opts, node) {
|
|
11535
11582
|
var start = settings.displayStart + 1, end = displayEnd(settings), max = recordsTotal(settings), total = recordsDisplay(settings), out = total ? opts.text : opts.empty;
|
|
@@ -11602,7 +11649,7 @@ function _pagingDraw(settings, host, opts) {
|
|
|
11602
11649
|
if (!settings.initDone) {
|
|
11603
11650
|
return;
|
|
11604
11651
|
}
|
|
11605
|
-
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 =
|
|
11652
|
+
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) {
|
|
11606
11653
|
return val === 'numbers'
|
|
11607
11654
|
? pagingNumbers(page, pages, opts.buttons, opts.boundaryNumbers)
|
|
11608
11655
|
: val;
|
|
@@ -12271,7 +12318,8 @@ const defaults = {
|
|
|
12271
12318
|
},
|
|
12272
12319
|
stateSaveParams: null,
|
|
12273
12320
|
tabIndex: 0,
|
|
12274
|
-
titleRow: null
|
|
12321
|
+
titleRow: null,
|
|
12322
|
+
typeDetect: true
|
|
12275
12323
|
};
|
|
12276
12324
|
|
|
12277
12325
|
const DataTable = function (selector, options) {
|