@danielgindi/selectbox 2.0.58 → 2.0.60

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.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.58
2
+ * @danielgindi/selectbox 2.0.60
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
- * @param {Node} other
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 {DropList.Item} item The item to add. It is copied.
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 {DropList.Item[]} itemsToAdd The items to add. These are copied.
568
- * @param {number} [atIndex=-1] The index to insert at (or -1)
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 {DropList.Item[]} items The items to set. These are copied.
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
- * @returns {DropList.LibraryErrorHandler|undefined}
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 {string} term
811
- * @param {boolean} [performSearch=false] should actually perform the search, or just set the input's text?
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;
@@ -1123,7 +1023,6 @@
1123
1023
  "left": targetBox.left,
1124
1024
  "top": targetBox.top + (invertYPos ? anchor.bottom - position.bottom : anchor.top - position.top)
1125
1025
  };
1126
- if (isRtlDocument) viewCss.left -= document.documentElement.clientWidth - document.documentElement.scrollWidth;
1127
1026
  viewCss.left += anchor.left - position.left;
1128
1027
  if (positionOptions.offset) {
1129
1028
  if (positionOptions.offset.y) if (invertYPos) viewCss.top -= positionOptions.offset.y;
@@ -1164,10 +1063,6 @@
1164
1063
  }
1165
1064
  /**
1166
1065
  * 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
1066
  */
1172
1067
  setItemChecked(value, checked) {
1173
1068
  const p = this._p;
@@ -1187,9 +1082,6 @@
1187
1082
  }
1188
1083
  /**
1189
1084
  * 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
1085
  */
1194
1086
  setCheckedValues(values) {
1195
1087
  const p = this._p;
@@ -1212,11 +1104,9 @@
1212
1104
  }
1213
1105
  /**
1214
1106
  * Get all checked values. Returns array of item values.
1215
- * @public
1216
- * @param {boolean} excludeGroups=false Exclude group items
1217
- * @returns {Array<*>} self
1107
+ * @param excludeGroups Exclude group items
1218
1108
  */
