|
11 | 11 | >
|
12 | 12 | <component
|
13 | 13 | :is="input.multiple ? ActionButtonToggle : ActionButton"
|
14 |
| - v-for="(option, optionIndex) in options" |
15 |
| - :key="optionIndex" |
| 14 | + v-for="option in options" |
| 15 | + :key="`choice-${_.snakeCase(String(option.value))}-${input.options.length}`" |
16 | 16 | :theme="theme"
|
17 | 17 | :aria-label="option.alias || option.value"
|
18 | 18 | :active="modelValue.includes(option.value)"
|
19 | 19 | :title="modelValue.includes(option.value) ? t('select_selected') : ''"
|
20 | 20 | :disabled="readonly || (!input.multiple && modelValue.includes(option.value))"
|
| 21 | + :round="!!option.icon || (!!option.pattern && !option.alias)" |
| 22 | + :tooltip="option.icon ? option.alias : ''" |
| 23 | + tooltip-as-text |
| 24 | + tooltip-position="bottom" |
21 | 25 | @click="choose(option.value)"
|
22 | 26 | >
|
23 |
| - <span>{{ option.alias || option.value }}</span> |
24 | 27 | <template v-if="option.icon">
|
25 | 28 | <IconFa :name="option.icon" />
|
26 | 29 | <IconFa v-if="input.multiple" :name="option.icon" regular />
|
27 | 30 | </template>
|
28 |
| - <figure |
29 |
| - v-else-if="option.pattern" |
30 |
| - class="avatar --size-xs --bdr --bdrColor-light" |
31 |
| - :style=" |
32 |
| - validator.isURL(option.pattern) |
33 |
| - ? { backgroundImage: `url('${option.pattern}')` } |
34 |
| - : { backgroundColor: option.pattern } |
35 |
| - " |
36 |
| - ></figure> |
| 31 | + <template v-else-if="option.pattern"> |
| 32 | + <span v-if="option.alias">{{ option.alias }}</span> |
| 33 | + <figure |
| 34 | + class="avatar --size-xs --bdr" |
| 35 | + :class="`--bdrColor-${ |
| 36 | + themeValues[ |
| 37 | + !input.multiple && modelValue.includes(option.value) ? 0 : 1 |
| 38 | + ] |
| 39 | + }`" |
| 40 | + :style=" |
| 41 | + validator.isURL(option.pattern) |
| 42 | + ? { backgroundImage: `url('${option.pattern}')` } |
| 43 | + : { backgroundColor: option.pattern } |
| 44 | + " |
| 45 | + ></figure> |
| 46 | + </template> |
| 47 | + <span v-else>{{ option.alias || option.value }}</span> |
37 | 48 | </component>
|
38 | 49 | </div>
|
39 | 50 | </FormInputOptions>
|
|
318 | 329 | import useInput from "../../composables/input";
|
319 | 330 | import useCountries from "../../composables/countries";
|
320 | 331 | import { useHelpers } from "../../composables/utils";
|
| 332 | + import useTheme from "../../composables/theme"; |
321 | 333 |
|
322 | 334 | interface iFormInputProps extends iUseThemeProps {
|
323 | 335 | modelValue: any[];
|
|
344 | 356 | const { isValidFormInputValue, notEmptyValue } = useHelpers(useForm).utils;
|
345 | 357 | const { getInputPlaceholder, getInputAutocomplete, getInputTextType } = useInput(props);
|
346 | 358 | const { defaultCountry } = useCountries();
|
| 359 | + const { themeValues } = useTheme(props); |
347 | 360 |
|
348 | 361 | const countriesArr = computed(() => {
|
349 | 362 | return (props.countries || []).map(({ code, name }) => ({ value: code, alias: name }));
|
|
0 commit comments