Fix dropdown component for group select [SCI-6583] (#3905)

This commit is contained in:
artoscinote 2022-02-28 13:21:17 +01:00 committed by GitHub
parent 99e8f7e3cb
commit 4e118d095d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,8 +7,22 @@
:data-select-multiple-name="dataSelectMultipleName"
:data-placeholder="placeholder"
>
<optgroup v-if="groupSelector" v-for="group in this.options" :label="group.label">
<option v-for="option in group.options"
<template v-if="groupSelector">
<optgroup v-for="group in this.options" :label="group.label" :key="group.label">
<option v-for="option in group.options"
:key="option.label"
:value="option.value"
:selected="option.value == selectedValue || (Array.isArray(selectedValue) && selectedValue.some(e => e == option.value))"
:data-selected="option.value == selectedValue || (Array.isArray(selectedValue) && selectedValue.some(e => e == option.value))"
:data-params="JSON.stringify(option.params)"
:data-group="group.label">
{{ option.label }}
</option>
</optgroup>
</template>
<template v-else>
<option
v-for="option in this.options"
:key="option.label"
:value="option.value"
:selected="option.value == selectedValue || (Array.isArray(selectedValue) && selectedValue.some(e => e == option.value))"
@ -16,16 +30,7 @@
:data-params="JSON.stringify(option.params)">
{{ option.label }}
</option>
</optgroup>
<option v-if="!groupSelector"
v-for="option in this.options"
:key="option.label"
:value="option.value"
:selected="option.value == selectedValue || (Array.isArray(selectedValue) && selectedValue.some(e => e == option.value))"
:data-selected="option.value == selectedValue || (Array.isArray(selectedValue) && selectedValue.some(e => e == option.value))"
:data-params="JSON.stringify(option.params)">
{{ option.label }}
</option>
</template>
</select>
</div>
</template>