Browse Source
Merge pull request #41792 from nextcloud/avoid-mutating-prop
Handle close GlobalSearchModal gracefully
pull/41785/head
Ferdinand Thiessen
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
15 additions and
6 deletions
-
core/src/views/GlobalSearch.vue
-
core/src/views/GlobalSearchModal.vue
-
dist/core-global-search.js
-
dist/core-global-search.js.map
|
|
|
@ -26,7 +26,7 @@ |
|
|
|
<Magnify class="global-search__trigger" :size="22" /> |
|
|
|
</template> |
|
|
|
</NcButton> |
|
|
|
<GlobalSearchModal :is-visible="showGlobalSearch" :class="'global-search-modal'" /> |
|
|
|
<GlobalSearchModal :class="'global-search-modal'" :is-visible="showGlobalSearch" @update:isVisible="handleModalVisibilityChange" /> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -54,6 +54,9 @@ export default { |
|
|
|
toggleGlobalSearch() { |
|
|
|
this.showGlobalSearch = !this.showGlobalSearch |
|
|
|
}, |
|
|
|
handleModalVisibilityChange(newVisibilityVal) { |
|
|
|
this.showGlobalSearch = newVisibilityVal |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
@ -2,7 +2,7 @@ |
|
|
|
<NcModal id="global-search" |
|
|
|
ref="globalSearchModal" |
|
|
|
:name="t('core', 'Global search')" |
|
|
|
:show.sync="isVisible" |
|
|
|
:show.sync="internalIsVisible" |
|
|
|
:clear-view-delay="0" |
|
|
|
:title="t('Global search')" |
|
|
|
@close="closeModal"> |
|
|
|
@ -200,6 +200,7 @@ export default { |
|
|
|
contacts: [], |
|
|
|
debouncedFind: debounce(this.find, 300), |
|
|
|
showDateRangeModal: false, |
|
|
|
internalIsVisible: false, |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
@ -224,12 +225,17 @@ export default { |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
isVisible(value) { |
|
|
|
this.internalIsVisible = value |
|
|
|
}, |
|
|
|
internalIsVisible(value) { |
|
|
|
this.$emit('update:isVisible', value) |
|
|
|
this.$nextTick(() => { |
|
|
|
if (value) { |
|
|
|
this.focusInput() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
getProviders().then((providers) => { |
|
|
|
@ -519,7 +525,7 @@ export default { |
|
|
|
this.$refs.searchInput.$el.children[0].children[0].focus() |
|
|
|
}, |
|
|
|
closeModal() { |
|
|
|
this.$refs.globalSearchModal.close() |
|
|
|
this.internalIsVisible = false |
|
|
|
this.searchQuery = '' |
|
|
|
}, |
|
|
|
supportFiltering() { |
|
|
|
|