@danielgindi/selectbox 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.es6.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.5
2
+ * @danielgindi/selectbox 2.0.7
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  import { createElement, closestUntil, setElementAttrs, next, prev } from '@danielgindi/dom-utils/lib/Dom';
@@ -1186,7 +1186,15 @@ class DropList {
1186
1186
  if (typeof fn === 'function') {
1187
1187
  // Send the original items to the filter function
1188
1188
  filteredItems = p.filterFn(
1189
- p.items.map(x => x[ItemSymbol] ?? x),
1189
+ p.items.map(x => {
1190
+ const y = x[ItemSymbol];
1191
+ if (y !== undefined) {
1192
+ y[ItemSymbol] = x;
1193
+ return y;
1194
+ }
1195
+
1196
+ return x;
1197
+ }),
1190
1198
  term);
1191
1199
 
1192
1200
  if (Array.isArray(filteredItems)) {
@@ -4464,6 +4472,8 @@ class SelectBox {
4464
4472
  });
4465
4473
  };
4466
4474
  }
4475
+
4476
+ p.actualFilterFn = fn;
4467
4477
  p.dropList?.setFilterFn(fn);
4468
4478
  return this;
4469
4479
  }
@@ -5067,8 +5077,8 @@ class SelectBox {
5067
5077
  filterThrottleWindow: p.filterThrottleWindow,
5068
5078
  filterOnEmptyTerm: p.filterOnEmptyTerm,
5069
5079
  filterGroups: p.treatGroupSelectionAsItems,
5070
- filterEmptyGroups: p.treatGroupSelectionAsItems,
5071
- filterFn: p.filterFn,
5080
+ filterEmptyGroups: !p.treatGroupSelectionAsItems,
5081
+ filterFn: p.actualFilterFn,
5072
5082
 
5073
5083
  positionOptionsProvider: () => this._getDropListPositionOptions(),
5074
5084