datatables.net 2.0.7 → 2.1.0

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.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "js/dataTables.js",
5
5
  "module": "js/dataTables.mjs",
6
6
  "types": "./types/types.d.ts",
7
- "version": "2.0.7",
7
+ "version": "2.1.0",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",
package/types/types.d.ts CHANGED
@@ -117,7 +117,7 @@ export type Order = OrderCombined | OrderCombined[];
117
117
 
118
118
  export interface DataType {
119
119
  className?: string;
120
- detect?: ((data: any) => string);
120
+ detect?: ExtTypeSettingsDetect;
121
121
  order?: {
122
122
  pre?: ((a: any, b: any) => number);
123
123
  asc?: ((a: any, b: any) => number);
@@ -128,6 +128,21 @@ export interface DataType {
128
128
  }
129
129
 
130
130
  export interface Feature {
131
+ /** A simple `<div>` that can contain your own content */
132
+ div?: {
133
+ /** Class name for the div */
134
+ className?: string;
135
+
136
+ /** Id to give the div */
137
+ id?: string;
138
+
139
+ /** HTML content for the div (cannot be used as well as textContent) */
140
+ html?: string;
141
+
142
+ /** Text content for the div (cannot be used as well as innerHTML) */
143
+ text?: string;
144
+ }
145
+
131
146
  /** Table information display */
132
147
  info?: {
133
148
  /** Information display callback */
@@ -163,11 +178,14 @@ export interface Feature {
163
178
  /** Paging button display options */
164
179
  type?: 'numbers' | 'simple' | 'simple_numbers' | 'full' | 'full_numbers' | 'first_last_numbers';
165
180
 
166
- /**
167
- * Set the maximum number of paging number buttons
168
- * @deprecated Use `buttons` instead.
169
- */
170
- numbers?: number;
181
+ /** Display the buttons in the pager (default true) */
182
+ numbers?: boolean;
183
+
184
+ /** Display the first and last buttons in the pager (default true) */
185
+ firstLast?: boolean;
186
+
187
+ /** Display the previous and next buttons in the pager (default true) */
188
+ previousNext?: boolean;
171
189
 
172
190
  /** Include the extreme page numbers, if separated by ellipsis, or not */
173
191
  boundaryNumbers?: boolean;
@@ -178,12 +196,15 @@ export interface Feature {
178
196
  /** Placeholder for the input element */
179
197
  placeholder?: string;
180
198
 
199
+ /** Show the processing icon when searching */
200
+ processing?: boolean;
201
+
181
202
  /** Text for search control */
182
203
  text?: string;
183
204
  }
184
205
  }
185
206
 
186
- type LayoutNumber = '' | '1' | '2' | '3' | '4' | '5';
207
+ type LayoutNumber = '' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
187
208
 
188
209
  type LayoutSide = 'top' | 'bottom';
189
210
 
@@ -191,7 +212,26 @@ type LayoutEdge = 'Start' | 'End';
191
212
 
192
213
  type LayoutKeys = `${LayoutSide}${LayoutNumber}${LayoutEdge}` | `${LayoutSide}${LayoutNumber}`;
193
214
 
194
- type Layout = Partial<Record<LayoutKeys, keyof Feature | Feature | Array<keyof Feature> | Feature[] | null>>;
215
+ type LayoutFeatures = keyof Feature | Feature | Array<keyof Feature> | Feature[];
216
+
217
+ type LayoutElement = {
218
+ /** Class to apply to the CELL in the layout grid */
219
+ className?: string;
220
+
221
+ /** Id to apply to the CELL in the layout grid */
222
+ id?: string;
223
+
224
+ /** Class to apply to the ROW in the layout grid */
225
+ rowClass?: string;
226
+
227
+ /** Id to apply to the ROW in the layout grid */
228
+ rowId?: string;
229
+
230
+ /** List of features to show in this cell */
231
+ features: LayoutFeatures;
232
+ }
233
+
234
+ type Layout = Partial<Record<LayoutKeys, LayoutElement | LayoutFeatures | null>>;
195
235
 
196
236
 
197
237
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -358,6 +398,11 @@ export interface Config {
358
398
  */
359
399
  orderClasses?: boolean;
360
400
 
401
+ /**
402
+ * Reverse the initial data order when `desc` ordering
403
+ */
404
+ orderDescReverse?: boolean;
405
+
361
406
  /**
362
407
  * Initial order (sort) to apply to the table.
363
408
  */
@@ -2659,19 +2704,78 @@ export interface DataTablesStatic {
2659
2704
  type(name: string, definition: DataType): void;
2660
2705
 
2661
2706
  /**
2662
- * Set an individual property value for a a given data type.
2707
+ * Set a class name for a given data type
2708
+ *
2709
+ * @param name Data type name to set a property value for
2710
+ * @param property Name of the data type property to set
2711
+ * @param val Class name to set
2712
+ */
2713
+ type(name: string, property: 'className', val: DataType['className']): void;
2714
+
2715
+ /**
2716
+ * Set the detection function(s) for a given data type
2717
+ *
2718
+ * @param name Data type name to set a property value for
2719
+ * @param property Name of the data type property to set
2720
+ * @param val Detection function / object to set
2721
+ */
2722
+ type(name: string, property: 'detect', val: DataType['detect']): void;
2723
+
2724
+ /**
2725
+ * Set the order functions for a given data type
2726
+ *
2727
+ * @param name Data type name to set a property value for
2728
+ * @param property Name of the data type property to set
2729
+ * @param val Object of functions to set
2730
+ */
2731
+ type(name: string, property: 'order', val: DataType['order']): void;
2732
+
2733
+ /**
2734
+ * Set a rendering function for a given data type
2735
+ *
2736
+ * @param name Data type name to set a property value for
2737
+ * @param property Name of the data type property to set
2738
+ * @param val Rendering function
2739
+ */
2740
+ type(name: string, property: 'render', val: DataType['render']): void;
2741
+
2742
+ /**
2743
+ * Set a search data renderer for a given data type
2663
2744
  *
2664
2745
  * @param name Data type name to set a property value for
2665
2746
  * @param property Name of the data type property to set
2666
- * @param val The value to set (typically a function or string)
2747
+ * @param val Function to set
2667
2748
  */
2668
- type(name: string, property: keyof(DataType), val: any): void;
2749
+ type(name: string, property: 'search', val: DataType['search']): void;
2750
+
2669
2751
 
2670
2752
  /**
2671
2753
  * Get the names of the registered data types DataTables can work with.
2672
2754
  */
2673
2755
  types(): string[];
2674
2756
 
2757
+ /**
2758
+ * Get the libraries that DataTables uses, or the global objects.
2759
+ *
2760
+ * @param type The library needed
2761
+ */
2762
+ use(type: 'lib' | 'win' | 'datetime' | 'luxon' | 'moment');
2763
+
2764
+ /**
2765
+ * Set the libraries that DataTables uses, or the global objects, with automatic
2766
+ * detection of what the library is. Used for module loading environments.
2767
+ */
2768
+ use(library: any);
2769
+
2770
+ /**
2771
+ * Set the libraries that DataTables uses, or the global objects, explicity staing
2772
+ * what library is to be considered. Used for module loading environments.
2773
+ *
2774
+ * @param type Indicate the library that is being loaded.
2775
+ * @param library The library (e.g. Moment or Luxon)
2776
+ */
2777
+ use(type: 'lib' | 'win' | 'datetime' | 'luxon' | 'moment', library: any);
2778
+
2675
2779
  /**
2676
2780
  * Utils
2677
2781
  */
@@ -3028,6 +3132,17 @@ export interface DataTablesStaticExtButtons {
3028
3132
  container: string;
3029
3133
  };
3030
3134
 
3135
+ /** Layout grid classes */
3136
+ layout: {
3137
+ row: string;
3138
+ cell: string;
3139
+ tableRow: string;
3140
+ tableCell: string;
3141
+ start: string;
3142
+ end: string;
3143
+ full: string;
3144
+ },
3145
+
3031
3146
  /** Length feature classes */
3032
3147
  length: {
3033
3148
  /** Container `<div>` class */
@@ -3153,7 +3268,7 @@ export interface ExtTypeSettings {
3153
3268
  *
3154
3269
  * @see https://datatables.net/manual/plug-ins/type-detection
3155
3270
  */
3156
- detect: FunctionExtTypeSettingsDetect[];
3271
+ detect: ExtTypeSettingsDetect[];
3157
3272
 
3158
3273
  /**
3159
3274
  * Type based ordering functions for plug-in development.
@@ -3179,7 +3294,25 @@ export interface ExtTypeSettings {
3179
3294
  * @param data Data from the column cell to be analysed.
3180
3295
  * @param DataTables settings object.
3181
3296
  */
3182
- type FunctionExtTypeSettingsDetect = (data: any, settings: InternalSettings) => (string | null);
3297
+ export type ExtTypeSettingsDetect = ((data: any, settings: InternalSettings) => (boolean | string | null)) | {
3298
+ /**
3299
+ * All data points in the column must pass this function to allow a column
3300
+ * to take this data type.
3301
+ */
3302
+ allOf: (data: any, settings: InternalSettings) => boolean,
3303
+
3304
+ /**
3305
+ * At least one of the data points in the column must pass this function to
3306
+ * allow the column to take this data type.
3307
+ */
3308
+ oneOf: (data: any, settings: InternalSettings) => boolean,
3309
+
3310
+ /**
3311
+ * Run when type detection starts, to see if a column can be assigned a data type
3312
+ * based on a property of the column other than the data.
3313
+ */
3314
+ init?: (settings: InternalSettings, column: any, index: number) => boolean
3315
+ };
3183
3316
 
3184
3317
  type FunctionAjax = (data: object, callback: ((data: any) => void), settings: InternalSettings) => void;
3185
3318