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
style: improve UI interface
Libonf1b857999400
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vueindex 5e42b3897e..4f5ab45fdb 100644--- a/apps/desktop/src/App.vue+++ b/apps/desktop/src/App.vue@@ -1387,7 +1387,7 @@ onUnmounted(() => {</div><Teleport to="body"><Transition name="toast">- <div v-if="toastVisible" class="fixed bottom-6 left-1/2 -translate-x-1/2 z-99999 px-4 py-2 rounded-lg bg-foreground text-background text-sm shadow-lg select-text">+ <div v-if="toastVisible" class="fixed bottom-6 inset-x-0 w-max mx-auto z-99999 px-4 py-2 rounded-lg bg-foreground text-background text-sm shadow-lg select-text">{{ toastMessage }}</div></Transition>@@ -1446,11 +1446,12 @@ onUnmounted(() => {<style scoped>.toast-enter-active,.toast-leave-active {- transition: all 0.25s ease;+ transition: 0.25s ease;+ transition-property: transform, opacity;}.toast-enter-from,.toast-leave-to {opacity: 0;- transform: translate(-50%, 8px);+ transform: translateY(100%) scale(0.95);}</style>diff --git a/apps/desktop/src/components/editor/AiAssistant.vue b/apps/desktop/src/components/editor/AiAssistant.vueindex 69ef3110b3..8ad95f133f 100644--- a/apps/desktop/src/components/editor/AiAssistant.vue+++ b/apps/desktop/src/components/editor/AiAssistant.vue@@ -922,7 +922,7 @@ const messageRenderer = computed(() => {<div class="flex flex-col gap-3 p-3"><template v-for="(msg, i) in visibleMessages" :key="i"><div v-if="msg.role === 'user'" class="flex justify-end">- <div class="max-w-[85%] rounded-lg bg-primary px-3 py-2 text-xs text-primary-foreground">+ <div class="max-w-[85%] whitespace-pre-wrap rounded-lg bg-primary px-3 py-2 text-xs text-primary-foreground">{{ msg.content }}</div></div>diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vueindex 381d7215f1..2a8944bd12 100644--- a/apps/desktop/src/components/grid/DataGrid.vue+++ b/apps/desktop/src/components/grid/DataGrid.vue@@ -2845,6 +2845,7 @@ const selection = useDataGridSelection({});const {+ isSelectingAll,selectedRange,selectedCells,selectedCellCount,@@ -4110,12 +4111,12 @@ function drawCanvasGrid() {hoverCell: canvasHoverCell.value,isScrolling: isScrolling.value,editingCell: editingCell.value,- singleSelectedCell: canvasSingleSelectedCell.value,searchMatchKeys: searchMatchSet.value,currentSearchMatch: currentSearchMatch.value,formatCell: formatCellCached,isRowActive,isRowSelected,+ isSelectingAll: isSelectingAll.value,rowCellsUseSelectionVisual,cellIsSelected,cellCanHover: canEditCellItem,@@ -4132,6 +4133,7 @@ watch(selectedRowIds,hasCellSelection,hasRowSelection,+ isSelectingAll,searchMatchSet,currentSearchMatch,isDark,@@ -6333,9 +6335,9 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<div v-if="whereSuggestions.length > 0" class="fixed z-50 min-w-[180px] rounded-md border bg-popover text-popover-foreground shadow-md" :style="whereSuggestionStyle"><divv-for="(sug, idx) in whereSuggestions"- :key="`${sug.kind}:${sug.value}`"+ :key="`${sug.kind}:${sug.value}`"class="flex items-center gap-2 px-3 py-1.5 text-xs cursor-pointer"- :class="idx === whereSuggestionIndex ? 'bg-accent text-accent-foreground' : 'hover:bg-accent/50'"+ :class="idx === whereSuggestionIndex ? 'bg-accent text-accent-foreground' : 'hover:bg-gray-200 dark:hover:bg-gray-800'"@mousedown.prevent="whereSuggestionIndex = idx;acceptWhereSuggestion();@@ -6396,7 +6398,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {v-for="(sug, idx) in orderBySuggestions":key="`${sug.kind}:${sug.value}`"class="flex items-center gap-2 px-3 py-1.5 text-xs cursor-pointer"- :class="idx === orderBySuggestionIndex ? 'bg-accent text-accent-foreground' : 'hover:bg-accent/50'"+ :class="idx === orderBySuggestionIndex ? 'bg-accent text-accent-foreground' : 'hover:bg-gray-200 dark:hover:bg-gray-800'"@mousedown.prevent="orderBySuggestionIndex = idx;acceptOrderBySuggestion();@@ -6519,7 +6521,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {v-for="(sug, idx) in searchSuggestions":key="sug"class="flex items-center px-3 py-1.5 text-xs cursor-pointer"- :class="idx === suggestionIndex ? 'bg-accent text-accent-foreground' : 'hover:bg-accent/50'"+ :class="idx === suggestionIndex ? 'bg-accent text-accent-foreground' : 'hover:bg-gray-200 dark:hover:bg-gray-800'"@mousedown.prevent="suggestionIndex = idx;acceptSuggestion();@@ -6620,7 +6622,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {'bg-primary/15': transposeRecordUsesActiveHighlight(cell.recordIndex) && !transposeRecordUsesSelectionVisual(cell.recordIndex) && !displayItems[cell.recordIndex]?.isDirtyCol[cell.valueIndex] && !transposeCellIsSelected(cell.recordIndex, cell.valueIndex),'bg-yellow-500/10 cell-dirty': displayItems[cell.recordIndex]?.isDirtyCol[cell.valueIndex],'cursor-text': !isScrolling && canEditCellItem(displayItems[cell.recordIndex], cell.valueIndex),- 'hover:bg-accent/50':+ 'hover:bg-gray-200 dark:hover:bg-gray-800':!isScrolling && canEditCellItem(displayItems[cell.recordIndex], cell.valueIndex) && !transposeRecordUsesSelectionVisual(cell.recordIndex) && !transposeRecordUsesActiveHighlight(cell.recordIndex) && !transposeCellIsSelected(cell.recordIndex, cell.valueIndex),}":style="{ width: `${getTransposeRecordWidth(cell.recordIndex)}px` }"@@ -6680,15 +6682,21 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {</div><template v-else><!-- Sticky header -->- <div ref="headerRef" class="shrink-0 bg-[rgb(239_239_239)] dark:bg-muted/60 z-10 border-y border-border overflow-hidden">- <div class="flex text-xs font-semibold text-foreground" :style="{ width: 'var(--header-total-w)' }">- <div class="shrink-0 px-2 py-1.5 border-r border-border text-center text-muted-foreground select-none cursor-pointer hover:bg-accent/60 sticky left-0 z-20 bg-[rgb(239_239_239)] dark:bg-muted" :style="{ width: 'var(--row-num-w)' }" @click="selectAllCells">#</div>+ <div ref="headerRef" class="shrink-0 bg-[rgb(239_239_239)] dark:bg-muted/60 z-10 w-(--header-total-w) border-y border-border overflow-hidden">+ <div class="flex text-xs font-semibold text-foreground">+ <div+ class="shrink-0 px-2 py-1.5 border-r w-(--row-num-w) border-border text-center text-muted-foreground select-none cursor-default hover:bg-gray-200 dark:hover:bg-gray-800 sticky left-0 z-20 bg-[rgb(239_239_239)] dark:bg-muted"+ :class="{ '!bg-gray-300 dark:!bg-gray-900 outline outline-primary -outline-offset-1': isSelectingAll }"+ @click="selectAllCells"+ >+ #+ </div><div class="shrink-0" :style="{ width: `${horizontalColumnWindow.beforeWidth}px` }" /><LightTooltip v-for="col in renderedGridColumns" :key="`${col.name}-${col.actualColIdx}`" :text="col.name" side="bottom" :side-offset="4"><div- class="shrink-0 px-2 py-1.5 border-r border-border whitespace-nowrap hover:bg-accent/60 select-none relative overflow-hidden"+ class="shrink-0 px-2 py-1.5 border-r border-border whitespace-nowrap hover:bg-gray-200 dark:hover:bg-gray-800 select-none relative overflow-hidden":class="{- 'bg-primary/15 ring-1 ring-inset ring-primary/40': highlightedColumnIndex === col.actualColIdx || columnIsSelected(col.visibleColIdx),+ '!bg-gray-300 dark:!bg-gray-900 outline outline-primary -outline-offset-1': highlightedColumnIndex === col.actualColIdx || columnIsSelected(col.visibleColIdx),'bg-amber-500/20 ring-1 ring-inset ring-amber-500/40': currentSearchMatch?.kind === 'column' && currentSearchMatch.col === col.actualColIdx,}":style="renderedColumnStyle(col.visibleColIdx)"@@ -6711,7 +6719,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<buttonv-if="headerColumnSortable(col.actualColIdx)"type="button"- class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground"+ class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-foreground":class="sortCol === col.name && sortColIndex === col.actualColIdx ? 'text-primary opacity-100' : 'opacity-80'":title="t('grid.sort')"@click.stop="toggleSort(col.name, col.actualColIdx)"@@ -6724,7 +6732,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<DropdownMenuTrigger as-child><buttontype="button"- class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground"+ class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-foreground":class="columnHasFormatter(col.actualColIdx) || localFilterActive(col.actualColIdx) ? 'text-primary opacity-90' : 'opacity-80'":title="t('grid.columnActions')"@click.stop@@ -6750,7 +6758,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<PopoverTrigger v-else as-child><buttontype="button"- class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground"+ class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-foreground":class="columnHasFormatter(col.actualColIdx) ? 'text-primary opacity-100' : 'opacity-80'":disabled="!formatterKeyForColumn(col.name)":title="t('grid.columnFormatter')"@@ -6894,7 +6902,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<PopoverTrigger v-else as-child><buttontype="button"- class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground"+ class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-foreground":class="localFilterActive(col.actualColIdx) ? 'text-primary opacity-100' : 'opacity-80'":title="t('grid.localFilter')"@click.stop@@ -6983,7 +6991,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {</template></LightTooltip><div class="shrink-0" :style="{ width: `${horizontalColumnWindow.afterWidth}px` }" />- <div v-if="gridScrollbarGutter > 0" class="shrink-0 border-l border-border" :style="{ width: 'var(--grid-scrollbar-gutter)' }" />+ <div v-if="gridScrollbarGutter > 0" class="shrink-0 border-l border-border w-(--grid-scrollbar-gutter)" /></div></div>@@ -7086,25 +7094,24 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {><template #default="{ item }"><div- class="flex text-xs border-b border-border"+ class="flex text-[13px] border-b border-border h-6.5 w-(--total-w)":class="{'bg-destructive/5 opacity-70': item.isDeleted,'bg-primary/5': item.isNew && !isRowActive(item.displayIndex),'bg-muted/30': !item.isNew && !item.isDeleted && !isRowActive(item.displayIndex) && item.displayIndex % 2 === 1,'active-row': isRowActive(item.displayIndex) && !item.isDeleted,}"- :style="{ height: '26px', width: 'var(--total-w)' }":data-row-index="item.displayIndex"><div- class="data-grid-row-number shrink-0 px-2 py-1 border-r border-border text-center select-none cursor-default hover:bg-accent/50 sticky left-0 z-10 bg-[rgb(255_255_255)] dark:bg-[rgb(35_37_42)]"+ class="data-grid-row-number w-(--row-num-w) shrink-0 px-2 py-1 border-r text-center select-none cursor-default hover:bg-gray-200 dark:hover:bg-gray-800 sticky left-0 z-10 bg-background":class="[rowNumberStatusClass(item),{- 'text-primary font-semibold !bg-primary/25': isRowSelected(item.id) && item.status !== 'new' && item.status !== 'edited' && item.status !== 'deleted',+ 'row-selected': isSelectingAll,+ 'row-selected text-primary font-semibold !bg-gray-300 dark:!bg-gray-800': isRowSelected(item.id) && item.status !== 'new' && item.status !== 'edited' && item.status !== 'deleted',},]"- :style="{ width: 'var(--row-num-w)' }"@click="handleRowClick(item.displayIndex, item.id, $event)"@dblclick.stop="toggleTranspose(item.displayIndex)"@contextmenu="onRowContext(item.id, item.displayIndex)"@@ -7126,7 +7133,8 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {'row-cell-selected-dirty': rowCellsUseSelectionVisual(item.id) && !cellIsSelected(item.displayIndex, col.visibleColIdx) && item.isDirtyCol[col.actualColIdx],'bg-yellow-200/60 dark:bg-yellow-500/20': cellIsSearchMatch(item.displayIndex, col.actualColIdx),'ring-2 ring-inset ring-yellow-500 bg-yellow-300/60 dark:bg-yellow-500/40': cellIsCurrentMatch(item.displayIndex, col.actualColIdx),- 'cursor-text hover:bg-accent/50': !isScrolling && canEditCellItem(item, col.actualColIdx),+ 'tabular-nums': typeof item.data[col.actualColIdx] === 'number',+ 'cursor-text hover:bg-gray-200 dark:hover:bg-gray-800': !isScrolling && canEditCellItem(item, col.actualColIdx),'line-through': item.isDeleted,}"@mousedown="handleDataCellMousedown(item.displayIndex, col.visibleColIdx, item.id, $event)"@@ -7204,14 +7212,14 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<!-- Table Info Drawer --><div v-if="showTableInfo" class="relative col-start-2 row-start-1 border-l flex flex-col bg-background min-w-0" :class="[{ 'row-span-2': cellDetailPanelIsBottom }, { 'ddl-drawer-resizing': isResizingDdl }]" :style="ddlDrawerStyle" @contextmenu="onDrawerContextMenu"><div class="absolute left-0 top-0 bottom-0 z-20 w-1.5 -translate-x-1/2 cursor-col-resize hover:bg-primary/30" @mousedown.prevent="onDdlResizeStart" />- <div class="flex items-center gap-2 px-3 py-1.5 border-b shrink-0 bg-muted/20">+ <div class="flex items-center gap-2 px-3 py-1.5 border-b shrink-0 bg-muted/20 h-9"><TableProperties class="w-3.5 h-3.5 text-muted-foreground" /><span class="text-xs font-medium flex-1 min-w-0 truncate">{{ tableMeta?.tableName }}</span><Button v-if="activeTableInfoTab === 'ddl'" variant="ghost" size="sm" class="h-6 px-2 text-xs" :title="t('grid.copyDdl')" :aria-label="t('grid.copyDdl')" @click="copyDdl"><Copy class="w-3 h-3" /><span>{{ t("grid.copyDdl") }}</span></Button>- <Button v-if="activeTableInfoTab === 'ddl'" variant="ghost" size="icon" class="h-5 w-5" :class="{ 'bg-accent': ddlWrap }" @click="toggleDdlWrap">+ <Button v-if="activeTableInfoTab === 'ddl'" variant="ghost" size="icon" class="h-6 w-6" :class="{ 'bg-accent': ddlWrap }" @click="toggleDdlWrap"><WrapText class="w-3 h-3" /></Button><Button variant="ghost" size="icon" class="h-5 w-5" @click="showTableInfo = false">@@ -7222,7 +7230,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<buttonv-for="tab in tableInfoTabs":key="tab.id"- class="h-9 min-w-0 px-1.5 text-[11px] text-muted-foreground border-b-2 border-transparent hover:bg-muted/50 hover:text-foreground"+ class="h-9 min-w-0 px-1.5 text-[11px] text-muted-foreground border-b-2 border-transparent hover:bg-gray-200 dark:hover:bg-gray-800/50 hover:text-foreground":class="{ 'border-primary text-foreground bg-muted/40': activeTableInfoTab === tab.id }":title="tab.label"@click="selectTableInfoTab(tab.id)"@@ -7249,17 +7257,17 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<table v-else class="w-full text-xs"><thead class="sticky top-0 bg-muted text-muted-foreground"><tr class="border-b">- <th class="text-left font-medium px-3 py-2 w-8">#</th>- <th class="text-left font-medium px-3 py-2">{{ t("grid.columnName") }}</th>- <th class="text-left font-medium px-3 py-2">{{ t("grid.columnType") }}</th>- <th class="text-left font-medium px-3 py-2">{{ t("grid.tableInfoNullable") }}</th>+ <th class="text-left text-nowrap font-medium px-3 py-2 w-8">#</th>+ <th class="text-left text-nowrap font-medium px-3 py-2">{{ t("grid.columnName") }}</th>+ <th class="text-left text-nowrap font-medium px-3 py-2">{{ t("grid.columnType") }}</th>+ <th class="text-left text-nowrap font-medium px-3 py-2">{{ t("grid.tableInfoNullable") }}</th></tr></thead><tbody><trv-for="(column, index) in filteredColumns":key="column.name"- class="border-b cursor-pointer hover:bg-muted/30"+ class="border-b cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-800/30"role="button"tabindex="0":title="column.name"@@ -7978,6 +7986,8 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {</template><style scoped>+@reference "../../styles/globals.css";+[data-grid-root] {--data-grid-row-muted-bg: rgb(248 248 248);--data-grid-row-new-bg: rgb(243 243 243);@@ -8150,7 +8160,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {.canvas-grid-surface {cursor: cell;font-family: var(--dbx-data-grid-font-family);- font-size: 12.5px;+ font-size: 13px;font-weight: 400;line-height: 1rem;outline: none;@@ -8191,12 +8201,6 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {transition: none;}-.cell-selected {- background-color: var(--data-grid-cell-selected-bg);- outline: 1px solid var(--data-grid-cell-selected-border);- outline-offset: -1px;-}-.row-cell-selected {background-color: var(--data-grid-cell-selected-bg);outline: 1px solid var(--data-grid-cell-selected-border);@@ -8237,16 +8241,15 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {background-color: var(--data-grid-row-number-deleted-bg);}-.active-row > div:not(.cell-dirty) {- background-color: var(--data-grid-cell-active-bg);-}-+.cell-selected,+.active-row > div:not(.cell-dirty),.active-row > .data-grid-row-number:not(.cell-dirty) {- background-color: var(--data-grid-row-number-active-bg);+ @apply text-foreground bg-gray-300 dark:bg-gray-900;}-.data-grid-row-number.\!bg-primary\/25 {- background-color: var(--data-grid-row-number-selected-bg) !important;+.cell-selected,+.active-row .row-selected.data-grid-row-number {+ @apply outline outline-primary -outline-offset-1;}.ddl-code :deep(.ddl-kw) {diff --git a/apps/desktop/src/components/layout/AppTabBar.vue b/apps/desktop/src/components/layout/AppTabBar.vueindex 69e1ffcbaf..21837b5f97 100644--- a/apps/desktop/src/components/layout/AppTabBar.vue+++ b/apps/desktop/src/components/layout/AppTabBar.vue@@ -14,6 +14,8 @@ import { useTabScroll } from "@/composables/useTabScroll";import { useTabDrag } from "@/composables/useTabDrag";import { connectionColor, isConnectionReadonly, tabDisplayTitle, tabTooltipLines } from "@/lib/tabPresentation";import { hexToRgba } from "@/lib/color";+import { copyToClipboard } from "@/lib/clipboard";+import { useToast } from "@/composables/useToast";import type { QueryTab } from "@/types/database";const props = defineProps<{@@ -30,6 +32,7 @@ const emit = defineEmits<{const { t } = useI18n();const queryStore = useQueryStore();const settingsStore = useSettingsStore();+const { toast } = useToast();const tabDrag = useTabDrag((draggedId, targetId, position) => {queryStore.reorderTab(draggedId, targetId, position);});@@ -92,6 +95,18 @@ function getTabMenuItems(tab: QueryTab): ContextMenuItem[] {icon: Copy,visible: canRenameTab(tab),},+ {+ label: t("contextMenu.copyName"),+ action: async () => {+ try {+ await copyToClipboard(tabDisplayTitle(tab, t));+ toast(t("connection.copied"), 2000);+ } catch (e: any) {+ toast(t("grid.copyFailed", { message: e?.message || String(e) }), 5000);+ }+ },+ icon: Copy,+ },{ label: "", separator: true },{label: tab.pinned ? t("contextMenu.unpin") : t("contextMenu.pin"),diff --git a/apps/desktop/src/composables/useDataGridSelection.ts b/apps/desktop/src/composables/useDataGridSelection.tsindex 0a7e706698..ad195d07be 100644--- a/apps/desktop/src/composables/useDataGridSelection.ts+++ b/apps/desktop/src/composables/useDataGridSelection.ts@@ -30,6 +30,7 @@ export function useDataGridSelection(options: UseDataGridSelectionOptions) {const selectionFocus = ref<CellPosition | null>(null);const isSelectingCells = ref(false);+ const isSelectingAll = ref(false);const selectedRowIds = ref<Set<number>>(new Set());const selectedColumnIndexes = ref<Set<number>>(new Set());const lastClickedRowIndex = ref<number | null>(null);@@ -62,9 +63,11 @@ export function useDataGridSelection(options: UseDataGridSelectionOptions) {selectionFocus.value = null;selectedColumnIndexes.value = new Set();isSelectingCells.value = false;+ isSelectingAll.value = false;}function clearRowSelection() {+ isSelectingAll.value = false;selectedRowIds.value = new Set();lastClickedRowIndex.value = null;}@@ -132,6 +135,7 @@ export function useDataGridSelection(options: UseDataGridSelectionOptions) {lastClickedColumnIndex.value = null;selectionAnchor.value = { rowIndex: range.startRow, colIndex: range.startCol };selectionFocus.value = { rowIndex: range.endRow, colIndex: range.endCol };+ isSelectingAll.value = true;focusGridWithoutScrolling();}@@ -252,6 +256,7 @@ export function useDataGridSelection(options: UseDataGridSelectionOptions) {selectedCells,selectedCellCount,hasCellSelection,+ isSelectingAll,clearCellSelection,selectSingleCell,selectRow,diff --git a/apps/desktop/src/lib/canvasDataGridRenderer.ts b/apps/desktop/src/lib/canvasDataGridRenderer.tsindex c049d5a243..4372226359 100644--- a/apps/desktop/src/lib/canvasDataGridRenderer.ts+++ b/apps/desktop/src/lib/canvasDataGridRenderer.ts@@ -24,11 +24,6 @@ export interface CanvasEditingCell {col: number;}-export interface CanvasSingleSelectedCell {- rowIndex: number;- visibleColIdx: number;-}-export interface CanvasSearchMatch {kind: "cell" | "column";displayRow: number;@@ -52,12 +47,12 @@ export interface DrawCanvasDataGridOptions {hoverCell: CanvasHoverCell | null;isScrolling: boolean;editingCell: CanvasEditingCell | null;- singleSelectedCell: CanvasSingleSelectedCell | null;searchMatchKeys: ReadonlySet<string>;currentSearchMatch: CanvasSearchMatch | null;formatCell: (value: CellValue, columnIndex: number) => string;isRowActive: (rowIndex: number) => boolean;isRowSelected: (rowId: number) => boolean;+ isSelectingAll: boolean;rowCellsUseSelectionVisual: (rowId: number) => boolean;cellIsSelected: (rowIndex: number, visibleColIdx: number) => boolean;cellCanHover: (row: CanvasDataGridRow, actualColIdx: number) => boolean;@@ -163,7 +158,7 @@ function resolveCanvasRenderState(canvas: HTMLCanvasElement, isDark: boolean, stif (cached?.cacheKey === cacheKey) return cached;const fontFamily = canvasStyle.fontFamily || `"Geist Variable Tabular", "Geist Variable", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif`;- const fontSize = Number.parseFloat(canvasStyle.fontSize) || 12;+ const fontSize = Number.parseFloat(canvasStyle.fontSize) || 13;const lineHeight = canvasStyle.lineHeight;const normalFont = canvasFont({family: fontFamily,@@ -221,12 +216,12 @@ export function drawCanvasDataGrid(options: DrawCanvasDataGridOptions) {hoverCell,isScrolling,editingCell,- singleSelectedCell,searchMatchKeys,currentSearchMatch,formatCell,isRowActive,isRowSelected,+ isSelectingAll,rowCellsUseSelectionVisual,cellIsSelected,cellCanHover,@@ -275,14 +270,15 @@ export function drawCanvasDataGrid(options: DrawCanvasDataGridOptions) {if (!item) continue;const y = rowIndex * CANVAS_DATA_GRID_ROW_HEIGHT - scrollTop;const rowIsActive = isRowActive(item.displayIndex);+const rowBase = item.isDeleted ? theme.rowDeleted : item.isNew && !rowIsActive ? theme.rowNew : item.displayIndex % 2 === 1 && !rowIsActive ? theme.rowMuted : theme.background;+ const rowBorderY = crispCanvasLine(y + CANVAS_DATA_GRID_ROW_HEIGHT - 1, dpr);ctx.globalAlpha = item.isDeleted ? 0.7 : 1;- ctx.fillStyle = rowBase;+ ctx.fillStyle = rowIsActive && !item.isDeleted ? theme.cellSelectedSingle : rowBase;ctx.fillRect(0, y, width, CANVAS_DATA_GRID_ROW_HEIGHT);let rowNumberFill = item.status === "new" ? theme.rowNumberNew : item.status === "edited" ? theme.rowNumberEdited : item.status === "deleted" ? theme.rowNumberDeleted : theme.rowNumberDefault;- if (rowIsActive && !item.isDeleted) rowNumberFill = theme.rowNumberActive;- if (isRowSelected(item.id) && item.status === "clean") rowNumberFill = theme.rowNumberSelected;+ if ((rowIsActive || isRowSelected(item.id)) && !item.isDeleted) rowNumberFill = theme.cellSelectedSingle;ctx.fillStyle = rowNumberFill;ctx.fillRect(0, y, rowNumberWidth, CANVAS_DATA_GRID_ROW_HEIGHT);if (hoverCell?.rowIndex === item.displayIndex && hoverCell.visibleColIdx < 0 && !isScrolling && item.status === "clean" && !rowIsActive && !isRowSelected(item.id)) {@@ -303,12 +299,28 @@ export function drawCanvasDataGrid(options: DrawCanvasDataGridOptions) {ctx.fillText(String(item.displayIndex + 1), rowNumberTextX, textY);ctx.font = normalFont;- const rowBorderY = crispCanvasLine(y + CANVAS_DATA_GRID_ROW_HEIGHT - 1, dpr);ctx.strokeStyle = theme.border;ctx.beginPath();ctx.moveTo(0, rowBorderY);ctx.lineTo(width, rowBorderY);ctx.stroke();+ if ((isRowSelected(item.id) || isSelectingAll) && !item.isDeleted) {+ const selectedLeftX = 0.5;+ const selectedRightX = rowNumberWidth - 1.5;+ const selectedTopY = Math.max(y + 0.5, 1);+ ctx.strokeStyle = theme.cellSelectedSingleBorder;+ ctx.lineWidth = 1;+ ctx.beginPath();+ ctx.moveTo(selectedLeftX, selectedTopY);+ ctx.lineTo(selectedRightX, selectedTopY);+ ctx.moveTo(selectedLeftX, rowBorderY);+ ctx.lineTo(selectedRightX, rowBorderY);+ ctx.moveTo(selectedLeftX, selectedTopY);+ ctx.lineTo(selectedLeftX, rowBorderY);+ ctx.moveTo(selectedRightX, selectedTopY);+ ctx.lineTo(selectedRightX, rowBorderY);+ ctx.stroke();+ }let x = rowNumberWidth + columnOffset - scrollLeft;for (let visibleColIdx = firstCol; visibleColIdx < renderedColumnWidths.length && x < width; visibleColIdx++) {@@ -321,9 +333,8 @@ export function drawCanvasDataGrid(options: DrawCanvasDataGridOptions) {if (x + colWidth >= rowNumberWidth) {const selectedCell = cellIsSelected(item.displayIndex, visibleColIdx);const rowSelectionVisual = rowCellsUseSelectionVisual(item.id);- const isSingleSelectedCell = singleSelectedCell?.rowIndex === item.displayIndex && singleSelectedCell.visibleColIdx === visibleColIdx;const isDirtyCell = item.isDirtyCol[actualColIdx];- const selectedFillVisual = rowSelectionVisual || (selectedCell && (!isSingleSelectedCell || isDirtyCell) && (!rowIsActive || isDirtyCell));+ const selectedFillVisual = rowSelectionVisual || selectedCell;const selectedBorderVisual = rowSelectionVisual || selectedCell;const isSearchMatch = paintSearchMatches && searchMatchKeys.has(`cell:${item.displayIndex}:${actualColIdx}`);const isCurrentSearchMatch = paintSearchMatches && currentSearchMatch?.displayRow === item.displayIndex && currentSearchMatch.col === actualColIdx;@@ -338,12 +349,12 @@ export function drawCanvasDataGrid(options: DrawCanvasDataGridOptions) {ctx.fillStyle = theme.cellHover;ctx.fillRect(clippedX, y, cellPaintWidth, CANVAS_DATA_GRID_ROW_HEIGHT);}- if (selectedFillVisual) {- ctx.fillStyle = isDirtyCell ? theme.cellSelectedDirty : theme.cellSelected;+ if ((rowIsActive || selectedCell) && !item.isDeleted && !isDirtyCell) {+ ctx.fillStyle = theme.cellSelectedSingle;ctx.fillRect(clippedX, y, cellPaintWidth, CANVAS_DATA_GRID_ROW_HEIGHT);}- if (rowIsActive && !item.isDeleted && !isDirtyCell) {- ctx.fillStyle = theme.cellActive;+ if (selectedFillVisual && isDirtyCell) {+ ctx.fillStyle = theme.cellSelectedDirty;ctx.fillRect(clippedX, y, cellPaintWidth, CANVAS_DATA_GRID_ROW_HEIGHT);}if (isSearchMatch) {@@ -396,7 +407,7 @@ export function drawCanvasDataGrid(options: DrawCanvasDataGridOptions) {const selectedRightX = clippedX + cellPaintWidth - 1.5;const selectedTopY = Math.max(y + 0.5, 1);const drawSelectedLeftBorder = selectedLeftX >= rowNumberWidth + 0.5;- ctx.strokeStyle = theme.cellSelectedBorder;+ ctx.strokeStyle = selectedCell && !isDirtyCell ? theme.cellSelectedSingleBorder : theme.cellSelectedBorder;ctx.beginPath();ctx.moveTo(selectedLeftX, selectedTopY);ctx.lineTo(selectedRightX, selectedTopY);diff --git a/apps/desktop/src/lib/dataGridPaintTheme.ts b/apps/desktop/src/lib/dataGridPaintTheme.tsindex 7cea2ca0cc..32b5d32a2f 100644--- a/apps/desktop/src/lib/dataGridPaintTheme.ts+++ b/apps/desktop/src/lib/dataGridPaintTheme.ts@@ -12,6 +12,8 @@ export interface DataGridPaintTheme {cellSelected: string;cellSelectedDirty: string;cellSelectedBorder: string;+ cellSelectedSingle: string;+ cellSelectedSingleBorder: string;cellHover: string;cellSearch: string;cellCurrentSearch: string;@@ -223,6 +225,7 @@ export function resolveDataGridPaintTheme(options: { getVar: (name: string) => sconst cellSelected = isDark ? "rgb(66, 67, 70)" : "rgb(226, 226, 226)";const cellSelectedDirty = isDark ? "rgb(94, 75, 26)" : "rgb(244, 229, 186)";const cellSelectedBorder = isDark ? "rgb(170, 170, 175)" : "rgb(90, 90, 90)";+ const cellSelectedSingle = isDark ? "rgb(17, 24, 39)" : "rgb(209, 213, 219)";const cellHover = accent;const cellSearch = isDark ? DATA_GRID_DARK_SEARCH_COLORS.match : "rgb(253, 245, 184)";const cellCurrentSearch = isDark ? DATA_GRID_DARK_SEARCH_COLORS.current : "rgba(253, 224, 71, 0.52)";@@ -232,7 +235,7 @@ export function resolveDataGridPaintTheme(options: { getVar: (name: string) => sconst rowNumberEdited = isDark ? DATA_GRID_DARK_ROW_NUMBER_EDITED_BG : DATA_GRID_LIGHT_ROW_NUMBER_EDITED_BG;const rowNumberDeleted = isDark ? DATA_GRID_DARK_ROW_NUMBER_DELETED_BG : DATA_GRID_LIGHT_ROW_NUMBER_DELETED_BG;const rowNumberActive = activeSurface;- const rowNumberSelected = cellSelected;+ const rowNumberSelected = isDark ? "rgb(31, 41, 55)" : "rgb(209, 213, 219)";return {background,@@ -248,6 +251,8 @@ export function resolveDataGridPaintTheme(options: { getVar: (name: string) => scellSelected: paintToken(getVar, "--data-grid-cell-selected-bg", cellSelected),cellSelectedDirty: paintToken(getVar, "--data-grid-cell-selected-dirty-bg", cellSelectedDirty),cellSelectedBorder: paintToken(getVar, "--data-grid-cell-selected-border", cellSelectedBorder),+ cellSelectedSingle: paintToken(getVar, "--data-grid-cell-selected-single-bg", cellSelectedSingle),+ cellSelectedSingleBorder: paintToken(getVar, "--data-grid-cell-selected-single-border", primary),cellHover: paintToken(getVar, "--data-grid-cell-hover-bg", cellHover),cellSearch: paintToken(getVar, "--data-grid-cell-search-bg", cellSearch),cellCurrentSearch: paintToken(getVar, "--data-grid-cell-current-search-bg", cellCurrentSearch),diff --git a/apps/desktop/src/styles/globals.css b/apps/desktop/src/styles/globals.cssindex df86f80ac5..003b24e6b6 100644--- a/apps/desktop/src/styles/globals.css+++ b/apps/desktop/src/styles/globals.css@@ -251,8 +251,9 @@ body.dbx-table-reference-dragging * {overscroll-behavior: none;}body {- @apply bg-background text-foreground;- @apply font-sans;+ @apply font-sans bg-background text-foreground;+ text-rendering: geometricPrecision;+ font-synthesis: none;}button,[role="button"],