2023-01-26 18:21:41 +00:00
|
|
|
<template>
|
|
|
|
<FormField
|
|
|
|
:name="name"
|
|
|
|
:label="label"
|
|
|
|
:placeholder="placeholder"
|
|
|
|
:disabled="disabled"
|
|
|
|
>
|
2023-01-26 18:30:17 +00:00
|
|
|
<template #input="{ invalid, forId, value, setValue }">
|
2023-01-26 18:21:41 +00:00
|
|
|
<SelectVue
|
|
|
|
:for-id="forId"
|
|
|
|
:invalid="invalid"
|
|
|
|
:disabled="disabled"
|
|
|
|
:options="options || []"
|
|
|
|
:placeholder="placeholder"
|
|
|
|
:model-value="(value as string)"
|
|
|
|
@update:model-value="(newValue) => setValue(newValue)"
|
2023-01-27 16:27:14 +00:00
|
|
|
>
|
|
|
|
<template #option="slotProps">
|
|
|
|
<slot name="option" v-bind="slotProps" />
|
|
|
|
</template>
|
|
|
|
</SelectVue>
|
2023-01-26 18:21:41 +00:00
|
|
|
</template>
|
|
|
|
<template #default><slot /></template>
|
|
|
|
</FormField>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import FormField from '../FormField.vue';
|
2023-01-27 16:27:14 +00:00
|
|
|
import SelectVue from '../base/Select.vue';
|
|
|
|
import { SelectOption } from '../form.types';
|
2023-01-26 18:21:41 +00:00
|
|
|
|
|
|
|
const props = withDefaults(
|
|
|
|
defineProps<{
|
|
|
|
label: string;
|
|
|
|
name: string;
|
|
|
|
options: SelectOption[];
|
|
|
|
disabled?: boolean;
|
|
|
|
placeholder?: string;
|
|
|
|
}>(),
|
|
|
|
{
|
|
|
|
disabled: false,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
</script>
|