Browse Source

feat: expand all bases while searching

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3573/head
mertmit 2 years ago
parent
commit
38fa085f08
  1. 13
      packages/nc-gui/components/dashboard/TreeView.vue

13
packages/nc-gui/components/dashboard/TreeView.vue

@ -240,9 +240,18 @@ function openTableCreateDialog(baseId?: string) {
const searchInputRef: VNodeRef = (vnode: typeof Input) => vnode?.$el?.focus() const searchInputRef: VNodeRef = (vnode: typeof Input) => vnode?.$el?.focus()
const beforeSearch = ref<string[]>([])
const onSearchCloseIconClick = () => { const onSearchCloseIconClick = () => {
filterQuery = '' filterQuery = ''
toggleSearchActive(false) toggleSearchActive(false)
activeKey.value = beforeSearch.value
}
const onSearchIconClick = () => {
beforeSearch.value = activeKey.value
toggleSearchActive(true)
activeKey.value = bases.value.filter((el) => el.enabled).map((el) => `collapse-${el.id}`)
} }
const isCreateTableAllowed = computed( const isCreateTableAllowed = computed(
@ -348,7 +357,7 @@ watch(
<Transition name="slide-right" mode="out-in"> <Transition name="slide-right" mode="out-in">
<MdiClose v-if="searchActive" class="text-lg mx-1 mt-0.5" @click="onSearchCloseIconClick" /> <MdiClose v-if="searchActive" class="text-lg mx-1 mt-0.5" @click="onSearchCloseIconClick" />
<IcRoundSearch v-else class="text-lg text-primary mx-1 mt-0.5" @click="toggleSearchActive(true)" /> <IcRoundSearch v-else class="text-lg text-primary mx-1 mt-0.5" @click="onSearchIconClick" />
</Transition> </Transition>
<a-dropdown v-if="!isSharedBase" :trigger="['click']" overlay-class-name="nc-dropdown-import-menu" @click.stop> <a-dropdown v-if="!isSharedBase" :trigger="['click']" overlay-class-name="nc-dropdown-import-menu" @click.stop>
@ -611,7 +620,7 @@ watch(
:class="[{ hidden: searchActive && !!filterQuery && !filteredTables?.find((el) => el.base_id === base.id) }]" :class="[{ hidden: searchActive && !!filterQuery && !filteredTables?.find((el) => el.base_id === base.id) }]"
expand-icon-position="right" expand-icon-position="right"
:bordered="false" :bordered="false"
accordion :accordion="!searchActive"
ghost ghost
> >
<a-collapse-panel :key="`collapse-${base.id}`"> <a-collapse-panel :key="`collapse-${base.id}`">

Loading…
Cancel
Save