datatables.net 3.0.0 → 3.0.2

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/types/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! DataTables
1
+ /*! DataTables 3.0.2
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.
@@ -1562,7 +1562,7 @@ interface Defaults {
1562
1562
  * Add event listeners during the DataTables startup
1563
1563
  */
1564
1564
  on: {
1565
- [name: string]: (this: HTMLElement, e: Event, ...args: any[]) => void;
1565
+ [name: string]: (this: HTMLElement, e: DataTableEvent, ...args: any[]) => void;
1566
1566
  };
1567
1567
  /**
1568
1568
  * Initial order (sort) to apply to the table.
@@ -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;
@@ -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
  *
@@ -5114,7 +5119,7 @@ interface DataTablesStatic {
5114
5119
  /**
5115
5120
  * Get all DataTable tables that have been initialised - as HTML elements
5116
5121
  *
5117
- * @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
5118
5123
  * returned (false), or visible tables only (true).
5119
5124
  * @returns Array of HTML table Elements
5120
5125
  */
@@ -5199,7 +5204,6 @@ interface DataTablesStaticRender {
5199
5204
  * Format an ISO8061 date value using the specified format
5200
5205
  * @param to Display format
5201
5206
  * @param locale Locale
5202
- * @param def Default value if empty
5203
5207
  */
5204
5208
  date(to: string, locale?: string): DateTimeRenderer;
5205
5209
  /**
@@ -5218,7 +5222,6 @@ interface DataTablesStaticRender {
5218
5222
  * Format an ISO8061 datetime value using the specified format
5219
5223
  * @param to Display format
5220
5224
  * @param locale Locale
5221
- * @param def Default value if empty
5222
5225
  */
5223
5226
  datetime(to: string, locale?: string): DateTimeRenderer;
5224
5227
  /**
@@ -5256,7 +5259,6 @@ interface DataTablesStaticRender {
5256
5259
  * Format an ISO8061 time value using the specified format
5257
5260
  * @param to Display format
5258
5261
  * @param locale Locale
5259
- * @param def Default value if empty
5260
5262
  */
5261
5263
  time(to: string, locale?: string): DateTimeRenderer;
5262
5264
  /**
@@ -5340,4 +5342,4 @@ interface DataTable extends DataTablesStatic {}
5340
5342
  declare const DataTable: typeof DataTable$1;
5341
5343
 
5342
5344
  export { Api, Settings as ColumnContext, DataTable, Dom, DataTable as default, _default as util };
5343
- 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 };