@danielgindi/selectbox 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.4
2
+ * @danielgindi/selectbox 2.0.6
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  (function (global, factory) {
@@ -1212,11 +1212,10 @@
1212
1212
  if (!Array.isArray(filteredItems)) {
1213
1213
  if (term) {
1214
1214
  const matcher = new RegExp(escapeRegex(term), 'i');
1215
- const labelProp = p.labelProp;
1216
1215
 
1217
1216
  filteredItems = p.items.filter((x) => {
1218
1217
  if (!filterGroups && x._group) return true;
1219
- return matcher.test(x[labelProp]);
1218
+ return matcher.test(x.label);
1220
1219
  });
1221
1220
  } else {
1222
1221
  filteredItems = null;
@@ -1490,6 +1489,8 @@
1490
1489
 
1491
1490
  // Calculate virtual viewport size
1492
1491
  if (p.virtualListHelper.isVirtual()) {
1492
+ // Avoid extremely high size which will cause laying out the whole list
1493
+ menuEl.style.height = Math.min(el.clientHeight, document.body.clientHeight) + 'px';
1493
1494
  p.virtualListHelper.render();
1494
1495
  }
1495
1496
 
@@ -3651,7 +3652,6 @@
3651
3652
  p.resizeObserver.observe(p.el);
3652
3653
  }
3653
3654
 
3654
- if (o.filterFn)
3655
3655
  this.setFilterFn(o.filterFn);
3656
3656
 
3657
3657
  this.setItems(o.items);
@@ -4445,6 +4445,10 @@
4445
4445
  const p = this._p;
4446
4446
  if (p.filterFn === fn)
4447
4447
  return this;
4448
+
4449
+ // Do not keep this reference, as far as the user is concerned - he/she did not set a custom filter.
4450
+ p.filterFn = fn;
4451
+
4448
4452
  if (!fn) {
4449
4453
  // Add search by multi-item label
4450
4454
  fn = (items, term) => {
@@ -4458,7 +4462,8 @@
4458
4462
  });
4459
4463
  };
4460
4464
  }
4461
- p.filterFn = fn;
4465
+
4466
+ p.actualFilterFn = fn;
4462
4467
  p.dropList?.setFilterFn(fn);
4463
4468
  return this;
4464
4469
  }
@@ -5062,8 +5067,8 @@
5062
5067
  filterThrottleWindow: p.filterThrottleWindow,
5063
5068
  filterOnEmptyTerm: p.filterOnEmptyTerm,
5064
5069
  filterGroups: p.treatGroupSelectionAsItems,
5065
- filterEmptyGroups: p.treatGroupSelectionAsItems,
5066
- filterFn: p.filterFn,
5070
+ filterEmptyGroups: !p.treatGroupSelectionAsItems,
5071
+ filterFn: p.actualFilterFn,
5067
5072
 
5068
5073
  positionOptionsProvider: () => this._getDropListPositionOptions(),
5069
5074