@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.es6.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
  import { closestUntil, createElement, next, prev, setElementAttrs } from "@danielgindi/dom-utils/lib/Dom";
@@ -107,9 +107,6 @@ var DefaultOptions = {
107
107
  filterEmptyGroups: false
108
108
  };
109
109
  var DropList = class DropList {
110
- /**
111
- * @param {DropList.Options} options
112
- */
113
110
  constructor(options) {
114
111
  const o = { ...DefaultOptions };
115
112
  for (let [key, value] of Object.entries(
@@ -315,19 +312,13 @@ var DropList = class DropList {
315
312
  }
316
313
  /**
317
314
  * Returns true if other is an inclusive descendant of node, and false otherwise.
318
- * @param {Node} other
319
- * @param {boolean} [considerSubmenus=true]
320
- * @returns {boolean}
315
+ * Accepts `EventTarget` (not just `Node`) since callers pass `event.target`/`event.relatedTarget` directly.
321
316
  */
322
317
  elContains(other, considerSubmenus = true) {
323
318
  if (this.el.contains(other)) return true;
324
319
  if (considerSubmenus && this._p.currentSubDropList?.droplist?.elContains(other)) return true;
325
320
  return false;
326
321
  }
327
- /**
328
- * @param {string|string[]} classes
329
- * @returns {DropList}
330
- */
331
322
  setAdditionalClasses(classes) {
332
323
  const p = this._p;
333
324
  p.additionalClasses = classes;
@@ -336,8 +327,6 @@ var DropList = class DropList {
336
327
  }
337
328
  /**
338
329
  * Sets the appropriate direction for the droplist
339
- * @param {'ltr'|'rtl'|'auto'} direction
340
- * @return {DropList}
341
330
  */
342
331
  setDirection(direction) {
343
332
  const p = this._p;
@@ -347,46 +336,26 @@ var DropList = class DropList {
347
336
  }
348
337
  /**
349
338
  * Gets the supplied direction for the droplist
350
- * @return {'ltr'|'rtl'|'auto'}
351
339
  */
352
340
  getDirection() {
353
341
  return this._p.direction;
354
342
  }
355
- /**
356
- * @param {string} prop
357
- * @returns {DropList}
358
- */
359
343
  setLabelProp(prop) {
360
344
  const p = this._p;
361
345
  p.labelProp = prop;
362
346
  return this;
363
347
  }
364
- /**
365
- *
366
- * @property {function(item: DropList.ItemBase, itemEl: Element):(*|false)} [fn] Function to call when rendering an item element
367
- * @returns {DropList}
368
- */
369
348
  setRenderItem(fn) {
370
349
  const p = this._p;
371
350
  p.renderItem = fn;
372
351
  return this;
373
352
  }
374
- /**
375
- *
376
- * @property {function(item: DropList.ItemBase, itemEl: Element)} [fn] Function to call when rendering an item element
377
- * @returns {DropList}
378
- */
379
353
  setUnrenderItem(fn) {
380
354
  const p = this._p;
381
355
  p.unrenderItem = fn;
382
356
  this._setupUnrenderFunction();
383
357
  return this;
384
358
  }
385
- /**
386
- * @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
387
- * @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
388
- * @returns {DropList}
389
- */
390
359
  setRenderNoResultsItem(render, unrender) {
391
360
  const p = this._p;
392
361
  p.renderNoResultsItem = render;
@@ -432,10 +401,6 @@ var DropList = class DropList {
432
401
  });
433
402
  return this;
434
403
  }
435
- /**
436
- * @param {string} prop
437
- * @returns {DropList}
438
- */
439
404
  setValueProp(prop) {
440
405
  const p = this._p;
441
406
  p.valueProp = prop;
@@ -523,19 +488,16 @@ var DropList = class DropList {
523
488
  return true;
524
489
  }
525
490
  /**
526
- *
527
- * @param {DropList.Item} item The item to add. It is copied.
528
- * @param {number} [atIndex=-1] The index to insert at (or -1)
529
- * @returns {DropList}
491
+ * @param item The item to add. It is copied.
492
+ * @param atIndex The index to insert at (or -1)
530
493
  */
531
494
  addItem(item, atIndex = -1) {
532
495
  return this.addItems([item], atIndex);
533
496
  }
534
497
  /**
535
498
  * Adds items to the menu and renders
536
- * @param {DropList.Item[]} itemsToAdd The items to add. These are copied.
537
- * @param {number} [atIndex=-1] The index to insert at (or -1)
538
- * @returns {DropList}
499
+ * @param itemsToAdd The items to add. These are copied.
500
+ * @param atIndex The index to insert at (or -1)
539
501
  */
540
502
  addItems(itemsToAdd, atIndex = -1) {
541
503
  const p = this._p, labelProp = p.labelProp, valueProp = p.valueProp;
@@ -577,8 +539,7 @@ var DropList = class DropList {
577
539
  }
578
540
  /**
579
541
  * Replaces all current items with the supplied items
580
- * @param {DropList.Item[]} items The items to set. These are copied.
581
- * @returns {DropList}
542
+ * @param items The items to set. These are copied.
582
543
  */
583
544
  setItems(items) {
584
545
  const p = this._p;
@@ -723,8 +684,6 @@ var DropList = class DropList {
723
684
  /**
724
685
  * Return the item element at the given original index, if it exists.
725
686
  * The item may not be currently rendered, and null will be returned
726
- * @param index
727
- * @returns {HTMLElement|null}
728
687
  */
729
688
  itemElementAtIndex(index) {
730
689
  const p = this._p;
@@ -735,16 +694,10 @@ var DropList = class DropList {
735
694
  /**
736
695
  * Return the item element at the given index, if it exists.
737
696
  * The item may not be currently rendered, and null will be returned
738
- * @param index
739
- * @returns {HTMLElement|null}
740
697
  */
741
698
  filteredElementItemAtIndex(index) {
742
699
  return this._p.virtualListHelper.getItemElementAt(index) ?? null;
743
700
  }
744
- /**
745
- * @param {function(dropList: DropList):DropList.PositionOptions} fn
746
- * @returns {DropList}
747
- */
748
701
  setPositionOptionsProvider(fn) {
749
702
  const p = this._p;
750
703
  if (p.positionOptionsProvider === fn) return this;
@@ -752,17 +705,12 @@ var DropList = class DropList {
752
705
  this.relayout();
753
706
  return this;
754
707
  }
755
- /**
756
- * @returns {function(dropList: DropList):DropList.PositionOptions|null}
757
- */
758
708
  getPositionOptionsProvider() {
759
709
  return this._p.positionOptionsProvider;
760
710
  }
761
711
  /**
762
712
  * Sets a handler to intercept internal errors/warnings (e.g. from a throwing `renderItem`/`unrenderItem`)
763
713
  * instead of the default `console.error`/`console.warn`.
764
- * @param {DropList.LibraryErrorHandler|null} [fn]
765
- * @returns {DropList}
766
714
  */
767
715
  setOnError(fn) {
768
716
  const p = this._p;
@@ -770,15 +718,14 @@ var DropList = class DropList {
770
718
  return this;
771
719
  }
772
720
  /**
773
- * @returns {DropList.LibraryErrorHandler|undefined}
721
+ * Gets the current `onError` handler, if any.
774
722
  */
775
723
  getOnError() {
776
724
  return this._p.onError;
777
725
  }
778
726
  /**
779
- * @param {string} term
780
- * @param {boolean} [performSearch=false] should actually perform the search, or just set the input's text?
781
- * @returns {DropList}
727
+ * @param term the search term to set
728
+ * @param performSearch should actually perform the search, or just set the input's text?
782
729
  */
783
730
  setSearchTerm(term, performSearch = false) {
784
731
  const p = this._p;
@@ -883,26 +830,15 @@ var DropList = class DropList {
883
830
  if (p.items) return p.items.length;
884
831
  return 0;
885
832
  }
886
- /**
887
- * @param {string} noResultsText
888
- * @returns {DropList}
889
- */
890
833
  setNoResultsText(noResultsText) {
891
834
  const p = this._p;
892
835
  p.noResultsText = noResultsText;
893
836
  if (p.hasNoResultsItem) p.virtualListHelper.refreshItemAt(0).render();
894
837
  return this;
895
838
  }
896
- /**
897
- * @returns {string}
898
- */
899
839
  getNoResultsText() {
900
840
  return this._p.noResultsText;
901
841
  }
902
- /**
903
- * @param {number} window
904
- * @returns {DropList}
905
- */
906
842
  setFilterThrottleWindow(window) {
907
843
  const p = this._p;
908
844
  p.filterThrottleWindow = window;
@@ -912,16 +848,9 @@ var DropList = class DropList {
912
848
  if (isScheduled) p.throttledRefilterItems();
913
849
  return this;
914
850
  }
915
- /**
916
- * @returns {number}
917
- */
918
851
  getFilterThrottleWindow() {
919
852
  return this._p.filterThrottleWindow;
920
853
  }
921
- /**
922
- * @param {boolean} value
923
- * @returns {DropList}
924
- */
925
854
  setFilterOnEmptyTerm(value) {
926
855
  const p = this._p;
927
856
  if (p.filterOnEmptyTerm === value) return this;
@@ -929,16 +858,9 @@ var DropList = class DropList {
929
858
  p.throttledRefilterItems();
930
859
  return this;
931
860
  }
932
- /**
933
- * @returns {boolean}
934
- */
935
861
  getFilterOnEmptyTerm() {
936
862
  return this._p.filterOnEmptyTerm;
937
863
  }
938
- /**
939
- * @param {boolean} value
940
- * @returns {DropList}
941
- */
942
864
  setFilterGroups(value) {
943
865
  const p = this._p;
944
866
  if (p.filterGroups === value) return this;
@@ -946,52 +868,30 @@ var DropList = class DropList {
946
868
  p.throttledRefilterItems();
947
869
  return this;
948
870
  }
949
- /**
950
- * @returns {boolean}
951
- */
952
871
  getFilterGroups() {
953
872
  return this._p.filterGroups;
954
873
  }
955
- /**
956
- * @param {boolean} value
957
- * @returns {DropList}
958
- */
959
- setFilterEmptyGroups(value) {
874
+ setFilterEmptyGroups(value = true) {
960
875
  const p = this._p;
961
876
  if (p.filterEmptyGroups === value) return this;
962
877
  p.filterEmptyGroups = value;
963
878
  p.throttledRefilterItems();
964
879
  return this;
965
880
  }
966
- /**
967
- * @returns {boolean}
968
- */
969
881
  getFilterEmptyGroups() {
970
882
  return this._p.filterEmptyGroups;
971
883
  }
972
- /**
973
- * @param {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)} fn
974
- * @returns {DropList}
975
- */
976
884
  setFilterFn(fn) {
977
885
  const p = this._p;
886
+ fn ??= null;
978
887
  if (p.filterFn === fn) return this;
979
888
  p.filterFn = fn;
980
889
  p.throttledRefilterItems();
981
890
  return this;
982
891
  }
983
- /**
984
- * @returns {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)}
985
- */
986
892
  getFilterFn() {
987
893
  return this._p.filterFn;
988
894
  }
989
- /**
990
- *
991
- * @param {DropList.PositionOptions} [positionOptions]
992
- * @returns {DropList}
993
- * @public
994
- */
995
895
  relayout(positionOptions) {
996
896
  const p = this._p, el = p.el, menuEl = p.menuEl;
997
897
  if (!this.isVisible()) return this;
@@ -1092,7 +992,6 @@ var DropList = class DropList {
1092
992
  "left": targetBox.left,
1093
993
  "top": targetBox.top + (invertYPos ? anchor.bottom - position.bottom : anchor.top - position.top)
1094
994
  };
1095
- if (isRtlDocument) viewCss.left -= document.documentElement.clientWidth - document.documentElement.scrollWidth;
1096
995
  viewCss.left += anchor.left - position.left;
1097
996
  if (positionOptions.offset) {
1098
997
  if (positionOptions.offset.y) if (invertYPos) viewCss.top -= positionOptions.offset.y;
@@ -1116,7 +1015,10 @@ var DropList = class DropList {
1116
1015
  viewCss.top += "px";
1117
1016
  setCssProps(el, viewCss);
1118
1017
  setElementHeight(el, viewSize.height, true, true);
1119
- if (menuEl !== el) setElementHeight(menuEl, viewSize.height - headerHeight - footerHeight - verticalBorderWidth - verticalPadding, true, true);
1018
+ if (menuEl !== el) {
1019
+ let menuHeight = viewSize.height - headerHeight - footerHeight - verticalBorderWidth - verticalPadding;
1020
+ setElementHeight(menuEl, menuHeight, true, true);
1021
+ }
1120
1022
  p.virtualListHelper.render();
1121
1023
  if (positionOptions && positionOptions.target) {
1122
1024
  p.lastPositionTarget = positionOptions.target;
@@ -1130,10 +1032,6 @@ var DropList = class DropList {
1130
1032
  }
1131
1033
  /**
1132
1034
  * Set the checked mode of a specific value.
1133
- * @public
1134
- * @param {*} value - array of values to check
1135
- * @param {boolean} checked - will the value be checked?
1136
- * @returns {DropList} self
1137
1035
  */
1138
1036
  setItemChecked(value, checked) {
1139
1037
  const p = this._p;
@@ -1153,9 +1051,6 @@ var DropList = class DropList {
1153
1051
  }
1154
1052
  /**
1155
1053
  * Set the checked values. All the other values will be unchecked,
1156
- * @public
1157
- * @param {Array<*>} values - array of values to check
1158
- * @returns {DropList} self
1159
1054
  */
1160
1055
  setCheckedValues(values) {
1161
1056
  const p = this._p;
@@ -1178,11 +1073,9 @@ var DropList = class DropList {
1178
1073
  }
1179
1074
  /**
1180
1075
  * Get all checked values. Returns array of item values.
1181
- * @public
1182
- * @param {boolean} excludeGroups=false Exclude group items
1183
- * @returns {Array<*>} self
1076
+ * @param excludeGroups Exclude group items
1184
1077
  */
1185
- getCheckedValues(excludeGroups) {
1078
+ getCheckedValues(excludeGroups = false) {
1186
1079
  const p = this._p;
1187
1080
  excludeGroups = excludeGroups && p.groupCount > 0;
1188
1081
  let values = [];
@@ -1196,11 +1089,9 @@ var DropList = class DropList {
1196
1089
  }
1197
1090
  /**
1198
1091
  * Get all checked items. Returns array of actual item data object.
1199
- * @public
1200
- * @param {boolean} excludeGroups=false Exclude group items
1201
- * @returns {DropList.Item[]}
1092
+ * @param excludeGroups Exclude group items
1202
1093
  */
1203
- getCheckedItems(excludeGroups) {
1094
+ getCheckedItems(excludeGroups = false) {
1204
1095
  const p = this._p;
1205
1096
  excludeGroups = excludeGroups && p.groupCount > 0;
1206
1097
  const items = [];
@@ -1212,12 +1103,6 @@ var DropList = class DropList {
1212
1103
  }
1213
1104
  return items;
1214
1105
  }
1215
- /**
1216
- *
1217
- * @param {DropList.PositionOptions?} [positionOptions]
1218
- * @returns {DropList}
1219
- * @public
1220
- */
1221
1106
  show(positionOptions) {
1222
1107
  const p = this._p;
1223
1108
  p.hiding = false;
@@ -1301,7 +1186,6 @@ var DropList = class DropList {
1301
1186
  /**
1302
1187
  * Change visibility of the header element
1303
1188
  * You should probably call `relayout()` after this.
1304
- * @param {boolean} visible
1305
1189
  */
1306
1190
  setHeaderVisible(visible) {
1307
1191
  if (this.isHeaderVisible() === !!visible) return;
@@ -1310,14 +1194,12 @@ var DropList = class DropList {
1310
1194
  }
1311
1195
  /**
1312
1196
  * Is the header element visible?
1313
- * @returns {boolean}
1314
1197
  */
1315
1198
  isHeaderVisible() {
1316
1199
  return !!this._p.headerEl.parentNode;
1317
1200
  }
1318
1201
  /**
1319
1202
  * Get a reference to the header element in order to add custom content.
1320
- * @returns {Element}
1321
1203
  */
1322
1204
  getHeaderElement() {
1323
1205
  return this._p.headerEl;
@@ -1325,7 +1207,6 @@ var DropList = class DropList {
1325
1207
  /**
1326
1208
  * Change visibility of the footer element
1327
1209
  * You should probably call `relayout()` after this.
1328
- * @param {boolean} visible
1329
1210
  */
1330
1211
  setFooterVisible(visible) {
1331
1212
  if (this.isFooterVisible() === !!visible) return;
@@ -1334,14 +1215,12 @@ var DropList = class DropList {
1334
1215
  }
1335
1216
  /**
1336
1217
  * Is the footer element visible?
1337
- * @returns {boolean}
1338
1218
  */
1339
1219
  isFooterVisible() {
1340
1220
  return !!this._p.footerEl.parentNode;
1341
1221
  }
1342
1222
  /**
1343
1223
  * Get a reference to the footer element in order to add custom content.
1344
- * @returns {Element}
1345
1224
  */
1346
1225
  getFooterElement() {
1347
1226
  return this._p.footerEl;
@@ -1349,7 +1228,6 @@ var DropList = class DropList {
1349
1228
  /**
1350
1229
  * Set inline search visibility
1351
1230
  * You should probably call `relayout()` after this.
1352
- * @param {boolean} searchable
1353
1231
  */
1354
1232
  setSearchable(searchable) {
1355
1233
  const p = this._p;
@@ -1375,7 +1253,6 @@ var DropList = class DropList {
1375
1253
  }
1376
1254
  /**
1377
1255
  * Set the placeholder text of the inline search box
1378
- * @param {string} placeholder
1379
1256
  */
1380
1257
  setSearchPlaceholder(placeholder) {
1381
1258
  const p = this._p;
@@ -1620,9 +1497,6 @@ var DropList = class DropList {
1620
1497
  }
1621
1498
  /**
1622
1499
  * Register an event handler
1623
- * @param {(string|'*')?} event
1624
- * @param {function(any)} handler
1625
- * @returns {DropList}
1626
1500
  */
1627
1501
  on(event, handler) {
1628
1502
  this._p.mitt.on(event, handler);
@@ -1630,9 +1504,6 @@ var DropList = class DropList {
1630
1504
  }
1631
1505
  /**
1632
1506
  * Register a one time event handler
1633
- * @param {(string|'*')?} event
1634
- * @param {function(any)} handler
1635
- * @returns {DropList}
1636
1507
  */
1637
1508
  once(event, handler) {
1638
1509
  let wrapped = (value) => {
@@ -1644,9 +1515,6 @@ var DropList = class DropList {
1644
1515
  }
1645
1516
  /**
1646
1517
  * Remove an `handler` for `event`, all events for `event`, or all events completely.
1647
- * @param {(string|'*')?} event
1648
- * @param {function(any)} handler
1649
- * @returns {DropList}
1650
1518
  */
1651
1519
  off(event, handler) {
1652
1520
  if (!event && !event) this._p.mitt.all.clear();
@@ -1655,9 +1523,6 @@ var DropList = class DropList {
1655
1523
  }
1656
1524
  /**
1657
1525
  * Emit an event
1658
- * @param {string} event
1659
- * @param {any} value
1660
- * @returns {DropList}
1661
1526
  */
1662
1527
  emit(event, value) {
1663
1528
  this._p.mitt.emit(event, value);
@@ -1692,8 +1557,6 @@ var DropList = class DropList {
1692
1557
  return this;
1693
1558
  }
1694
1559
  /**
1695
- * @param {string} event
1696
- * @param {*} [data]
1697
1560
  * @private
1698
1561
  * @internal
1699
1562
  */
@@ -1836,9 +1699,7 @@ var DropList = class DropList {
1836
1699
  case VALUE_UP:
1837
1700
  this.previous(event);
1838
1701
  break;
1839
- case VALUE_DOWN:
1840
- this.next(event);
1841
- break;
1702
+ case VALUE_DOWN: this.next(event);
1842
1703
  }
1843
1704
  break;
1844
1705
  case VALUE_LEFT:
@@ -2111,7 +1972,6 @@ var DropList = class DropList {
2111
1972
  }
2112
1973
  /**
2113
1974
  * @private
2114
- * @returns {DropList} self
2115
1975
  * @internal
2116
1976
  */
2117
1977
  _measureItem() {
@@ -2157,8 +2017,7 @@ var DropList = class DropList {
2157
2017
  }
2158
2018
  /**
2159
2019
  * Determines whether the list should be in virtual mode, depending on the item count.
2160
- * @param {number?} targetItemCount - item count we are expecting. Defaults to current item count
2161
- * @returns {DropList}
2020
+ * @param targetItemCount item count we are expecting. Defaults to current item count
2162
2021
  * @private
2163
2022
  * @internal
2164
2023
  */
@@ -2223,11 +2082,6 @@ var DropList = class DropList {
2223
2082
  var DestroyedSymbol = Symbol("destroyed");
2224
2083
  var RestMultiItemsSymbol = Symbol("rest_multi_items");
2225
2084
  var hasTouchCapability = !!("ontouchstart" in window || window.DocumentTouch && window.document instanceof window.DocumentTouch || window.navigator.maxTouchPoints);
2226
- /**
2227
- * @param {Element|EventTarget} el
2228
- * @param {string} className
2229
- * @returns {boolean}
2230
- */
2231
2085
  var hasClass = function(el, className) {
2232
2086
  if (el instanceof Element) return el.classList.contains(className);
2233
2087
  return false;
@@ -2283,12 +2137,6 @@ var DefaultOptions$1 = {
2283
2137
  closeListWhenLoading: true,
2284
2138
  clearInputWhen: ["single_close", "multi_select_single"]
2285
2139
  };
2286
- /**
2287
- *
2288
- * @param {DropList.ItemBase[]} items
2289
- * @param {string} labelProp
2290
- * @returns {string}
2291
- */
2292
2140
  var defaultMultiPlaceholderFormatter = (items, labelProp) => {
2293
2141
  if (items.length === 0) return "";
2294
2142
  let title = items[0][labelProp] + "";
@@ -2312,9 +2160,6 @@ function restoreFocusState(state) {
2312
2160
  return true;
2313
2161
  }
2314
2162
  var SelectBox = class {
2315
- /**
2316
- * @param {SelectBox.Options} options
2317
- */
2318
2163
  constructor(options) {
2319
2164
  const o = { ...DefaultOptions$1 };
2320
2165
  for (let [key, value] of Object.entries(
@@ -2502,21 +2347,15 @@ var SelectBox = class {
2502
2347
  }
2503
2348
  /**
2504
2349
  * Returns true if other is an inclusive descendant of droplist node, false otherwise, and undefined if the droplist is not initiated.
2505
- * @param {Node} other
2506
- * @param {boolean} [considerSubmenus=true]
2507
- * @returns {boolean|undefined}
2508
2350
  */
2509
2351
  droplistElContains(other, considerSubmenus = true) {
2510
2352
  return this._p.dropList?.elContains(other, considerSubmenus);
2511
2353
  }
2512
2354
  /**
2513
2355
  * Enables the control
2514
- * @param {boolean=true} enabled Should the control be enabled?
2515
- * @returns {SelectBox}
2516
2356
  */
2517
- enable(enabled) {
2357
+ enable(enabled = true) {
2518
2358
  const p = this._p;
2519
- if (enabled === void 0) enabled = true;
2520
2359
  p.disabled = !enabled;
2521
2360
  p.el.setAttribute("aria-disabled", p.disabled.toString());
2522
2361
  p.input.disabled = !!p.disabled;
@@ -2527,50 +2366,38 @@ var SelectBox = class {
2527
2366
  }
2528
2367
  /**
2529
2368
  * Is the control enabled?
2530
- * @returns {boolean}
2531
2369
  */
2532
2370
  isEnabled() {
2533
2371
  return !this._p.disabled;
2534
2372
  }
2535
2373
  /**
2536
2374
  * Disables the control
2537
- * @param {boolean=true} disabled Should the control be disabled?
2538
- * @returns {SelectBox}
2539
2375
  */
2540
- disable(disabled) {
2541
- return this.enable(disabled === void 0 ? false : !disabled);
2376
+ disable(disabled = true) {
2377
+ return this.enable(!disabled);
2542
2378
  }
2543
2379
  /**
2544
2380
  * Is the control disabled?
2545
- * @returns {boolean}
2546
2381
  */
2547
2382
  isDisabled() {
2548
2383
  return this._p.disabled;
2549
2384
  }
2550
2385
  /**
2551
2386
  * Sets read only mode
2552
- * @param {boolean=true} readOnly Should the control be read only?
2553
- * @returns {SelectBox}
2554
2387
  */
2555
- setReadOnly(readOnly) {
2388
+ setReadOnly(readOnly = true) {
2556
2389
  const p = this._p;
2557
- if (readOnly === void 0) readOnly = true;
2558
2390
  p.readOnly = readOnly;
2559
2391
  p.el.setAttribute("aria-readOnly", p.readOnly.toString());
2560
2392
  p.input.readOnly = !(p.searchable || p.multi) || !!p.readOnly;
2561
2393
  return this;
2562
2394
  }
2563
2395
  /**
2564
- * Is the control enabled?
2565
- * @returns {boolean}
2396
+ * Is the control read only?
2566
2397
  */
2567
2398
  isReadOnly() {
2568
2399
  return this._p.readOnly;
2569
2400
  }
2570
- /**
2571
- * @param {string|string[]} classes
2572
- * @returns {SelectBox}
2573
- */
2574
2401
  setAdditionalClasses(classes) {
2575
2402
  const p = this._p;
2576
2403
  p.additionalClasses = classes;
@@ -2578,10 +2405,8 @@ var SelectBox = class {
2578
2405
  return this;
2579
2406
  }
2580
2407
  /**
2581
- *
2582
- * @param {DropList.ItemBase[]} [items]
2583
- * @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
2584
- * @returns {SelectBox}
2408
+ * @param items the items to set (not values)
2409
+ * @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
2585
2410
  */
2586
2411
  setItems(items, resetValues = true) {
2587
2412
  const p = this._p;
@@ -2617,16 +2442,9 @@ var SelectBox = class {
2617
2442
  }
2618
2443
  if (p.dropList) p.dropList.updateItemByValue(value, newItem);
2619
2444
  }
2620
- /**
2621
- * @returns {DropList.ItemBase[]|*}
2622
- */
2623
2445
  getItems() {
2624
2446
  return this._p.items;
2625
2447
  }
2626
- /**
2627
- * @param {boolean} clearable
2628
- * @returns {SelectBox}
2629
- */
2630
2448
  setClearable(clearable) {
2631
2449
  clearable = !!clearable;
2632
2450
  if (this._p.clearable === clearable) return this;
@@ -2634,16 +2452,9 @@ var SelectBox = class {
2634
2452
  this._scheduleSync("render_clear");
2635
2453
  return this;
2636
2454
  }
2637
- /**
2638
- * @returns {boolean}
2639
- */
2640
2455
  getClearable() {
2641
2456
  return this._p.clearable;
2642
2457
  }
2643
- /**
2644
- * @param {boolean} enabled
2645
- * @returns {SelectBox}
2646
- */
2647
2458
  setHasOpenIndicator(enabled) {
2648
2459
  enabled = !!enabled;
2649
2460
  if (this._p.hasOpenIndicator === enabled) return this;
@@ -2651,31 +2462,20 @@ var SelectBox = class {
2651
2462
  this._scheduleSync("render_base");
2652
2463
  return this;
2653
2464
  }
2654
- /**
2655
- * @returns {boolean}
2656
- */
2657
2465
  getHasOpenIndicator() {
2658
2466
  return this._p.hasOpenIndicator;
2659
2467
  }
2660
- /**
2661
- * @param {string} placeholder
2662
- * @returns {SelectBox}
2663
- */
2664
2468
  setPlaceholder(placeholder) {
2665
2469
  this._p.placeholder = placeholder == null ? "" : String(placeholder);
2666
2470
  this._scheduleSync("render_base");
2667
2471
  return this;
2668
2472
  }
2669
- /**
2670
- * @returns {string}
2671
- */
2672
2473
  getPlaceHolder() {
2673
2474
  return this._p.placeholder;
2674
2475
  }
2675
2476
  /**
2676
- * @param {string} term
2677
- * @param {boolean} [performSearch=false] should actually perform the search, or just set the input's text?
2678
- * @returns {SelectBox}
2477
+ * @param term the search term to set
2478
+ * @param performSearch should actually perform the search, or just set the input's text?
2679
2479
  */
2680
2480
  setSearchTerm(term, performSearch = false) {
2681
2481
  const p = this._p;
@@ -2689,9 +2489,6 @@ var SelectBox = class {
2689
2489
  }
2690
2490
  return this;
2691
2491
  }
2692
- /**
2693
- * @returns {string}
2694
- */
2695
2492
  getSearchTerm() {
2696
2493
  const p = this._p;
2697
2494
  if (p.input) return p.input.value;
@@ -2701,10 +2498,6 @@ var SelectBox = class {
2701
2498
  this._p.dropList?.invokeRefilter();
2702
2499
  return this;
2703
2500
  }
2704
- /**
2705
- * @param {boolean} sortSelectedItems
2706
- * @returns {SelectBox}
2707
- */
2708
2501
  setSortSelectedItems(sortSelectedItems) {
2709
2502
  const p = this._p;
2710
2503
  sortSelectedItems = !!sortSelectedItems;
@@ -2713,16 +2506,9 @@ var SelectBox = class {
2713
2506
  this._scheduleSync("render_items");
2714
2507
  return this;
2715
2508
  }
2716
- /**
2717
- * @returns {boolean}
2718
- */
2719
2509
  isSortSelectedItemsEnabled() {
2720
2510
  return this._p.sortSelectedItems;
2721
2511
  }
2722
- /**
2723
- * @param {boolean} sortListItems
2724
- * @returns {SelectBox}
2725
- */
2726
2512
  setSortListItems(sortListItems) {
2727
2513
  const p = this._p;
2728
2514
  sortListItems = !!sortListItems;
@@ -2732,16 +2518,9 @@ var SelectBox = class {
2732
2518
  this._scheduleSync("render_list");
2733
2519
  return this;
2734
2520
  }
2735
- /**
2736
- * @returns {boolean}
2737
- */
2738
2521
  isSortListItemsEnabled() {
2739
2522
  return this._p.sortListItems;
2740
2523
  }
2741
- /**
2742
- * @param {boolean} sortListCheckedFirst
2743
- * @returns {SelectBox}
2744
- */
2745
2524
  setSortListCheckedFirst(sortListCheckedFirst) {
2746
2525
  const p = this._p;
2747
2526
  sortListCheckedFirst = !!sortListCheckedFirst;
@@ -2751,16 +2530,9 @@ var SelectBox = class {
2751
2530
  this._scheduleSync("render_list");
2752
2531
  return this;
2753
2532
  }
2754
- /**
2755
- * @returns {boolean}
2756
- */
2757
2533
  isSortListCheckedFirstEnabled() {
2758
2534
  return this._p.sortListCheckedFirst;
2759
2535
  }
2760
- /**
2761
- * @param {*[]} values
2762
- * @returns {SelectBox}
2763
- */
2764
2536
  setStickyValues(values) {
2765
2537
  const p = this._p;
2766
2538
  p.stickyValues = Array.isArray(values) ? new Set(values) : null;
@@ -2768,16 +2540,9 @@ var SelectBox = class {
2768
2540
  this._scheduleSync("render_list");
2769
2541
  return this;
2770
2542
  }
2771
- /**
2772
- * @returns {*[]}
2773
- */
2774
2543
  getStickyValues() {
2775
2544
  return this._p.stickyValues ? Array.from(this._p.stickyValues) : null;
2776
2545
  }
2777
- /**
2778
- * @param {function(a: DropList.ItemBase, b: DropList.ItemBase):number} comparator
2779
- * @returns {SelectBox}
2780
- */
2781
2546
  setSortItemComparator(comparator) {
2782
2547
  const p = this._p;
2783
2548
  if (p.sortItemComparator === comparator) return this;
@@ -2786,16 +2551,9 @@ var SelectBox = class {
2786
2551
  this._scheduleSync("render_list");
2787
2552
  return this;
2788
2553
  }
2789
- /**
2790
- * @returns {function(a: DropList.ItemBase, b: DropList.ItemBase):number}
2791
- */
2792
2554
  getSortItemComparator() {
2793
2555
  return this._p.sortItemComparator;
2794
2556
  }
2795
- /**
2796
- * @param {boolean} treatGroupSelectionAsItems
2797
- * @returns {SelectBox}
2798
- */
2799
2557
  setTreatGroupSelectionAsItems(treatGroupSelectionAsItems) {
2800
2558
  const p = this._p;
2801
2559
  treatGroupSelectionAsItems = !!treatGroupSelectionAsItems;
@@ -2807,16 +2565,9 @@ var SelectBox = class {
2807
2565
  this._scheduleSync("render_list");
2808
2566
  return this;
2809
2567
  }
2810
- /**
2811
- * @returns {boolean}
2812
- */
2813
2568
  isTreatGroupSelectionAsItemsEnabled() {
2814
2569
  return !this._p.treatGroupSelectionAsItems;
2815
2570
  }
2816
- /**
2817
- * @param {boolean} splitListCheckedGroups
2818
- * @returns {SelectBox}
2819
- */
2820
2571
  setSplitListCheckedGroups(splitListCheckedGroups) {
2821
2572
  const p = this._p;
2822
2573
  splitListCheckedGroups = !!splitListCheckedGroups;
@@ -2826,16 +2577,9 @@ var SelectBox = class {
2826
2577
  this._scheduleSync("render_list");
2827
2578
  return this;
2828
2579
  }
2829
- /**
2830
- * @returns {boolean}
2831
- */
2832
2580
  isSplitListCheckedGroupsEnabled() {
2833
2581
  return this._p.splitListCheckedGroups;
2834
2582
  }
2835
- /**
2836
- * @param {boolean} showSelection
2837
- * @returns {SelectBox}
2838
- */
2839
2583
  setShowSelection(showSelection) {
2840
2584
  const p = this._p;
2841
2585
  showSelection = !!showSelection;
@@ -2844,16 +2588,9 @@ var SelectBox = class {
2844
2588
  this._scheduleSync("render_items");
2845
2589
  return this;
2846
2590
  }
2847
- /**
2848
- * @returns {boolean}
2849
- */
2850
2591
  isShowSelectionEnabled() {
2851
2592
  return this._p.showSelection;
2852
2593
  }
2853
- /**
2854
- * @param {boolean} showPlaceholderInTooltip
2855
- * @returns {SelectBox}
2856
- */
2857
2594
  setShowPlaceholderInTooltip(showPlaceholderInTooltip) {
2858
2595
  const p = this._p;
2859
2596
  showPlaceholderInTooltip = !!showPlaceholderInTooltip;
@@ -2862,16 +2599,9 @@ var SelectBox = class {
2862
2599
  this._scheduleSync("render_base");
2863
2600
  return this;
2864
2601
  }
2865
- /**
2866
- * @returns {boolean}
2867
- */
2868
2602
  isShowPlaceholderInTooltipEnabled() {
2869
2603
  return this._p.showPlaceholderInTooltip;
2870
2604
  }
2871
- /**
2872
- * @param {function(items: DropList.ItemBase[]):string} formatter
2873
- * @returns {SelectBox}
2874
- */
2875
2605
  setMultiPlaceholderFormatter(formatter) {
2876
2606
  const p = this._p;
2877
2607
  if (p.multiPlaceholderFormatter === formatter) return this;
@@ -2879,26 +2609,15 @@ var SelectBox = class {
2879
2609
  this._scheduleSync("render_base");
2880
2610
  return this;
2881
2611
  }
2882
- /**
2883
- * @param {boolean|'touch'} value
2884
- * @returns {SelectBox}
2885
- */
2886
2612
  setBlurOnSingleSelection(value) {
2887
2613
  const p = this._p;
2888
2614
  if (p.blurOnSingleSelection === value) return this;
2889
2615
  p.blurOnSingleSelection = value;
2890
2616
  return this;
2891
2617
  }
2892
- /**
2893
- * @returns {boolean|'touch'}
2894
- */
2895
2618
  getBlurOnSingleSelection() {
2896
2619
  return this._p.blurOnSingleSelection;
2897
2620
  }
2898
- /**
2899
- * @param {boolean} multi
2900
- * @returns {SelectBox}
2901
- */
2902
2621
  setMulti(multi) {
2903
2622
  const p = this._p;
2904
2623
  multi = !!multi;
@@ -2914,16 +2633,9 @@ var SelectBox = class {
2914
2633
  this._scheduleSync("full");
2915
2634
  return this;
2916
2635
  }
2917
- /**
2918
- * @returns {boolean}
2919
- */
2920
2636
  isMultiEnabled() {
2921
2637
  return this._p.multi;
2922
2638
  }
2923
- /**
2924
- * @param {boolean} searchable
2925
- * @returns {SelectBox}
2926
- */
2927
2639
  setSearchable(searchable) {
2928
2640
  const p = this._p;
2929
2641
  searchable = !!searchable;
@@ -2932,10 +2644,6 @@ var SelectBox = class {
2932
2644
  this._scheduleSync("full");
2933
2645
  return this;
2934
2646
  }
2935
- /**
2936
- * @param {boolean} allowTypeToSelect
2937
- * @returns {SelectBox}
2938
- */
2939
2647
  setAllowTypeToSelect(allowTypeToSelect) {
2940
2648
  const p = this._p;
2941
2649
  allowTypeToSelect = !!allowTypeToSelect;
@@ -2943,129 +2651,71 @@ var SelectBox = class {
2943
2651
  p.allowTypeToSelect = allowTypeToSelect;
2944
2652
  return this;
2945
2653
  }
2946
- /**
2947
- * @returns {boolean}
2948
- */
2949
2654
  isSearchableEnabled() {
2950
2655
  return this._p.searchable;
2951
2656
  }
2952
- /**
2953
- * @param {string} noResultsText
2954
- * @returns {SelectBox}
2955
- */
2956
2657
  setNoResultsText(noResultsText) {
2957
2658
  this._p.dropList?.setNoResultsText(noResultsText);
2958
2659
  return this;
2959
2660
  }
2960
- /**
2961
- * @returns {string}
2962
- */
2963
2661
  getNoResultsText() {
2964
2662
  return this._p.noResultsText;
2965
2663
  }
2966
- /**
2967
- * @param {boolean} autoSelectTextOnCheck
2968
- * @returns {SelectBox}
2969
- */
2970
2664
  setAutoSelectTextOnCheck(autoSelectTextOnCheck) {
2971
2665
  this._p.autoSelectTextOnCheck = autoSelectTextOnCheck;
2972
2666
  return this;
2973
2667
  }
2974
- /**
2975
- * @returns {boolean}
2976
- */
2977
2668
  getAutoSelectTextOnCheck() {
2978
2669
  return this._p.autoSelectTextOnCheck;
2979
2670
  }
2980
- /**
2981
- * @param {number} window
2982
- * @returns {SelectBox}
2983
- */
2984
2671
  setFilterThrottleWindow(window) {
2985
2672
  const p = this._p;
2986
2673
  p.filterThrottleWindow = window;
2987
2674
  p.dropList?.setFilterThrottleWindow(window);
2988
2675
  return this;
2989
2676
  }
2990
- /**
2991
- * @returns {number}
2992
- */
2993
2677
  getFilterThrottleWindow() {
2994
2678
  return this._p.filterThrottleWindow;
2995
2679
  }
2996
- /**
2997
- * @param {boolean} value
2998
- * @returns {SelectBox}
2999
- */
3000
2680
  setFilterOnEmptyTerm(value) {
3001
2681
  const p = this._p;
3002
2682
  if (p.filterOnEmptyTerm === value) return this;
3003
2683
  p.dropList?.setFilterOnEmptyTerm(value);
3004
2684
  return this;
3005
2685
  }
3006
- /**
3007
- * @returns {boolean}
3008
- */
3009
2686
  getFilterOnEmptyTerm() {
3010
2687
  return this._p.filterOnEmptyTerm;
3011
2688
  }
3012
- /**
3013
- * @param {DropList.Options} listOptions
3014
- * @returns {SelectBox}
3015
- */
3016
2689
  setListOptions(listOptions) {
3017
2690
  const p = this._p;
3018
2691
  p.listOptions = listOptions;
3019
2692
  this._setupDropdownMenu();
3020
2693
  return this;
3021
2694
  }
3022
- /**
3023
- * @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
3024
- * @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
3025
- * @returns {SelectBox})|null
3026
- */
3027
2695
  setRenderSingleItem(render, unrender) {
3028
2696
  const p = this._p;
3029
2697
  p.renderSingleItem = render;
3030
2698
  p.unrenderSingleItem = unrender;
3031
2699
  return this;
3032
2700
  }
3033
- /**
3034
- * @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
3035
- * @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
3036
- * @returns {SelectBox}
3037
- */
3038
2701
  setRenderMultiItem(render, unrender) {
3039
2702
  const p = this._p;
3040
2703
  p.renderMultiItem = render;
3041
2704
  p.unrenderMultiItem = unrender;
3042
2705
  return this;
3043
2706
  }
3044
- /**
3045
- * @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
3046
- * @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
3047
- * @returns {SelectBox}
3048
- */
3049
2707
  setRenderRestMultiItem(render, unrender) {
3050
2708
  const p = this._p;
3051
2709
  p.renderRestMultiItem = render;
3052
2710
  p.unrenderRestMultiItem = unrender;
3053
2711
  return this;
3054
2712
  }
3055
- /**
3056
- * @param {string} prop
3057
- * @returns {SelectBox}
3058
- */
3059
2713
  setLabelProp(prop) {
3060
2714
  const p = this._p;
3061
2715
  p.labelProp = prop;
3062
2716
  if (p.dropList) p.dropList.setLabelProp(prop);
3063
2717
  return this;
3064
2718
  }
3065
- /**
3066
- * @param {string} prop
3067
- * @returns {SelectBox}
3068
- */
3069
2719
  setValueProp(prop) {
3070
2720
  const p = this._p;
3071
2721
  if (p.valueProp === prop) return this;
@@ -3074,50 +2724,31 @@ var SelectBox = class {
3074
2724
  this._refreshItemByValueMap();
3075
2725
  return this;
3076
2726
  }
3077
- /**
3078
- * @param {string} prop
3079
- * @returns {SelectBox}
3080
- */
3081
2727
  setMultiItemLabelProp(prop) {
3082
2728
  const p = this._p;
3083
2729
  p.multiItemLabelProp = prop;
3084
2730
  this._scheduleSync("render_items");
3085
2731
  return this;
3086
2732
  }
3087
- /**
3088
- * @param {'before'|'after'|'none'} position
3089
- * @returns {SelectBox}
3090
- */
3091
2733
  setMultiItemRemovePosition(position) {
3092
2734
  const p = this._p;
3093
2735
  p.multiItemRemovePosition = position;
3094
2736
  this._scheduleSync("render_items");
3095
2737
  return this;
3096
2738
  }
3097
- /**
3098
- * @param {number|null|undefined} value
3099
- * @returns {SelectBox}
3100
- */
3101
2739
  setMaxMultiItems(value) {
3102
2740
  const p = this._p;
3103
2741
  p.maxMultiItems = value;
3104
2742
  return this;
3105
2743
  }
3106
- /**
3107
- * @param {function(count: number, items: DropList.ItemBase[]):string|null|undefined} value
3108
- * @returns {SelectBox}
3109
- */
3110
2744
  setMultiItemsRestLabelProvider(value) {
3111
2745
  const p = this._p;
3112
2746
  p.multiItemsRestLabelProvider = value;
3113
2747
  return this;
3114
2748
  }
3115
- /**
3116
- * @param {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)} fn
3117
- * @returns {SelectBox}
3118
- */
3119
2749
  setFilterFn(fn) {
3120
2750
  const p = this._p;
2751
+ fn ??= null;
3121
2752
  if (p.filterFn === fn) return this;
3122
2753
  p.filterFn = fn;
3123
2754
  if (!fn) fn = (items, term) => {
@@ -3132,9 +2763,6 @@ var SelectBox = class {
3132
2763
  p.dropList?.setFilterFn(fn);
3133
2764
  return this;
3134
2765
  }
3135
- /**
3136
- * @returns {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)}
3137
- */
3138
2766
  getFilterFn() {
3139
2767
  return this._p.filterFn;
3140
2768
  }
@@ -3142,8 +2770,6 @@ var SelectBox = class {
3142
2770
  * Sets a handler to intercept internal errors/warnings (e.g. from a throwing `renderMultiItem`/`unrenderSingleItem`)
3143
2771
  * instead of the default `console.error`/`console.warn`. Also used as the default `onError` for the internal
3144
2772
  * `DropList`, unless `listOptions.onError` is set explicitly.
3145
- * @param {SelectBox.LibraryErrorHandler|null} [fn]
3146
- * @returns {SelectBox}
3147
2773
  */
3148
2774
  setOnError(fn) {
3149
2775
  const p = this._p;
@@ -3152,14 +2778,13 @@ var SelectBox = class {
3152
2778
  return this;
3153
2779
  }
3154
2780
  /**
3155
- * @returns {SelectBox.LibraryErrorHandler|undefined}
2781
+ * Gets the current `onError` handler, if any.
3156
2782
  */
3157
2783
  getOnError() {
3158
2784
  return this._p.onError;
3159
2785
  }
3160
2786
  /**
3161
2787
  * Focus on input element
3162
- * @returns {SelectBox}
3163
2788
  */
3164
2789
  focusInput() {
3165
2790
  const p = this._p;
@@ -3168,7 +2793,6 @@ var SelectBox = class {
3168
2793
  }
3169
2794
  /**
3170
2795
  * Remvoe focus from the input element
3171
- * @returns {SelectBox}
3172
2796
  */
3173
2797
  blurInput() {
3174
2798
  const p = this._p;
@@ -3177,7 +2801,6 @@ var SelectBox = class {
3177
2801
  }
3178
2802
  /**
3179
2803
  * Removes all selected items
3180
- * @returns {SelectBox}
3181
2804
  */
3182
2805
  clear() {
3183
2806
  if (!this._performClearWithEvent(true)) return this;
@@ -3186,8 +2809,6 @@ var SelectBox = class {
3186
2809
  }
3187
2810
  /**
3188
2811
  * Returns a single value or an array of selected values - depending on `multi` prop
3189
- * @public
3190
- * @returns {*[]}
3191
2812
  */
3192
2813
  getValue() {
3193
2814
  const p = this._p;
@@ -3196,9 +2817,7 @@ var SelectBox = class {
3196
2817
  }
3197
2818
  /**
3198
2819
  * Selects the specified value or multiple values - depending on `multi` prop
3199
- * @public
3200
- * @param {*|*[]} value - if `multi`, then an array of values to select, otherwise - a single value to select
3201
- * @returns {SelectBox}
2820
+ * @param value - if `multi`, then an array of values to select, otherwise - a single value to select
3202
2821
  */
3203
2822
  setValue(value) {
3204
2823
  if (this._p.multi) return this.setSelectedValues(Array.isArray(value) ? value : value !== void 0 ? [value] : []);
@@ -3206,17 +2825,12 @@ var SelectBox = class {
3206
2825
  }
3207
2826
  /**
3208
2827
  * Returns an array of selected values
3209
- * @public
3210
- * @returns {*[]}
3211
2828
  */
3212
2829
  getSelectedValues() {
3213
2830
  return this._p.selectedValues.slice(0);
3214
2831
  }
3215
2832
  /**
3216
2833
  * Selects the specified values
3217
- * @public
3218
- * @param {*[]} values - an array of *values* to select
3219
- * @returns {SelectBox}
3220
2834
  */
3221
2835
  setSelectedValues(values) {
3222
2836
  const p = this._p, valueProp = p.valueProp;
@@ -3241,16 +2855,12 @@ var SelectBox = class {
3241
2855
  }
3242
2856
  /**
3243
2857
  * Returns the count of selected values
3244
- * @public
3245
- * @returns {number}
3246
2858
  */
3247
2859
  getSelectedValueCount() {
3248
2860
  return this._p.selectedValues.length;
3249
2861
  }
3250
2862
  /**
3251
2863
  * Returns an array of selected items
3252
- * @public
3253
- * @returns {Array.<Object>}
3254
2864
  */
3255
2865
  getSelectedItems() {
3256
2866
  return this._p.selectedItems.slice(0);
@@ -3259,17 +2869,11 @@ var SelectBox = class {
3259
2869
  * Sets the specified items to "checked" mode.
3260
2870
  * An array of items is passed, not values, because we need to keep track if items,
3261
2871
  * and if we already have the array of items then this spares the process of searching for the items by values.
3262
- * @public
3263
- * @param {DropList.ItemBase[]} items - an array of *items* to select (not values)
3264
- * @returns {SelectBox}
3265
2872
  */
3266
2873
  setSelectedItems(items) {
3267
2874
  this._setSelectedItems(items);
3268
2875
  return this;
3269
2876
  }
3270
- /**
3271
- * @returns {SelectBox}
3272
- */
3273
2877
  openList() {
3274
2878
  const p = this._p;
3275
2879
  if (p.dropList.isVisible()) return this;
@@ -3284,9 +2888,6 @@ var SelectBox = class {
3284
2888
  else if (!p.multi && this.getValue() !== void 0) p.dropList.setFocusedItemByValue(this.getValue());
3285
2889
  return this;
3286
2890
  }
3287
- /**
3288
- * @returns {SelectBox}
3289
- */
3290
2891
  closeList() {
3291
2892
  const p = this._p;
3292
2893
  if (this[DestroyedSymbol]) return this;
@@ -3298,32 +2899,17 @@ var SelectBox = class {
3298
2899
  }
3299
2900
  return this;
3300
2901
  }
3301
- /**
3302
- * @param {boolean} [open]
3303
- * @returns {SelectBox}
3304
- */
3305
2902
  toggleList(open) {
3306
2903
  const p = this._p;
3307
2904
  if (open === void 0 ? !p.dropList.isVisible() : !!open) return this.openList();
3308
2905
  else return this.closeList();
3309
2906
  }
3310
- /**
3311
- * @returns {boolean}
3312
- */
3313
2907
  isListOpen() {
3314
2908
  return !!this._p.dropListVisible;
3315
2909
  }
3316
- /**
3317
- * @param {boolean} [on]
3318
- * @returns {SelectBox}
3319
- */
3320
2910
  toggleLoading(on) {
3321
2911
  return this.setIsLoadingMode(on === void 0 ? !this.getIsLoadingMode() : !!on);
3322
2912
  }
3323
- /**
3324
- * @param {boolean} isLoadingMode
3325
- * @returns {SelectBox}
3326
- */
3327
2913
  setIsLoadingMode(isLoadingMode) {
3328
2914
  const p = this._p;
3329
2915
  isLoadingMode = isLoadingMode === void 0 ? true : !!isLoadingMode;
@@ -3334,31 +2920,21 @@ var SelectBox = class {
3334
2920
  this._scheduleSync("render_base");
3335
2921
  return this;
3336
2922
  }
3337
- /**
3338
- * @returns {boolean}
3339
- */
3340
2923
  getIsLoadingMode() {
3341
2924
  return this._p.isLoadingMode;
3342
2925
  }
3343
2926
  /**
3344
2927
  * Sets whether to close the list when loading mode is enabled
3345
- * @param {boolean} closeListWhenLoading
3346
- * @returns {SelectBox}
3347
2928
  */
3348
2929
  setCloseListWhenLoading(closeListWhenLoading) {
3349
2930
  this._p.closeListWhenLoading = closeListWhenLoading;
3350
2931
  return this;
3351
2932
  }
3352
- /**
3353
- * @returns {boolean}
3354
- */
3355
2933
  getCloseListWhenLoading() {
3356
2934
  return this._p.closeListWhenLoading;
3357
2935
  }
3358
2936
  /**
3359
2937
  * Sets when to clear the input field
3360
- * @param {string[]} clearInputWhen
3361
- * @returns {SelectBox}
3362
2938
  */
3363
2939
  setClearInputWhen(clearInputWhen) {
3364
2940
  this._p.clearInputWhen = Array.isArray(clearInputWhen) ? clearInputWhen.slice(0) : [];
@@ -3366,15 +2942,12 @@ var SelectBox = class {
3366
2942
  }
3367
2943
  /**
3368
2944
  * Retrieves the settings for when to clear the input field
3369
- * @returns {string[]}
3370
2945
  */
3371
2946
  getClearInputWhen() {
3372
2947
  return this._p.clearInputWhen;
3373
2948
  }
3374
2949
  /**
3375
2950
  * Sets the appropriate direction for the selectbox
3376
- * @param {'ltr'|'rtl'|'auto'} direction
3377
- * @return {SelectBox}
3378
2951
  */
3379
2952
  setDirection(direction) {
3380
2953
  const p = this._p;
@@ -3384,14 +2957,12 @@ var SelectBox = class {
3384
2957
  }
3385
2958
  /**
3386
2959
  * Gets the supplied direction for the selectbox
3387
- * @return {'ltr'|'rtl'|'auto'}
3388
2960
  */
3389
2961
  getDirection() {
3390
2962
  return this._p.direction;
3391
2963
  }
3392
2964
  /**
3393
2965
  * Can be called in case that the selectbox was attached to the dom late and has a weird size.
3394
- * @returns {SelectBox}
3395
2966
  */
3396
2967
  refreshSize() {
3397
2968
  this._resizeInput();
@@ -3399,9 +2970,6 @@ var SelectBox = class {
3399
2970
  }
3400
2971
  /**
3401
2972
  * Register an event handler
3402
- * @param {(string|'*')?} event
3403
- * @param {function(any)} handler
3404
- * @returns {SelectBox}
3405
2973
  */
3406
2974
  on(event, handler) {
3407
2975
  this._p.mitt.on(event, handler);
@@ -3409,9 +2977,6 @@ var SelectBox = class {
3409
2977
  }
3410
2978
  /**
3411
2979
  * Register a one time event handler
3412
- * @param {(string|'*')?} event
3413
- * @param {function(any)} handler
3414
- * @returns {SelectBox}
3415
2980
  */
3416
2981
  once(event, handler) {
3417
2982
  let wrapped = (value) => {
@@ -3423,9 +2988,6 @@ var SelectBox = class {
3423
2988
  }
3424
2989
  /**
3425
2990
  * Remove an `handler` for `event`, all events for `event`, or all events completely.
3426
- * @param {(string|'*')?} event
3427
- * @param {function(any)} handler
3428
- * @returns {SelectBox}
3429
2991
  */
3430
2992
  off(event, handler) {
3431
2993
  if (!event && !event) this._p.mitt.all.clear();
@@ -3434,9 +2996,6 @@ var SelectBox = class {
3434
2996
  }
3435
2997
  /**
3436
2998
  * Emit an event
3437
- * @param {string} event
3438
- * @param {any} value
3439
- * @returns {SelectBox}
3440
2999
  */
3441
3000
  emit(event, value) {
3442
3001
  this._p.mitt.emit(event, value);
@@ -3456,8 +3015,6 @@ var SelectBox = class {
3456
3015
  p.subitemByValueMap = null;
3457
3016
  }
3458
3017
  /**
3459
- * @param {*} value
3460
- * @returns {DropList.ItemBase|undefined}
3461
3018
  * @private
3462
3019
  * @internal
3463
3020
  */
@@ -3476,9 +3033,6 @@ var SelectBox = class {
3476
3033
  this._addSubitemsToValueMap(p.items, subitemByValueMap, p.valueProp);
3477
3034
  }
3478
3035
  /**
3479
- * @param {DropList.ItemBase[]} items
3480
- * @param {Map<*, DropList.ItemBase>} itemByValueMap
3481
- * @param {string} valueProp
3482
3036
  * @private
3483
3037
  * @internal
3484
3038
  */
@@ -3757,9 +3311,7 @@ var SelectBox = class {
3757
3311
  case "search":
3758
3312
  this._trigger("search", event);
3759
3313
  break;
3760
- case "itemschanged":
3761
- this._trigger("itemschanged", event);
3762
- break;
3314
+ case "itemschanged": this._trigger("itemschanged", event);
3763
3315
  }
3764
3316
  }
3765
3317
  });
@@ -3827,9 +3379,7 @@ var SelectBox = class {
3827
3379
  case VALUE_HOME:
3828
3380
  dropList.goToFirst(evt);
3829
3381
  break;
3830
- case VALUE_END:
3831
- dropList.goToLast(evt);
3832
- break;
3382
+ case VALUE_END: dropList.goToLast(evt);
3833
3383
  }
3834
3384
  break;
3835
3385
  case VALUE_SPACE:
@@ -3859,17 +3409,15 @@ var SelectBox = class {
3859
3409
  evt.preventDefault();
3860
3410
  }
3861
3411
  break;
3862
- default:
3863
- if (dropList.isVisible()) dropList._keydownFreeType(evt, false);
3864
- else if (p.allowTypeToSelect) dropList._keydownFreeType(evt, true);
3865
- else {
3866
- this.openList();
3867
- setTimeout(() => {
3868
- if (this[DestroyedSymbol]) return;
3869
- dropList._keydownFreeType(evt, false);
3870
- });
3871
- }
3872
- break;
3412
+ default: if (dropList.isVisible()) dropList._keydownFreeType(evt, false);
3413
+ else if (p.allowTypeToSelect) dropList._keydownFreeType(evt, true);
3414
+ else {
3415
+ this.openList();
3416
+ setTimeout(() => {
3417
+ if (this[DestroyedSymbol]) return;
3418
+ dropList._keydownFreeType(evt, false);
3419
+ });
3420
+ }
3873
3421
  }
3874
3422
  if (!suppressEnterSpaceToggle) {
3875
3423
  if (evt.key === VALUE_ENTER || evt.key === VALUE_SPACE && p.lastKeyAllowsNonTypeKeys && !p.multi && !dropList.hasFocusedItem() && !p.disabled && !p.readOnly) {
@@ -4089,9 +3637,7 @@ var SelectBox = class {
4089
3637
  if (!p.showSelection) this._syncPlaceholder();
4090
3638
  else if (p.multiItemEls[p.multiItemEls.length - 1]?.[ItemSymbol]?.[p.valueProp] === RestMultiItemsSymbol) this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);
4091
3639
  break;
4092
- case "resize_input":
4093
- this._resizeInput();
4094
- break;
3640
+ case "resize_input": this._resizeInput();
4095
3641
  }
4096
3642
  }
4097
3643
  /** @private */
@@ -4112,7 +3658,6 @@ var SelectBox = class {
4112
3658
  p.singleWrapper.innerHTML = "";
4113
3659
  }
4114
3660
  /**
4115
- * @param {number} index
4116
3661
  * @private
4117
3662
  * @internal
4118
3663
  */
@@ -4137,7 +3682,6 @@ var SelectBox = class {
4137
3682
  }
4138
3683
  }
4139
3684
  /**
4140
- * @param {DropList.ItemBase} item
4141
3685
  * @private
4142
3686
  * @internal
4143
3687
  */
@@ -4151,8 +3695,6 @@ var SelectBox = class {
4151
3695
  }
4152
3696
  }
4153
3697
  /**
4154
- * @param {DropList.ItemBase} item
4155
- * @param {Element} itemEl
4156
3698
  * @private
4157
3699
  * @internal
4158
3700
  */
@@ -4166,7 +3708,6 @@ var SelectBox = class {
4166
3708
  }
4167
3709
  }
4168
3710
  /**
4169
- * @param {DropList.ItemBase} item
4170
3711
  * @returns {boolean} true if rendered, false if not
4171
3712
  * @private
4172
3713
  * @internal
@@ -4240,9 +3781,6 @@ var SelectBox = class {
4240
3781
  }
4241
3782
  /**
4242
3783
  * Syncs render state, selected items, and position
4243
- * @param {boolean=false} fullItemsRender Should re-render all items?
4244
- * @param {boolean=false} updateListItems Should call updateListItems?
4245
- * @returns {SelectBox}
4246
3784
  * @internal
4247
3785
  */
4248
3786
  _syncFull(fullItemsRender, updateListItems) {
@@ -4301,8 +3839,6 @@ var SelectBox = class {
4301
3839
  return this;
4302
3840
  }
4303
3841
  /**
4304
- * @param {string} event
4305
- * @param {*} [data]
4306
3842
  * @private
4307
3843
  * @internal
4308
3844
  */
@@ -4314,8 +3850,6 @@ var SelectBox = class {
4314
3850
  }
4315
3851
  /**
4316
3852
  * Render a multi item
4317
- * @param {Object} item
4318
- * @returns {Element|null}
4319
3853
  * @private
4320
3854
  * @internal
4321
3855
  */
@@ -4341,9 +3875,6 @@ var SelectBox = class {
4341
3875
  }
4342
3876
  /**
4343
3877
  * Removes a specific multi item by user event
4344
- * @param {Element} itemEl
4345
- * @param {Event} originatingEvent
4346
- * @returns {SelectBox}
4347
3878
  * @private
4348
3879
  * @internal
4349
3880
  */
@@ -4403,8 +3934,6 @@ var SelectBox = class {
4403
3934
  return this;
4404
3935
  }
4405
3936
  /**
4406
- * @param {DropList.ItemBase} item
4407
- * @param {boolean} [populate]
4408
3937
  * @private
4409
3938
  * @internal
4410
3939
  */
@@ -4431,7 +3960,6 @@ var SelectBox = class {
4431
3960
  this._scheduleSync("render_list");
4432
3961
  }
4433
3962
  /**
4434
- * @param {*} value
4435
3963
  * @private
4436
3964
  * @internal
4437
3965
  */
@@ -4444,7 +3972,6 @@ var SelectBox = class {
4444
3972
  }
4445
3973
  /**
4446
3974
  * Update input size to current state
4447
- * @returns {SelectBox}
4448
3975
  * @private
4449
3976
  * @internal
4450
3977
  */
@@ -4502,7 +4029,6 @@ var SelectBox = class {
4502
4029
  }
4503
4030
  /**
4504
4031
  * Update autocomplete position if needed
4505
- * @returns {SelectBox}
4506
4032
  * @private
4507
4033
  * @internal
4508
4034
  */
@@ -4518,7 +4044,6 @@ var SelectBox = class {
4518
4044
  return this;
4519
4045
  }
4520
4046
  /**
4521
- * @param {KeyboardEvent} event
4522
4047
  * @private
4523
4048
  * @internal
4524
4049
  */
@@ -4549,7 +4074,6 @@ var SelectBox = class {
4549
4074
  }
4550
4075
  }
4551
4076
  /**
4552
- * @param {KeyboardEvent} event
4553
4077
  * @private
4554
4078
  * @internal
4555
4079
  */
@@ -4595,13 +4119,12 @@ var SelectBox = class {
4595
4119
  }
4596
4120
  }
4597
4121
  /**
4598
- * @returns {DropList.PositionOptions}
4599
4122
  * @private
4600
4123
  * @internal
4601
4124
  */
4602
4125
  _getDropListPositionOptions() {
4603
4126
  return {
4604
- target: this._p.el,
4127
+ target: /**@type Element*/ this._p.el,
4605
4128
  offset: {
4606
4129
  x: 0,
4607
4130
  y: 0
@@ -4638,11 +4161,6 @@ var SelectBox = class {
4638
4161
  /**
4639
4162
  * Handles sorting, and putting checked items first (according to selectedValues, not item.checked)
4640
4163
  * @private
4641
- * @param {DropList.ItemBase[]} items
4642
- * @param {boolean=false} sort
4643
- * @param {boolean=false} sortCheckedFirst
4644
- * @param {boolean=false} splitCheckedGroups
4645
- * @returns {DropList.ItemBase[]}
4646
4164
  * @internal
4647
4165
  */
4648
4166
  _sortItems(items, sort, sortCheckedFirst, splitCheckedGroups) {