Skip to content

Commit

Permalink
feat(select-menu): add clearable
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaubree committed Jan 19, 2024
1 parent 864e0da commit 1478fde
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/select/USelectMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const props = withDefaults(defineProps<{
isTrailing?: boolean
isLeading?: boolean
isLoading?: boolean
isClearable?: boolean
selectedIcon?: string
isDisabled?: boolean
isMultiple?: boolean
Expand Down Expand Up @@ -50,6 +51,7 @@ const props = withDefaults(defineProps<{
optionAttribute: 'label',
placeholder: 'Sélectionner',
isPadded: true,
isClearable: true,
size: () => useAppUi().select.default.size,
color: () => useAppUi().select.default.color,
variant: () => useAppUi().select.default.variant,
Expand Down Expand Up @@ -140,7 +142,7 @@ function onUpdate(event: T | T[] | string | number | null) {
query.value = ''
searchInput.value.$el.value = ''
}
modelValue.value = JSON.stringify(modelValue.value) === JSON.stringify(event) ? undefined : event
modelValue.value = props.isClearable && JSON.stringify(modelValue.value) === JSON.stringify(event) ? undefined : event
}
watch(container, value => value ? emit('open') : emit('close'))
Expand Down

0 comments on commit 1478fde

Please # to comment.