1219
- getCheckedValues(excludeGroups) {
1109
+ getCheckedValues(excludeGroups = false) {
1220
1110
  const p = this._p;
1221
1111
  excludeGroups = excludeGroups && p.groupCount > 0;
1222
1112
  let values = [];
@@ -1230,11 +1120,9 @@
1230
1120
  }
1231
1121
  /**
1232
1122
  * Get all checked items. Returns array of actual item data object.
1233
- * @public
1234
- * @param {boolean} excludeGroups=false Exclude group items
1235
- * @returns {DropList.Item[]}
1123
+ * @param excludeGroups Exclude group items
1236
1124
  */
1237
- getCheckedItems(excludeGroups) {
1125
+ getCheckedItems(excludeGroups = false) {
1238
1126
  const p = this._p;
1239
1127
  excludeGroups = excludeGroups && p.groupCount > 0;
1240
1128
  const items = [];
@@ -1246,12 +1134,6 @@
1246
1134
  }
1247
1135
  return items;
1248
1136
  }
1249
- /**
1250
- *
1251
- * @param {DropList.PositionOptions?} [positionOptions]
1252
- * @returns {DropList}
1253
- * @public
1254
- */
1255
1137
  show(positionOptions) {
1256
1138
  const p = this._p;
1257
1139
  p.hiding = false;
@@ -1335,7 +1217,6 @@
1335
1217
  /**
1336
1218
  * Change visibility of the header element
1337
1219
  * You should probably call `relayout()` after this.
1338
- * @param {boolean} visible
1339
1220
  */
1340
1221
  setHeaderVisible(visible) {
1341
1222
  if (this.isHeaderVisible() === !!visible) return;
@@ -1344,14 +1225,12 @@
1344
1225
  }
1345
1226
  /**
1346
1227
  * Is the header element visible?
1347
- * @returns {boolean}
1348
1228
  */
1349
1229
  isHeaderVisible() {
1350
1230
  return !!this._p.headerEl.parentNode;
1351
1231
  }
1352
1232
  /**
1353
1233
  * Get a reference to the header element in order to add custom content.
1354
- * @returns {Element}
1355
1234
  */
1356
1235
  getHeaderElement() {
1357
1236
  return this._p.headerEl;
@@ -1359,7 +1238,6 @@
1359
1238
  /**
1360
1239
  * Change visibility of the footer element
1361
1240
  * You should probably call `relayout()` after this.
1362
- * @param {boolean} visible
1363
1241
  */
1364
1242
  setFooterVisible(visible) {
1365
1243
  if (this.isFooterVisible() === !!visible) return;
@@ -1368,14 +1246,12 @@
1368
1246
  }
1369
1247
  /**
1370
1248
  * Is the footer element visible?
1371
- * @returns {boolean}
1372
1249
  */
1373
1250
  isFooterVisible() {
1374
1251
  return !!this._p.footerEl.parentNode;
1375
1252
  }
1376
1253
  /**
1377
1254
  * Get a reference to the footer element in order to add custom content.
1378
- * @returns {Element}
1379
1255
  */
1380
1256
  getFooterElement() {
1381
1257
  return this._p.footerEl;
@@ -1383,7 +1259,6 @@
1383
1259
  /**
1384
1260
  * Set inline search visibility
1385
1261
  * You should probably call `relayout()` after this.
1386
- * @param {boolean} searchable
1387
1262
  */
1388
1263
  setSearchable(searchable) {
1389
1264
  const p = this._p;
@@ -1409,7 +1284,6 @@
1409
1284
  }
1410
1285
  /**
1411
1286
  * Set the placeholder text of the inline search box
1412
- * @param {string} placeholder
1413
1287
  */
1414
1288
  setSearchPlaceholder(placeholder) {
1415
1289
  const p = this._p;
@@ -1654,9 +1528,6 @@
1654
1528
  }
1655
1529
  /**
1656
1530
  * Register an event handler
1657
- * @param {(string|'*')?} event
1658
- * @param {function(any)} handler
1659
- * @returns {DropList}
1660
1531
  */
1661
1532
  on(event, handler) {
1662
1533
  this._p.mitt.on(event, handler);
@@ -1664,9 +1535,6 @@
1664
1535
  }
1665
1536
  /**
1666
1537
  * Register a one time event handler
1667
- * @param {(string|'*')?} event
1668
- * @param {function(any)} handler
1669
- * @returns {DropList}
1670
1538
  */
1671
1539
  once(event, handler) {
1672
1540
  let wrapped = (value) => {
@@ -1678,9 +1546,6 @@
1678
1546
  }
1679
1547
  /**
1680
1548
  * 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
1549
  */
1685
1550
  off(event, handler) {
1686
1551
  if (!event && !event) this._p.mitt.all.clear();
@@ -1689,9 +1554,6 @@
1689
1554
  }
1690
1555
  /**
1691
1556
  * Emit an event
1692
- * @param {string} event
1693
- * @param {any} value
1694
- * @returns {DropList}
1695
1557
  */
1696
1558
  emit(event, value) {
1697
1559
  this._p.mitt.emit(event, value);
@@ -1726,8 +1588,6 @@
1726
1588
  return this;
1727
1589
  }
1728
1590
  /**
1729
- * @param {string} event
1730
- * @param {*} [data]
1731
1591
  * @private
1732
1592
  * @internal
1733
1593
  */
@@ -1870,9 +1730,7 @@
1870
1730
  case keycode_js.VALUE_UP:
1871
1731
  this.previous(event);
1872
1732
  break;
1873
- case keycode_js.VALUE_DOWN:
1874
- this.next(event);
1875
- break;
1733
+ case keycode_js.VALUE_DOWN: this.next(event);
1876
1734
  }
1877
1735
  break;
1878
1736
  case keycode_js.VALUE_LEFT:
@@ -2145,7 +2003,6 @@
2145
2003
  }
2146
2004
  /**
2147
2005
  * @private
2148
- * @returns {DropList} self
2149
2006
  * @internal
2150
2007
  */
2151
2008
  _measureItem() {
@@ -2191,8 +2048,7 @@
2191
2048
  }
2192
2049
  /**
2193
2050
  * Determines whether the list should be in virtual mode, depending on the item count.
2194
- * @param {number?} targetItemCount - item count we are expecting. Defaults to current item count
2195
- * @returns {DropList}
2051
+ * @param targetItemCount item count we are expecting. Defaults to current item count
2196
2052
  * @private
2197
2053
  * @internal
2198
2054
  */
@@ -2257,11 +2113,6 @@
2257
2113
  var DestroyedSymbol = Symbol("destroyed");
2258
2114
  var RestMultiItemsSymbol = Symbol("rest_multi_items");
2259
2115
  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
2116
  var hasClass = function(el, className) {
2266
2117
  if (el instanceof Element) return el.classList.contains(className);
2267
2118
  return false;
@@ -2317,12 +2168,6 @@
2317
2168
  closeListWhenLoading: true,
2318
2169
  clearInputWhen: ["single_close", "multi_select_single"]
2319
2170
  };
2320
- /**
2321
- *
2322
- * @param {DropList.ItemBase[]} items
2323
- * @param {string} labelProp
2324
- * @returns {string}
2325
- */
2326
2171
  var defaultMultiPlaceholderFormatter = (items, labelProp) => {
2327
2172
  if (items.length === 0) return "";
2328
2173
  let title = items[0][labelProp] + "";
@@ -2346,9 +2191,6 @@
2346
2191
  return true;
2347
2192
  }
2348
2193
  var SelectBox = class {
2349
- /**
2350
- * @param {SelectBox.Options} options
2351
- */
2352
2194
  constructor(options) {
2353
2195
  const o = { ...DefaultOptions$1 };
2354
2196
  for (let [key, value] of Object.entries(
@@ -2536,21 +2378,15 @@
2536
2378
  }
2537
2379
  /**
2538
2380
  * 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
2381
  */
2543
2382
  droplistElContains(other, considerSubmenus = true) {
2544
2383
  return this._p.dropList?.elContains(other, considerSubmenus);
2545
2384
  }
2546
2385
  /**
2547
2386
  * Enables the control
2548
- * @param {boolean=true} enabled Should the control be enabled?
2549
- * @returns {SelectBox}
2550
2387
  */
2551
- enable(enabled) {
2388
+ enable(enabled = true) {
2552
2389
  const p = this._p;
2553
- if (enabled === void 0) enabled = true;
2554
2390
  p.disabled = !enabled;
2555
2391
  p.el.setAttribute("aria-disabled", p.disabled.toString());
2556
2392
  p.input.disabled = !!p.disabled;
@@ -2561,50 +2397,38 @@
2561
2397
  }
2562
2398
  /**
2563
2399
  * Is the control enabled?
2564
- * @returns {boolean}
2565
2400
  */
2566
2401
  isEnabled() {
2567
2402
  return !this._p.disabled;
2568
2403
  }
2569
2404
  /**
2570
2405
  * Disables the control
2571
- * @param {boolean=true} disabled Should the control be disabled?
2572
- * @returns {SelectBox}
2573
2406
  */
2574
- disable(disabled) {
2575
- return this.enable(disabled === void 0 ? false : !disabled);
2407
+ disable(disabled = true) {
2408
+ return this.enable(!disabled);
2576
2409
  }
2577
2410
  /**
2578
2411
  * Is the control disabled?
2579
- * @returns {boolean}
2580
2412
  */
2581
2413
  isDisabled() {
2582
2414
  return this._p.disabled;
2583
2415
  }
2584
2416
  /**
2585
2417
  * Sets read only mode
2586
- * @param {boolean=true} readOnly Should the control be read only?
2587
- * @returns {SelectBox}
2588
2418
  */
2589
- setReadOnly(readOnly) {
2419
+ setReadOnly(readOnly = true) {
2590
2420
  const p = this._p;
2591
- if (readOnly === void 0) readOnly = true;
2592
2421
  p.readOnly = readOnly;
2593
2422
  p.el.setAttribute("aria-readOnly", p.readOnly.toString());
2594
2423
  p.input.readOnly = !(p.searchable || p.multi) || !!p.readOnly;
2595
2424
  return this;
2596
2425
  }
2597
2426
  /**
2598
- * Is the control enabled?
2599
- * @returns {boolean}
2427
+ * Is the control read only?
2600
2428
  */
2601
2429
  isReadOnly() {
2602
2430
  return this._p.readOnly;
2603
2431
  }
2604
- /**
2605
- * @param {string|string[]} classes
2606
- * @returns {SelectBox}
2607
- */
2608
2432
  setAdditionalClasses(classes) {
2609
2433
  const p = this._p;
2610
2434
  p.additionalClasses = classes;
@@ -2612,10 +2436,8 @@
2612
2436
  return this;
2613
2437
  }
2614
2438
  /**
2615
- *
2616
- * @param {DropList.ItemBase[]} [items]
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}
2439
+ * @param items the items to set (not values)
2440
+ * @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
2441
  */
2620
2442
  setItems(items, resetValues = true) {
2621
2443
  const p = this._p;
@@ -2651,16 +2473,9 @@
2651
2473
  }
2652
2474
  if (p.dropList) p.dropList.updateItemByValue(value, newItem);
2653
2475
  }
2654
- /**
2655
- * @returns {DropList.ItemBase[]|*}
2656
- */
2657
2476
  getItems() {
2658
2477
  return this._p.items;
2659
2478
  }
2660
- /**
2661
- * @param {boolean} clearable
2662
- * @returns {SelectBox}
2663
- */
2664
2479
  setClearable(clearable) {
2665
2480
  clearable = !!clearable;
2666
2481
  if (this._p.clearable === clearable) return this;
@@ -2668,16 +2483,9 @@
2668
2483
  this._scheduleSync("render_clear");
2669
2484
  return this;
2670
2485
  }
2671
- /**
2672
- * @returns {boolean}
2673
- */
2674
2486
  getClearable() {
2675
2487
  return this._p.clearable;
2676
2488
  }
2677
- /**
2678
- * @param {boolean} enabled
2679
- * @returns {SelectBox}
2680
- */
2681
2489
  setHasOpenIndicator(enabled) {
2682
2490
  enabled = !!enabled;
2683
2491
  if (this._p.hasOpenIndicator === enabled) return this;
@@ -2685,31 +2493,20 @@
2685
2493
  this._scheduleSync("render_base");
2686
2494
  return this;
2687
2495
  }
2688
- /**
2689
- * @returns {boolean}
2690
- */
2691
2496
  getHasOpenIndicator() {
2692
2497
  return this._p.hasOpenIndicator;
2693
2498
  }
2694
- /**
2695
- * @param {string} placeholder
2696
- * @returns {SelectBox}
2697
- */
2698
2499
  setPlaceholder(placeholder) {
2699
2500
  this._p.placeholder = placeholder == null ? "" : String(placeholder);
2700
2501
  this._scheduleSync("render_base");
2701
2502
  return this;
2702
2503
  }
2703
- /**
2704
- * @returns {string}
2705
- */
2706
2504
  getPlaceHolder() {
2707
2505
  return this._p.placeholder;
2708
2506
  }
2709
2507
  /**
2710
- * @param {string} term
2711
- * @param {boolean} [performSearch=false] should actually perform the search, or just set the input's text?
2712
- * @returns {SelectBox}
2508
+ * @param term the search term to set
2509
+ * @param performSearch should actually perform the search, or just set the input's text?
2713
2510
  */
2714
2511
  setSearchTerm(term, performSearch = false) {
2715
2512
  const p = this._p;
@@ -2723,9 +2520,6 @@
2723
2520
  }
2724
2521
  return this;
2725
2522
  }
2726
- /**
2727
- * @returns {string}
2728
- */
2729
2523
  getSearchTerm() {
2730
2524
  const p = this._p;
2731
2525
  if (p.input) return p.input.value;
@@ -2735,10 +2529,6 @@
2735
2529
  this._p.dropList?.invokeRefilter();
2736
2530
  return this;
2737
2531
  }
2738
- /**
2739
- * @param {boolean} sortSelectedItems
2740
- * @returns {SelectBox}
2741
- */
2742
2532
  setSortSelectedItems(sortSelectedItems) {
2743
2533
  const p = this._p;
2744
2534
  sortSelectedItems = !!sortSelectedItems;
@@ -2747,16 +2537,9 @@
2747
2537
  this._scheduleSync("render_items");
2748
2538
  return this;
2749
2539
  }
2750
- /**
2751
- * @returns {boolean}
2752
- */
2753
2540
  isSortSelectedItemsEnabled() {
2754
2541
  return this._p.sortSelectedItems;
2755
2542
  }
2756
- /**
2757
- * @param {boolean} sortListItems
2758
- * @returns {SelectBox}
2759
- */
2760
2543
  setSortListItems(sortListItems) {
2761
2544
  const p = this._p;
2762
2545
  sortListItems = !!sortListItems;
@@ -2766,16 +2549,9 @@
2766
2549
  this._scheduleSync("render_list");
2767
2550
  return this;
2768
2551
  }
2769
- /**
2770
- * @returns {boolean}
2771
- */
2772
2552
  isSortListItemsEnabled() {
2773
2553
  return this._p.sortListItems;
2774
2554
  }
2775
- /**
2776
- * @param {boolean} sortListCheckedFirst
2777
- * @returns {SelectBox}
2778
- */
2779
2555
  setSortListCheckedFirst(sortListCheckedFirst) {
2780
2556
  const p = this._p;
2781
2557
  sortListCheckedFirst = !!sortListCheckedFirst;
@@ -2785,16 +2561,9 @@
2785
2561
  this._scheduleSync("render_list");
2786
2562
  return this;
2787
2563
  }
2788
- /**
2789
- * @returns {boolean}
2790
- */
2791
2564
  isSortListCheckedFirstEnabled() {
2792
2565
  return this._p.sortListCheckedFirst;
2793
2566
  }
2794
- /**
2795
- * @param {*[]} values
2796
- * @returns {SelectBox}
2797
- */
2798
2567
  setStickyValues(values) {
2799
2568
  const p = this._p;
2800
2569
  p.stickyValues = Array.isArray(values) ? new Set(values) : null;
@@ -2802,16 +2571,9 @@
2802
2571
  this._scheduleSync("render_list");
2803
2572
  return this;
2804
2573
  }
2805
- /**
2806
- * @returns {*[]}
2807
- */
2808
2574
  getStickyValues() {
2809
2575
  return this._p.stickyValues ? Array.from(this._p.stickyValues) : null;
2810
2576
  }
2811
- /**
2812
- * @param {function(a: DropList.ItemBase, b: DropList.ItemBase):number} comparator
2813
- * @returns {SelectBox}
2814
- */
2815
2577
  setSortItemComparator(comparator) {
2816
2578
  const p = this._p;
2817
2579
  if (p.sortItemComparator === comparator) return this;
@@ -2820,16 +2582,9 @@
2820
2582
  this._scheduleSync("render_list");
2821
2583
  return this;
2822
2584
  }
2823
- /**
2824
- * @returns {function(a: DropList.ItemBase, b: DropList.ItemBase):number}
2825
- */
2826
2585
  getSortItemComparator() {
2827
2586
  return this._p.sortItemComparator;
2828
2587
  }
2829
- /**
2830
- * @param {boolean} treatGroupSelectionAsItems
2831
- * @returns {SelectBox}
2832
- */
2833
2588
  setTreatGroupSelectionAsItems(treatGroupSelectionAsItems) {
2834
2589
  const p = this._p;
2835
2590
  treatGroupSelectionAsItems = !!treatGroupSelectionAsItems;
@@ -2841,16 +2596,9 @@
2841
2596
  this._scheduleSync("render_list");
2842
2597
  return this;
2843
2598
  }
2844
- /**
2845
- * @returns {boolean}
2846
- */
2847
2599
  isTreatGroupSelectionAsItemsEnabled() {
2848
2600
  return !this._p.treatGroupSelectionAsItems;
2849
2601
  }
2850
- /**
2851
- * @param {boolean} splitListCheckedGroups
2852
- * @returns {SelectBox}
2853
- */
2854
2602
  setSplitListCheckedGroups(splitListCheckedGroups) {
2855
2603
  const p = this._p;
2856
2604
  splitListCheckedGroups = !!splitListCheckedGroups;
@@ -2860,16 +2608,9 @@
2860
2608
  this._scheduleSync("render_list");
2861
2609
  return this;
2862
2610
  }
2863
- /**
2864
- * @returns {boolean}
2865
- */
2866
2611
  isSplitListCheckedGroupsEnabled() {
2867
2612
  return this._p.splitListCheckedGroups;
2868
2613
  }
2869
- /**
2870
- * @param {boolean} showSelection
2871
- * @returns {SelectBox}
2872
- */
2873
2614
  setShowSelection(showSelection) {
2874
2615
  const p = this._p;
2875
2616
  showSelection = !!showSelection;
@@ -2878,16 +2619,9 @@
2878
2619
  this._scheduleSync("render_items");
2879
2620
  return this;
2880
2621
  }
2881
- /**
2882
- * @returns {boolean}
2883
- */
2884
2622
  isShowSelectionEnabled() {
2885
2623
  return this._p.showSelection;
2886
2624
  }
2887
- /**
2888
- * @param {boolean} showPlaceholderInTooltip
2889
- * @returns {SelectBox}
2890
- */
2891
2625
  setShowPlaceholderInTooltip(showPlaceholderInTooltip) {
2892
2626
  const p = this._p;
2893
2627
  showPlaceholderInTooltip = !!showPlaceholderInTooltip;
@@ -2896,16 +2630,9 @@
2896
2630
  this._scheduleSync("render_base");
2897
2631
  return this;
2898
2632
  }
2899
- /**
2900
- * @returns {boolean}
2901
- */
2902
2633
  isShowPlaceholderInTooltipEnabled() {
2903
2634
  return this._p.showPlaceholderInTooltip;
2904
2635
  }
2905
- /**
2906
- * @param {function(items: DropList.ItemBase[]):string} formatter
2907
- * @returns {SelectBox}
2908
- */
2909
2636
  setMultiPlaceholderFormatter(formatter) {
2910
2637
  const p = this._p;
2911
2638
  if (p.multiPlaceholderFormatter === formatter) return this;
@@ -2913,26 +2640,15 @@
2913
2640
  this._scheduleSync("render_base");
2914
2641
  return this;
2915
2642
  }
2916
- /**
2917
- * @param {boolean|'touch'} value
2918
- * @returns {SelectBox}
2919
- */
2920
2643
  setBlurOnSingleSelection(value) {
2921
2644
  const p = this._p;
2922
2645
  if (p.blurOnSingleSelection === value) return this;
2923
2646
  p.blurOnSingleSelection = value;
2924
2647
  return this;
2925
2648
  }
2926
- /**
2927
- * @returns {boolean|'touch'}
2928
- */
2929
2649
  getBlurOnSingleSelection() {
2930
2650
  return this._p.blurOnSingleSelection;
2931
2651
  }
2932
- /**
2933
- * @param {boolean} multi
2934
- * @returns {SelectBox}
2935
- */
2936
2652
  setMulti(multi) {
2937
2653
  const p = this._p;
2938
2654
  multi = !!multi;
@@ -2948,16 +2664,9 @@
2948
2664
  this._scheduleSync("full");
2949
2665
  return this;
2950
2666
  }
2951
- /**
2952
- * @returns {boolean}
2953
- */
2954
2667
  isMultiEnabled() {
2955
2668
  return this._p.multi;
2956
2669
  }
2957
- /**
2958
- * @param {boolean} searchable
2959
- * @returns {SelectBox}
2960
- */
2961
2670
  setSearchable(searchable) {
2962
2671
  const p = this._p;
2963
2672
  searchable = !!searchable;
@@ -2966,10 +2675,6 @@
2966
2675
  this._scheduleSync("full");
2967
2676
  return this;
2968
2677
  }
2969
- /**
2970
- * @param {boolean} allowTypeToSelect
2971
- * @returns {SelectBox}
2972
- */
2973
2678
  setAllowTypeToSelect(allowTypeToSelect) {
2974
2679
  const p = this._p;
2975
2680
  allowTypeToSelect = !!allowTypeToSelect;
@@ -2977,129 +2682,71 @@
2977
2682
  p.allowTypeToSelect = allowTypeToSelect;
2978
2683
  return this;
2979
2684
  }
2980
- /**
2981
- * @returns {boolean}
2982
- */
2983
2685
  isSearchableEnabled() {
2984
2686
  return this._p.searchable;
2985
2687
  }
2986
- /**
2987
- * @param {string} noResultsText
2988
- * @returns {SelectBox}
2989
- */
2990
2688
  setNoResultsText(noResultsText) {
2991
2689
  this._p.dropList?.setNoResultsText(noResultsText);
2992
2690
  return this;
2993
2691
  }
2994
- /**
2995
- * @returns {string}
2996
- */
2997
2692
  getNoResultsText() {
2998
2693
  return this._p.noResultsText;
2999
2694
  }
3000
- /**
3001
- * @param {boolean} autoSelectTextOnCheck
3002
- * @returns {SelectBox}
3003
- */
3004
2695
  setAutoSelectTextOnCheck(autoSelectTextOnCheck) {
3005
2696
  this._p.autoSelectTextOnCheck = autoSelectTextOnCheck;
3006
2697
  return this;
3007
2698
  }
3008
- /**
3009
- * @returns {boolean}
3010
- */
3011
2699
  getAutoSelectTextOnCheck() {
3012
2700
  return this._p.autoSelectTextOnCheck;
3013
2701
  }
3014
- /**
3015
- * @param {number} window
3016
- * @returns {SelectBox}
3017
- */
3018
2702
  setFilterThrottleWindow(window) {
3019
2703
  const p = this._p;
3020
2704
  p.filterThrottleWindow = window;
3021
2705
  p.dropList?.setFilterThrottleWindow(window);
3022
2706
  return this;
3023
2707
  }
3024
- /**
3025
- * @returns {number}
3026
- */
3027
2708
  getFilterThrottleWindow() {
3028
2709
  return this._p.filterThrottleWindow;
3029
2710
  }
3030
- /**
3031
- * @param {boolean} value
3032
- * @returns {SelectBox}
3033
- */
3034
2711
  setFilterOnEmptyTerm(value) {
3035
2712
  const p = this._p;
3036
2713
  if (p.filterOnEmptyTerm === value) return this;
3037
2714
  p.dropList?.setFilterOnEmptyTerm(value);
3038
2715
  return this;
3039
2716
  }
3040
- /**
3041
- * @returns {boolean}
3042
- */
3043
2717
  getFilterOnEmptyTerm() {
3044
2718
  return this._p.filterOnEmptyTerm;
3045
2719
  }
3046
- /**
3047
- * @param {DropList.Options} listOptions
3048
- * @returns {SelectBox}
3049
- */
3050
2720
  setListOptions(listOptions) {
3051
2721
  const p = this._p;
3052
2722
  p.listOptions = listOptions;
3053
2723
  this._setupDropdownMenu();
3054
2724
  return this;
3055
2725
  }
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
2726
  setRenderSingleItem(render, unrender) {
3062
2727
  const p = this._p;
3063
2728
  p.renderSingleItem = render;
3064
2729
  p.unrenderSingleItem = unrender;
3065
2730
  return this;
3066
2731
  }
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
2732
  setRenderMultiItem(render, unrender) {
3073
2733
  const p = this._p;
3074
2734
  p.renderMultiItem = render;
3075
2735
  p.unrenderMultiItem = unrender;
3076
2736
  return this;
3077
2737
  }
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
2738
  setRenderRestMultiItem(render, unrender) {
3084
2739
  const p = this._p;
3085
2740
  p.renderRestMultiItem = render;
3086
2741
  p.unrenderRestMultiItem = unrender;
3087
2742
  return this;
3088
2743
  }
3089
- /**
3090
- * @param {string} prop
3091
- * @returns {SelectBox}
3092
- */
3093
2744
  setLabelProp(prop) {
3094
2745
  const p = this._p;
3095
2746
  p.labelProp = prop;
3096
2747
  if (p.dropList) p.dropList.setLabelProp(prop);
3097
2748
  return this;
3098
2749
  }
3099
- /**
3100
- * @param {string} prop
3101
- * @returns {SelectBox}
3102
- */
3103
2750
  setValueProp(prop) {
3104
2751
  const p = this._p;
3105
2752
  if (p.valueProp === prop) return this;
@@ -3108,50 +2755,31 @@
3108
2755
  this._refreshItemByValueMap();
3109
2756
  return this;
3110
2757
  }
3111
- /**
3112
- * @param {string} prop
3113
- * @returns {SelectBox}
3114
- */
3115
2758
  setMultiItemLabelProp(prop) {
3116
2759
  const p = this._p;
3117
2760
  p.multiItemLabelProp = prop;
3118
2761
  this._scheduleSync("render_items");
3119
2762
  return this;
3120
2763
  }
3121
- /**
3122
- * @param {'before'|'after'|'none'} position
3123
- * @returns {SelectBox}
3124
- */
3125
2764
  setMultiItemRemovePosition(position) {
3126
2765
  const p = this._p;
3127
2766
  p.multiItemRemovePosition = position;
3128
2767
  this._scheduleSync("render_items");
3129
2768
  return this;
3130
2769
  }
3131
- /**
3132
- * @param {number|null|undefined} value
3133
- * @returns {SelectBox}
3134
- */
3135
2770
  setMaxMultiItems(value) {
3136
2771
  const p = this._p;
3137
2772
  p.maxMultiItems = value;
3138
2773
  return this;
3139
2774
  }
3140
- /**
3141
- * @param {function(count: number, items: DropList.ItemBase[]):string|null|undefined} value
3142
- * @returns {SelectBox}
3143
- */
3144
2775
  setMultiItemsRestLabelProvider(value) {
3145
2776
  const p = this._p;
3146
2777
  p.multiItemsRestLabelProvider = value;
3147
2778
  return this;
3148
2779
  }
3149
- /**
3150
- * @param {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)} fn
3151
- * @returns {SelectBox}
3152
- */
3153
2780
  setFilterFn(fn) {
3154
2781
  const p = this._p;
2782
+ fn ??= null;
3155
2783
  if (p.filterFn === fn) return this;
3156
2784
  p.filterFn = fn;
3157
2785
  if (!fn) fn = (items, term) => {
@@ -3166,9 +2794,6 @@
3166
2794
  p.dropList?.setFilterFn(fn);
3167
2795
  return this;
3168
2796
  }
3169
- /**
3170
- * @returns {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)}
3171
- */
3172
2797
  getFilterFn() {
3173
2798
  return this._p.filterFn;
3174
2799
  }
@@ -3176,8 +2801,6 @@
3176
2801
  * Sets a handler to intercept internal errors/warnings (e.g. from a throwing `renderMultiItem`/`unrenderSingleItem`)
3177
2802
  * instead of the default `console.error`/`console.warn`. Also used as the default `onError` for the internal
3178
2803
  * `DropList`, unless `listOptions.onError` is set explicitly.
3179
- * @param {SelectBox.LibraryErrorHandler|null} [fn]
3180
- * @returns {SelectBox}
3181
2804
  */
3182
2805
  setOnError(fn) {
3183
2806
  const p = this._p;
@@ -3186,14 +2809,13 @@
3186
2809
  return this;
3187
2810
  }
3188
2811
  /**
3189
- * @returns {SelectBox.LibraryErrorHandler|undefined}
2812
+ * Gets the current `onError` handler, if any.
3190
2813
  */
3191
2814
  getOnError() {
3192
2815
  return this._p.onError;
3193
2816
  }
3194
2817
  /**
3195
2818
  * Focus on input element
3196
- * @returns {SelectBox}
3197
2819
  */
3198
2820
  focusInput() {
3199
2821
  const p = this._p;
@@ -3202,7 +2824,6 @@
3202
2824
  }
3203
2825
  /**
3204
2826
  * Remvoe focus from the input element
3205
- * @returns {SelectBox}
3206
2827
  */
3207
2828
  blurInput() {
3208
2829
  const p = this._p;
@@ -3211,7 +2832,6 @@
3211
2832
  }
3212
2833
  /**
3213
2834
  * Removes all selected items
3214
- * @returns {SelectBox}
3215
2835
  */
3216
2836
  clear() {
3217
2837
  if (!this._performClearWithEvent(true)) return this;
@@ -3220,8 +2840,6 @@
3220
2840
  }
3221
2841
  /**
3222
2842
  * Returns a single value or an array of selected values - depending on `multi` prop
3223
- * @public
3224
- * @returns {*[]}
3225
2843
  */
3226
2844
  getValue() {
3227
2845
  const p = this._p;
@@ -3230,9 +2848,7 @@
3230
2848
  }
3231
2849
  /**
3232
2850
  * Selects the specified value or multiple values - depending on `multi` prop
3233
- * @public
3234
- * @param {*|*[]} value - if `multi`, then an array of values to select, otherwise - a single value to select
3235
- * @returns {SelectBox}
2851
+ * @param value - if `multi`, then an array of values to select, otherwise - a single value to select
3236
2852
  */
3237
2853
  setValue(value) {
3238
2854
  if (this._p.multi) return this.setSelectedValues(Array.isArray(value) ? value : value !== void 0 ? [value] : []);
@@ -3240,17 +2856,12 @@
3240
2856
  }
3241
2857
  /**
3242
2858
  * Returns an array of selected values
3243
- * @public
3244
- * @returns {*[]}
3245
2859
  */
3246
2860
  getSelectedValues() {
3247
2861
  return this._p.selectedValues.slice(0);
3248
2862
  }
3249
2863
  /**
3250
2864
  * Selects the specified values
3251
- * @public
3252
- * @param {*[]} values - an array of *values* to select
3253
- * @returns {SelectBox}
3254
2865
  */
3255
2866
  setSelectedValues(values) {
3256
2867
  const p = this._p, valueProp = p.valueProp;
@@ -3275,16 +2886,12 @@
3275
2886
  }
3276
2887
  /**
3277
2888
  * Returns the count of selected values
3278
- * @public
3279
- * @returns {number}
3280
2889
  */
3281
2890
  getSelectedValueCount() {
3282
2891
  return this._p.selectedValues.length;
3283
2892
  }
3284
2893
  /**
3285
2894
  * Returns an array of selected items
3286
- * @public
3287
- * @returns {Array.<Object>}
3288
2895
  */
3289
2896
  getSelectedItems() {
3290
2897
  return this._p.selectedItems.slice(0);
@@ -3293,17 +2900,11 @@
3293
2900
  * Sets the specified items to "checked" mode.
3294
2901
  * An array of items is passed, not values, because we need to keep track if items,
3295
2902
  * 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
2903
  */
3300
2904
  setSelectedItems(items) {
3301
2905
  this._setSelectedItems(items);
3302
2906
  return this;
3303
2907
  }
3304
- /**
3305
- * @returns {SelectBox}
3306
- */
3307
2908
  openList() {
3308
2909
  const p = this._p;
3309
2910
  if (p.dropList.isVisible()) return this;
@@ -3318,9 +2919,6 @@
3318
2919
  else if (!p.multi && this.getValue() !== void 0) p.dropList.setFocusedItemByValue(this.getValue());
3319
2920
  return this;
3320
2921
  }
3321
- /**
3322
- * @returns {SelectBox}
3323
- */
3324
2922
  closeList() {
3325
2923
  const p = this._p;
3326
2924
  if (this[DestroyedSymbol]) return this;
@@ -3332,32 +2930,17 @@
3332
2930
  }
3333
2931
  return this;
3334
2932
  }
3335
- /**
3336
- * @param {boolean} [open]
3337
- * @returns {SelectBox}
3338
- */
3339
2933
  toggleList(open) {
3340
2934
  const p = this._p;
3341
2935
  if (open === void 0 ? !p.dropList.isVisible() : !!open) return this.openList();
3342
2936
  else return this.closeList();
3343
2937
  }
3344
- /**
3345
- * @returns {boolean}
3346
- */
3347
2938
  isListOpen() {
3348
2939
  return !!this._p.dropListVisible;
3349
2940
  }
3350
- /**
3351
- * @param {boolean} [on]
3352
- * @returns {SelectBox}
3353
- */
3354
2941
  toggleLoading(on) {
3355
2942
  return this.setIsLoadingMode(on === void 0 ? !this.getIsLoadingMode() : !!on);
3356
2943
  }
3357
- /**
3358
- * @param {boolean} isLoadingMode
3359
- * @returns {SelectBox}
3360
- */
3361
2944
  setIsLoadingMode(isLoadingMode) {
3362
2945
  const p = this._p;
3363
2946
  isLoadingMode = isLoadingMode === void 0 ? true : !!isLoadingMode;
@@ -3368,31 +2951,21 @@
3368
2951
  this._scheduleSync("render_base");
3369
2952
  return this;
3370
2953
  }
3371
- /**
3372
- * @returns {boolean}
3373
- */
3374
2954
  getIsLoadingMode() {
3375
2955
  return this._p.isLoadingMode;
3376
2956
  }
3377
2957
  /**
3378
2958
  * Sets whether to close the list when loading mode is enabled
3379
- * @param {boolean} closeListWhenLoading
3380
- * @returns {SelectBox}
3381
2959
  */
3382
2960
  setCloseListWhenLoading(closeListWhenLoading) {
3383
2961
  this._p.closeListWhenLoading = closeListWhenLoading;
3384
2962
  return this;
3385
2963
  }
3386
- /**
3387
- * @returns {boolean}
3388
- */
3389
2964
  getCloseListWhenLoading() {
3390
2965
  return this._p.closeListWhenLoading;
3391
2966
  }
3392
2967
  /**
3393
2968
  * Sets when to clear the input field
3394
- * @param {string[]} clearInputWhen
3395
- * @returns {SelectBox}
3396
2969
  */
3397
2970
  setClearInputWhen(clearInputWhen) {
3398
2971
  this._p.clearInputWhen = Array.isArray(clearInputWhen) ? clearInputWhen.slice(0) : [];
@@ -3400,15 +2973,12 @@
3400
2973
  }
3401
2974
  /**
3402
2975
  * Retrieves the settings for when to clear the input field
3403
- * @returns {string[]}
3404
2976
  */
3405
2977
  getClearInputWhen() {
3406
2978
  return this._p.clearInputWhen;
3407
2979
  }
3408
2980
  /**
3409
2981
  * Sets the appropriate direction for the selectbox
3410
- * @param {'ltr'|'rtl'|'auto'} direction
3411
- * @return {SelectBox}
3412
2982
  */
3413
2983
  setDirection(direction) {
3414
2984
  const p = this._p;
@@ -3418,14 +2988,12 @@
3418
2988
  }
3419
2989
  /**
3420
2990
  * Gets the supplied direction for the selectbox
3421
- * @return {'ltr'|'rtl'|'auto'}
3422
2991
  */
3423
2992
  getDirection() {
3424
2993
  return this._p.direction;
3425
2994
  }
3426
2995
  /**
3427
2996
  * Can be called in case that the selectbox was attached to the dom late and has a weird size.
3428
- * @returns {SelectBox}
3429
2997
  */
3430
2998
  refreshSize() {
3431
2999
  this._resizeInput();
@@ -3433,9 +3001,6 @@
3433
3001
  }
3434
3002
  /**
3435
3003
  * Register an event handler
3436
- * @param {(string|'*')?} event
3437
- * @param {function(any)} handler
3438
- * @returns {SelectBox}
3439
3004
  */
3440
3005
  on(event, handler) {
3441
3006
  this._p.mitt.on(event, handler);
@@ -3443,9 +3008,6 @@
3443
3008
  }
3444
3009
  /**
3445
3010
  * Register a one time event handler
3446
- * @param {(string|'*')?} event
3447
- * @param {function(any)} handler
3448
- * @returns {SelectBox}
3449
3011
  */
3450
3012
  once(event, handler) {
3451
3013
  let wrapped = (value) => {
@@ -3457,9 +3019,6 @@
3457
3019
  }
3458
3020
  /**
3459
3021
  * 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
3022
  */
3464
3023
  off(event, handler) {
3465
3024
  if (!event && !event) this._p.mitt.all.clear();
@@ -3468,9 +3027,6 @@
3468
3027
  }
3469
3028
  /**
3470
3029
  * Emit an event
3471
- * @param {string} event
3472
- * @param {any} value
3473
- * @returns {SelectBox}
3474
3030
  */
3475
3031
  emit(event, value) {
3476
3032
  this._p.mitt.emit(event, value);
@@ -3490,8 +3046,6 @@
3490
3046
  p.subitemByValueMap = null;
3491
3047
  }
3492
3048
  /**
3493
- * @param {*} value
3494
- * @returns {DropList.ItemBase|undefined}
3495
3049
  * @private
3496
3050
  * @internal
3497
3051
  */
@@ -3510,9 +3064,6 @@
3510
3064
  this._addSubitemsToValueMap(p.items, subitemByValueMap, p.valueProp);
3511
3065
  }
3512
3066
  /**
3513
- * @param {DropList.ItemBase[]} items
3514
- * @param {Map<*, DropList.ItemBase>} itemByValueMap
3515
- * @param {string} valueProp
3516
3067
  * @private
3517
3068
  * @internal
3518
3069
  */
@@ -3791,9 +3342,7 @@
3791
3342
  case "search":
3792
3343
  this._trigger("search", event);
3793
3344
  break;
3794
- case "itemschanged":
3795
- this._trigger("itemschanged", event);
3796
- break;
3345
+ case "itemschanged": this._trigger("itemschanged", event);
3797
3346
  }
3798
3347
  }
3799
3348
  });
@@ -3861,9 +3410,7 @@
3861
3410
  case keycode_js.VALUE_HOME:
3862
3411
  dropList.goToFirst(evt);
3863
3412
  break;
3864
- case keycode_js.VALUE_END:
3865
- dropList.goToLast(evt);
3866
- break;
3413
+ case keycode_js.VALUE_END: dropList.goToLast(evt);
3867
3414
  }
3868
3415
  break;
3869
3416
  case keycode_js.VALUE_SPACE:
@@ -3893,17 +3440,15 @@
3893
3440
  evt.preventDefault();
3894
3441
  }
3895
3442
  break;
3896
- default:
3897
- if (dropList.isVisible()) dropList._keydownFreeType(evt, false);
3898
- else if (p.allowTypeToSelect) dropList._keydownFreeType(evt, true);
3899
- else {
3900
- this.openList();
3901
- setTimeout(() => {
3902
- if (this[DestroyedSymbol]) return;
3903
- dropList._keydownFreeType(evt, false);
3904
- });
3905
- }
3906
- break;
3443
+ default: if (dropList.isVisible()) dropList._keydownFreeType(evt, false);
3444
+ else if (p.allowTypeToSelect) dropList._keydownFreeType(evt, true);
3445
+ else {
3446
+ this.openList();
3447
+ setTimeout(() => {
3448
+ if (this[DestroyedSymbol]) return;
3449
+ dropList._keydownFreeType(evt, false);
3450
+ });
3451
+ }
3907
3452
  }
3908
3453
  if (!suppressEnterSpaceToggle) {
3909
3454
  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 +3668,7 @@
4123
3668
  if (!p.showSelection) this._syncPlaceholder();
4124
3669
  else if (p.multiItemEls[p.multiItemEls.length - 1]?.[ItemSymbol]?.[p.valueProp] === RestMultiItemsSymbol) this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);
4125
3670
  break;
4126
- case "resize_input":
4127
- this._resizeInput();
4128
- break;
3671
+ case "resize_input": this._resizeInput();
4129
3672
  }
