@teammodlr/ui-kit 2.3.15 → 2.3.17
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/lib/components/colorpicker/ColorPicker.vue.d.ts +1 -1
- package/lib/components/dialogprovider/types.d.ts +3 -0
- package/lib/index.cjs.js +3 -3
- package/lib/index.es.js +497 -493
- package/package.json +1 -1
- package/src/components/colorpicker/ColorPicker.vue +7 -7
- package/src/components/colorpicker/examples/basic.vue +11 -1
- package/src/components/dialogprovider/DialogProvider.vue +18 -1
- package/src/components/dialogprovider/types.ts +3 -0
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,12 +239,12 @@ 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
250
|
const updateFromHex = (shouldEmit = true) => {
|
|
@@ -266,7 +265,7 @@ export default defineComponent({
|
|
|
266
265
|
opacitySlider.value = 0;
|
|
267
266
|
}
|
|
268
267
|
|
|
269
|
-
updateFromHSV(RGBToHSV(color.r, color.g, color.b), color.a);
|
|
268
|
+
updateFromHSV(RGBToHSV(color.r, color.g, color.b), color.a, shouldEmit);
|
|
270
269
|
if (shouldEmit && modelModifiers.lazy) {
|
|
271
270
|
emitModelValue();
|
|
272
271
|
}
|
|
@@ -379,6 +378,7 @@ export default defineComponent({
|
|
|
379
378
|
|
|
380
379
|
onClickOutside(popper, (e) => {
|
|
381
380
|
isOpen.value = false;
|
|
381
|
+
emit('onColorChange', hexInput.value);
|
|
382
382
|
});
|
|
383
383
|
|
|
384
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>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
</template>
|
|
15
15
|
<script lang="ts">
|
|
16
|
-
import { defineComponent, reactive, provide, ref, nextTick } from 'vue';
|
|
16
|
+
import { defineComponent, reactive, provide, ref, nextTick, computed } from 'vue';
|
|
17
17
|
import type { DialogApiInjection, DialogOptions, DialogReactive } from './types';
|
|
18
18
|
import MDialog from '../dialog/Dialog.vue';
|
|
19
19
|
import MRenderer from '../renderer/renderer';
|
|
@@ -103,9 +103,26 @@ export default defineComponent({
|
|
|
103
103
|
remove(key);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
const hasOpenDialog = computed(() => {
|
|
107
|
+
return Object.values(dialogMap).some(dialog => dialog.options.open === true);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const openDialogCount = computed(() => {
|
|
111
|
+
return Object.values(dialogMap).filter(dialog => dialog.options.open === true).length;
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const openDialogKeys = computed(() => {
|
|
115
|
+
return Object.values(dialogMap)
|
|
116
|
+
.filter(dialog => dialog.options.open === true)
|
|
117
|
+
.map(dialog => dialog.key);
|
|
118
|
+
});
|
|
119
|
+
|
|
106
120
|
const api: DialogApiInjection = {
|
|
107
121
|
create,
|
|
108
122
|
remove,
|
|
123
|
+
hasOpenDialog: () => hasOpenDialog.value,
|
|
124
|
+
openDialogCount: () => openDialogCount.value,
|
|
125
|
+
openDialogKeys: () => openDialogKeys.value
|
|
109
126
|
};
|
|
110
127
|
|
|
111
128
|
provide('m-dialog', api);
|
|
@@ -23,4 +23,7 @@ export interface DialogReactive {
|
|
|
23
23
|
export interface DialogApiInjection {
|
|
24
24
|
create: (key: string, options?: DialogOptions) => DialogReactive;
|
|
25
25
|
remove: (key: string) => void;
|
|
26
|
+
hasOpenDialog: () => boolean;
|
|
27
|
+
openDialogCount: () => number;
|
|
28
|
+
openDialogKeys: () => string[];
|
|
26
29
|
}
|