datatables.net 1.13.2 → 1.13.4

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,16 +1,22 @@
1
- /*! DataTables 1.13.2
1
+ /*! DataTables 1.13.4
2
2
  * ©2008-2023 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  import jQuery from 'jquery';
6
6
 
7
7
  // DataTables code uses $ internally, but we want to be able to
8
- // reassign $ with the `use` method below, so it is a regular var.
8
+ // reassign $ with the `use` method, so it is a regular var.
9
9
  let $ = jQuery;
10
10
 
11
11
 
12
12
  var DataTable = function ( selector, options )
13
13
  {
14
+ // Check if called with a window or jQuery object for DOM less applications
15
+ // This is for backwards compatibility
16
+ if (DataTable.factory(selector, options)) {
17
+ return DataTable;
18
+ }
19
+
14
20
  // When creating with `new`, create a new DataTable, returning the API instance
15
21
  if (this instanceof DataTable) {
16
22
  return $(selector).DataTable(options);
@@ -1115,6 +1121,7 @@ var DataTable = function ( selector, options )
1115
1121
  type: sort !== null ? i+'.@data-'+sort : undefined,
1116
1122
  filter: filter !== null ? i+'.@data-'+filter : undefined
1117
1123
  };
1124
+ col._isArrayHost = true;
1118
1125
 
1119
1126
  _fnColumnOptions( oSettings, i );
1120
1127
  }
@@ -2303,7 +2310,7 @@ function _fnColumnOptions( oSettings, iCol, oOptions )
2303
2310
 
2304
2311
  // Indicate if DataTables should read DOM data as an object or array
2305
2312
  // Used in _fnGetRowElements
2306
- if ( typeof mDataSrc !== 'number' ) {
2313
+ if ( typeof mDataSrc !== 'number' && ! oCol._isArrayHost ) {
2307
2314
  oSettings._rowReadObject = true;
2308
2315
  }
2309
2316
 
@@ -5057,7 +5064,8 @@ function _fnFeatureHtmlProcessing ( settings )
5057
5064
  {
5058
5065
  return $('<div/>', {
5059
5066
  'id': ! settings.aanFeatures.r ? settings.sTableId+'_processing' : null,
5060
- 'class': settings.oClasses.sProcessing
5067
+ 'class': settings.oClasses.sProcessing,
5068
+ 'role': 'status'
5061
5069
  } )
5062
5070
  .html( settings.oLanguage.sProcessing )
5063
5071
  .append('<div><div></div><div></div><div></div><div></div></div>')
@@ -9305,6 +9313,48 @@ _api_register( 'state.save()', function () {
9305
9313
 
9306
9314
 
9307
9315
 
9316
+ /**
9317
+ * Set the jQuery or window object to be used by DataTables
9318
+ *
9319
+ * @param {*} module Library / container object
9320
+ * @param {string} type Library or container type `lib` or `win`.
9321
+ */
9322
+ DataTable.use = function (module, type) {
9323
+ if (type === 'lib' || module.fn) {
9324
+ $ = module;
9325
+ }
9326
+ else if (type == 'win' || module.document) {
9327
+ window = module;
9328
+ document = module.document;
9329
+ }
9330
+ }
9331
+
9332
+ /**
9333
+ * CommonJS factory function pass through. This will check if the arguments
9334
+ * given are a window object or a jQuery object. If so they are set
9335
+ * accordingly.
9336
+ * @param {*} root Window
9337
+ * @param {*} jq jQUery
9338
+ * @returns {boolean} Indicator
9339
+ */
9340
+ DataTable.factory = function (root, jq) {
9341
+ var is = false;
9342
+
9343
+ // Test if the first parameter is a window object
9344
+ if (root && root.document) {
9345
+ window = root;
9346
+ document = root.document;
9347
+ }
9348
+
9349
+ // Test if the second parameter is a jQuery object
9350
+ if (jq && jq.fn && jq.fn.jquery) {
9351
+ $ = jq;
9352
+ is = true;
9353
+ }
9354
+
9355
+ return is;
9356
+ }
9357
+
9308
9358
  /**
9309
9359
  * Provide a common method for plug-ins to check the version of DataTables being
9310
9360
  * used, in order to ensure compatibility.
@@ -9646,7 +9696,7 @@ _api_register( 'i18n()', function ( token, def, plural ) {
9646
9696
  * @type string
9647
9697
  * @default Version number
9648
9698
  */
9649
- DataTable.version = "1.13.2";
9699
+ DataTable.version = "1.13.4";
9650
9700
 
9651
9701
  /**
9652
9702
  * Private data store, containing all of the settings objects that are
@@ -15575,13 +15625,4 @@ $.each( DataTable, function ( prop, val ) {
15575
15625
  $.fn.DataTable[ prop ] = val;
15576
15626
  } );
15577
15627
 
15578
- DataTable.use = function (module, type) {
15579
- if (type === 'lib' || module.fn) {
15580
- $ = module;
15581
- }
15582
- else if (type == 'win' || module.document) {
15583
- window = module;
15584
- }
15585
- }
15586
-
15587
15628
  export default DataTable;
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.2",
7
+ "version": "1.13.4",
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
@@ -79,6 +79,12 @@ declare interface DataTables<T> extends ApiStatic {
79
79
  selector: InstSelector,
80
80
  opts?: Config
81
81
  ): Api<T>
82
+
83
+ /**
84
+ * CommonJS factory. This only applies to CommonJS environments,
85
+ * in all others it would throw an error.
86
+ */
87
+ (win?: Window, jQuery?: JQuery): DataTables<T>;
82
88
  }
83
89
 
84
90
  declare const DataTables: DataTables<any>;
