Unify selectedValue func
This commit is contained in:
parent
013f00e90d
commit
06d881aa7f
|
@ -39,8 +39,9 @@
|
||||||
|
|
||||||
$: options = $fetch.rows
|
$: options = $fetch.rows
|
||||||
$: tableDefinition = $fetch.definition
|
$: tableDefinition = $fetch.definition
|
||||||
$: singleValue = flatten(fieldState?.value)?.[0]
|
$: selectedValue = multiselect
|
||||||
$: multiValue = flatten(fieldState?.value) ?? []
|
? flatten(fieldState?.value) ?? []
|
||||||
|
: flatten(fieldState?.value)?.[0]
|
||||||
$: component = multiselect ? CoreMultiselect : CoreSelect
|
$: component = multiselect ? CoreMultiselect : CoreSelect
|
||||||
$: expandedDefaultValue = expand(defaultValue)
|
$: expandedDefaultValue = expand(defaultValue)
|
||||||
$: primaryDisplay = tableDefinition?.primaryDisplay || "_id"
|
$: primaryDisplay = tableDefinition?.primaryDisplay || "_id"
|
||||||
|
@ -121,7 +122,7 @@
|
||||||
this={component}
|
this={component}
|
||||||
{options}
|
{options}
|
||||||
{autocomplete}
|
{autocomplete}
|
||||||
value={multiselect ? multiValue : singleValue}
|
value={selectedValue}
|
||||||
on:change={multiselect ? multiHandler : singleHandler}
|
on:change={multiselect ? multiHandler : singleHandler}
|
||||||
id={fieldState.fieldId}
|
id={fieldState.fieldId}
|
||||||
disabled={fieldState.disabled}
|
disabled={fieldState.disabled}
|
||||||
|
|
Loading…
Reference in New Issue