goodteditor-ui 1.0.26 → 1.0.28

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.
Files changed (116) hide show
  1. package/.eslintrc.js +7 -7
  2. package/.prettierrc +14 -14
  3. package/README.md +35 -35
  4. package/babel.config.js +5 -5
  5. package/index.js +53 -53
  6. package/jsconfig.json +13 -13
  7. package/package.json +67 -67
  8. package/src/App.vue +36 -36
  9. package/src/components/ui/Avatar.md +68 -68
  10. package/src/components/ui/Avatar.vue +180 -180
  11. package/src/components/ui/Badge.md +20 -20
  12. package/src/components/ui/Badge.vue +75 -75
  13. package/src/components/ui/Collapse.md +90 -90
  14. package/src/components/ui/Collapse.vue +86 -86
  15. package/src/components/ui/ColorPicker/Alpha.vue +114 -114
  16. package/src/components/ui/ColorPicker/Colors.vue +117 -117
  17. package/src/components/ui/ColorPicker/Hue.vue +113 -113
  18. package/src/components/ui/ColorPicker/Preview.vue +55 -55
  19. package/src/components/ui/ColorPicker/Saturation.vue +123 -123
  20. package/src/components/ui/ColorPicker/mixin.js +105 -105
  21. package/src/components/ui/ColorPicker.md +17 -17
  22. package/src/components/ui/ColorPicker.vue +314 -314
  23. package/src/components/ui/Datalist.md +41 -41
  24. package/src/components/ui/Datalist.vue +164 -164
  25. package/src/components/ui/DatePicker.md +168 -168
  26. package/src/components/ui/DatePicker.vue +527 -527
  27. package/src/components/ui/FileSelector.md +105 -105
  28. package/src/components/ui/FileSelector.vue +82 -82
  29. package/src/components/ui/Grid.md +130 -130
  30. package/src/components/ui/Grid.vue +92 -92
  31. package/src/components/ui/Image.md +59 -59
  32. package/src/components/ui/Image.vue +57 -57
  33. package/src/components/ui/InputAutocomplete.md +115 -115
  34. package/src/components/ui/InputAutocomplete.vue +374 -349
  35. package/src/components/ui/InputColorPicker.md +51 -51
  36. package/src/components/ui/InputColorPicker.vue +151 -151
  37. package/src/components/ui/InputDatePicker.md +121 -121
  38. package/src/components/ui/InputDatePicker.vue +326 -326
  39. package/src/components/ui/InputTags.md +51 -51
  40. package/src/components/ui/InputTags.vue +184 -184
  41. package/src/components/ui/InputTimePicker.md +25 -25
  42. package/src/components/ui/InputTimePicker.vue +253 -253
  43. package/src/components/ui/InputUnits.md +20 -20
  44. package/src/components/ui/InputUnits.vue +257 -257
  45. package/src/components/ui/Lazy.md +37 -37
  46. package/src/components/ui/Lazy.vue +92 -92
  47. package/src/components/ui/Pagination.md +74 -74
  48. package/src/components/ui/Pagination.vue +138 -138
  49. package/src/components/ui/Paginator.md +34 -34
  50. package/src/components/ui/Paginator.vue +83 -83
  51. package/src/components/ui/Popover.md +34 -34
  52. package/src/components/ui/Popover.vue +274 -274
  53. package/src/components/ui/Popup.md +59 -59
  54. package/src/components/ui/Popup.vue +150 -150
  55. package/src/components/ui/ResponsiveContainer.md +58 -58
  56. package/src/components/ui/ResponsiveContainer.vue +99 -99
  57. package/src/components/ui/Select.md +187 -187
  58. package/src/components/ui/Select.vue +421 -421
  59. package/src/components/ui/TimePicker.md +50 -50
  60. package/src/components/ui/TimePicker.vue +252 -252
  61. package/src/components/ui/Tooltip.md +54 -54
  62. package/src/components/ui/Tooltip.vue +113 -113
  63. package/src/components/ui/WysiwygEditor/WysiwygEditor.d.ts +128 -128
  64. package/src/components/ui/WysiwygEditor/constants.js +273 -273
  65. package/src/components/ui/WysiwygEditor/extensions/blockquote.js +15 -15
  66. package/src/components/ui/WysiwygEditor/extensions/bold.js +15 -15
  67. package/src/components/ui/WysiwygEditor/extensions/bullet-list.js +15 -15
  68. package/src/components/ui/WysiwygEditor/extensions/code-block.js +13 -13
  69. package/src/components/ui/WysiwygEditor/extensions/code.js +13 -13
  70. package/src/components/ui/WysiwygEditor/extensions/font-size.js +34 -34
  71. package/src/components/ui/WysiwygEditor/extensions/formatting.js +14 -14
  72. package/src/components/ui/WysiwygEditor/extensions/heading.js +13 -13
  73. package/src/components/ui/WysiwygEditor/extensions/horizontal-rule.js +15 -15
  74. package/src/components/ui/WysiwygEditor/extensions/image.js +37 -33
  75. package/src/components/ui/WysiwygEditor/extensions/index.d.ts +32 -32
  76. package/src/components/ui/WysiwygEditor/extensions/index.js +32 -32
  77. package/src/components/ui/WysiwygEditor/extensions/italic.js +15 -15
  78. package/src/components/ui/WysiwygEditor/extensions/link.js +16 -16
  79. package/src/components/ui/WysiwygEditor/extensions/list-item.js +15 -15
  80. package/src/components/ui/WysiwygEditor/extensions/ordered-list.js +15 -15
  81. package/src/components/ui/WysiwygEditor/extensions/paragraph.js +23 -23
  82. package/src/components/ui/WysiwygEditor/extensions/strike.js +15 -15
  83. package/src/components/ui/WysiwygEditor/extensions/table-cell.js +13 -13
  84. package/src/components/ui/WysiwygEditor/extensions/table-header.js +15 -15
  85. package/src/components/ui/WysiwygEditor/extensions/table-row.js +15 -15
  86. package/src/components/ui/WysiwygEditor/extensions/table.js +29 -29
  87. package/src/components/ui/WysiwygEditor/extensions/text-align.js +6 -6
  88. package/src/components/ui/WysiwygEditor/extensions/text-style.js +12 -12
  89. package/src/components/ui/WysiwygEditor/extensions/underline.js +15 -15
  90. package/src/components/ui/WysiwygEditor/index.d.ts +4 -4
  91. package/src/components/ui/WysiwygEditor/index.js +4 -4
  92. package/src/components/ui/WysiwygEditor/renders/Button.vue +28 -28
  93. package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +41 -41
  94. package/src/components/ui/WysiwygEditor/renders/Image.vue +200 -162
  95. package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +34 -34
  96. package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +37 -37
  97. package/src/components/ui/WysiwygEditor/renders/Link.vue +82 -82
  98. package/src/components/ui/WysiwygEditor/renders/Select.vue +47 -47
  99. package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +49 -49
  100. package/src/components/ui/WysiwygEditor/renders/components/Popover.vue +15 -0
  101. package/src/components/ui/WysiwygEditor/renders/components/WithPopover.vue +35 -35
  102. package/src/components/ui/WysiwygEditor/renders/index.d.ts +8 -8
  103. package/src/components/ui/WysiwygEditor/renders/index.js +8 -8
  104. package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +39 -39
  105. package/src/components/ui/WysiwygEditor/renders/mixins/index.js +1 -1
  106. package/src/components/ui/WysiwygEditor/tools-and-commands.js +709 -702
  107. package/src/components/ui/WysiwygEditor/utils.js +72 -72
  108. package/src/components/ui/WysiwygEditor.md +18 -18
  109. package/src/components/ui/WysiwygEditor.vue +266 -266
  110. package/src/components/ui/utils/FormComponent.js +107 -107
  111. package/src/components/ui/utils/Helpers.js +84 -84
  112. package/src/components/ui/utils/WithPopover.js +81 -81
  113. package/src/main.js +8 -8
  114. package/styleguide.config.js +37 -37
  115. package/vue.config.js +8 -8
  116. package/dist/js.png +0 -0
