Browse Source

fix: Removed manual auto scrolling as its not required since browser list maintains its scroll position of item even if top items are removed if there space to scroll top

pull/6802/head
Muhammed Mustafa 1 year ago
parent
commit
349e0c64d2
  1. 10
      packages/nc-gui/components/dashboard/Sidebar.vue
  2. 8
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
  3. 5
      packages/nc-gui/components/dashboard/TreeView/TableList.vue
  4. 2
      packages/nc-gui/components/dashboard/TreeView/TableNode.vue
  5. 6
      packages/nc-gui/components/dashboard/TreeView/index.vue

10
packages/nc-gui/components/dashboard/Sidebar.vue

@ -31,14 +31,6 @@ onMounted(() => {
onUnmounted(() => {
treeViewDom.value?.removeEventListener('scroll', checkScrollTopMoreThanZero)
})
const onOpenTable = (scrollDown: boolean) => {
if (scrollDown && treeViewDom.value && !isMobileMode.value) {
nextTick(() => {
treeViewDom.value!.scrollTop = treeViewDom.value!.scrollTop - 8
})
}
}
</script>
<template>
@ -62,7 +54,7 @@ const onOpenTable = (scrollDown: boolean) => {
'pt-0.25': isSharedBase,
}"
>
<DashboardTreeView v-if="!isWorkspaceLoading" @open-table="onOpenTable" />
<DashboardTreeView v-if="!isWorkspaceLoading" />
</div>
<div v-if="!isSharedBase">
<DashboardSidebarUserInfo />

8
packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue

@ -365,10 +365,6 @@ const projectDelete = () => {
isProjectDeleteDialogVisible.value = true
$e('c:project:delete')
}
const onOpenTable = (scrollDown: boolean) => {
emit('openTable', scrollDown)
}
</script>
<template>
@ -588,7 +584,7 @@ const onOpenTable = (scrollDown: boolean) => {
<div class="flex-1 overflow-y-auto overflow-x-hidden flex flex-col" :class="{ 'mb-[20px]': isSharedBase }">
<div v-if="base?.sources?.[0]?.enabled" class="flex-1">
<div class="transition-height duration-200">
<DashboardTreeViewTableList :base="base" :source-index="0" @open-table="onOpenTable" />
<DashboardTreeViewTableList :base="base" :source-index="0" />
</div>
</div>
@ -702,7 +698,7 @@ const onOpenTable = (scrollDown: boolean) => {
:key="`sortable-${source.id}-${source.id && source.id in keys ? keys[source.id] : '0'}`"
:nc-source="source.id"
>
<DashboardTreeViewTableList :base="base" :source-index="sourceIndex" @open-table="onOpenTable" />
<DashboardTreeViewTableList :base="base" :source-index="sourceIndex" />
</div>
</a-collapse-panel>
</a-collapse>

5
packages/nc-gui/components/dashboard/TreeView/TableList.vue

@ -131,10 +131,6 @@ watchEffect(() => {
const availableTables = computed(() => {
return tables.value.filter((table) => table.source_id === base.value?.sources?.[sourceIndex.value].id)
})
const onOpenTable = (scrollDown: boolean) => {
emit('openTable', scrollDown)
}
</script>
<template>
@ -168,7 +164,6 @@ const onOpenTable = (scrollDown: boolean) => {
:data-title="table.title"
:data-source-id="source?.id"
:data-type="table.type"
@open-table="onOpenTable"
>
</TableNode>
</div>

2
packages/nc-gui/components/dashboard/TreeView/TableNode.vue

@ -122,8 +122,6 @@ const onOpenTable = async () => {
if (isMobileMode.value) {
isLeftSidebarOpen.value = false
}
if (!showCreateViewAllTimes.value) emit('openTable', true)
} catch (e) {
message.error(await extractSdkResponseErrorMsg(e))
} finally {

6
packages/nc-gui/components/dashboard/TreeView/index.vue

@ -223,10 +223,6 @@ watch(
immediate: true,
},
)
const onOpenTable = (scrollDown: boolean) => {
emit('openTable', scrollDown)
}
</script>
<template>
@ -235,7 +231,7 @@ const onOpenTable = (scrollDown: boolean) => {
<div mode="inline" class="nc-treeview pb-0.5 flex-grow min-h-50 overflow-x-hidden">
<template v-if="basesList?.length">
<ProjectWrapper v-for="base of basesList" :key="base.id" :base-role="base.project_role" :base="base">
<DashboardTreeViewProjectNode @open-table="onOpenTable" />
<DashboardTreeViewProjectNode />
</ProjectWrapper>
</template>

Loading…
Cancel
Save