datatables.net-searchbuilder 1.8.4 → 2.0.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/js/dataTables.searchBuilder.js +3623 -3677
- package/js/dataTables.searchBuilder.min.js +3 -3
- package/js/dataTables.searchBuilder.min.mjs +3 -6
- package/js/dataTables.searchBuilder.mjs +3605 -3659
- package/package.json +3 -15
- package/types/types.d.ts +687 -108
package/types/types.d.ts
CHANGED
|
@@ -1,119 +1,698 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Project: https://datatables.net/extensions/searchbuilder/, https://datatables.net
|
|
1
|
+
import { Dom, ColumnSelector, Context, Api, DataTable } from 'datatables.net';
|
|
2
|
+
export { DataTable as default } from 'datatables.net';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
interface IClassses {
|
|
5
|
+
add: string;
|
|
6
|
+
button: string;
|
|
7
|
+
clearGroup: string;
|
|
8
|
+
greyscale: string;
|
|
9
|
+
group: string;
|
|
10
|
+
inputButton: string;
|
|
11
|
+
logic: string;
|
|
12
|
+
logicContainer: string;
|
|
13
|
+
search: string;
|
|
14
|
+
}
|
|
15
|
+
interface IDom$2 {
|
|
16
|
+
add: Dom;
|
|
17
|
+
clear: Dom;
|
|
18
|
+
container: Dom;
|
|
19
|
+
logic: Dom;
|
|
20
|
+
logicContainer: Dom;
|
|
21
|
+
search: Dom;
|
|
22
|
+
}
|
|
23
|
+
interface IS$2 {
|
|
24
|
+
criteria: ISCriteria[];
|
|
25
|
+
depth: number;
|
|
26
|
+
dt: any;
|
|
27
|
+
index: number;
|
|
28
|
+
isChild: boolean;
|
|
29
|
+
logic: string;
|
|
30
|
+
opts: IDefaults;
|
|
31
|
+
preventRedraw: boolean;
|
|
32
|
+
serverData: {
|
|
33
|
+
[keys: string]: IServerData;
|
|
34
|
+
};
|
|
35
|
+
toDrop: Criteria;
|
|
36
|
+
topGroup: Dom;
|
|
37
|
+
}
|
|
38
|
+
interface ICriteriaDetails {
|
|
39
|
+
condition?: string;
|
|
40
|
+
data?: string;
|
|
41
|
+
logic?: string;
|
|
42
|
+
value?: string[];
|
|
43
|
+
}
|
|
44
|
+
interface ISCriteria {
|
|
45
|
+
criteria: Group | Criteria;
|
|
46
|
+
index: number;
|
|
47
|
+
logic?: string;
|
|
48
|
+
}
|
|
49
|
+
interface IDetails$2 {
|
|
50
|
+
criteria?: ICriteriaDetails[];
|
|
51
|
+
index?: number;
|
|
52
|
+
logic?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The Group class is used within SearchBuilder to represent a group of criteria
|
|
56
|
+
*/
|
|
57
|
+
declare class Group {
|
|
58
|
+
static classes: IClassses;
|
|
59
|
+
static defaults: IDefaults;
|
|
60
|
+
classes: IClassses;
|
|
61
|
+
dom: IDom$2;
|
|
62
|
+
c: IDefaults;
|
|
63
|
+
s: IS$2;
|
|
64
|
+
constructor(table: any, opts: IDefaults, topGroup: Dom, index?: number, isChild?: boolean, depth?: number, serverData?: any);
|
|
65
|
+
/**
|
|
66
|
+
* Destroys the groups buttons, clears the internal criteria and removes it from the dom
|
|
67
|
+
*/
|
|
68
|
+
destroy(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the details required to rebuild the group
|
|
71
|
+
*/
|
|
72
|
+
getDetails(deFormatDates?: boolean): IDetails$2 | {};
|
|
73
|
+
/**
|
|
74
|
+
* Getter for the node for the container of the group
|
|
75
|
+
*
|
|
76
|
+
* @returns Node for the container of the group
|
|
77
|
+
*/
|
|
78
|
+
getNode(): Dom;
|
|
79
|
+
/**
|
|
80
|
+
* Rebuilds the group based upon the details passed in
|
|
81
|
+
*
|
|
82
|
+
* @param loadedDetails the details required to rebuild the group
|
|
83
|
+
*/
|
|
84
|
+
rebuild(loadedDetails: IDetails$2 | IDetails): void;
|
|
85
|
+
/**
|
|
86
|
+
* Redraws the Contents of the searchBuilder Groups and Criteria
|
|
87
|
+
*/
|
|
88
|
+
redrawContents(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Resizes the logic button only rather than the entire dom.
|
|
91
|
+
*/
|
|
92
|
+
redrawLogic(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Search method, checking the row data against the criteria in the group
|
|
95
|
+
*
|
|
96
|
+
* @param rowData The row data to be compared
|
|
97
|
+
* @returns boolean The result of the search
|
|
98
|
+
*/
|
|
99
|
+
search(rowData: any[], rowIdx: number): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Locates the groups logic button to the correct location on the page
|
|
102
|
+
*/
|
|
103
|
+
setupLogic(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Sets listeners on the groups elements
|
|
106
|
+
*/
|
|
107
|
+
setListeners(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Adds a criteria to the group
|
|
110
|
+
*
|
|
111
|
+
* @param crit Instance of Criteria to be added to the group
|
|
112
|
+
*/
|
|
113
|
+
addCriteria(crit?: Criteria): void;
|
|
114
|
+
/**
|
|
115
|
+
* Checks the group to see if it has any filled criteria
|
|
116
|
+
*/
|
|
117
|
+
checkFilled(): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Gets the count for the number of criteria in this group and any sub groups
|
|
120
|
+
*/
|
|
121
|
+
count(): number;
|
|
122
|
+
/**
|
|
123
|
+
* Rebuilds a sub group that previously existed
|
|
124
|
+
*
|
|
125
|
+
* @param loadedGroup The details of a group within this group
|
|
126
|
+
*/
|
|
127
|
+
private _addPrevGroup;
|
|
128
|
+
/**
|
|
129
|
+
* Rebuilds a criteria of this group that previously existed
|
|
130
|
+
*
|
|
131
|
+
* @param loadedCriteria The details of a criteria within the group
|
|
132
|
+
*/
|
|
133
|
+
private _addPrevCriteria;
|
|
134
|
+
/**
|
|
135
|
+
* Checks And the criteria using AND logic
|
|
136
|
+
*
|
|
137
|
+
* @param rowData The row data to be checked against the search criteria
|
|
138
|
+
* @returns boolean The result of the AND search
|
|
139
|
+
*/
|
|
140
|
+
private _andSearch;
|
|
141
|
+
/**
|
|
142
|
+
* Checks And the criteria using OR logic
|
|
143
|
+
*
|
|
144
|
+
* @param rowData The row data to be checked against the search criteria
|
|
145
|
+
* @returns boolean The result of the OR search
|
|
146
|
+
*/
|
|
147
|
+
private _orSearch;
|
|
148
|
+
/**
|
|
149
|
+
* Removes a criteria from the group
|
|
150
|
+
*
|
|
151
|
+
* @param criteria The criteria instance to be removed
|
|
152
|
+
*/
|
|
153
|
+
private _removeCriteria;
|
|
154
|
+
/**
|
|
155
|
+
* Sets the listeners in group for a criteria
|
|
156
|
+
*
|
|
157
|
+
* @param criteria The criteria for the listeners to be set on
|
|
158
|
+
*/
|
|
159
|
+
private _setCriteriaListeners;
|
|
160
|
+
/**
|
|
161
|
+
* Set's the listeners for the group clear button
|
|
162
|
+
*/
|
|
163
|
+
private _setClearListener;
|
|
164
|
+
/**
|
|
165
|
+
* Sets listeners for sub groups of this group
|
|
166
|
+
*
|
|
167
|
+
* @param group The sub group that the listeners are to be set on
|
|
168
|
+
*/
|
|
169
|
+
private _setGroupListeners;
|
|
170
|
+
/**
|
|
171
|
+
* Sets up the Group instance, setting listeners and appending elements
|
|
172
|
+
*/
|
|
173
|
+
private _setup;
|
|
174
|
+
/**
|
|
175
|
+
* Sets the listener for the logic button
|
|
176
|
+
*/
|
|
177
|
+
private _setLogicListener;
|
|
178
|
+
/**
|
|
179
|
+
* Toggles the logic for the group
|
|
180
|
+
*/
|
|
181
|
+
private _toggleLogic;
|
|
182
|
+
}
|
|
6
183
|
|
|
7
|
-
|
|
8
|
-
|
|
184
|
+
interface IDetails$1 {
|
|
185
|
+
criteria: Group[];
|
|
186
|
+
logic: string;
|
|
187
|
+
}
|
|
188
|
+
interface IClasses$1 {
|
|
189
|
+
button: string;
|
|
190
|
+
clearAll: string;
|
|
191
|
+
container: string;
|
|
192
|
+
inputButton: string;
|
|
193
|
+
title: string;
|
|
194
|
+
titleRow: string;
|
|
195
|
+
}
|
|
196
|
+
interface IDefaults {
|
|
197
|
+
columns: ColumnSelector;
|
|
198
|
+
conditions: {
|
|
199
|
+
[keys: string]: {
|
|
200
|
+
[keys: string]: ICondition;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
depthLimit: false | number;
|
|
204
|
+
enterSearch: boolean;
|
|
205
|
+
filterChanged: (count: number, text: string) => void;
|
|
206
|
+
greyscale: boolean;
|
|
207
|
+
i18n: II18n;
|
|
208
|
+
liveSearch: boolean;
|
|
209
|
+
logic: string;
|
|
210
|
+
orthogonal: IOrthogonal;
|
|
211
|
+
preDefined: boolean | IDetails$1;
|
|
212
|
+
}
|
|
213
|
+
interface IDom$1 {
|
|
214
|
+
clearAll: Dom;
|
|
215
|
+
container: Dom;
|
|
216
|
+
title: Dom;
|
|
217
|
+
titleRow: Dom;
|
|
218
|
+
topGroup: Dom;
|
|
219
|
+
}
|
|
220
|
+
interface II18n {
|
|
221
|
+
add: string;
|
|
222
|
+
button: {
|
|
223
|
+
0: string;
|
|
224
|
+
_: string;
|
|
225
|
+
};
|
|
226
|
+
clearAll: string;
|
|
227
|
+
condition: string;
|
|
228
|
+
conditions?: {
|
|
229
|
+
[s: string]: {
|
|
230
|
+
[t: string]: string;
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
data: string;
|
|
234
|
+
delete: string;
|
|
235
|
+
deleteTitle: string;
|
|
236
|
+
left: string;
|
|
237
|
+
leftTitle: string;
|
|
238
|
+
logicAnd: string;
|
|
239
|
+
logicOr: string;
|
|
240
|
+
right: string;
|
|
241
|
+
rightTitle: string;
|
|
242
|
+
search: string;
|
|
243
|
+
title: {
|
|
244
|
+
0: string;
|
|
245
|
+
_: string;
|
|
246
|
+
};
|
|
247
|
+
value: string;
|
|
248
|
+
valueJoiner: string;
|
|
249
|
+
}
|
|
250
|
+
interface IServerData {
|
|
251
|
+
label: any;
|
|
252
|
+
value: any;
|
|
253
|
+
}
|
|
254
|
+
interface IS$1 {
|
|
255
|
+
dt: any;
|
|
256
|
+
opts: IDefaults;
|
|
257
|
+
search: (settings: Context, searchData: any[], dataIndex: number, origData: any) => boolean;
|
|
258
|
+
serverData: {
|
|
259
|
+
[keys: string]: IServerData[];
|
|
260
|
+
};
|
|
261
|
+
topGroup: Group;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* SearchBuilder class for DataTables.
|
|
265
|
+
* Allows for complex search queries to be constructed and implemented on a DataTable
|
|
266
|
+
*/
|
|
267
|
+
declare class SearchBuilder {
|
|
268
|
+
static version: string;
|
|
269
|
+
static classes: IClasses$1;
|
|
270
|
+
static defaults: IDefaults;
|
|
271
|
+
classes: IClasses$1;
|
|
272
|
+
dom: IDom$1;
|
|
273
|
+
c: IDefaults;
|
|
274
|
+
s: IS$1;
|
|
275
|
+
constructor(builderSettings: any, opts: IDefaults);
|
|
276
|
+
/**
|
|
277
|
+
* Gets the details required to rebuild the SearchBuilder as it currently is
|
|
278
|
+
*/
|
|
279
|
+
getDetails(deFormatDates?: boolean): IDetails$1 | {};
|
|
280
|
+
/**
|
|
281
|
+
* Getter for the node of the container for the searchBuilder
|
|
282
|
+
*
|
|
283
|
+
* @returns Dom the node of the container
|
|
284
|
+
*/
|
|
285
|
+
getNode(): Dom;
|
|
286
|
+
/**
|
|
287
|
+
* Rebuilds the SearchBuilder to a state that is provided
|
|
288
|
+
*
|
|
289
|
+
* @param details The details required to perform a rebuild
|
|
290
|
+
*/
|
|
291
|
+
rebuild(details: any, redraw?: boolean): SearchBuilder;
|
|
292
|
+
/**
|
|
293
|
+
* Applies the defaults to preDefined criteria
|
|
294
|
+
*
|
|
295
|
+
* @param preDef the array of criteria to be processed.
|
|
296
|
+
*/
|
|
297
|
+
private _applyPreDefDefaults;
|
|
298
|
+
/**
|
|
299
|
+
* Set's up the SearchBuilder
|
|
300
|
+
*/
|
|
301
|
+
private _setUp;
|
|
302
|
+
private _collapseArray;
|
|
303
|
+
/**
|
|
304
|
+
* Updates the title of the SearchBuilder
|
|
305
|
+
*
|
|
306
|
+
* @param count the number of filters in the SearchBuilder
|
|
307
|
+
*/
|
|
308
|
+
private _updateTitle;
|
|
309
|
+
/**
|
|
310
|
+
* Builds all of the dom elements together
|
|
311
|
+
*/
|
|
312
|
+
private _build;
|
|
313
|
+
/**
|
|
314
|
+
* Checks if the clearAll button should be added or not
|
|
315
|
+
*/
|
|
316
|
+
private _checkClear;
|
|
317
|
+
/**
|
|
318
|
+
* Update the count in the title/button
|
|
319
|
+
*
|
|
320
|
+
* @param count Number of filters applied
|
|
321
|
+
*/
|
|
322
|
+
private _filterChanged;
|
|
323
|
+
/**
|
|
324
|
+
* Set the listener for the clear button
|
|
325
|
+
*/
|
|
326
|
+
private _setClearListener;
|
|
327
|
+
/**
|
|
328
|
+
* Set the listener for the Redraw event
|
|
329
|
+
*/
|
|
330
|
+
private _setRedrawListener;
|
|
331
|
+
/**
|
|
332
|
+
* Sets listeners to check whether clearAll should be added or removed
|
|
333
|
+
*/
|
|
334
|
+
private _setEmptyListener;
|
|
335
|
+
}
|
|
9
336
|
|
|
10
|
-
|
|
337
|
+
interface IClasses {
|
|
338
|
+
button: string;
|
|
339
|
+
buttonContainer: string;
|
|
340
|
+
condition: string;
|
|
341
|
+
container: string;
|
|
342
|
+
data: string;
|
|
343
|
+
delete: string;
|
|
344
|
+
dropDown: string;
|
|
345
|
+
greyscale: string;
|
|
346
|
+
input: string;
|
|
347
|
+
inputCont: string;
|
|
348
|
+
italic: string;
|
|
349
|
+
joiner: string;
|
|
350
|
+
left: string;
|
|
351
|
+
notItalic: string;
|
|
352
|
+
option: string;
|
|
353
|
+
right: string;
|
|
354
|
+
select: string;
|
|
355
|
+
value: string;
|
|
356
|
+
vertical: string;
|
|
357
|
+
}
|
|
358
|
+
interface ICondition {
|
|
359
|
+
conditionName: string | ((dt: any, i18n: any) => string);
|
|
360
|
+
init: (that?: Criteria, fn?: (thatAgain: Criteria, el: Dom) => void, preDefined?: string[]) => Dom | Array<Dom> | void;
|
|
361
|
+
inputValue: (el: Dom[], that: Criteria) => string[];
|
|
362
|
+
isInputValid: (val: Array<Dom>, that: Criteria) => boolean;
|
|
363
|
+
search: (value: string | string[], comparison: string[], that: Criteria) => boolean;
|
|
364
|
+
}
|
|
365
|
+
interface IOrthogonal {
|
|
366
|
+
display: string;
|
|
367
|
+
search: string;
|
|
368
|
+
}
|
|
369
|
+
interface IDom {
|
|
370
|
+
buttons: Dom;
|
|
371
|
+
condition: Dom;
|
|
372
|
+
conditionTitle: Dom;
|
|
373
|
+
container: Dom;
|
|
374
|
+
data: Dom;
|
|
375
|
+
dataTitle: Dom;
|
|
376
|
+
defaultValue: Dom;
|
|
377
|
+
delete: Dom;
|
|
378
|
+
inputCont: Dom;
|
|
379
|
+
left: Dom;
|
|
380
|
+
right: Dom;
|
|
381
|
+
value: Array<Dom>;
|
|
382
|
+
valueTitle: Dom;
|
|
383
|
+
}
|
|
384
|
+
interface IS {
|
|
385
|
+
condition: string;
|
|
386
|
+
conditions: {
|
|
387
|
+
[keys: string]: ICondition;
|
|
388
|
+
};
|
|
389
|
+
data: string;
|
|
390
|
+
dataIdx: number;
|
|
391
|
+
dataPoints: IDataOpt[];
|
|
392
|
+
dateFormat: string | boolean;
|
|
393
|
+
depth: number;
|
|
394
|
+
dt: Api;
|
|
395
|
+
filled: boolean;
|
|
396
|
+
index: number;
|
|
397
|
+
liveSearch: boolean;
|
|
398
|
+
origData: string;
|
|
399
|
+
preventRedraw: boolean;
|
|
400
|
+
serverData: {
|
|
401
|
+
[keys: string]: IServerData[];
|
|
402
|
+
};
|
|
403
|
+
topGroup: Dom;
|
|
404
|
+
type: string;
|
|
405
|
+
value: string[];
|
|
406
|
+
}
|
|
407
|
+
interface IDataOpt {
|
|
408
|
+
index: number;
|
|
409
|
+
origData: string;
|
|
410
|
+
text: string;
|
|
411
|
+
}
|
|
412
|
+
interface IDetails {
|
|
413
|
+
condition?: string;
|
|
414
|
+
criteria?: Criteria;
|
|
415
|
+
data?: string;
|
|
416
|
+
index?: number;
|
|
417
|
+
logic?: string;
|
|
418
|
+
origData?: string;
|
|
419
|
+
type?: string;
|
|
420
|
+
value?: string[];
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* The Criteria class is used within SearchBuilder to represent a search criteria
|
|
424
|
+
*/
|
|
425
|
+
declare class Criteria {
|
|
426
|
+
static classes: IClasses;
|
|
427
|
+
classes: IClasses;
|
|
428
|
+
dom: IDom;
|
|
429
|
+
c: IDefaults;
|
|
430
|
+
s: IS;
|
|
431
|
+
constructor(table: any, opts: IDefaults, topGroup: Dom, index?: number, depth?: number, serverData?: any, liveSearch?: boolean);
|
|
432
|
+
/**
|
|
433
|
+
* Default initialisation function for select conditions
|
|
434
|
+
*/
|
|
435
|
+
private static initSelect;
|
|
436
|
+
/**
|
|
437
|
+
* Default initialisation function for select conditions
|
|
438
|
+
*/
|
|
439
|
+
private static initSelectSSP;
|
|
440
|
+
/**
|
|
441
|
+
* Default initialisation function for select array conditions
|
|
442
|
+
*
|
|
443
|
+
* This exists because there needs to be different select functionality for contains/without and equals/not
|
|
444
|
+
*/
|
|
445
|
+
private static initSelectArray;
|
|
446
|
+
/**
|
|
447
|
+
* Default initialisation function for input conditions
|
|
448
|
+
*/
|
|
449
|
+
private static initInput;
|
|
450
|
+
/**
|
|
451
|
+
* Default initialisation function for conditions requiring 2 inputs
|
|
452
|
+
*/
|
|
453
|
+
private static init2Input;
|
|
454
|
+
/**
|
|
455
|
+
* Default initialisation function for date conditions
|
|
456
|
+
*/
|
|
457
|
+
private static initDate;
|
|
458
|
+
private static initNoValue;
|
|
459
|
+
private static init2Date;
|
|
460
|
+
/**
|
|
461
|
+
* Default function for select elements to validate condition
|
|
462
|
+
*/
|
|
463
|
+
private static isInputValidSelect;
|
|
464
|
+
/**
|
|
465
|
+
* Default function for input and date elements to validate condition
|
|
466
|
+
*/
|
|
467
|
+
private static isInputValidInput;
|
|
468
|
+
/**
|
|
469
|
+
* Default function for getting select conditions
|
|
470
|
+
*/
|
|
471
|
+
private static inputValueSelect;
|
|
472
|
+
/**
|
|
473
|
+
* Default function for getting input conditions
|
|
474
|
+
*/
|
|
475
|
+
private static inputValueInput;
|
|
476
|
+
/**
|
|
477
|
+
* Function that is run on each element as a call back when a search should be triggered
|
|
478
|
+
*/
|
|
479
|
+
private static updateListener;
|
|
480
|
+
/**
|
|
481
|
+
* Redraw the DataTable with the current search parameters
|
|
482
|
+
*/
|
|
483
|
+
private doSearch;
|
|
484
|
+
/**
|
|
485
|
+
* Parses formatted numbers down to a form where they can be compared.
|
|
486
|
+
* Note that this does not account for different decimal characters. Use
|
|
487
|
+
* parseNumber instead on the instance.
|
|
488
|
+
*
|
|
489
|
+
* @param val the value to convert
|
|
490
|
+
* @returns the converted value
|
|
491
|
+
*/
|
|
492
|
+
private static parseNumFmt;
|
|
493
|
+
static dateConditions: {
|
|
494
|
+
[keys: string]: ICondition;
|
|
495
|
+
};
|
|
496
|
+
static momentDateConditions: {
|
|
497
|
+
[keys: string]: ICondition;
|
|
498
|
+
};
|
|
499
|
+
static luxonDateConditions: {
|
|
500
|
+
[keys: string]: ICondition;
|
|
501
|
+
};
|
|
502
|
+
static numConditions: {
|
|
503
|
+
[keys: string]: ICondition;
|
|
504
|
+
};
|
|
505
|
+
static numFmtConditions: {
|
|
506
|
+
[keys: string]: ICondition;
|
|
507
|
+
};
|
|
508
|
+
static stringConditions: {
|
|
509
|
+
[keys: string]: ICondition;
|
|
510
|
+
};
|
|
511
|
+
static arrayConditions: {
|
|
512
|
+
[keys: string]: ICondition;
|
|
513
|
+
};
|
|
514
|
+
private static defaults;
|
|
515
|
+
/**
|
|
516
|
+
* Adds the left button to the criteria
|
|
517
|
+
*/
|
|
518
|
+
updateArrows(hasSiblings?: boolean): void;
|
|
519
|
+
/**
|
|
520
|
+
* Destroys the criteria, removing listeners and container from the dom
|
|
521
|
+
*/
|
|
522
|
+
destroy(): void;
|
|
523
|
+
/**
|
|
524
|
+
* Passes in the data for the row and compares it against this single criteria
|
|
525
|
+
*
|
|
526
|
+
* @param rowData The data for the row to be compared
|
|
527
|
+
* @returns boolean Whether the criteria has passed
|
|
528
|
+
*/
|
|
529
|
+
search(rowData: any[], rowIdx: number): boolean;
|
|
530
|
+
/**
|
|
531
|
+
* Determine if the DataTable has return for search enabled
|
|
532
|
+
*
|
|
533
|
+
* @returns true if enabled
|
|
534
|
+
*/
|
|
535
|
+
isReturnSearch(): boolean;
|
|
536
|
+
/**
|
|
537
|
+
* Gets the details required to rebuild the criteria
|
|
538
|
+
*/
|
|
539
|
+
getDetails(deFormatDates?: boolean): IDetails;
|
|
540
|
+
/**
|
|
541
|
+
* Getter for the node for the container of the criteria
|
|
542
|
+
*
|
|
543
|
+
* @returns Dom the node for the container
|
|
544
|
+
*/
|
|
545
|
+
getNode(): Dom;
|
|
546
|
+
/**
|
|
547
|
+
* Parses formatted numbers down to a form where they can be compared
|
|
548
|
+
*
|
|
549
|
+
* @param val the value to convert
|
|
550
|
+
* @returns the converted value
|
|
551
|
+
*/
|
|
552
|
+
parseNumber(val: any): number;
|
|
553
|
+
/**
|
|
554
|
+
* Populates the criteria data, condition and value(s) as far as has been selected
|
|
555
|
+
*/
|
|
556
|
+
populate(): void;
|
|
557
|
+
/**
|
|
558
|
+
* Rebuilds the criteria based upon the details passed in
|
|
559
|
+
*
|
|
560
|
+
* @param loadedCriteria the details required to rebuild the criteria
|
|
561
|
+
*/
|
|
562
|
+
rebuild(loadedCriteria: IDetails): void;
|
|
563
|
+
/**
|
|
564
|
+
* Sets the listeners for the criteria
|
|
565
|
+
*/
|
|
566
|
+
setListeners(): void;
|
|
567
|
+
setupButtons(): void;
|
|
568
|
+
/**
|
|
569
|
+
* Builds the elements of the dom together
|
|
570
|
+
*/
|
|
571
|
+
private _buildCriteria;
|
|
572
|
+
/**
|
|
573
|
+
* Clears the condition select element
|
|
574
|
+
*/
|
|
575
|
+
private _clearCondition;
|
|
576
|
+
/**
|
|
577
|
+
* Clears the value elements
|
|
578
|
+
*/
|
|
579
|
+
private _clearValue;
|
|
580
|
+
/**
|
|
581
|
+
* Gets the options for the column
|
|
582
|
+
*
|
|
583
|
+
* @returns {object} The options for the column
|
|
584
|
+
*/
|
|
585
|
+
private _getOptions;
|
|
586
|
+
/**
|
|
587
|
+
* Populates the condition dropdown
|
|
588
|
+
*/
|
|
589
|
+
private _populateCondition;
|
|
590
|
+
/**
|
|
591
|
+
* Populates the data / column select element
|
|
592
|
+
*/
|
|
593
|
+
private _populateData;
|
|
594
|
+
/**
|
|
595
|
+
* Populates the Value select element
|
|
596
|
+
*
|
|
597
|
+
* @param loadedCriteria optional, used to reload criteria from predefined filters
|
|
598
|
+
*/
|
|
599
|
+
private _populateValue;
|
|
600
|
+
/**
|
|
601
|
+
* Provides throttling capabilities to SearchBuilder without having to use dt's _fnThrottle function
|
|
602
|
+
* This is because that function is not quite suitable for our needs as it runs initially rather than waiting
|
|
603
|
+
*
|
|
604
|
+
* @param args arguments supplied to the throttle function
|
|
605
|
+
* @returns Function that is to be run that implements the throttling
|
|
606
|
+
*/
|
|
607
|
+
private _throttle;
|
|
608
|
+
}
|
|
11
609
|
|
|
12
610
|
type DeepPartial<T> = T extends object ? {
|
|
13
611
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
14
612
|
} : T;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
18
|
-
* DataTables' types integration
|
|
19
|
-
*/
|
|
20
613
|
declare module 'datatables.net' {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
*/
|
|
82
|
-
defaults: ConfigSearchBuilder;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
614
|
+
interface Config {
|
|
615
|
+
/**
|
|
616
|
+
* SearchBuilder extension options
|
|
617
|
+
*/
|
|
618
|
+
searchBuilder?: boolean | string[] | ConfigSearchBuilder | ConfigSearchBuilder[];
|
|
619
|
+
}
|
|
620
|
+
interface Defaults {
|
|
621
|
+
searchBuilder?: ConfigSearchBuilder;
|
|
622
|
+
}
|
|
623
|
+
interface ConfigLanguage {
|
|
624
|
+
/**
|
|
625
|
+
* SearchBuilder language options
|
|
626
|
+
*/
|
|
627
|
+
searchBuilder?: ConfigSearchBuilderLanguage;
|
|
628
|
+
}
|
|
629
|
+
interface Context {
|
|
630
|
+
_searchBuilder: SearchBuilder;
|
|
631
|
+
}
|
|
632
|
+
interface Ext {
|
|
633
|
+
searchBuilder: {
|
|
634
|
+
conditions: Record<string, ICondition>;
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
interface ColumnContext {
|
|
638
|
+
searchBuilder?: {
|
|
639
|
+
/** Set a default condition for this column */
|
|
640
|
+
defaultCondition?: number | string;
|
|
641
|
+
/** Set values of orthogonal data for rendering functions */
|
|
642
|
+
orthogonal?: {
|
|
643
|
+
[key: string]: string;
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
/** Set a custom title for a column in SearchBuilder */
|
|
647
|
+
searchBuilderTitle?: string;
|
|
648
|
+
/** Set the SearchBuilder type to use for a column */
|
|
649
|
+
searchBuilderType?: string;
|
|
650
|
+
}
|
|
651
|
+
interface Feature {
|
|
652
|
+
searchBuilder?: string[] | ConfigSearchBuilder | ConfigSearchBuilder[];
|
|
653
|
+
}
|
|
654
|
+
interface Api<T> {
|
|
655
|
+
/**
|
|
656
|
+
* SearchBuilder methods container
|
|
657
|
+
*
|
|
658
|
+
* @returns Api for chaining with the additional SearchBuilder methods
|
|
659
|
+
*/
|
|
660
|
+
searchBuilder: ApiSearchBuilder<T>;
|
|
661
|
+
}
|
|
662
|
+
interface DataTablesStatic {
|
|
663
|
+
/**
|
|
664
|
+
* SearchBuilder class
|
|
665
|
+
*/
|
|
666
|
+
SearchBuilder: typeof SearchBuilder;
|
|
667
|
+
Group: typeof Group;
|
|
668
|
+
Criteria: typeof Criteria;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
interface ConfigSearchBuilder extends Partial<IDefaults> {
|
|
672
|
+
}
|
|
673
|
+
interface ConfigSearchBuilderLanguage extends DeepPartial<II18n> {
|
|
85
674
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
89
|
-
* Options
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
interface ConfigSearchBuilder extends Partial<IDefaults> {}
|
|
93
|
-
|
|
94
|
-
interface ConfigSearchBuilderLanguage extends DeepPartial<II18n> {}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
98
|
-
* API
|
|
99
|
-
*/
|
|
100
675
|
interface ApiSearchBuilder<T> extends Api<T> {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
676
|
+
/**
|
|
677
|
+
* Returns the node of the SearchBuilder Container
|
|
678
|
+
*/
|
|
679
|
+
container(): Dom;
|
|
680
|
+
/**
|
|
681
|
+
* Gets the details of the current SearchBuilder setup
|
|
682
|
+
*
|
|
683
|
+
* @param deFormatDates Boolean flag that indicates whether to de format any
|
|
684
|
+
* dates that are found into an ISO8601 format.
|
|
685
|
+
*/
|
|
686
|
+
getDetails(deFormatDates?: boolean): IDetails$1;
|
|
687
|
+
/**
|
|
688
|
+
* Rebuild the search to a given state.
|
|
689
|
+
*
|
|
690
|
+
* @param state Object of the same structure that is returned from
|
|
691
|
+
* searchBuilder.getDetails(). This contains all of the details needed to
|
|
692
|
+
* rebuild the state.
|
|
693
|
+
* @param redraw Indicate if the host DataTable should be redrawn or not.
|
|
694
|
+
* Defaults to `true`.
|
|
695
|
+
* @returns self for chaining
|
|
696
|
+
*/
|
|
697
|
+
rebuild(state?: IDetails$1, redraw?: boolean): Api<T>;
|
|
119
698
|
}
|