@avakhula/ui 0.0.192 → 0.0.194

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.0.192",
3
+ "version": "0.0.194",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
@@ -250,6 +250,9 @@ export default {
250
250
  value(newVal) {
251
251
  this.actualValue = newVal;
252
252
  },
253
+ modelValue(newVal) {
254
+ this.actualValue = newVal;
255
+ },
253
256
  disabled(newVal) {
254
257
  this.$globalEvents.$emit(`label:disabled:${this.id}`, newVal);
255
258
  },
@@ -93,7 +93,7 @@
93
93
  :is-multiple="isMultiple"
94
94
  :is-bookmarkable="true"
95
95
  :is-bookmarked="true"
96
- @check="registerCheck"
96
+ @check="onCheck"
97
97
  @toggle-bookmark="toggleBookmark"
98
98
  :uid="uid"
99
99
  :only-end-nodes="onlyEndNodes"
@@ -151,7 +151,7 @@
151
151
  :name="actualName"
152
152
  :parent-auto-check="parentAutoCheck"
153
153
  :is-multiple="isMultiple"
154
- @check="registerCheck"
154
+ @check="onCheck"
155
155
  @toggle-bookmark="toggleBookmark"
156
156
  :uid="uid"
157
157
  :only-end-nodes="onlyEndNodes"
@@ -214,7 +214,7 @@
214
214
  :parent-auto-check="parentAutoCheck"
215
215
  :is-multiple="isMultiple"
216
216
  :is-bookmarkable="isBookmarkable"
217
- @check="registerCheck"
217
+ @check="onCheck"
218
218
  @toggle-bookmark="toggleBookmark"
219
219
  :uid="uid"
220
220
  :only-end-nodes="onlyEndNodes"
@@ -765,6 +765,18 @@ export default {
765
765
  checkIfOptionsChecked(options) {
766
766
  return options.every((option) => option.checked);
767
767
  },
768
+ onCheck(option, isChecked, isDirectChild) {
769
+ this.registerCheck(option, isChecked, isDirectChild);
770
+ const values = Object.keys(this.selected);
771
+
772
+ if (this.isMultiple) {
773
+ this.$emit("update:modelValue", values);
774
+ this.$emit("input", values);
775
+ } else {
776
+ this.$emit("update:modelValue", values[0]);
777
+ this.$emit("input", values[0]);
778
+ }
779
+ },
768
780
  registerCheck(option, isChecked, isDirectChild) {
769
781
  if (isChecked) {
770
782
  option.checked = true;
@@ -773,8 +785,6 @@ export default {
773
785
  !(this.onlyEndNodes && option.children && option.children.length)
774
786
  ) {
775
787
  this.selected[option.id] = option;
776
- this.$emit("update:modelValue", Object.keys(this.selected));
777
- this.$emit("input", Object.keys(this.selected));
778
788
  }
779
789
  } else {
780
790
  const selectedOptionKey = Object.keys(this.selected)[0];
@@ -789,8 +799,6 @@ export default {
789
799
  } else {
790
800
  delete this.selected[option.id];
791
801
  option.checked = false;
792
- this.$emit("update:modelValue", Object.keys(this.selected));
793
- this.$emit("input", Object.keys(this.selected));
794
802
  }
795
803
 
796
804
  this.toggleDuplicateOptions(this.actualOptions, option.id, isChecked);
@@ -815,6 +823,9 @@ export default {
815
823
  this.traverseTree(this.actualOptions, (option) => {
816
824
  this.registerCheck(option, this.allOptionsIsChecked, false);
817
825
  });
826
+
827
+ this.$emit("update:modelValue", Object.keys(this.selected));
828
+ this.$emit("input", Object.keys(this.selected));
818
829
  },
819
830
  traverseTree(tree, callback) {
820
831
  tree.forEach((option) => {