Skip to content

Commit e6032af

Browse files
committed
Enhancements : improve most recent global search UI
- Fixes remove person filter/chip when applied - Close person searchable filter via workaround Resolves : #41381 Signed-off-by: fenn-cs <[email protected]>
1 parent 13b6e17 commit e6032af

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

core/src/components/GlobalSearch/SearchableList.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
-->
2222

2323
<template>
24-
<NcPopover :shown="opened">
24+
<NcPopover>
2525
<template #trigger>
26-
<slot name="trigger" />
26+
<slot ref="popoverTrigger" name="trigger" />
2727
</template>
2828
<div class="searchable-list__wrapper">
2929
<NcTextField :value.sync="searchTerm"
@@ -122,7 +122,6 @@ export default {
122122
itemSelected(element) {
123123
this.$emit('item-selected', element)
124124
this.clearSearch()
125-
this.opened = false
126125
},
127126
},
128127
}

core/src/views/GlobalSearchModal.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
:empty-content-text="t('core', 'Not found')"
5858
@item-selected="applyPersonFilter">
5959
<template #trigger>
60-
<NcButton>
60+
<NcButton ref="peopleFilterTrigger">
6161
<template #icon>
6262
<AccountGroup :size="20" />
6363
</template>
@@ -357,6 +357,15 @@ export default {
357357
this.personFilter.user = person.user
358358
this.personFilter.name = person.displayName
359359
this.filters.push(this.personFilter)
360+
/*
361+
* Workaround to close SearchableList
362+
* NcPopover used in the SearchableList component does have
363+
* any prop/external state used to manage it's open status
364+
* according to https://nextcloud-vue-components.netlify.app/#/Components/NcPopover.
365+
* `:shown=''` prop used on NcPopover
366+
* as well as as `v-close-popper` on the list items in searchable list did not work
367+
*/
368+
this.$refs.peopleFilterTrigger.$el.click()
360369
} else {
361370
this.filters[existingPersonFilter].id = person.id
362371
this.filters[existingPersonFilter].user = person.user
@@ -397,7 +406,8 @@ export default {
397406
398407
} else {
399408
for (let i = 0; i < this.filters.length; i++) {
400-
if (this.filters[i].id === 'date') {
409+
// Remove date and person filter
410+
if (this.filters[i].id === 'date' || this.filters[i].id === filter.id) {
401411
this.dateFilterIsApplied = false
402412
this.filters.splice(i, 1)
403413
break

0 commit comments

Comments
 (0)