@danielgindi/selectbox 2.0.58 → 2.0.59
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/dist/lib.cjs.js +44 -528
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +47 -528
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +44 -528
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/dist/types/DropList.d.ts +15 -153
- package/dist/types/DropList.d.ts.map +1 -1
- package/dist/types/SelectBox.d.ts +12 -300
- package/dist/types/SelectBox.d.ts.map +1 -1
- package/dist/types/types.d.ts +17 -2
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +10 -10
- package/vue/DropList.vue +189 -176
- package/vue/SelectBox.vue +313 -388
- package/vue/utils/slots.js +22 -40
package/dist/lib.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 2.0.
|
|
2
|
+
* @danielgindi/selectbox 2.0.59
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
(function(global, factory) {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
return to;
|
|
34
34
|
};
|
|
35
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
35
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
36
36
|
value: mod,
|
|
37
37
|
enumerable: true
|
|
38
38
|
}) : target, mod));
|
|
@@ -138,9 +138,6 @@
|
|
|
138
138
|
filterEmptyGroups: false
|
|
139
139
|
};
|
|
140
140
|
var DropList = class DropList {
|
|
141
|
-
/**
|
|
142
|
-
* @param {DropList.Options} options
|
|
143
|
-
*/
|
|
144
141
|
constructor(options) {
|
|
145
142
|
const o = { ...DefaultOptions };
|
|
146
143
|
for (let [key, value] of Object.entries(
|
|
@@ -346,19 +343,13 @@
|
|
|
346
343
|
}
|
|
347
344
|
/**
|
|
348
345
|
* Returns true if other is an inclusive descendant of node, and false otherwise.
|
|
349
|
-
*
|
|
350
|
-
* @param {boolean} [considerSubmenus=true]
|
|
351
|
-
* @returns {boolean}
|
|
346
|
+
* Accepts `EventTarget` (not just `Node`) since callers pass `event.target`/`event.relatedTarget` directly.
|
|
352
347
|
*/
|
|
353
348
|
elContains(other, considerSubmenus = true) {
|
|
354
349
|
if (this.el.contains(other)) return true;
|
|
355
350
|
if (considerSubmenus && this._p.currentSubDropList?.droplist?.elContains(other)) return true;
|
|
356
351
|
return false;
|
|
357
352
|
}
|
|
358
|
-
/**
|
|
359
|
-
* @param {string|string[]} classes
|
|
360
|
-
* @returns {DropList}
|
|
361
|
-
*/
|
|
362
353
|
setAdditionalClasses(classes) {
|
|
363
354
|
const p = this._p;
|
|
364
355
|
p.additionalClasses = classes;
|
|
@@ -367,8 +358,6 @@
|
|
|
367
358
|
}
|
|
368
359
|
/**
|
|
369
360
|
* Sets the appropriate direction for the droplist
|
|
370
|
-
* @param {'ltr'|'rtl'|'auto'} direction
|
|
371
|
-
* @return {DropList}
|
|
372
361
|
*/
|
|
373
362
|
setDirection(direction) {
|
|
374
363
|
const p = this._p;
|
|
@@ -378,46 +367,26 @@
|
|
|
378
367
|
}
|
|
379
368
|
/**
|
|
380
369
|
* Gets the supplied direction for the droplist
|
|
381
|
-
* @return {'ltr'|'rtl'|'auto'}
|
|
382
370
|
*/
|
|
383
371
|
getDirection() {
|
|
384
372
|
return this._p.direction;
|
|
385
373
|
}
|
|
386
|
-
/**
|
|
387
|
-
* @param {string} prop
|
|
388
|
-
* @returns {DropList}
|
|
389
|
-
*/
|
|
390
374
|
setLabelProp(prop) {
|
|
391
375
|
const p = this._p;
|
|
392
376
|
p.labelProp = prop;
|
|
393
377
|
return this;
|
|
394
378
|
}
|
|
395
|
-
/**
|
|
396
|
-
*
|
|
397
|
-
* @property {function(item: DropList.ItemBase, itemEl: Element):(*|false)} [fn] Function to call when rendering an item element
|
|
398
|
-
* @returns {DropList}
|
|
399
|
-
*/
|
|
400
379
|
setRenderItem(fn) {
|
|
401
380
|
const p = this._p;
|
|
402
381
|
p.renderItem = fn;
|
|
403
382
|
return this;
|
|
404
383
|
}
|
|
405
|
-
/**
|
|
406
|
-
*
|
|
407
|
-
* @property {function(item: DropList.ItemBase, itemEl: Element)} [fn] Function to call when rendering an item element
|
|
408
|
-
* @returns {DropList}
|
|
409
|
-
*/
|
|
410
384
|
setUnrenderItem(fn) {
|
|
411
385
|
const p = this._p;
|
|
412
386
|
p.unrenderItem = fn;
|
|
413
387
|
this._setupUnrenderFunction();
|
|
414
388
|
return this;
|
|
415
389
|
}
|
|
416
|
-
/**
|
|
417
|
-
* @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
|
|
418
|
-
* @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
|
|
419
|
-
* @returns {DropList}
|
|
420
|
-
*/
|
|
421
390
|
setRenderNoResultsItem(render, unrender) {
|
|
422
391
|
const p = this._p;
|
|
423
392
|
p.renderNoResultsItem = render;
|
|
@@ -463,10 +432,6 @@
|
|
|
463
432
|
});
|
|
464
433
|
return this;
|
|
465
434
|
}
|
|
466
|
-
/**
|
|
467
|
-
* @param {string} prop
|
|
468
|
-
* @returns {DropList}
|
|
469
|
-
*/
|
|
470
435
|
setValueProp(prop) {
|
|
471
436
|
const p = this._p;
|
|
472
437
|
p.valueProp = prop;
|
|
@@ -554,19 +519,16 @@
|
|
|
554
519
|
return true;
|
|
555
520
|
}
|
|
556
521
|
/**
|
|
557
|
-
*
|
|
558
|
-
* @param
|
|
559
|
-
* @param {number} [atIndex=-1] The index to insert at (or -1)
|
|
560
|
-
* @returns {DropList}
|
|
522
|
+
* @param item The item to add. It is copied.
|
|
523
|
+
* @param atIndex The index to insert at (or -1)
|
|
561
524
|
*/
|
|
562
525
|
addItem(item, atIndex = -1) {
|
|
563
526
|
return this.addItems([item], atIndex);
|
|
564
527
|
}
|
|
565
528
|
/**
|
|
566
529
|
* Adds items to the menu and renders
|
|
567
|
-
* @param
|
|
568
|
-
* @param
|
|
569
|
-
* @returns {DropList}
|
|
530
|
+
* @param itemsToAdd The items to add. These are copied.
|
|
531
|
+
* @param atIndex The index to insert at (or -1)
|
|
570
532
|
*/
|
|
571
533
|
addItems(itemsToAdd, atIndex = -1) {
|
|
572
534
|
const p = this._p, labelProp = p.labelProp, valueProp = p.valueProp;
|
|
@@ -608,8 +570,7 @@
|
|
|
608
570
|
}
|
|
609
571
|
/**
|
|
610
572
|
* Replaces all current items with the supplied items
|
|
611
|
-
* @param
|
|
612
|
-
* @returns {DropList}
|
|
573
|
+
* @param items The items to set. These are copied.
|
|
613
574
|
*/
|
|
614
575
|
setItems(items) {
|
|
615
576
|
const p = this._p;
|
|
@@ -754,8 +715,6 @@
|
|
|
754
715
|
/**
|
|
755
716
|
* Return the item element at the given original index, if it exists.
|
|
756
717
|
* The item may not be currently rendered, and null will be returned
|
|
757
|
-
* @param index
|
|
758
|
-
* @returns {HTMLElement|null}
|
|
759
718
|
*/
|
|
760
719
|
itemElementAtIndex(index) {
|
|
761
720
|
const p = this._p;
|
|
@@ -766,16 +725,10 @@
|
|
|
766
725
|
/**
|
|
767
726
|
* Return the item element at the given index, if it exists.
|
|
768
727
|
* The item may not be currently rendered, and null will be returned
|
|
769
|
-
* @param index
|
|
770
|
-
* @returns {HTMLElement|null}
|
|
771
728
|
*/
|
|
772
729
|
filteredElementItemAtIndex(index) {
|
|
773
730
|
return this._p.virtualListHelper.getItemElementAt(index) ?? null;
|
|
774
731
|
}
|
|
775
|
-
/**
|
|
776
|
-
* @param {function(dropList: DropList):DropList.PositionOptions} fn
|
|
777
|
-
* @returns {DropList}
|
|
778
|
-
*/
|
|
779
732
|
setPositionOptionsProvider(fn) {
|
|
780
733
|
const p = this._p;
|
|
781
734
|
if (p.positionOptionsProvider === fn) return this;
|
|
@@ -783,17 +736,12 @@
|
|
|
783
736
|
this.relayout();
|
|
784
737
|
return this;
|
|
785
738
|
}
|
|
786
|
-
/**
|
|
787
|
-
* @returns {function(dropList: DropList):DropList.PositionOptions|null}
|
|
788
|
-
*/
|
|
789
739
|
getPositionOptionsProvider() {
|
|
790
740
|
return this._p.positionOptionsProvider;
|
|
791
741
|
}
|
|
792
742
|
/**
|
|
793
743
|
* Sets a handler to intercept internal errors/warnings (e.g. from a throwing `renderItem`/`unrenderItem`)
|
|
794
744
|
* instead of the default `console.error`/`console.warn`.
|
|
795
|
-
* @param {DropList.LibraryErrorHandler|null} [fn]
|
|
796
|
-
* @returns {DropList}
|
|
797
745
|
*/
|
|
798
746
|
setOnError(fn) {
|
|
799
747
|
const p = this._p;
|
|
@@ -801,15 +749,14 @@
|
|
|
801
749
|
return this;
|
|
802
750
|
}
|
|
803
751
|
/**
|
|
804
|
-
*
|
|
752
|
+
* Gets the current `onError` handler, if any.
|
|
805
753
|
*/
|
|
806
754
|
getOnError() {
|
|
807
755
|
return this._p.onError;
|
|
808
756
|
}
|
|
809
757
|
/**
|
|
810
|
-
* @param
|
|
811
|
-
* @param
|
|
812
|
-
* @returns {DropList}
|
|
758
|
+
* @param term the search term to set
|
|
759
|
+
* @param performSearch should actually perform the search, or just set the input's text?
|
|
813
760
|
*/
|
|
814
761
|
setSearchTerm(term, performSearch = false) {
|
|
815
762
|
const p = this._p;
|
|
@@ -914,26 +861,15 @@
|
|
|
914
861
|
if (p.items) return p.items.length;
|
|
915
862
|
return 0;
|
|
916
863
|
}
|
|
917
|
-
/**
|
|
918
|
-
* @param {string} noResultsText
|
|
919
|
-
* @returns {DropList}
|
|
920
|
-
*/
|
|
921
864
|
setNoResultsText(noResultsText) {
|
|
922
865
|
const p = this._p;
|
|
923
866
|
p.noResultsText = noResultsText;
|
|
924
867
|
if (p.hasNoResultsItem) p.virtualListHelper.refreshItemAt(0).render();
|
|
925
868
|
return this;
|
|
926
869
|
}
|
|
927
|
-
/**
|
|
928
|
-
* @returns {string}
|
|
929
|
-
*/
|
|
930
870
|
getNoResultsText() {
|
|
931
871
|
return this._p.noResultsText;
|
|
932
872
|
}
|
|
933
|
-
/**
|
|
934
|
-
* @param {number} window
|
|
935
|
-
* @returns {DropList}
|
|
936
|
-
*/
|
|
937
873
|
setFilterThrottleWindow(window) {
|
|
938
874
|
const p = this._p;
|
|
939
875
|
p.filterThrottleWindow = window;
|
|
@@ -943,16 +879,9 @@
|
|
|
943
879
|
if (isScheduled) p.throttledRefilterItems();
|
|
944
880
|
return this;
|
|
945
881
|
}
|
|
946
|
-
/**
|
|
947
|
-
* @returns {number}
|
|
948
|
-
*/
|
|
949
882
|
getFilterThrottleWindow() {
|
|
950
883
|
return this._p.filterThrottleWindow;
|
|
951
884
|
}
|
|
952
|
-
/**
|
|
953
|
-
* @param {boolean} value
|
|
954
|
-
* @returns {DropList}
|
|
955
|
-
*/
|
|
956
885
|
setFilterOnEmptyTerm(value) {
|
|
957
886
|
const p = this._p;
|
|
958
887
|
if (p.filterOnEmptyTerm === value) return this;
|
|
@@ -960,16 +889,9 @@
|
|
|
960
889
|
p.throttledRefilterItems();
|
|
961
890
|
return this;
|
|
962
891
|
}
|
|
963
|
-
/**
|
|
964
|
-
* @returns {boolean}
|
|
965
|
-
*/
|
|
966
892
|
getFilterOnEmptyTerm() {
|
|
967
893
|
return this._p.filterOnEmptyTerm;
|
|
968
894
|
}
|
|
969
|
-
/**
|
|
970
|
-
* @param {boolean} value
|
|
971
|
-
* @returns {DropList}
|
|
972
|
-
*/
|
|
973
895
|
setFilterGroups(value) {
|
|
974
896
|
const p = this._p;
|
|
975
897
|
if (p.filterGroups === value) return this;
|
|
@@ -977,52 +899,30 @@
|
|
|
977
899
|
p.throttledRefilterItems();
|
|
978
900
|
return this;
|
|
979
901
|
}
|
|
980
|
-
/**
|
|
981
|
-
* @returns {boolean}
|
|
982
|
-
*/
|
|
983
902
|
getFilterGroups() {
|
|
984
903
|
return this._p.filterGroups;
|
|
985
904
|
}
|
|
986
|
-
|
|
987
|
-
* @param {boolean} value
|
|
988
|
-
* @returns {DropList}
|
|
989
|
-
*/
|
|
990
|
-
setFilterEmptyGroups(value) {
|
|
905
|
+
setFilterEmptyGroups(value = true) {
|
|
991
906
|
const p = this._p;
|
|
992
907
|
if (p.filterEmptyGroups === value) return this;
|
|
993
908
|
p.filterEmptyGroups = value;
|
|
994
909
|
p.throttledRefilterItems();
|
|
995
910
|
return this;
|
|
996
911
|
}
|
|
997
|
-
/**
|
|
998
|
-
* @returns {boolean}
|
|
999
|
-
*/
|
|
1000
912
|
getFilterEmptyGroups() {
|
|
1001
913
|
return this._p.filterEmptyGroups;
|
|
1002
914
|
}
|
|
1003
|
-
/**
|
|
1004
|
-
* @param {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)} fn
|
|
1005
|
-
* @returns {DropList}
|
|
1006
|
-
*/
|
|
1007
915
|
setFilterFn(fn) {
|
|
1008
916
|
const p = this._p;
|
|
917
|
+
fn ??= null;
|
|
1009
918
|
if (p.filterFn === fn) return this;
|
|
1010
919
|
p.filterFn = fn;
|
|
1011
920
|
p.throttledRefilterItems();
|
|
1012
921
|
return this;
|
|
1013
922
|
}
|
|
1014
|
-
/**
|
|
1015
|
-
* @returns {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)}
|
|
1016
|
-
*/
|
|
1017
923
|
getFilterFn() {
|
|
1018
924
|
return this._p.filterFn;
|
|
1019
925
|
}
|
|
1020
|
-
/**
|
|
1021
|
-
*
|
|
1022
|
-
* @param {DropList.PositionOptions} [positionOptions]
|
|
1023
|
-
* @returns {DropList}
|
|
1024
|
-
* @public
|
|
1025
|
-
*/
|
|
1026
926
|
relayout(positionOptions) {
|
|
1027
927
|
const p = this._p, el = p.el, menuEl = p.menuEl;
|
|
1028
928
|
if (!this.isVisible()) return this;
|
|
@@ -1164,10 +1064,6 @@
|
|
|
1164
1064
|
}
|
|
1165
1065
|
/**
|
|
1166
1066
|
* Set the checked mode of a specific value.
|
|
1167
|
-
* @public
|
|
1168
|
-
* @param {*} value - array of values to check
|
|
1169
|
-
* @param {boolean} checked - will the value be checked?
|
|
1170
|
-
* @returns {DropList} self
|
|
1171
1067
|
*/
|
|
1172
1068
|
setItemChecked(value, checked) {
|
|
1173
1069
|
const p = this._p;
|
|
@@ -1187,9 +1083,6 @@
|
|
|
1187
1083
|
}
|
|
1188
1084
|
/**
|
|
1189
1085
|
* Set the checked values. All the other values will be unchecked,
|
|
1190
|
-
* @public
|
|
1191
|
-
* @param {Array<*>} values - array of values to check
|
|
1192
|
-
* @returns {DropList} self
|
|
1193
1086
|
*/
|
|
1194
1087
|
setCheckedValues(values) {
|
|
1195
1088
|
const p = this._p;
|
|
@@ -1212,11 +1105,9 @@
|
|
|
1212
1105
|
}
|
|
1213
1106
|
/**
|
|
1214
1107
|
* Get all checked values. Returns array of item values.
|
|
1215
|
-
* @
|
|
1216
|
-
* @param {boolean} excludeGroups=false Exclude group items
|
|
1217
|
-
* @returns {Array<*>} self
|
|
1108
|
+
* @param excludeGroups Exclude group items
|
|
1218
1109
|
*/
|
|
1219
|
-
getCheckedValues(excludeGroups) {
|
|
1110
|
+
getCheckedValues(excludeGroups = false) {
|
|
1220
1111
|
const p = this._p;
|
|
1221
1112
|
excludeGroups = excludeGroups && p.groupCount > 0;
|
|
1222
1113
|
let values = [];
|
|
@@ -1230,11 +1121,9 @@
|
|
|
1230
1121
|
}
|
|
1231
1122
|
/**
|
|
1232
1123
|
* Get all checked items. Returns array of actual item data object.
|
|
1233
|
-
* @
|
|
1234
|
-
* @param {boolean} excludeGroups=false Exclude group items
|
|
1235
|
-
* @returns {DropList.Item[]}
|
|
1124
|
+
* @param excludeGroups Exclude group items
|
|
1236
1125
|
*/
|
|
1237
|
-
getCheckedItems(excludeGroups) {
|
|
1126
|
+
getCheckedItems(excludeGroups = false) {
|
|
1238
1127
|
const p = this._p;
|
|
1239
1128
|
excludeGroups = excludeGroups && p.groupCount > 0;
|
|
1240
1129
|
const items = [];
|
|
@@ -1246,12 +1135,6 @@
|
|
|
1246
1135
|
}
|
|
1247
1136
|
return items;
|
|
1248
1137
|
}
|
|
1249
|
-
/**
|
|
1250
|
-
*
|
|
1251
|
-
* @param {DropList.PositionOptions?} [positionOptions]
|
|
1252
|
-
* @returns {DropList}
|
|
1253
|
-
* @public
|
|
1254
|
-
*/
|
|
1255
1138
|
show(positionOptions) {
|
|
1256
1139
|
const p = this._p;
|
|
1257
1140
|
p.hiding = false;
|
|
@@ -1335,7 +1218,6 @@
|
|
|
1335
1218
|
/**
|
|
1336
1219
|
* Change visibility of the header element
|
|
1337
1220
|
* You should probably call `relayout()` after this.
|
|
1338
|
-
* @param {boolean} visible
|
|
1339
1221
|
*/
|
|
1340
1222
|
setHeaderVisible(visible) {
|
|
1341
1223
|
if (this.isHeaderVisible() === !!visible) return;
|
|
@@ -1344,14 +1226,12 @@
|
|
|
1344
1226
|
}
|
|
1345
1227
|
/**
|
|
1346
1228
|
* Is the header element visible?
|
|
1347
|
-
* @returns {boolean}
|
|
1348
1229
|
*/
|
|
1349
1230
|
isHeaderVisible() {
|
|
1350
1231
|
return !!this._p.headerEl.parentNode;
|
|
1351
1232
|
}
|
|
1352
1233
|
/**
|
|
1353
1234
|
* Get a reference to the header element in order to add custom content.
|
|
1354
|
-
* @returns {Element}
|
|
1355
1235
|
*/
|
|
1356
1236
|
getHeaderElement() {
|
|
1357
1237
|
return this._p.headerEl;
|
|
@@ -1359,7 +1239,6 @@
|
|
|
1359
1239
|
/**
|
|
1360
1240
|
* Change visibility of the footer element
|
|
1361
1241
|
* You should probably call `relayout()` after this.
|
|
1362
|
-
* @param {boolean} visible
|
|
1363
1242
|
*/
|
|
1364
1243
|
setFooterVisible(visible) {
|
|
1365
1244
|
if (this.isFooterVisible() === !!visible) return;
|
|
@@ -1368,14 +1247,12 @@
|
|
|
1368
1247
|
}
|
|
1369
1248
|
/**
|
|
1370
1249
|
* Is the footer element visible?
|
|
1371
|
-
* @returns {boolean}
|
|
1372
1250
|
*/
|
|
1373
1251
|
isFooterVisible() {
|
|
1374
1252
|
return !!this._p.footerEl.parentNode;
|
|
1375
1253
|
}
|
|
1376
1254
|
/**
|
|
1377
1255
|
* Get a reference to the footer element in order to add custom content.
|
|
1378
|
-
* @returns {Element}
|
|
1379
1256
|
*/
|
|
1380
1257
|
getFooterElement() {
|
|
1381
1258
|
return this._p.footerEl;
|
|
@@ -1383,7 +1260,6 @@
|
|
|
1383
1260
|
/**
|
|
1384
1261
|
* Set inline search visibility
|
|
1385
1262
|
* You should probably call `relayout()` after this.
|
|
1386
|
-
* @param {boolean} searchable
|
|
1387
1263
|
*/
|
|
1388
1264
|
setSearchable(searchable) {
|
|
1389
1265
|
const p = this._p;
|
|
@@ -1409,7 +1285,6 @@
|
|
|
1409
1285
|
}
|
|
1410
1286
|
/**
|
|
1411
1287
|
* Set the placeholder text of the inline search box
|
|
1412
|
-
* @param {string} placeholder
|
|
1413
1288
|
*/
|
|
1414
1289
|
setSearchPlaceholder(placeholder) {
|
|
1415
1290
|
const p = this._p;
|
|
@@ -1654,9 +1529,6 @@
|
|
|
1654
1529
|
}
|
|
1655
1530
|
/**
|
|
1656
1531
|
* Register an event handler
|
|
1657
|
-
* @param {(string|'*')?} event
|
|
1658
|
-
* @param {function(any)} handler
|
|
1659
|
-
* @returns {DropList}
|
|
1660
1532
|
*/
|
|
1661
1533
|
on(event, handler) {
|
|
1662
1534
|
this._p.mitt.on(event, handler);
|
|
@@ -1664,9 +1536,6 @@
|
|
|
1664
1536
|
}
|
|
1665
1537
|
/**
|
|
1666
1538
|
* Register a one time event handler
|
|
1667
|
-
* @param {(string|'*')?} event
|
|
1668
|
-
* @param {function(any)} handler
|
|
1669
|
-
* @returns {DropList}
|
|
1670
1539
|
*/
|
|
1671
1540
|
once(event, handler) {
|
|
1672
1541
|
let wrapped = (value) => {
|
|
@@ -1678,9 +1547,6 @@
|
|
|
1678
1547
|
}
|
|
1679
1548
|
/**
|
|
1680
1549
|
* Remove an `handler` for `event`, all events for `event`, or all events completely.
|
|
1681
|
-
* @param {(string|'*')?} event
|
|
1682
|
-
* @param {function(any)} handler
|
|
1683
|
-
* @returns {DropList}
|
|
1684
1550
|
*/
|
|
1685
1551
|
off(event, handler) {
|
|
1686
1552
|
if (!event && !event) this._p.mitt.all.clear();
|
|
@@ -1689,9 +1555,6 @@
|
|
|
1689
1555
|
}
|
|
1690
1556
|
/**
|
|
1691
1557
|
* Emit an event
|
|
1692
|
-
* @param {string} event
|
|
1693
|
-
* @param {any} value
|
|
1694
|
-
* @returns {DropList}
|
|
1695
1558
|
*/
|
|
1696
1559
|
emit(event, value) {
|
|
1697
1560
|
this._p.mitt.emit(event, value);
|
|
@@ -1726,8 +1589,6 @@
|
|
|
1726
1589
|
return this;
|
|
1727
1590
|
}
|
|
1728
1591
|
/**
|
|
1729
|
-
* @param {string} event
|
|
1730
|
-
* @param {*} [data]
|
|
1731
1592
|
* @private
|
|
1732
1593
|
* @internal
|
|
1733
1594
|
*/
|
|
@@ -1870,9 +1731,7 @@
|
|
|
1870
1731
|
case keycode_js.VALUE_UP:
|
|
1871
1732
|
this.previous(event);
|
|
1872
1733
|
break;
|
|
1873
|
-
case keycode_js.VALUE_DOWN:
|
|
1874
|
-
this.next(event);
|
|
1875
|
-
break;
|
|
1734
|
+
case keycode_js.VALUE_DOWN: this.next(event);
|
|
1876
1735
|
}
|
|
1877
1736
|
break;
|
|
1878
1737
|
case keycode_js.VALUE_LEFT:
|
|
@@ -2145,7 +2004,6 @@
|
|
|
2145
2004
|
}
|
|
2146
2005
|
/**
|
|
2147
2006
|
* @private
|
|
2148
|
-
* @returns {DropList} self
|
|
2149
2007
|
* @internal
|
|
2150
2008
|
*/
|
|
2151
2009
|
_measureItem() {
|
|
@@ -2191,8 +2049,7 @@
|
|
|
2191
2049
|
}
|
|
2192
2050
|
/**
|
|
2193
2051
|
* Determines whether the list should be in virtual mode, depending on the item count.
|
|
2194
|
-
* @param
|
|
2195
|
-
* @returns {DropList}
|
|
2052
|
+
* @param targetItemCount item count we are expecting. Defaults to current item count
|
|
2196
2053
|
* @private
|
|
2197
2054
|
* @internal
|
|
2198
2055
|
*/
|
|
@@ -2257,11 +2114,6 @@
|
|
|
2257
2114
|
var DestroyedSymbol = Symbol("destroyed");
|
|
2258
2115
|
var RestMultiItemsSymbol = Symbol("rest_multi_items");
|
|
2259
2116
|
var hasTouchCapability = !!("ontouchstart" in window || window.DocumentTouch && window.document instanceof window.DocumentTouch || window.navigator.maxTouchPoints);
|
|
2260
|
-
/**
|
|
2261
|
-
* @param {Element|EventTarget} el
|
|
2262
|
-
* @param {string} className
|
|
2263
|
-
* @returns {boolean}
|
|
2264
|
-
*/
|
|
2265
2117
|
var hasClass = function(el, className) {
|
|
2266
2118
|
if (el instanceof Element) return el.classList.contains(className);
|
|
2267
2119
|
return false;
|
|
@@ -2317,12 +2169,6 @@
|
|
|
2317
2169
|
closeListWhenLoading: true,
|
|
2318
2170
|
clearInputWhen: ["single_close", "multi_select_single"]
|
|
2319
2171
|
};
|
|
2320
|
-
/**
|
|
2321
|
-
*
|
|
2322
|
-
* @param {DropList.ItemBase[]} items
|
|
2323
|
-
* @param {string} labelProp
|
|
2324
|
-
* @returns {string}
|
|
2325
|
-
*/
|
|
2326
2172
|
var defaultMultiPlaceholderFormatter = (items, labelProp) => {
|
|
2327
2173
|
if (items.length === 0) return "";
|
|
2328
2174
|
let title = items[0][labelProp] + "";
|
|
@@ -2346,9 +2192,6 @@
|
|
|
2346
2192
|
return true;
|
|
2347
2193
|
}
|
|
2348
2194
|
var SelectBox = class {
|
|
2349
|
-
/**
|
|
2350
|
-
* @param {SelectBox.Options} options
|
|
2351
|
-
*/
|
|
2352
2195
|
constructor(options) {
|
|
2353
2196
|
const o = { ...DefaultOptions$1 };
|
|
2354
2197
|
for (let [key, value] of Object.entries(
|
|
@@ -2536,21 +2379,15 @@
|
|
|
2536
2379
|
}
|
|
2537
2380
|
/**
|
|
2538
2381
|
* Returns true if other is an inclusive descendant of droplist node, false otherwise, and undefined if the droplist is not initiated.
|
|
2539
|
-
* @param {Node} other
|
|
2540
|
-
* @param {boolean} [considerSubmenus=true]
|
|
2541
|
-
* @returns {boolean|undefined}
|
|
2542
2382
|
*/
|
|
2543
2383
|
droplistElContains(other, considerSubmenus = true) {
|
|
2544
2384
|
return this._p.dropList?.elContains(other, considerSubmenus);
|
|
2545
2385
|
}
|
|
2546
2386
|
/**
|
|
2547
2387
|
* Enables the control
|
|
2548
|
-
* @param {boolean=true} enabled Should the control be enabled?
|
|
2549
|
-
* @returns {SelectBox}
|
|
2550
2388
|
*/
|
|
2551
|
-
enable(enabled) {
|
|
2389
|
+
enable(enabled = true) {
|
|
2552
2390
|
const p = this._p;
|
|
2553
|
-
if (enabled === void 0) enabled = true;
|
|
2554
2391
|
p.disabled = !enabled;
|
|
2555
2392
|
p.el.setAttribute("aria-disabled", p.disabled.toString());
|
|
2556
2393
|
p.input.disabled = !!p.disabled;
|
|
@@ -2561,50 +2398,38 @@
|
|
|
2561
2398
|
}
|
|
2562
2399
|
/**
|
|
2563
2400
|
* Is the control enabled?
|
|
2564
|
-
* @returns {boolean}
|
|
2565
2401
|
*/
|
|
2566
2402
|
isEnabled() {
|
|
2567
2403
|
return !this._p.disabled;
|
|
2568
2404
|
}
|
|
2569
2405
|
/**
|
|
2570
2406
|
* Disables the control
|
|
2571
|
-
* @param {boolean=true} disabled Should the control be disabled?
|
|
2572
|
-
* @returns {SelectBox}
|
|
2573
2407
|
*/
|
|
2574
|
-
disable(disabled) {
|
|
2575
|
-
return this.enable(
|
|
2408
|
+
disable(disabled = true) {
|
|
2409
|
+
return this.enable(!disabled);
|
|
2576
2410
|
}
|
|
2577
2411
|
/**
|
|
2578
2412
|
* Is the control disabled?
|
|
2579
|
-
* @returns {boolean}
|
|
2580
2413
|
*/
|
|
2581
2414
|
isDisabled() {
|
|
2582
2415
|
return this._p.disabled;
|
|
2583
2416
|
}
|
|
2584
2417
|
/**
|
|
2585
2418
|
* Sets read only mode
|
|
2586
|
-
* @param {boolean=true} readOnly Should the control be read only?
|
|
2587
|
-
* @returns {SelectBox}
|
|
2588
2419
|
*/
|
|
2589
|
-
setReadOnly(readOnly) {
|
|
2420
|
+
setReadOnly(readOnly = true) {
|
|
2590
2421
|
const p = this._p;
|
|
2591
|
-
if (readOnly === void 0) readOnly = true;
|
|
2592
2422
|
p.readOnly = readOnly;
|
|
2593
2423
|
p.el.setAttribute("aria-readOnly", p.readOnly.toString());
|
|
2594
2424
|
p.input.readOnly = !(p.searchable || p.multi) || !!p.readOnly;
|
|
2595
2425
|
return this;
|
|
2596
2426
|
}
|
|
2597
2427
|
/**
|
|
2598
|
-
* Is the control
|
|
2599
|
-
* @returns {boolean}
|
|
2428
|
+
* Is the control read only?
|
|
2600
2429
|
*/
|
|
2601
2430
|
isReadOnly() {
|
|
2602
2431
|
return this._p.readOnly;
|
|
2603
2432
|
}
|
|
2604
|
-
/**
|
|
2605
|
-
* @param {string|string[]} classes
|
|
2606
|
-
* @returns {SelectBox}
|
|
2607
|
-
*/
|
|
2608
2433
|
setAdditionalClasses(classes) {
|
|
2609
2434
|
const p = this._p;
|
|
2610
2435
|
p.additionalClasses = classes;
|
|
@@ -2612,10 +2437,8 @@
|
|
|
2612
2437
|
return this;
|
|
2613
2438
|
}
|
|
2614
2439
|
/**
|
|
2615
|
-
*
|
|
2616
|
-
* @param
|
|
2617
|
-
* @param {boolean} [resetValues=true] should reset values to current values (essentially refresh the data based on items & values). If set to false, use setValue to set a fresh value
|
|
2618
|
-
* @returns {SelectBox}
|
|
2440
|
+
* @param items the items to set (not values)
|
|
2441
|
+
* @param resetValues should reset values to current values (essentially refresh the data based on items & values). If set to false, use setValue to set a fresh value
|
|
2619
2442
|
*/
|
|
2620
2443
|
setItems(items, resetValues = true) {
|
|
2621
2444
|
const p = this._p;
|
|
@@ -2651,16 +2474,9 @@
|
|
|
2651
2474
|
}
|
|
2652
2475
|
if (p.dropList) p.dropList.updateItemByValue(value, newItem);
|
|
2653
2476
|
}
|
|
2654
|
-
/**
|
|
2655
|
-
* @returns {DropList.ItemBase[]|*}
|
|
2656
|
-
*/
|
|
2657
2477
|
getItems() {
|
|
2658
2478
|
return this._p.items;
|
|
2659
2479
|
}
|
|
2660
|
-
/**
|
|
2661
|
-
* @param {boolean} clearable
|
|
2662
|
-
* @returns {SelectBox}
|
|
2663
|
-
*/
|
|
2664
2480
|
setClearable(clearable) {
|
|
2665
2481
|
clearable = !!clearable;
|
|
2666
2482
|
if (this._p.clearable === clearable) return this;
|
|
@@ -2668,16 +2484,9 @@
|
|
|
2668
2484
|
this._scheduleSync("render_clear");
|
|
2669
2485
|
return this;
|
|
2670
2486
|
}
|
|
2671
|
-
/**
|
|
2672
|
-
* @returns {boolean}
|
|
2673
|
-
*/
|
|
2674
2487
|
getClearable() {
|
|
2675
2488
|
return this._p.clearable;
|
|
2676
2489
|
}
|
|
2677
|
-
/**
|
|
2678
|
-
* @param {boolean} enabled
|
|
2679
|
-
* @returns {SelectBox}
|
|
2680
|
-
*/
|
|
2681
2490
|
setHasOpenIndicator(enabled) {
|
|
2682
2491
|
enabled = !!enabled;
|
|
2683
2492
|
if (this._p.hasOpenIndicator === enabled) return this;
|
|
@@ -2685,31 +2494,20 @@
|
|
|
2685
2494
|
this._scheduleSync("render_base");
|
|
2686
2495
|
return this;
|
|
2687
2496
|
}
|
|
2688
|
-
/**
|
|
2689
|
-
* @returns {boolean}
|
|
2690
|
-
*/
|
|
2691
2497
|
getHasOpenIndicator() {
|
|
2692
2498
|
return this._p.hasOpenIndicator;
|
|
2693
2499
|
}
|
|
2694
|
-
/**
|
|
2695
|
-
* @param {string} placeholder
|
|
2696
|
-
* @returns {SelectBox}
|
|
2697
|
-
*/
|
|
2698
2500
|
setPlaceholder(placeholder) {
|
|
2699
2501
|
this._p.placeholder = placeholder == null ? "" : String(placeholder);
|
|
2700
2502
|
this._scheduleSync("render_base");
|
|
2701
2503
|
return this;
|
|
2702
2504
|
}
|
|
2703
|
-
/**
|
|
2704
|
-
* @returns {string}
|
|
2705
|
-
*/
|
|
2706
2505
|
getPlaceHolder() {
|
|
2707
2506
|
return this._p.placeholder;
|
|
2708
2507
|
}
|
|
2709
2508
|
/**
|
|
2710
|
-
* @param
|
|
2711
|
-
* @param
|
|
2712
|
-
* @returns {SelectBox}
|
|
2509
|
+
* @param term the search term to set
|
|
2510
|
+
* @param performSearch should actually perform the search, or just set the input's text?
|
|
2713
2511
|
*/
|
|
2714
2512
|
setSearchTerm(term, performSearch = false) {
|
|
2715
2513
|
const p = this._p;
|
|
@@ -2723,9 +2521,6 @@
|
|
|
2723
2521
|
}
|
|
2724
2522
|
return this;
|
|
2725
2523
|
}
|
|
2726
|
-
/**
|
|
2727
|
-
* @returns {string}
|
|
2728
|
-
*/
|
|
2729
2524
|
getSearchTerm() {
|
|
2730
2525
|
const p = this._p;
|
|
2731
2526
|
if (p.input) return p.input.value;
|
|
@@ -2735,10 +2530,6 @@
|
|
|
2735
2530
|
this._p.dropList?.invokeRefilter();
|
|
2736
2531
|
return this;
|
|
2737
2532
|
}
|
|
2738
|
-
/**
|
|
2739
|
-
* @param {boolean} sortSelectedItems
|
|
2740
|
-
* @returns {SelectBox}
|
|
2741
|
-
*/
|
|
2742
2533
|
setSortSelectedItems(sortSelectedItems) {
|
|
2743
2534
|
const p = this._p;
|
|
2744
2535
|
sortSelectedItems = !!sortSelectedItems;
|
|
@@ -2747,16 +2538,9 @@
|
|
|
2747
2538
|
this._scheduleSync("render_items");
|
|
2748
2539
|
return this;
|
|
2749
2540
|
}
|
|
2750
|
-
/**
|
|
2751
|
-
* @returns {boolean}
|
|
2752
|
-
*/
|
|
2753
2541
|
isSortSelectedItemsEnabled() {
|
|
2754
2542
|
return this._p.sortSelectedItems;
|
|
2755
2543
|
}
|
|
2756
|
-
/**
|
|
2757
|
-
* @param {boolean} sortListItems
|
|
2758
|
-
* @returns {SelectBox}
|
|
2759
|
-
*/
|
|
2760
2544
|
setSortListItems(sortListItems) {
|
|
2761
2545
|
const p = this._p;
|
|
2762
2546
|
sortListItems = !!sortListItems;
|
|
@@ -2766,16 +2550,9 @@
|
|
|
2766
2550
|
this._scheduleSync("render_list");
|
|
2767
2551
|
return this;
|
|
2768
2552
|
}
|
|
2769
|
-
/**
|
|
2770
|
-
* @returns {boolean}
|
|
2771
|
-
*/
|
|
2772
2553
|
isSortListItemsEnabled() {
|
|
2773
2554
|
return this._p.sortListItems;
|
|
2774
2555
|
}
|
|
2775
|
-
/**
|
|
2776
|
-
* @param {boolean} sortListCheckedFirst
|
|
2777
|
-
* @returns {SelectBox}
|
|
2778
|
-
*/
|
|
2779
2556
|
setSortListCheckedFirst(sortListCheckedFirst) {
|
|
2780
2557
|
const p = this._p;
|
|
2781
2558
|
sortListCheckedFirst = !!sortListCheckedFirst;
|
|
@@ -2785,16 +2562,9 @@
|
|
|
2785
2562
|
this._scheduleSync("render_list");
|
|
2786
2563
|
return this;
|
|
2787
2564
|
}
|
|
2788
|
-
/**
|
|
2789
|
-
* @returns {boolean}
|
|
2790
|
-
*/
|
|
2791
2565
|
isSortListCheckedFirstEnabled() {
|
|
2792
2566
|
return this._p.sortListCheckedFirst;
|
|
2793
2567
|
}
|
|
2794
|
-
/**
|
|
2795
|
-
* @param {*[]} values
|
|
2796
|
-
* @returns {SelectBox}
|
|
2797
|
-
*/
|
|
2798
2568
|
setStickyValues(values) {
|
|
2799
2569
|
const p = this._p;
|
|
2800
2570
|
p.stickyValues = Array.isArray(values) ? new Set(values) : null;
|
|
@@ -2802,16 +2572,9 @@
|
|
|
2802
2572
|
this._scheduleSync("render_list");
|
|
2803
2573
|
return this;
|
|
2804
2574
|
}
|
|
2805
|
-
/**
|
|
2806
|
-
* @returns {*[]}
|
|
2807
|
-
*/
|
|
2808
2575
|
getStickyValues() {
|
|
2809
2576
|
return this._p.stickyValues ? Array.from(this._p.stickyValues) : null;
|
|
2810
2577
|
}
|
|
2811
|
-
/**
|
|
2812
|
-
* @param {function(a: DropList.ItemBase, b: DropList.ItemBase):number} comparator
|
|
2813
|
-
* @returns {SelectBox}
|
|
2814
|
-
*/
|
|
2815
2578
|
setSortItemComparator(comparator) {
|
|
2816
2579
|
const p = this._p;
|
|
2817
2580
|
if (p.sortItemComparator === comparator) return this;
|
|
@@ -2820,16 +2583,9 @@
|
|
|
2820
2583
|
this._scheduleSync("render_list");
|
|
2821
2584
|
return this;
|
|
2822
2585
|
}
|
|
2823
|
-
/**
|
|
2824
|
-
* @returns {function(a: DropList.ItemBase, b: DropList.ItemBase):number}
|
|
2825
|
-
*/
|
|
2826
2586
|
getSortItemComparator() {
|
|
2827
2587
|
return this._p.sortItemComparator;
|
|
2828
2588
|
}
|
|
2829
|
-
/**
|
|
2830
|
-
* @param {boolean} treatGroupSelectionAsItems
|
|
2831
|
-
* @returns {SelectBox}
|
|
2832
|
-
*/
|
|
2833
2589
|
setTreatGroupSelectionAsItems(treatGroupSelectionAsItems) {
|
|
2834
2590
|
const p = this._p;
|
|
2835
2591
|
treatGroupSelectionAsItems = !!treatGroupSelectionAsItems;
|
|
@@ -2841,16 +2597,9 @@
|
|
|
2841
2597
|
this._scheduleSync("render_list");
|
|
2842
2598
|
return this;
|
|
2843
2599
|
}
|
|
2844
|
-
/**
|
|
2845
|
-
* @returns {boolean}
|
|
2846
|
-
*/
|
|
2847
2600
|
isTreatGroupSelectionAsItemsEnabled() {
|
|
2848
2601
|
return !this._p.treatGroupSelectionAsItems;
|
|
2849
2602
|
}
|
|
2850
|
-
/**
|
|
2851
|
-
* @param {boolean} splitListCheckedGroups
|
|
2852
|
-
* @returns {SelectBox}
|
|
2853
|
-
*/
|
|
2854
2603
|
setSplitListCheckedGroups(splitListCheckedGroups) {
|
|
2855
2604
|
const p = this._p;
|
|
2856
2605
|
splitListCheckedGroups = !!splitListCheckedGroups;
|
|
@@ -2860,16 +2609,9 @@
|
|
|
2860
2609
|
this._scheduleSync("render_list");
|
|
2861
2610
|
return this;
|
|
2862
2611
|
}
|
|
2863
|
-
/**
|
|
2864
|
-
* @returns {boolean}
|
|
2865
|
-
*/
|
|
2866
2612
|
isSplitListCheckedGroupsEnabled() {
|
|
2867
2613
|
return this._p.splitListCheckedGroups;
|
|
2868
2614
|
}
|
|
2869
|
-
/**
|
|
2870
|
-
* @param {boolean} showSelection
|
|
2871
|
-
* @returns {SelectBox}
|
|
2872
|
-
*/
|
|
2873
2615
|
setShowSelection(showSelection) {
|
|
2874
2616
|
const p = this._p;
|
|
2875
2617
|
showSelection = !!showSelection;
|
|
@@ -2878,16 +2620,9 @@
|
|
|
2878
2620
|
this._scheduleSync("render_items");
|
|
2879
2621
|
return this;
|
|
2880
2622
|
}
|
|
2881
|
-
/**
|
|
2882
|
-
* @returns {boolean}
|
|
2883
|
-
*/
|
|
2884
2623
|
isShowSelectionEnabled() {
|
|
2885
2624
|
return this._p.showSelection;
|
|
2886
2625
|
}
|
|
2887
|
-
/**
|
|
2888
|
-
* @param {boolean} showPlaceholderInTooltip
|
|
2889
|
-
* @returns {SelectBox}
|
|
2890
|
-
*/
|
|
2891
2626
|
setShowPlaceholderInTooltip(showPlaceholderInTooltip) {
|
|
2892
2627
|
const p = this._p;
|
|
2893
2628
|
showPlaceholderInTooltip = !!showPlaceholderInTooltip;
|
|
@@ -2896,16 +2631,9 @@
|
|
|
2896
2631
|
this._scheduleSync("render_base");
|
|
2897
2632
|
return this;
|
|
2898
2633
|
}
|
|
2899
|
-
/**
|
|
2900
|
-
* @returns {boolean}
|
|
2901
|
-
*/
|
|
2902
2634
|
isShowPlaceholderInTooltipEnabled() {
|
|
2903
2635
|
return this._p.showPlaceholderInTooltip;
|
|
2904
2636
|
}
|
|
2905
|
-
/**
|
|
2906
|
-
* @param {function(items: DropList.ItemBase[]):string} formatter
|
|
2907
|
-
* @returns {SelectBox}
|
|
2908
|
-
*/
|
|
2909
2637
|
setMultiPlaceholderFormatter(formatter) {
|
|
2910
2638
|
const p = this._p;
|
|
2911
2639
|
if (p.multiPlaceholderFormatter === formatter) return this;
|
|
@@ -2913,26 +2641,15 @@
|
|
|
2913
2641
|
this._scheduleSync("render_base");
|
|
2914
2642
|
return this;
|
|
2915
2643
|
}
|
|
2916
|
-
/**
|
|
2917
|
-
* @param {boolean|'touch'} value
|
|
2918
|
-
* @returns {SelectBox}
|
|
2919
|
-
*/
|
|
2920
2644
|
setBlurOnSingleSelection(value) {
|
|
2921
2645
|
const p = this._p;
|
|
2922
2646
|
if (p.blurOnSingleSelection === value) return this;
|
|
2923
2647
|
p.blurOnSingleSelection = value;
|
|
2924
2648
|
return this;
|
|
2925
2649
|
}
|
|
2926
|
-
/**
|
|
2927
|
-
* @returns {boolean|'touch'}
|
|
2928
|
-
*/
|
|
2929
2650
|
getBlurOnSingleSelection() {
|
|
2930
2651
|
return this._p.blurOnSingleSelection;
|
|
2931
2652
|
}
|
|
2932
|
-
/**
|
|
2933
|
-
* @param {boolean} multi
|
|
2934
|
-
* @returns {SelectBox}
|
|
2935
|
-
*/
|
|
2936
2653
|
setMulti(multi) {
|
|
2937
2654
|
const p = this._p;
|
|
2938
2655
|
multi = !!multi;
|
|
@@ -2948,16 +2665,9 @@
|
|
|
2948
2665
|
this._scheduleSync("full");
|
|
2949
2666
|
return this;
|
|
2950
2667
|
}
|
|
2951
|
-
/**
|
|
2952
|
-
* @returns {boolean}
|
|
2953
|
-
*/
|
|
2954
2668
|
isMultiEnabled() {
|
|
2955
2669
|
return this._p.multi;
|
|
2956
2670
|
}
|
|
2957
|
-
/**
|
|
2958
|
-
* @param {boolean} searchable
|
|
2959
|
-
* @returns {SelectBox}
|
|
2960
|
-
*/
|
|
2961
2671
|
setSearchable(searchable) {
|
|
2962
2672
|
const p = this._p;
|
|
2963
2673
|
searchable = !!searchable;
|
|
@@ -2966,10 +2676,6 @@
|
|
|
2966
2676
|
this._scheduleSync("full");
|
|
2967
2677
|
return this;
|
|
2968
2678
|
}
|
|
2969
|
-
/**
|
|
2970
|
-
* @param {boolean} allowTypeToSelect
|
|
2971
|
-
* @returns {SelectBox}
|
|
2972
|
-
*/
|
|
2973
2679
|
setAllowTypeToSelect(allowTypeToSelect) {
|
|
2974
2680
|
const p = this._p;
|
|
2975
2681
|
allowTypeToSelect = !!allowTypeToSelect;
|
|
@@ -2977,129 +2683,71 @@
|
|
|
2977
2683
|
p.allowTypeToSelect = allowTypeToSelect;
|
|
2978
2684
|
return this;
|
|
2979
2685
|
}
|
|
2980
|
-
/**
|
|
2981
|
-
* @returns {boolean}
|
|
2982
|
-
*/
|
|
2983
2686
|
isSearchableEnabled() {
|
|
2984
2687
|
return this._p.searchable;
|
|
2985
2688
|
}
|
|
2986
|
-
/**
|
|
2987
|
-
* @param {string} noResultsText
|
|
2988
|
-
* @returns {SelectBox}
|
|
2989
|
-
*/
|
|
2990
2689
|
setNoResultsText(noResultsText) {
|
|
2991
2690
|
this._p.dropList?.setNoResultsText(noResultsText);
|
|
2992
2691
|
return this;
|
|
2993
2692
|
}
|
|
2994
|
-
/**
|
|
2995
|
-
* @returns {string}
|
|
2996
|
-
*/
|
|
2997
2693
|
getNoResultsText() {
|
|
2998
2694
|
return this._p.noResultsText;
|
|
2999
2695
|
}
|
|
3000
|
-
/**
|
|
3001
|
-
* @param {boolean} autoSelectTextOnCheck
|
|
3002
|
-
* @returns {SelectBox}
|
|
3003
|
-
*/
|
|
3004
2696
|
setAutoSelectTextOnCheck(autoSelectTextOnCheck) {
|
|
3005
2697
|
this._p.autoSelectTextOnCheck = autoSelectTextOnCheck;
|
|
3006
2698
|
return this;
|
|
3007
2699
|
}
|
|
3008
|
-
/**
|
|
3009
|
-
* @returns {boolean}
|
|
3010
|
-
*/
|
|
3011
2700
|
getAutoSelectTextOnCheck() {
|
|
3012
2701
|
return this._p.autoSelectTextOnCheck;
|
|
3013
2702
|
}
|
|
3014
|
-
/**
|
|
3015
|
-
* @param {number} window
|
|
3016
|
-
* @returns {SelectBox}
|
|
3017
|
-
*/
|
|
3018
2703
|
setFilterThrottleWindow(window) {
|
|
3019
2704
|
const p = this._p;
|
|
3020
2705
|
p.filterThrottleWindow = window;
|
|
3021
2706
|
p.dropList?.setFilterThrottleWindow(window);
|
|
3022
2707
|
return this;
|
|
3023
2708
|
}
|
|
3024
|
-
/**
|
|
3025
|
-
* @returns {number}
|
|
3026
|
-
*/
|
|
3027
2709
|
getFilterThrottleWindow() {
|
|
3028
2710
|
return this._p.filterThrottleWindow;
|
|
3029
2711
|
}
|
|
3030
|
-
/**
|
|
3031
|
-
* @param {boolean} value
|
|
3032
|
-
* @returns {SelectBox}
|
|
3033
|
-
*/
|
|
3034
2712
|
setFilterOnEmptyTerm(value) {
|
|
3035
2713
|
const p = this._p;
|
|
3036
2714
|
if (p.filterOnEmptyTerm === value) return this;
|
|
3037
2715
|
p.dropList?.setFilterOnEmptyTerm(value);
|
|
3038
2716
|
return this;
|
|
3039
2717
|
}
|
|
3040
|
-
/**
|
|
3041
|
-
* @returns {boolean}
|
|
3042
|
-
*/
|
|
3043
2718
|
getFilterOnEmptyTerm() {
|
|
3044
2719
|
return this._p.filterOnEmptyTerm;
|
|
3045
2720
|
}
|
|
3046
|
-
/**
|
|
3047
|
-
* @param {DropList.Options} listOptions
|
|
3048
|
-
* @returns {SelectBox}
|
|
3049
|
-
*/
|
|
3050
2721
|
setListOptions(listOptions) {
|
|
3051
2722
|
const p = this._p;
|
|
3052
2723
|
p.listOptions = listOptions;
|
|
3053
2724
|
this._setupDropdownMenu();
|
|
3054
2725
|
return this;
|
|
3055
2726
|
}
|
|
3056
|
-
/**
|
|
3057
|
-
* @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
|
|
3058
|
-
* @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
|
|
3059
|
-
* @returns {SelectBox})|null
|
|
3060
|
-
*/
|
|
3061
2727
|
setRenderSingleItem(render, unrender) {
|
|
3062
2728
|
const p = this._p;
|
|
3063
2729
|
p.renderSingleItem = render;
|
|
3064
2730
|
p.unrenderSingleItem = unrender;
|
|
3065
2731
|
return this;
|
|
3066
2732
|
}
|
|
3067
|
-
/**
|
|
3068
|
-
* @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
|
|
3069
|
-
* @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
|
|
3070
|
-
* @returns {SelectBox}
|
|
3071
|
-
*/
|
|
3072
2733
|
setRenderMultiItem(render, unrender) {
|
|
3073
2734
|
const p = this._p;
|
|
3074
2735
|
p.renderMultiItem = render;
|
|
3075
2736
|
p.unrenderMultiItem = unrender;
|
|
3076
2737
|
return this;
|
|
3077
2738
|
}
|
|
3078
|
-
/**
|
|
3079
|
-
* @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
|
|
3080
|
-
* @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
|
|
3081
|
-
* @returns {SelectBox}
|
|
3082
|
-
*/
|
|
3083
2739
|
setRenderRestMultiItem(render, unrender) {
|
|
3084
2740
|
const p = this._p;
|
|
3085
2741
|
p.renderRestMultiItem = render;
|
|
3086
2742
|
p.unrenderRestMultiItem = unrender;
|
|
3087
2743
|
return this;
|
|
3088
2744
|
}
|
|
3089
|
-
/**
|
|
3090
|
-
* @param {string} prop
|
|
3091
|
-
* @returns {SelectBox}
|
|
3092
|
-
*/
|
|
3093
2745
|
setLabelProp(prop) {
|
|
3094
2746
|
const p = this._p;
|
|
3095
2747
|
p.labelProp = prop;
|
|
3096
2748
|
if (p.dropList) p.dropList.setLabelProp(prop);
|
|
3097
2749
|
return this;
|
|
3098
2750
|
}
|
|
3099
|
-
/**
|
|
3100
|
-
* @param {string} prop
|
|
3101
|
-
* @returns {SelectBox}
|
|
3102
|
-
*/
|
|
3103
2751
|
setValueProp(prop) {
|
|
3104
2752
|
const p = this._p;
|
|
3105
2753
|
if (p.valueProp === prop) return this;
|
|
@@ -3108,50 +2756,31 @@
|
|
|
3108
2756
|
this._refreshItemByValueMap();
|
|
3109
2757
|
return this;
|
|
3110
2758
|
}
|
|
3111
|
-
/**
|
|
3112
|
-
* @param {string} prop
|
|
3113
|
-
* @returns {SelectBox}
|
|
3114
|
-
*/
|
|
3115
2759
|
setMultiItemLabelProp(prop) {
|
|
3116
2760
|
const p = this._p;
|
|
3117
2761
|
p.multiItemLabelProp = prop;
|
|
3118
2762
|
this._scheduleSync("render_items");
|
|
3119
2763
|
return this;
|
|
3120
2764
|
}
|
|
3121
|
-
/**
|
|
3122
|
-
* @param {'before'|'after'|'none'} position
|
|
3123
|
-
* @returns {SelectBox}
|
|
3124
|
-
*/
|
|
3125
2765
|
setMultiItemRemovePosition(position) {
|
|
3126
2766
|
const p = this._p;
|
|
3127
2767
|
p.multiItemRemovePosition = position;
|
|
3128
2768
|
this._scheduleSync("render_items");
|
|
3129
2769
|
return this;
|
|
3130
2770
|
}
|
|
3131
|
-
/**
|
|
3132
|
-
* @param {number|null|undefined} value
|
|
3133
|
-
* @returns {SelectBox}
|
|
3134
|
-
*/
|
|
3135
2771
|
setMaxMultiItems(value) {
|
|
3136
2772
|
const p = this._p;
|
|
3137
2773
|
p.maxMultiItems = value;
|
|
3138
2774
|
return this;
|
|
3139
2775
|
}
|
|
3140
|
-
/**
|
|
3141
|
-
* @param {function(count: number, items: DropList.ItemBase[]):string|null|undefined} value
|
|
3142
|
-
* @returns {SelectBox}
|
|
3143
|
-
*/
|
|
3144
2776
|
setMultiItemsRestLabelProvider(value) {
|
|
3145
2777
|
const p = this._p;
|
|
3146
2778
|
p.multiItemsRestLabelProvider = value;
|
|
3147
2779
|
return this;
|
|
3148
2780
|
}
|
|
3149
|
-
/**
|
|
3150
|
-
* @param {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)} fn
|
|
3151
|
-
* @returns {SelectBox}
|
|
3152
|
-
*/
|
|
3153
2781
|
setFilterFn(fn) {
|
|
3154
2782
|
const p = this._p;
|
|
2783
|
+
fn ??= null;
|
|
3155
2784
|
if (p.filterFn === fn) return this;
|
|
3156
2785
|
p.filterFn = fn;
|
|
3157
2786
|
if (!fn) fn = (items, term) => {
|
|
@@ -3166,9 +2795,6 @@
|
|
|
3166
2795
|
p.dropList?.setFilterFn(fn);
|
|
3167
2796
|
return this;
|
|
3168
2797
|
}
|
|
3169
|
-
/**
|
|
3170
|
-
* @returns {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)}
|
|
3171
|
-
*/
|
|
3172
2798
|
getFilterFn() {
|
|
3173
2799
|
return this._p.filterFn;
|
|
3174
2800
|
}
|
|
@@ -3176,8 +2802,6 @@
|
|
|
3176
2802
|
* Sets a handler to intercept internal errors/warnings (e.g. from a throwing `renderMultiItem`/`unrenderSingleItem`)
|
|
3177
2803
|
* instead of the default `console.error`/`console.warn`. Also used as the default `onError` for the internal
|
|
3178
2804
|
* `DropList`, unless `listOptions.onError` is set explicitly.
|
|
3179
|
-
* @param {SelectBox.LibraryErrorHandler|null} [fn]
|
|
3180
|
-
* @returns {SelectBox}
|
|
3181
2805
|
*/
|
|
3182
2806
|
setOnError(fn) {
|
|
3183
2807
|
const p = this._p;
|
|
@@ -3186,14 +2810,13 @@
|
|
|
3186
2810
|
return this;
|
|
3187
2811
|
}
|
|
3188
2812
|
/**
|
|
3189
|
-
*
|
|
2813
|
+
* Gets the current `onError` handler, if any.
|
|
3190
2814
|
*/
|
|
3191
2815
|
getOnError() {
|
|
3192
2816
|
return this._p.onError;
|
|
3193
2817
|
}
|
|
3194
2818
|
/**
|
|
3195
2819
|
* Focus on input element
|
|
3196
|
-
* @returns {SelectBox}
|
|
3197
2820
|
*/
|
|
3198
2821
|
focusInput() {
|
|
3199
2822
|
const p = this._p;
|
|
@@ -3202,7 +2825,6 @@
|
|
|
3202
2825
|
}
|
|
3203
2826
|
/**
|
|
3204
2827
|
* Remvoe focus from the input element
|
|
3205
|
-
* @returns {SelectBox}
|
|
3206
2828
|
*/
|
|
3207
2829
|
blurInput() {
|
|
3208
2830
|
const p = this._p;
|
|
@@ -3211,7 +2833,6 @@
|
|
|
3211
2833
|
}
|
|
3212
2834
|
/**
|
|
3213
2835
|
* Removes all selected items
|
|
3214
|
-
* @returns {SelectBox}
|
|
3215
2836
|
*/
|
|
3216
2837
|
clear() {
|
|
3217
2838
|
if (!this._performClearWithEvent(true)) return this;
|
|
@@ -3220,8 +2841,6 @@
|
|
|
3220
2841
|
}
|
|
3221
2842
|
/**
|
|
3222
2843
|
* Returns a single value or an array of selected values - depending on `multi` prop
|
|
3223
|
-
* @public
|
|
3224
|
-
* @returns {*[]}
|
|
3225
2844
|
*/
|
|
3226
2845
|
getValue() {
|
|
3227
2846
|
const p = this._p;
|
|
@@ -3230,9 +2849,7 @@
|
|
|
3230
2849
|
}
|
|
3231
2850
|
/**
|
|
3232
2851
|
* Selects the specified value or multiple values - depending on `multi` prop
|
|
3233
|
-
* @
|
|
3234
|
-
* @param {*|*[]} value - if `multi`, then an array of values to select, otherwise - a single value to select
|
|
3235
|
-
* @returns {SelectBox}
|
|
2852
|
+
* @param value - if `multi`, then an array of values to select, otherwise - a single value to select
|
|
3236
2853
|
*/
|
|
3237
2854
|
setValue(value) {
|
|
3238
2855
|
if (this._p.multi) return this.setSelectedValues(Array.isArray(value) ? value : value !== void 0 ? [value] : []);
|
|
@@ -3240,17 +2857,12 @@
|
|
|
3240
2857
|
}
|
|
3241
2858
|
/**
|
|
3242
2859
|
* Returns an array of selected values
|
|
3243
|
-
* @public
|
|
3244
|
-
* @returns {*[]}
|
|
3245
2860
|
*/
|
|
3246
2861
|
getSelectedValues() {
|
|
3247
2862
|
return this._p.selectedValues.slice(0);
|
|
3248
2863
|
}
|
|
3249
2864
|
/**
|
|
3250
2865
|
* Selects the specified values
|
|
3251
|
-
* @public
|
|
3252
|
-
* @param {*[]} values - an array of *values* to select
|
|
3253
|
-
* @returns {SelectBox}
|
|
3254
2866
|
*/
|
|
3255
2867
|
setSelectedValues(values) {
|
|
3256
2868
|
const p = this._p, valueProp = p.valueProp;
|
|
@@ -3275,16 +2887,12 @@
|
|
|
3275
2887
|
}
|
|
3276
2888
|
/**
|
|
3277
2889
|
* Returns the count of selected values
|
|
3278
|
-
* @public
|
|
3279
|
-
* @returns {number}
|
|
3280
2890
|
*/
|
|
3281
2891
|
getSelectedValueCount() {
|
|
3282
2892
|
return this._p.selectedValues.length;
|
|
3283
2893
|
}
|
|
3284
2894
|
/**
|
|
3285
2895
|
* Returns an array of selected items
|
|
3286
|
-
* @public
|
|
3287
|
-
* @returns {Array.<Object>}
|
|
3288
2896
|
*/
|
|
3289
2897
|
getSelectedItems() {
|
|
3290
2898
|
return this._p.selectedItems.slice(0);
|
|
@@ -3293,17 +2901,11 @@
|
|
|
3293
2901
|
* Sets the specified items to "checked" mode.
|
|
3294
2902
|
* An array of items is passed, not values, because we need to keep track if items,
|
|
3295
2903
|
* and if we already have the array of items then this spares the process of searching for the items by values.
|
|
3296
|
-
* @public
|
|
3297
|
-
* @param {DropList.ItemBase[]} items - an array of *items* to select (not values)
|
|
3298
|
-
* @returns {SelectBox}
|
|
3299
2904
|
*/
|
|
3300
2905
|
setSelectedItems(items) {
|
|
3301
2906
|
this._setSelectedItems(items);
|
|
3302
2907
|
return this;
|
|
3303
2908
|
}
|
|
3304
|
-
/**
|
|
3305
|
-
* @returns {SelectBox}
|
|
3306
|
-
*/
|
|
3307
2909
|
openList() {
|
|
3308
2910
|
const p = this._p;
|
|
3309
2911
|
if (p.dropList.isVisible()) return this;
|
|
@@ -3318,9 +2920,6 @@
|
|
|
3318
2920
|
else if (!p.multi && this.getValue() !== void 0) p.dropList.setFocusedItemByValue(this.getValue());
|
|
3319
2921
|
return this;
|
|
3320
2922
|
}
|
|
3321
|
-
/**
|
|
3322
|
-
* @returns {SelectBox}
|
|
3323
|
-
*/
|
|
3324
2923
|
closeList() {
|
|
3325
2924
|
const p = this._p;
|
|
3326
2925
|
if (this[DestroyedSymbol]) return this;
|
|
@@ -3332,32 +2931,17 @@
|
|
|
3332
2931
|
}
|
|
3333
2932
|
return this;
|
|
3334
2933
|
}
|
|
3335
|
-
/**
|
|
3336
|
-
* @param {boolean} [open]
|
|
3337
|
-
* @returns {SelectBox}
|
|
3338
|
-
*/
|
|
3339
2934
|
toggleList(open) {
|
|
3340
2935
|
const p = this._p;
|
|
3341
2936
|
if (open === void 0 ? !p.dropList.isVisible() : !!open) return this.openList();
|
|
3342
2937
|
else return this.closeList();
|
|
3343
2938
|
}
|
|
3344
|
-
/**
|
|
3345
|
-
* @returns {boolean}
|
|
3346
|
-
*/
|
|
3347
2939
|
isListOpen() {
|
|
3348
2940
|
return !!this._p.dropListVisible;
|
|
3349
2941
|
}
|
|
3350
|
-
/**
|
|
3351
|
-
* @param {boolean} [on]
|
|
3352
|
-
* @returns {SelectBox}
|
|
3353
|
-
*/
|
|
3354
2942
|
toggleLoading(on) {
|
|
3355
2943
|
return this.setIsLoadingMode(on === void 0 ? !this.getIsLoadingMode() : !!on);
|
|
3356
2944
|
}
|
|
3357
|
-
/**
|
|
3358
|
-
* @param {boolean} isLoadingMode
|
|
3359
|
-
* @returns {SelectBox}
|
|
3360
|
-
*/
|
|
3361
2945
|
setIsLoadingMode(isLoadingMode) {
|
|
3362
2946
|
const p = this._p;
|
|
3363
2947
|
isLoadingMode = isLoadingMode === void 0 ? true : !!isLoadingMode;
|
|
@@ -3368,31 +2952,21 @@
|
|
|
3368
2952
|
this._scheduleSync("render_base");
|
|
3369
2953
|
return this;
|
|
3370
2954
|
}
|
|
3371
|
-
/**
|
|
3372
|
-
* @returns {boolean}
|
|
3373
|
-
*/
|
|
3374
2955
|
getIsLoadingMode() {
|
|
3375
2956
|
return this._p.isLoadingMode;
|
|
3376
2957
|
}
|
|
3377
2958
|
/**
|
|
3378
2959
|
* Sets whether to close the list when loading mode is enabled
|
|
3379
|
-
* @param {boolean} closeListWhenLoading
|
|
3380
|
-
* @returns {SelectBox}
|
|
3381
2960
|
*/
|
|
3382
2961
|
setCloseListWhenLoading(closeListWhenLoading) {
|
|
3383
2962
|
this._p.closeListWhenLoading = closeListWhenLoading;
|
|
3384
2963
|
return this;
|
|
3385
2964
|
}
|
|
3386
|
-
/**
|
|
3387
|
-
* @returns {boolean}
|
|
3388
|
-
*/
|
|
3389
2965
|
getCloseListWhenLoading() {
|
|
3390
2966
|
return this._p.closeListWhenLoading;
|
|
3391
2967
|
}
|
|
3392
2968
|
/**
|
|
3393
2969
|
* Sets when to clear the input field
|
|
3394
|
-
* @param {string[]} clearInputWhen
|
|
3395
|
-
* @returns {SelectBox}
|
|
3396
2970
|
*/
|
|
3397
2971
|
setClearInputWhen(clearInputWhen) {
|
|
3398
2972
|
this._p.clearInputWhen = Array.isArray(clearInputWhen) ? clearInputWhen.slice(0) : [];
|
|
@@ -3400,15 +2974,12 @@
|
|
|
3400
2974
|
}
|
|
3401
2975
|
/**
|
|
3402
2976
|
* Retrieves the settings for when to clear the input field
|
|
3403
|
-
* @returns {string[]}
|
|
3404
2977
|
*/
|
|
3405
2978
|
getClearInputWhen() {
|
|
3406
2979
|
return this._p.clearInputWhen;
|
|
3407
2980
|
}
|
|
3408
2981
|
/**
|
|
3409
2982
|
* Sets the appropriate direction for the selectbox
|
|
3410
|
-
* @param {'ltr'|'rtl'|'auto'} direction
|
|
3411
|
-
* @return {SelectBox}
|
|
3412
2983
|
*/
|
|
3413
2984
|
setDirection(direction) {
|
|
3414
2985
|
const p = this._p;
|
|
@@ -3418,14 +2989,12 @@
|
|
|
3418
2989
|
}
|
|
3419
2990
|
/**
|
|
3420
2991
|
* Gets the supplied direction for the selectbox
|
|
3421
|
-
* @return {'ltr'|'rtl'|'auto'}
|
|
3422
2992
|
*/
|
|
3423
2993
|
getDirection() {
|
|
3424
2994
|
return this._p.direction;
|
|
3425
2995
|
}
|
|
3426
2996
|
/**
|
|
3427
2997
|
* Can be called in case that the selectbox was attached to the dom late and has a weird size.
|
|
3428
|
-
* @returns {SelectBox}
|
|
3429
2998
|
*/
|
|
3430
2999
|
refreshSize() {
|
|
3431
3000
|
this._resizeInput();
|
|
@@ -3433,9 +3002,6 @@
|
|
|
3433
3002
|
}
|
|
3434
3003
|
/**
|
|
3435
3004
|
* Register an event handler
|
|
3436
|
-
* @param {(string|'*')?} event
|
|
3437
|
-
* @param {function(any)} handler
|
|
3438
|
-
* @returns {SelectBox}
|
|
3439
3005
|
*/
|
|
3440
3006
|
on(event, handler) {
|
|
3441
3007
|
this._p.mitt.on(event, handler);
|
|
@@ -3443,9 +3009,6 @@
|
|
|
3443
3009
|
}
|
|
3444
3010
|
/**
|
|
3445
3011
|
* Register a one time event handler
|
|
3446
|
-
* @param {(string|'*')?} event
|
|
3447
|
-
* @param {function(any)} handler
|
|
3448
|
-
* @returns {SelectBox}
|
|
3449
3012
|
*/
|
|
3450
3013
|
once(event, handler) {
|
|
3451
3014
|
let wrapped = (value) => {
|
|
@@ -3457,9 +3020,6 @@
|
|
|
3457
3020
|
}
|
|
3458
3021
|
/**
|
|
3459
3022
|
* Remove an `handler` for `event`, all events for `event`, or all events completely.
|
|
3460
|
-
* @param {(string|'*')?} event
|
|
3461
|
-
* @param {function(any)} handler
|
|
3462
|
-
* @returns {SelectBox}
|
|
3463
3023
|
*/
|
|
3464
3024
|
off(event, handler) {
|
|
3465
3025
|
if (!event && !event) this._p.mitt.all.clear();
|
|
@@ -3468,9 +3028,6 @@
|
|
|
3468
3028
|
}
|
|
3469
3029
|
/**
|
|
3470
3030
|
* Emit an event
|
|
3471
|
-
* @param {string} event
|
|
3472
|
-
* @param {any} value
|
|
3473
|
-
* @returns {SelectBox}
|
|
3474
3031
|
*/
|
|
3475
3032
|
emit(event, value) {
|
|
3476
3033
|
this._p.mitt.emit(event, value);
|
|
@@ -3490,8 +3047,6 @@
|
|
|
3490
3047
|
p.subitemByValueMap = null;
|
|
3491
3048
|
}
|
|
3492
3049
|
/**
|
|
3493
|
-
* @param {*} value
|
|
3494
|
-
* @returns {DropList.ItemBase|undefined}
|
|
3495
3050
|
* @private
|
|
3496
3051
|
* @internal
|
|
3497
3052
|
*/
|
|
@@ -3510,9 +3065,6 @@
|
|
|
3510
3065
|
this._addSubitemsToValueMap(p.items, subitemByValueMap, p.valueProp);
|
|
3511
3066
|
}
|
|
3512
3067
|
/**
|
|
3513
|
-
* @param {DropList.ItemBase[]} items
|
|
3514
|
-
* @param {Map<*, DropList.ItemBase>} itemByValueMap
|
|
3515
|
-
* @param {string} valueProp
|
|
3516
3068
|
* @private
|
|
3517
3069
|
* @internal
|
|
3518
3070
|
*/
|
|
@@ -3791,9 +3343,7 @@
|
|
|
3791
3343
|
case "search":
|
|
3792
3344
|
this._trigger("search", event);
|
|
3793
3345
|
break;
|
|
3794
|
-
case "itemschanged":
|
|
3795
|
-
this._trigger("itemschanged", event);
|
|
3796
|
-
break;
|
|
3346
|
+
case "itemschanged": this._trigger("itemschanged", event);
|
|
3797
3347
|
}
|
|
3798
3348
|
}
|
|
3799
3349
|
});
|
|
@@ -3861,9 +3411,7 @@
|
|
|
3861
3411
|
case keycode_js.VALUE_HOME:
|
|
3862
3412
|
dropList.goToFirst(evt);
|
|
3863
3413
|
break;
|
|
3864
|
-
case keycode_js.VALUE_END:
|
|
3865
|
-
dropList.goToLast(evt);
|
|
3866
|
-
break;
|
|
3414
|
+
case keycode_js.VALUE_END: dropList.goToLast(evt);
|
|
3867
3415
|
}
|
|
3868
3416
|
break;
|
|
3869
3417
|
case keycode_js.VALUE_SPACE:
|
|
@@ -3893,17 +3441,15 @@
|
|
|
3893
3441
|
evt.preventDefault();
|
|
3894
3442
|
}
|
|
3895
3443
|
break;
|
|
3896
|
-
default:
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
}
|
|
3906
|
-
break;
|
|
3444
|
+
default: if (dropList.isVisible()) dropList._keydownFreeType(evt, false);
|
|
3445
|
+
else if (p.allowTypeToSelect) dropList._keydownFreeType(evt, true);
|
|
3446
|
+
else {
|
|
3447
|
+
this.openList();
|
|
3448
|
+
setTimeout(() => {
|
|
3449
|
+
if (this[DestroyedSymbol]) return;
|
|
3450
|
+
dropList._keydownFreeType(evt, false);
|
|
3451
|
+
});
|
|
3452
|
+
}
|
|
3907
3453
|
}
|
|
3908
3454
|
if (!suppressEnterSpaceToggle) {
|
|
3909
3455
|
if (evt.key === keycode_js.VALUE_ENTER || evt.key === keycode_js.VALUE_SPACE && p.lastKeyAllowsNonTypeKeys && !p.multi && !dropList.hasFocusedItem() && !p.disabled && !p.readOnly) {
|
|
@@ -4123,9 +3669,7 @@
|
|
|
4123
3669
|
if (!p.showSelection) this._syncPlaceholder();
|
|
4124
3670
|
else if (p.multiItemEls[p.multiItemEls.length - 1]?.[ItemSymbol]?.[p.valueProp] === RestMultiItemsSymbol) this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);
|
|
4125
3671
|
break;
|
|
4126
|
-
case "resize_input":
|
|
4127
|
-
this._resizeInput();
|
|
4128
|
-
break;
|
|
3672
|
+
case "resize_input": this._resizeInput();
|
|
4129
3673
|
}
|
|
4130
3674
|
}
|
|
4131
3675
|
/** @private */
|
|
@@ -4146,7 +3690,6 @@
|
|
|
4146
3690
|
p.singleWrapper.innerHTML = "";
|
|
4147
3691
|
}
|
|
4148
3692
|
/**
|
|
4149
|
-
* @param {number} index
|
|
4150
3693
|
* @private
|
|
4151
3694
|
* @internal
|
|
4152
3695
|
*/
|
|
@@ -4171,7 +3714,6 @@
|
|
|
4171
3714
|
}
|
|
4172
3715
|
}
|
|
4173
3716
|
/**
|
|
4174
|
-
* @param {DropList.ItemBase} item
|
|
4175
3717
|
* @private
|
|
4176
3718
|
* @internal
|
|
4177
3719
|
*/
|
|
@@ -4185,8 +3727,6 @@
|
|
|
4185
3727
|
}
|
|
4186
3728
|
}
|
|
4187
3729
|
/**
|
|
4188
|
-
* @param {DropList.ItemBase} item
|
|
4189
|
-
* @param {Element} itemEl
|
|
4190
3730
|
* @private
|
|
4191
3731
|
* @internal
|
|
4192
3732
|
*/
|
|
@@ -4200,7 +3740,6 @@
|
|
|
4200
3740
|
}
|
|
4201
3741
|
}
|
|
4202
3742
|
/**
|
|
4203
|
-
* @param {DropList.ItemBase} item
|
|
4204
3743
|
* @returns {boolean} true if rendered, false if not
|
|
4205
3744
|
* @private
|
|
4206
3745
|
* @internal
|
|
@@ -4274,9 +3813,6 @@
|
|
|
4274
3813
|
}
|
|
4275
3814
|
/**
|
|
4276
3815
|
* Syncs render state, selected items, and position
|
|
4277
|
-
* @param {boolean=false} fullItemsRender Should re-render all items?
|
|
4278
|
-
* @param {boolean=false} updateListItems Should call updateListItems?
|
|
4279
|
-
* @returns {SelectBox}
|
|
4280
3816
|
* @internal
|
|
4281
3817
|
*/
|
|
4282
3818
|
_syncFull(fullItemsRender, updateListItems) {
|
|
@@ -4335,8 +3871,6 @@
|
|
|
4335
3871
|
return this;
|
|
4336
3872
|
}
|
|
4337
3873
|
/**
|
|
4338
|
-
* @param {string} event
|
|
4339
|
-
* @param {*} [data]
|
|
4340
3874
|
* @private
|
|
4341
3875
|
* @internal
|
|
4342
3876
|
*/
|
|
@@ -4348,8 +3882,6 @@
|
|
|
4348
3882
|
}
|
|
4349
3883
|
/**
|
|
4350
3884
|
* Render a multi item
|
|
4351
|
-
* @param {Object} item
|
|
4352
|
-
* @returns {Element|null}
|
|
4353
3885
|
* @private
|
|
4354
3886
|
* @internal
|
|
4355
3887
|
*/
|
|
@@ -4375,9 +3907,6 @@
|
|
|
4375
3907
|
}
|
|
4376
3908
|
/**
|
|
4377
3909
|
* Removes a specific multi item by user event
|
|
4378
|
-
* @param {Element} itemEl
|
|
4379
|
-
* @param {Event} originatingEvent
|
|
4380
|
-
* @returns {SelectBox}
|
|
4381
3910
|
* @private
|
|
4382
3911
|
* @internal
|
|
4383
3912
|
*/
|
|
@@ -4437,8 +3966,6 @@
|
|
|
4437
3966
|
return this;
|
|
4438
3967
|
}
|
|
4439
3968
|
/**
|
|
4440
|
-
* @param {DropList.ItemBase} item
|
|
4441
|
-
* @param {boolean} [populate]
|
|
4442
3969
|
* @private
|
|
4443
3970
|
* @internal
|
|
4444
3971
|
*/
|
|
@@ -4465,7 +3992,6 @@
|
|
|
4465
3992
|
this._scheduleSync("render_list");
|
|
4466
3993
|
}
|
|
4467
3994
|
/**
|
|
4468
|
-
* @param {*} value
|
|
4469
3995
|
* @private
|
|
4470
3996
|
* @internal
|
|
4471
3997
|
*/
|
|
@@ -4478,7 +4004,6 @@
|
|
|
4478
4004
|
}
|
|
4479
4005
|
/**
|
|
4480
4006
|
* Update input size to current state
|
|
4481
|
-
* @returns {SelectBox}
|
|
4482
4007
|
* @private
|
|
4483
4008
|
* @internal
|
|
4484
4009
|
*/
|
|
@@ -4536,7 +4061,6 @@
|
|
|
4536
4061
|
}
|
|
4537
4062
|
/**
|
|
4538
4063
|
* Update autocomplete position if needed
|
|
4539
|
-
* @returns {SelectBox}
|
|
4540
4064
|
* @private
|
|
4541
4065
|
* @internal
|
|
4542
4066
|
*/
|
|
@@ -4552,7 +4076,6 @@
|
|
|
4552
4076
|
return this;
|
|
4553
4077
|
}
|
|
4554
4078
|
/**
|
|
4555
|
-
* @param {KeyboardEvent} event
|
|
4556
4079
|
* @private
|
|
4557
4080
|
* @internal
|
|
4558
4081
|
*/
|
|
@@ -4583,7 +4106,6 @@
|
|
|
4583
4106
|
}
|
|
4584
4107
|
}
|
|
4585
4108
|
/**
|
|
4586
|
-
* @param {KeyboardEvent} event
|
|
4587
4109
|
* @private
|
|
4588
4110
|
* @internal
|
|
4589
4111
|
*/
|
|
@@ -4629,13 +4151,12 @@
|
|
|
4629
4151
|
}
|
|
4630
4152
|
}
|
|
4631
4153
|
/**
|
|
4632
|
-
* @returns {DropList.PositionOptions}
|
|
4633
4154
|
* @private
|
|
4634
4155
|
* @internal
|
|
4635
4156
|
*/
|
|
4636
4157
|
_getDropListPositionOptions() {
|
|
4637
4158
|
return {
|
|
4638
|
-
target: this._p.el,
|
|
4159
|
+
target: /**@type Element*/ this._p.el,
|
|
4639
4160
|
offset: {
|
|
4640
4161
|
x: 0,
|
|
4641
4162
|
y: 0
|
|
@@ -4672,11 +4193,6 @@
|
|
|
4672
4193
|
/**
|
|
4673
4194
|
* Handles sorting, and putting checked items first (according to selectedValues, not item.checked)
|
|
4674
4195
|
* @private
|
|
4675
|
-
* @param {DropList.ItemBase[]} items
|
|
4676
|
-
* @param {boolean=false} sort
|
|
4677
|
-
* @param {boolean=false} sortCheckedFirst
|
|
4678
|
-
* @param {boolean=false} splitCheckedGroups
|
|
4679
|
-
* @returns {DropList.ItemBase[]}
|
|
4680
4196
|
* @internal
|
|
4681
4197
|
*/
|
|
4682
4198
|
_sortItems(items, sort, sortCheckedFirst, splitCheckedGroups) {
|