@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.cjs.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
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
@@ -20,7 +20,7 @@ var __copyProps = (to, from, except, desc) => {
20
20
  }
21
21
  return to;
22
22
  };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
24
24
  value: mod,
25
25
  enumerable: true
26
26
  }) : target, mod));
@@ -133,9 +133,6 @@ var DefaultOptions = {
133
133
  filterEmptyGroups: false
134
134
  };
135
135
  var DropList = class DropList {
136
- /**
137
- * @param {DropList.Options} options
138
- */
139
136
  constructor(options) {
140
137
  const o = { ...DefaultOptions };
141
138
  for (let [key, value] of Object.entries(
@@ -341,19 +338,13 @@ var DropList = class DropList {
341
338
  }
342
339
  /**
343
340
  * Returns true if other is an inclusive descendant of node, and false otherwise.
344
- * @param {Node} other
345
- * @param {boolean} [considerSubmenus=true]
346
- * @returns {boolean}
341
+ * Accepts `EventTarget` (not just `Node`) since callers pass `event.target`/`event.relatedTarget` directly.
347
342
  */
348
343
  elContains(other, considerSubmenus = true) {
349
344
  if (this.el.contains(other)) return true;
350
345
  if (considerSubmenus && this._p.currentSubDropList?.droplist?.elContains(other)) return true;
351
346
  return false;
352
347
  }
353
- /**
354
- * @param {string|string[]} classes
355
- * @returns {DropList}
356
- */
357
348
  setAdditionalClasses(classes) {
358
349
  const p = this._p;
359
350
  p.additionalClasses = classes;
@@ -362,8 +353,6 @@ var DropList = class DropList {
362
353
  }
363
354
  /**
364
355
  * Sets the appropriate direction for the droplist
365
- * @param {'ltr'|'rtl'|'auto'} direction
366
- * @return {DropList}
367
356
  */
368
357
  setDirection(direction) {
369
358
  const p = this._p;
@@ -373,46 +362,26 @@ var DropList = class DropList {
373
362
  }
374
363
  /**
375
364
  * Gets the supplied direction for the droplist
376
- * @return {'ltr'|'rtl'|'auto'}
377
365
  */
378
366
  getDirection() {
379
367
  return this._p.direction;
380
368
  }
381
- /**
382
- * @param {string} prop
383
- * @returns {DropList}
384
- */
385
369
  setLabelProp(prop) {
386
370
  const p = this._p;
387
371
  p.labelProp = prop;
388
372
  return this;
389
373
  }
390
- /**
391
- *
392
- * @property {function(item: DropList.ItemBase, itemEl: Element):(*|false)} [fn] Function to call when rendering an item element
393
- * @returns {DropList}
394
- */
395
374
  setRenderItem(fn) {
396
375
  const p = this._p;
397
376
  p.renderItem = fn;
398
377
  return this;
399
378
  }
400
- /**
401
- *
402
- * @property {function(item: DropList.ItemBase, itemEl: Element)} [fn] Function to call when rendering an item element
403
- * @returns {DropList}
404
- */
405
379
  setUnrenderItem(fn) {
406
380
  const p = this._p;
407
381
  p.unrenderItem = fn;
408
382
  this._setupUnrenderFunction();
409
383
  return this;
410
384
  }
411
- /**
412
- * @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
413
- * @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
414
- * @returns {DropList}
415
- */
416
385
  setRenderNoResultsItem(render, unrender) {
417
386
  const p = this._p;
418
387
  p.renderNoResultsItem = render;
@@ -458,10 +427,6 @@ var DropList = class DropList {
458
427
  });
459
428
  return this;
460
429
  }
461
- /**
462
- * @param {string} prop
463
- * @returns {DropList}
464
- */
465
430
  setValueProp(prop) {
466
431
  const p = this._p;
467
432
  p.valueProp = prop;
@@ -549,19 +514,16 @@ var DropList = class DropList {
549
514
  return true;
550
515
  }
551
516
  /**
552
- *
553
- * @param {DropList.Item} item The item to add. It is copied.
554
- * @param {number} [atIndex=-1] The index to insert at (or -1)
555
- * @returns {DropList}
517
+ * @param item The item to add. It is copied.
518
+ * @param atIndex The index to insert at (or -1)
556
519
  */
557
520
  addItem(item, atIndex = -1) {
558
521
  return this.addItems([item], atIndex);
559
522
  }
560
523
  /**
561
524
  * Adds items to the menu and renders
562
- * @param {DropList.Item[]} itemsToAdd The items to add. These are copied.
563
- * @param {number} [atIndex=-1] The index to insert at (or -1)
564
- * @returns {DropList}
525
+ * @param itemsToAdd The items to add. These are copied.
526
+ * @param atIndex The index to insert at (or -1)
565
527
  */
566
528
  addItems(itemsToAdd, atIndex = -1) {
567
529
  const p = this._p, labelProp = p.labelProp, valueProp = p.valueProp;
@@ -603,8 +565,7 @@ var DropList = class DropList {
603
565
  }
604
566
  /**
605
567
  * Replaces all current items with the supplied items
606
- * @param {DropList.Item[]} items The items to set. These are copied.
607
- * @returns {DropList}
568
+ * @param items The items to set. These are copied.
608
569
  */
609
570
  setItems(items) {
610
571
  const p = this._p;
@@ -749,8 +710,6 @@ var DropList = class DropList {
749
710
  /**
750
711
  * Return the item element at the given original index, if it exists.
751
712
  * The item may not be currently rendered, and null will be returned
752
- * @param index
753
- * @returns {HTMLElement|null}
754
713
  */
755
714
  itemElementAtIndex(index) {
756
715
  const p = this._p;
@@ -761,16 +720,10 @@ var DropList = class DropList {
761
720
  /**
762
721
  * Return the item element at the given index, if it exists.
763
722
  * The item may not be currently rendered, and null will be returned
764
- * @param index
765
- * @returns {HTMLElement|null}
766
723
  */
767
724
  filteredElementItemAtIndex(index) {
768
725
  return this._p.virtualListHelper.getItemElementAt(index) ?? null;
769
726
  }
770
- /**
771
- * @param {function(dropList: DropList):DropList.PositionOptions} fn
772
- * @returns {DropList}
773
- */
774
727
  setPositionOptionsProvider(fn) {
775
728
  const p = this._p;
776
729
  if (p.positionOptionsProvider === fn) return this;
@@ -778,17 +731,12 @@ var DropList = class DropList {
778
731
  this.relayout();
779
732
  return this;
780
733
  }
781
- /**
782
- * @returns {function(dropList: DropList):DropList.PositionOptions|null}
783
- */
784
734
  getPositionOptionsProvider() {
785
735
  return this._p.positionOptionsProvider;
786
736
  }
787
737
  /**
788
738
  * Sets a handler to intercept internal errors/warnings (e.g. from a throwing `renderItem`/`unrenderItem`)
789
739
  * instead of the default `console.error`/`console.warn`.
790
- * @param {DropList.LibraryErrorHandler|null} [fn]
791
- * @returns {DropList}
792
740
  */
793
741
  setOnError(fn) {
794
742
  const p = this._p;
@@ -796,15 +744,14 @@ var DropList = class DropList {
796
744
  return this;
797
745
  }
798
746
  /**
799
- * @returns {DropList.LibraryErrorHandler|undefined}
747
+ * Gets the current `onError` handler, if any.
800
748
  */
801
749
  getOnError() {
802
750
  return this._p.onError;
803
751
  }
804
752
  /**
805
- * @param {string} term
806
- * @param {boolean} [performSearch=false] should actually perform the search, or just set the input's text?
807
- * @returns {DropList}
753
+ * @param term the search term to set
754
+ * @param performSearch should actually perform the search, or just set the input's text?
808
755
  */
809
756
  setSearchTerm(term, performSearch = false) {
810
757
  const p = this._p;
@@ -909,26 +856,15 @@ var DropList = class DropList {
909
856
  if (p.items) return p.items.length;
910
857
  return 0;
911
858
  }
912
- /**
913
- * @param {string} noResultsText
914
- * @returns {DropList}
915
- */
916
859
  setNoResultsText(noResultsText) {
917
860
  const p = this._p;
918
861
  p.noResultsText = noResultsText;
919
862
  if (p.hasNoResultsItem) p.virtualListHelper.refreshItemAt(0).render();
920
863
  return this;
921
864
  }
922
- /**
923
- * @returns {string}
924
- */
925
865
  getNoResultsText() {
926
866
  return this._p.noResultsText;
927
867
  }
928
- /**
929
- * @param {number} window
930
- * @returns {DropList}
931
- */
932
868
  setFilterThrottleWindow(window) {
933
869
  const p = this._p;
934
870
  p.filterThrottleWindow = window;
@@ -938,16 +874,9 @@ var DropList = class DropList {
938
874
  if (isScheduled) p.throttledRefilterItems();
939
875
  return this;
940
876
  }
941
- /**
942
- * @returns {number}
943
- */
944
877
  getFilterThrottleWindow() {
945
878
  return this._p.filterThrottleWindow;
946
879
  }
947
- /**
948
- * @param {boolean} value
949
- * @returns {DropList}
950
- */
951
880
  setFilterOnEmptyTerm(value) {
952
881
  const p = this._p;
953
882
  if (p.filterOnEmptyTerm === value) return this;
@@ -955,16 +884,9 @@ var DropList = class DropList {
955
884
  p.throttledRefilterItems();
956
885
  return this;
957
886
  }
958
- /**
959
- * @returns {boolean}
960
- */
961
887
  getFilterOnEmptyTerm() {
962
888
  return this._p.filterOnEmptyTerm;
963
889
  }
964
- /**
965
- * @param {boolean} value
966
- * @returns {DropList}
967
- */
968
890
  setFilterGroups(value) {
969
891
  const p = this._p;
970
892
  if (p.filterGroups === value) return this;
@@ -972,52 +894,30 @@ var DropList = class DropList {
972
894
  p.throttledRefilterItems();
973
895
  return this;
974
896
  }
975
- /**
976
- * @returns {boolean}
977
- */
978
897
  getFilterGroups() {
979
898
  return this._p.filterGroups;
980
899
  }
981
- /**
982
- * @param {boolean} value
983
- * @returns {DropList}
984
- */
985
- setFilterEmptyGroups(value) {
900
+ setFilterEmptyGroups(value = true) {
986
901
  const p = this._p;
987
902
  if (p.filterEmptyGroups === value) return this;
988
903
  p.filterEmptyGroups = value;
989
904
  p.throttledRefilterItems();
990
905
  return this;
991
906
  }
992
- /**
993
- * @returns {boolean}
994
- */
995
907
  getFilterEmptyGroups() {
996
908
  return this._p.filterEmptyGroups;
997
909
  }
998
- /**
999
- * @param {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)} fn
1000
- * @returns {DropList}
1001
- */
1002
910
  setFilterFn(fn) {
1003
911
  const p = this._p;
912
+ fn ??= null;
1004
913
  if (p.filterFn === fn) return this;
1005
914
  p.filterFn = fn;
1006
915
  p.throttledRefilterItems();
1007
916
  return this;
1008
917
  }
1009
- /**
1010
- * @returns {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)}
1011
- */
1012
918
  getFilterFn() {
1013
919
  return this._p.filterFn;
1014
920
  }
1015
- /**
1016
- *
1017
- * @param {DropList.PositionOptions} [positionOptions]
1018
- * @returns {DropList}
1019
- * @public
1020
- */
1021
921
  relayout(positionOptions) {
1022
922
  const p = this._p, el = p.el, menuEl = p.menuEl;
1023
923
  if (!this.isVisible()) return this;
@@ -1118,7 +1018,6 @@ var DropList = class DropList {
1118
1018
  "left": targetBox.left,
1119
1019
  "top": targetBox.top + (invertYPos ? anchor.bottom - position.bottom : anchor.top - position.top)
1120
1020
  };
1121
- if (isRtlDocument) viewCss.left -= document.documentElement.clientWidth - document.documentElement.scrollWidth;
1122
1021
  viewCss.left += anchor.left - position.left;
1123
1022
  if (positionOptions.offset) {
1124
1023
  if (positionOptions.offset.y) if (invertYPos) viewCss.top -= positionOptions.offset.y;
@@ -1159,10 +1058,6 @@ var DropList = class DropList {
1159
1058
  }
1160
1059
  /**
1161
1060
  * Set the checked mode of a specific value.
1162
- * @public
1163
- * @param {*} value - array of values to check
1164
- * @param {boolean} checked - will the value be checked?
1165
- * @returns {DropList} self
1166
1061
  */
1167
1062
  setItemChecked(value, checked) {
1168
1063
  const p = this._p;
@@ -1182,9 +1077,6 @@ var DropList = class DropList {
1182
1077
  }
1183
1078
  /**
1184
1079
  * Set the checked values. All the other values will be unchecked,
1185
- * @public
1186
- * @param {Array<*>} values - array of values to check
1187
- * @returns {DropList} self
1188
1080
  */
1189
1081
  setCheckedValues(values) {
1190
1082
  const p = this._p;
@@ -1207,11 +1099,9 @@ var DropList = class DropList {
1207
1099
  }
1208
1100
  /**
1209
1101
  * Get all checked values. Returns array of item values.
1210
- * @public
1211
- * @param {boolean} excludeGroups=false Exclude group items
1212
- * @returns {Array<*>} self
1102
+ * @param excludeGroups Exclude group items
1213
1103
  */
1214
- getCheckedValues(excludeGroups) {
1104
+ getCheckedValues(excludeGroups = false) {
1215
1105
  const p = this._p;
1216
1106
  excludeGroups = excludeGroups && p.groupCount > 0;
1217
1107
  let values = [];
@@ -1225,11 +1115,9 @@ var DropList = class DropList {
1225
1115
  }
1226
1116
  /**
1227
1117
  * Get all checked items. Returns array of actual item data object.
1228
- * @public
1229
- * @param {boolean} excludeGroups=false Exclude group items
1230
- * @returns {DropList.Item[]}
1118
+ * @param excludeGroups Exclude group items
1231
1119
  */
1232
- getCheckedItems(excludeGroups) {
1120
+ getCheckedItems(excludeGroups = false) {
1233
1121
  const p = this._p;
1234
1122
  excludeGroups = excludeGroups && p.groupCount > 0;
1235
1123
  const items = [];
@@ -1241,12 +1129,6 @@ var DropList = class DropList {
1241
1129
  }
1242
1130
  return items;
1243
1131
  }
1244
- /**
1245
- *
1246
- * @param {DropList.PositionOptions?} [positionOptions]
1247
- * @returns {DropList}
1248
- * @public
1249
- */
1250
1132
  show(positionOptions) {
1251
1133
  const p = this._p;
1252
1134
  p.hiding = false;
@@ -1330,7 +1212,6 @@ var DropList = class DropList {
1330
1212
  /**
1331
1213
  * Change visibility of the header element
1332
1214
  * You should probably call `relayout()` after this.
1333
- * @param {boolean} visible
1334
1215
  */
1335
1216
  setHeaderVisible(visible) {
1336
1217
  if (this.isHeaderVisible() === !!visible) return;
@@ -1339,14 +1220,12 @@ var DropList = class DropList {
1339
1220
  }
1340
1221
  /**
1341
1222
  * Is the header element visible?
1342
- * @returns {boolean}
1343
1223
  */
1344
1224
  isHeaderVisible() {
1345
1225
  return !!this._p.headerEl.parentNode;
1346
1226
  }
1347
1227
  /**
1348
1228
  * Get a reference to the header element in order to add custom content.
1349
- * @returns {Element}
1350
1229
  */
1351
1230
  getHeaderElement() {
1352
1231
  return this._p.headerEl;
@@ -1354,7 +1233,6 @@ var DropList = class DropList {
1354
1233
  /**
1355
1234
  * Change visibility of the footer element
1356
1235
  * You should probably call `relayout()` after this.
1357
- * @param {boolean} visible
1358
1236
  */
1359
1237
  setFooterVisible(visible) {
1360
1238
  if (this.isFooterVisible() === !!visible) return;
@@ -1363,14 +1241,12 @@ var DropList = class DropList {
1363
1241
  }
1364
1242
  /**
1365
1243
  * Is the footer element visible?
1366
- * @returns {boolean}
1367
1244
  */
1368
1245
  isFooterVisible() {
1369
1246
  return !!this._p.footerEl.parentNode;
1370
1247
  }
1371
1248
  /**
1372
1249
  * Get a reference to the footer element in order to add custom content.
1373
- * @returns {Element}
1374
1250
  */
1375
1251
  getFooterElement() {
1376
1252
  return this._p.footerEl;
@@ -1378,7 +1254,6 @@ var DropList = class DropList {
1378
1254
  /**
1379
1255
  * Set inline search visibility
1380
1256
  * You should probably call `relayout()` after this.
1381
- * @param {boolean} searchable
1382
1257
  */
1383
1258
  setSearchable(searchable) {
1384
1259
  const p = this._p;
@@ -1404,7 +1279,6 @@ var DropList = class DropList {
1404
1279
  }
1405
1280
  /**
1406
1281
  * Set the placeholder text of the inline search box
1407
- * @param {string} placeholder
1408
1282
  */
1409
1283
  setSearchPlaceholder(placeholder) {
1410
1284
  const p = this._p;
@@ -1649,9 +1523,6 @@ var DropList = class DropList {
1649
1523
  }
1650
1524
  /**
1651
1525
  * Register an event handler
1652
- * @param {(string|'*')?} event
1653
- * @param {function(any)} handler
1654
- * @returns {DropList}
1655
1526
  */
1656
1527
  on(event, handler) {
1657
1528
  this._p.mitt.on(event, handler);
@@ -1659,9 +1530,6 @@ var DropList = class DropList {
1659
1530
  }
1660
1531
  /**
1661
1532
  * Register a one time event handler
1662
- * @param {(string|'*')?} event
1663
- * @param {function(any)} handler
1664
- * @returns {DropList}
1665
1533
  */
1666
1534
  once(event, handler) {
1667
1535
  let wrapped = (value) => {
@@ -1673,9 +1541,6 @@ var DropList = class DropList {
1673
1541
  }
1674
1542
  /**
1675
1543
  * Remove an `handler` for `event`, all events for `event`, or all events completely.
1676
- * @param {(string|'*')?} event
1677
- * @param {function(any)} handler
1678
- * @returns {DropList}
1679
1544
  */
1680
1545
  off(event, handler) {
1681
1546
  if (!event && !event) this._p.mitt.all.clear();
@@ -1684,9 +1549,6 @@ var DropList = class DropList {
1684
1549
  }
1685
1550
  /**
1686
1551
  * Emit an event
1687
- * @param {string} event
1688
- * @param {any} value
1689
- * @returns {DropList}
1690
1552
  */
1691
1553
  emit(event, value) {
1692
1554
  this._p.mitt.emit(event, value);
@@ -1721,8 +1583,6 @@ var DropList = class DropList {
1721
1583
  return this;
1722
1584
  }
1723
1585
  /**
1724
- * @param {string} event
1725
- * @param {*} [data]
1726
1586
  * @private
1727
1587
  * @internal
1728
1588
  */
@@ -1865,9 +1725,7 @@ var DropList = class DropList {
1865
1725
  case keycode_js.VALUE_UP:
1866
1726
  this.previous(event);
1867
1727
  break;
1868
- case keycode_js.VALUE_DOWN:
1869
- this.next(event);
1870
- break;
1728
+ case keycode_js.VALUE_DOWN: this.next(event);
1871
1729
  }
1872
1730
  break;
1873
1731
  case keycode_js.VALUE_LEFT:
@@ -2140,7 +1998,6 @@ var DropList = class DropList {
2140
1998
  }
2141
1999
  /**
2142
2000
  * @private
2143
- * @returns {DropList} self
2144
2001
  * @internal
2145
2002
  */
2146
2003
  _measureItem() {
@@ -2186,8 +2043,7 @@ var DropList = class DropList {
2186
2043
  }
2187
2044
  /**
2188
2045
  * Determines whether the list should be in virtual mode, depending on the item count.
2189
- * @param {number?} targetItemCount - item count we are expecting. Defaults to current item count
2190
- * @returns {DropList}
2046
+ * @param targetItemCount item count we are expecting. Defaults to current item count
2191
2047
  * @private
2192
2048
  * @internal
2193
2049
  */
@@ -2252,11 +2108,6 @@ var DropList = class DropList {
2252
2108
  var DestroyedSymbol = Symbol("destroyed");
2253
2109
  var RestMultiItemsSymbol = Symbol("rest_multi_items");
2254
2110
  var hasTouchCapability = !!("ontouchstart" in window || window.DocumentTouch && window.document instanceof window.DocumentTouch || window.navigator.maxTouchPoints);
2255
- /**
2256
- * @param {Element|EventTarget} el
2257
- * @param {string} className
2258
- * @returns {boolean}
2259
- */
2260
2111
  var hasClass = function(el, className) {
2261
2112
  if (el instanceof Element) return el.classList.contains(className);
2262
2113
  return false;
@@ -2312,12 +2163,6 @@ var DefaultOptions$1 = {
2312
2163
  closeListWhenLoading: true,
2313
2164
  clearInputWhen: ["single_close", "multi_select_single"]
2314
2165
  };
2315
- /**
2316
- *
2317
- * @param {DropList.ItemBase[]} items
2318
- * @param {string} labelProp
2319
- * @returns {string}
2320
- */
2321
2166
  var defaultMultiPlaceholderFormatter = (items, labelProp) => {
2322
2167
  if (items.length === 0) return "";
2323
2168
  let title = items[0][labelProp] + "";
@@ -2341,9 +2186,6 @@ function restoreFocusState(state) {
2341
2186
  return true;
2342
2187
  }
2343
2188
  var SelectBox = class {
2344
- /**
2345
- * @param {SelectBox.Options} options
2346
- */
2347
2189
  constructor(options) {
2348
2190
  const o = { ...DefaultOptions$1 };
2349
2191
  for (let [key, value] of Object.entries(
@@ -2531,21 +2373,15 @@ var SelectBox = class {
2531
2373
  }
2532
2374
  /**
2533
2375
  * Returns true if other is an inclusive descendant of droplist node, false otherwise, and undefined if the droplist is not initiated.
2534
- * @param {Node} other
2535
- * @param {boolean} [considerSubmenus=true]
2536
- * @returns {boolean|undefined}
2537
2376
  */
2538
2377
  droplistElContains(other, considerSubmenus = true) {
2539
2378
  return this._p.dropList?.elContains(other, considerSubmenus);
2540
2379
  }
2541
2380
  /**
2542
2381
  * Enables the control
2543
- * @param {boolean=true} enabled Should the control be enabled?
2544
- * @returns {SelectBox}
2545
2382
  */
2546
- enable(enabled) {
2383
+ enable(enabled = true) {
2547
2384
  const p = this._p;
2548
- if (enabled === void 0) enabled = true;
2549
2385
  p.disabled = !enabled;
2550
2386
  p.el.setAttribute("aria-disabled", p.disabled.toString());
2551
2387
  p.input.disabled = !!p.disabled;
@@ -2556,50 +2392,38 @@ var SelectBox = class {
2556
2392
  }
2557
2393
  /**
2558
2394
  * Is the control enabled?
2559
- * @returns {boolean}
2560
2395
  */
2561
2396
  isEnabled() {
2562
2397
  return !this._p.disabled;
2563
2398
  }
2564
2399
  /**
2565
2400
  * Disables the control
2566
- * @param {boolean=true} disabled Should the control be disabled?
2567
- * @returns {SelectBox}
2568
2401
  */
2569
- disable(disabled) {
2570
- return this.enable(disabled === void 0 ? false : !disabled);
2402
+ disable(disabled = true) {
2403
+ return this.enable(!disabled);
2571
2404
  }
2572
2405
  /**
2573
2406
  * Is the control disabled?
2574
- * @returns {boolean}
2575
2407
  */
2576
2408
  isDisabled() {
2577
2409
  return this._p.disabled;
2578
2410
  }
2579
2411
  /**
2580
2412
  * Sets read only mode
2581
- * @param {boolean=true} readOnly Should the control be read only?
2582
- * @returns {SelectBox}
2583
2413
  */
2584
- setReadOnly(readOnly) {
2414
+ setReadOnly(readOnly = true) {
2585
2415
  const p = this._p;
2586
- if (readOnly === void 0) readOnly = true;
2587
2416
  p.readOnly = readOnly;
2588
2417
  p.el.setAttribute("aria-readOnly", p.readOnly.toString());
2589
2418
  p.input.readOnly = !(p.searchable || p.multi) || !!p.readOnly;
2590
2419
  return this;
2591
2420
  }
2592
2421
  /**
2593
- * Is the control enabled?
2594
- * @returns {boolean}
2422
+ * Is the control read only?
2595
2423
  */
2596
2424
  isReadOnly() {
2597
2425
  return this._p.readOnly;
2598
2426
  }
2599
- /**
2600
- * @param {string|string[]} classes
2601
- * @returns {SelectBox}
2602
- */
2603
2427
  setAdditionalClasses(classes) {
2604
2428
  const p = this._p;
2605
2429
  p.additionalClasses = classes;
@@ -2607,10 +2431,8 @@ var SelectBox = class {
2607
2431
  return this;
2608
2432
  }
2609
2433
  /**
2610
- *
2611
- * @param {DropList.ItemBase[]} [items]
2612
- * @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
2613
- * @returns {SelectBox}
2434
+ * @param items the items to set (not values)
2435
+ * @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
2614
2436
  */
2615
2437
  setItems(items, resetValues = true) {
2616
2438
  const p = this._p;
@@ -2646,16 +2468,9 @@ var SelectBox = class {
2646
2468
  }
2647
2469
  if (p.dropList) p.dropList.updateItemByValue(value, newItem);
2648
2470
  }
2649
- /**
2650
- * @returns {DropList.ItemBase[]|*}
2651
- */
2652
2471
  getItems() {
2653
2472
  return this._p.items;
2654
2473
  }
2655
- /**
2656
- * @param {boolean} clearable
2657
- * @returns {SelectBox}
2658
- */
2659
2474
  setClearable(clearable) {
2660
2475
  clearable = !!clearable;
2661
2476
  if (this._p.clearable === clearable) return this;
@@ -2663,16 +2478,9 @@ var SelectBox = class {
2663
2478
  this._scheduleSync("render_clear");
2664
2479
  return this;
2665
2480
  }
2666
- /**
2667
- * @returns {boolean}
2668
- */
2669
2481
  getClearable() {
2670
2482
  return this._p.clearable;
2671
2483
  }
2672
- /**
2673
- * @param {boolean} enabled
2674
- * @returns {SelectBox}
2675
- */
2676
2484
  setHasOpenIndicator(enabled) {
2677
2485
  enabled = !!enabled;
2678
2486
  if (this._p.hasOpenIndicator === enabled) return this;
@@ -2680,31 +2488,20 @@ var SelectBox = class {
2680
2488
  this._scheduleSync("render_base");
2681
2489
  return this;
2682
2490
  }
2683
- /**
2684
- * @returns {boolean}
2685
- */
2686
2491
  getHasOpenIndicator() {
2687
2492
  return this._p.hasOpenIndicator;
2688
2493
  }
2689
- /**
2690
- * @param {string} placeholder
2691
- * @returns {SelectBox}
2692
- */
2693
2494
  setPlaceholder(placeholder) {
2694
2495
  this._p.placeholder = placeholder == null ? "" : String(placeholder);
2695
2496
  this._scheduleSync("render_base");
2696
2497
  return this;
2697
2498
  }
2698
- /**
2699
- * @returns {string}
2700
- */
2701
2499
  getPlaceHolder() {
2702
2500
  return this._p.placeholder;
2703
2501
  }
2704
2502
  /**
2705
- * @param {string} term
2706
- * @param {boolean} [performSearch=false] should actually perform the search, or just set the input's text?
2707
- * @returns {SelectBox}
2503
+ * @param term the search term to set
2504
+ * @param performSearch should actually perform the search, or just set the input's text?
2708
2505
  */
2709
2506
  setSearchTerm(term, performSearch = false) {
2710
2507
  const p = this._p;
@@ -2718,9 +2515,6 @@ var SelectBox = class {
2718
2515
  }
2719
2516
  return this;
2720
2517
  }
2721
- /**
2722
- * @returns {string}
2723
- */
2724
2518
  getSearchTerm() {
2725
2519
  const p = this._p;
2726
2520
  if (p.input) return p.input.value;
@@ -2730,10 +2524,6 @@ var SelectBox = class {
2730
2524
  this._p.dropList?.invokeRefilter();
2731
2525
  return this;
2732
2526
  }
2733
- /**
2734
- * @param {boolean} sortSelectedItems
2735
- * @returns {SelectBox}
2736
- */
2737
2527
  setSortSelectedItems(sortSelectedItems) {
2738
2528
  const p = this._p;
2739
2529
  sortSelectedItems = !!sortSelectedItems;
@@ -2742,16 +2532,9 @@ var SelectBox = class {
2742
2532
  this._scheduleSync("render_items");
2743
2533
  return this;
2744
2534
  }
2745
- /**
2746
- * @returns {boolean}
2747
- */
2748
2535
  isSortSelectedItemsEnabled() {
2749
2536
  return this._p.sortSelectedItems;
2750
2537
  }
2751
- /**
2752
- * @param {boolean} sortListItems
2753
- * @returns {SelectBox}
2754
- */
2755
2538
  setSortListItems(sortListItems) {
2756
2539
  const p = this._p;
2757
2540
  sortListItems = !!sortListItems;
@@ -2761,16 +2544,9 @@ var SelectBox = class {
2761
2544
  this._scheduleSync("render_list");
2762
2545
  return this;
2763
2546
  }
2764
- /**
2765
- * @returns {boolean}
2766
- */
2767
2547
  isSortListItemsEnabled() {
2768
2548
  return this._p.sortListItems;
2769
2549
  }
2770
- /**
2771
- * @param {boolean} sortListCheckedFirst
2772
- * @returns {SelectBox}
2773
- */
2774
2550
  setSortListCheckedFirst(sortListCheckedFirst) {
2775
2551
  const p = this._p;
2776
2552
  sortListCheckedFirst = !!sortListCheckedFirst;
@@ -2780,16 +2556,9 @@ var SelectBox = class {
2780
2556
  this._scheduleSync("render_list");
2781
2557
  return this;
2782
2558
  }
2783
- /**
2784
- * @returns {boolean}
2785
- */
2786
2559
  isSortListCheckedFirstEnabled() {
2787
2560
  return this._p.sortListCheckedFirst;
2788
2561
  }
2789
- /**
2790
- * @param {*[]} values
2791
- * @returns {SelectBox}
2792
- */
2793
2562
  setStickyValues(values) {
2794
2563
  const p = this._p;
2795
2564
  p.stickyValues = Array.isArray(values) ? new Set(values) : null;
@@ -2797,16 +2566,9 @@ var SelectBox = class {
2797
2566
  this._scheduleSync("render_list");
2798
2567
  return this;
2799
2568
  }
2800
- /**
2801
- * @returns {*[]}
2802
- */
2803
2569
  getStickyValues() {
2804
2570
  return this._p.stickyValues ? Array.from(this._p.stickyValues) : null;
2805
2571
  }
2806
- /**
2807
- * @param {function(a: DropList.ItemBase, b: DropList.ItemBase):number} comparator
2808
- * @returns {SelectBox}
2809
- */
2810
2572
  setSortItemComparator(comparator) {
2811
2573
  const p = this._p;
2812
2574
  if (p.sortItemComparator === comparator) return this;
@@ -2815,16 +2577,9 @@ var SelectBox = class {
2815
2577
  this._scheduleSync("render_list");
2816
2578
  return this;
2817
2579
  }
2818
- /**
2819
- * @returns {function(a: DropList.ItemBase, b: DropList.ItemBase):number}
2820
- */
2821
2580
  getSortItemComparator() {
2822
2581
  return this._p.sortItemComparator;
2823
2582
  }
2824
- /**
2825
- * @param {boolean} treatGroupSelectionAsItems
2826
- * @returns {SelectBox}
2827
- */
2828
2583
  setTreatGroupSelectionAsItems(treatGroupSelectionAsItems) {
2829
2584
  const p = this._p;
2830
2585
  treatGroupSelectionAsItems = !!treatGroupSelectionAsItems;
@@ -2836,16 +2591,9 @@ var SelectBox = class {
2836
2591
  this._scheduleSync("render_list");
2837
2592
  return this;
2838
2593
  }
2839
- /**
2840
- * @returns {boolean}
2841
- */
2842
2594
  isTreatGroupSelectionAsItemsEnabled() {
2843
2595
  return !this._p.treatGroupSelectionAsItems;
2844
2596
  }
2845
- /**
2846
- * @param {boolean} splitListCheckedGroups
2847
- * @returns {SelectBox}
2848
- */
2849
2597
  setSplitListCheckedGroups(splitListCheckedGroups) {
2850
2598
  const p = this._p;
2851
2599
  splitListCheckedGroups = !!splitListCheckedGroups;
@@ -2855,16 +2603,9 @@ var SelectBox = class {
2855
2603
  this._scheduleSync("render_list");
2856
2604
  return this;
2857
2605
  }
2858
- /**
2859
- * @returns {boolean}
2860
- */
2861
2606
  isSplitListCheckedGroupsEnabled() {
2862
2607
  return this._p.splitListCheckedGroups;
2863
2608
  }
2864
- /**
2865
- * @param {boolean} showSelection
2866
- * @returns {SelectBox}
2867
- */
2868
2609
  setShowSelection(showSelection) {
2869
2610
  const p = this._p;
2870
2611
  showSelection = !!showSelection;
@@ -2873,16 +2614,9 @@ var SelectBox = class {
2873
2614
  this._scheduleSync("render_items");
2874
2615
  return this;
2875
2616
  }
2876
- /**
2877
- * @returns {boolean}
2878
- */
2879
2617
  isShowSelectionEnabled() {
2880
2618
  return this._p.showSelection;
2881
2619
  }
2882
- /**
2883
- * @param {boolean} showPlaceholderInTooltip
2884
- * @returns {SelectBox}
2885
- */
2886
2620
  setShowPlaceholderInTooltip(showPlaceholderInTooltip) {
2887
2621
  const p = this._p;
2888
2622
  showPlaceholderInTooltip = !!showPlaceholderInTooltip;
@@ -2891,16 +2625,9 @@ var SelectBox = class {
2891
2625
  this._scheduleSync("render_base");
2892
2626
  return this;
2893
2627
  }
2894
- /**
2895
- * @returns {boolean}
2896
- */
2897
2628
  isShowPlaceholderInTooltipEnabled() {
2898
2629
  return this._p.showPlaceholderInTooltip;
2899
2630
  }
2900
- /**
2901
- * @param {function(items: DropList.ItemBase[]):string} formatter
2902
- * @returns {SelectBox}
2903
- */
2904
2631
  setMultiPlaceholderFormatter(formatter) {
2905
2632
  const p = this._p;
2906
2633
  if (p.multiPlaceholderFormatter === formatter) return this;
@@ -2908,26 +2635,15 @@ var SelectBox = class {
2908
2635
  this._scheduleSync("render_base");
2909
2636
  return this;
2910
2637
  }
2911
- /**
2912
- * @param {boolean|'touch'} value
2913
- * @returns {SelectBox}
2914
- */
2915
2638
  setBlurOnSingleSelection(value) {
2916
2639
  const p = this._p;
2917
2640
  if (p.blurOnSingleSelection === value) return this;
2918
2641
  p.blurOnSingleSelection = value;
2919
2642
  return this;
2920
2643
  }
2921
- /**
2922
- * @returns {boolean|'touch'}
2923
- */
2924
2644
  getBlurOnSingleSelection() {
2925
2645
  return this._p.blurOnSingleSelection;
2926
2646
  }
2927
- /**
2928
- * @param {boolean} multi
2929
- * @returns {SelectBox}
2930
- */
2931
2647
  setMulti(multi) {
2932
2648
  const p = this._p;
2933
2649
  multi = !!multi;
@@ -2943,16 +2659,9 @@ var SelectBox = class {
2943
2659
  this._scheduleSync("full");
2944
2660
  return this;
2945
2661
  }
2946
- /**
2947
- * @returns {boolean}
2948
- */
2949
2662
  isMultiEnabled() {
2950
2663
  return this._p.multi;
2951
2664
  }
2952
- /**
2953
- * @param {boolean} searchable
2954
- * @returns {SelectBox}
2955
- */
2956
2665
  setSearchable(searchable) {
2957
2666
  const p = this._p;
2958
2667
  searchable = !!searchable;
@@ -2961,10 +2670,6 @@ var SelectBox = class {
2961
2670
  this._scheduleSync("full");
2962
2671
  return this;
2963
2672
  }
2964
- /**
2965
- * @param {boolean} allowTypeToSelect
2966
- * @returns {SelectBox}
2967
- */
2968
2673
  setAllowTypeToSelect(allowTypeToSelect) {
2969
2674
  const p = this._p;
2970
2675
  allowTypeToSelect = !!allowTypeToSelect;
@@ -2972,129 +2677,71 @@ var SelectBox = class {
2972
2677
  p.allowTypeToSelect = allowTypeToSelect;
2973
2678
  return this;
2974
2679
  }
2975
- /**
2976
- * @returns {boolean}
2977
- */
2978
2680
  isSearchableEnabled() {
2979
2681
  return this._p.searchable;
2980
2682
  }
2981
- /**
2982
- * @param {string} noResultsText
2983
- * @returns {SelectBox}
2984
- */
2985
2683
  setNoResultsText(noResultsText) {
2986
2684
  this._p.dropList?.setNoResultsText(noResultsText);
2987
2685
  return this;
2988
2686
  }
2989
- /**
2990
- * @returns {string}
2991
- */
2992
2687
  getNoResultsText() {
2993
2688
  return this._p.noResultsText;
2994
2689
  }
2995
- /**
2996
- * @param {boolean} autoSelectTextOnCheck
2997
- * @returns {SelectBox}
2998
- */
2999
2690
  setAutoSelectTextOnCheck(autoSelectTextOnCheck) {
3000
2691
  this._p.autoSelectTextOnCheck = autoSelectTextOnCheck;
3001
2692
  return this;
3002
2693
  }
3003
- /**
3004
- * @returns {boolean}
3005
- */
3006
2694
  getAutoSelectTextOnCheck() {
3007
2695
  return this._p.autoSelectTextOnCheck;
3008
2696
  }
3009
- /**
3010
- * @param {number} window
3011
- * @returns {SelectBox}
3012
- */
3013
2697
  setFilterThrottleWindow(window) {
3014
2698
  const p = this._p;
3015
2699
  p.filterThrottleWindow = window;
3016
2700
  p.dropList?.setFilterThrottleWindow(window);
3017
2701
  return this;
3018
2702
  }
3019
- /**
3020
- * @returns {number}
3021
- */
3022
2703
  getFilterThrottleWindow() {
3023
2704
  return this._p.filterThrottleWindow;
3024
2705
  }
3025
- /**
3026
- * @param {boolean} value
3027
- * @returns {SelectBox}
3028
- */
3029
2706
  setFilterOnEmptyTerm(value) {
3030
2707
  const p = this._p;
3031
2708
  if (p.filterOnEmptyTerm === value) return this;
3032
2709
  p.dropList?.setFilterOnEmptyTerm(value);
3033
2710
  return this;
3034
2711
  }
3035
- /**
3036
- * @returns {boolean}
3037
- */
3038
2712
  getFilterOnEmptyTerm() {
3039
2713
  return this._p.filterOnEmptyTerm;
3040
2714
  }
3041
- /**
3042
- * @param {DropList.Options} listOptions
3043
- * @returns {SelectBox}
3044
- */
3045
2715
  setListOptions(listOptions) {
3046
2716
  const p = this._p;
3047
2717
  p.listOptions = listOptions;
3048
2718
  this._setupDropdownMenu();
3049
2719
  return this;
3050
2720
  }
3051
- /**
3052
- * @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
3053
- * @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
3054
- * @returns {SelectBox})|null
3055
- */
3056
2721
  setRenderSingleItem(render, unrender) {
3057
2722
  const p = this._p;
3058
2723
  p.renderSingleItem = render;
3059
2724
  p.unrenderSingleItem = unrender;
3060
2725
  return this;
3061
2726
  }
3062
- /**
3063
- * @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
3064
- * @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
3065
- * @returns {SelectBox}
3066
- */
3067
2727
  setRenderMultiItem(render, unrender) {
3068
2728
  const p = this._p;
3069
2729
  p.renderMultiItem = render;
3070
2730
  p.unrenderMultiItem = unrender;
3071
2731
  return this;
3072
2732
  }
3073
- /**
3074
- * @param {(function(item: DropList.ItemBase, itemEl: Element):(*|false))|null} render
3075
- * @param {(function(item: DropList.ItemBase, itemEl: Element))|null} unrender
3076
- * @returns {SelectBox}
3077
- */
3078
2733
  setRenderRestMultiItem(render, unrender) {
3079
2734
  const p = this._p;
3080
2735
  p.renderRestMultiItem = render;
3081
2736
  p.unrenderRestMultiItem = unrender;
3082
2737
  return this;
3083
2738
  }
3084
- /**
3085
- * @param {string} prop
3086
- * @returns {SelectBox}
3087
- */
3088
2739
  setLabelProp(prop) {
3089
2740
  const p = this._p;
3090
2741
  p.labelProp = prop;
3091
2742
  if (p.dropList) p.dropList.setLabelProp(prop);
3092
2743
  return this;
3093
2744
  }
3094
- /**
3095
- * @param {string} prop
3096
- * @returns {SelectBox}
3097
- */
3098
2745
  setValueProp(prop) {
3099
2746
  const p = this._p;
3100
2747
  if (p.valueProp === prop) return this;
@@ -3103,50 +2750,31 @@ var SelectBox = class {
3103
2750
  this._refreshItemByValueMap();
3104
2751
  return this;
3105
2752
  }
3106
- /**
3107
- * @param {string} prop
3108
- * @returns {SelectBox}
3109
- */
3110
2753
  setMultiItemLabelProp(prop) {
3111
2754
  const p = this._p;
3112
2755
  p.multiItemLabelProp = prop;
3113
2756
  this._scheduleSync("render_items");
3114
2757
  return this;
3115
2758
  }
3116
- /**
3117
- * @param {'before'|'after'|'none'} position
3118
- * @returns {SelectBox}
3119
- */
3120
2759
  setMultiItemRemovePosition(position) {
3121
2760
  const p = this._p;
3122
2761
  p.multiItemRemovePosition = position;
3123
2762
  this._scheduleSync("render_items");
3124
2763
  return this;
3125
2764
  }
3126
- /**
3127
- * @param {number|null|undefined} value
3128
- * @returns {SelectBox}
3129
- */
3130
2765
  setMaxMultiItems(value) {
3131
2766
  const p = this._p;
3132
2767
  p.maxMultiItems = value;
3133
2768
  return this;
3134
2769
  }
3135
- /**
3136
- * @param {function(count: number, items: DropList.ItemBase[]):string|null|undefined} value
3137
- * @returns {SelectBox}
3138
- */
3139
2770
  setMultiItemsRestLabelProvider(value) {
3140
2771
  const p = this._p;
3141
2772
  p.multiItemsRestLabelProvider = value;
3142
2773
  return this;
3143
2774
  }
3144
- /**
3145
- * @param {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)} fn
3146
- * @returns {SelectBox}
3147
- */
3148
2775
  setFilterFn(fn) {
3149
2776
  const p = this._p;
2777
+ fn ??= null;
3150
2778
  if (p.filterFn === fn) return this;
3151
2779
  p.filterFn = fn;
3152
2780
  if (!fn) fn = (items, term) => {
@@ -3161,9 +2789,6 @@ var SelectBox = class {
3161
2789
  p.dropList?.setFilterFn(fn);
3162
2790
  return this;
3163
2791
  }
3164
- /**
3165
- * @returns {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)}
3166
- */
3167
2792
  getFilterFn() {
3168
2793
  return this._p.filterFn;
3169
2794
  }
@@ -3171,8 +2796,6 @@ var SelectBox = class {
3171
2796
  * Sets a handler to intercept internal errors/warnings (e.g. from a throwing `renderMultiItem`/`unrenderSingleItem`)
3172
2797
  * instead of the default `console.error`/`console.warn`. Also used as the default `onError` for the internal
3173
2798
  * `DropList`, unless `listOptions.onError` is set explicitly.
3174
- * @param {SelectBox.LibraryErrorHandler|null} [fn]
3175
- * @returns {SelectBox}
3176
2799
  */
3177
2800
  setOnError(fn) {
3178
2801
  const p = this._p;
@@ -3181,14 +2804,13 @@ var SelectBox = class {
3181
2804
  return this;
3182
2805
  }
3183
2806
  /**
3184
- * @returns {SelectBox.LibraryErrorHandler|undefined}
2807
+ * Gets the current `onError` handler, if any.
3185
2808
  */
3186
2809
  getOnError() {
3187
2810
  return this._p.onError;
3188
2811
  }
3189
2812
  /**
3190
2813
  * Focus on input element
3191
- * @returns {SelectBox}
3192
2814
  */
3193
2815
  focusInput() {
3194
2816
  const p = this._p;
@@ -3197,7 +2819,6 @@ var SelectBox = class {
3197
2819
  }
3198
2820
  /**
3199
2821
  * Remvoe focus from the input element
3200
- * @returns {SelectBox}
3201
2822
  */
3202
2823
  blurInput() {
3203
2824
  const p = this._p;
@@ -3206,7 +2827,6 @@ var SelectBox = class {
3206
2827
  }
3207
2828
  /**
3208
2829
  * Removes all selected items
3209
- * @returns {SelectBox}
3210
2830
  */
3211
2831
  clear() {
3212
2832
  if (!this._performClearWithEvent(true)) return this;
@@ -3215,8 +2835,6 @@ var SelectBox = class {
3215
2835
  }
3216
2836
  /**
3217
2837
  * Returns a single value or an array of selected values - depending on `multi` prop
3218
- * @public
3219
- * @returns {*[]}
3220
2838
  */
3221
2839
  getValue() {
3222
2840
  const p = this._p;
@@ -3225,9 +2843,7 @@ var SelectBox = class {
3225
2843
  }
3226
2844
  /**
3227
2845
  * Selects the specified value or multiple values - depending on `multi` prop
3228
- * @public
3229
- * @param {*|*[]} value - if `multi`, then an array of values to select, otherwise - a single value to select
3230
- * @returns {SelectBox}
2846
+ * @param value - if `multi`, then an array of values to select, otherwise - a single value to select
3231
2847
  */
3232
2848
  setValue(value) {
3233
2849
  if (this._p.multi) return this.setSelectedValues(Array.isArray(value) ? value : value !== void 0 ? [value] : []);
@@ -3235,17 +2851,12 @@ var SelectBox = class {
3235
2851
  }
3236
2852
  /**
3237
2853
  * Returns an array of selected values
3238
- * @public
3239
- * @returns {*[]}
3240
2854
  */
3241
2855
  getSelectedValues() {
3242
2856
  return this._p.selectedValues.slice(0);
3243
2857
  }
3244
2858
  /**
3245
2859
  * Selects the specified values
3246
- * @public
3247
- * @param {*[]} values - an array of *values* to select
3248
- * @returns {SelectBox}
3249
2860
  */
3250
2861
  setSelectedValues(values) {
3251
2862
  const p = this._p, valueProp = p.valueProp;
@@ -3270,16 +2881,12 @@ var SelectBox = class {
3270
2881
  }
3271
2882
  /**
3272
2883
  * Returns the count of selected values
3273
- * @public
3274
- * @returns {number}
3275
2884
  */
3276
2885
  getSelectedValueCount() {
3277
2886
  return this._p.selectedValues.length;
3278
2887
  }
3279
2888
  /**
3280
2889
  * Returns an array of selected items
3281
- * @public
3282
- * @returns {Array.<Object>}
3283
2890
  */
3284
2891
  getSelectedItems() {
3285
2892
  return this._p.selectedItems.slice(0);
@@ -3288,17 +2895,11 @@ var SelectBox = class {
3288
2895
  * Sets the specified items to "checked" mode.
3289
2896
  * An array of items is passed, not values, because we need to keep track if items,
3290
2897
  * and if we already have the array of items then this spares the process of searching for the items by values.
3291
- * @public
3292
- * @param {DropList.ItemBase[]} items - an array of *items* to select (not values)
3293
- * @returns {SelectBox}
3294
2898
  */
3295
2899
  setSelectedItems(items) {
3296
2900
  this._setSelectedItems(items);
3297
2901
  return this;
3298
2902
  }
3299
- /**
3300
- * @returns {SelectBox}
3301
- */
3302
2903
  openList() {
3303
2904
  const p = this._p;
3304
2905
  if (p.dropList.isVisible()) return this;
@@ -3313,9 +2914,6 @@ var SelectBox = class {
3313
2914
  else if (!p.multi && this.getValue() !== void 0) p.dropList.setFocusedItemByValue(this.getValue());
3314
2915
  return this;
3315
2916
  }
3316
- /**
3317
- * @returns {SelectBox}
3318
- */
3319
2917
  closeList() {
3320
2918
  const p = this._p;
3321
2919
  if (this[DestroyedSymbol]) return this;
@@ -3327,32 +2925,17 @@ var SelectBox = class {
3327
2925
  }
3328
2926
  return this;
3329
2927
  }
3330
- /**
3331
- * @param {boolean} [open]
3332
- * @returns {SelectBox}
3333
- */
3334
2928
  toggleList(open) {
3335
2929
  const p = this._p;
3336
2930
  if (open === void 0 ? !p.dropList.isVisible() : !!open) return this.openList();
3337
2931
  else return this.closeList();
3338
2932
  }
3339
- /**
3340
- * @returns {boolean}
3341
- */
3342
2933
  isListOpen() {
3343
2934
  return !!this._p.dropListVisible;
3344
2935
  }
3345
- /**
3346
- * @param {boolean} [on]
3347
- * @returns {SelectBox}
3348
- */
3349
2936
  toggleLoading(on) {
3350
2937
  return this.setIsLoadingMode(on === void 0 ? !this.getIsLoadingMode() : !!on);
3351
2938
  }
3352
- /**
3353
- * @param {boolean} isLoadingMode
3354
- * @returns {SelectBox}
3355
- */
3356
2939
  setIsLoadingMode(isLoadingMode) {
3357
2940
  const p = this._p;
3358
2941
  isLoadingMode = isLoadingMode === void 0 ? true : !!isLoadingMode;
@@ -3363,31 +2946,21 @@ var SelectBox = class {
3363
2946
  this._scheduleSync("render_base");
3364
2947
  return this;
3365
2948
  }
3366
- /**
3367
- * @returns {boolean}
3368
- */
3369
2949
  getIsLoadingMode() {
3370
2950
  return this._p.isLoadingMode;
3371
2951
  }
3372
2952
  /**
3373
2953
  * Sets whether to close the list when loading mode is enabled
3374
- * @param {boolean} closeListWhenLoading
3375
- * @returns {SelectBox}
3376
2954
  */
3377
2955
  setCloseListWhenLoading(closeListWhenLoading) {
3378
2956
  this._p.closeListWhenLoading = closeListWhenLoading;
3379
2957
  return this;
3380
2958
  }
3381
- /**
3382
- * @returns {boolean}
3383
- */
3384
2959
  getCloseListWhenLoading() {
3385
2960
  return this._p.closeListWhenLoading;
3386
2961
  }
3387
2962
  /**
3388
2963
  * Sets when to clear the input field
3389
- * @param {string[]} clearInputWhen
3390
- * @returns {SelectBox}
3391
2964
  */
3392
2965
  setClearInputWhen(clearInputWhen) {
3393
2966
  this._p.clearInputWhen = Array.isArray(clearInputWhen) ? clearInputWhen.slice(0) : [];
@@ -3395,15 +2968,12 @@ var SelectBox = class {
3395
2968
  }
3396
2969
  /**
3397
2970
  * Retrieves the settings for when to clear the input field
3398
- * @returns {string[]}
3399
2971
  */
3400
2972
  getClearInputWhen() {
3401
2973
  return this._p.clearInputWhen;
3402
2974
  }
3403
2975
  /**
3404
2976
  * Sets the appropriate direction for the selectbox
3405
- * @param {'ltr'|'rtl'|'auto'} direction
3406
- * @return {SelectBox}
3407
2977
  */
3408
2978
  setDirection(direction) {
3409
2979
  const p = this._p;
@@ -3413,14 +2983,12 @@ var SelectBox = class {
3413
2983
  }
3414
2984
  /**
3415
2985
  * Gets the supplied direction for the selectbox
3416
- * @return {'ltr'|'rtl'|'auto'}
3417
2986
  */
3418
2987
  getDirection() {
3419
2988
  return this._p.direction;
3420
2989
  }
3421
2990
  /**
3422
2991
  * Can be called in case that the selectbox was attached to the dom late and has a weird size.
3423
- * @returns {SelectBox}
3424
2992
  */
3425
2993
  refreshSize() {
3426
2994
  this._resizeInput();
@@ -3428,9 +2996,6 @@ var SelectBox = class {
3428
2996
  }
3429
2997
  /**
3430
2998
  * Register an event handler
3431
- * @param {(string|'*')?} event
3432
- * @param {function(any)} handler
3433
- * @returns {SelectBox}
3434
2999
  */
3435
3000
  on(event, handler) {
3436
3001
  this._p.mitt.on(event, handler);
@@ -3438,9 +3003,6 @@ var SelectBox = class {
3438
3003
  }
3439
3004
  /**
3440
3005
  * Register a one time event handler
3441
- * @param {(string|'*')?} event
3442
- * @param {function(any)} handler
3443
- * @returns {SelectBox}
3444
3006
  */
3445
3007
  once(event, handler) {
3446
3008
  let wrapped = (value) => {
@@ -3452,9 +3014,6 @@ var SelectBox = class {
3452
3014
  }
3453
3015
  /**
3454
3016
  * Remove an `handler` for `event`, all events for `event`, or all events completely.
3455
- * @param {(string|'*')?} event
3456
- * @param {function(any)} handler
3457
- * @returns {SelectBox}
3458
3017
  */
3459
3018
  off(event, handler) {
3460
3019
  if (!event && !event) this._p.mitt.all.clear();
@@ -3463,9 +3022,6 @@ var SelectBox = class {
3463
3022
  }
3464
3023
  /**
3465
3024
  * Emit an event
3466
- * @param {string} event
3467
- * @param {any} value
3468
- * @returns {SelectBox}
3469
3025
  */
3470
3026
  emit(event, value) {
3471
3027
  this._p.mitt.emit(event, value);
@@ -3485,8 +3041,6 @@ var SelectBox = class {
3485
3041
  p.subitemByValueMap = null;
3486
3042
  }
3487
3043
  /**
3488
- * @param {*} value
3489
- * @returns {DropList.ItemBase|undefined}
3490
3044
  * @private
3491
3045
  * @internal
3492
3046
  */
@@ -3505,9 +3059,6 @@ var SelectBox = class {
3505
3059
  this._addSubitemsToValueMap(p.items, subitemByValueMap, p.valueProp);
3506
3060
  }
3507
3061
  /**
3508
- * @param {DropList.ItemBase[]} items
3509
- * @param {Map<*, DropList.ItemBase>} itemByValueMap
3510
- * @param {string} valueProp
3511
3062
  * @private
3512
3063
  * @internal
3513
3064
  */
@@ -3786,9 +3337,7 @@ var SelectBox = class {
3786
3337
  case "search":
3787
3338
  this._trigger("search", event);
3788
3339
  break;
3789
- case "itemschanged":
3790
- this._trigger("itemschanged", event);
3791
- break;
3340
+ case "itemschanged": this._trigger("itemschanged", event);
3792
3341
  }
3793
3342
  }
3794
3343
  });
@@ -3856,9 +3405,7 @@ var SelectBox = class {
3856
3405
  case keycode_js.VALUE_HOME:
3857
3406
  dropList.goToFirst(evt);
3858
3407
  break;
3859
- case keycode_js.VALUE_END:
3860
- dropList.goToLast(evt);
3861
- break;
3408
+ case keycode_js.VALUE_END: dropList.goToLast(evt);
3862
3409
  }
3863
3410
  break;
3864
3411
  case keycode_js.VALUE_SPACE:
@@ -3888,17 +3435,15 @@ var SelectBox = class {
3888
3435
  evt.preventDefault();
3889
3436
  }
3890
3437
  break;
3891
- default:
3892
- if (dropList.isVisible()) dropList._keydownFreeType(evt, false);
3893
- else if (p.allowTypeToSelect) dropList._keydownFreeType(evt, true);
3894
- else {
3895
- this.openList();
3896
- setTimeout(() => {
3897
- if (this[DestroyedSymbol]) return;
3898
- dropList._keydownFreeType(evt, false);
3899
- });
3900
- }
3901
- break;
3438
+ default: if (dropList.isVisible()) dropList._keydownFreeType(evt, false);
3439
+ else if (p.allowTypeToSelect) dropList._keydownFreeType(evt, true);
3440
+ else {
3441
+ this.openList();
3442
+ setTimeout(() => {
3443
+ if (this[DestroyedSymbol]) return;
3444
+ dropList._keydownFreeType(evt, false);
3445
+ });
3446
+ }
3902
3447
  }
3903
3448
  if (!suppressEnterSpaceToggle) {
3904
3449
  if (evt.key === keycode_js.VALUE_ENTER || evt.key === keycode_js.VALUE_SPACE && p.lastKeyAllowsNonTypeKeys && !p.multi && !dropList.hasFocusedItem() && !p.disabled && !p.readOnly) {
@@ -4118,9 +3663,7 @@ var SelectBox = class {
4118
3663
  if (!p.showSelection) this._syncPlaceholder();
4119
3664
  else if (p.multiItemEls[p.multiItemEls.length - 1]?.[ItemSymbol]?.[p.valueProp] === RestMultiItemsSymbol) this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);
4120
3665
  break;
4121
- case "resize_input":
4122
- this._resizeInput();
4123
- break;
3666
+ case "resize_input": this._resizeInput();
4124
3667
  }
4125
3668
  }
4126
3669
  /** @private */
@@ -4141,7 +3684,6 @@ var SelectBox = class {
4141
3684
  p.singleWrapper.innerHTML = "";
4142
3685
  }
4143
3686
  /**
4144
- * @param {number} index
4145
3687
  * @private
4146
3688
  * @internal
4147
3689
  */
@@ -4166,7 +3708,6 @@ var SelectBox = class {
4166
3708
  }
4167
3709
  }
4168
3710
  /**
4169
- * @param {DropList.ItemBase} item
4170
3711
  * @private
4171
3712
  * @internal
4172
3713
  */
@@ -4180,8 +3721,6 @@ var SelectBox = class {
4180
3721
  }
4181
3722
  }
4182
3723
  /**
4183
- * @param {DropList.ItemBase} item
4184
- * @param {Element} itemEl
4185
3724
  * @private
4186
3725
  * @internal
4187
3726
  */
@@ -4195,7 +3734,6 @@ var SelectBox = class {
4195
3734
  }
4196
3735
  }
4197
3736
  /**
4198
- * @param {DropList.ItemBase} item
4199
3737
  * @returns {boolean} true if rendered, false if not
4200
3738
  * @private
4201
3739
  * @internal
@@ -4269,9 +3807,6 @@ var SelectBox = class {
4269
3807
  }
4270
3808
  /**
4271
3809
  * Syncs render state, selected items, and position
4272
- * @param {boolean=false} fullItemsRender Should re-render all items?
4273
- * @param {boolean=false} updateListItems Should call updateListItems?
4274
- * @returns {SelectBox}
4275
3810
  * @internal
4276
3811
  */
4277
3812
  _syncFull(fullItemsRender, updateListItems) {
@@ -4330,8 +3865,6 @@ var SelectBox = class {
4330
3865
  return this;
4331
3866
  }
4332
3867
  /**
4333
- * @param {string} event
4334
- * @param {*} [data]
4335
3868
  * @private
4336
3869
  * @internal
4337
3870
  */
@@ -4343,8 +3876,6 @@ var SelectBox = class {
4343
3876
  }
4344
3877
  /**
4345
3878
  * Render a multi item
4346
- * @param {Object} item
4347
- * @returns {Element|null}
4348
3879
  * @private
4349
3880
  * @internal
4350
3881
  */
@@ -4370,9 +3901,6 @@ var SelectBox = class {
4370
3901
  }
4371
3902
  /**
4372
3903
  * Removes a specific multi item by user event
4373
- * @param {Element} itemEl
4374
- * @param {Event} originatingEvent
4375
- * @returns {SelectBox}
4376
3904
  * @private
4377
3905
  * @internal
4378
3906
  */
@@ -4432,8 +3960,6 @@ var SelectBox = class {
4432
3960
  return this;
4433
3961
  }
4434
3962
  /**
4435
- * @param {DropList.ItemBase} item
4436
- * @param {boolean} [populate]
4437
3963
  * @private
4438
3964
  * @internal
4439
3965
  */
@@ -4460,7 +3986,6 @@ var SelectBox = class {
4460
3986
  this._scheduleSync("render_list");
4461
3987
  }
4462
3988
  /**
4463
- * @param {*} value
4464
3989
  * @private
4465
3990
  * @internal
4466
3991
  */
@@ -4473,7 +3998,6 @@ var SelectBox = class {
4473
3998
  }
4474
3999
  /**
4475
4000
  * Update input size to current state
4476
- * @returns {SelectBox}
4477
4001
  * @private
4478
4002
  * @internal
4479
4003
  */
@@ -4531,7 +4055,6 @@ var SelectBox = class {
4531
4055
  }
4532
4056
  /**
4533
4057
  * Update autocomplete position if needed
4534
- * @returns {SelectBox}
4535
4058
  * @private
4536
4059
  * @internal
4537
4060
  */
@@ -4547,7 +4070,6 @@ var SelectBox = class {
4547
4070
  return this;
4548
4071
  }
4549
4072
  /**
4550
- * @param {KeyboardEvent} event
4551
4073
  * @private
4552
4074
  * @internal
4553
4075
  */
@@ -4578,7 +4100,6 @@ var SelectBox = class {
4578
4100
  }
4579
4101
  }
4580
4102
  /**
4581
- * @param {KeyboardEvent} event
4582
4103
  * @private
4583
4104
  * @internal
4584
4105
  */
@@ -4624,13 +4145,12 @@ var SelectBox = class {
4624
4145
  }
4625
4146
  }
4626
4147
  /**
4627
- * @returns {DropList.PositionOptions}
4628
4148
  * @private
4629
4149
  * @internal
4630
4150
  */
4631
4151
  _getDropListPositionOptions() {
4632
4152
  return {
4633
- target: this._p.el,
4153
+ target: /**@type Element*/ this._p.el,
4634
4154
  offset: {
4635
4155
  x: 0,
4636
4156
  y: 0
@@ -4667,11 +4187,6 @@ var SelectBox = class {
4667
4187
  /**
4668
4188
  * Handles sorting, and putting checked items first (according to selectedValues, not item.checked)
4669
4189
  * @private
4670
- * @param {DropList.ItemBase[]} items
4671
- * @param {boolean=false} sort
4672
- * @param {boolean=false} sortCheckedFirst
4673
- * @param {boolean=false} splitCheckedGroups
4674
- * @returns {DropList.ItemBase[]}
4675
4190
  * @internal
4676
4191
  */
4677
4192
  _sortItems(items, sort, sortCheckedFirst, splitCheckedGroups) {