diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index 2e2129d8a..566c8ce04 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -297,6 +297,7 @@ function typeColorClass(t: string): string { return "text-muted-foreground"; } const contextCell = ref<{ rowId: number; rowIndex: number; col: number } | null>(null); +const contextHeaderColumn = ref(null); const detailCell = ref<{ rowIndex: number; col: number } | null>(null); const hoveredDetailCell = ref<{ rowIndex: number; col: number } | null>(null); const showCellDetail = ref(false); @@ -2779,7 +2780,18 @@ watch( ); // --- Context menu handlers --- +function onHeaderContext(col: string) { + contextCell.value = null; + clearCellSelection(); + clearRowSelection(); + contextHeaderColumn.value = col; +} +async function copyHeaderColumn() { + if (!contextHeaderColumn.value) return; + await copyText(contextHeaderColumn.value); +} function onCellContext(rowId: number, rowIndex: number, colIdx: number, visibleColIdx: number) { + contextHeaderColumn.value = null; contextCell.value = { rowId, rowIndex, col: colIdx }; if (hasRowSelection.value && isRowSelected(rowId)) { void prefetchCopyStatements(); @@ -2793,6 +2805,7 @@ function onCellContext(rowId: number, rowIndex: number, colIdx: number, visibleC } function onRowContext(rowId: number, rowIndex: number) { + contextHeaderColumn.value = null; contextCell.value = { rowId, rowIndex, col: -1 }; if (!isRowSelected(rowId)) { clearCellSelection(); @@ -3669,6 +3682,7 @@ defineExpose({ }" :style="{ width: `var(--col-w-${colIdx})` }" :data-grid-column-index="actualColumnIndex(colIdx)" + @contextmenu="onHeaderContext(col)" > + - + {{ t("grid.copy") }} {{ t("grid.copyCell") }}