datatables.net 2.1.5 → 2.1.7
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 +42 -40
- package/js/dataTables.min.js +2 -2
- package/js/dataTables.min.mjs +2 -2
- package/js/dataTables.mjs +41 -39
- package/package.json +1 -1
package/js/dataTables.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DataTables 2.1.
|
|
1
|
+
/*! DataTables 2.1.7
|
|
2
2
|
* © SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*/
|
|
4
4
|
|
|
@@ -201,6 +201,7 @@ var DataTable = function ( selector, options )
|
|
|
201
201
|
"caption",
|
|
202
202
|
"layout",
|
|
203
203
|
"orderDescReverse",
|
|
204
|
+
"typeDetect",
|
|
204
205
|
[ "iCookieDuration", "iStateDuration" ], // backwards compat
|
|
205
206
|
[ "oSearch", "oPreviousSearch" ],
|
|
206
207
|
[ "aoSearchCols", "aoPreSearchCols" ],
|
|
@@ -424,7 +425,7 @@ var DataTable = function ( selector, options )
|
|
|
424
425
|
} );
|
|
425
426
|
}
|
|
426
427
|
else {
|
|
427
|
-
_fnCallbackFire( oSettings, null, 'i18n', [oSettings]);
|
|
428
|
+
_fnCallbackFire( oSettings, null, 'i18n', [oSettings], true);
|
|
428
429
|
_fnInitialise( oSettings );
|
|
429
430
|
}
|
|
430
431
|
} );
|
|
@@ -1164,7 +1165,7 @@ var _pluck_order = function ( a, order, prop, prop2 )
|
|
|
1164
1165
|
// is essential here
|
|
1165
1166
|
if ( prop2 !== undefined ) {
|
|
1166
1167
|
for ( ; i<ien ; i++ ) {
|
|
1167
|
-
if ( a[ order[i] ][ prop ] ) {
|
|
1168
|
+
if ( a[ order[i] ] && a[ order[i] ][ prop ] ) {
|
|
1168
1169
|
out.push( a[ order[i] ][ prop ][ prop2 ] );
|
|
1169
1170
|
}
|
|
1170
1171
|
}
|
|
@@ -1264,8 +1265,11 @@ var _normalize = function (str, both) {
|
|
|
1264
1265
|
}
|
|
1265
1266
|
|
|
1266
1267
|
// It is faster to just run `normalize` than it is to check if
|
|
1267
|
-
// we need to with a regex!
|
|
1268
|
-
|
|
1268
|
+
// we need to with a regex! (Check as it isn't available in old
|
|
1269
|
+
// Safari)
|
|
1270
|
+
var res = str.normalize
|
|
1271
|
+
? str.normalize("NFD")
|
|
1272
|
+
: str;
|
|
1269
1273
|
|
|
1270
1274
|
// Equally, here we check if a regex is needed or not
|
|
1271
1275
|
return res.length !== str.length
|
|
@@ -2103,11 +2107,7 @@ function _fnColumnSizes ( settings )
|
|
|
2103
2107
|
for (var i=0 ; i<cols.length ; i++) {
|
|
2104
2108
|
var width = _fnColumnsSumWidth(settings, [i], false, false);
|
|
2105
2109
|
|
|
2106
|
-
|
|
2107
|
-
// it further
|
|
2108
|
-
cols[i].colEl
|
|
2109
|
-
.css('width', width)
|
|
2110
|
-
.css('min-width', width);
|
|
2110
|
+
cols[i].colEl.css('width', width);
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
2113
|
|
|
@@ -2204,7 +2204,7 @@ function _fnGetColumns( oSettings, sParam )
|
|
|
2204
2204
|
*/
|
|
2205
2205
|
function _typeResult (typeDetect, res) {
|
|
2206
2206
|
return res === true
|
|
2207
|
-
? typeDetect.
|
|
2207
|
+
? typeDetect._name
|
|
2208
2208
|
: res;
|
|
2209
2209
|
}
|
|
2210
2210
|
|
|
@@ -2221,12 +2221,6 @@ function _fnColumnTypes ( settings )
|
|
|
2221
2221
|
var i, ien, j, jen, k, ken;
|
|
2222
2222
|
var col, detectedType, cache;
|
|
2223
2223
|
|
|
2224
|
-
// If SSP then we don't have the full data set, so any type detection would be
|
|
2225
|
-
// unreliable and error prone
|
|
2226
|
-
if (_fnDataSource( settings ) === 'ssp') {
|
|
2227
|
-
return;
|
|
2228
|
-
}
|
|
2229
|
-
|
|
2230
2224
|
// For each column, spin over the data type detection functions, seeing if one matches
|
|
2231
2225
|
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
|
|
2232
2226
|
col = columns[i];
|
|
@@ -2236,6 +2230,12 @@ function _fnColumnTypes ( settings )
|
|
|
2236
2230
|
col.sType = col._sManualType;
|
|
2237
2231
|
}
|
|
2238
2232
|
else if ( ! col.sType ) {
|
|
2233
|
+
// With SSP type detection can be unreliable and error prone, so we provide a way
|
|
2234
|
+
// to turn it off.
|
|
2235
|
+
if (! settings.typeDetect) {
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
2239
|
for ( j=0, jen=types.length ; j<jen ; j++ ) {
|
|
2240
2240
|
var typeDetect = types[j];
|
|
2241
2241
|
|
|
@@ -2987,8 +2987,8 @@ function _fnGetRowElements( settings, row, colIdx, d )
|
|
|
2987
2987
|
* @returns
|
|
2988
2988
|
*/
|
|
2989
2989
|
function _fnGetRowDisplay (settings, rowIdx) {
|
|
2990
|
-
|
|
2991
|
-
|
|
2990
|
+
var rowModal = settings.aoData[rowIdx];
|
|
2991
|
+
var columns = settings.aoColumns;
|
|
2992
2992
|
|
|
2993
2993
|
if (! rowModal.displayData) {
|
|
2994
2994
|
// Need to render and cache
|
|
@@ -4287,6 +4287,7 @@ function _fnAjaxUpdateDraw ( settings, json )
|
|
|
4287
4287
|
}
|
|
4288
4288
|
settings.aiDisplay = settings.aiDisplayMaster.slice();
|
|
4289
4289
|
|
|
4290
|
+
_fnColumnTypes(settings);
|
|
4290
4291
|
_fnDraw( settings, true );
|
|
4291
4292
|
_fnInitComplete( settings );
|
|
4292
4293
|
_fnProcessingDisplay( settings, false );
|
|
@@ -5353,11 +5354,7 @@ function _fnCalculateColumnWidths ( settings )
|
|
|
5353
5354
|
var width = _fnColumnsSumWidth( settings, this, true, false );
|
|
5354
5355
|
|
|
5355
5356
|
if ( width ) {
|
|
5356
|
-
// Need to set the width and min-width, otherwise the browser
|
|
5357
|
-
// will attempt to collapse the table beyond want might have
|
|
5358
|
-
// been specified
|
|
5359
5357
|
this.style.width = width;
|
|
5360
|
-
this.style.minWidth = width;
|
|
5361
5358
|
|
|
5362
5359
|
// For scrollX we need to force the column width otherwise the
|
|
5363
5360
|
// browser will collapse it. If this width is smaller than the
|
|
@@ -7659,7 +7656,7 @@ var _selector_opts = function ( opts )
|
|
|
7659
7656
|
// Reduce the API instance to the first item found
|
|
7660
7657
|
var _selector_first = function ( old )
|
|
7661
7658
|
{
|
|
7662
|
-
|
|
7659
|
+
var inst = new _Api(old.context[0]);
|
|
7663
7660
|
|
|
7664
7661
|
// Use a push rather than passing to the constructor, since it will
|
|
7665
7662
|
// merge arrays down automatically, which isn't what is wanted here
|
|
@@ -9654,7 +9651,7 @@ _api_register( 'ready()', function ( fn ) {
|
|
|
9654
9651
|
fn.call(this);
|
|
9655
9652
|
}
|
|
9656
9653
|
else {
|
|
9657
|
-
this.on('init', function () {
|
|
9654
|
+
this.on('init.dt.DT', function () {
|
|
9658
9655
|
fn.call(this);
|
|
9659
9656
|
});
|
|
9660
9657
|
}
|
|
@@ -9807,7 +9804,7 @@ _api_register( 'i18n()', function ( token, def, plural ) {
|
|
|
9807
9804
|
* @type string
|
|
9808
9805
|
* @default Version number
|
|
9809
9806
|
*/
|
|
9810
|
-
DataTable.version = "2.1.
|
|
9807
|
+
DataTable.version = "2.1.7";
|
|
9811
9808
|
|
|
9812
9809
|
/**
|
|
9813
9810
|
* Private data store, containing all of the settings objects that are
|
|
@@ -11907,7 +11904,10 @@ DataTable.models.oSettings = {
|
|
|
11907
11904
|
colgroup: null,
|
|
11908
11905
|
|
|
11909
11906
|
/** Delay loading of data */
|
|
11910
|
-
deferLoading: null
|
|
11907
|
+
deferLoading: null,
|
|
11908
|
+
|
|
11909
|
+
/** Allow auto type detection */
|
|
11910
|
+
typeDetect: true
|
|
11911
11911
|
};
|
|
11912
11912
|
|
|
11913
11913
|
/**
|
|
@@ -12368,7 +12368,7 @@ DataTable.type = function (name, prop, val) {
|
|
|
12368
12368
|
return {
|
|
12369
12369
|
className: _extTypes.className[name],
|
|
12370
12370
|
detect: _extTypes.detect.find(function (fn) {
|
|
12371
|
-
return fn.
|
|
12371
|
+
return fn._name === name;
|
|
12372
12372
|
}),
|
|
12373
12373
|
order: {
|
|
12374
12374
|
pre: _extTypes.order[name + '-pre'],
|
|
@@ -12386,10 +12386,10 @@ DataTable.type = function (name, prop, val) {
|
|
|
12386
12386
|
var setDetect = function (detect) {
|
|
12387
12387
|
// `detect` can be a function or an object - we set a name
|
|
12388
12388
|
// property for either - that is used for the detection
|
|
12389
|
-
Object.defineProperty(detect, "
|
|
12389
|
+
Object.defineProperty(detect, "_name", {value: name});
|
|
12390
12390
|
|
|
12391
12391
|
var idx = _extTypes.detect.findIndex(function (item) {
|
|
12392
|
-
return item.
|
|
12392
|
+
return item._name === name;
|
|
12393
12393
|
});
|
|
12394
12394
|
|
|
12395
12395
|
if (idx === -1) {
|
|
@@ -12452,13 +12452,13 @@ DataTable.type = function (name, prop, val) {
|
|
|
12452
12452
|
// Get a list of types
|
|
12453
12453
|
DataTable.types = function () {
|
|
12454
12454
|
return _extTypes.detect.map(function (fn) {
|
|
12455
|
-
return fn.
|
|
12455
|
+
return fn._name;
|
|
12456
12456
|
});
|
|
12457
12457
|
};
|
|
12458
12458
|
|
|
12459
12459
|
var __diacriticSort = function (a, b) {
|
|
12460
|
-
a = a.toString().toLowerCase();
|
|
12461
|
-
b = b.toString().toLowerCase();
|
|
12460
|
+
a = a !== null && a !== undefined ? a.toString().toLowerCase() : '';
|
|
12461
|
+
b = b !== null && b !== undefined ? b.toString().toLowerCase() : '';
|
|
12462
12462
|
|
|
12463
12463
|
// Checked for `navigator.languages` support in `oneOf` so this code can't execute in old
|
|
12464
12464
|
// Safari and thus can disable this check
|
|
@@ -13172,15 +13172,17 @@ function _pagingDraw(settings, host, opts) {
|
|
|
13172
13172
|
all = len === -1,
|
|
13173
13173
|
page = all ? 0 : Math.ceil( start / len ),
|
|
13174
13174
|
pages = all ? 1 : Math.ceil( visRecords / len ),
|
|
13175
|
-
buttons =
|
|
13175
|
+
buttons = [],
|
|
13176
|
+
buttonEls = [],
|
|
13177
|
+
buttonsNested = plugin(opts)
|
|
13176
13178
|
.map(function (val) {
|
|
13177
13179
|
return val === 'numbers'
|
|
13178
13180
|
? _pagingNumbers(page, pages, opts.buttons, opts.boundaryNumbers)
|
|
13179
13181
|
: val;
|
|
13180
|
-
})
|
|
13181
|
-
.flat();
|
|
13182
|
+
});
|
|
13182
13183
|
|
|
13183
|
-
|
|
13184
|
+
// .flat() would be better, but not supported in old Safari
|
|
13185
|
+
buttons = buttons.concat.apply(buttons, buttonsNested);
|
|
13184
13186
|
|
|
13185
13187
|
for (var i=0 ; i<buttons.length ; i++) {
|
|
13186
13188
|
var button = buttons[i];
|
|
@@ -13459,14 +13461,14 @@ DataTable.feature.register( 'pageLength', function ( settings, opts ) {
|
|
|
13459
13461
|
|
|
13460
13462
|
// Save text node content for macro updating
|
|
13461
13463
|
var textNodes = [];
|
|
13462
|
-
div.find('label')[0].childNodes.forEach(function (el) {
|
|
13464
|
+
Array.from(div.find('label')[0].childNodes).forEach(function (el) {
|
|
13463
13465
|
if (el.nodeType === Node.TEXT_NODE) {
|
|
13464
13466
|
textNodes.push({
|
|
13465
13467
|
el: el,
|
|
13466
13468
|
text: el.textContent
|
|
13467
13469
|
});
|
|
13468
13470
|
}
|
|
13469
|
-
})
|
|
13471
|
+
});
|
|
13470
13472
|
|
|
13471
13473
|
// Update the label text in case it has an entries value
|
|
13472
13474
|
var updateEntries = function (len) {
|