datatables.net 1.13.1 → 1.13.3

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,5 +1,5 @@
1
- /*! DataTables 1.13.1
2
- * ©2008-2022 SpryMedia Ltd - datatables.net/license
1
+ /*! DataTables 1.13.3
2
+ * ©2008-2023 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  import jQuery from 'jquery';
@@ -1320,7 +1320,12 @@ var _numToDecimal = function ( num, decimalPoint ) {
1320
1320
 
1321
1321
 
1322
1322
  var _isNumber = function ( d, decimalPoint, formatted ) {
1323
- var strType = typeof d === 'string';
1323
+ let type = typeof d;
1324
+ var strType = type === 'string';
1325
+
1326
+ if ( type === 'number' || type === 'bigint') {
1327
+ return true;
1328
+ }
1324
1329
 
1325
1330
  // If empty return immediately so there must be a number if it is a
1326
1331
  // formatted string (this stops the string "k", or "kr", etc being detected
@@ -5052,7 +5057,8 @@ function _fnFeatureHtmlProcessing ( settings )
5052
5057
  {
5053
5058
  return $('<div/>', {
5054
5059
  'id': ! settings.aanFeatures.r ? settings.sTableId+'_processing' : null,
5055
- 'class': settings.oClasses.sProcessing
5060
+ 'class': settings.oClasses.sProcessing,
5061
+ 'role': 'status'
5056
5062
  } )
5057
5063
  .html( settings.oLanguage.sProcessing )
5058
5064
  .append('<div><div></div><div></div><div></div><div></div></div>')
@@ -6727,8 +6733,15 @@ function _fnCallbackFire( settings, callbackArr, eventName, args )
6727
6733
 
6728
6734
  if ( eventName !== null ) {
6729
6735
  var e = $.Event( eventName+'.dt' );
6736
+ var table = $(settings.nTable);
6730
6737
 
6731
- $(settings.nTable).trigger( e, args );
6738
+ table.trigger( e, args );
6739
+
6740
+ // If not yet attached to the document, trigger the event
6741
+ // on the body directly to sort of simulate the bubble
6742
+ if (table.parents('body').length === 0) {
6743
+ $('body').trigger( e, args );
6744
+ }
6732
6745
 
6733
6746
  ret.push( e.result );
6734
6747
  }
@@ -7194,7 +7207,7 @@ $.extend( _Api.prototype, {
7194
7207
 
7195
7208
  pluck: function ( prop )
7196
7209
  {
7197
- let fn = DataTable.util.get(prop);
7210
+ var fn = DataTable.util.get(prop);
7198
7211
 
7199
7212
  return this.map( function ( el ) {
7200
7213
  return fn(el);
@@ -8291,10 +8304,9 @@ _api_register( 'row.add()', function ( row ) {
8291
8304
 
8292
8305
  $(document).on('plugin-init.dt', function (e, context) {
8293
8306
  var api = new _Api( context );
8294
-
8295
- const namespace = 'on-plugin-init';
8296
- const stateSaveParamsEvent = `stateSaveParams.${namespace}`;
8297
- const destroyEvent = `destroy.${namespace}`;
8307
+ var namespace = 'on-plugin-init';
8308
+ var stateSaveParamsEvent = 'stateSaveParams.' + namespace;
8309
+ var destroyEvent = 'destroy. ' + namespace;
8298
8310
 
8299
8311
  api.on( stateSaveParamsEvent, function ( e, settings, d ) {
8300
8312
  // This could be more compact with the API, but it is a lot faster as a simple
@@ -8313,7 +8325,7 @@ $(document).on('plugin-init.dt', function (e, context) {
8313
8325
  });
8314
8326
 
8315
8327
  api.on( destroyEvent, function () {
8316
- api.off(`${stateSaveParamsEvent} ${destroyEvent}`);
8328
+ api.off(stateSaveParamsEvent + ' ' + destroyEvent);
8317
8329
  });
8318
8330
 
8319
8331
  var loaded = api.state.loaded();
@@ -9635,7 +9647,7 @@ _api_register( 'i18n()', function ( token, def, plural ) {
9635
9647
  * @type string
9636
9648
  * @default Version number
9637
9649
  */