@@ -1,314 +1,314 @@
1
- <template>
2
- <div class="ui-color-picker">
3
- <div class="panel pad-2 d-inline-flex">
4
- <div :style="{ width: `${totalWidth}px` }">
5
- <div class="d-flex">
6
- <cp-saturation
7
- ref="saturation"
8
- :color="rgbString"
9
- :hsv="hsv"
10
- :size="hueHeight"
11
- @changeSaturation="changeSaturation"
12
- @selectSaturation="selectSaturation"
13
- />
14
- <cp-hue
15
- class="mar-left-2"
16
- ref="hue"
17
- :hsv="hsv"
18
- :width="hueWidth"
19
- :height="hueHeight"
20
- @selectHue="selectHue"
21
- />
22
- <cp-alpha
23
- class="mar-left-2"
24
- ref="alpha"
25
- :color="rgbString"
26
- :rgba="rgba"
27
- :width="hueWidth"
28
- :height="hueHeight"
29
- @selectAlpha="selectAlpha"
30
- />
31
- </div>
32
- <cp-preview
33
- class="mar-top-2"
34
- :color="previewRgbaString"
35
- :width="previewWidth"
36
- :height="previewHeight"
37
- />
38
- <div class="d-flex mar-top-2">
39
- <input
40
- class="input input-small text-xsmall flex-grow"
41
- type="text"
42
- :value="modelRgba"
43
- @change="e => inputRgba(e.target.value)"
44
- v-if="modelMode == modelModes.RGBA"
45
- />
46
- <input
47
- class="input input-small text-xsmall flex-grow"
48
- type="text"
49
- :value="modelHex"
50
- @change="e => inputHex(e.target.value)"
51
- v-else
52
- />
53
- <div class="btn btn-outline btn-small mar-left-2" @click="toggleModelMode">
54
- <span class="text-xsmall text-upper">{{ nextModelMode }}</span>
55
- </div>
56
- <div
57
- class="btn btn-outline btn-small mar-left-2"
58
- @click="submit"
59
- v-if="showSubmit"
60
- >
61
- <i class="mdi mdi-check"></i>
62
- </div>
63
- </div>
64
- <cp-colors
65
- class="mar-top-2"
66
- :color="rgbaString"
67
- :colors-default="colorsDefault"
68
- :colors-history-key="colorsHistoryKey"
69
- @selectColor="selectColor"
70
- v-if="colorsDefault.length || colorsHistoryKey"
71
- />
72
- </div>
73
- </div>
74
- </div>
75
- </template>
76
- <style lang="less" scoped>
77
- .ui-color-picker {
78
- canvas {
79
- display: block;
80
- }
81
- input {
82
- min-width: 0;
83
- }
84
- .btn {
85
- min-height: 0;
86
- width: 2.25em;
87
- padding: 0;
88
- }
89
- .text-upper {
90
- text-transform: uppercase;
91
- }
92
- }
93
- </style>
94
- <script>
95
- import mixin from './ColorPicker/mixin';
96
- import CpSaturation from './ColorPicker/Saturation.vue';
97
- import CpHue from './ColorPicker/Hue.vue';
98
- import CpAlpha from './ColorPicker/Alpha.vue';
99
- import CpPreview from './ColorPicker/Preview.vue';
100
- import CpColors from './ColorPicker/Colors.vue';
101
-
102
- let MODEL_MODE = {
103
- HEX: 'h',
104
- RGBA: 'r',
105
- };
106
- export default {
107
- components: {
108
- CpSaturation,
109
- CpHue,
110
- CpAlpha,
111
- CpPreview,
112
- CpColors,
113
- },
114
- mixins: [mixin],
115
- props: {
116
- /**
117
- * @model
118
- */
119
- value: {
120
- type: String,
121
- default: '#000000',
122
- },
123
- /**
124
- * Default colors palette
125
- */
126
- colorsDefault: {
127
- type: Array,
128
- default: () => [],
129
- },
130
- /**
131
- * LocalStorage key for saving used colors
132
- */
133
- colorsHistoryKey: {
134
- type: String,
135
- default: '',
136
- },
137
- /**
138
- * Show submit button
139
- */
140
- showSubmit: {
141
- type: Boolean,
142
- default: false,
143
- },
144
- },
145
- data() {
146
- return {
147
- hueWidth: 15,
148
- hueHeight: 150,
149
- previewHeight: 15,
150
- modelRgba: '',
151
- modelHex: '',
152
- modelMode: MODEL_MODE.RGBA,
153
- modelModes: MODEL_MODE,
154
- r: 0,
155
- g: 0,
156
- b: 0,
157
- a: 1,
158
- h: 0,
159
- s: 0,
160
- v: 0,
161
- };
162
- },
163
- computed: {
164
- nextModelMode() {
165
- let { HEX, RGBA } = MODEL_MODE;
166
- return this.modelMode == HEX ? RGBA : HEX;
167
- },
168
- totalWidth() {
169
- return this.hueHeight + (this.hueWidth + 4) * 2;
170
- },
171
- previewWidth() {
172
- return this.totalWidth;
173
- },
174
- rgba() {
175
- return {
176
- r: this.r,
177
- g: this.g,
178
- b: this.b,
179
- a: this.a,
180
- };
181
- },
182
- hsv() {
183
- return {
184
- h: this.h,
185
- s: this.s,
186
- v: this.v,
187
- };
188
- },
189
- rgbString() {
190
- return `rgb(${this.r}, ${this.g}, ${this.b})`;
191
- },
192
- rgbaStringShort() {
193
- return `${this.r}, ${this.g}, ${this.b}, ${this.a}`;
194
- },
195
- rgbaString() {
196
- return `rgba(${this.rgbaStringShort})`;
197
- },
198
- hexString() {
199
- return this.rgb2hex(this.rgba, true);
200
- },
201
- previewRgbaString() {
202
- return this.rgbaString;
203
- },
204
- },
205
- watch: {
206
- value: {
207
- handler(v) {
208
- Object.assign(this, this.setColorValue(this.value));
209
- this.setText();
210
- },
211
- immediate: true,
212
- },
213
- rgba() {
214
- /**
215
- * Triggers when the color changes
216
- * @property {Object} color color object
217
- */
218
- this.$emit('changeColor', {
219
- rgba: this.rgba,
220
- hsv: this.hsv,
221
- hex: this.modelHex,
222
- });
223
- /**
224
- * Triggers when the color changes
225
- * @property {Number} rgbaString color rgba string
226
- */
227
- this.$emit('input', this.rgbaString);
228
- },
229
- },
230
- /*created() {
231
- Object.assign(this, this.setColorValue(this.value));
232
- this.setText();
233
- },*/
234
- methods: {
235
- submit() {
236
- /**
237
- * Triggers when the color changes
238
- * @property {Object} color color object
239
- */
240
- this.$emit('submit', {
241
- rgba: this.rgba,
242
- hsv: this.hsv,
243
- hex: this.modelHex,
244
- });
245
- },
246
- toggleModelMode() {
247
- let { HEX, RGBA } = MODEL_MODE;
248
- this.modelMode = this.modelMode == HEX ? RGBA : HEX;
249
- },
250
- selectSaturation(color) {
251
- const { r, g, b, h, s, v } = this.setColorValue(color);
252
- Object.assign(this, { r, g, b, h, s, v });
253
- this.setText();
254
- },
255
- changeSaturation(color) {
256
- //const { r, g, b } = this.setColorValue(color);
257
- //const { a } = this;
258
- //this.previewRgbaString = `rgba(${r},${g},${b},${a})`;
259
- const { r, g, b, h, s, v } = this.setColorValue(color);
260
- Object.assign(this, { r, g, b, h, s, v });
261
- this.setText();
262
- },
263
- selectHue(color) {
264
- const { r, g, b, h, s, v } = this.setColorValue(color);
265
- Object.assign(this, { r, g, b, h, s, v });
266
- this.setText();
267
- this.$nextTick(() => {
268
- this.$refs.saturation.renderColor();
269
- this.$refs.saturation.renderSlide();
270
- });
271
- },
272
- selectAlpha(a) {
273
- this.a = a;
274
- this.setText();
275
- },
276
- inputHex(color) {
277
- const { r, g, b, a, h, s, v } = this.setColorValue(color);
278
- Object.assign(this, { r, g, b, a, h, s, v });
279
- this.modelHex = color;
280
- this.modelRgba = this.rgbaStringShort;
281
- this.$nextTick(() => {
282
- this.$refs.saturation.renderColor();
283
- this.$refs.saturation.renderSlide();
284
- this.$refs.hue.renderSlide();
285
- });
286
- },
287
- inputRgba(color) {
288
- const { r, g, b, a, h, s, v } = this.setColorValue(color);
289
- Object.assign(this, { r, g, b, a, h, s, v });
290
- this.modelHex = this.hexString;
291
- this.modelRgba = color;
292
- this.$nextTick(() => {
293
- this.$refs.saturation.renderColor();
294
- this.$refs.saturation.renderSlide();
295
- this.$refs.hue.renderSlide();
296
- });
297
- },
298
- setText() {
299
- this.modelHex = this.hexString;
300
- this.modelRgba = this.rgbaStringShort;
301
- },
302
- selectColor(color) {
303
- const { r, g, b, a, h, s, v } = this.setColorValue(color);
304
- Object.assign(this, { r, g, b, a, h, s, v });
305
- this.setText();
306
- this.$nextTick(() => {
307
- this.$refs.saturation.renderColor();
308
- this.$refs.saturation.renderSlide();
309
- this.$refs.hue.renderSlide();
310
- });
311
- },
312
- },
313
- };
314
- </script>
1
+ <template>
2
+ <div class="ui-color-picker">
3
+ <div class="panel pad-2 d-inline-flex">
4
+ <div :style="{ width: `${totalWidth}px` }">
5
+ <div class="d-flex">
6
+ <cp-saturation
7
+ ref="saturation"
8
+ :color="rgbString"
9
+ :hsv="hsv"
10
+ :size="hueHeight"
11
+ @changeSaturation="changeSaturation"
12
+ @selectSaturation="selectSaturation"
13
+ />
14
+ <cp-hue
15
+ class="mar-left-2"
16
+ ref="hue"
17
+ :hsv="hsv"
18
+ :width="hueWidth"
19
+ :height="hueHeight"
20
+ @selectHue="selectHue"
21
+ />
22
+ <cp-alpha
23
+ class="mar-left-2"
24
+ ref="alpha"
25
+ :color="rgbString"
26
+ :rgba="rgba"
27
+ :width="hueWidth"
28
+ :height="hueHeight"
29
+ @selectAlpha="selectAlpha"
30
+ />
31
+ </div>
32
+ <cp-preview
33
+ class="mar-top-2"
34
+ :color="previewRgbaString"
35
+ :width="previewWidth"
36
+ :height="previewHeight"
37
+ />
38
+ <div class="d-flex mar-top-2">
39
+ <input
40
+ class="input input-small text-xsmall flex-grow"
41
+ type="text"
42
+ :value="modelRgba"
43
+ @change="e => inputRgba(e.target.value)"
44
+ v-if="modelMode == modelModes.RGBA"
45
+ />
46
+ <input
47
+ class="input input-small text-xsmall flex-grow"
48
+ type="text"
49
+ :value="modelHex"
50
+ @change="e => inputHex(e.target.value)"
51
+ v-else
52
+ />
53
+ <div class="btn btn-outline btn-small mar-left-2" @click="toggleModelMode">
54
+ <span class="text-xsmall text-upper">{{ nextModelMode }}</span>
55
+ </div>
56
+ <div
57
+ class="btn btn-outline btn-small mar-left-2"
58
+ @click="submit"
59
+ v-if="showSubmit"
60
+ >
61
+ <i class="mdi mdi-check"></i>
62
+ </div>
63
+ </div>
64
+ <cp-colors
65
+ class="mar-top-2"
66
+ :color="rgbaString"
67
+ :colors-default="colorsDefault"
68
+ :colors-history-key="colorsHistoryKey"
69
+ @selectColor="selectColor"
70
+ v-if="colorsDefault.length || colorsHistoryKey"
71
+ />
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </template>
76
+ <style lang="less" scoped>
77
+ .ui-color-picker {
78
+ canvas {
79
+ display: block;
80
+ }
81
+ input {
82
+ min-width: 0;
83
+ }
84
+ .btn {
85
+ min-height: 0;
86
+ width: 2.25em;
87
+ padding: 0;
88
+ }
89
+ .text-upper {
90
+ text-transform: uppercase;
91
+ }
92
+ }
93
+ </style>
94
+ <script>
95
+ import mixin from './ColorPicker/mixin';
96
+ import CpSaturation from './ColorPicker/Saturation.vue';
97
+ import CpHue from './ColorPicker/Hue.vue';
98
+ import CpAlpha from './ColorPicker/Alpha.vue';
99
+ import CpPreview from './ColorPicker/Preview.vue';
100
+ import CpColors from './ColorPicker/Colors.vue';
101
+
102
+ let MODEL_MODE = {
103
+ HEX: 'h',
104
+ RGBA: 'r',
105
+ };
106
+ export default {
107
+ components: {
108
+ CpSaturation,
109
+ CpHue,
110
+ CpAlpha,
111
+ CpPreview,
112
+ CpColors,
113
+ },
114
+ mixins: [mixin],
115
+ props: {
116
+ /**
117
+ * @model
118
+ */
119
+ value: {
120
+ type: String,
121
+ default: '#000000',
122
+ },
123
+ /**
124
+ * Default colors palette
125
+ */
126
+ colorsDefault: {
127
+ type: Array,
128
+ default: () => [],
129
+ },
130
+ /**
131
+ * LocalStorage key for saving used colors
132
+ */
133
+ colorsHistoryKey: {
134
+ type: String,
135
+ default: '',
136
+ },
137
+ /**
138
+ * Show submit button
139
+ */
140
+ showSubmit: {
141
+ type: Boolean,
142
+ default: false,
143
+ },
144
+ },
145
+ data() {
146
+ return {
147
+ hueWidth: 15,
148
+ hueHeight: 150,
149
+ previewHeight: 15,
150
+ modelRgba: '',
151
+ modelHex: '',
152
+ modelMode: MODEL_MODE.RGBA,
153
+ modelModes: MODEL_MODE,
154
+ r: 0,
155
+ g: 0,
156
+ b: 0,
157
+ a: 1,
158
+ h: 0,
159
+ s: 0,
160
+ v: 0,
161
+ };
162
+ },
163
+ computed: {
164
+ nextModelMode() {
165
+ let { HEX, RGBA } = MODEL_MODE;
166
+ return this.modelMode == HEX ? RGBA : HEX;
167
+ },
168
+ totalWidth() {
169
+ return this.hueHeight + (this.hueWidth + 4) * 2;
170
+ },
171
+ previewWidth() {
172
+ return this.totalWidth;
173
+ },
174
+ rgba() {
175
+ return {
176
+ r: this.r,
177
+ g: this.g,
178
+ b: this.b,
179
+ a: this.a,
180
+ };
181
+ },
182
+ hsv() {
183
+ return {
184
+ h: this.h,
185
+ s: this.s,
186
+ v: this.v,
187
+ };
188
+ },
189
+ rgbString() {
190
+ return `rgb(${this.r}, ${this.g}, ${this.b})`;
191
+ },
192
+ rgbaStringShort() {
193
+ return `${this.r}, ${this.g}, ${this.b}, ${this.a}`;
194
+ },
195
+ rgbaString() {
196
+ return `rgba(${this.rgbaStringShort})`;
197
+ },
198
+ hexString() {
199
+ return this.rgb2hex(this.rgba, true);
200
+ },
201
+ previewRgbaString() {
202
+ return this.rgbaString;
203
+ },
204
+ },
205
+ watch: {
206
+ value: {
207
+ handler(v) {
208
+ Object.assign(this, this.setColorValue(this.value));
209
+ this.setText();
210
+ },
211
+ immediate: true,
212
+ },
213
+ rgba() {
214
+ /**
215
+ * Triggers when the color changes
216
+ * @property {Object} color color object
217
+ */
218
+ this.$emit('changeColor', {
219
+ rgba: this.rgba,
220
+ hsv: this.hsv,
221
+ hex: this.modelHex,
222
+ });
223
+ /**
224
+ * Triggers when the color changes
225
+ * @property {Number} rgbaString color rgba string
226
+ */
227
+ this.$emit('input', this.rgbaString);
228
+ },
229
+ },
230
+ /*created() {
231
+ Object.assign(this, this.setColorValue(this.value));
232
+ this.setText();
233
+ },*/
234
+ methods: {
235
+ submit() {
236
+ /**
237
+ * Triggers when the color changes
238
+ * @property {Object} color color object
239
+ */
240
+ this.$emit('submit', {
241
+ rgba: this.rgba,
242
+ hsv: this.hsv,
243
+ hex: this.modelHex,
244
+ });
245
+ },
246
+ toggleModelMode() {
247
+ let { HEX, RGBA } = MODEL_MODE;
248
+ this.modelMode = this.modelMode == HEX ? RGBA : HEX;
249
+ },
250
+ selectSaturation(color) {
251
+ const { r, g, b, h, s, v } = this.setColorValue(color);
252
+ Object.assign(this, { r, g, b, h, s, v });
253
+ this.setText();
254
+ },
255
+ changeSaturation(color) {
256
+ //const { r, g, b } = this.setColorValue(color);
257
+ //const { a } = this;
258
+ //this.previewRgbaString = `rgba(${r},${g},${b},${a})`;
259
+ const { r, g, b, h, s, v } = this.setColorValue(color);
260
+ Object.assign(this, { r, g, b, h, s, v });
261
+ this.setText();
262
+ },
263
+ selectHue(color) {
264
+ const { r, g, b, h, s, v } = this.setColorValue(color);
265
+ Object.assign(this, { r, g, b, h, s, v });
266
+ this.setText();
267
+ this.$nextTick(() => {
268
+ this.$refs.saturation.renderColor();
269
+ this.$refs.saturation.renderSlide();
270
+ });
271
+ },
272
+ selectAlpha(a) {
273
+ this.a = a;
274
+ this.setText();
275
+ },
276
+ inputHex(color) {
277
+ const { r, g, b, a, h, s, v } = this.setColorValue(color);
278
+ Object.assign(this, { r, g, b, a, h, s, v });
279
+ this.modelHex = color;
280
+ this.modelRgba = this.rgbaStringShort;
281
+ this.$nextTick(() => {
282
+ this.$refs.saturation.renderColor();
283
+ this.$refs.saturation.renderSlide();
284
+ this.$refs.hue.renderSlide();
285
+ });
286
+ },
287
+ inputRgba(color) {
288
+ const { r, g, b, a, h, s, v } = this.setColorValue(color);
289
+ Object.assign(this, { r, g, b, a, h, s, v });
290
+ this.modelHex = this.hexString;
291
+ this.modelRgba = color;
292
+ this.$nextTick(() => {
293
+ this.$refs.saturation.renderColor();
294
+ this.$refs.saturation.renderSlide();
295
+ this.$refs.hue.renderSlide();
296
+ });
297
+ },
298
+ setText() {
299
+ this.modelHex = this.hexString;
300
+ this.modelRgba = this.rgbaStringShort;
301
+ },
302
+ selectColor(color) {
303
+ const { r, g, b, a, h, s, v } = this.setColorValue(color);
304
+ Object.assign(this, { r, g, b, a, h, s, v });
305
+ this.setText();
306
+ this.$nextTick(() => {
307
+ this.$refs.saturation.renderColor();
308
+ this.$refs.saturation.renderSlide();
309
+ this.$refs.hue.renderSlide();
310
+ });
311
+ },
312
+ },
313
+ };
314
+ </script>