datatables.net 1.12.0 → 1.13.0

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.
@@ -1,11 +1,11 @@
1
- /*! DataTables 1.12.0
1
+ /*! DataTables 1.13.0
2
2
  * ©2008-2022 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  /**
6
6
  * @summary DataTables
7
7
  * @description Paginate, search and order HTML tables
8
- * @version 1.12.0
8
+ * @version 1.13.0
9
9
  * @author SpryMedia Ltd
10
10
  * @contact www.datatables.net
11
11
  * @copyright SpryMedia Ltd.
@@ -1150,6 +1150,10 @@
1150
1150
  $( rowOne[0] ).children('th, td').each( function (i, cell) {
1151
1151
  var col = oSettings.aoColumns[i];
1152
1152
 
1153
+ if (! col) {
1154
+ _fnLog( oSettings, 0, 'Incorrect column count', 18 );
1155
+ }
1156
+
1153
1157
  if ( col.mData === i ) {
1154
1158
  var sort = a( cell, 'sort' ) || a( cell, 'order' );
1155
1159
  var filter = a( cell, 'filter' ) || a( cell, 'search' );
@@ -3154,6 +3158,11 @@
3154
3158
  create = nTrIn ? false : true;
3155
3159
 
3156
3160
  nTd = create ? document.createElement( oCol.sCellType ) : anTds[i];
3161
+
3162
+ if (! nTd) {
3163
+ _fnLog( oSettings, 0, 'Incorrect column count', 18 );
3164
+ }
3165
+
3157
3166
  nTd._DT_CellIndex = {
3158
3167
  row: iRow,
3159
3168
  column: i
@@ -3304,10 +3313,16 @@
3304
3313
 
3305
3314
  for ( i=0, ien=cells.length ; i<ien ; i++ ) {
3306
3315
  column = columns[i];
3307
- column.nTf = cells[i].cell;
3308
3316
 
3309
- if ( column.sClass ) {
3310
- $(column.nTf).addClass( column.sClass );
3317
+ if (column) {
3318
+ column.nTf = cells[i].cell;
3319
+
3320
+ if ( column.sClass ) {
3321
+ $(column.nTf).addClass( column.sClass );
3322
+ }
3323
+ }
3324
+ else {
3325
+ _fnLog( oSettings, 0, 'Incorrect column count', 18 );
3311
3326
  }
3312
3327
  }
3313
3328
  }
@@ -5067,6 +5082,10 @@
5067
5082
  _fnDraw( settings );
5068
5083
  }
5069
5084
  }
5085
+ else {
5086
+ // No change event - paging was called, but no change
5087
+ _fnCallbackFire( settings, null, 'page-nc', [settings] );
5088
+ }
5070
5089
 
5071
5090
  return changed;
5072
5091
  }
@@ -5336,6 +5355,7 @@
5336
5355
  footerCopy = footer.clone().prependTo( table );
5337
5356
  footerTrgEls = footer.find('tr'); // the original tfoot is in its own table and must be sized
5338
5357
  footerSrcEls = footerCopy.find('tr');
5358
+ footerCopy.find('[id]').removeAttr('id');
5339
5359
  }
5340
5360
 
5341
5361
  // Clone the current header and footer elements and then place it into the inner table
@@ -5343,6 +5363,7 @@
5343
5363
  headerTrgEls = header.find('tr'); // original header is in its own table
5344
5364
  headerSrcEls = headerCopy.find('tr');
5345
5365
  headerCopy.find('th, td').removeAttr('tabindex');
5366
+ headerCopy.find('[id]').removeAttr('id');
5346
5367
 
5347
5368
 
5348
5369
  /*
@@ -8320,8 +8341,12 @@
8320
8341
 
8321
8342
  $(document).on('plugin-init.dt', function (e, context) {
8322
8343
  var api = new _Api( context );
8344
+
8345
+ const namespace = 'on-plugin-init';
8346
+ const stateSaveParamsEvent = `stateSaveParams.${namespace}`;
8347
+ const destroyEvent = `destroy.${namespace}`;
8323
8348
 
8324
- api.on( 'stateSaveParams', function ( e, settings, d ) {
8349
+ api.on( stateSaveParamsEvent, function ( e, settings, d ) {
8325
8350
  // This could be more compact with the API, but it is a lot faster as a simple
8326
8351
  // internal loop
8327
8352
  var idFn = settings.rowIdFn;
@@ -8335,7 +8360,11 @@
8335
8360
  }
8336
8361
 
8337
8362
  d.childRows = ids;
8338
- })
8363
+ });
8364
+
8365
+ api.on( destroyEvent, function () {
8366
+ api.off(`${stateSaveParamsEvent} ${destroyEvent}`);
8367
+ });
8339
8368
 
8340
8369
  var loaded = api.state.loaded();
8341
8370
 
@@ -9656,7 +9685,7 @@
9656
9685
  * @type string
9657
9686
  * @default Version number
9658
9687
  */
