datatables.net 1.13.4 → 1.13.6

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,4 +1,4 @@
1
- /*! DataTables 1.13.4
1
+ /*! DataTables 1.13.5
2
2
  * ©2008-2023 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -6,7 +6,7 @@ import jQuery from 'jquery';
6
6
 
7
7
  // DataTables code uses $ internally, but we want to be able to
8
8
  // reassign $ with the `use` method, so it is a regular var.
9
- let $ = jQuery;
9
+ var $ = jQuery;
10
10
 
11
11
 
12
12
  var DataTable = function ( selector, options )
@@ -1327,7 +1327,7 @@ var _numToDecimal = function ( num, decimalPoint ) {
1327
1327
 
1328
1328
 
1329
1329
  var _isNumber = function ( d, decimalPoint, formatted ) {
1330
- let type = typeof d;
1330
+ var type = typeof d;
1331
1331
  var strType = type === 'string';
1332
1332
 
1333
1333
  if ( type === 'number' || type === 'bigint') {
@@ -1461,7 +1461,9 @@ var _removeEmpty = function ( a )
1461
1461
 
1462
1462
 
1463
1463
  var _stripHtml = function ( d ) {
1464
- return d.replace( _re_html, '' );
1464
+ return d
1465
+ .replace( _re_html, '' ) // Complete tags
1466
+ .replace(/<script/i, ''); // Safety for incomplete script tag
1465
1467
  };
1466
1468
 
1467
1469
 
@@ -1835,7 +1837,10 @@ DataTable.util = {
1835
1837
  continue;
1836
1838
  }
1837
1839
 
1838
- if ( data === null || data[ a[i] ] === undefined ) {
1840
+ if (data === null || data[ a[i] ] === null) {
1841
+ return null;
1842
+ }
1843
+ else if ( data === undefined || data[ a[i] ] === undefined ) {
1839
1844
  return undefined;
1840
1845
  }
1841
1846
 
@@ -4006,11 +4011,16 @@ function _fnAjaxUpdate( settings )
4006
4011
  settings.iDraw++;
4007
4012
  _fnProcessingDisplay( settings, true );
4008
4013
 
4014
+ // Keep track of drawHold state to handle scrolling after the Ajax call
4015
+ var drawHold = settings._drawHold;
4016
+
4009
4017
  _fnBuildAjax(
4010
4018
  settings,
4011
4019
  _fnAjaxParameters( settings ),
4012
4020
  function(json) {
4021
+ settings._drawHold = drawHold;
4013
4022
  _fnAjaxUpdateDraw( settings, json );
4023
+ settings._drawHold = false;
4014
4024
  }
4015
4025
  );
4016
4026
  }
@@ -4274,7 +4284,7 @@ function _fnFeatureHtmlFilter ( settings )
4274
4284
  _fnThrottle( searchFn, searchDelay ) :
4275
4285
  searchFn
4276
4286
  )
4277
- .on( 'mouseup', function(e) {
4287
+ .on( 'mouseup.DT', function(e) {
4278
4288
  // Edge fix! Edge 17 does not trigger anything other than mouse events when clicking
4279
4289
  // on the clear icon (Edge bug 17584515). This is safe in other browsers as `searchFn`
4280
4290
  // checks the value to see if it has changed. In other browsers it won't have.
@@ -4340,7 +4350,7 @@ function _fnFilterComplete ( oSettings, oInput, iForce )
4340
4350
  if ( _fnDataSource( oSettings ) != 'ssp' )
4341
4351
  {
4342
4352
  /* Global filter */
4343
- _fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive, oInput.return );
4353
+ _fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive );
4344
4354
  fnSaveFilter( oInput );
4345
4355
 
4346
4356
  /* Now do the individual column filter */
@@ -4509,11 +4519,15 @@ function _fnFilterCreateSearch( search, regex, smart, caseInsensitive )
4509
4519
  *
4510
4520
  * ^(?=.*?\bone\b)(?=.*?\btwo three\b)(?=.*?\bfour\b).*$
4511
4521
  */