9638
- DataTable.version = "1.13.1";
9650
+ DataTable.version = "1.13.3";
9639
9651
 
9640
9652
  /**
9641
9653
  * Private data store, containing all of the settings objects that are
@@ -14768,10 +14780,17 @@ $.extend( true, DataTable.ext.renderer, {
14768
14780
  }
14769
14781
 
14770
14782
  if ( btnDisplay !== null ) {
14771
- node = $('<a>', {
14783
+ var tag = settings.oInit.pagingTag || 'a';
14784
+ var disabled = btnClass.indexOf(disabledClass) !== -1;
14785
+
14786
+
14787
+ node = $('<'+tag+'>', {
14772
14788
  'class': classes.sPageButton+' '+btnClass,
14773
14789
  'aria-controls': settings.sTableId,
14790
+ 'aria-disabled': disabled ? 'true' : null,
14774
14791
  'aria-label': aria[ button ],
14792
+ 'aria-role': 'link',
14793
+ 'aria-current': btnClass === classes.sPageButtonActive ? 'page' : null,
14775
14794
  'data-dt-idx': button,
14776
14795
  'tabindex': tabIndex,
14777
14796
  'id': idx === 0 && typeof button === 'string' ?
@@ -14903,6 +14922,12 @@ var __numericReplace = function ( d, decimalPlace, re1, re2 ) {
14903
14922
  if ( d !== 0 && (!d || d === '-') ) {
14904
14923
  return -Infinity;
14905
14924
  }
14925
+
14926
+ let type = typeof d;
14927
+
14928
+ if (type === 'number' || type === 'bigint') {
14929
+ return d;
14930
+ }
14906
14931
 
14907
14932
  // If a decimal place other than `.` is used, it needs to be given to the
14908
14933
  // function so we can detect it and replace with a `.` which is the only
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.1",
7
+ "version": "1.13.3",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",
package/types/types.d.ts CHANGED
@@ -69,7 +69,7 @@ export type CellIdxWithVisible = {
69
69
  /**
70
70
  * DataTables class
71
71
  */
