@avakhula/ui 0.1.23 → 0.1.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakhula/ui",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "private": false,
@@ -524,10 +524,7 @@ export default {
524
524
  ) {
525
525
  this.setPreparedValues(this.actualOptions).then(() => {
526
526
  const values = Object.keys(this.selected);
527
- this.$globalEvents.$emit("select-" + this.filterId + ":update", {
528
- values,
529
- filter: this.filterId,
530
- });
527
+ this.broadcastUpdate(values);
531
528
  });
532
529
  }
533
530
  },
@@ -557,11 +554,8 @@ export default {
557
554
 
558
555
  if ((this.isInitialized && !isOptionsEqual) || this.isWatching) {
559
556
  this.setPreparedValues().then(() => {
560
- const values = Object.keys(this.selected);
561
- this.$globalEvents.$emit("select-" + this.filterId + ":update", {
562
- values,
563
- filter: this.filterId,
564
- });
557
+ const values = Object.keys(this.selected);
558
+ this.broadcastUpdate(values);
565
559
  });
566
560
  }
567
561
  },
@@ -609,6 +603,10 @@ export default {
609
603
  this.virtualizer?.measure();
610
604
  }, 1000);
611
605
 
606
+ this.broadcastUpdate = debounce(function(values) {
607
+ this.$globalEvents.$emit("select-" + this.filterId + ":update", { values, filter: this.filterId });
608
+ }, 100);
609
+
612
610
  return {
613
611
  virtualizer: null,
614
612
  initialOptions: typeof this.options === "function" ? this.options : copy(this.options),
@@ -752,7 +750,7 @@ export default {
752
750
  if (this.dependency) {
753
751
  this.$globalEvents.$on("select-" + this.dependency + ":update", (dependencyValue) => {
754
752
  this.clear();
755
- this.dependencyValue = dependencyValue;
753
+ this.dependencyValue = dependencyValue;
756
754
 
757
755
  if (this.dependencyValue && this.dependencyValue.values && (!Array.isArray(this.dependencyValue.values) || this.dependencyValue.values.length)) {
758
756
  this.setPreparedValues();
@@ -827,6 +825,7 @@ export default {
827
825
  this.$emit("input", empty);
828
826
  this.$emit("clear-value", empty);
829
827
  this.$nextTick(() => (this.isInternalChange = false));
828
+ this.broadcastUpdate(empty);
830
829
  this.setPreparedValues();
831
830
  },
832
831
  prepare(options, checkInitialVisibility = true) {
@@ -963,7 +962,7 @@ export default {
963
962
  this.$emit("input", values[0]);
964
963
  }
965
964
  this.$nextTick(() => (this.isInternalChange = false));
966
- this.$globalEvents.$emit("select-" + this.filterId + ":update", { values, filter: this.filterId });
965
+ this.broadcastUpdate(values);
967
966
  if (!this.isMultiple) this.$refs.dropdown.close();
968
967
  },
969
968
  checkIfOptionsChecked(options) {
@@ -998,6 +997,7 @@ export default {
998
997
  this.$emit("update:modelValue", values);
999
998
  this.$emit("input", values);
1000
999
  this.$nextTick(() => (this.isInternalChange = false));
1000
+ this.broadcastUpdate(values);
1001
1001
  }
1002
1002
  },
1003
1003
  toggleDuplicateOptions(options, optionId, checked) {