4130
3673
  }
4131
3674
  /** @private */
@@ -4146,7 +3689,6 @@
4146
3689
  p.singleWrapper.innerHTML = "";
4147
3690
  }
4148
3691
  /**
4149
- * @param {number} index
4150
3692
  * @private
4151
3693
  * @internal
4152
3694
  */
@@ -4171,7 +3713,6 @@
4171
3713
  }
4172
3714
  }
4173
3715
  /**
4174
- * @param {DropList.ItemBase} item
4175
3716
  * @private
4176
3717
  * @internal
4177
3718
  */
@@ -4185,8 +3726,6 @@
4185
3726
  }
4186
3727
  }
4187
3728
  /**
4188
- * @param {DropList.ItemBase} item
4189
- * @param {Element} itemEl
4190
3729
  * @private
4191
3730
  * @internal
4192
3731
  */
@@ -4200,7 +3739,6 @@
4200
3739
  }
4201
3740
  }
4202
3741
  /**
4203
- * @param {DropList.ItemBase} item
4204
3742
  * @returns {boolean} true if rendered, false if not
4205
3743
  * @private
4206
3744
  * @internal
@@ -4274,9 +3812,6 @@
4274
3812
  }
4275
3813
  /**
4276
3814
  * 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
3815
  * @internal
4281
3816
  */
