Skip to content

feat(data-grid): cell-level selection and copy#161

Merged
debba merged 1 commit intoTabularisDB:mainfrom
thomaswasle:feature/cell-level-selection-and-copy
May 6, 2026
Merged

feat(data-grid): cell-level selection and copy#161
debba merged 1 commit intoTabularisDB:mainfrom
thomaswasle:feature/cell-level-selection-and-copy

Conversation

@thomaswasle
Copy link
Copy Markdown
Contributor

Summary

Introduces two distinct, mutually exclusive selection modes in the data grid:

Cell selection — click any data cell to focus it. The focused cell is highlighted with a blue
inset ring. Ctrl/Cmd+C copies that cell's raw value as a string.

Row selection — click the row-number column on the left to select one or more rows (existing
shift-click range and Ctrl/Cmd-click toggle behaviour is unchanged). Ctrl/Cmd+C copies the
selected rows in the configured format (CSV / JSON).

The two modes clear each other: clicking a cell clears any row selection; clicking a row number
clears cell focus. Clicking the # header (select all) also clears cell focus.

A "Copy Cell" item has been added to the right-click context menu as a discoverable alternative
to the keyboard shortcut.

Changes

  • focusedCell state ({ rowIndex, colIndex } | null) tracks the active cell
  • copyCellValue(rowIndex, colIndex) formats the value via formatCellValue (handles null, boolean,
    JSON, geometry, BLOB) and writes it to the clipboard
  • copyCellFromContext wires the new context menu item to the same logic
  • Cell click: sets focusedCell, clears row selection — no longer triggers handleRowClick
  • Row-number click: clears focusedCell, then runs handleRowClick as before
  • handleSelectAll (the # header): clears focusedCell before selecting all rows
  • Focused cell renders with ring-2 ring-inset ring-blue-400 for a clear, layout-neutral visual
    indicator
  • Ctrl/Cmd+C handler simplified: focusedCell → copy cell; selectedRowIndices.size > 0 → copy rows
    (the two states are now mutually exclusive)

@debba
Copy link
Copy Markdown
Collaborator

debba commented May 5, 2026

Interesting, I will test it ASAP

@debba debba merged commit 101f77d into TabularisDB:main May 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants