@teammodlr/ui-kit 2.3.14 → 2.3.16
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
|
@@ -212,10 +212,9 @@ export default defineComponent({
|
|
|
212
212
|
|
|
213
213
|
const emitModelValue = () => {
|
|
214
214
|
emit('update:modelValue', hexInput.value);
|
|
215
|
-
emit('onColorChange', hexInput.value);
|
|
216
215
|
};
|
|
217
216
|
|
|
218
|
-
const setInputs = () => {
|
|
217
|
+
const setInputs = (shouldEmit: boolean = true) => {
|
|
219
218
|
if (hexInput.value !== 'inherit') {
|
|
220
219
|
hexInput.value = RGBAToHex(finalColor.value.r, finalColor.value.g, finalColor.value.b, finalColor.value.a);
|
|
221
220
|
}
|
|
@@ -224,13 +223,13 @@ export default defineComponent({
|
|
|
224
223
|
bInput.value = finalColor.value.b.toString();
|
|
225
224
|
aInput.value = finalColor.value.a.toFixed(2).toString();
|
|
226
225
|
|
|
227
|
-
if (!modelModifiers.lazy) {
|
|
226
|
+
if (shouldEmit && !modelModifiers.lazy) {
|
|
228
227
|
emitModelValue();
|
|
229
228
|
}
|
|
230
229
|
};
|
|
231
230
|
|
|
232
231
|
watch(() => finalColor.value, () => {
|
|
233
|
-
setInputs();
|
|
232
|
+
setInputs(false);
|
|
234
233
|
});
|
|
235
234
|
|
|
236
235
|
watch(() => props.color, (newColor) => {
|
|
@@ -240,24 +239,23 @@ export default defineComponent({
|
|
|
240
239
|
}
|
|
241
240
|
});
|
|
242
241
|
|
|
243
|
-
const updateFromHSV = (hsv: HSV, alpha: number) => {
|
|
242
|
+
const updateFromHSV = (hsv: HSV, alpha: number, shouldEmit: boolean = true) => {
|
|
244
243
|
position.x = hsv.s;
|
|
245
244
|
position.y = 1 - hsv.v;
|
|
246
245
|
hueSlider.value = ((1 / 360) * hsv.h) * 100;
|
|
247
246
|
opacitySlider.value = alpha * 100;
|
|
248
|
-
setInputs();
|
|
247
|
+
setInputs(shouldEmit);
|
|
249
248
|
}
|
|
250
249
|
|
|
251
|
-
const updateFromHex = () => {
|
|
250
|
+
const updateFromHex = (shouldEmit = true) => {
|
|
252
251
|
if (hexInput.value === 'inherit') {
|
|
253
|
-
if (modelModifiers.lazy) {
|
|
252
|
+
if (shouldEmit && modelModifiers.lazy) {
|
|
254
253
|
emitModelValue();
|
|
255
254
|
}
|
|
256
255
|
return;
|
|
257
256
|
}
|
|
258
257
|
|
|
259
258
|
let hex = hexInput.value.replace("#", "");
|
|
260
|
-
debugger;
|
|
261
259
|
if (hex.length === 3) {
|
|
262
260
|
hex = hex.split("").map(char => char + char).join("");
|
|
263
261
|
}
|
|
@@ -267,8 +265,8 @@ export default defineComponent({
|
|
|
267
265
|
opacitySlider.value = 0;
|
|
268
266
|
}
|
|
269
267
|
|
|
270
|
-
updateFromHSV(RGBToHSV(color.r, color.g, color.b), color.a);
|
|
271
|
-
if (modelModifiers.lazy) {
|
|
268
|
+
updateFromHSV(RGBToHSV(color.r, color.g, color.b), color.a, shouldEmit);
|
|
269
|
+
if (shouldEmit && modelModifiers.lazy) {
|
|
272
270
|
emitModelValue();
|
|
273
271
|
}
|
|
274
272
|
};
|
|
@@ -340,7 +338,7 @@ export default defineComponent({
|
|
|
340
338
|
val = props.defaultColor ?? "#FFFFFF";
|
|
341
339
|
}
|
|
342
340
|
hexInput.value = val;
|
|
343
|
-
updateFromHex();
|
|
341
|
+
updateFromHex(false);
|
|
344
342
|
});
|
|
345
343
|
|
|
346
344
|
const setThumbPosition = () => {
|
|
@@ -374,12 +372,13 @@ export default defineComponent({
|
|
|
374
372
|
hexInput.value = props.color || props.modelValue;
|
|
375
373
|
}
|
|
376
374
|
|
|
377
|
-
updateFromHex();
|
|
375
|
+
updateFromHex(false);
|
|
378
376
|
});
|
|
379
377
|
|
|
380
378
|
|
|
381
379
|
onClickOutside(popper, (e) => {
|
|
382
380
|
isOpen.value = false;
|
|
381
|
+
emit('onColorChange', hexInput.value);
|
|
383
382
|
});
|
|
384
383
|
|
|
385
384
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<p>Selected Color: {{ colorValue }}</p>
|
|
4
|
-
<MColorPicker
|
|
4
|
+
<MColorPicker color="#FF0000" style="display: inline-block;" @on-color-change="updateColor">
|
|
5
5
|
<template #default="{ r, g, b, hex, transparent }">
|
|
6
6
|
<div :class="transparent"
|
|
7
7
|
style="width: 100px; height: 100px; border: 1px solid black; position: relative; overflow: hidden;">
|
|
@@ -18,6 +18,16 @@ export default {
|
|
|
18
18
|
return {
|
|
19
19
|
colorValue: 'rgba(0,0,0,50%)' // Initial color value
|
|
20
20
|
};
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
const updateColor = (color) => {
|
|
24
|
+
console.log(color);
|
|
25
|
+
debugger;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
updateColor
|
|
30
|
+
}
|
|
21
31
|
}
|
|
22
32
|
};
|
|
23
33
|
</script>
|