@danielgindi/selectbox 2.0.8 → 2.0.10

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
@@ -1169,7 +1169,10 @@ class DropList {
1169
1169
  p.items.map(x => {
1170
1170
  const y = x[ItemSymbol];
1171
1171
  if (y !== undefined) {
1172
- y[ItemSymbol] = x;
1172
+ // Seal it to avoid object finding issues when wrapped in proxies by Vue or other libs
1173
+ y[ItemSymbol] = Object.seal({
1174
+ [ItemSymbol]: x,
1175
+ });
1173
1176
  return y;
1174
1177
  }
1175
1178
 
@@ -1180,7 +1183,7 @@ class DropList {
1180
1183
  if (Array.isArray(filteredItems)) {
1181
1184
  // And back
1182
1185
  filteredItems = filteredItems.map(oitem => {
1183
- let our = oitem[ItemSymbol];
1186
+ let our = oitem[ItemSymbol]?.[ItemSymbol]; // double-unwrap sealed->item
1184
1187
  if (!our) {
1185
1188
  our = {
1186
1189
  [ItemSymbol]: oitem,
@@ -1734,15 +1737,19 @@ class DropList {
1734
1737
  let item = p.items[i];
1735
1738
  let checked = !item._nocheck && values.indexOf(item.value) !== -1;
1736
1739
 
1737
- if (item._group) {
1738
- groupIndexes.push(i);
1740
+ let itemIndex = p.filteredItems ? p.filteredItems.indexOf(item) : i;
1741
+
1742
+ if (item._group && itemIndex !== -1) {
1743
+ groupIndexes.push(itemIndex);
1739
1744
  }
1740
1745
 
1741
1746
  if (item._checked === checked) continue;
1742
1747
 
1743
1748
  item._checked = checked;
1744
1749
 
1745
- let li = p.virtualListHelper.getItemElementAt(i);
1750
+ if (itemIndex === -1) continue;
1751
+
1752
+ let li = p.virtualListHelper.getItemElementAt(itemIndex);
1746
1753
  if (!li) continue;
1747
1754
 
1748
1755
  toggleClass(li, `${p.baseClassName}__item_checked`, item._checked);
@@ -2043,7 +2050,7 @@ class DropList {
2043
2050
  this.rushRefilter();
2044
2051
 
2045
2052
  if (p.filteredItems) {
2046
- const item = p.items[itemIndex];
2053
+ const item = p.filteredItems[itemIndex];
2047
2054
  itemIndex = p.items.indexOf(item);
2048
2055
  }
2049
2056
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielgindi/selectbox",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
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",