@avakhula/ui 0.0.289 → 0.0.291

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.289",
3
+ "version": "0.0.291",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
@@ -130,12 +130,13 @@ $checkbox-bg-indeterminate: $blue-800;
130
130
  }
131
131
  }
132
132
 
133
- &.checkbox-disabled {
134
- .checkbox-input {
135
- background-color: $checkbox-bg-filed-disabled;
136
- border-color: $checkbox-border-filed-disabled;
137
- }
138
- }
133
+ // &.checkbox-readonly,
134
+ // &.checkbox-disabled {
135
+ // .checkbox-input {
136
+ // background-color: $checkbox-bg-filed-disabled;
137
+ // border-color: $checkbox-border-filed-disabled;
138
+ // }
139
+ // }
139
140
  }
140
141
 
141
142
  &.ib-checkbox-indeterminate {
@@ -165,6 +166,7 @@ $checkbox-bg-indeterminate: $blue-800;
165
166
  }
166
167
  }
167
168
 
169
+ &.ib-checkbox-readonly,
168
170
  &.ib-checkbox-disabled {
169
171
  cursor: not-allowed;
170
172
 
@@ -198,10 +200,6 @@ $checkbox-bg-indeterminate: $blue-800;
198
200
  }
199
201
  }
200
202
 
201
- .ib-checkbox-label {
202
- color: $checkbox-text-color-disabled;
203
- }
204
-
205
203
  &.ib-checkbox-filled,
206
204
  &.ib-checkbox-indeterminate{
207
205
  .ib-checkbox-input {
@@ -220,6 +218,12 @@ $checkbox-bg-indeterminate: $blue-800;
220
218
  }
221
219
  }
222
220
  }
221
+
222
+ &.ib-checkbox-disabled {
223
+ .ib-checkbox-label {
224
+ color: $checkbox-text-color-disabled;
225
+ }
226
+ }
223
227
  }
224
228
 
225
229
  &.ib-has-error {
@@ -15,7 +15,7 @@
15
15
  :checked="checked"
16
16
  :disabled="disabled"
17
17
  :required="required"
18
- @click="onChange"
18
+ @click.prevent="onChange"
19
19
  />
20
20
  <div class="ib-checkbox-body">
21
21
  <span
@@ -80,6 +80,10 @@ export default {
80
80
  type: Boolean,
81
81
  default: false,
82
82
  },
83
+ readonly: {
84
+ type: Boolean,
85
+ default: false,
86
+ },
83
87
  disabled: {
84
88
  type: Boolean,
85
89
  default: false,
@@ -112,6 +116,8 @@ export default {
112
116
  },
113
117
  methods: {
114
118
  onChange() {
119
+ if (this.readonly) return;
120
+
115
121
  this.checked = !this.checked;
116
122
  this.$emit("update:modelValue", this.checked);
117
123
  this.$emit("input", this.checked);
@@ -124,6 +130,7 @@ export default {
124
130
  "ib-has-error": this.error,
125
131
  "ib-checkbox-filled": this.checked,
126
132
  "ib-checkbox-disabled": this.disabled,
133
+ "ib-checkbox-readonly": this.readonly,
127
134
  "ib-checkbox-indeterminate": this.indeterminate,
128
135
  };
129
136
  },
@@ -49,6 +49,7 @@
49
49
  :id="'input' + id"
50
50
  :is-checked="isChecked(option)"
51
51
  :disabled="option.isDisabled"
52
+ :readonly="option.readonly"
52
53
  autocomplete="off"
53
54
  autocorrect="off"
54
55
  autocapitalize="off"
@@ -21,6 +21,7 @@ const testData = [
21
21
  initiallyVisible: true,
22
22
  visible: true,
23
23
  isDisabled: false,
24
+ readonly: true,
24
25
  isChildrenVisible: true,
25
26
  },
26
27
  {
@@ -459,7 +459,7 @@ export default {
459
459
  }
460
460
  },
461
461
  options(newOptions) {
462
- // this.initialOptions = copy(newOptions);
462
+ this.initialOptions = copy(newOptions);
463
463
  },
464
464
  initialOptions(newOptions) {
465
465
  let isOptionsEqual = true;
@@ -830,7 +830,7 @@ export default {
830
830
  this.$refs.dropdown.close();
831
831
  },
832
832
  checkIfOptionsChecked(options) {
833
- return options.every((option) => option.checked);
833
+ return options.every((option) => option.checked || option.readonly);
834
834
  },
835
835
  registerCheck(option, isChecked, isDirectChild) {
836
836
  if (isChecked) {
@@ -880,6 +880,7 @@ export default {
880
880
  manageAll() {
881
881
  this.allOptionsIsChecked = !this.allOptionsIsChecked;
882
882
  this.traverseTree(this.actualOptions, (option) => {
883
+ if (option.readonly) return;
883
884
  this.registerCheck(option, this.allOptionsIsChecked, false);
884
885
  });
885
886
  },