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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(grid): expand multiline WHERE conditions after paste
zipg9e0381f73773
diff --git a/apps/desktop/src/components/grid/DataGridConditionEditor.vue b/apps/desktop/src/components/grid/DataGridConditionEditor.vueindex 3f8b709a2d..6c242ab7b8 100644--- a/apps/desktop/src/components/grid/DataGridConditionEditor.vue+++ b/apps/desktop/src/components/grid/DataGridConditionEditor.vue@@ -134,8 +134,9 @@ function createTextProbe(input: HTMLTextAreaElement, wrap: boolean, options: { wfunction shouldExpand(input: HTMLTextAreaElement) {if (!input.value) return false;+ const hasMultipleLines = /\r?\n/.test(input.value);const probe = createTextProbe(input, false);- const should = probe.getBoundingClientRect().width > input.clientWidth + 1;+ const should = hasMultipleLines || probe.getBoundingClientRect().width > input.clientWidth + 1;probe.remove();return should;}diff --git a/apps/desktop/src/components/grid/__tests__/DataGridConditionEditor.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridConditionEditor.spec.tsindex 47889a45b8..d87a2caf8e 100644--- a/apps/desktop/src/components/grid/__tests__/DataGridConditionEditor.spec.ts+++ b/apps/desktop/src/components/grid/__tests__/DataGridConditionEditor.spec.ts@@ -390,6 +390,33 @@ describe("DataGridConditionEditor quote completion", () => {vi.unstubAllGlobals();});+ it("expands when a multiline value is pasted even if each line fits", async () => {+ vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockImplementation(function (this: HTMLElement) {+ const width = 320;+ return { x: 0, y: 0, left: 0, top: 0, right: width, bottom: 24, width, height: 24, toJSON: () => ({}) } as DOMRect;+ });+ vi.spyOn(HTMLCanvasElement.prototype, "getContext").mockReturnValue(null);+ vi.stubGlobal("requestAnimationFrame", (callback: FrameRequestCallback) => {+ callback(0);+ return 1;+ });+ const { input } = mountEditor("where", "where id in ()");+ mockTextareaMetrics(input, { clientWidth: 320, scrollWidth: 320, clientHeight: 24, scrollHeight: 72 });+ input.focus();+ await nextTick();+ expect(document.body.querySelector(".data-grid-topbar-condition-input--expanded")).toBeNull();++ input.value = "where id in (60792411\n580019433\n1035062084)";+ input.setSelectionRange(input.value.length, input.value.length);+ input.dispatchEvent(new Event("input", { bubbles: true }));++ await nextTick();+ await nextTick();++ expect(document.body.querySelector(".data-grid-topbar-condition-input--expanded")).toBeTruthy();+ vi.unstubAllGlobals();+ });+it("preserves the caret offset when focus moves into the expanded textarea", async () => {vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockImplementation(function (this: HTMLElement) {const width = this.classList.contains("data-grid-topbar-condition-pane--expanded") ? 160 : 140;