@types/selectize 0.12.31 → 0.12.35
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.
- selectize/LICENSE +21 -21
- selectize/README.md +4 -4
- selectize/index.d.ts +673 -637
- selectize/package.json +7 -4
selectize/index.d.ts
CHANGED
|
@@ -1,637 +1,673 @@
|
|
|
1
|
-
// Type definitions for Selectize 0.12.14
|
|
2
|
-
// Project: https://github.com/brianreavis/selectize.js
|
|
3
|
-
// Definitions by: Adi Dahiya <https://github.com/adidahiya>, Natalie Bausch <https://github.com/naBausch>
|
|
4
|
-
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
*
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
*
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
*
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* Default:
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* Default:
|
|
174
|
-
*/
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
*
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
*
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
*
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* Default: "
|
|
230
|
-
*/
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* Default:
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* Default:
|
|
244
|
-
*/
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
*
|
|
249
|
-
* property
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
*
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
*
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
*
|
|
423
|
-
*/
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
*
|
|
507
|
-
*/
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
//
|
|
511
|
-
// ------------------------------------------------------------------------------------------------------------
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
*
|
|
515
|
-
*/
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
*
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
*
|
|
551
|
-
*/
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*/
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
*
|
|
562
|
-
*/
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
1
|
+
// Type definitions for Selectize 0.12.14
|
|
2
|
+
// Project: https://github.com/brianreavis/selectize.js
|
|
3
|
+
// Definitions by: Adi Dahiya <https://github.com/adidahiya>, Natalie Bausch <https://github.com/naBausch>
|
|
4
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
5
|
+
// TypeScript Version: 2.3
|
|
6
|
+
|
|
7
|
+
declare namespace Selectize {
|
|
8
|
+
// see https://github.com/brianreavis/selectize.js/blob/master/docs/usage.md
|
|
9
|
+
// option identifiers are parameterized by T; data is parameterized by U
|
|
10
|
+
interface IOptions<T, U> {
|
|
11
|
+
|
|
12
|
+
// General
|
|
13
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* An array of the initial selected values. By default this is populated from the original input element.
|
|
17
|
+
*/
|
|
18
|
+
items?: T[] | undefined;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The placeholder of the control (displayed when nothing is selected / typed).
|
|
22
|
+
* Defaults to input element's placeholder, unless this one is specified.
|
|
23
|
+
*/
|
|
24
|
+
placeholder?: string | undefined;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The string to separate items by. This option is only used when Selectize is instantiated from a
|
|
28
|
+
* <input type="text"> element.
|
|
29
|
+
*
|
|
30
|
+
* Default: ','
|
|
31
|
+
*/
|
|
32
|
+
delimiter?: string | undefined;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Enable or disable international character support.
|
|
36
|
+
*
|
|
37
|
+
* Default: true
|
|
38
|
+
*/
|
|
39
|
+
diacritics?: boolean | undefined;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Allows the user to create a new items that aren't in the list of options.
|
|
43
|
+
* This option can be any of the following: "true", "false" (disabled), or a function that accepts two
|
|
44
|
+
* arguments: "input" and "callback". The callback should be invoked with the final data for the option.
|
|
45
|
+
*
|
|
46
|
+
* Default: false
|
|
47
|
+
*/
|
|
48
|
+
create?: any;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* If true, when user exits the field (clicks outside of input or presses ESC) new option is created and
|
|
52
|
+
* selected (if `create`-option is enabled).
|
|
53
|
+
*
|
|
54
|
+
* Default: false
|
|
55
|
+
*/
|
|
56
|
+
createOnBlur?: boolean | undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Specifies a RegExp or String containing a regular expression that the current search filter must match to
|
|
60
|
+
* be allowed to be created. May also be a predicate function that takes the filter text and returns whether
|
|
61
|
+
* it is allowed.
|
|
62
|
+
*
|
|
63
|
+
* Default: null
|
|
64
|
+
*/
|
|
65
|
+
createFilter?: any;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Toggles match highlighting within the dropdown menu.
|
|
69
|
+
*
|
|
70
|
+
* Default: true
|
|
71
|
+
*/
|
|
72
|
+
highlight?: boolean | undefined;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* If false, items created by the user will not show up as available options once they are unselected.
|
|
76
|
+
*
|
|
77
|
+
* Default: true
|
|
78
|
+
*/
|
|
79
|
+
persist?: boolean | undefined;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Show the dropdown immediately when the control receives focus.
|
|
83
|
+
*
|
|
84
|
+
* Default: true
|
|
85
|
+
*/
|
|
86
|
+
openOnFocus?: boolean | undefined;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The max number of items to render at once in the dropdown list of options.
|
|
90
|
+
*
|
|
91
|
+
* Default: 1000
|
|
92
|
+
*/
|
|
93
|
+
maxOptions?: number | undefined;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The max number of items the user can select.
|
|
97
|
+
*
|
|
98
|
+
* Default: Infinity
|
|
99
|
+
*/
|
|
100
|
+
maxItems?: number | undefined;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* If true, the items that are currently selected will not be shown in the dropdown list of available options.
|
|
104
|
+
*
|
|
105
|
+
* Default: false
|
|
106
|
+
*/
|
|
107
|
+
hideSelected?: boolean | undefined;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* If true, the dropdown will be closed after a selection is made.
|
|
111
|
+
*
|
|
112
|
+
* Default: false
|
|
113
|
+
*/
|
|
114
|
+
closeAfterSelect?: boolean | undefined;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* If true, Selectize will treat any options with a "" value like normal. This defaults to false to
|
|
118
|
+
* accomodate the common <select> practice of having the first empty option act as a placeholder.
|
|
119
|
+
*
|
|
120
|
+
* Default: false
|
|
121
|
+
*/
|
|
122
|
+
allowEmptyOption?: boolean | undefined;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The animation duration (in milliseconds) of the scroll animation triggered when going [up] and [down] in
|
|
126
|
+
* the options dropdown.
|
|
127
|
+
*
|
|
128
|
+
* Default: 60
|
|
129
|
+
*/
|
|
130
|
+
scrollDuration?: number | undefined;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The number of milliseconds to wait before requesting options from the server or null.
|
|
134
|
+
* If null, throttling is disabled.
|
|
135
|
+
*
|
|
136
|
+
* Default: 300
|
|
137
|
+
*/
|
|
138
|
+
loadThrottle?: number | undefined;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* If true, the "load" function will be called upon control initialization (with an empty search).
|
|
142
|
+
* Alternatively it can be set to "focus" to call the "load" function when control receives focus.
|
|
143
|
+
*
|
|
144
|
+
* Default: false
|
|
145
|
+
*/
|
|
146
|
+
preload?: boolean | 'focus' | undefined;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The element the dropdown menu is appended to. This should be "body" or null.
|
|
150
|
+
* If null, the dropdown will be appended as a child of the selectize control.
|
|
151
|
+
*
|
|
152
|
+
* Default: null
|
|
153
|
+
*/
|
|
154
|
+
dropdownParent?: string | undefined;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Sets if the "Add..." option should be the default selection in the dropdown.
|
|
158
|
+
*
|
|
159
|
+
* Default: false
|
|
160
|
+
*/
|
|
161
|
+
addPrecedence?: boolean | undefined;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* If true, the tab key will choose the currently selected item.
|
|
165
|
+
*
|
|
166
|
+
* Default: false
|
|
167
|
+
*/
|
|
168
|
+
selectOnTab?: boolean | undefined;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Plugins to use
|
|
172
|
+
*
|
|
173
|
+
* Default: null
|
|
174
|
+
*/
|
|
175
|
+
plugins?: string[] | IPluginOption[] | { [name: string]: any } | undefined;
|
|
176
|
+
|
|
177
|
+
// Data / Searching
|
|
178
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Options available to select; array of objects. If your element is <select> with <option>s specified this
|
|
182
|
+
* property gets populated accordingly. Setting this property is convenient if you have your data as an
|
|
183
|
+
* array and want to automatically generate the <option>s.
|
|
184
|
+
*
|
|
185
|
+
* Default: []
|
|
186
|
+
*/
|
|
187
|
+
options?: U[] | undefined;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The <option> attribute from which to read JSON data about the option.
|
|
191
|
+
*
|
|
192
|
+
* Default: "data-data"
|
|
193
|
+
*/
|
|
194
|
+
dataAttr?: string | undefined;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The name of the property to use as the "value" when an item is selected.
|
|
198
|
+
*
|
|
199
|
+
* Default: "value"
|
|
200
|
+
*/
|
|
201
|
+
valueField?: string | undefined;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Option groups that options will be bucketed into.
|
|
205
|
+
* If your element is a <select> with <optgroup>s this property gets populated automatically.
|
|
206
|
+
* Make sure each object in the array has a property named whatever "optgroupValueField" is set to.
|
|
207
|
+
*/
|
|
208
|
+
optgroups?: U[] | undefined;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* The name of the option group property that serves as its unique identifier.
|
|
212
|
+
*
|
|
213
|
+
* Default: "value"
|
|
214
|
+
*/
|
|
215
|
+
optgroupValueField?: string | undefined;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* The name of the property to render as an option / item label (not needed when custom rendering
|
|
219
|
+
* functions are defined).
|
|
220
|
+
*
|
|
221
|
+
* Default: "text"
|
|
222
|
+
*/
|
|
223
|
+
labelField?: string | undefined;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The name of the property to render as an option group label (not needed when custom rendering
|
|
227
|
+
* functions are defined).
|
|
228
|
+
*
|
|
229
|
+
* Default: "label"
|
|
230
|
+
*/
|
|
231
|
+
optgroupLabelField?: string | undefined;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The name of the property to group items by.
|
|
235
|
+
*
|
|
236
|
+
* Default: "optgroup"
|
|
237
|
+
*/
|
|
238
|
+
optgroupField?: string | undefined;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* The name of the property to disabled option and optgroup.
|
|
242
|
+
*
|
|
243
|
+
* Default: 'disabled'
|
|
244
|
+
*/
|
|
245
|
+
disabledField?: string | undefined;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* A single field or an array of fields to sort by. Each item in the array should be an object containing at
|
|
249
|
+
* least a "field" property. Optionally, "direction" can be set to "asc" or "desc". The order of the array
|
|
250
|
+
* defines the sort precedence.
|
|
251
|
+
*
|
|
252
|
+
* Unless present, a special "$score" field will be automatically added to the beginning of the sort list.
|
|
253
|
+
* This will make results sorted primarily by match quality (descending).
|
|
254
|
+
*
|
|
255
|
+
* Default: "$order"
|
|
256
|
+
*/
|
|
257
|
+
sortField?: string | { field: string, direction?: 'asc' | 'desc' | undefined }[] | undefined;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* An array of property names to analyze when filtering options.
|
|
261
|
+
*
|
|
262
|
+
* Default: ["text"]
|
|
263
|
+
*/
|
|
264
|
+
searchField?: string | string[] | undefined;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* When searching for multiple terms (separated by a space), this is the operator used. Can be "and" or "or".
|
|
268
|
+
*
|
|
269
|
+
* Default: "and"
|
|
270
|
+
*/
|
|
271
|
+
searchConjunction?: string | undefined;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* If truthy, Selectize will make all optgroups be in the same order as they were added (by the `$order`
|
|
275
|
+
* property). Otherwise, it will order based on the score of the results in each.
|
|
276
|
+
*
|
|
277
|
+
* Default: false
|
|
278
|
+
*/
|
|
279
|
+
lockOptgroupOrder?: boolean | undefined;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* An array of optgroup values that indicates the order they should be listed in in the dropdown.
|
|
283
|
+
* If not provided, groups will be ordered by the ranking of the options within them.
|
|
284
|
+
*
|
|
285
|
+
* Default: null
|
|
286
|
+
*/
|
|
287
|
+
optgroupOrder?: string[] | undefined;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Copy the original input classes to the Dropdown element.
|
|
291
|
+
*
|
|
292
|
+
* Default: true
|
|
293
|
+
*/
|
|
294
|
+
copyClassesToDropdown?: boolean | undefined;
|
|
295
|
+
|
|
296
|
+
// Callbacks
|
|
297
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Invoked when new options should be loaded from the server.
|
|
301
|
+
*/
|
|
302
|
+
load?(query: string, callback: Function): any;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Overrides the scoring function used to sort available options. The provided function should return a
|
|
306
|
+
* function that returns a number greater than or equal to zero to represent the "score" of an item
|
|
307
|
+
* (the function's first argument). If 0, the option is declared not a match.
|
|
308
|
+
*/
|
|
309
|
+
score?(search: ISearch): (item: any) => number;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Invoked once the control is completely initialized.
|
|
313
|
+
*/
|
|
314
|
+
onInitialize?(): any;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Invoked when the control gains focus.
|
|
318
|
+
*/
|
|
319
|
+
onFocus?(): any;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Invoked when the control loses focus.
|
|
323
|
+
*/
|
|
324
|
+
onBlur?(): any;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Invoked when the value of the control changes.
|
|
328
|
+
*
|
|
329
|
+
* If single select, value is of type T.
|
|
330
|
+
* If multi select, value is of type T[].
|
|
331
|
+
*/
|
|
332
|
+
onChange?(value: any): any;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Invoked when an item is selected.
|
|
336
|
+
*/
|
|
337
|
+
onItemAdd?(value: T, item: JQuery): any;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Invoked when an item is deselected.
|
|
341
|
+
*/
|
|
342
|
+
onItemRemove?(value: T): any;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Invoked when the control is manually cleared via the clear() method.
|
|
346
|
+
*/
|
|
347
|
+
onClear?(): any;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Invoked when the user attempts to delete the current selection.
|
|
351
|
+
*/
|
|
352
|
+
onDelete?(values: T[]): any;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Invoked when a new option is added to the available options list.
|
|
356
|
+
*/
|
|
357
|
+
onOptionAdd?(value: T, data: U): any;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Invoked when an option is removed from the available options.
|
|
361
|
+
*/
|
|
362
|
+
onOptionRemove?(value: T): any;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Invoked when the dropdown opens.
|
|
366
|
+
*/
|
|
367
|
+
onDropdownOpen?(dropdown: JQuery): any;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Invoked when the dropdown closes.
|
|
371
|
+
*/
|
|
372
|
+
onDropdownClose?(dropdown: JQuery): any;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Invoked when the user types while filtering options.
|
|
376
|
+
*/
|
|
377
|
+
onType?(srt: string): any;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Invoked when new options have been loaded and added to the control (via the "load" option or "load" API method).
|
|
381
|
+
*/
|
|
382
|
+
onLoad?(data: U[]): any;
|
|
383
|
+
|
|
384
|
+
// Rendering
|
|
385
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
386
|
+
|
|
387
|
+
render?: ICustomRenderers<U> | undefined;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Custom rendering functions. Each function should accept two arguments: "data" and "escape" and return
|
|
392
|
+
* HTML (string) with a single root element. The "escape" argument is a function that takes a string and
|
|
393
|
+
* escapes all special HTML characters. This is very important to use to prevent XSS vulnerabilities.
|
|
394
|
+
*/
|
|
395
|
+
interface ICustomRenderers<U> {
|
|
396
|
+
// An option in the dropdown list of available options.
|
|
397
|
+
option?(data: U, escape: (input: string) => string): string;
|
|
398
|
+
|
|
399
|
+
// An item the user has selected.
|
|
400
|
+
item?(data: U, escape: (input: string) => string): string;
|
|
401
|
+
|
|
402
|
+
// The "create new" option at the bottom of the dropdown. The data contains one property: "input"
|
|
403
|
+
// (which is what the user has typed).
|
|
404
|
+
option_create?(data: U, escape: (input: string) => string): string;
|
|
405
|
+
|
|
406
|
+
// The header of an option group.
|
|
407
|
+
optgroup_header?(data: U, escape: (input: string) => string): string;
|
|
408
|
+
|
|
409
|
+
// The wrapper for an optgroup. The "html" property in the data will be the raw html of the optgroup's header
|
|
410
|
+
// and options.
|
|
411
|
+
optgroup?(data: U, escape: (input: string) => string): string;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// see https://github.com/brianreavis/selectize.js/blob/master/docs/api.md
|
|
415
|
+
interface IApi<T, U> {
|
|
416
|
+
/**
|
|
417
|
+
* An array of selected values.
|
|
418
|
+
*/
|
|
419
|
+
items: T[];
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* An object containing the entire pool of options. The object is keyed by each object's value.
|
|
423
|
+
*/
|
|
424
|
+
options: { [value: string]: U };
|
|
425
|
+
|
|
426
|
+
// Dropdown Options
|
|
427
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Adds an available option. If it already exists, nothing will happen.
|
|
431
|
+
* Note: this does not refresh the options list dropdown (use refreshOptions() for that).
|
|
432
|
+
*/
|
|
433
|
+
addOption(data: U): void;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Updates an option available for selection. If it is visible in the selected items or options dropdown,
|
|
437
|
+
* it will be re-rendered automatically.
|
|
438
|
+
*/
|
|
439
|
+
updateOption(value: T, data: U): void;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Removes the option identified by the given value.
|
|
443
|
+
*/
|
|
444
|
+
removeOption(value: T): void;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Removes all options from the control.
|
|
448
|
+
*/
|
|
449
|
+
clearOptions(): void;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Retrieves the jQuery element for the option identified by the given value.
|
|
453
|
+
*/
|
|
454
|
+
getOption(value: T): JQuery;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Retrieves the jQuery element for the previous or next option, relative to the currently highlighted option.
|
|
458
|
+
* The "direction" argument should be 1 for "next" or -1 for "previous".
|
|
459
|
+
*/
|
|
460
|
+
getAdjacentOption(value: T, direction: number): void;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Refreshes the list of available options shown in the autocomplete dropdown menu.
|
|
464
|
+
*/
|
|
465
|
+
refreshOptions(triggerDropdown: boolean): void;
|
|
466
|
+
|
|
467
|
+
// Selected Items
|
|
468
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Resets / clears all selected items from the control.
|
|
472
|
+
*/
|
|
473
|
+
clear(silent?: boolean): void;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Returns the jQuery element of the item matching the given value.
|
|
477
|
+
*/
|
|
478
|
+
getItem(value: T): JQuery;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* "Selects" an item. Adds it to the list at the current caret position.
|
|
482
|
+
*/
|
|
483
|
+
addItem(value: T, silent?: boolean): void;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Removes the selected item matching the provided value.
|
|
487
|
+
*/
|
|
488
|
+
removeItem(value: T, silent?: boolean): void;
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Invokes the "create" method provided in the selectize options that should provide the data for the
|
|
492
|
+
* new item, given the user input. Once this completes, it will be added to the item list.
|
|
493
|
+
*/
|
|
494
|
+
createItem(value: T, triggerDropdown?: boolean, callback?: (data?: any) => void): void;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Re-renders the selected item lists.
|
|
498
|
+
*/
|
|
499
|
+
refreshItems(): void;
|
|
500
|
+
|
|
501
|
+
// Optgroups
|
|
502
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Registers a new optgroup for options to be bucketed into.
|
|
506
|
+
* The "id" argument refers to a value of the property in option identified by the "optgroupField" setting.
|
|
507
|
+
*/
|
|
508
|
+
addOptionGroup(id: string, data: U): void;
|
|
509
|
+
|
|
510
|
+
// Events
|
|
511
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Adds an event listener.
|
|
515
|
+
*/
|
|
516
|
+
on(eventName: string, handler: Function): void;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Removes an event listener. If no handler is provided, all event listeners are removed.
|
|
520
|
+
*/
|
|
521
|
+
off(eventName: string, handler?: Function): void;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Triggers event listeners.
|
|
525
|
+
*/
|
|
526
|
+
trigger(eventName: string, ...args: any[]): void;
|
|
527
|
+
|
|
528
|
+
// Dropdown Actions
|
|
529
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Shows the autocomplete dropdown containing the available options.
|
|
533
|
+
*/
|
|
534
|
+
open(): void;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Closes the autocomplete dropdown menu.
|
|
538
|
+
*/
|
|
539
|
+
close(): void;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Calculates and applies the appropriate position of the dropdown.
|
|
543
|
+
*/
|
|
544
|
+
positionDropdown(): void;
|
|
545
|
+
|
|
546
|
+
// Other
|
|
547
|
+
// ------------------------------------------------------------------------------------------------------------
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Destroys the control and unbinds event listeners so that it can be garbage collected.
|
|
551
|
+
*/
|
|
552
|
+
destroy(): void;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Loads options by invoking the the provided function. The function should accept one argument (callback)
|
|
556
|
+
* and invoke the callback with the results once they are available.
|
|
557
|
+
*/
|
|
558
|
+
load(callback: (results: any) => any): void;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Brings the control into focus.
|
|
562
|
+
*/
|
|
563
|
+
focus(): void;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Forces the control out of focus.
|
|
567
|
+
*/
|
|
568
|
+
blur(): void;
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Disables user input on the control (note: the control can still receive focus).
|
|
572
|
+
*/
|
|
573
|
+
lock(): void;
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Re-enables user input on the control.
|
|
577
|
+
*/
|
|
578
|
+
unlock(): void;
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Disables user input on the control completely. While disabled, it cannot receive focus.
|
|
582
|
+
*/
|
|
583
|
+
disable(): void;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Enables the control so that it can respond to focus and user input.
|
|
587
|
+
*/
|
|
588
|
+
enable(): void;
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Returns the value of the control. If multiple items can be selected (e.g. <select multiple>), this
|
|
592
|
+
* returns an array. If only one item can be selected, this returns a string.
|
|
593
|
+
*/
|
|
594
|
+
getValue(): any;
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Resets the selected items to the given value(s).
|
|
598
|
+
*/
|
|
599
|
+
setValue(value: T, silent?: boolean): void;
|
|
600
|
+
setValue(value: T[], silent?: boolean): void;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Moves the caret to the specified position ("index" being the index in the list of selected items).
|
|
604
|
+
*/
|
|
605
|
+
setCaret(index: number): void;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Returns whether or not the user can select more items.
|
|
609
|
+
*/
|
|
610
|
+
isFull(): boolean;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Clears the render cache. Takes an optional template argument (e.g. "option", "item") to clear only that cache.
|
|
614
|
+
*/
|
|
615
|
+
clearCache(template?: string): void;
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* When the `settings.placeholder` value is changed, the new placeholder will be displayed.
|
|
619
|
+
*/
|
|
620
|
+
updatePlaceholder(): void;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
interface ISearchToken {
|
|
624
|
+
regex: RegExp;
|
|
625
|
+
string: string;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
interface ISearchResult {
|
|
629
|
+
id: string;
|
|
630
|
+
score: number;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
interface ISearch {
|
|
634
|
+
/**
|
|
635
|
+
* Original search options.
|
|
636
|
+
*/
|
|
637
|
+
options: any;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* The raw user input
|
|
641
|
+
*/
|
|
642
|
+
query: string;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* An array containing parsed search tokens. A token is an object containing two properties: "string" and "regex".
|
|
646
|
+
*/
|
|
647
|
+
tokens: ISearchToken[];
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* The total number of results.
|
|
651
|
+
*/
|
|
652
|
+
total: number;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* A list of matched results. Each result is an object containing two properties: "score" and "id".
|
|
656
|
+
*/
|
|
657
|
+
items: ISearchResult[];
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// see https://github.com/selectize/selectize.js/blob/master/docs/plugins.md
|
|
661
|
+
interface IPluginOption {
|
|
662
|
+
name: string;
|
|
663
|
+
options: any;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
interface JQuery {
|
|
668
|
+
selectize(options?: Selectize.IOptions<any, any>): JQuery;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
interface HTMLElement {
|
|
672
|
+
selectize: Selectize.IApi<any, any>;
|
|
673
|
+
}
|