Skip to content

Commit d24da51

Browse files
committed
66747bd1e60e2043dd395c898152c2dbff448c13
Sync to source repo @66747bd1e60e2043dd395c898152c2dbff448c13
1 parent 45e88ac commit d24da51

2 files changed

Lines changed: 144 additions & 6 deletions

File tree

datatables.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"types/types.d.ts"
1515
],
1616
"src-repo": "http://github.com/DataTables/StateRestore",
17-
"last-tag": "1.1.1"
18-
}
17+
"last-tag": "1.1.1",
18+
"last-sync": "66747bd1e60e2043dd395c898152c2dbff448c13"
19+
}

types/types.d.ts

Lines changed: 141 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,144 @@
1+
// Type definitions for DataTables StateRestore
2+
//
3+
// Project: https://datatables.net/extensions/StateRestore/, https://datatables.net
14

2-
// Dist-DataTables-StateRestore-jQueryUI integration with jQueryUI exports the DataTables API having
3-
// set default values to complete the ingeration.
4-
import Api from "datatables.net";
5+
/// <reference types="jquery" />
56

6-
export default Api;
7+
import DataTables, {Api} from 'datatables.net';
8+
import * as stateRestoreCollectionType from './StateRestoreCollection';
9+
import * as stateRestoreType from './StateRestore';
710

11+
export default DataTables;
12+
13+
type DeepPartial<T> = T extends object ? {
14+
[P in keyof T]?: DeepPartial<T[P]>;
15+
} : T;
16+
17+
18+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
19+
* DataTables' types integration
20+
*/
21+
declare module 'datatables.net' {
22+
interface Config {
23+
/**
24+
* StateRestore extension options
25+
*/
26+
stateRestore?: boolean | string[] | ConfigStateRestore | ConfigStateRestore[];
27+
}
28+
29+
interface ConfigLanguage {
30+
/**
31+
* StateRestore language options
32+
*/
33+
stateRestore?: ConfigStateRestoreLanguage;
34+
}
35+
36+
interface Api<T> {
37+
/**
38+
* StateRestore API Methods
39+
*/
40+
stateRestore: ApiStateRestore<T>;
41+
}
42+
43+
interface ApiStatic {
44+
/**
45+
* StateRestore class
46+
*/
47+
StateRestore: {
48+
/**
49+
* Create a new StateRestore instance for the target DataTable
50+
*/
51+
new (dt: Api<any>, settings: string[] | ConfigStateRestore | ConfigStateRestore[]);
52+
53+
/**
54+
* StateRestore version
55+
*/
56+
version: string;
57+
58+
/**
59+
* Default configuration values
60+
*/
61+
defaults: ConfigStateRestore;
62+
}
63+
}
64+
}
65+
66+
67+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
68+
* Options
69+
*/
70+
interface ConfigStateRestore extends Partial<stateRestoreCollectionType.IDefaults> {}
71+
72+
interface ConfigStateRestoreLanguage extends DeepPartial<stateRestoreCollectionType.II18n> {}
73+
74+
75+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
76+
* API
77+
*/
78+
79+
interface ApiStateRestore<T> {
80+
/**
81+
* Creates a new state, adding it to the collection.
82+
*
83+
* @param identifier The identifier that is to be used for the new state
84+
*
85+
* @returns DatatTables Api for chaining
86+
*/
87+
addState(identifier: string): void | Api<T>;
88+
89+
/**
90+
* Retrieves a state from the collection.
91+
*
92+
* @param identifier The identifier of the state that is to be retrieved.
93+
*
94+
* @returns StateRestore instance, or further api methods.
95+
*/
96+
state(identifier: string): stateRestoreType.default | null | StateRestoreSubApi<T>;
97+
98+
/**
99+
* Retrieves all of the states from the collection.
100+
*
101+
* @returns An array of the StateRestore instances,
102+
* or further api methods that are applicable to multiple states.
103+
*/
104+
states(): stateRestoreType.default[] | StateRestoreMultiSubApi<T>;
105+
}
106+
107+
interface StateRestoreSubApi<T> extends Api<T> {
108+
/**
109+
* Removes the state previously identified in the call to `state()`.
110+
*
111+
* @returns Datatables Api for chaining.
112+
*/
113+
remove(): Api<T>;
114+
115+
/**
116+
* Loads the state previously identified in the call to `state()` into the table.
117+
*
118+
* @returns Datatables Api for chaining.
119+
*/
120+
load(): Api<T>;
121+
122+
/**
123+
* Renames the state previously identified in the call to `state()`.
124+
*
125+
* @returns Datatables Api for chaining.
126+
*/
127+
rename(): Api<T>;
128+
129+
/**
130+
* Saves the state previously identified in the call to `state()`.
131+
*
132+
* @returns Datatables Api for chaining.
133+
*/
134+
save(): Api<T>;
135+
}
136+
137+
interface StateRestoreMultiSubApi<T> extends Api<T> {
138+
/**
139+
* Removes all of the states that were previously identified in the call to `states()`.
140+
*
141+
* @returns Datatables Api for chaining.
142+
*/
143+
remove(): Api<T>;
144+
}

0 commit comments

Comments
 (0)