@@ -97,12 +103,20 @@ interface JQueryDataTables extends JQuery {
97
103
 
98
104
  // Extend the jQuery object with DataTables' construction methods
99
105
  declare global {
106
+ interface JQueryDataTableApi extends DataTablesStatic {
107
+ <T = any>(opts?: Config): Api<T>;
108
+ }
109
+
110
+ interface JQueryDataTableJq extends DataTablesStatic {
111
+ (opts?: Config): JQueryDataTables;
112
+ }
113
+
100
114
  interface JQuery {
101
115
  /**
102
116
  * Create a new DataTable, returning a DataTables API instance.
103
117
  * @param opts Configuration settings
104
118
  */
105
- DataTable<T = any>(opts?: Config): Api<T>;
119
+ DataTable: JQueryDataTableApi;
106
120
 
107
121
  /**
108
122
  * Create a new DataTable, returning a jQuery object, extended
@@ -110,7 +124,7 @@ declare global {
110
124
  * DataTables API.
111
125
  * @param opts Configuration settings
112
126
  */
113
- dataTable(opts?: Config): JQueryDataTables;
127
+ dataTable: JQueryDataTableJq;
114
128
  }
115
129
  }
116
130
 
@@ -573,6 +587,7 @@ export interface ConfigSearch {
573
587
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
574
588
  * API
575
589
  */
590
+
576
591
  export interface Api<T> {
577
592
  /**
578
593
  * API should be array-like
@@ -955,7 +970,7 @@ export interface Api<T> {
955
970
  * @param tableSelector Table selector.
956
971
  * @returns DataTables API instance with selected table in its context.
957
972
  */
958
- table(tableSelector: any): ApiTableMethods<T> | Api<Array<any>>;
973
+ table(tableSelector?: any): ApiTableMethods<T>;
959
974
 
960
975
  /**
961
976
  * Select tables based on the given selector
@@ -963,7 +978,7 @@ export interface Api<T> {
963
978
  * @param tableSelector Table selector.
964
979
  * @returns DataTables API instance with all tables in the current context.
965
980
  */
966
- tables(tableSelector?: any): ApiTablesMethods<T> | Api<Array<any>>;
981
+ tables(tableSelector?: any): ApiTablesMethods<T>;
967
982
 
968
983
  /**
969
984
  * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set.
@@ -2034,7 +2049,7 @@ export interface ApiTablesMethods<T> extends Api<T> {
2034
2049
 
2035
2050
 
2036
2051
 
2037
- export interface ApiStatic {
2052
+ export interface DataTablesStatic {
2038
2053
  /**
2039
2054
  * Check if a table node is a DataTable already or not.
2040
2055
  *
@@ -2051,7 +2066,7 @@ export interface ApiStatic {
2051
2066
  * The options defined here can be used with the `columns.render` initialisation
2052
2067
  * option to provide a display renderer.
2053
2068
  */
2054
- render: ApiStaticRender;
2069
+ render: DataTablesStaticRender;
2055
2070
 
2056
2071
  /**
2057
2072
  * 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.
@@ -2085,14 +2100,14 @@ export interface ApiStatic {
2085
2100
  /**
2086
2101
  * Utils
2087
2102
  */
2088
- util: ApiStaticUtil;
2103
+ util: DataTablesStaticUtil;
2089
2104
 
2090
2105
  /**
2091
2106
  * Get DataTable API instance
2092
2107
  *
2093
2108
  * @param table Selector string for table
2094
2109
  */
2095
- Api: new (selector: string | Node | Node[] | JQuery) => Api<any>;
2110
+ Api: ApiStatic;
2096
2111
 
2097
2112
  /**
2098
2113
  * Default Settings
@@ -2102,7 +2117,18 @@ export interface ApiStatic {
2102
2117
  /**
2103
2118
  * Default Settings
2104
2119
  */
2105
- ext: ApiStaticExt;
2120
+ ext: DataTablesStaticExt;
2121
+ }
2122
+
2123
+ export interface ApiStatic {
2124
+ /**
2125
+ * Create a new API instance to an existing DataTable. Note that this
2126
+ * does not create a new DataTable.
2127
+ */
2128
+ new (selector: string | Node | Node[] | JQuery | InternalSettings): Api<any>;
2129
+
2130
+ register<T=any>(name: string, fn: Function): T;
2131
+ registerPlural<T=any>(name: string, fn: Function): T;
2106
2132
  }
2107
2133
 
2108
2134
  export interface OrderFixed {
@@ -2121,7 +2147,7 @@ export interface OrderFixed {
2121
2147
  post?: any[];
2122
2148
  }
2123
2149
 
2124
- export interface ApiStaticRender {
2150
+ export interface DataTablesStaticRender {
2125
2151
  /**
2126
2152
  * Format an ISO8061 date in auto locale detected format
2127
2153
  */
@@ -2210,7 +2236,7 @@ export interface ApiStaticRender {
2210
2236
  time(from?: string, to?: string, locale?: string, def?: string): ObjectColumnRender;
2211
2237
  }
2212
2238
 
2213
- export interface ApiStaticUtil {
2239
+ export interface DataTablesStaticUtil {
2214
2240
  /**
2215
2241
  * Escape special characters in a regular expression string. Since: 1.10.4
2216
2242
  *
@@ -2318,8 +2344,9 @@ interface CellMetaSettings {
2318
2344
  settings: InternalSettings;
2319
2345
  }
2320
2346
 
2321
- export interface ApiStaticExt {
2347
+ export interface DataTablesStaticExt {
2322
2348
  builder: string;
2349
+ buttons: {[key: string]: object};
2323
2350
  classes: ExtClassesSettings;
2324
2351
  errMode: string;
2325
2352
  feature: any[];