feat(structure): unify scrollbars and restore column scrolling

This commit is contained in:
gggaiitx authored and GitHub committed 2026-09-18 20:05:49 +08:00
1 parent 9788c20d3c
commit 3597a00759
5 files changed
+261 -28

No files matched your search

@@ -5032,7 +5032,7 @@ watch(
<div ref="structureHorizontalScrollbarThumbRef" class="structure-horizontal-scrollbar__thumb" />
</div>
<TabsContent ref="foreignKeysScrollerRef" v-if="tableMetadataCapabilities.foreignKeys" value="foreignKeys" class="m-0 min-h-0 flex-1 overflow-auto p-[var(--structure-cell-px)]" @scroll.passive="onStructureContentScroll('foreignKeys', $event)">
<TabsContent ref="foreignKeysScrollerRef" v-if="tableMetadataCapabilities.foreignKeys" value="foreignKeys" class="structure-card-scroller m-0 min-h-0 flex-1 overflow-auto p-[var(--structure-cell-px)]" @scroll.passive="onStructureContentScroll('foreignKeys', $event)">
<div v-if="foreignKeysLoading" class="flex items-center justify-center gap-2 py-10 text-muted-foreground">
<Loader2 class="h-4 w-4 animate-spin" />
{{ t("common.loading") }}
@@ -5085,7 +5085,7 @@ watch(
</div>
</TabsContent>
<TabsContent ref="constraintsScrollerRef" v-if="tableMetadataCapabilities.constraints" value="constraints" class="m-0 min-h-0 flex-1 overflow-auto p-[var(--structure-cell-px)]" @scroll.passive="onStructureContentScroll('constraints', $event)">
<TabsContent ref="constraintsScrollerRef" v-if="tableMetadataCapabilities.constraints" value="constraints" class="structure-card-scroller m-0 min-h-0 flex-1 overflow-auto p-[var(--structure-cell-px)]" @scroll.passive="onStructureContentScroll('constraints', $event)">
<div v-if="constraintsLoading" class="flex items-center justify-center gap-2 py-10 text-muted-foreground">
<Loader2 class="h-4 w-4 animate-spin" />
{{ t("common.loading") }}
@@ -5111,7 +5111,7 @@ watch(
</div>
</TabsContent>
<TabsContent ref="triggersScrollerRef" v-if="tableMetadataCapabilities.triggers" value="triggers" class="m-0 min-h-0 flex-1 overflow-auto p-[var(--structure-cell-px)]" @scroll.passive="onStructureContentScroll('triggers', $event)">
<TabsContent ref="triggersScrollerRef" v-if="tableMetadataCapabilities.triggers" value="triggers" class="structure-card-scroller m-0 min-h-0 flex-1 overflow-auto p-[var(--structure-cell-px)]" @scroll.passive="onStructureContentScroll('triggers', $event)">
<div v-if="triggersLoading" class="flex items-center justify-center gap-2 py-10 text-muted-foreground">
<Loader2 class="h-4 w-4 animate-spin" />
{{ t("common.loading") }}
@@ -5197,7 +5197,7 @@ watch(
</div>
</TabsContent>
<TabsContent ref="ddlScrollerRef" v-if="tableMetadataCapabilities.ddl" value="ddl" force-mount class="relative m-0 min-h-0 flex-1 overflow-auto p-[var(--structure-cell-px)] data-[state=inactive]:hidden" @scroll.passive="onStructureContentScroll('ddl', $event)">
<TabsContent ref="ddlScrollerRef" v-if="tableMetadataCapabilities.ddl" value="ddl" force-mount class="structure-card-scroller relative m-0 min-h-0 flex-1 overflow-auto p-[var(--structure-cell-px)] data-[state=inactive]:hidden" @scroll.passive="onStructureContentScroll('ddl', $event)">
<div v-if="ddlLoading" class="flex items-center justify-center gap-2 py-10 text-muted-foreground">
<Loader2 class="h-4 w-4 animate-spin" />
{{ t("common.loading") }}
@@ -5411,18 +5411,87 @@ watch(
background: var(--dbx-editor-selection-background, rgba(59, 130, 246, 0.35)) !important;
}
/* DDL (CodeMirror) scrollbars match the grid scroller style. */
.structure-ddl-editor :deep(.cm-scroller::-webkit-scrollbar) {
width: 10px;
height: 10px;
}
.structure-ddl-editor :deep(.cm-scroller::-webkit-scrollbar-track) {
background: transparent;
}
.structure-ddl-editor :deep(.cm-scroller::-webkit-scrollbar-thumb) {
background: rgba(82, 82, 82, 0.3);
background: color-mix(in oklab, var(--foreground) 30%, transparent);
border: 3px solid transparent;
background-clip: padding-box;
border-radius: 999px;
}
.structure-ddl-editor :deep(.cm-scroller::-webkit-scrollbar-thumb:hover) {
background: rgba(82, 82, 82, 0.48);
background: color-mix(in oklab, var(--foreground) 48%, transparent);
border-width: 2px;
background-clip: padding-box;
}
.structure-table-scroller::-webkit-scrollbar {
width: 8px;
width: 10px;
height: 0;
}
/* Foreign keys / constraints / triggers card lists: both scrollbars match. */
.structure-card-scroller::-webkit-scrollbar {
width: 10px;
height: 10px;
}
.structure-card-scroller::-webkit-scrollbar-track {
background: transparent;
}
.structure-card-scroller::-webkit-scrollbar-thumb {
background: rgba(82, 82, 82, 0.3);
background: color-mix(in oklab, var(--foreground) 30%, transparent);
border: 3px solid transparent;
background-clip: padding-box;
border-radius: 999px;
}
.structure-card-scroller::-webkit-scrollbar-thumb:hover {
background: rgba(82, 82, 82, 0.48);
background: color-mix(in oklab, var(--foreground) 48%, transparent);
border-width: 2px;
background-clip: padding-box;
}
.structure-table-scroller::-webkit-scrollbar-track {
background: transparent;
}
.structure-table-scroller::-webkit-scrollbar-thumb {
background: rgba(82, 82, 82, 0.3);
background: color-mix(in oklab, var(--foreground) 30%, transparent);
border: 3px solid transparent;
background-clip: padding-box;
border-radius: 999px;
}
.structure-table-scroller::-webkit-scrollbar-thumb:hover {
background: rgba(82, 82, 82, 0.48);
background: color-mix(in oklab, var(--foreground) 48%, transparent);
border-width: 2px;
background-clip: padding-box;
}
.structure-horizontal-scrollbar {
position: relative;
height: 10px;
flex-shrink: 0;
cursor: pointer;
touch-action: none;
background: var(--background);
background: transparent;
}
.structure-horizontal-scrollbar__thumb {
@@ -5431,6 +5500,7 @@ watch(
height: 4px;
min-width: 24px;
border-radius: 999px;
background: rgba(82, 82, 82, 0.3);
background: color-mix(in oklab, var(--foreground) 30%, transparent);
transition:
top 120ms ease,
@@ -5442,6 +5512,7 @@ watch(
.structure-horizontal-scrollbar--dragging .structure-horizontal-scrollbar__thumb {
top: 2px;
height: 6px;
background: rgba(82, 82, 82, 0.48);
background: color-mix(in oklab, var(--foreground) 48%, transparent);
}
@@ -5493,3 +5564,46 @@ watch(
background-color: var(--background);
}
</style>
<style>
/* Non-scoped so the scrollbar pseudo-elements on CodeMirror's cm-scroller actually match in WebView2.
Matches the grid / card scroller scrollbar style (10px track, 4px thumb, 6px on hover). */
.structure-ddl-editor .cm-scroller::-webkit-scrollbar {
width: 10px;
height: 10px;
}
.structure-ddl-editor .cm-scroller::-webkit-scrollbar-track {
background: transparent;
}
.structure-ddl-editor .cm-scroller::-webkit-scrollbar-thumb {
background: rgba(82, 82, 82, 0.3);
background: color-mix(in oklab, var(--foreground) 30%, transparent);
border: 3px solid transparent;
background-clip: padding-box;
border-radius: 999px;
}
.structure-ddl-editor .cm-scroller::-webkit-scrollbar-thumb:hover {
background: rgba(82, 82, 82, 0.48);
background: color-mix(in oklab, var(--foreground) 48%, transparent);
border-width: 2px;
background-clip: padding-box;
}
html.dbx-legacy-webview.dark .structure-ddl-editor .cm-scroller::-webkit-scrollbar-thumb,
html.dbx-legacy-webview.dark .structure-card-scroller::-webkit-scrollbar-thumb,
html.dbx-legacy-webview.dark .structure-table-scroller::-webkit-scrollbar-thumb,
html.dbx-legacy-webview.dark .structure-horizontal-scrollbar__thumb {
background: rgba(212, 212, 216, 0.3);
}
html.dbx-legacy-webview.dark .structure-ddl-editor .cm-scroller::-webkit-scrollbar-thumb:hover,
html.dbx-legacy-webview.dark .structure-card-scroller::-webkit-scrollbar-thumb:hover,
html.dbx-legacy-webview.dark .structure-table-scroller::-webkit-scrollbar-thumb:hover,
html.dbx-legacy-webview.dark .structure-horizontal-scrollbar:hover .structure-horizontal-scrollbar__thumb,
html.dbx-legacy-webview.dark .structure-horizontal-scrollbar--dragging .structure-horizontal-scrollbar__thumb {
background: rgba(212, 212, 216, 0.48);
}
</style>