datatables.net 1.13.6 → 1.13.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.
@@ -1,23 +1,23 @@
1
- /*! DataTables 1.13.5
1
+ /*! DataTables 1.13.7
2
2
  * ©2008-2023 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.13.4
8
+ * @version 1.13.7
9
9
  * @author SpryMedia Ltd
10
10
  * @contact www.datatables.net
11
11
  * @copyright SpryMedia Ltd.
12
12
  *
13
13
  * This source file is free software, available under the following license:
14
- * MIT license - http://datatables.net/license
14
+ * MIT license - https://datatables.net/license
15
15
  *
16
16
  * This source file is distributed in the hope that it will be useful, but
17
17
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18
18
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
19
19
  *
20
- * For details please refer to: http://www.datatables.net
20
+ * For details please refer to: https://www.datatables.net
21
21
  */
22
22
 
23
23
  /*jslint evil: true, undef: true, browser: true */
@@ -38,7 +38,7 @@
38
38
  // returns a factory function that expects the window object
39
39
  var jq = require('jquery');
40
40
 
41
- if (typeof window !== 'undefined') {
41
+ if (typeof window === 'undefined') {
42
42
  module.exports = function (root, $) {
43
43
  if ( ! root ) {
44
44
  // CommonJS environments without a window global must pass a
@@ -54,7 +54,7 @@
54
54
  };
55
55
  }
56
56
  else {
57
- return factory( jq, window, window.document );
57
+ module.exports = factory( jq, window, window.document );
58
58
  }
59
59
  }
60
60
  else {
@@ -1345,7 +1345,7 @@
1345
1345
  // Escape regular expression special characters
1346
1346
  var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' );
1347
1347
 
1348
- // http://en.wikipedia.org/wiki/Foreign_exchange_market
1348
+ // https://en.wikipedia.org/wiki/Foreign_exchange_market
1349
1349
  // - \u20BD - Russian ruble.
1350
1350
  // - \u20a9 - South Korean Won
1351
1351
  // - \u20BA - Turkish Lira
@@ -2344,6 +2344,12 @@
2344
2344
  oCol.aDataSort = [ oOptions.iDataSort ];
2345
2345
  }
2346
2346
  _fnMap( oCol, oOptions, "aDataSort" );
2347
+
2348
+ // Fall back to the aria-label attribute on the table header if no ariaTitle is
2349
+ // provided.
2350
+ if (! oCol.ariaTitle) {
2351
+ oCol.ariaTitle = th.attr("aria-label");
2352
+ }
2347
2353
  }
2348
2354
 
2349
2355
  /* Cache the data get and set functions for speed */
@@ -4307,7 +4313,7 @@
4307
4313
  /* Update all other filter input elements for the new display */
4308
4314
  var n = features.f;
4309
4315
  var val = !this.value ? "" : this.value; // mental IE8 fix :-(
4310
- if(previousSearch.return && event.key !== "Enter") {
4316
+ if(previousSearch['return'] && event.key !== "Enter") {
4311
4317
  return;
4312
4318
  }
4313
4319
  /* Now do the filter */
@@ -4317,7 +4323,7 @@
4317
4323
  "bRegex": previousSearch.bRegex,
4318
4324
  "bSmart": previousSearch.bSmart ,
4319
4325
  "bCaseInsensitive": previousSearch.bCaseInsensitive,
4320
- "return": previousSearch.return
4326
+ "return": previousSearch['return']
4321
4327
  } );
4322
4328
 
4323
4329
  // Need to redraw, without resorting
@@ -4392,7 +4398,7 @@
4392
4398
  oPrevSearch.bRegex = oFilter.bRegex;
4393
4399
  oPrevSearch.bSmart = oFilter.bSmart;
4394
4400
  oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
4395
- oPrevSearch.return = oFilter.return;
4401
+ oPrevSearch['return'] = oFilter['return'];
4396
4402
  };