72
- declare interface DataTables<T> extends ApiStatic {
72
+ declare interface DataTables<T> extends DataTablesStatic {
73
73
  /**
74
74
  * Create a new DataTable
75
75
  * @param selector Selector to pick one or more `<table>` elements
@@ -521,12 +521,16 @@ export interface ConfigColumns {
521
521
  width?: string;
522
522
  }
523
523
 
524
- export interface ConfigColumnDefs extends ConfigColumns {
524
+ export type ConfigColumnDefs = ConfigColumnDefsMultiple | ConfigColumnDefsSingle;
525
+
526
+ export interface ConfigColumnDefsMultiple extends ConfigColumns {
525
527
  /**
526
528
  * Target column(s). Either this or `target` must be specified.
527
529
  */
528
- targets?: string | number | Array<(number | string)>;
530
+ targets: string | number | Array<(number | string)>;
531
+ }
529
532
 
533
+ export interface ConfigColumnDefsSingle extends ConfigColumns {
530
534
  /**
531
535
  * Single column target. Either this or `targets` must be specified. Since: 1.12
532
536
  */
@@ -569,7 +573,10 @@ export interface ConfigSearch {
569
573
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
570
574
  * API
571
575
  */
576
+
572
577
  export interface Api<T> {
578
+ new(context: any, data: any[]);
579
+
573
580
  /**
574
581
  * API should be array-like
575
582
  */
@@ -951,7 +958,7 @@ export interface Api<T> {
951
958
  * @param tableSelector Table selector.
952
959
  * @returns DataTables API instance with selected table in its context.
953
960
  */
954
- table(tableSelector: any): ApiTableMethods<T> | Api<Array<any>>;
961
+ table(tableSelector?: any): ApiTableMethods<T>;
955
962
 
956
963
  /**
957
964
  * Select tables based on the given selector
@@ -959,7 +966,7 @@ export interface Api<T> {
959
966
  * @param tableSelector Table selector.
960
967
  * @returns DataTables API instance with all tables in the current context.
961
968
  */
962
- tables(tableSelector?: any): ApiTablesMethods<T> | Api<Array<any>>;
969
+ tables(tableSelector?: any): ApiTablesMethods<T>;
963
970
 
964
971
  /**
965
972
  * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set.
@@ -2030,7 +2037,7 @@ export interface ApiTablesMethods<T> extends Api<T> {
2030
2037
 
2031
2038
 
2032
2039
 
2033
- export interface ApiStatic {
2040
+ export interface DataTablesStatic {
2034
2041
  /**
2035
2042
  * Check if a table node is a DataTable already or not.
2036
2043
  *
@@ -2047,7 +2054,7 @@ export interface ApiStatic {
2047
2054
  * The options defined here can be used with the `columns.render` initialisation
2048
2055
  * option to provide a display renderer.
2049
2056
  */
2050
- render: ApiStaticRender;
2057
+ render: DataTablesStaticRender;
2051
2058
 
2052
2059
  /**
2053
2060
  * Get all DataTable tables that have been initialised - optionally you can select to get only currently visible tables and / or retrieve the tables as API instances.
@@ -2081,14 +2088,14 @@ export interface ApiStatic {
2081
2088
  /**
2082
2089
  * Utils
2083
2090
  */
2084
- util: ApiStaticUtil;
2091
+ util: DataTablesStaticUtil;
2085
2092
 
2086
2093
  /**
2087
2094
  * Get DataTable API instance
2088
2095
  *
2089
2096
  * @param table Selector string for table
2090
2097
  */
2091
- Api: new (selector: string | Node | Node[] | JQuery) => Api<any>;
2098
+ Api: ApiStatic;
2092
2099
 
2093
2100
  /**
2094
2101
  * Default Settings
@@ -2098,7 +2105,18 @@ export interface ApiStatic {
2098
2105
  /**
2099
2106
  * Default Settings
2100
2107
  */
2101
- ext: ApiStaticExt;
2108
+ ext: DataTablesStaticExt;
2109
+ }
2110
+
2111
+ export interface ApiStatic {
2112
+ /**
2113
+ * Create a new API instance to an existing DataTable. Note that this
2114
+ * does not create a new DataTable.
2115
+ */
2116
+ new (selector: string | Node | Node[] | JQuery): Api<any>;
2117
+
2118
+ register<T=any>(name: string, fn: Function): T;
2119
+ registerPlural<T=any>(name: string, fn: Function): T;
2102
2120
  }
2103
2121
 
2104
2122
  export interface OrderFixed {
@@ -2117,7 +2135,7 @@ export interface OrderFixed {
2117
2135
  post?: any[];
2118
2136
  }
2119
2137
 
2120
- export interface ApiStaticRender {
2138
+ export interface DataTablesStaticRender {
2121
2139
  /**
2122
2140
  * Format an ISO8061 date in auto locale detected format
2123
2141
  */
@@ -2206,7 +2224,7 @@ export interface ApiStaticRender {
2206
2224
  time(from?: string, to?: string, locale?: string, def?: string): ObjectColumnRender;
2207
2225
  }
2208
2226
 
2209
- export interface ApiStaticUtil {
2227
+ export interface DataTablesStaticUtil {
2210
2228
  /**
2211
2229
  * Escape special characters in a regular expression string. Since: 1.10.4
2212
2230
  *
@@ -2314,8 +2332,9 @@ interface CellMetaSettings {
2314
2332
  settings: InternalSettings;
2315
2333
  }
2316
2334
 
2317
- export interface ApiStaticExt {
2335
+ export interface DataTablesStaticExt {
2318
2336
  builder: string;
2337
+ buttons: {[key: string]: object};
2319
2338
  classes: ExtClassesSettings;
2320
2339
  errMode: string;
2321
2340
  feature: any[];
@@ -2324,6 +2343,7 @@ export interface ApiStaticExt {
2324
2343
  legacy: object;
2325
2344
  oApi: object;
2326
2345
  order: object;
2346
+ oSort: object;
2327
2347
  pager: object;
2328
2348
  renderer: object;
2329
2349
  search: any[];