goodteditor-ui 1.0.93 → 1.0.94

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": "goodteditor-ui",
3
- "version": "1.0.93",
3
+ "version": "1.0.94",
4
4
  "main": "index.js",
5
5
  "homepage": "https://goodt-ui.netlify.app/",
6
6
  "scripts": {
@@ -4,8 +4,7 @@
4
4
  :class="cssClass"
5
5
  @focus="onRootFocus"
6
6
  tabindex="0"
7
- :data-popover="popoverTargetId"
8
- >
7
+ :data-popover="popoverTargetId">
9
8
  <div class="ui-input-color-picker-wrapper d-flex flex-v-center w-100">
10
9
  <div style="flex: 1 0 0">
11
10
  <!--
@@ -22,8 +21,7 @@
22
21
  type="text"
23
22
  :value="value"
24
23
  v-bind="inputBinds"
25
- v-on="inputEvents"
26
- />
24
+ v-on="inputEvents" />
27
25
  </slot>
28
26
  </div>
29
27
  <!--
@@ -34,10 +32,9 @@
34
32
  <slot name="icon" v-bind="{ value, toggle: togglePopover }">
35
33
  <div
36
34
  class="ui-input-color-picker-icon-preview mar-left-2"
37
- :class="[ readonly ? 'events-none': 'cursor-pointer' ]"
35
+ :class="[readonly ? 'events-none' : 'cursor-pointer']"
38
36
  :style="{ ...(isValid && { background: value }) }"
39
- @click="togglePopover"
40
- ></div>
37
+ @click="togglePopover"></div>
41
38
  </slot>
42
39
  </div>
43
40
  <ui-popover v-if="popoverShow" :show.sync="popoverShow" v-bind="popoverOptions">
@@ -46,12 +43,11 @@
46
43
  v-bind="{
47
44
  value,
48
45
  colorsDefault,
49
- showSubmit: true,
46
+ showSubmit: true
50
47
  }"
51
48
  @close="onColorPickerClose"
52
49
  @submit="onColorPickerSubmit"
53
- @valid="emitValid"
54
- ></color-picker>
50
+ @valid="emitValid"></color-picker>
55
51
  </ui-popover>
56
52
  </div>
57
53
  </template>
@@ -124,7 +120,6 @@ export default {
124
120
  },
125
121
  data() {
126
122
  return {
127
- isValid: false,
128
123
  inputBinds: {
129
124
  placeholder: this.placeholder,
130
125
  readonly: this.readonly || !this.editable,
@@ -139,8 +134,21 @@ export default {
139
134
  }
140
135
  };
141
136
  },
142
- created() {
143
- this.validateInput(this.value);
137
+ computed: {
138
+ /**
139
+ * @return {boolean}
140
+ */
141
+ isValid() {
142
+ return this.value === '' ? true : isValidColorString(this.value);
143
+ }
144
+ },
145
+ watch: {
146
+ isValid: {
147
+ handler() {
148
+ this.emitValid(this.isValid);
149
+ },
150
+ immediate: true
151
+ }
144
152
  },
145
153
  methods: {
146
154
  inputColor(val) {
@@ -160,11 +168,6 @@ export default {
160
168
  emitValid(isValid) {
161
169
  this.$emit('valid', isValid);
162
170
  },
163
- validateInput(value) {
164
- const isValid = value === '' ? true : isValidColorString(value);
165
- this.isValid = isValid;
166
- this.emitValid(isValid);
167
- },
168
171
  // EVENT HANDLERS
169
172
  onRootFocus(e) {
170
173
  if (this.disabled) {
@@ -175,13 +178,11 @@ export default {
175
178
  },
176
179
  onInputChange(e) {
177
180
  const { value } = e.target;
178
- this.validateInput(value);
179
181
  this.changeColor(value);
180
182
  },
181
183
  onInputInput(e) {
182
184
  const { value } = e.target;
183
- this.validateInput(value);
184
- this.inputColor(e.target.value);
185
+ this.inputColor(value);
185
186
  },
186
187
  onInputFocus(e) {
187
188
  if (this.disabled) {