datatables.net 1.13.6 → 1.13.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.
@@ -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
@@ -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 ) {
@@ -9768,12 +9790,12 @@
9768
9790
  /**
9769
9791
  * Version string for plug-ins to check compatibility. Allowed format is
9770
9792
  * `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.
9793
+ * only for non-release builds. See https://semver.org/ for more information.
9772
9794
  * @member
9773
9795
  * @type string
9774
9796
  * @default Version number
9775
9797
  */
9776
- DataTable.version = "1.13.5";
9798
+ DataTable.version = "1.13.7";
9777
9799
 
9778
9800
  /**
9779
9801
  * Private data store, containing all of the settings objects that are
@@ -10349,7 +10371,7 @@
10349
10371
  * --------
10350
10372
  *
10351
10373
  * As an object, the parameters in the object are passed to
10352
- * [jQuery.ajax](http://api.jquery.com/jQuery.ajax/) allowing fine control
10374
+ * [jQuery.ajax](https://api.jquery.com/jQuery.ajax/) allowing fine control
10353
10375
  * of the Ajax request. DataTables has a number of default parameters which
10354
10376
  * you can override using this option. Please refer to the jQuery
10355
10377
  * documentation for a full description of the options available, although
@@ -12057,7 +12079,7 @@
12057
12079
  * $(document).ready( function() {
12058
12080
  * $('#example').dataTable( {
12059
12081
  * "language": {
12060
- * "url": "http://www.sprymedia.co.uk/dataTables/lang.txt"
12082
+ * "url": "https://www.sprymedia.co.uk/dataTables/lang.txt"
12061
12083
  * }
12062
12084
  * } );
12063
12085
  * } );
@@ -14838,7 +14860,7 @@
14838
14860
  var btnDisplay, btnClass;
14839
14861
 
14840
14862
  var attach = function( container, buttons ) {
14841
- var i, ien, node, button, tabIndex;
14863
+ var i, ien, node, button;
14842
14864
  var disabledClass = classes.sPageButtonDisabled;
14843
14865
  var clickHandler = function ( e ) {
14844
14866
  _fnPageChange( settings, e.data.action, true );
@@ -14853,9 +14875,10 @@
14853
14875
  attach( inner, button );
14854
14876
  }
14855
14877
  else {
14878
+ var disabled = false;
14879
+
14856
14880
  btnDisplay = null;
14857
14881
  btnClass = button;
14858
- tabIndex = settings.iTabIndex;
14859
14882
 
14860
14883
  switch ( button ) {
14861
14884
  case 'ellipsis':
@@ -14866,8 +14889,7 @@
14866
14889
  btnDisplay = lang.sFirst;
14867
14890
 
14868
14891
  if ( page === 0 ) {
14869
- tabIndex = -1;
14870
- btnClass += ' ' + disabledClass;
14892
+ disabled = true;
14871
14893
  }
14872
14894
  break;
14873
14895
 
@@ -14875,8 +14897,7 @@
14875
14897
  btnDisplay = lang.sPrevious;
14876
14898
 
14877
14899
  if ( page === 0 ) {
14878
- tabIndex = -1;
14879
- btnClass += ' ' + disabledClass;
14900
+ disabled = true;
14880
14901
  }
14881
14902
  break;
14882
14903
 
@@ -14884,8 +14905,7 @@
14884
14905
  btnDisplay = lang.sNext;
14885
14906
 
14886
14907
  if ( pages === 0 || page === pages-1 ) {
14887
- tabIndex = -1;
14888
- btnClass += ' ' + disabledClass;
14908
+ disabled = true;
14889
14909
  }
14890
14910
  break;
14891
14911
 
@@ -14893,8 +14913,7 @@
14893
14913
  btnDisplay = lang.sLast;
14894
14914
 
14895
14915
  if ( pages === 0 || page === pages-1 ) {
14896
- tabIndex = -1;
14897
- btnClass += ' ' + disabledClass;
14916
+ disabled = true;
14898
14917
  }
14899
14918
  break;
14900
14919
 
@@ -14907,8 +14926,10 @@
14907
14926
 
14908
14927
  if ( btnDisplay !== null ) {
14909
14928
  var tag = settings.oInit.pagingTag || 'a';
14910
- var disabled = btnClass.indexOf(disabledClass) !== -1;
14911
-
14929
+
14930
+ if (disabled) {
14931
+ btnClass += ' ' + disabledClass;
14932
+ }
14912
14933
 
14913
14934
  node = $('<'+tag+'>', {
14914
14935
  'class': classes.sPageButton+' '+btnClass,
@@ -14918,7 +14939,7 @@
14918
14939
  'role': 'link',
14919
14940
  'aria-current': btnClass === classes.sPageButtonActive ? 'page' : null,
14920
14941
  'data-dt-idx': button,
14921
- 'tabindex': tabIndex,
14942
+ 'tabindex': disabled ? -1 : settings.iTabIndex,
14922
14943
  'id': idx === 0 && typeof button === 'string' ?
14923
14944
  settings.sTableId +'_'+ button :
14924
14945
  null
@@ -15135,7 +15156,7 @@
15135
15156
  // string
15136
15157
  "string-pre": function ( a ) {
15137
15158
  // This is a little complex, but faster than always calling toString,
15138
- // http://jsperf.com/tostring-v-check
15159
+ // https://jsperf.com/tostring-v-check
15139
15160
  return _empty(a) ?
15140
15161
  '' :
15141
15162
  typeof a === 'string' ?