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。

feat: auto-scroll to bottom when adding a new row in DataGrid

t8y2d26173e0eb4f
diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json
index fd3fb8505b..17611090df 100644
--- a/src-tauri/capabilities/default.json
+++ b/src-tauri/capabilities/default.json
@@ -9,6 +9,7 @@
"core:default",
"core:window:allow-show",
"core:window:allow-hide",
+ "core:window:allow-set-theme",
"dialog:default",
"dialog:allow-save",
"dialog:allow-open",
diff --git a/src/App.vue b/src/App.vue
index 7f19ca1928..e5d96ebc3e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -20,6 +20,7 @@ import { useConnectionStore } from "@/stores/connectionStore";
import { useQueryStore } from "@/stores/queryStore";
import { useHistoryStore } from "@/stores/historyStore";
import { setLocale, currentLocale, type Locale } from "@/i18n";
+import { getCurrentWindow, type Theme } from "@tauri-apps/api/window";
import * as api from "@/lib/tauri";
const { t } = useI18n();
@@ -187,6 +188,7 @@ const isDark = ref(localStorage.getItem("dbx-theme") === "dark");
function applyTheme() {
document.documentElement.classList.toggle("dark", isDark.value);
+ getCurrentWindow().setTheme(isDark.value ? "dark" as Theme : "light" as Theme);
}
function toggleTheme() {
diff --git a/src/components/grid/DataGrid.vue b/src/components/grid/DataGrid.vue
index f1b0fe77e9..a57c97d060 100644
--- a/src/components/grid/DataGrid.vue
+++ b/src/components/grid/DataGrid.vue
@@ -315,6 +315,10 @@ function onEditKeydown(e: KeyboardEvent) {
function addRow() {
newRows.value.push(props.result.columns.map(() => null));
+ nextTick(() => {
+ const el = getScrollerElement();
+ if (el) el.scrollTop = el.scrollHeight;
+ });
}
function deleteSelectedRow() {