4512
- var a = $.map( search.match( /"[^"]+"|[^ ]+/g ) || [''], function ( word ) {
4522
+ var a = $.map( search.match( /["\u201C][^"\u201D]+["\u201D]|[^ ]+/g ) || [''], function ( word ) {
4513
4523
  if ( word.charAt(0) === '"' ) {
4514
4524
  var m = word.match( /^"(.*)"$/ );
4515
4525
  word = m ? m[1] : word;
4516
4526
  }
4527
+ else if ( word.charAt(0) === '\u201C' ) {
4528
+ var m = word.match( /^\u201C(.*)\u201D$/ );
4529
+ word = m ? m[1] : word;
4530
+ }
4517
4531
 
4518
4532
  return word.replace('"', '');
4519
4533
  } );
@@ -9317,7 +9331,8 @@ _api_register( 'state.save()', function () {
9317
9331
  * Set the jQuery or window object to be used by DataTables
9318
9332
  *
9319
9333
  * @param {*} module Library / container object
9320
- * @param {string} type Library or container type `lib` or `win`.
9334
+ * @param {string} [type] Library or container type `lib`, `win` or `datetime`.
9335
+ * If not provided, automatic detection is attempted.
9321
9336
  */
9322
9337
  DataTable.use = function (module, type) {
9323
9338
  if (type === 'lib' || module.fn) {
@@ -9327,6 +9342,9 @@ DataTable.use = function (module, type) {
9327
9342
  window = module;
9328
9343
  document = module.document;
9329
9344
  }
9345
+ else if (type === 'datetime' || module.type === 'DateTime') {
9346
+ DataTable.DateTime = module;
9347
+ }
9330
9348
  }
9331
9349
 
9332
9350
  /**
@@ -9686,7 +9704,9 @@ _api_register( 'i18n()', function ( token, def, plural ) {
9686
9704
  resolved._;
9687
9705
  }
9688
9706
 
9689
- return resolved.replace( '%d', plural ); // nb: plural might be undefined,
9707
+ return typeof resolved === 'string'
9708
+ ? resolved.replace( '%d', plural ) // nb: plural might be undefined,
9709
+ : resolved;
9690
9710
  } );
9691
9711
  /**
9692
9712
  * Version string for plug-ins to check compatibility. Allowed format is
@@ -9696,7 +9716,7 @@ _api_register( 'i18n()', function ( token, def, plural ) {
9696
9716
  * @type string
9697
9717
  * @default Version number
9698
9718
  */
9699
- DataTable.version = "1.13.4";
9719
+ DataTable.version = "1.13.5";
9700
9720
 
9701
9721
  /**
9702
9722
  * Private data store, containing all of the settings objects that are
@@ -14838,7 +14858,7 @@ $.extend( true, DataTable.ext.renderer, {
14838
14858
  'aria-controls': settings.sTableId,
14839
14859
  'aria-disabled': disabled ? 'true' : null,
14840
14860
  'aria-label': aria[ button ],
14841
- 'aria-role': 'link',
14861
+ 'role': 'link',
14842
14862
  'aria-current': btnClass === classes.sPageButtonActive ? 'page' : null,
14843
14863
  'data-dt-idx': button,
14844
14864
  'tabindex': tabIndex,
@@ -14972,7 +14992,7 @@ var __numericReplace = function ( d, decimalPlace, re1, re2 ) {
14972
14992
  return -Infinity;
14973
14993
  }
14974
14994
 
14975
- let type = typeof d;
14995
+ var type = typeof d;
14976
14996
 
14977
14997
  if (type === 'number' || type === 'bigint') {
14978
14998
  return d;
@@ -15346,7 +15366,7 @@ function __mlHelper (localeString) {
15346
15366
  var __thousands = ',';
15347
15367
  var __decimal = '.';
15348
15368
 
15349
- if (Intl) {
15369
+ if (window.Intl !== undefined) {
15350
15370
  try {
15351
15371
  var num = new Intl.NumberFormat().formatToParts(100000.1);
15352
15372
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "js/jquery.dataTables.js",
5
5
  "module": "js/jquery.dataTables.mjs",
6
6
  "types": "./types/types.d.ts",
7
- "version": "1.13.4",
7
+ "version": "1.13.6",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",
package/types/types.d.ts CHANGED
@@ -1719,7 +1719,7 @@ export interface ApiRowChildMethods<T> {
1719
1719
  * @param showRemove This parameter can be given as true or false
1720
1720
  * @returns DataTables Api instance.
1721
1721
  */
1722
- (showRemove: boolean): RowChildMethods<T> | Api<T>;
1722
+ (showRemove: boolean): RowChildMethods<T>;
1723
1723
 
1724
1724
  /**
1725
1725
  * Set the data to show in the child row(s). Note that calling this method will replace any child rows which are already attached to the parent row.
@@ -1728,7 +1728,7 @@ export interface ApiRowChildMethods<T> {
1728
1728
  * @param className Class name that is added to the td cell node(s) of the child row(s). As of 1.10.1 it is also added to the tr row node of the child row(s).
1729
1729
  * @returns DataTables Api instance
1730
1730
  */
1731
- (data: (string | Node | JQuery) | Array<(string | number | JQuery)>, className?: string): RowChildMethods<T> | Api<T>;
1731
+ (data: (string | Node | JQuery) | Array<(string | number | JQuery)>, className?: string): RowChildMethods<T>;
1732
1732
 
1733
1733
  /**
1734
1734
  * Hide the child row(s) of a parent row
@@ -2128,7 +2128,7 @@ export interface ApiStatic {
2128
2128
  new (selector: string | Node | Node[] | JQuery | InternalSettings): Api<any>;
2129
2129
 
2130
2130
  register<T=any>(name: string, fn: Function): T;
2131
- registerPlural<T=any>(name: string, fn: Function): T;
2131
+ registerPlural<T=any>(pluralName: string, singleName: string, fn: Function): T;
2132
2132
  }
2133
2133
 
2134
2134
  export interface OrderFixed {