1
0
Fork 0
mirror of synced 2024-10-01 01:28:51 +13: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 // 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
} }

View file

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

View file

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