Update picker to use null as default placeholder value
This commit is contained in:
parent
edf19c8869
commit
c3a74c5006
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
// Form API contains functions to control the form
|
// Form API contains functions to control the form
|
||||||
const formApi = {
|
const formApi = {
|
||||||
registerField: (field, defaultValue = undefined, fieldDisabled = false) => {
|
registerField: (field, defaultValue = null, fieldDisabled = false) => {
|
||||||
if (!field) {
|
if (!field) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
role="option"
|
role="option"
|
||||||
aria-selected="true"
|
aria-selected="true"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:click={() => onSelectOption(undefined)}>
|
on:click={() => onSelectOption(null)}>
|
||||||
<span class="spectrum-Menu-itemLabel">{placeholderOption}</span>
|
<span class="spectrum-Menu-itemLabel">{placeholderOption}</span>
|
||||||
<svg
|
<svg
|
||||||
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
|
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
const toggleOption = id => {
|
const toggleOption = id => {
|
||||||
if (fieldSchema.relationshipType === "one-to-many") {
|
if (fieldSchema.relationshipType === "one-to-many") {
|
||||||
fieldApi.setValue([{ _id: id }])
|
fieldApi.setValue(id ? [{ _id: id }] : [])
|
||||||
} else {
|
} else {
|
||||||
if ($fieldState.value.find(option => option?._id === id)) {
|
if ($fieldState.value.find(option => option?._id === id)) {
|
||||||
const filtered = $fieldState.value.filter(option => option?._id !== id)
|
const filtered = $fieldState.value.filter(option => option?._id !== id)
|
||||||
|
|
Loading…
Reference in New Issue