datatables.net 2.1.6 → 2.1.8

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! DataTables 2.1.6
1
+ /*! DataTables 2.1.8
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -1265,8 +1265,11 @@ var _normalize = function (str, both) {
1265
1265
  }
1266
1266
 
1267
1267
  // It is faster to just run `normalize` than it is to check if
1268
- // we need to with a regex!
1269
- var res = str.normalize("NFD");
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;
1270
1273
 
1271
1274
  // Equally, here we check if a regex is needed or not
1272
1275
  return res.length !== str.length
@@ -2104,11 +2107,7 @@ function _fnColumnSizes ( settings )
2104
2107
  for (var i=0 ; i<cols.length ; i++) {
2105
2108
  var width = _fnColumnsSumWidth(settings, [i], false, false);
2106
2109
 
2107
- // Need to set the min-width, otherwise the browser might try to collapse
2108
- // it further
2109
- cols[i].colEl
2110
- .css('width', width)
2111
- .css('min-width', width);
2110
+ cols[i].colEl.css('width', width);
2112
2111
  }
2113
2112
  }
2114
2113
 
@@ -2205,7 +2204,7 @@ function _fnGetColumns( oSettings, sParam )
2205
2204
  */
2206
2205
  function _typeResult (typeDetect, res) {
2207
2206
  return res === true
2208
- ? typeDetect.name
2207
+ ? typeDetect._name
2209
2208
  : res;
2210
2209
  }
2211
2210
 
@@ -2988,8 +2987,8 @@ function _fnGetRowElements( settings, row, colIdx, d )
2988
2987
  * @returns
2989
2988
  */