4282
3817
  _syncFull(fullItemsRender, updateListItems) {
@@ -4335,8 +3870,6 @@
4335
3870
  return this;
4336
3871
  }
4337
3872
  /**
4338
- * @param {string} event
4339
- * @param {*} [data]
4340
3873
  * @private
4341
3874
  * @internal
4342
3875
  */
@@ -4348,8 +3881,6 @@
4348
3881
  }
4349
3882
  /**
4350
3883
  * Render a multi item
4351
- * @param {Object} item
4352
- * @returns {Element|null}
4353
3884
  * @private
4354
3885
  * @internal
4355
3886
  */
@@ -4375,9 +3906,6 @@
4375
3906
  }
4376
3907
  /**
4377
3908
  * Removes a specific multi item by user event
4378
- * @param {Element} itemEl
4379
- * @param {Event} originatingEvent
4380
- * @returns {SelectBox}
4381
3909
  * @private
4382
3910
  * @internal
4383
3911
  */
@@ -4437,8 +3965,6 @@
4437
3965
  return this;
4438
3966
  }
4439
3967
  /**
4440
- * @param {DropList.ItemBase} item
4441
- * @param {boolean} [populate]
4442
3968
  * @private
4443
3969
  * @internal
4444
3970
  */
@@ -4465,7 +3991,6 @@
4465
3991
  this._scheduleSync("render_list");
