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(structure): preserve selected row control styling

t8y2add378d6433c
diff --git a/apps/desktop/src/components/structure/TableStructureEditor.vue b/apps/desktop/src/components/structure/TableStructureEditor.vue
index f297de2d37..3a05c0f50c 100644
--- a/apps/desktop/src/components/structure/TableStructureEditor.vue
+++ b/apps/desktop/src/components/structure/TableStructureEditor.vue
@@ -6637,11 +6637,6 @@ watch(
inset 0 1px 0 color-mix(in oklab, var(--primary) 55%, transparent),
inset 0 -1px 0 color-mix(in oklab, var(--primary) 55%, transparent);
}
-
-/* Inputs are bg-transparent; give them a solid surface on the selected row so fields stay readable. */
-.structure-column-search-current :is(input, button, [role="combobox"], [data-slot="select-trigger"]) {
- background-color: var(--background);
-}
</style>
<style>
diff --git a/apps/desktop/src/components/structure/__tests__/TableStructureEditor.selectedRowStyle.spec.ts b/apps/desktop/src/components/structure/__tests__/TableStructureEditor.selectedRowStyle.spec.ts
new file mode 100644
index 0000000000..b14a02b686
--- /dev/null
+++ b/apps/desktop/src/components/structure/__tests__/TableStructureEditor.selectedRowStyle.spec.ts
@@ -0,0 +1,24 @@
+import { readFileSync } from "node:fs";
+import { describe, expect, it } from "vitest";
+
+const source = readFileSync(new URL("../TableStructureEditor.vue", import.meta.url), "utf8");
+const scopedStyleStart = source.indexOf("<style scoped>");
+const scopedStyleEnd = source.indexOf("</style>", scopedStyleStart);
+const scopedStyle = source.slice(scopedStyleStart, scopedStyleEnd).replace(/\/\*[\s\S]*?\*\//g, "");
+const rules = [...scopedStyle.matchAll(/([^{}]+)\{([^{}]*)\}/g)].map((match) => ({
+ selectors: match[1]!.split(",").map((selector) => selector.trim()),
+ declarations: match[2]!,
+}));
+
+describe("TableStructureEditor selected-row styles", () => {
+ it("keeps the highlight on cells without repainting descendant controls", () => {
+ const selectedBackgroundRules = rules.filter(({ selectors, declarations }) => selectors.some((selector) => selector.includes(".structure-column-search-current")) && /background(?:-color)?\s*:/.test(declarations));
+
+ expect(selectedBackgroundRules).toHaveLength(1);
+ expect(selectedBackgroundRules[0]?.selectors).toEqual([".structure-column-search-current > td"]);
+ expect(selectedBackgroundRules[0]?.declarations).toContain("var(--primary)");
+
+ const gridControlRule = rules.find(({ selectors }) => selectors.includes(".structure-edit-grid :deep(.structure-grid-control)"));
+ expect(gridControlRule?.declarations).toContain("background-color: transparent;");
+ });
+});