set defaultValue in Field component
This commit is contained in:
parent
7ed18caa31
commit
5b58bd9be6
|
@ -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}
|
||||||
|
|
Loading…
Reference in New Issue