fix(grid): restore scrollbar after closing row transpose

This commit is contained in:
vrustx authored and GitHub committed 2026-07-17 13:48:12 +08:00
1 parent b45bf7077f
commit 7caf9b1feb
3 files changed
+159 -11

No files matched your search

@@ -1,4 +1,5 @@
import { COLUMN_WIDTH_DENSITY_PRESETS, percentileValue } from "@/lib/dataGrid/dataGridColumnWidth";
import { restoredDataGridScrollLeft } from "@/lib/dataGrid/dataGridInfiniteScroll";
import type { ColumnWidthDensity } from "@/stores/settingsStore";
export interface DataGridTransposeState {
@@ -174,6 +175,13 @@ export function nextTransposeState(showTranspose: boolean, transposeRowIndex: nu
return { showTranspose: true, transposeRowIndex: requestedRowIndex };
}
export function restoreDataGridAfterTranspose(options: { scroller: Pick<HTMLElement, "scrollLeft" | "scrollWidth" | "clientWidth"> | null; scrollLeftBeforeTranspose: number; attachCanvasResizeObserver: () => void; refreshGridScrollerMetrics: () => void }) {
if (!options.scroller) return;
options.scroller.scrollLeft = restoredDataGridScrollLeft(options.scrollLeftBeforeTranspose, options.scroller.scrollWidth, options.scroller.clientWidth);
options.attachCanvasResizeObserver();
options.refreshGridScrollerMetrics();
}
export function nextContextTransposeState(options: ContextTransposeStateOptions): DataGridTransposeState {
const anchorRowIndex = transposeAnchorRowIndex(options);
return nextTransposeState(options.showTranspose, options.transposeRowIndex, anchorRowIndex);