Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: more scrollbar fixes (#14439)

Liu Ji00836da90429
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue
index a3e746c7bb..f46045b4ad 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue
@@ -12,10 +12,12 @@
class="header-track absolute z-0 left-0 top-0 right-0 h-[34px] border border-block-border bg-gray-50 dark:bg-gray-700"
/>
- <div
- ref="scrollerRef"
- class="inner-wrapper max-h-full w-full overflow-auto border-y border-r border-block-border fix-scrollbar-z-index"
+ <NScrollbar
+ ref="scrollbarRef"
+ class="inner-wrapper !h-auto max-h-full w-full overflow-auto border-y border-r border-block-border fix-scrollbar-z-index"
:class="rows.length === 0 && 'border-r-0 hide-scrollbar'"
+ :x-scrollable="true"
+ trigger="none"
>
<table
ref="tableRef"
@@ -98,7 +100,7 @@
</tr>
</tbody>
</table>
- </div>
+ </NScrollbar>
<div
v-if="rows.length === 0"
@@ -122,7 +124,7 @@
<script lang="ts" setup>
import type { Table } from "@tanstack/vue-table";
import { useElementSize } from "@vueuse/core";
-import { NEmpty } from "naive-ui";
+import { NEmpty, NScrollbar } from "naive-ui";
import { computed, nextTick, ref, watch } from "vue";
import {
FeatureBadge,
@@ -152,10 +154,13 @@ const props = defineProps<{
}>();
const containerRef = ref<HTMLDivElement>();
-const scrollerRef = ref<HTMLDivElement>();
+const scrollbarRef = ref<InstanceType<typeof NScrollbar>>();
const tableRef = ref<HTMLTableElement>();
const subscriptionStore = useSubscriptionV1Store();
const { height: containerHeight } = useElementSize(containerRef);
+const scrollerRef = computed(() => {
+ return scrollbarRef.value?.scrollbarInstRef?.containerRef;
+});
usePreventBackAndForward(scrollerRef);
const tableResize = useTableColumnWidthLogic({
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/useTableResize.ts b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/useTableResize.ts
index 2e29b6b42b..5179e85b6a 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/useTableResize.ts
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/useTableResize.ts
@@ -5,7 +5,7 @@ import { computed, onBeforeUnmount, reactive, watch } from "vue";
export type TableResizeOptions = {
tableRef: Ref<HTMLTableElement | undefined>;
- scrollerRef: Ref<HTMLElement | undefined>;
+ scrollerRef: Ref<HTMLElement | null | undefined>;
minWidth: number;
maxWidth: number;
};
@@ -220,7 +220,7 @@ const getElementWidth = (elem: HTMLElement) => {
return rect.width;
};
-const scrollMaxX = (elem: HTMLElement | undefined) => {
+const scrollMaxX = (elem: HTMLElement | null | undefined) => {
if (!elem) return;
const max = elem.scrollWidth;
elem.scrollTo(max, elem.scrollTop);
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTableLite/DataTableLite.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTableLite/DataTableLite.vue
index 5bc8ee32a0..c5b698ee02 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTableLite/DataTableLite.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTableLite/DataTableLite.vue
@@ -30,6 +30,9 @@
:min-row-height="ROW_HEIGHT"
:height-for-row="() => ROW_HEIGHT"
:scroll-x="tableResize.getTableScrollWidth()"
+ :scrollbar-props="{
+ trigger: 'none',
+ }"
table-layout="fixed"
size="small"
class="relative z-[1] -mr-px"