@danielgindi/selectbox 1.0.70 → 1.0.71

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/SelectBox.js CHANGED
@@ -662,6 +662,14 @@ class SelectBox {
662
662
  return '';
663
663
  }
664
664
 
665
+ invokeRefilter() {
666
+ const p = this._p;
667
+ if (!p.filterTerm && !p.filterOnEmptyTerm)
668
+ return this;
669
+ p.throttledUpdateListItems();
670
+ return this;
671
+ }
672
+
665
673
  /**
666
674
  * @param {boolean} sortSelectedItems
667
675
  * @returns {SelectBox}
@@ -1002,7 +1010,10 @@ class SelectBox {
1002
1010
  */
1003
1011
  setFilterOnEmptyTerm(value) {
1004
1012
  const p = this._p;
1013
+ if (p.filterOnEmptyTerm === value)
1014
+ return this;
1005
1015
  p.filterOnEmptyTerm = value;
1016
+ p.throttledUpdateListItems();
1006
1017
  return this;
1007
1018
  }
1008
1019
 
@@ -1142,7 +1153,10 @@ class SelectBox {
1142
1153
  */
1143
1154
  setFilterFn(fn) {
1144
1155
  const p = this._p;
1156
+ if (p.filterFn === fn)
1157
+ return this;
1145
1158
  p.filterFn = fn;
1159
+ p.throttledUpdateListItems();
1146
1160
  return this;
1147
1161
  }
1148
1162
 
@@ -1258,7 +1272,7 @@ class SelectBox {
1258
1272
  if (item !== undefined) {
1259
1273
  selectedItems.push(item);
1260
1274
  } else {
1261
- selectedItems.push({ [p.valueProp]: value });
1275
+ selectedItems.push({ [valueProp]: value });
1262
1276
  }
1263
1277
  }
1264
1278
 
@@ -1267,7 +1281,6 @@ class SelectBox {
1267
1281
  p.selectionChanged = true;
1268
1282
  p.resortBySelectionNeeded = true;
1269
1283
 
1270
- this._updateListItems();
1271
1284
  this._scheduleSync('full');
1272
1285
 
1273
1286
  return this;
@@ -2285,6 +2298,7 @@ class SelectBox {
2285
2298
  }
2286
2299
  }
2287
2300
 
2301
+ /** @private */
2288
2302
  _refilterItems() {
2289
2303
  const p = this._p;
2290
2304
 
@@ -2355,6 +2369,7 @@ class SelectBox {
2355
2369
  p.itemsChanged = true;
2356
2370
  }
2357
2371
 
2372
+ /** @private */
2358
2373
  _setSelectedItems(items) {
2359
2374
  const p = this._p, valueProp = p.valueProp;
2360
2375
 
@@ -2373,6 +2388,7 @@ class SelectBox {
2373
2388
  this._scheduleSync('full');
2374
2389
  }
2375
2390
 
2391
+ /** @private */
2376
2392
  _scheduleSync(mode, data) {
2377
2393
  const p = this._p;
2378
2394
 
@@ -2396,6 +2412,7 @@ class SelectBox {
2396
2412
  });
2397
2413
  }
2398
2414
 
2415
+ /** @private */
2399
2416
  _performSync(queue) {
2400
2417
  const p = this._p;
2401
2418
 
@@ -2470,6 +2487,7 @@ class SelectBox {
2470
2487
  }
2471
2488
  }
2472
2489
 
2490
+ /** @private */
2473
2491
  _cleanupSingleWrapper() {
2474
2492
  const p = this._p;
2475
2493
 
@@ -2767,7 +2785,10 @@ class SelectBox {
2767
2785
  }
2768
2786
 
2769
2787
  // Update input size
2770
- this._resizeInput()._updateListItems();
2788
+ this._resizeInput();
2789
+
2790
+ // Update list items
2791
+ this._updateListItems();
2771
2792
 
2772
2793
  return this;
2773
2794
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielgindi/selectbox",
3
- "version": "1.0.70",
3
+ "version": "1.0.71",
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",
package/vue/SelectBox.vue CHANGED
@@ -185,6 +185,10 @@
185
185
  type: Function,
186
186
  default: undefined,
187
187
  },
188
+ // eslint-disable-next-line vue/require-prop-types
189
+ filterDependencies: {
190
+ default: undefined,
191
+ },
188
192
  virtualMinItems: {
189
193
  type: Number,
190
194
  default: 10,
@@ -607,6 +611,11 @@
607
611
  if (this._box)
608
612
  this._box.setTreatGroupSelectionAsItems(!!this.treatGroupSelectionAsItems);
609
613
  },
614
+
615
+ filterDependencies() {
616
+ if (this._box)
617
+ this._box.invokeRefilter();
618
+ },
610
619
  },
611
620
 
612
621
  mounted() {