2990
2989
  function _fnGetRowDisplay (settings, rowIdx) {
2991
- let rowModal = settings.aoData[rowIdx];
2992
- let columns = settings.aoColumns;
2990
+ var rowModal = settings.aoData[rowIdx];
2991
+ var columns = settings.aoColumns;
2993
2992
 
2994
2993
  if (! rowModal.displayData) {
2995
2994
  // Need to render and cache
@@ -3195,9 +3194,6 @@ function _fnBuildHead( settings, side )
3195
3194
  settings.aoFooter = detected;
3196
3195
  }
3197
3196
 
3198
- // ARIA role for the rows
3199
- $(target).children('tr').attr('role', 'row');
3200
-
3201
3197
  // Every cell needs to be passed through the renderer
3202
3198
  $(target).children('tr').children('th, td')
3203
3199
  .each( function () {
@@ -5187,7 +5183,7 @@ function _fnScrollDraw ( settings )
5187
5183
  // browser support
5188
5184
  var firstTr = null;
5189
5185
 
5190
- for (i=0 ; i<settings.aiDisplay.length ; i++) {
5186
+ for (i=settings._iDisplayStart ; i<settings.aiDisplay.length ; i++) {
5191
5187
  var idx = settings.aiDisplay[i];
5192
5188
  var tr = settings.aoData[idx].nTr;
5193
5189
 
@@ -5355,11 +5351,7 @@ function _fnCalculateColumnWidths ( settings )
5355
5351
  var width = _fnColumnsSumWidth( settings, this, true, false );
5356
5352
 
5357
5353
  if ( width ) {
5358
- // Need to set the width and min-width, otherwise the browser
5359
- // will attempt to collapse the table beyond want might have
5360
- // been specified
5361
5354
  this.style.width = width;
5362
- this.style.minWidth = width;
5363
5355
 
5364
5356
  // For scrollX we need to force the column width otherwise the
5365
5357
  // browser will collapse it. If this width is smaller than the
@@ -7661,7 +7653,7 @@ var _selector_opts = function ( opts )
7661
7653
  // Reduce the API instance to the first item found
7662
7654
  var _selector_first = function ( old )
7663
7655
  {
7664
- let inst = new _Api(old.context[0]);
7656
+ var inst = new _Api(old.context[0]);
7665
7657
 
7666
7658
  // Use a push rather than passing to the constructor, since it will
7667
7659
  // merge arrays down automatically, which isn't what is wanted here
@@ -9656,7 +9648,7 @@ _api_register( 'ready()', function ( fn ) {
9656
9648
  fn.call(this);
9657
9649
  }
9658
9650
  else {
9659
- this.on('init', function () {
9651
+ this.on('init.dt.DT', function () {
9660
9652
  fn.call(this);
9661
9653
  });
9662
9654
  }
@@ -9809,7 +9801,7 @@ _api_register( 'i18n()', function ( token, def, plural ) {
9809
9801
  * @type string
9810
9802
  * @default Version number
9811
9803
  */
9812
- DataTable.version = "2.1.6";
9804
+ DataTable.version = "2.1.8";
9813
9805
 
9814
9806
  /**
9815
9807
  * Private data store, containing all of the settings objects that are
@@ -12134,7 +12126,7 @@ function __mlHelper (localeString) {
12134
12126
 
12135
12127
  // Add type detection and sorting specific to this date format - we need to be able to identify
12136
12128
  // date type columns as such, rather than as numbers in extensions. Hence the need for this.
12137
- if (! DataTable.ext.type.order[typeName]) {
12129
+ if (! DataTable.ext.type.order[typeName + '-pre']) {
12138
12130
  DataTable.type(typeName, {
12139
12131
  detect: function (d) {
12140
12132
  // The renderer will give the value to type detect as the type!
@@ -12373,7 +12365,7 @@ DataTable.type = function (name, prop, val) {
12373
12365
  return {
12374
12366
  className: _extTypes.className[name],
12375
12367
  detect: _extTypes.detect.find(function (fn) {
12376
- return fn.name === name;
12368
+ return fn._name === name;
12377
12369
  }),
12378
12370
  order: {
12379
12371
  pre: _extTypes.order[name + '-pre'],
@@ -12391,10 +12383,10 @@ DataTable.type = function (name, prop, val) {
12391
12383
  var setDetect = function (detect) {
12392
12384
  // `detect` can be a function or an object - we set a name
12393
12385
  // property for either - that is used for the detection
12394
- Object.defineProperty(detect, "name", {value: name});
12386
+ Object.defineProperty(detect, "_name", {value: name});
12395
12387
 
12396
12388
  var idx = _extTypes.detect.findIndex(function (item) {
12397
- return item.name === name;
12389
+ return item._name === name;
12398
12390
  });
12399
12391
 
12400
12392
  if (idx === -1) {
@@ -12457,13 +12449,13 @@ DataTable.type = function (name, prop, val) {
12457
12449
  // Get a list of types
12458
12450
  DataTable.types = function () {
12459
12451
  return _extTypes.detect.map(function (fn) {
12460
- return fn.name;
12452
+ return fn._name;
12461
12453
  });
12462
12454
  };
12463
12455
 
12464
12456
  var __diacriticSort = function (a, b) {
12465
- a = a.toString().toLowerCase();
12466
- b = b.toString().toLowerCase();
12457
+ a = a !== null && a !== undefined ? a.toString().toLowerCase() : '';
12458
+ b = b !== null && b !== undefined ? b.toString().toLowerCase() : '';
12467
12459
 
12468
12460
  // Checked for `navigator.languages` support in `oneOf` so this code can't execute in old
12469
12461
  // Safari and thus can disable this check
@@ -13177,15 +13169,17 @@ function _pagingDraw(settings, host, opts) {
13177
13169
  all = len === -1,
13178
13170
  page = all ? 0 : Math.ceil( start / len ),
13179
13171
  pages = all ? 1 : Math.ceil( visRecords / len ),
13180
- buttons = plugin(opts)
13172
+ buttons = [],
13173
+ buttonEls = [],
13174
+ buttonsNested = plugin(opts)
13181
13175
  .map(function (val) {
13182
13176
  return val === 'numbers'
13183
13177
  ? _pagingNumbers(page, pages, opts.buttons, opts.boundaryNumbers)
13184
13178
  : val;
13185
- })
13186
- .flat();
13179
+ });
13187
13180
 
13188
- var buttonEls = [];
13181
+ // .flat() would be better, but not supported in old Safari
13182
+ buttons = buttons.concat.apply(buttons, buttonsNested);
13189
13183
 
13190
13184
  for (var i=0 ; i<buttons.length ; i++) {
13191
13185
  var button = buttons[i];
@@ -13464,14 +13458,14 @@ DataTable.feature.register( 'pageLength', function ( settings, opts ) {
13464
13458
 
13465
13459
  // Save text node content for macro updating
13466
13460
  var textNodes = [];
13467
- div.find('label')[0].childNodes.forEach(function (el) {
13461
+ Array.from(div.find('label')[0].childNodes).forEach(function (el) {
13468
13462
  if (el.nodeType === Node.TEXT_NODE) {
13469
13463
  textNodes.push({
13470
13464
  el: el,
13471
13465
  text: el.textContent
13472
13466
  });
13473
13467
  }
13474
- })
13468
+ });
13475
13469
 
13476
13470
  // Update the label text in case it has an entries value
13477
13471
  var updateEntries = function (len) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "js/dataTables.js",
5
5
  "module": "js/dataTables.mjs",
6
6
  "types": "./types/types.d.ts",
7
- "version": "2.1.6",
7
+ "version": "2.1.8",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",
package/types/types.d.ts CHANGED
@@ -3064,7 +3064,7 @@ interface FunctionColumnData {
3064
3064
  (row: any, type: 'display' | 'sort' | 'filter' | 'type', s: undefined, meta: CellMetaSettings): any;
3065
3065
  }
3066
3066
 
3067
- interface ObjectColumnData {
3067
+ export interface ObjectColumnData {
3068
3068
  _: string | number | FunctionColumnData;
3069
3069
  filter?: string | number | FunctionColumnData;
3070
3070
  display?: string | number | FunctionColumnData;
@@ -3072,7 +3072,7 @@ interface ObjectColumnData {
3072
3072
  sort?: string | number | FunctionColumnData;
3073
3073
  }
3074
3074
 
3075
- interface ObjectColumnRender {
3075
+ export interface ObjectColumnRender {
3076
3076
  _?: string | number | FunctionColumnRender;
3077
3077
  filter?: string | number | FunctionColumnRender;
3078
3078
  display?: string | number | FunctionColumnRender;