@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/dist/lib.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.8
2
+ * @danielgindi/selectbox 2.0.10
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  (function (global, factory) {
@@ -1195,7 +1195,10 @@
1195
1195
  p.items.map((x) => {
1196
1196
  const y = x[ItemSymbol];
1197
1197
  if (y !== undefined) {
1198
- y[ItemSymbol] = x;
1198
+ // Seal it to avoid object finding issues when wrapped in proxies by Vue or other libs
1199
+ y[ItemSymbol] = Object.seal({
1200
+ [ItemSymbol]: x
1201
+ });
1199
1202
  return y;
1200
1203
  }
1201
1204
 
@@ -1206,7 +1209,7 @@
1206
1209
  if (Array.isArray(filteredItems)) {
1207
1210
  // And back
1208
1211
  filteredItems = filteredItems.map((oitem) => {
1209
- let our = oitem[ItemSymbol];
1212
+ let our = oitem[ItemSymbol]?.[ItemSymbol]; // double-unwrap sealed->item
1210
1213
  if (!our) {
1211
1214
  our = {
1212
1215
  [ItemSymbol]: oitem,
@@ -1760,15 +1763,19 @@
1760
1763
  let item = p.items[i];
1761
1764
  let checked = !item._nocheck && values.indexOf(item.value) !== -1;
1762
1765
 
1763
- if (item._group) {
1764
- groupIndexes.push(i);
1766
+ let itemIndex = p.filteredItems ? p.filteredItems.indexOf(item) : i;
1767
+
1768
+ if (item._group && itemIndex !== -1) {
1769
+ groupIndexes.push(itemIndex);
1765
1770
  }
1766
1771
 
1767
1772
  if (item._checked === checked) continue;
1768
1773
 
1769
1774
  item._checked = checked;
1770
1775
 
1771
- let li = p.virtualListHelper.getItemElementAt(i);
1776
+ if (itemIndex === -1) continue;
1777
+
1778
+ let li = p.virtualListHelper.getItemElementAt(itemIndex);
1772
1779
  if (!li) continue;
1773
1780
 
1774
1781
  DomCompat.toggleClass(li, `${p.baseClassName}__item_checked`, item._checked);
@@ -2069,7 +2076,7 @@
2069
2076
  this.rushRefilter();
2070
2077
 
2071
2078
  if (p.filteredItems) {
2072
- const item = p.items[itemIndex];
2079
+ const item = p.filteredItems[itemIndex];
2073
2080
  itemIndex = p.items.indexOf(item);
2074
2081
  }
2075
2082