@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.cjs.js +12 -7
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +13 -8
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +12 -7
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/lib/DropList.js +3 -2
- package/lib/SelectBox.js +9 -5
- package/package.json +63 -63
package/dist/lib.es6.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 2.0.
|
|
2
|
+
* @danielgindi/selectbox 2.0.6
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
import { createElement, closestUntil, setElementAttrs, next, prev } from '@danielgindi/dom-utils/lib/Dom';
|
|
@@ -1214,11 +1214,10 @@ class DropList {
|
|
|
1214
1214
|
if (!Array.isArray(filteredItems)) {
|
|
1215
1215
|
if (term) {
|
|
1216
1216
|
const matcher = new RegExp(escapeRegex(term), 'i');
|
|
1217
|
-
const labelProp = p.labelProp;
|
|
1218
1217
|
|
|
1219
1218
|
filteredItems = p.items.filter(x => {
|
|
1220
1219
|
if (!filterGroups && x._group) return true;
|
|
1221
|
-
return matcher.test(x
|
|
1220
|
+
return matcher.test(x.label);
|
|
1222
1221
|
});
|
|
1223
1222
|
} else {
|
|
1224
1223
|
filteredItems = null;
|
|
@@ -1492,6 +1491,8 @@ class DropList {
|
|
|
1492
1491
|
|
|
1493
1492
|
// Calculate virtual viewport size
|
|
1494
1493
|
if (p.virtualListHelper.isVirtual()) {
|
|
1494
|
+
// Avoid extremely high size which will cause laying out the whole list
|
|
1495
|
+
menuEl.style.height = Math.min(el.clientHeight, document.body.clientHeight) + 'px';
|
|
1495
1496
|
p.virtualListHelper.render();
|
|
1496
1497
|
}
|
|
1497
1498
|
|
|
@@ -3653,8 +3654,7 @@ class SelectBox {
|
|
|
3653
3654
|
p.resizeObserver.observe(p.el);
|
|
3654
3655
|
}
|
|
3655
3656
|
|
|
3656
|
-
|
|
3657
|
-
this.setFilterFn(o.filterFn);
|
|
3657
|
+
this.setFilterFn(o.filterFn);
|
|
3658
3658
|
|
|
3659
3659
|
this.setItems(o.items);
|
|
3660
3660
|
delete o.items; // we do not need this in memory anymore
|
|
@@ -4447,6 +4447,10 @@ class SelectBox {
|
|
|
4447
4447
|
const p = this._p;
|
|
4448
4448
|
if (p.filterFn === fn)
|
|
4449
4449
|
return this;
|
|
4450
|
+
|
|
4451
|
+
// Do not keep this reference, as far as the user is concerned - he/she did not set a custom filter.
|
|
4452
|
+
p.filterFn = fn;
|
|
4453
|
+
|
|
4450
4454
|
if (!fn) {
|
|
4451
4455
|
// Add search by multi-item label
|
|
4452
4456
|
fn = (items, term) => {
|
|
@@ -4460,7 +4464,8 @@ class SelectBox {
|
|
|
4460
4464
|
});
|
|
4461
4465
|
};
|
|
4462
4466
|
}
|
|
4463
|
-
|
|
4467
|
+
|
|
4468
|
+
p.actualFilterFn = fn;
|
|
4464
4469
|
p.dropList?.setFilterFn(fn);
|
|
4465
4470
|
return this;
|
|
4466
4471
|
}
|
|
@@ -5064,8 +5069,8 @@ class SelectBox {
|
|
|
5064
5069
|
filterThrottleWindow: p.filterThrottleWindow,
|
|
5065
5070
|
filterOnEmptyTerm: p.filterOnEmptyTerm,
|
|
5066
5071
|
filterGroups: p.treatGroupSelectionAsItems,
|
|
5067
|
-
filterEmptyGroups: p.treatGroupSelectionAsItems,
|
|
5068
|
-
filterFn: p.
|
|
5072
|
+
filterEmptyGroups: !p.treatGroupSelectionAsItems,
|
|
5073
|
+
filterFn: p.actualFilterFn,
|
|
5069
5074
|
|
|
5070
5075
|
positionOptionsProvider: () => this._getDropListPositionOptions(),
|
|
5071
5076
|
|