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
|
||||
const formApi = {
|
||||
registerField: (field, defaultValue = undefined, fieldDisabled = false) => {
|
||||
registerField: (field, defaultValue = null, fieldDisabled = false) => {
|
||||
if (!field) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
role="option"
|
||||
aria-selected="true"
|
||||
tabindex="0"
|
||||
on:click={() => onSelectOption(undefined)}>
|
||||
on:click={() => onSelectOption(null)}>
|
||||
<span class="spectrum-Menu-itemLabel">{placeholderOption}</span>
|
||||
<svg
|
||||
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
const toggleOption = id => {
|
||||
if (fieldSchema.relationshipType === "one-to-many") {
|
||||
fieldApi.setValue([{ _id: id }])
|
||||
fieldApi.setValue(id ? [{ _id: id }] : [])
|
||||
} else {
|
||||
if ($fieldState.value.find(option => option?._id === id)) {
|
||||
const filtered = $fieldState.value.filter(option => option?._id !== id)
|
||||
|
|
Loading…
Reference in New Issue