4397
4403
  var fnRegex = function ( o ) {
4398
4404
  // Backwards compatibility with the bEscapeRegex option
@@ -4644,7 +4650,7 @@
4644
4650
  // If it looks like there is an HTML entity in the string,
4645
4651
  // attempt to decode it so sorting works as expected. Note that
4646
4652
  // we could use a single line of jQuery to do this, but the DOM
4647
- // method used here is much faster http://jsperf.com/html-decode
4653
+ // method used here is much faster https://jsperf.com/html-decode
4648
4654
  if ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {
4649
4655
  __filter_div.innerHTML = cellData;
4650
4656
  cellData = __filter_div_textContent ?
@@ -5669,11 +5675,13 @@
5669
5675
  }
5670
5676
 
5671
5677
  /* Convert any user input sizes into pixel sizes */
5678
+ var sizes = _fnConvertToWidth(_pluck(columns, 'sWidthOrig'), tableContainer);
5679
+
5672
5680
  for ( i=0 ; i<visibleColumns.length ; i++ ) {
5673
5681
  column = columns[ visibleColumns[i] ];
5674
5682
 
5675
5683
  if ( column.sWidth !== null ) {
5676
- column.sWidth = _fnConvertToWidth( column.sWidthOrig, tableContainer );
5684
+ column.sWidth = sizes[i];
5677
5685
 
5678
5686
  userInputs = true;
5679
5687
  }
@@ -5876,26 +5884,40 @@
5876
5884
 
5877
5885
 
5878
5886
  /**
5879
- * Convert a CSS unit width to pixels (e.g. 2em)
5880
- * @param {string} width width to be converted
5887
+ * Convert a set of CSS units width to pixels (e.g. 2em)
5888
+ * @param {string[]} widths widths to be converted
5881
5889
  * @param {node} parent parent to get the with for (required for relative widths) - optional
5882
- * @returns {int} width in pixels
5890
+ * @returns {int[]} widths in pixels
5883
5891
  * @memberof DataTable#oApi
5884
5892
  */
5885
- function _fnConvertToWidth ( width, parent )
5893
+ function _fnConvertToWidth ( widths, parent )
5886
5894
  {
5887
- if ( ! width ) {
5888
- return 0;
5895
+ var els = [];
5896
+ var results = [];
5897
+
5898
+ // Add the elements in a single loop so we only need to reflow once
5899
+ for (var i=0 ; i<widths.length ; i++) {
5900
+ if (widths[i]) {
5901
+ els.push(
5902
+ $('<div/>')
5903
+ .css( 'width', _fnStringToCss( widths[i] ) )
5904
+ .appendTo( parent || document.body )
5905
+ )
5906
+ }
5907
+ else {
5908
+ els.push(null);
5909
+ }
5889
5910
  }
5890
5911
 
5891
- var n = $('<div/>')
5892
- .css( 'width', _fnStringToCss( width ) )
5893
- .appendTo( parent || document.body );
5912
+ // Get the sizes (will reflow once)
5913
+ for (var i=0 ; i<widths.length ; i++) {
5914
+ results.push(els[i] ? els[i][0].offsetWidth : null);
5915
+ }
5894
5916
 
5895
- var val = n[0].offsetWidth;
5896
- n.remove();
5917
+ // Tidy
5918
+ $(els).remove();
5897
5919
 
5898
- return val;
5920
+ return results;
5899
5921
  }
5900
5922
 
5901
5923
 
@@ -6630,7 +6652,7 @@
6630
6652
 
6631
6653
  if ( tn ) {
6632
6654
  msg += '. For more information about this error, please see '+
6633
- 'http://datatables.net/tn/'+tn;
6655
+ 'https://datatables.net/tn/'+tn;
6634
6656
  }
6635
6657
 
6636
6658
  if ( ! level ) {
@@ -8561,7 +8583,13 @@
8561
8583
  row = data[i];
8562
8584
 
8563
8585
  if ( row._details ) {
8564
- row._details.children('td[colspan]').attr('colspan', visible );
8586
+ row._details.each(function () {
8587
+ var el = $(this).children('td');
8588
+
8589
+ if (el.length == 1) {
8590
+ el.attr('colspan', visible);
8591
+ }
8592
+ });
8565
8593
  }
8566
8594
  }
8567
8595
  } );
@@ -9768,12 +9796,12 @@
9768
9796
  /**
9769
9797
  * Version string for plug-ins to check compatibility. Allowed format is
9770
9798
  * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
9771
- * only for non-release builds. See http://semver.org/ for more information.
9799
+ * only for non-release builds. See https://semver.org/ for more information.
9772
9800
  * @member
9773
9801
  * @type string
9774
9802
  * @default Version number
9775
9803
  */
9776
- DataTable.version = "1.13.5";
9804
+ DataTable.version = "1.13.7";
9777
9805
 
9778
9806
  /**
9779
9807
  * Private data store, containing all of the settings objects that are
@@ -10349,7 +10377,7 @@
10349
10377
  * --------
10350
10378
  *
10351
10379
  * As an object, the parameters in the object are passed to
10352
- * [jQuery.ajax](http://api.jquery.com/jQuery.ajax/) allowing fine control
10380
+ * [jQuery.ajax](https://api.jquery.com/jQuery.ajax/) allowing fine control
10353
10381
  * of the Ajax request. DataTables has a number of default parameters which
10354
10382
  * you can override using this option. Please refer to the jQuery
10355
10383
  * documentation for a full description of the options available, although
@@ -12057,7 +12085,7 @@
12057
12085
  * $(document).ready( function() {
12058
12086
  * $('#example').dataTable( {
12059
12087
  * "language": {
12060
- * "url": "http://www.sprymedia.co.uk/dataTables/lang.txt"
12088
+ * "url": "https://www.sprymedia.co.uk/dataTables/lang.txt"
12061
12089
  * }
12062
12090
  * } );
12063
12091
  * } );
@@ -14838,7 +14866,7 @@
14838
14866
  var btnDisplay, btnClass;
14839
14867
 
14840
14868
  var attach = function( container, buttons ) {
14841
- var i, ien, node, button, tabIndex;
14869
+ var i, ien, node, button;
14842
14870
  var disabledClass = classes.sPageButtonDisabled;
14843
14871
  var clickHandler = function ( e ) {
14844
14872
  _fnPageChange( settings, e.data.action, true );
@@ -14853,9 +14881,10 @@
14853
14881
  attach( inner, button );
14854
14882
  }
14855
14883
  else {
14884
+ var disabled = false;
14885
+
14856
14886
  btnDisplay = null;
14857
14887
  btnClass = button;
14858
- tabIndex = settings.iTabIndex;
14859
14888
 
14860
14889
  switch ( button ) {
14861
14890
  case 'ellipsis':
@@ -14866,8 +14895,7 @@
14866
14895
  btnDisplay = lang.sFirst;
14867
14896
 
14868
14897
  if ( page === 0 ) {
14869
- tabIndex = -1;
14870
- btnClass += ' ' + disabledClass;
14898
+ disabled = true;
14871
14899
  }
14872
14900
  break;
14873
14901
 
@@ -14875,8 +14903,7 @@
14875
14903
  btnDisplay = lang.sPrevious;
14876
14904
 
14877
14905
  if ( page === 0 ) {
14878
- tabIndex = -1;
14879
- btnClass += ' ' + disabledClass;
14906
+ disabled = true;
14880
14907
  }
14881
14908
  break;
14882
14909
 
@@ -14884,8 +14911,7 @@
14884
14911
  btnDisplay = lang.sNext;
14885
14912
 
14886
14913
  if ( pages === 0 || page === pages-1 ) {
14887
- tabIndex = -1;
14888
- btnClass += ' ' + disabledClass;
14914
+ disabled = true;
14889
14915
  }
14890
14916
  break;
14891
14917
 
@@ -14893,8 +14919,7 @@
14893
14919
  btnDisplay = lang.sLast;
14894
14920
 
14895
14921
  if ( pages === 0 || page === pages-1 ) {
14896
- tabIndex = -1;
14897
- btnClass += ' ' + disabledClass;
14922
+ disabled = true;
14898
14923
  }
14899
14924
  break;
14900
14925
 
@@ -14907,8 +14932,10 @@
14907
14932
 
14908
14933
  if ( btnDisplay !== null ) {
14909
14934
  var tag = settings.oInit.pagingTag || 'a';
14910
- var disabled = btnClass.indexOf(disabledClass) !== -1;
14911
-
14935
+
14936
+ if (disabled) {
14937
+ btnClass += ' ' + disabledClass;
14938
+ }
14912
14939
 
14913
14940
  node = $('<'+tag+'>', {
14914
14941
  'class': classes.sPageButton+' '+btnClass,
@@ -14918,7 +14945,7 @@
14918
14945
  'role': 'link',
14919
14946
  'aria-current': btnClass === classes.sPageButtonActive ? 'page' : null,
14920
14947
  'data-dt-idx': button,
14921
- 'tabindex': tabIndex,
14948
+ 'tabindex': disabled ? -1 : settings.iTabIndex,
14922
14949
  'id': idx === 0 && typeof button === 'string' ?
14923
14950
  settings.sTableId +'_'+ button :
14924
14951
  null
@@ -15135,7 +15162,7 @@
15135
15162
  // string
15136
15163
  "string-pre": function ( a ) {
15137
15164
  // This is a little complex, but faster than always calling toString,
15138
- // http://jsperf.com/tostring-v-check
15165
+ // https://jsperf.com/tostring-v-check
15139
15166
  return _empty(a) ?
15140
15167
  '' :
15141
15168
  typeof a === 'string' ?