Browse Source

set defaultValue in Field component

master
Bastiaan Terhorst 5 years ago
parent
commit
107aa44308
  1. 8
      packages/client/src/components/app/forms/MultiFieldSelect.svelte

8
packages/client/src/components/app/forms/MultiFieldSelect.svelte

@ -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…
Cancel
Save