4466
3992
  }
4467
3993
  /**
4468
- * @param {*} value
4469
3994
  * @private
4470
3995
  * @internal
4471
3996
  */
@@ -4478,7 +4003,6 @@
4478
4003
  }
4479
4004
  /**
4480
4005
  * Update input size to current state
4481
- * @returns {SelectBox}
4482
4006
  * @private
4483
4007
  * @internal
4484
4008
  */
@@ -4536,7 +4060,6 @@
4536
4060
  }
4537
4061
  /**
4538
4062
  * Update autocomplete position if needed
4539
- * @returns {SelectBox}
4540
4063
  * @private
4541
4064
  * @internal
4542
4065
  */
@@ -4552,7 +4075,6 @@
4552
4075
  return this;
4553
4076
  }
4554
4077
  /**
4555
- * @param {KeyboardEvent} event
4556
4078
  * @private
4557
4079
  * @internal
4558
4080
  */
@@ -4583,7 +4105,6 @@
4583
4105
  }
4584
4106
  }
4585
4107
  /**
4586
- * @param {KeyboardEvent} event
4587
4108
  * @private
4588
4109
  * @internal
4589
4110
  */
@@ -4629,13 +4150,12 @@
4629
4150
  }
4630
4151
  }
4631
4152
  /**
4632
- * @returns {DropList.PositionOptions}
4633
4153
  * @private
4634
4154
  * @internal
4635
4155
  */
4636
4156
  _getDropListPositionOptions() {
4637
4157
  return {
4638
- target: this._p.el,
4158
+ target: /**@type Element*/ this._p.el,
4639
4159
  offset: {
4640
4160
  x: 0,
4641
4161
  y: 0
@@ -4672,11 +4192,6 @@
4672
4192
  /**
4673
4193
  * Handles sorting, and putting checked items first (according to selectedValues, not item.checked)
4674
4194
  * @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
4195
  * @internal
4681
4196
  */
4682
4197
  _sortItems(items, sort, sortCheckedFirst, splitCheckedGroups) {