@danielgindi/selectbox 2.0.8 → 2.0.9

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/lib/DropList.js CHANGED
@@ -1734,15 +1734,23 @@ class DropList {
1734
1734
  let item = p.items[i];
1735
1735
  let checked = !item._nocheck && values.indexOf(item.value) !== -1;
1736
1736
 
1737
- if (item._group) {
1738
- groupIndexes.push(i);
1737
+ let itemIndex = i;
1738
+ if (p.filteredItems) {
1739
+ const item = p.items[itemIndex];
1740
+ itemIndex = p.filteredItems.indexOf(item);
1741
+ }
1742
+
1743
+ if (item._group && itemIndex !== -1) {
1744
+ groupIndexes.push(itemIndex);
1739
1745
  }
1740
1746
 
1741
1747
  if (item._checked === checked) continue;
1742
1748
 
1743
1749
  item._checked = checked;
1744
1750
 
1745
- let li = p.virtualListHelper.getItemElementAt(i);
1751
+ if (itemIndex === -1) continue;
1752
+
1753
+ let li = p.virtualListHelper.getItemElementAt(itemIndex);
1746
1754
  if (!li) continue;
1747
1755
 
1748
1756
  toggleClass(li, `${p.baseClassName}__item_checked`, item._checked);
@@ -2043,7 +2051,7 @@ class DropList {
2043
2051
  this.rushRefilter();
2044
2052
 
2045
2053
  if (p.filteredItems) {
2046
- const item = p.items[itemIndex];
2054
+ const item = p.filteredItems[itemIndex];
2047
2055
  itemIndex = p.items.indexOf(item);
2048
2056
  }
2049
2057
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielgindi/selectbox",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "A collection of dom utilities. So you can work natively with the dom without dom frameworks.",
5
5
  "main": "dist/lib.cjs.min.js",
6
6
  "module": "lib/index.js",