datatables.net 3.0.0-beta.2 → 3.0.1

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": "3.0.0-beta.2",
7
+ "version": "3.0.1",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",
@@ -26,5 +26,6 @@
26
26
  "repository": {
27
27
  "type": "git",
28
28
  "url": "git+https://github.com/DataTables/DataTablesSrc.git"
29
- }
29
+ },
30
+ "dependencies": null
30
31
  }
package/types/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! DataTables
1
+ /*! DataTables 3.0.1
2
2
  * Copyright (c) SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -91,7 +91,7 @@ declare class Dom<T extends HTMLElement = HTMLElement> implements ArrayLike<T> {
91
91
  /**
92
92
  * Add an element (or multiple) to the instance. Will ensure uniqueness.
93
93
  *
94
- * @param el Element(s) to add
94
+ * @param selector Element(s) to add
95
95
  * @param sort Indicate if the element should be added in document order.
96
96
  * @returns Self for chaining
97
97
  */
@@ -330,7 +330,7 @@ declare class Dom<T extends HTMLElement = HTMLElement> implements ArrayLike<T> {
330
330
  /**
331
331
  * Get all matching descendants
332
332
  *
333
- * @param selector Elements to find
333
+ * @param input Elements to find
334
334
  * @returns A new Dom instance with all matching elements
335
335
  */
336
336
  find<R extends HTMLElement = T>(input: Dom | string | HTMLElement | Element | null): Dom<R>;
@@ -1222,9 +1222,9 @@ type LayoutElement = {
1222
1222
  };
1223
1223
  type LayoutComponent = LayoutElement | LayoutFeatures | (() => HTMLElement) | HTMLElement | JQuery<HTMLElement> | Dom | null;
1224
1224
  type Layout = Partial<Record<LayoutKeys, LayoutComponent>>;
1225
- type FunctionColumnRender = (this: DataTableDom, data: any, type: any, row: any, meta: CellMetaSettings) => any;
1225
+ type ColumnRenderFunction = (this: DataTableDom, data: any, type: any, row: any, meta: CellMeta) => any;
1226
1226
  type FunctionColumnCreatedCell = (this: DataTableDom, cell: HTMLTableCellElement, cellData: any, rowData: any, row: number, col: number) => void;
1227
- interface CellMetaSettings {
1227
+ interface CellMeta {
1228
1228
  row: number;
1229
1229
  col: number;
1230
1230
  settings: Context;
@@ -1248,8 +1248,8 @@ interface OrderFixed {
1248
1248
  post?: any[];
1249
1249
  }
1250
1250
  interface FunctionColumnData {
1251
- (row: any, type: 'set', s: any, meta: CellMetaSettings): void;
1252
- (row: any, type: 'display' | 'sort' | 'filter' | 'type', s: undefined, meta: CellMetaSettings): any;
1251
+ (row: any, type: 'set', s: any, meta: CellMeta): void;
1252
+ (row: any, type: 'display' | 'sort' | 'filter' | 'type', s: undefined, meta: CellMeta): any;
1253
1253
  }
1254
1254
  interface ObjectColumnData {
1255
1255
  _: string | number | FunctionColumnData;
@@ -1259,11 +1259,11 @@ interface ObjectColumnData {
1259
1259
  sort?: string | number | FunctionColumnData;
1260
1260
  }
1261
1261
  interface ObjectColumnRender {
1262
- _?: string | number | FunctionColumnRender;
1263
- filter?: string | number | FunctionColumnRender;
1264
- display?: string | number | FunctionColumnRender;
1265
- type?: string | number | FunctionColumnRender;
1266
- sort?: string | number | FunctionColumnRender;
1262
+ _?: string | number | ColumnRenderFunction;
1263
+ filter?: string | number | ColumnRenderFunction;
1264
+ display?: string | number | ColumnRenderFunction;
1265
+ type?: string | number | ColumnRenderFunction;
1266
+ sort?: string | number | ColumnRenderFunction;
1267
1267
  }
1268
1268
  interface AjaxData {
1269
1269
  draw?: number;
@@ -1411,7 +1411,7 @@ interface Defaults$1 {
1411
1411
  /**
1412
1412
  * Render (process) the data for use in the table.
1413
1413
  */
1414
- render: number | string | ObjectColumnData | FunctionColumnRender | ObjectColumnRender | null;
1414
+ render: number | string | ObjectColumnData | ColumnRenderFunction | ObjectColumnRender | null;
1415
1415
  search: SearchOptions | null;
1416
1416
  /**
1417
1417
  * Enable or disable filtering on the data in this column.
@@ -1728,6 +1728,8 @@ interface Defaults {
1728
1728
  tabIndex: number;
1729
1729
  /** Specify which row is the title row in the header. */
1730
1730
  titleRow: null | number | boolean;
1731
+ /** Ability to enable / disable auto type detection. */
1732
+ typeDetect: boolean;
1731
1733
  }
1732
1734
  type LanguageOption = string | {
1733
1735
  [key: string | number]: LanguageOption;
@@ -2354,6 +2356,7 @@ type RegisterCallback<T> = (settings: Context, options: T) => HTMLElement | Dom
2354
2356
  * @param name The name of the new feature.
2355
2357
  * @param cb A function that will create the elements and event listeners for
2356
2358
  * the feature being added.
2359
+ * @param legacyChar
2357
2360
  */
2358
2361
  declare function register$1<T>(name: string, cb: RegisterCallback<T>, legacyChar?: string): void;
2359
2362
 
@@ -2638,6 +2641,7 @@ declare function pluck(a: any[], prop: string | number, prop2?: string | number)
2638
2641
  * as the indexes to pick from the source array
2639
2642
  *
2640
2643
  * @param a Array to get values from
2644
+ * @param order Indexes to pick
2641
2645
  * @param prop Property to read values from
2642
2646
  * @param prop2 Inner property to get values from if a 2D array
2643
2647
  * @returns Array of read values
@@ -2952,7 +2956,7 @@ declare function escapeHtml<T>(mixed: T): T;
2952
2956
  /**
2953
2957
  * Set the function to use for HTML entity encoding from a string
2954
2958
  *
2955
- * @param fn HTML escape function
2959
+ * @param mixed HTML escape function
2956
2960
  */
2957
2961
  declare function escapeHtml<T = TEscapeHtml>(mixed: T): void;
2958
2962
  /**
@@ -2968,13 +2972,14 @@ declare function normalize(mixed: string, both?: boolean): string;
2968
2972
  /**
2969
2973
  * Set the function to use for string normalisation
2970
2974
  *
2971
- * @param mixed Normalisation function
2975
+ * @param fn Normalisation function
2972
2976
  */
2973
2977
  declare function normalize<T = TNormalize>(fn: T): void;
2974
2978
  /**
2975
2979
  * Strip HTML from a string, if a string is given, otherwise no action
2976
2980
  *
2977
2981
  * @param mixed Value to remove HTML from
2982
+ * @param replacement
2978
2983
  * @returns The stripped value (or original if not a string)
2979
2984
  */
2980
2985
  declare function stripHtml<T>(mixed: T, replacement?: string): T;
@@ -3002,7 +3007,7 @@ declare namespace string {
3002
3007
  * Debounce a function
3003
3008
  *
3004
3009
  * @param fn Function to be called
3005
- * @param timeout Call frequency in mS
3010
+ * @param freq Call frequency in mS
3006
3011
  * @returns Wrapped function
3007
3012
  */
3008
3013
  declare function debounce(fn: () => void, freq?: number): () => void;
@@ -3091,7 +3096,7 @@ declare const _default: {
3091
3096
  * @param jq jQuery
3092
3097
  * @returns Indicator
3093
3098
  */
3094
- declare function factory(root: Window & typeof globalThis, jq: JQueryStatic): boolean;
3099
+ declare function factory(root: Window & typeof globalThis, jq: any): boolean;
3095
3100
 
3096
3101
  type Unpacked<T> = T extends (infer U)[] ? U : T extends (...args: any[]) => infer U ? U : T extends Promise<infer U> ? U : T;
3097
3102
  type DomSelector = string | Node | HTMLElement | JQuery | Dom;
@@ -3117,6 +3122,9 @@ type HeaderStructure = {
3117
3122
  rowspan: number;
3118
3123
  title: string;
3119
3124
  };
3125
+ interface DataTableEvent<T = any> extends Event {
3126
+ dt: Api<T>;
3127
+ }
3120
3128
  interface ApiConstructor {
3121
3129
  new (content: InstSelector, data?: any): Api;
3122
3130
  (content: InstSelector, data?: any): Api;
@@ -3424,7 +3432,7 @@ interface ApiScopeable<T, S> {
3424
3432
  * unbind a single event listener.
3425
3433
  * @returns DataTables Api instance
3426
3434
  */
3427
- off(event: string, callback?: (this: HTMLElement, e: Event, ...args: any[]) => void): Api<T>;
3435
+ off(event: string, callback?: (this: HTMLElement, e: DataTableEvent, ...args: any[]) => void): Api<T>;
3428
3436
  /**
3429
3437
  * Remove event handlers from selected elements
3430
3438
  *
@@ -3434,7 +3442,7 @@ interface ApiScopeable<T, S> {
3434
3442
  * unbind a single event listener.
3435
3443
  * @returns DataTables Api instance
3436
3444
  */
3437
- off(event: string, selector: string, callback?: (this: HTMLElement, e: Event, ...args: any[]) => void): Api<T>;
3445
+ off(event: string, selector: string, callback?: (this: HTMLElement, e: DataTableEvent, ...args: any[]) => void): Api<T>;
3438
3446
  /**
3439
3447
  * Table events listener.
3440
3448
  *
@@ -3442,7 +3450,7 @@ interface ApiScopeable<T, S> {
3442
3450
  * @param callback Event handler.
3443
3451
  * @returns DataTables Api instance
3444
3452
  */
3445
- on(event: string, callback: (this: HTMLElement, e: Event, ...args: any[]) => void): Api<T>;
3453
+ on(event: string, callback: (this: HTMLElement, e: DataTableEvent, ...args: any[]) => void): Api<T>;
3446
3454
  /**
3447
3455
  * Listen for events from selected elements
3448
3456
  *
@@ -3451,7 +3459,7 @@ interface ApiScopeable<T, S> {
3451
3459
  * @param callback Event handler.
3452
3460
  * @returns DataTables Api instance
3453
3461
  */
3454
- on(event: string, selector: string, callback: (this: HTMLElement, e: Event, ...args: any[]) => void): Api<T>;
3462
+ on(event: string, selector: string, callback: (this: HTMLElement, e: DataTableEvent, ...args: any[]) => void): Api<T>;
3455
3463
  /**
3456
3464
  * Listen for a table event once and then remove the listener.
3457
3465
  *
@@ -3460,7 +3468,7 @@ interface ApiScopeable<T, S> {
3460
3468
  * Listen for events from tables and fire a callback when they occur
3461
3469
  * @returns DataTables Api instance
3462
3470
  */
3463
- one(event: string, callback: (this: HTMLElement, e: Event, ...args: any[]) => void): Api<T>;
3471
+ one(event: string, callback: (this: HTMLElement, e: DataTableEvent, ...args: any[]) => void): Api<T>;
3464
3472
  /**
3465
3473
  * Listen for events from a selected element and trigger only once then
3466
3474
  * remove the listener.
@@ -3470,7 +3478,7 @@ interface ApiScopeable<T, S> {
3470
3478
  * @param callback Event handler.
3471
3479
  * @returns DataTables Api instance
3472
3480
  */
3473
- one(event: string, selector: string, callback: (this: HTMLElement, e: Event, ...args: any[]) => void): Api<T>;
3481
+ one(event: string, selector: string, callback: (this: HTMLElement, e: DataTableEvent, ...args: any[]) => void): Api<T>;
3474
3482
  /**
3475
3483
  * Order Methods / object
3476
3484
  */
@@ -3506,6 +3514,7 @@ interface ApiScopeable<T, S> {
3506
3514
  * Add one or more items to the end of an API instance's result set.
3507
3515
  *
3508
3516
  * @param value_1 Item to add to the API instance's result set.
3517
+ * @param value_2 Additional items to add.
3509
3518
  * @returns The length of the modified API instance
3510
3519
  */
3511
3520
  push(value_1: any, ...value_2: any[]): number;
@@ -3521,7 +3530,7 @@ interface ApiScopeable<T, S> {
3521
3530
  */
3522
3531
  ready(this: S, fn: (this: Api<T>) => void): Api<T>;
3523
3532
  /**
3524
- * Apply a callback function against and accumulator and each element in the
3533
+ * Apply a callback function against an accumulator and each element in the
3525
3534
  * Api's result set (left-to-right).
3526
3535
  *
3527
3536
  * @param fn Callback function which is called for each item in the API
@@ -3606,6 +3615,7 @@ interface ApiScopeable<T, S> {
3606
3615
  * @param howMany Number of elements to remove from the result set.
3607
3616
  * @param value_1 Item to add to the result set at the index specified by
3608
3617
  * the first parameter.
3618
+ * @param value_2 Additional items to add.
3609
3619
  * @returns An array of the items which were removed. If no elements were
3610
3620
  * removed, an empty array is returned.
3611
3621
  */
@@ -3682,6 +3692,7 @@ interface ApiScopeable<T, S> {
3682
3692
  * Add one or more items to the start of an API instance's result set.
3683
3693
  *
3684
3694
  * @param value_1 Item to add to the API instance's result set.
3695
+ * @param value_2 Additional items to add.
3685
3696
  * @returns The length of the modified API instance
3686
3697
  */
3687
3698
  unshift(value_1: any, ...value_2: any[]): number;
@@ -3695,7 +3706,7 @@ interface ApiCaption {
3695
3706
  * Set the contents of the `-tag caption` element. If the table doesn't have
3696
3707
  * a `-tag caption` element, one will be created automatically.
3697
3708
  *
3698
- * @param string The value to show in the table's `caption` tag.
3709
+ * @param set The value to show in the table's `caption` tag.
3699
3710
  * @param side `top` or `bottom` to set where the table will be shown on the
3700
3711
  * table. If not given the previous value will be used (can also be set in
3701
3712
  * CSS).
@@ -4397,7 +4408,7 @@ interface ApiColumnSearch<T> {
4397
4408
  * Set the search term for the matched column.
4398
4409
  *
4399
4410
  * @param input Search to apply.
4400
- * @param Search Search configuration options
4411
+ * @param options Search configuration options
4401
4412
  * @returns DataTables API instance
4402
4413
  */
4403
4414
  (input: SearchInput<T>, options: Partial<SearchOptions>): Api<any>;
@@ -4619,7 +4630,7 @@ interface ApiColumnsSearch<T> {
4619
4630
  * Set the search term for the matched columns.
4620
4631
  *
4621
4632
  * @param input Search to apply.
4622
- * @param Search Search configuration options
4633
+ * @param options Search configuration options
4623
4634
  * @returns DataTables API instance
4624
4635
  */
4625
4636
  (input: SearchInput<T>, options: Partial<SearchOptions>): Api<any>;
@@ -4655,26 +4666,20 @@ interface ApiRowChildMethods<T> {
4655
4666
  * result set, or undefined if there are no child rows set for the parent
4656
4667
  * yet.
4657
4668
  */
4658
- (): JQuery;
4659
- /**
4660
- * Get the child row(s) that have been set for a parent row
4661
- *
4662
- * @param showRemove This parameter can be given as true or false
4663
- * @returns DataTables Api instance.
4664
- */
4665
- (showRemove: boolean): RowChildMethods<T>;
4669
+ (): Dom;
4666
4670
  /**
4667
4671
  * Set the data to show in the child row(s). Note that calling this method
4668
4672
  * will replace any child rows which are already attached to the parent row.
4669
4673
  *
4670
4674
  * @param data The data to be shown in the child row can be given in
4671
- * multiple different ways.
4675
+ * multiple different ways. Can be set to boolean `false` to hide an
4676
+ * existing child row, or boolean `true` to show an existing child row.
4672
4677
  * @param className Class name that is added to the td cell node(s) of the
4673
4678
  * child row(s). As of 1.10.1 it is also added to the tr row node of the
4674
4679
  * child row(s).
4675
4680
  * @returns DataTables Api instance
4676
4681
  */
4677
- (data: (string | Node | JQuery) | Array<string | number | JQuery>, className?: string): RowChildMethods<T>;
4682
+ (data: (boolean | string | Node | JQuery) | Array<string | number | JQuery>, className?: string): RowChildMethods<T>;
4678
4683
  /**
4679
4684
  * Hide the child row(s) of a parent row
4680
4685
  *
@@ -5042,12 +5047,25 @@ interface DataTablesStatic {
5042
5047
  * @returns true the given table is a DataTable, false otherwise
5043
5048
  */
5044
5049
  isDataTable(table: string | Node | JQuery | Api<any>): boolean;
5050
+ /**
5051
+ * Set the DataTables Plus license key.
5052
+ *
5053
+ * @param key Your DataTables Plus license key
5054
+ */
5055
+ key(key: string): void;
5045
5056
  /**
5046
5057
  * The models that DataTables uses for data storage.
5047
5058
  *
5048
5059
  * @ignore
5049
5060
  */
5050
5061
  models: typeof _default$1;
5062
+ /**
5063
+ * Validate a "Plus" extensions
5064
+ *
5065
+ * @param date The release date of the software. ISO8601 date only format.
5066
+ * @param software Optional the extension name
5067
+ */
5068
+ plus(date: string, software?: string): boolean;
5051
5069
  /**
5052
5070
  * Helpers for `columns.render`.
5053
5071
  *
@@ -5101,7 +5119,7 @@ interface DataTablesStatic {
5101
5119
  /**
5102
5120
  * Get all DataTable tables that have been initialised - as HTML elements
5103
5121
  *
5104
- * @param options Indicate if you want all tables on the page should be
5122
+ * @param visible Indicate if you want all tables on the page should be
5105
5123
  * returned (false), or visible tables only (true).
5106
5124
  * @returns Array of HTML table Elements
5107
5125
  */
@@ -5186,7 +5204,6 @@ interface DataTablesStaticRender {
5186
5204
  * Format an ISO8061 date value using the specified format
5187
5205
  * @param to Display format
5188
5206
  * @param locale Locale
5189
- * @param def Default value if empty
5190
5207
  */
5191
5208
  date(to: string, locale?: string): DateTimeRenderer;
5192
5209
  /**
@@ -5205,7 +5222,6 @@ interface DataTablesStaticRender {
5205
5222
  * Format an ISO8061 datetime value using the specified format
5206
5223
  * @param to Display format
5207
5224
  * @param locale Locale
5208
- * @param def Default value if empty
5209
5225
  */
5210
5226
  datetime(to: string, locale?: string): DateTimeRenderer;
5211
5227
  /**
@@ -5243,7 +5259,6 @@ interface DataTablesStaticRender {
5243
5259
  * Format an ISO8061 time value using the specified format
5244
5260
  * @param to Display format
5245
5261
  * @param locale Locale
5246
- * @param def Default value if empty
5247
5262
  */
5248
5263
  time(to: string, locale?: string): DateTimeRenderer;
5249
5264
  /**
@@ -5327,4 +5342,4 @@ interface DataTable extends DataTablesStatic {}
5327
5342
  declare const DataTable: typeof DataTable$1;
5328
5343
 
5329
5344
  export { Api, Settings as ColumnContext, DataTable, Dom, DataTable as default, _default as util };
5330
- export type { AjaxMethods, AjaxOptions, ApiAjax, ApiCaption, ApiCell, ApiCellMethods, ApiCells, ApiCellsMethods, ApiColumn, ApiColumnMethods, ApiColumnSearch, ApiColumns, ApiColumnsMethods, ApiColumnsSearch, ApiConstructor, ApiOrder, ApiPage, ApiPageInfo, ApiRow, ApiRowChildMethods, ApiRowMethods, ApiRows, ApiRowsMethods, ApiScopeable, ApiSearch, ApiSelector, ApiState, ApiStatic, ApiStaticRegisterFn, ApiTableFooterMethods, ApiTableHeaderMethods, ApiTableMethods, ApiTablesMethods, CellIdx, CellIdxWithVisible, CellSelector, ColumnIdx, ColumnSelector, Options$1 as ColumnsConfig, Context, DataTablesStatic, DataTablesStaticExtButtons, DataTablesStaticRender, Defaults, DomSelector, Ext, ExtButtons, ExtTypeSettings, HeaderStructure, IColumnControlContent, InstSelector, ConfigLanguage as Language, Options, RowChildMethods, Row as RowContext, RowIdx, RowSelector, SelectorModifier, Context as Settings, State, StateLoad, TableSelector };
5345
+ export type { AjaxMethods, AjaxOptions, ApiAjax, ApiCaption, ApiCell, ApiCellMethods, ApiCells, ApiCellsMethods, ApiColumn, ApiColumnMethods, ApiColumnSearch, ApiColumns, ApiColumnsMethods, ApiColumnsSearch, ApiConstructor, ApiOrder, ApiPage, ApiPageInfo, ApiRow, ApiRowChildMethods, ApiRowMethods, ApiRows, ApiRowsMethods, ApiScopeable, ApiSearch, ApiSelector, ApiState, ApiStatic, ApiStaticRegisterFn, ApiTableFooterMethods, ApiTableHeaderMethods, ApiTableMethods, ApiTablesMethods, CellIdx, CellIdxWithVisible, CellMeta, CellSelector, ColumnIdx, ColumnRenderFunction, ColumnSelector, Options$1 as ColumnsConfig, Context, DataTableEvent, DataTablesStatic, DataTablesStaticExtButtons, DataTablesStaticRender, DataType, DataTypeDetect, Defaults, DomSelector, Ext, ExtButtons, ExtTypeSettings, HeaderStructure, IColumnControlContent, InstSelector, ConfigLanguage as Language, Options, RowChildMethods, Row as RowContext, RowIdx, RowSelector, SelectorModifier, Context as Settings, State, StateLoad, TableSelector };