|
|
@ -19,6 +19,7 @@ |
|
|
let fieldApi |
|
|
let fieldApi |
|
|
let fieldSchema |
|
|
let fieldSchema |
|
|
|
|
|
|
|
|
|
|
|
$: safeDefaultValue = getSafeDefaultValue(defaultValue) |
|
|
$: flatOptions = optionsSource == null || optionsSource === "schema" |
|
|
$: flatOptions = optionsSource == null || optionsSource === "schema" |
|
|
$: options = getOptions( |
|
|
$: options = getOptions( |
|
|
optionsSource, |
|
|
optionsSource, |
|
|
@ -28,6 +29,16 @@ |
|
|
valueColumn, |
|
|
valueColumn, |
|
|
customOptions |
|
|
customOptions |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const getSafeDefaultValue = value => { |
|
|
|
|
|
if (value == null || value === "") { |
|
|
|
|
|
return [] |
|
|
|
|
|
} |
|
|
|
|
|
if (!Array.isArray(value)) { |
|
|
|
|
|
return [value] |
|
|
|
|
|
} |
|
|
|
|
|
return value |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<Field |
|
|
<Field |
|
|
@ -35,7 +46,7 @@ |
|
|
{label} |
|
|
{label} |
|
|
{disabled} |
|
|
{disabled} |
|
|
{validation} |
|
|
{validation} |
|
|
{defaultValue} |
|
|
defaultValue={safeDefaultValue} |
|
|
type="array" |
|
|
type="array" |
|
|
bind:fieldState |
|
|
bind:fieldState |
|
|
bind:fieldApi |
|
|
bind:fieldApi |
|
|
|