2021-01-27 11:59:05 +01:00
|
|
|
<script>
|
2021-04-15 20:43:18 +02:00
|
|
|
import { CoreSelect } from "@budibase/bbui"
|
2021-02-05 11:53:25 +01:00
|
|
|
import Field from "./Field.svelte"
|
2021-01-27 11:59:05 +01:00
|
|
|
|
|
|
|
export let field
|
|
|
|
export let label
|
|
|
|
export let placeholder
|
2021-02-17 16:16:44 +01:00
|
|
|
export let disabled = false
|
2021-01-27 11:59:05 +01:00
|
|
|
|
2021-01-28 09:47:44 +01:00
|
|
|
let fieldState
|
|
|
|
let fieldApi
|
|
|
|
let fieldSchema
|
2021-01-27 11:59:05 +01:00
|
|
|
</script>
|
|
|
|
|
2021-02-05 11:53:25 +01:00
|
|
|
<Field
|
|
|
|
{field}
|
|
|
|
{label}
|
2021-02-17 16:16:44 +01:00
|
|
|
{disabled}
|
2021-02-05 11:53:25 +01:00
|
|
|
type="options"
|
|
|
|
bind:fieldState
|
|
|
|
bind:fieldApi
|
2021-05-04 12:04:42 +02:00
|
|
|
bind:fieldSchema
|
|
|
|
>
|
2021-01-28 09:47:44 +01:00
|
|
|
{#if fieldState}
|
2021-04-15 20:43:18 +02:00
|
|
|
<CoreSelect
|
2021-04-15 12:51:18 +02:00
|
|
|
value={$fieldState.value}
|
2021-04-16 15:30:33 +02:00
|
|
|
id={$fieldState.fieldId}
|
2021-04-15 12:51:18 +02:00
|
|
|
disabled={$fieldState.disabled}
|
|
|
|
error={$fieldState.error}
|
|
|
|
options={fieldSchema?.constraints?.inclusion ?? []}
|
|
|
|
{placeholder}
|
2021-05-04 12:32:22 +02:00
|
|
|
on:change={e => fieldApi.setValue(e.detail)}
|
2021-05-04 12:04:42 +02:00
|
|
|
/>
|
2021-01-28 09:47:44 +01:00
|
|
|
{/if}
|
2021-02-05 11:53:25 +01:00
|
|
|
</Field>
|