datatables.net 2.3.6 → 2.3.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.3.6
1
+ /*! DataTables 2.3.8
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -413,7 +413,7 @@ var DataTable = function ( selector, options )
413
413
  if ( tfoot.length === 0 ) {
414
414
  // If we are a scrolling table, and no footer has been given, then we need to create
415
415
  // a tfoot element for the caption element to be appended to
416
- tfoot = $('<tfoot/>').insertAfter(thead);
416
+ tfoot = $('<tfoot/>').appendTo($this);
417
417
  }
418
418
  oSettings.nTFoot = tfoot[0];
419
419
 
@@ -3560,6 +3560,11 @@ function _fnReDraw( settings, holdPosition, recompute )
3560
3560
  if ( holdPosition !== true ) {
3561
3561
  settings._iDisplayStart = 0;
3562
3562
  }
3563
+ else {
3564
+ // Keep position, but make sure that there is actually data to display,
3565
+ // otherwise we need to rewind a bit (e.g. if rows were deleted)
3566
+ _fnLengthOverflow(settings);
3567
+ }
3563
3568
 
3564
3569
  // Let any modules know about the draw hold position state (used by
3565
3570
  // scrolling internally)
@@ -4873,6 +4878,12 @@ function _fnInitComplete ( settings )
4873
4878
 
4874
4879
  var args = [settings, settings.json];
4875
4880
 
4881
+ // If the footer element is empty after initialisation, then remove it
4882
+ let tfoot = $(settings.tfoot);
4883
+ if (tfoot.children().length === 0) {
4884
+ tfoot.remove();
4885
+ }
4886
+
4876
4887
  settings._bInitComplete = true;
4877
4888
 
4878
4889
  // Table is fully set up and we have data, so calculate the
@@ -5329,12 +5340,12 @@ function _fnScrollDraw ( settings )
5329
5340
  // the content of the cell so that the width applied to the header and body
5330
5341
  // both match, but we want to hide it completely.
5331
5342
  $('th, td', headerCopy).each(function () {
5332
- $(this.childNodes).wrapAll('<div class="dt-scroll-sizing">');
5343
+ $(this.childNodes).wrapAll('<div class="dt-scroll-sizing" />');
5333
5344
  });
5334
5345
 
5335
5346
  if ( footer ) {
5336
5347
  $('th, td', footerCopy).each(function () {
5337
- $(this.childNodes).wrapAll('<div class="dt-scroll-sizing">');
5348
+ $(this.childNodes).wrapAll('<div class="dt-scroll-sizing" />');
5338
5349
  });
5339
5350
  }
5340
5351
 
@@ -5362,6 +5373,10 @@ function _fnScrollDraw ( settings )
5362
5373
  // Correct DOM ordering for colgroup - comes before the thead
5363
5374
  table.children('colgroup').prependTo(table);
5364
5375
 
5376
+ // Remove tabindex from the hidden row elements
5377
+ table.find('thead, tfoot').find('[tabindex]').removeAttr('tabindex');
5378
+ table.find('thead, tfoot').find('role').removeAttr('role');
5379
+
5365
5380
  // Adjust the position of the header in case we loose the y-scrollbar
5366
5381
  divBody.trigger('scroll');
5367
5382
 
@@ -5685,8 +5700,12 @@ function _fnGetWideStrings( settings, colIdx )
5685
5700
  .replace(/id=".*?"/g, '')
5686
5701
  .replace(/name=".*?"/g, '');
5687
5702
 
5688
- // Don't want Javascript at all in these calculation cells.
5689
- cellString = cellString.replace(/<script.*?<\/script>/gi, ' ');
5703
+ // Don't want script, dialog or template tags in the width
5704
+ // calculations as they are hidden content
5705
+ cellString = cellString
5706
+ .replace(/<script[\s\S]*?<\/script>/gi, ' ')
5707
+ .replace(/<dialog[\s\S]*?<\/dialog>/gi, ' ')
5708
+ .replace(/<template[\s\S]*?<\/template>/gi, ' ');
5690
5709
 
5691
5710
  var noHtml = _stripHtml(cellString, ' ')
5692
5711
  .replace( /&nbsp;/g, ' ' );
@@ -8849,6 +8868,10 @@ var __column_selector = function ( settings, selector, opts )
8849
8868
  return null;
8850
8869
  }
8851
8870
 
8871
+ if (col.responsiveVisible === false) {
8872
+ return null;
8873
+ }
8874
+
8852
8875
  // Selector
8853
8876
  if (match[1]) {
8854
8877
  return $(nodes[idx]).filter(match[1]).length > 0 ? idx : null;
@@ -10253,7 +10276,7 @@ function cleanHeader(node, className) {
10253
10276
  * @type string
10254
10277
  * @default Version number
10255
10278
  */
10256
- DataTable.version = "2.3.6";
10279
+ DataTable.version = "2.3.8";
10257
10280
 
10258
10281
  /**
10259
10282
  * Private data store, containing all of the settings objects that are
@@ -12535,6 +12558,7 @@ function __mld( dtLib, momentFn, luxonFn, dateFn, arg1 ) {
12535
12558
  var __mlWarning = false;
12536
12559
  var __luxon; // Can be assigned in DateTable.use()
12537
12560
  var __moment; // Can be assigned in DateTable.use()
12561
+ var __reIsoTimezone = /[T\s]\d{2}.*?(Z|[+-]\d{2}(?::?\d{2})?)$/;
12538
12562
 
12539
12563
  /**
12540
12564
  *
@@ -12555,7 +12579,7 @@ function __mldObj (d, format, locale) {
12555
12579
  resolveWindowLibs();
12556
12580
 
12557
12581
  if (__moment) {
12558
- dt = __moment.utc( d, format, locale, true );
12582
+ dt = __moment( d, format, locale, true );
12559
12583
 
12560
12584
  if (! dt.isValid()) {
12561
12585
  return null;
@@ -12665,6 +12689,16 @@ function __mlHelper (localeString) {
12665
12689
  return d;
12666
12690
  }
12667
12691
 
12692
+ // Determine if there is a timezone. If there is, we want to reuse
12693
+ // it for the output, so the timezone doesn't change between the
12694
+ // input and output.
12695
+ let options = {};
12696
+ let tzMatch = typeof d === 'string' ? d.match(__reIsoTimezone) : null;
12697
+
12698
+ if (tzMatch) {
12699
+ options.timeZone = tzMatch[1] === 'Z' ? 'UTC' : tzMatch[1];
12700
+ }
12701
+
12668
12702
  var dt = __mldObj(d, from, locale);
12669
12703
 
12670
12704
  if (dt === null) {
@@ -12678,7 +12712,7 @@ function __mlHelper (localeString) {
12678
12712
  var formatted = to === null
12679
12713
  ? __mld(dt, 'toDate', 'toJSDate', '')[localeString](
12680
12714
  navigator.language,
12681
- { timeZone: "UTC" }
12715
+ options
12682
12716
  )
12683
12717
  : __mld(dt, 'format', 'toFormat', 'toISOString', to);
12684
12718
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "datatables.net",
3
- "description": "jQuery DataTables",
3
+ "description": "DataTables - The Javascript table library",
4
4
  "main": "js/dataTables.js",
5
5
  "module": "js/dataTables.mjs",
6
6
  "types": "./types/types.d.ts",
7
- "version": "2.3.6",
7
+ "version": "2.3.8",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",