9659
- DataTable.version = "1.12.0";
9688
+ DataTable.version = "1.13.0";
9660
9689
 
9661
9690
  /**
9662
9691
  * Private data store, containing all of the settings objects that are
@@ -14718,7 +14747,7 @@
14718
14747
  var classes = settings.oClasses;
14719
14748
  var lang = settings.oLanguage.oPaginate;
14720
14749
  var aria = settings.oLanguage.oAria.paginate || {};
14721
- var btnDisplay, btnClass, counter=0;
14750
+ var btnDisplay, btnClass;
14722
14751
 
14723
14752
  var attach = function( container, buttons ) {
14724
14753
  var i, ien, node, button, tabIndex;
@@ -14793,7 +14822,7 @@
14793
14822
  'class': classes.sPageButton+' '+btnClass,
14794
14823
  'aria-controls': settings.sTableId,
14795
14824
  'aria-label': aria[ button ],
14796
- 'data-dt-idx': counter,
14825
+ 'data-dt-idx': button,
14797
14826
  'tabindex': tabIndex,
14798
14827
  'id': idx === 0 && typeof button === 'string' ?
14799
14828
  settings.sTableId +'_'+ button :
@@ -14805,8 +14834,6 @@
14805
14834
  _fnBindAction(
14806
14835
  node, {action: button}, clickHandler
14807
14836
  );
14808
-
14809
- counter++;
14810
14837
  }
14811
14838
  }
14812
14839
  }
@@ -15151,7 +15178,7 @@
15151
15178
  }
15152
15179
  }
15153
15180
  else if (window.luxon) {
15154
- dt = format
15181
+ dt = format && typeof d === 'string'
15155
15182
  ? window.luxon.DateTime.fromFormat( d, format )
15156
15183
  : window.luxon.DateTime.fromISO( d );
15157
15184
 
@@ -15291,14 +15318,26 @@
15291
15318
  }
15292
15319
 
15293
15320
  // Based on locale, determine standard number formatting
15294
- var __thousands = '';
15295
- var __decimal = '';
15321
+ // Fallback for legacy browsers is US English
15322
+ var __thousands = ',';
15323
+ var __decimal = '.';
15296
15324
 
15297
15325
  if (Intl) {
15298
- var num = new Intl.NumberFormat().formatToParts(1000.1);
15299
-
15300
- __thousands = num[1].value;
15301
- __decimal = num[3].value;
15326
+ try {
15327
+ var num = new Intl.NumberFormat().formatToParts(100000.1);
15328
+
15329
+ for (var i=0 ; i<num.length ; i++) {
15330
+ if (num[i].type === 'group') {
15331
+ __thousands = num[i].value;
15332
+ }
15333
+ else if (num[i].type === 'decimal') {
15334
+ __decimal = num[i].value;
15335
+ }
15336
+ }
15337
+ }
15338
+ catch (e) {
15339
+ // noop
15340
+ }
15302
15341
  }
15303
15342
 
15304
15343
  // Formatted date time detection - use by declaring the formats you are going to use
@@ -15367,6 +15406,10 @@
15367
15406
  return d;
15368
15407
  }
15369
15408
 
15409
+ if (d === '' || d === null) {
15410
+ return d;
15411
+ }
15412
+
15370
15413
  var negative = d < 0 ? '-' : '';
15371
15414
  var flo = parseFloat( d );
15372
15415
 
@@ -15557,6 +15600,6 @@
15557
15600
  $.each( DataTable, function ( prop, val ) {
15558
15601
  $.fn.DataTable[ prop ] = val;
15559
15602
  } );
15560
-
15603
+
15561
15604
  return DataTable;
15562
15605
  }));