1
0
Fork 0
mirror of synced 2024-10-01 09:38:55 +13:00

set defaultValue in Field component

This commit is contained in:
Bastiaan Terhorst 2022-01-19 09:19:49 +01:00
parent 54a1c84179
commit 107aa44308

View file

@ -20,8 +20,7 @@
let fieldSchema let fieldSchema
$: flatOptions = optionsSource == null || optionsSource === "schema" $: flatOptions = optionsSource == null || optionsSource === "schema"
$: expandedDefaultValue = expand(fieldState?.defaultValue) $: expandedDefaultValue = expand(defaultValue)
$: expandedValue = expand(fieldState?.value)
$: options = getOptions( $: options = getOptions(
optionsSource, optionsSource,
fieldSchema, fieldSchema,
@ -49,7 +48,7 @@
{label} {label}
{disabled} {disabled}
{validation} {validation}
{defaultValue} defaultValue={expandedDefaultValue}
type="array" type="array"
bind:fieldState bind:fieldState
bind:fieldApi bind:fieldApi
@ -57,8 +56,7 @@
> >
{#if fieldState} {#if fieldState}
<CoreMultiselect <CoreMultiselect
value={expandedValue} value={fieldState.value || []}
defaultValue={expandedDefaultValue}
error={fieldState.error} error={fieldState.error}
getOptionLabel={flatOptions ? x => x : x => x.label} getOptionLabel={flatOptions ? x => x : x => x.label}
getOptionValue={flatOptions ? x => x : x => x.value} getOptionValue={flatOptions ? x => x : x => x.value}