Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(grid): 修复批量生成值后保存快捷键失效

zipg4311ace96011
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue
index e55bd2658d..04d496ccfe 100644
--- a/apps/desktop/src/components/grid/DataGrid.vue
+++ b/apps/desktop/src/components/grid/DataGrid.vue
@@ -6464,7 +6464,10 @@ function applyGeneratedSelectionValue(kind: CellValueGenerationKind, startValue
} finally {
commitBatch();
}
- if (applied) toast(t("grid.generatedValuesApplied", { count: cells.length }));
+ if (applied) {
+ toast(t("grid.generatedValuesApplied", { count: cells.length }));
+ void nextTick(() => window.requestAnimationFrame(() => gridRef.value?.focus({ preventScroll: true })));
+ }
return applied;
}
diff --git a/packages/app-tests/dataGridContextMenu.test.ts b/packages/app-tests/dataGridContextMenu.test.ts
index c7d665fa2f..e2e95d43fe 100644
--- a/packages/app-tests/dataGridContextMenu.test.ts
+++ b/packages/app-tests/dataGridContextMenu.test.ts
@@ -23,6 +23,12 @@ test("set NULL applies a real null value only to editable selections", () => {
assert.doesNotMatch(handler, /fillSelectionWithValue\(["'](?:NULL)?["']\)/);
});
+test("generated selection values restore grid focus for keyboard shortcuts", () => {
+ const applyHandler = dataGridSource.match(/function applyGeneratedSelectionValue\([^]*?\n\}/)?.[0] ?? "";
+
+ assert.match(applyHandler, /if \(applied\)[^]*nextTick\(\(\) => window\.requestAnimationFrame\(\(\) => gridRef\.value\?\.focus\(\{ preventScroll: true \}\)\)\)/);
+});
+
test("column-header context menus defer copy statement generation", () => {
const handler = dataGridSource.match(/function onHeaderContext\([^]*?\n\}/)?.[0] ?? "";