fix: Fix color picker type errors (#9436)

This commit is contained in:
Mutasem Aldmour 2024-05-17 11:25:13 +02:00 committed by GitHub
parent bc05faf0a6
commit 2967df2fe0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 13 deletions

View file

@ -40,16 +40,6 @@ const emit = defineEmits<{
(event: 'active-change', value: string): void; (event: 'active-change', value: string): void;
}>(); }>();
const model = computed({
get() {
return color.value;
},
set(value: string) {
color.value = value;
emit('update:modelValue', value);
},
});
const onChange = (value: string) => { const onChange = (value: string) => {
emit('change', value); emit('change', value);
}; };
@ -61,15 +51,20 @@ const onInput = (value: string) => {
const onActiveChange = (value: string) => { const onActiveChange = (value: string) => {
emit('active-change', value); emit('active-change', value);
}; };
const onColorSelect = (value: string) => {
emit('update:modelValue', value);
};
</script> </script>
<template> <template>
<span :class="['n8n-color-picker', $style.component]"> <span :class="['n8n-color-picker', $style.component]">
<ElColorPicker <ElColorPicker
v-model="model"
v-bind="colorPickerProps" v-bind="colorPickerProps"
size="default"
@change="onChange" @change="onChange"
@active-change="onActiveChange" @active-change="onActiveChange"
@update:model-value="onColorSelect"
/> />
<N8nInput <N8nInput
v-if="showInput" v-if="showInput"

View file

@ -10,7 +10,7 @@ exports[`components > N8nColorPicker > should render with input 1`] = `
<div <div
aria-description="current color is . press enter to select a new color." aria-description="current color is . press enter to select a new color."
aria-label="color picker" aria-label="color picker"
class="el-color-picker el-color-picker--medium el-tooltip__trigger el-tooltip__trigger" class="el-color-picker el-color-picker--default el-tooltip__trigger el-tooltip__trigger"
role="button" role="button"
tabindex="0" tabindex="0"
> >
@ -108,7 +108,7 @@ exports[`components > N8nColorPicker > should render without input 1`] = `
<div <div
aria-description="current color is . press enter to select a new color." aria-description="current color is . press enter to select a new color."
aria-label="color picker" aria-label="color picker"
class="el-color-picker el-color-picker--medium el-tooltip__trigger el-tooltip__trigger" class="el-color-picker el-color-picker--default el-tooltip__trigger el-tooltip__trigger"
role="button" role="button"
tabindex="0" tabindex="0"
> >