1
0
Fork 0
mirror of synced 2024-06-27 18:40:42 +12:00

Update picker to use null as default placeholder value

This commit is contained in:
Andrew Kingston 2021-02-25 11:34:11 +00:00
parent 635ea2b38e
commit 45d9845806
3 changed files with 3 additions and 3 deletions

View file

@ -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
}

View file

@ -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"

View file

@ -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)