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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save