@danielgindi/selectbox 2.0.2 → 2.0.4
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/css/droplist.css +1 -1
- package/css/droplist.css.map +1 -1
- package/dist/lib.cjs.js +26 -14
- 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 +26 -14
- 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 +26 -14
- 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 +24 -13
- package/lib/SelectBox.js +1 -0
- package/package.json +1 -1
- package/scss/droplist.scss +1 -0
package/lib/DropList.js
CHANGED
|
@@ -652,7 +652,8 @@ class DropList {
|
|
|
652
652
|
const p = this._p;
|
|
653
653
|
|
|
654
654
|
if (this.hasFocusedItem() && p.multi) {
|
|
655
|
-
|
|
655
|
+
const items = p.filteredItems ?? p.items;
|
|
656
|
+
let item = items[p.focusItemIndex];
|
|
656
657
|
if (item._nocheck || item._nointeraction) return this;
|
|
657
658
|
|
|
658
659
|
item._checked = !item._checked;
|
|
@@ -720,7 +721,7 @@ class DropList {
|
|
|
720
721
|
const p = this._p, labelProp = p.labelProp, valueProp = p.valueProp;
|
|
721
722
|
|
|
722
723
|
let isMulti = p.multi;
|
|
723
|
-
|
|
724
|
+
const items = p.items;
|
|
724
725
|
|
|
725
726
|
if (atIndex == null || atIndex < 0 || atIndex >= p.items.length) {
|
|
726
727
|
atIndex = -1;
|
|
@@ -1230,7 +1231,7 @@ class DropList {
|
|
|
1230
1231
|
p.filteredItems = null;
|
|
1231
1232
|
}
|
|
1232
1233
|
|
|
1233
|
-
|
|
1234
|
+
p.needsRefilter = false;
|
|
1234
1235
|
|
|
1235
1236
|
const items = p.filteredItems ?? p.items;
|
|
1236
1237
|
p.hasNoResultsItem = items.length === 0 && !!p.noResultsText;
|
|
@@ -1251,11 +1252,17 @@ class DropList {
|
|
|
1251
1252
|
return this;
|
|
1252
1253
|
}
|
|
1253
1254
|
|
|
1254
|
-
|
|
1255
|
+
rushRefilter() {
|
|
1255
1256
|
const p = this._p;
|
|
1256
|
-
|
|
1257
1257
|
if (p.needsRefilter)
|
|
1258
1258
|
this._refilterItems();
|
|
1259
|
+
return this;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
getFilteredItemCount() {
|
|
1263
|
+
const p = this._p;
|
|
1264
|
+
|
|
1265
|
+
this.rushRefilter();
|
|
1259
1266
|
|
|
1260
1267
|
if (p.filteredItems)
|
|
1261
1268
|
return p.filteredItems.length;
|
|
@@ -1701,6 +1708,8 @@ class DropList {
|
|
|
1701
1708
|
setCheckedValues(values) {
|
|
1702
1709
|
const p = this._p;
|
|
1703
1710
|
|
|
1711
|
+
this.rushRefilter();
|
|
1712
|
+
|
|
1704
1713
|
let groupIndexes = [];
|
|
1705
1714
|
|
|
1706
1715
|
for (let i = 0, count = p.items.length; i < count; i++) {
|
|
@@ -1764,7 +1773,7 @@ class DropList {
|
|
|
1764
1773
|
|
|
1765
1774
|
excludeGroups = excludeGroups && p.groupCount > 0;
|
|
1766
1775
|
|
|
1767
|
-
|
|
1776
|
+
const items = [];
|
|
1768
1777
|
|
|
1769
1778
|
for (let i = 0, count = p.items.length; i < count; i++) {
|
|
1770
1779
|
let item = p.items[i];
|
|
@@ -1805,9 +1814,7 @@ class DropList {
|
|
|
1805
1814
|
}
|
|
1806
1815
|
});
|
|
1807
1816
|
|
|
1808
|
-
|
|
1809
|
-
this._refilterItems();
|
|
1810
|
-
}
|
|
1817
|
+
this.rushRefilter();
|
|
1811
1818
|
|
|
1812
1819
|
const el = p.el;
|
|
1813
1820
|
el.style.position = 'absolute';
|
|
@@ -2015,6 +2022,8 @@ class DropList {
|
|
|
2015
2022
|
setFocusedItemAtIndex(itemIndex) {
|
|
2016
2023
|
const p = this._p;
|
|
2017
2024
|
|
|
2025
|
+
this.rushRefilter();
|
|
2026
|
+
|
|
2018
2027
|
if (p.filteredItems) {
|
|
2019
2028
|
const item = p.items[itemIndex];
|
|
2020
2029
|
itemIndex = p.items.indexOf(item);
|
|
@@ -2212,6 +2221,8 @@ class DropList {
|
|
|
2212
2221
|
setSingleSelectedItemAtIndex(itemIndex) {
|
|
2213
2222
|
const p = this._p;
|
|
2214
2223
|
|
|
2224
|
+
this.rushRefilter();
|
|
2225
|
+
|
|
2215
2226
|
let itemEl = null;
|
|
2216
2227
|
|
|
2217
2228
|
if (itemIndex > -1 && !p.items[itemIndex]._nointeraction) {
|
|
@@ -2971,7 +2982,7 @@ class DropList {
|
|
|
2971
2982
|
let affectedItems = 0;
|
|
2972
2983
|
|
|
2973
2984
|
if (p.autoCheckGroupChildren) {
|
|
2974
|
-
|
|
2985
|
+
const items = p.filteredItems ?? p.items;
|
|
2975
2986
|
let groupIndex = items.indexOf(item);
|
|
2976
2987
|
|
|
2977
2988
|
for (let i = groupIndex + 1, len = items.length; i < len; i++) {
|
|
@@ -3014,7 +3025,7 @@ class DropList {
|
|
|
3014
3025
|
affectedItems: affectedItems,
|
|
3015
3026
|
});
|
|
3016
3027
|
} else if (p.groupCount > 0 && p.autoCheckGroupChildren) {
|
|
3017
|
-
|
|
3028
|
+
const items = p.filteredItems ?? p.items;
|
|
3018
3029
|
let itemIndex = items.indexOf(item);
|
|
3019
3030
|
let groupIndex = -1;
|
|
3020
3031
|
|
|
@@ -3040,7 +3051,7 @@ class DropList {
|
|
|
3040
3051
|
if (!(p.multi && p.autoCheckGroupChildren && groupIndex > -1))
|
|
3041
3052
|
return this;
|
|
3042
3053
|
|
|
3043
|
-
|
|
3054
|
+
const items = p.filteredItems ?? p.items;
|
|
3044
3055
|
let groupItem = items[groupIndex];
|
|
3045
3056
|
|
|
3046
3057
|
if (!groupItem || !groupItem._group) return this;
|
|
@@ -3166,7 +3177,7 @@ class DropList {
|
|
|
3166
3177
|
_determineVirtualMode(targetItemCount) {
|
|
3167
3178
|
const p = this._p;
|
|
3168
3179
|
|
|
3169
|
-
|
|
3180
|
+
const items = p.filteredItems ?? p.items;
|
|
3170
3181
|
if (targetItemCount === undefined) {
|
|
3171
3182
|
targetItemCount = items.length;
|
|
3172
3183
|
}
|
package/lib/SelectBox.js
CHANGED
package/package.json
CHANGED