feat: auto-scroll to bottom when adding a new row in DataGrid
This commit is contained in:
parent
b976d5c06d
commit
d26173e0eb
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue