Merge branch 'ticket1051' into 'develop'

Label select component Fixed label colors

See merge request service-web-lab/support-web!5
This commit is contained in:
Vincent BRIDIER 2022-08-31 10:47:55 +00:00
commit e0d4d182ef

View file

@ -7,12 +7,12 @@
label="label"
:options="labels"
>
<template #option="{ option }: { option: SelectModel }">
<template #option="{ label, color }: { label: string, color: string }">
<span
class="py-1 px-2"
:style="`background-color: ${(option as SelectModel).color};color: ${invertColor((option as SelectModel).color, true)};`"
:style="`background-color: ${color};color: ${invertColor(color, true)};`"
>
{{ String(option.label) }}
{{ String(label) }}
</span>
</template>
<template #no-options>
@ -44,14 +44,14 @@ export default defineComponent({
const json = String(this.$attrs.json ?? "{}"),
data = JSON.parse(json);
this.name = data.name;
for (let label of data.value ?? []) {
for (const label of data.value ?? []) {
this.selectedLabels.push({
label: label.name,
value: label.id,
color: label.color,
});
}
for (let label of data.labels) {
for (const label of data.labels) {
this.labels.push({
label: label.name,
value: label.id,