@danielgindi/selectbox 2.0.58 → 2.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.58
2
+ * @danielgindi/selectbox 2.0.59
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;
@@ -1159,10 +1059,6 @@ var DropList = class DropList {
1159
1059
  }
1160
1060
  /**
1161
1061
  * 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
1062
  */
1167
1063
  setItemChecked(value, checked) {
1168
1064
  const p = this._p;
@@ -1182,9 +1078,6 @@ var DropList = class DropList {
1182
1078
  }
1183
1079
  /**
1184
1080
  * 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
1081
  */
1189
1082
  setCheckedValues(values) {
1190
1083
  const p = this._p;
@@ -1207,11 +1100,9 @@ var DropList = class DropList {
1207
1100
  }
1208
1101
  /**
1209
1102
  * Get all checked values. Returns array of item values.
1210
- * @public
1211
- * @param {boolean} excludeGroups=false Exclude group items
1212
- * @returns {Array<*>} self
1103
+ * @param excludeGroups Exclude group items
1213
1104
  */
1214
- getCheckedValues(excludeGroups) {
1105
+ getCheckedValues(excludeGroups = false) {
1215
1106
  const p = this._p;
1216
1107
  excludeGroups = excludeGroups && p.groupCount > 0;
1217
1108
  let values = [];
@@ -1225,11 +1116,9 @@ var DropList = class DropList {
1225
1116
  }
1226
1117
  /**
1227
1118
  * 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[]}
1119
+ * @param excludeGroups Exclude group items
1231
1120
  */
1232
- getCheckedItems(excludeGroups) {
1121
+ getCheckedItems(excludeGroups = false) {
1233
1122
  const p = this._p;
1234
1123
  excludeGroups = excludeGroups && p.groupCount > 0;
1235
1124
  const items = [];
@@ -1241,12 +1130,6 @@ var DropList = class DropList {
1241
1130
  }
1242
1131
  return items;
1243
1132
  }
1244
- /**
1245
- *
1246
- * @param {DropList.PositionOptions?} [positionOptions]
1247
- * @returns {DropList}
1248
- * @public
1249
- */
1250
1133
  show(positionOptions) {
1251
1134
  const p = this._p;
1252
1135
  p.hiding = false;
@@ -1330,7 +1213,6 @@ var DropList = class DropList {
1330
1213
  /**
1331
1214
  * Change visibility of the header element
1332
1215
  * You should probably call `relayout()` after this.
1333
- * @param {boolean} visible
1334
1216
  */
1335
1217
  setHeaderVisible(visible) {
1336
1218
  if (this.isHeaderVisible() === !!visible) return;
@@ -1339,14 +1221,12 @@ var DropList = class DropList {
1339
1221
  }
1340
1222
  /**
1341
1223
  * Is the header element visible?
1342
- * @returns {boolean}
1343
1224
  */
1344
1225
  isHeaderVisible() {
1345
1226
  return !!this._p.headerEl.parentNode;
1346
1227
  }
1347
1228
  /**
1348
1229
  * Get a reference to the header element in order to add custom content.
1349
- * @returns {Element}
1350
1230
  */
1351
1231
  getHeaderElement() {
1352
1232
  return this._p.headerEl;
@@ -1354,7 +1234,6 @@ var DropList = class DropList {
1354
1234
  /**
1355
1235
  * Change visibility of the footer element
1356
1236
  * You should probably call `relayout()` after this.
1357
- * @param {boolean} visible
1358
1237
  */
1359
1238
  setFooterVisible(visible) {
1360
1239
  if (this.isFooterVisible() === !!visible) return;
@@ -1363,14 +1242,12 @@ var DropList = class DropList {
1363
1242
  }
1364
1243
  /**
1365
1244
  * Is the footer element visible?
1366
- * @returns {boolean}
1367
1245
  */
1368
1246
  isFooterVisible() {
1369
1247
  return !!this._p.footerEl.parentNode;
1370
1248
  }
1371
1249
  /**
1372
1250
  * Get a reference to the footer element in order to add custom content.
1373
- * @returns {Element}
1374
1251
  */
1375
1252
  getFooterElement() {
1376
1253
  return this._p.footerEl;
@@ -1378,7 +1255,6 @@ var DropList = class DropList {
1378
1255
  /**
1379
1256
  * Set inline search visibility
1380
1257
  * You should probably call `relayout()` after this.
1381
- * @param {boolean} searchable
1382
1258
  */
1383
1259
  setSearchable(searchable) {
1384
1260
  const p = this._p;
@@ -1404,7 +1280,6 @@ var DropList = class DropList {
1404
1280
  }
1405
1281
  /**
1406
1282
  * Set the placeholder text of the inline search box
1407
- * @param {string} placeholder
1408
1283
  */
1409
1284
  setSearchPlaceholder(placeholder) {
1410
1285
  const p = this._p;
@@ -1649,9 +1524,6 @@ var DropList = class DropList {
1649
1524
  }
1650
1525
  /**
1651
1526
  * Register an event handler
1652
- * @param {(string|'*')?} event
1653
- * @param {function(any)} handler
1654
- * @returns {DropList}
1655
1527
  */
1656
1528
  on(event, handler) {
1657
1529
  this._p.mitt.on(event, handler);
@@ -1659,9 +1531,6 @@ var DropList = class DropList {
1659
1531
  }
1660
1532
  /**
1661
1533
  * Register a one time event handler
1662
- * @param {(string|'*')?} event
1663
- * @param {function(any)} handler
1664
- * @returns {DropList}
1665
1534
  */
1666
1535
  once(event, handler) {
1667
1536
  let wrapped = (value) => {
@@ -1673,9 +1542,6 @@ var DropList = class DropList {
1673
1542
  }
1674
1543
  /**
1675
1544
  * 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
1545
  */
1680
1546
  off(event, handler) {
1681
1547
  if (!event && !event) this._p.mitt.all.clear();
@@ -1684,9 +1550,6 @@ var DropList = class DropList {
1684
1550
  }
1685
1551
  /**
1686
1552
  * Emit an event
1687
- * @param {string} event
1688
- * @param {any} value
1689
- * @returns {DropList}
1690
1553
  */
1691
1554
  emit(event, value) {
1692
1555
  this._p.mitt.emit(event, value);
@@ -1721,8 +1584,6 @@ var DropList = class DropList {
1721
1584
  return this;
1722
1585
  }
1723
1586
  /**
1724
- * @param {string} event
1725
- * @param {*} [data]
1726
1587
  * @private
1727
1588
  * @internal
1728
1589
  */
@@ -1865,9 +1726,7 @@ var DropList = class DropList {
1865
1726
  case keycode_js.VALUE_UP:
1866
1727
  this.previous(event);
1867
1728
  break;
1868
- case keycode_js.VALUE_DOWN:
1869
- this.next(event);
1870
- break;
1729
+ case keycode_js.VALUE_DOWN: this.next(event);
1871
1730
  }
1872
1731
  break;
1873
1732
  case keycode_js.VALUE_LEFT:
@@ -2140,7 +1999,6 @@ var DropList = class DropList {
2140
1999
  }
2141
2000
  /**
2142
2001
  * @private
2143
- * @returns {DropList} self
2144
2002
  * @internal
2145
2003
  */
2146
2004
  _measureItem() {
@@ -2186,8 +2044,7 @@ var DropList = class DropList {
2186
2044
  }
2187
2045
  /**
2188
2046
  * 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}
2047
+ * @param targetItemCount item count we are expecting. Defaults to current item count
2191
2048
  * @private
2192
2049
  * @internal
2193
2050
  */
@@ -2252,11 +2109,6 @@ var DropList = class DropList {
2252
2109
  var DestroyedSymbol = Symbol("destroyed");
2253
2110
  var RestMultiItemsSymbol = Symbol("rest_multi_items");
2254
2111
  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
2112
  var hasClass = function(el, className) {
2261
2113
  if (el instanceof Element) return el.classList.contains(className);
2262
2114
  return false;
@@ -2312,12 +2164,6 @@ var DefaultOptions$1 = {
2312
2164
  closeListWhenLoading: true,
2313
2165
  clearInputWhen: ["single_close", "multi_select_single"]
2314
2166
  };
2315
- /**
2316
- *
2317
- * @param {DropList.ItemBase[]} items
2318
- * @param {string} labelProp
2319
- * @returns {string}
2320
- */
2321
2167
  var defaultMultiPlaceholderFormatter = (items, labelProp) => {
2322
2168
  if (items.length === 0) return "";
2323
2169
  let title = items[0][labelProp] + "";
@@ -2341,9 +2187,6 @@ function restoreFocusState(state) {
2341
2187
  return true;
2342
2188
  }
2343
2189
  var SelectBox = class {
2344
- /**
2345
- * @param {SelectBox.Options} options
2346
- */
2347
2190
  constructor(options) {
2348
2191
  const o = { ...DefaultOptions$1 };
2349
2192
  for (let [key, value] of Object.entries(
@@ -2531,21 +2374,15 @@ var SelectBox = class {
2531
2374
  }
2532
2375
  /**
2533
2376
  * 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
2377
  */
2538
2378
  droplistElContains(other, considerSubmenus = true) {
2539
2379
  return this._p.dropList?.elContains(other, considerSubmenus);
2540
2380
  }
2541
2381
  /**
2542
2382
  * Enables the control
2543
- * @param {boolean=true} enabled Should the control be enabled?
2544
- * @returns {SelectBox}
2545
2383
  */
2546
- enable(enabled) {
2384
+ enable(enabled = true) {
2547
2385
  const p = this._p;
2548
- if (enabled === void 0) enabled = true;
2549
2386
  p.disabled = !enabled;
2550
2387
  p.el.setAttribute("aria-disabled", p.disabled.toString());
2551
2388
  p.input.disabled = !!p.disabled;
@@ -2556,50 +2393,38 @@ var SelectBox = class {
2556
2393
  }
2557
2394
  /**
2558
2395
  * Is the control enabled?
2559
- * @returns {boolean}
2560
2396
  */
2561
2397
  isEnabled() {
2562
2398
  return !this._p.disabled;
2563
2399
  }
2564
2400
  /**
2565
2401
  * Disables the control
2566
- * @param {boolean=true} disabled Should the control be disabled?
2567
- * @returns {SelectBox}
2568
2402
  */
2569
- disable(disabled) {
2570
- return this.enable(disabled === void 0 ? false : !disabled);
2403
+ disable(disabled = true) {
2404
+ return this.enable(!disabled);
2571
2405
  }
2572
2406
  /**
2573
2407
  * Is the control disabled?
2574
- * @returns {boolean}
2575
2408
  */
2576
2409
  isDisabled() {
2577
2410
  return this._p.disabled;
2578
2411
  }
2579
2412
  /**
2580
2413
  * Sets read only mode
2581
- * @param {boolean=true} readOnly Should the control be read only?
2582
- * @returns {SelectBox}
2583
2414
  */
2584
- setReadOnly(readOnly) {
2415
+ setReadOnly(readOnly = true) {
2585
2416
  const p = this._p;
2586
- if (readOnly === void 0) readOnly = true;
2587
2417
  p.readOnly = readOnly;
2588
2418
  p.el.setAttribute("aria-readOnly", p.readOnly.toString());
2589
2419
  p.input.readOnly = !(p.searchable || p.multi) || !!p.readOnly;
2590
2420
  return this;
2591
2421
  }
2592
2422
  /**
2593
- * Is the control enabled?
2594
- * @returns {boolean}
2423
+ * Is the control read only?
2595
2424
  */
2596
2425
  isReadOnly() {
2597
2426
  return this._p.readOnly;
2598
2427
  }
2599
- /**
2600
- * @param {string|string[]} classes
2601
- * @returns {SelectBox}
2602
- */
2603
2428
  setAdditionalClasses(classes) {
2604
2429
  const p = this._p;
2605
2430
  p.additionalClasses = classes;
@@ -2607,10 +2432,8 @@ var SelectBox = class {
2607
2432
  return this;
2608
2433
  }
2609
2434
  /**
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}
2435
+ * @param items the items to set (not values)
2436
+ * @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
2437
  */
2615
2438
  setItems(items, resetValues = true) {
2616
2439
  const p = this._p;
@@ -2646,16 +2469,9 @@ var SelectBox = class {
2646
2469
  }
2647
2470
  if (p.dropList) p.dropList.updateItemByValue(value, newItem);
2648
2471
  }
2649
- /**
2650
- * @returns {DropList.ItemBase[]|*}
2651
- */
2652
2472
  getItems() {
2653
2473
  return this._p.items;
2654
2474
  }
2655
- /**
2656
- * @param {boolean} clearable
2657
- * @returns {SelectBox}
2658
- */
2659
2475
  setClearable(clearable) {
2660
2476
  clearable = !!clearable;
2661
2477
  if (this._p.clearable === clearable) return this;
@@ -2663,16 +2479,9 @@ var SelectBox = class {
2663
2479
  this._scheduleSync("render_clear");
2664
2480
  return this;
2665
2481
  }
2666
- /**
2667
- * @returns {boolean}
2668
- */
2669
2482
  getClearable() {
2670
2483
  return this._p.clearable;
2671
2484
  }
2672
- /**
2673
- * @param {boolean} enabled
2674
- * @returns {SelectBox}
2675
- */
2676
2485
  setHasOpenIndicator(enabled) {
2677
2486
  enabled = !!enabled;
2678
2487
  if (this._p.hasOpenIndicator === enabled) return this;
@@ -2680,31 +2489,20 @@ var SelectBox = class {
2680
2489
  this._scheduleSync("render_base");
2681
2490
  return this;
2682
2491
  }
2683
- /**
2684
- * @returns {boolean}
2685
- */
2686
2492
  getHasOpenIndicator() {
2687
2493
  return this._p.hasOpenIndicator;
2688
2494
  }
2689
- /**
2690
- * @param {string} placeholder
2691
- * @returns {SelectBox}
2692
- */
2693
2495
  setPlaceholder(placeholder) {
2694
2496
  this._p.placeholder = placeholder == null ? "" : String(placeholder);
2695
2497
  this._scheduleSync("render_base");
2696
2498
  return this;
2697
2499
  }
2698
- /**
2699
- * @returns {string}
2700
- */
2701
2500
  getPlaceHolder() {
2702
2501
  return this._p.placeholder;
2703
2502
  }
2704
2503
  /**
2705
- * @param {string} term
2706
- * @param {boolean} [performSearch=false] should actually perform the search, or just set the input's text?
2707
- * @returns {SelectBox}
2504
+ * @param term the search term to set
2505
+ * @param performSearch should actually perform the search, or just set the input's text?
2708
2506
  */
2709
2507
  setSearchTerm(term, performSearch = false) {
2710
2508
  const p = this._p;
@@ -2718,9 +2516,6 @@ var SelectBox = class {
2718
2516
  }
2719
2517
  return this;
2720
2518
  }
2721
- /**
2722
- * @returns {string}
2723
- */
2724
2519
  getSearchTerm() {
2725
2520
  const p = this._p;
2726
2521
  if (p.input) return p.input.value;
@@ -2730,10 +2525,6 @@ var SelectBox = class {
2730
2525
  this._p.dropList?.invokeRefilter();
2731
2526
  return this;
2732
2527
  }
2733
- /**
2734
- * @param {boolean} sortSelectedItems
2735
- * @returns {SelectBox}
2736
- */
2737
2528
  setSortSelectedItems(sortSelectedItems) {
2738
2529
  const p = this._p;
2739
2530
  sortSelectedItems = !!sortSelectedItems;
@@ -2742,16 +2533,9 @@ var SelectBox = class {
2742
2533
  this._scheduleSync("render_items");
2743
2534
  return this;
2744
2535
  }
2745
- /**
2746
- * @returns {boolean}
2747
- */
2748
2536
  isSortSelectedItemsEnabled() {
2749
2537
  return this._p.sortSelectedItems;
2750
2538
  }
2751
- /**
2752
- * @param {boolean} sortListItems
2753
- * @returns {SelectBox}
2754
- */
2755
2539
  setSortListItems(sortListItems) {
2756
2540
  const p = this._p;
2757
2541
  sortListItems = !!sortListItems;
@@ -2761,16 +2545,9 @@ var SelectBox = class {
2761
2545
  this._scheduleSync("render_list");
2762
2546
  return this;
2763
2547
  }
2764
- /**
2765
- * @returns {boolean}
2766
- */
2767
2548
  isSortListItemsEnabled() {
2768
2549
  return this._p.sortListItems;
2769
2550
  }
2770
- /**
2771
- * @param {boolean} sortListCheckedFirst
2772
- * @returns {SelectBox}
2773
- */
2774
2551
  setSortListCheckedFirst(sortListCheckedFirst) {
2775
2552
  const p = this._p;
2776
2553
  sortListCheckedFirst = !!sortListCheckedFirst;
@@ -2780,16 +2557,9 @@ var SelectBox = class {
2780
2557
  this._scheduleSync("render_list");
2781
2558
  return this;
2782
2559
  }
2783
- /**
2784
- * @returns {boolean}
2785
- */
2786
2560
  isSortListCheckedFirstEnabled() {
2787
2561
  return this._p.sortListCheckedFirst;
2788
2562
  }
2789
- /**
2790
- * @param {*[]} values
2791
- * @returns {SelectBox}
2792
- */
2793
2563
  setStickyValues(values) {
2794
2564
  const p = this._p;
2795
2565
  p.stickyValues = Array.isArray(values) ? new Set(values) : null;
@@ -2797,16 +2567,9 @@ var SelectBox = class {
2797
2567
  this._scheduleSync("render_list");
2798
2568
  return this;
2799
2569
  }
2800
- /**
2801
- * @returns {*[]}
2802
- */
2803
2570
  getStickyValues() {
2804
2571
  return this._p.stickyValues ? Array.from(this._p.stickyValues) : null;
2805
2572
  }
2806
- /**
2807
- * @param {function(a: DropList.ItemBase, b: DropList.ItemBase):number} comparator
2808
- * @returns {SelectBox}
2809
- */
2810
2573
  setSortItemComparator(comparator) {
2811
2574
  const p = this._p;
2812
2575
  if (p.sortItemComparator === comparator) return this;
@@ -2815,16 +2578,9 @@ var SelectBox = class {
2815
2578
  this._scheduleSync("render_list");
2816
2579
  return this;
2817
2580
  }
2818
- /**
2819
- * @returns {function(a: DropList.ItemBase, b: DropList.ItemBase):number}
2820
- */
2821
2581
  getSortItemComparator() {
2822
2582
  return this._p.sortItemComparator;
2823
2583
  }
2824
- /**
2825
- * @param {boolean} treatGroupSelectionAsItems
2826
- * @returns {SelectBox}
2827
- */
2828
2584
  setTreatGroupSelectionAsItems(treatGroupSelectionAsItems) {
2829
2585
  const p = this._p;
2830
2586
  treatGroupSelectionAsItems = !!treatGroupSelectionAsItems;
@@ -2836,16 +2592,9 @@ var SelectBox = class {
2836
2592
  this._scheduleSync("render_list");
2837
2593
  return this;
2838
2594
  }
2839
- /**
2840
- * @returns {boolean}
2841
- */
2842
2595
  isTreatGroupSelectionAsItemsEnabled() {
2843
2596
  return !this._p.treatGroupSelectionAsItems;
2844
2597
  }
2845
- /**
2846
- * @param {boolean} splitListCheckedGroups
2847
- * @returns {SelectBox}
2848
- */
2849
2598
  setSplitListCheckedGroups(splitListCheckedGroups) {
2850
2599
  const p = this._p;
2851
2600
  splitListCheckedGroups = !!splitListCheckedGroups;
@@ -2855,16 +2604,9 @@ var SelectBox = class {
2855
2604
  this._scheduleSync("render_list");
2856
2605
  return this;
2857
2606
  }
2858
- /**
2859
- * @returns {boolean}
2860
- */
2861
2607
  isSplitListCheckedGroupsEnabled() {
2862
2608
  return this._p.splitListCheckedGroups;
2863
2609
  }
2864
- /**
2865
- * @param {boolean} showSelection
2866
- * @returns {SelectBox}
2867
- */
2868
2610
  setShowSelection(showSelection) {
2869
2611
  const p = this._p;
2870
2612
  showSelection = !!showSelection;
@@ -2873,16 +2615,9 @@ var SelectBox = class {
2873
2615
  this._scheduleSync("render_items");
2874
2616
  return this;
2875
2617
  }
2876
- /**
2877
- * @returns {boolean}
2878
- */
2879
2618
  isShowSelectionEnabled() {
2880
2619
  return this._p.showSelection;
2881
2620
  }
2882
- /**
2883
- * @param {boolean} showPlaceholderInTooltip
2884
- * @returns {SelectBox}
2885
- */
2886
2621
  setShowPlaceholderInTooltip(showPlaceholderInTooltip) {
2887
2622
  const p = this._p;
2888
2623
  showPlaceholderInTooltip = !!showPlaceholderInTooltip;
@@ -2891,16 +2626,9 @@ var SelectBox = class {
2891
2626
  this._scheduleSync("render_base");
2892
2627
  return this;
2893
2628
  }
2894
- /**
2895
- * @returns {boolean}
2896
- */
2897
2629
  isShowPlaceholderInTooltipEnabled() {
2898
2630
  return this._p.showPlaceholderInTooltip;
2899
2631
  }
2900
- /**
2901
- * @param {function(items: DropList.ItemBase[]):string} formatter
2902
- * @returns {SelectBox}
2903
- */
2904
2632
  setMultiPlaceholderFormatter(formatter) {
2905
2633
  const p = this._p;
2906
2634
  if (p.multiPlaceholderFormatter === formatter) return this;
@@ -2908,26 +2636,15 @@ var SelectBox = class {
2908
2636
  this._scheduleSync("render_base");
2909
2637
  return this;
2910
2638
  }
2911
- /**
2912
- * @param {boolean|'touch'} value
2913
- * @returns {SelectBox}
2914
- */
2915
2639
  setBlurOnSingleSelection(value) {
2916
2640
  const p = this._p;
2917
2641
  if (p.blurOnSingleSelection === value) return this;
2918
2642
  p.blurOnSingleSelection = value;
2919
2643
  return this;
2920
2644
  }
2921
- /**
2922
- * @returns {boolean|'touch'}
2923
- */
2924
2645
  getBlurOnSingleSelection() {
2925
2646
  return this._p.blurOnSingleSelection;
2926
2647
  }
2927
- /**
2928
- * @param {boolean} multi
2929
- * @returns {SelectBox}
2930
- */
2931
2648
  setMulti(multi) {
2932
2649
  const p = this._p;
2933
2650
  multi = !!multi;
@@ -2943,16 +2660,9 @@ var SelectBox = class {
2943
2660
  this._scheduleSync("full");
2944
2661
  return this;
2945
2662
  }
2946
- /**
2947
- * @returns {boolean}
2948
- */
2949
2663
  isMultiEnabled() {
2950
2664
  return this._p.multi;
2951
2665
  }
2952
- /**
2953
- * @param {boolean} searchable
2954
- * @returns {SelectBox}
2955
- */
2956
2666
  setSearchable(searchable) {
2957
2667
  const p = this._p;
2958
2668
  searchable = !!searchable;
@@ -2961,10 +2671,6 @@ var SelectBox = class {
2961
2671
  this._scheduleSync("full");
2962
2672
  return this;
2963
2673
  }
2964
- /**
2965
- * @param {boolean} allowTypeToSelect
2966
- * @returns {SelectBox}
2967
- */
2968
2674
  setAllowTypeToSelect(allowTypeToSelect) {
2969
2675
  const p = this._p;
2970
2676
  allowTypeToSelect = !!allowTypeToSelect;
@@ -2972,129 +2678,71 @@ var SelectBox = class {
2972
2678
  p.allowTypeToSelect = allowTypeToSelect;
2973
2679
  return this;
2974
2680
  }
2975
- /**
2976
- * @returns {boolean}
2977
- */
2978
2681
  isSearchableEnabled() {
2979
2682
  return this._p.searchable;
2980
2683
  }
2981
- /**
2982
- * @param {string} noResultsText
2983
- * @returns {SelectBox}
2984
- */
2985
2684
  setNoResultsText(noResultsText) {
2986
2685
  this._p.dropList?.setNoResultsText(noResultsText);
2987
2686
  return this;
2988
2687
  }
2989
- /**
2990
- * @returns {string}
2991
- */
2992
2688
  getNoResultsText() {
2993
2689
  return this._p.noResultsText;
2994
2690
  }
2995
- /**
2996
- * @param {boolean} autoSelectTextOnCheck
2997
- * @returns {SelectBox}
2998
- */
2999
2691
  setAutoSelectTextOnCheck(autoSelectTextOnCheck) {
3000
2692
  this._p.autoSelectTextOnCheck = autoSelectTextOnCheck;
3001
2693
  return this;
3002
2694
  }
3003
- /**
3004
- * @returns {boolean}
3005
- */
3006
2695
  getAutoSelectTextOnCheck() {
3007
2696
  return this._p.autoSelectTextOnCheck;
3008
2697
  }
3009
- /**
3010
- * @param {number} window
3011
- * @returns {SelectBox}
3012
- */
3013
2698
  setFilterThrottleWindow(window) {
3014
2699
  const p = this._p;
3015
2700
  p.filterThrottleWindow = window;
3016
2701
  p.dropList?.setFilterThrottleWindow(window);
3017
2702
  return this;
3018
2703
  }
3019
- /**
3020
- * @returns {number}
3021
- */
3022
2704
  getFilterThrottleWindow() {
3023
2705
  return this._p.filterThrottleWindow;
3024
2706
  }
3025
- /**
3026
- * @param {boolean} value
3027
- * @returns {SelectBox}
3028
- */
3029
2707
  setFilterOnEmptyTerm(value) {
3030
2708
  const p = this._p;
3031
2709
  if (p.filterOnEmptyTerm === value) return this;
3032
2710
  p.dropList?.setFilterOnEmptyTerm(value);
3033
2711
  return this;
3034
2712
  }
3035
- /**
3036
- * @returns {boolean}
3037
- */
3038
2713
  getFilterOnEmptyTerm() {
3039
2714
  return this._p.filterOnEmptyTerm;
3040
2715
  }
3041
- /**
3042
- * @param {DropList.Options} listOptions
3043
- * @returns {SelectBox}
3044
- */
3045
2716
  setListOptions(listOptions) {
3046
2717
  const p = this._p;
3047
2718
  p.listOptions = listOptions;
3048
2719
  this._setupDropdownMenu();
3049
2720
  return this;
3050
2721
  }
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
2722
  setRenderSingleItem(render, unrender) {
3057
2723
  const p = this._p;
3058
2724
  p.renderSingleItem = render;
3059
2725
  p.unrenderSingleItem = unrender;
3060
2726
  return this;
3061
2727
  }
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
2728
  setRenderMultiItem(render, unrender) {
3068
2729
  const p = this._p;
3069
2730
  p.renderMultiItem = render;
3070
2731
  p.unrenderMultiItem = unrender;
3071
2732
  return this;
3072
2733
  }
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
2734
  setRenderRestMultiItem(render, unrender) {
3079
2735
  const p = this._p;
3080
2736
  p.renderRestMultiItem = render;
3081
2737
  p.unrenderRestMultiItem = unrender;
3082
2738
  return this;
3083
2739
  }
3084
- /**
3085
- * @param {string} prop
3086
- * @returns {SelectBox}
3087
- */
3088
2740
  setLabelProp(prop) {
3089
2741
  const p = this._p;
3090
2742
  p.labelProp = prop;
3091
2743
  if (p.dropList) p.dropList.setLabelProp(prop);
3092
2744
  return this;
3093
2745
  }
3094
- /**
3095
- * @param {string} prop
3096
- * @returns {SelectBox}
3097
- */
3098
2746
  setValueProp(prop) {
3099
2747
  const p = this._p;
3100
2748
  if (p.valueProp === prop) return this;
@@ -3103,50 +2751,31 @@ var SelectBox = class {
3103
2751
  this._refreshItemByValueMap();
3104
2752
  return this;
3105
2753
  }
3106
- /**
3107
- * @param {string} prop
3108
- * @returns {SelectBox}
3109
- */
3110
2754
  setMultiItemLabelProp(prop) {
3111
2755
  const p = this._p;
3112
2756
  p.multiItemLabelProp = prop;
3113
2757
  this._scheduleSync("render_items");
3114
2758
  return this;
3115
2759
  }
3116
- /**
3117
- * @param {'before'|'after'|'none'} position
3118
- * @returns {SelectBox}
3119
- */
3120
2760
  setMultiItemRemovePosition(position) {
3121
2761
  const p = this._p;
3122
2762
  p.multiItemRemovePosition = position;
3123
2763
  this._scheduleSync("render_items");
3124
2764
  return this;
3125
2765
  }
3126
- /**
3127
- * @param {number|null|undefined} value
3128
- * @returns {SelectBox}
3129
- */
3130
2766
  setMaxMultiItems(value) {
3131
2767
  const p = this._p;
3132
2768
  p.maxMultiItems = value;
3133
2769
  return this;
3134
2770
  }
3135
- /**
3136
- * @param {function(count: number, items: DropList.ItemBase[]):string|null|undefined} value
3137
- * @returns {SelectBox}
3138
- */
3139
2771
  setMultiItemsRestLabelProvider(value) {
3140
2772
  const p = this._p;
3141
2773
  p.multiItemsRestLabelProvider = value;
3142
2774
  return this;
3143
2775
  }
3144
- /**
3145
- * @param {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)} fn
3146
- * @returns {SelectBox}
3147
- */
3148
2776
  setFilterFn(fn) {
3149
2777
  const p = this._p;
2778
+ fn ??= null;
3150
2779
  if (p.filterFn === fn) return this;
3151
2780
  p.filterFn = fn;
3152
2781
  if (!fn) fn = (items, term) => {
@@ -3161,9 +2790,6 @@ var SelectBox = class {
3161
2790
  p.dropList?.setFilterFn(fn);
3162
2791
  return this;
3163
2792
  }
3164
- /**
3165
- * @returns {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)}
3166
- */
3167
2793
  getFilterFn() {
3168
2794
  return this._p.filterFn;
3169
2795
  }
@@ -3171,8 +2797,6 @@ var SelectBox = class {
3171
2797
  * Sets a handler to intercept internal errors/warnings (e.g. from a throwing `renderMultiItem`/`unrenderSingleItem`)
3172
2798
  * instead of the default `console.error`/`console.warn`. Also used as the default `onError` for the internal
3173
2799
  * `DropList`, unless `listOptions.onError` is set explicitly.
3174
- * @param {SelectBox.LibraryErrorHandler|null} [fn]
3175
- * @returns {SelectBox}
3176
2800
  */
3177
2801
  setOnError(fn) {
3178
2802
  const p = this._p;
@@ -3181,14 +2805,13 @@ var SelectBox = class {
3181
2805
  return this;
3182
2806
  }
3183
2807
  /**
3184
- * @returns {SelectBox.LibraryErrorHandler|undefined}
2808
+ * Gets the current `onError` handler, if any.
3185
2809
  */
3186
2810
  getOnError() {
3187
2811
  return this._p.onError;
3188
2812
  }
3189
2813
  /**
3190
2814
  * Focus on input element
3191
- * @returns {SelectBox}
3192
2815
  */
3193
2816
  focusInput() {
3194
2817
  const p = this._p;
@@ -3197,7 +2820,6 @@ var SelectBox = class {
3197
2820
  }
3198
2821
  /**
3199
2822
  * Remvoe focus from the input element
3200
- * @returns {SelectBox}
3201
2823
  */
3202
2824
  blurInput() {
3203
2825
  const p = this._p;
@@ -3206,7 +2828,6 @@ var SelectBox = class {
3206
2828
  }
3207
2829
  /**
3208
2830
  * Removes all selected items
3209
- * @returns {SelectBox}
3210
2831
  */
3211
2832
  clear() {
3212
2833
  if (!this._performClearWithEvent(true)) return this;
@@ -3215,8 +2836,6 @@ var SelectBox = class {
3215
2836
  }
3216
2837
  /**
3217
2838
  * Returns a single value or an array of selected values - depending on `multi` prop
3218
- * @public
3219
- * @returns {*[]}
3220
2839
  */
3221
2840
  getValue() {
3222
2841
  const p = this._p;
@@ -3225,9 +2844,7 @@ var SelectBox = class {
3225
2844
  }
3226
2845
  /**
3227
2846
  * 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}
2847
+ * @param value - if `multi`, then an array of values to select, otherwise - a single value to select
3231
2848
  */
3232
2849
  setValue(value) {
3233
2850
  if (this._p.multi) return this.setSelectedValues(Array.isArray(value) ? value : value !== void 0 ? [value] : []);
@@ -3235,17 +2852,12 @@ var SelectBox = class {
3235
2852
  }
3236
2853
  /**
3237
2854
  * Returns an array of selected values
3238
- * @public
3239
- * @returns {*[]}
3240
2855
  */
3241
2856
  getSelectedValues() {
3242
2857
  return this._p.selectedValues.slice(0);
3243
2858
  }
3244
2859
  /**
3245
2860
  * Selects the specified values
3246
- * @public
3247
- * @param {*[]} values - an array of *values* to select
3248
- * @returns {SelectBox}
3249
2861
  */
3250
2862
  setSelectedValues(values) {
3251
2863
  const p = this._p, valueProp = p.valueProp;
@@ -3270,16 +2882,12 @@ var SelectBox = class {
3270
2882
  }
3271
2883
  /**
3272
2884
  * Returns the count of selected values
3273
- * @public
3274
- * @returns {number}
3275
2885
  */
3276
2886
  getSelectedValueCount() {
3277
2887
  return this._p.selectedValues.length;
3278
2888
  }
3279
2889
  /**
3280
2890
  * Returns an array of selected items
3281
- * @public
3282
- * @returns {Array.<Object>}
3283
2891
  */
3284
2892
  getSelectedItems() {
3285
2893
  return this._p.selectedItems.slice(0);
@@ -3288,17 +2896,11 @@ var SelectBox = class {
3288
2896
  * Sets the specified items to "checked" mode.
3289
2897
  * An array of items is passed, not values, because we need to keep track if items,
3290
2898
  * 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
2899
  */
3295
2900
  setSelectedItems(items) {
3296
2901
  this._setSelectedItems(items);
3297
2902
  return this;
3298
2903
  }
3299
- /**
3300
- * @returns {SelectBox}
3301
- */
3302
2904
  openList() {
3303
2905
  const p = this._p;
3304
2906
  if (p.dropList.isVisible()) return this;
@@ -3313,9 +2915,6 @@ var SelectBox = class {
3313
2915
  else if (!p.multi && this.getValue() !== void 0) p.dropList.setFocusedItemByValue(this.getValue());
3314
2916
  return this;
3315
2917
  }
3316
- /**
3317
- * @returns {SelectBox}
3318
- */
3319
2918
  closeList() {
3320
2919
  const p = this._p;
3321
2920
  if (this[DestroyedSymbol]) return this;
@@ -3327,32 +2926,17 @@ var SelectBox = class {
3327
2926
  }
3328
2927
  return this;
3329
2928
  }
3330
- /**
3331
- * @param {boolean} [open]
3332
- * @returns {SelectBox}
3333
- */
3334
2929
  toggleList(open) {
3335
2930
  const p = this._p;
3336
2931
  if (open === void 0 ? !p.dropList.isVisible() : !!open) return this.openList();
3337
2932
  else return this.closeList();
3338
2933
  }
3339
- /**
3340
- * @returns {boolean}
3341
- */
3342
2934
  isListOpen() {
3343
2935
  return !!this._p.dropListVisible;
3344
2936
  }
3345
- /**
3346
- * @param {boolean} [on]
3347
- * @returns {SelectBox}
3348
- */
3349
2937
  toggleLoading(on) {
3350
2938
  return this.setIsLoadingMode(on === void 0 ? !this.getIsLoadingMode() : !!on);
3351
2939
  }
3352
- /**
3353
- * @param {boolean} isLoadingMode
3354
- * @returns {SelectBox}
3355
- */
3356
2940
  setIsLoadingMode(isLoadingMode) {
3357
2941
  const p = this._p;
3358
2942
  isLoadingMode = isLoadingMode === void 0 ? true : !!isLoadingMode;
@@ -3363,31 +2947,21 @@ var SelectBox = class {
3363
2947
  this._scheduleSync("render_base");
3364
2948
  return this;
3365
2949
  }
3366
- /**
3367
- * @returns {boolean}
3368
- */
3369
2950
  getIsLoadingMode() {
3370
2951
  return this._p.isLoadingMode;
3371
2952
  }
3372
2953
  /**
3373
2954
  * Sets whether to close the list when loading mode is enabled
3374
- * @param {boolean} closeListWhenLoading
3375
- * @returns {SelectBox}
3376
2955
  */
3377
2956
  setCloseListWhenLoading(closeListWhenLoading) {
3378
2957
  this._p.closeListWhenLoading = closeListWhenLoading;
3379
2958
  return this;
3380
2959
  }
3381
- /**
3382
- * @returns {boolean}
3383
- */
3384
2960
  getCloseListWhenLoading() {
3385
2961
  return this._p.closeListWhenLoading;
3386
2962
  }
3387
2963
  /**
3388
2964
  * Sets when to clear the input field
3389
- * @param {string[]} clearInputWhen
3390
- * @returns {SelectBox}
3391
2965
  */
3392
2966
  setClearInputWhen(clearInputWhen) {
3393
2967
  this._p.clearInputWhen = Array.isArray(clearInputWhen) ? clearInputWhen.slice(0) : [];
@@ -3395,15 +2969,12 @@ var SelectBox = class {
3395
2969
  }
3396
2970
  /**
3397
2971
  * Retrieves the settings for when to clear the input field
3398
- * @returns {string[]}
3399
2972
  */
3400
2973
  getClearInputWhen() {
3401
2974
  return this._p.clearInputWhen;
3402
2975
  }
3403
2976
  /**
3404
2977
  * Sets the appropriate direction for the selectbox
3405
- * @param {'ltr'|'rtl'|'auto'} direction
3406
- * @return {SelectBox}
3407
2978
  */
3408
2979
  setDirection(direction) {
3409
2980
  const p = this._p;
@@ -3413,14 +2984,12 @@ var SelectBox = class {
3413
2984
  }
3414
2985
  /**
3415
2986
  * Gets the supplied direction for the selectbox
3416
- * @return {'ltr'|'rtl'|'auto'}
3417
2987
  */
3418
2988
  getDirection() {
3419
2989
  return this._p.direction;
3420
2990
  }
3421
2991
  /**
3422
2992
  * Can be called in case that the selectbox was attached to the dom late and has a weird size.
3423
- * @returns {SelectBox}
3424
2993
  */
3425
2994
  refreshSize() {
3426
2995
  this._resizeInput();
@@ -3428,9 +2997,6 @@ var SelectBox = class {
3428
2997
  }
3429
2998
  /**
3430
2999
  * Register an event handler
3431
- * @param {(string|'*')?} event
3432
- * @param {function(any)} handler
3433
- * @returns {SelectBox}
3434
3000
  */
3435
3001
  on(event, handler) {
3436
3002
  this._p.mitt.on(event, handler);
@@ -3438,9 +3004,6 @@ var SelectBox = class {
3438
3004
  }
3439
3005
  /**
3440
3006
  * Register a one time event handler
3441
- * @param {(string|'*')?} event
3442
- * @param {function(any)} handler
3443
- * @returns {SelectBox}
3444
3007
  */
3445
3008
  once(event, handler) {
3446
3009
  let wrapped = (value) => {
@@ -3452,9 +3015,6 @@ var SelectBox = class {
3452
3015
  }
3453
3016
  /**
3454
3017
  * 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
3018
  */
3459
3019
  off(event, handler) {
3460
3020
  if (!event && !event) this._p.mitt.all.clear();
@@ -3463,9 +3023,6 @@ var SelectBox = class {
3463
3023
  }
3464
3024
  /**
3465
3025
  * Emit an event
3466
- * @param {string} event
3467
- * @param {any} value
3468
- * @returns {SelectBox}
3469
3026
  */
3470
3027
  emit(event, value) {
3471
3028
  this._p.mitt.emit(event, value);
@@ -3485,8 +3042,6 @@ var SelectBox = class {
3485
3042
  p.subitemByValueMap = null;
3486
3043
  }
3487
3044
  /**
3488
- * @param {*} value
3489
- * @returns {DropList.ItemBase|undefined}
3490
3045
  * @private
3491
3046
  * @internal
3492
3047
  */
@@ -3505,9 +3060,6 @@ var SelectBox = class {
3505
3060
  this._addSubitemsToValueMap(p.items, subitemByValueMap, p.valueProp);
3506
3061
  }
3507
3062
  /**
3508
- * @param {DropList.ItemBase[]} items
3509
- * @param {Map<*, DropList.ItemBase>} itemByValueMap
3510
- * @param {string} valueProp
3511
3063
  * @private
3512
3064
  * @internal
3513
3065
  */
@@ -3786,9 +3338,7 @@ var SelectBox = class {
3786
3338
  case "search":
3787
3339
  this._trigger("search", event);
3788
3340
  break;
3789
- case "itemschanged":
3790
- this._trigger("itemschanged", event);
3791
- break;
3341
+ case "itemschanged": this._trigger("itemschanged", event);
3792
3342
  }
3793
3343
  }
3794
3344
  });
@@ -3856,9 +3406,7 @@ var SelectBox = class {
3856
3406
  case keycode_js.VALUE_HOME:
3857
3407
  dropList.goToFirst(evt);
3858
3408
  break;
3859
- case keycode_js.VALUE_END:
3860
- dropList.goToLast(evt);
3861
- break;
3409
+ case keycode_js.VALUE_END: dropList.goToLast(evt);
3862
3410
  }
3863
3411
  break;
3864
3412
  case keycode_js.VALUE_SPACE:
@@ -3888,17 +3436,15 @@ var SelectBox = class {
3888
3436
  evt.preventDefault();
3889
3437
  }
3890
3438
  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;
3439
+ default: if (dropList.isVisible()) dropList._keydownFreeType(evt, false);
3440
+ else if (p.allowTypeToSelect) dropList._keydownFreeType(evt, true);
3441
+ else {
3442
+ this.openList();
3443
+ setTimeout(() => {
3444
+ if (this[DestroyedSymbol]) return;
3445
+ dropList._keydownFreeType(evt, false);
3446
+ });
3447
+ }
3902
3448
  }
3903
3449
  if (!suppressEnterSpaceToggle) {
3904
3450
  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 +3664,7 @@ var SelectBox = class {
4118
3664
  if (!p.showSelection) this._syncPlaceholder();
4119
3665
  else if (p.multiItemEls[p.multiItemEls.length - 1]?.[ItemSymbol]?.[p.valueProp] === RestMultiItemsSymbol) this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);
4120
3666
  break;
4121
- case "resize_input":
4122
- this._resizeInput();
4123
- break;
3667
+ case "resize_input": this._resizeInput();
4124
3668
  }
4125
3669
  }
4126
3670
  /** @private */
@@ -4141,7 +3685,6 @@ var SelectBox = class {
4141
3685
  p.singleWrapper.innerHTML = "";
4142
3686
  }
4143
3687
  /**
4144
- * @param {number} index
4145
3688
  * @private
4146
3689
  * @internal
4147
3690
  */
@@ -4166,7 +3709,6 @@ var SelectBox = class {
4166
3709
  }
4167
3710
  }
4168
3711
  /**
4169
- * @param {DropList.ItemBase} item
4170
3712
  * @private
4171
3713
  * @internal
4172
3714
  */
@@ -4180,8 +3722,6 @@ var SelectBox = class {
4180
3722
  }
4181
3723
  }
4182
3724
  /**
4183
- * @param {DropList.ItemBase} item
4184
- * @param {Element} itemEl
4185
3725
  * @private
4186
3726
  * @internal
4187
3727
  */
@@ -4195,7 +3735,6 @@ var SelectBox = class {
4195
3735
  }
4196
3736
  }
4197
3737
  /**
4198
- * @param {DropList.ItemBase} item
4199
3738
  * @returns {boolean} true if rendered, false if not
4200
3739
  * @private
4201
3740
  * @internal
@@ -4269,9 +3808,6 @@ var SelectBox = class {
4269
3808
  }
4270
3809
  /**
4271
3810
  * 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
3811
  * @internal
4276
3812
  */
4277
3813
  _syncFull(fullItemsRender, updateListItems) {
@@ -4330,8 +3866,6 @@ var SelectBox = class {
4330
3866
  return this;
4331
3867
  }
4332
3868
  /**
4333
- * @param {string} event
4334
- * @param {*} [data]
4335
3869
  * @private
4336
3870
  * @internal
4337
3871
  */
@@ -4343,8 +3877,6 @@ var SelectBox = class {
4343
3877
  }
4344
3878
  /**
4345
3879
  * Render a multi item
4346
- * @param {Object} item
4347
- * @returns {Element|null}
4348
3880
  * @private
4349
3881
  * @internal
4350
3882
  */
@@ -4370,9 +3902,6 @@ var SelectBox = class {
4370
3902
  }
4371
3903
  /**
4372
3904
  * Removes a specific multi item by user event
4373
- * @param {Element} itemEl
4374
- * @param {Event} originatingEvent
4375
- * @returns {SelectBox}
4376
3905
  * @private
4377
3906
  * @internal
4378
3907
  */
@@ -4432,8 +3961,6 @@ var SelectBox = class {
4432
3961
  return this;
4433
3962
  }
4434
3963
  /**
4435
- * @param {DropList.ItemBase} item
4436
- * @param {boolean} [populate]
4437
3964
  * @private
4438
3965
  * @internal
4439
3966
  */
@@ -4460,7 +3987,6 @@ var SelectBox = class {
4460
3987
  this._scheduleSync("render_list");
4461
3988
  }
4462
3989
  /**
4463
- * @param {*} value
4464
3990
  * @private
4465
3991
  * @internal
4466
3992
  */
@@ -4473,7 +3999,6 @@ var SelectBox = class {
4473
3999
  }
4474
4000
  /**
4475
4001
  * Update input size to current state
4476
- * @returns {SelectBox}
4477
4002
  * @private
4478
4003
  * @internal
4479
4004
  */
@@ -4531,7 +4056,6 @@ var SelectBox = class {
4531
4056
  }
4532
4057
  /**
4533
4058
  * Update autocomplete position if needed
4534
- * @returns {SelectBox}
4535
4059
  * @private
4536
4060
  * @internal
4537
4061
  */
@@ -4547,7 +4071,6 @@ var SelectBox = class {
4547
4071
  return this;
4548
4072
  }
4549
4073
  /**
4550
- * @param {KeyboardEvent} event
4551
4074
  * @private
4552
4075
  * @internal
4553
4076
  */
@@ -4578,7 +4101,6 @@ var SelectBox = class {
4578
4101
  }
4579
4102
  }
4580
4103
  /**
4581
- * @param {KeyboardEvent} event
4582
4104
  * @private
4583
4105
  * @internal
4584
4106
  */
@@ -4624,13 +4146,12 @@ var SelectBox = class {
4624
4146
  }
4625
4147
  }
4626
4148
  /**
4627
- * @returns {DropList.PositionOptions}
4628
4149
  * @private
4629
4150
  * @internal
4630
4151
  */
4631
4152
  _getDropListPositionOptions() {
4632
4153
  return {
4633
- target: this._p.el,
4154
+ target: /**@type Element*/ this._p.el,
4634
4155
  offset: {
4635
4156
  x: 0,
4636
4157
  y: 0
@@ -4667,11 +4188,6 @@ var SelectBox = class {
4667
4188
  /**
4668
4189
  * Handles sorting, and putting checked items first (according to selectedValues, not item.checked)
4669
4190
  * @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
4191
  * @internal
4676
4192
  */
4677
4193
  _sortItems(items, sort, sortCheckedFirst, splitCheckedGroups) {