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): toggle filter view switch panel
二丫讲梵804120c0b182
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vueindex e8652e4e56..cecde644b1 100644--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue@@ -5991,7 +5991,7 @@ onUnmounted(() => {<div class="flex h-8 min-w-0 items-center gap-2 border-t bg-background/35 px-2 text-[11px]"><span class="shrink-0 text-muted-foreground">{{ t("grid.filterSqlPreview") }}</span><code class="min-w-0 flex-1 truncate rounded bg-muted/35 px-1.5 py-0.5">WHERE status = 'ACTIVE'</code>- <span class="shrink-0 rounded bg-primary px-2 py-1 text-primary-foreground">{{ t("grid.applyFilter") }}</span>+ <span class="shrink-0 text-muted-foreground/70">{{ t("grid.applyFilter") }}</span></div></div>@@ -6009,7 +6009,7 @@ onUnmounted(() => {<div class="flex h-8 min-w-0 items-center gap-2 border-t bg-background/45 px-2 text-[11px]"><span class="shrink-0 text-muted-foreground">{{ t("grid.filterSqlPreview") }}</span><code class="min-w-0 flex-1 truncate">WHERE status = 'ACTIVE'</code>- <span class="shrink-0 rounded bg-primary px-2 py-1 text-primary-foreground">{{ t("grid.applyFilter") }}</span>+ <span class="shrink-0 text-muted-foreground/70">{{ t("grid.applyFilter") }}</span></div></div></div>diff --git a/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.tsindex 8c8db2db0b..d956da28b1 100644--- a/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts+++ b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts@@ -169,6 +169,8 @@ describe("EditorSettingsDialog live preview placement", () => {expect(dataSection).toContain("data-data-grid-filter-preview-quick");expect(dataSection).toContain("data-data-grid-filter-preview-conditions");expect(dataSection).toContain("data-data-grid-filter-preview-text");+ expect(dataSection.match(/text-muted-foreground\/70">\{\{ t\("grid.applyFilter"\) \}\}/g)).toHaveLength(2);+ expect(dataSection).not.toContain('rounded bg-primary px-2 py-1 text-primary-foreground">{{ t("grid.applyFilter") }}');expect(dataSection.match(/editDataGridFilterEditorView = '(quick|conditions|text)'/g)).toHaveLength(3);expect(dataSection).not.toContain('<SelectTrigger id="data-grid-filter-view"');diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vueindex bcb3988dc3..30e37229a9 100644--- a/apps/desktop/src/components/grid/DataGrid.vue+++ b/apps/desktop/src/components/grid/DataGrid.vue@@ -12713,7 +12713,7 @@ function openGridSnapshot() {</DataGridToolbar></div><DataGridFilterWorkbench- v-if="canUseWhereSearch && filterEditorView === 'conditions'"+ v-if="canUseWhereSearch && filterEditorView === 'conditions' && filterBuilderOpen":sql-preview="filterSqlPreview":rules="structuredFilterRules":columns="filterBuilderColumnOptions"@@ -12733,7 +12733,7 @@ function openGridSnapshot() {@update-rule="updateStructuredFilterRule"/><DataGridTextFilterWorkbench- v-if="canUseWhereSearch && filterEditorView === 'text'"+ v-if="canUseWhereSearch && filterEditorView === 'text' && filterBuilderOpen":height="settingsStore.editorSettings.dataGridTextFilterPanelHeight":sql-preview="filterSqlPreview":rules="structuredFilterRules"diff --git a/apps/desktop/src/components/grid/DataGridQueryControls.vue b/apps/desktop/src/components/grid/DataGridQueryControls.vueindex bea7f92c4e..cbe253baab 100644--- a/apps/desktop/src/components/grid/DataGridQueryControls.vue+++ b/apps/desktop/src/components/grid/DataGridQueryControls.vue@@ -134,6 +134,13 @@ async function openPendingFirstEmptyRuleColumnSearch() {}async function handleFilterButtonClick() {+ if (props.filterEditorView !== "quick") {+ const nextOpen = !props.filterBuilderOpen;+ emit("update:filterBuilderOpen", nextOpen);+ if (nextOpen) emit("ensureRule");+ return;+ }+const shouldFocusColumnSearch = !props.filterBuilderOpen && props.rules.every((rule) => !rule.columnName);pendingFirstEmptyRuleColumnSearch.value = shouldFocusColumnSearch;emit("ensureRule");@@ -158,6 +165,7 @@ onUnmounted(onResizeEnd);class="relative flex h-5 w-5 -translate-x-1 shrink-0 items-center justify-center rounded border text-[11px] font-medium transition-colors":class="filterButtonActive ? 'border-primary/40 bg-primary/10 text-primary hover:bg-primary/15' : 'border-border/70 text-muted-foreground hover:bg-accent hover:text-foreground'":disabled="!canUseWhereSearch"+ :aria-label="t('grid.filter')"@click="handleFilterButtonClick"><Filter class="h-3 w-3" />@@ -212,6 +220,19 @@ onUnmounted(onResizeEnd);</PopoverContent></Popover></template>+ <button+ v-else+ type="button"+ class="relative flex h-5 w-5 -translate-x-1 shrink-0 items-center justify-center rounded border text-[11px] font-medium transition-colors"+ :class="filterButtonActive ? 'border-primary/40 bg-primary/10 text-primary hover:bg-primary/15' : 'border-border/70 text-muted-foreground hover:bg-accent hover:text-foreground'"+ :disabled="!canUseWhereSearch"+ :aria-label="t('grid.filter')"+ :aria-expanded="filterBuilderOpen"+ @click="handleFilterButtonClick"+ >+ <Filter class="h-3 w-3" />+ <span v-if="filterButtonCount" class="absolute -right-1 -top-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-primary px-1 text-[9px] leading-none text-primary-foreground">{{ filterButtonCount }}</span>+ </button><DataGridConditionEditor:model-value="whereInput"kind="where"diff --git a/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.tsindex da70a80db5..e9c18fdec1 100644--- a/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts+++ b/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts@@ -1144,7 +1144,9 @@ describe("DataGridQueryControls", () => {expect(applyFilters).toHaveBeenCalledOnce();});- it("keeps view selection out of the data grid controls", async () => {+ it("keeps the filter toggle available when switching filter views", async () => {+ const updateFilterBuilderOpen = vi.fn();+ const ensureRule = vi.fn();const mounted = mountComponent(DataGridQueryControls, {whereInput: "",orderByInput: "",@@ -1168,16 +1170,26 @@ describe("DataGridQueryControls", () => {applyWhere: vi.fn(),applyOrderBy: vi.fn(),clearOrderBy: vi.fn(),+ "onUpdate:filterBuilderOpen": updateFilterBuilderOpen,+ onEnsureRule: ensureRule,});expect(hostText(mounted.root)).not.toContain("grid.filterQuickView");expect(hostText(mounted.root)).not.toContain("grid.filterConditionView");- expect(findAll(mounted.root, (node) => node.type === "button" && String(node.props.class).includes("-translate-x-1"))).toHaveLength(1);+ const quickFilterButtons = findAll(mounted.root, (node) => node.type === "button" && String(node.props.class).includes("-translate-x-1"));+ expect(quickFilterButtons).toHaveLength(1);+ expect(quickFilterButtons[0].props["aria-label"]).toBe("grid.filter");await mounted.setProps({ filterEditorView: "conditions", filterBuilderOpen: false });await nextTick();expect(findOne(mounted.root, (node) => node.type === "textarea" && node.props.placeholder === "WHERE")).toBeTruthy();- expect(findAll(mounted.root, (node) => node.type === "button" && String(node.props.class).includes("-translate-x-1"))).toHaveLength(0);+ const filterButtons = findAll(mounted.root, (node) => node.type === "button" && String(node.props.class).includes("-translate-x-1"));+ expect(filterButtons).toHaveLength(1);+ expect(filterButtons[0].props["aria-label"]).toBe("grid.filter");+ expect(filterButtons[0].props["aria-expanded"]).toBe(false);+ dispatch(filterButtons[0], "click");+ expect(updateFilterBuilderOpen).toHaveBeenCalledWith(true);+ expect(ensureRule).toHaveBeenCalledOnce();});});