Skip to content

Commit c5fe6aa

Browse files
committed
open comobox on click of select tag component
1 parent fea7eef commit c5fe6aa

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

frontend/src/components/ui/select/SelectTag.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- Tags visible to the user -->
44
<div class="flex gap-2 flex-wrap items-center px-3">
55
<TagsInputItem v-for="tagValue in tags" :key="tagValue" :value="tagValue">
6-
<TagsInputItemText/>
6+
<TagsInputItemText />
77
<TagsInputItemDelete />
88
</TagsInputItem>
99
</div>
@@ -23,6 +23,7 @@
2323
:class="tags.length > 0 ? 'mt-2' : ''"
2424
@keydown.enter.prevent
2525
@blur="handleBlur"
26+
@click="open = true"
2627
/>
2728
</ComboboxInput>
2829
</ComboboxAnchor>
@@ -99,11 +100,14 @@ const open = ref(false)
99100
const searchTerm = ref('')
100101
101102
// Get all options that are not already selected and match the search term
103+
// If not search term is provided, return all available options
102104
const filteredOptions = computed(() => {
103-
return props.items.filter(
104-
(item) =>
105-
!tags.value.includes(item.value) &&
106-
item.label.toLowerCase().includes(searchTerm.value.toLowerCase())
105+
const available = props.items.filter((item) => !tags.value.includes(item.value))
106+
107+
if (!searchTerm.value) return available
108+
109+
return available.filter((item) =>
110+
item.label.toLowerCase().includes(searchTerm.value.toLowerCase())
107111
)
108112
})
109113
@@ -127,6 +131,8 @@ const handleSelect = (event) => {
127131
// Custom filter function to filter items based on the search term
128132
const filterFunc = (remainingItemValues, term) => {
129133
const remainingItems = props.items.filter((item) => remainingItemValues.includes(item.value))
130-
return remainingItems.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())).map(item => item.value)
134+
return remainingItems
135+
.filter((item) => item.label.toLowerCase().includes(term.toLowerCase()))
136+
.map((item) => item.value)
131137
}
132138
</script>

0 commit comments

Comments
 (0)