Skip to content

feat(datagrid): read-only cell viewer with unified interaction dispatcher#1341

Merged
datlechin merged 8 commits into
mainfrom
feat/datagrid-readonly-cell-viewer
May 20, 2026
Merged

feat(datagrid): read-only cell viewer with unified interaction dispatcher#1341
datlechin merged 8 commits into
mainfrom
feat/datagrid-readonly-cell-viewer

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • Double-click or press Return on a query result cell now opens an inline NSTextView overlay (read-only, selectable, copyable). JSON columns open the JSON viewer in a popover, BLOB columns open the hex viewer.
  • Adds CellInteractionResolver (pure value-type): single source of truth that maps cell context to a CellInteractionMode. Replaces the duplicated decision trees previously scattered across handleDoubleClick, insertNewline, and handleChevronAction.
  • Extracts CellOverlayBase shared base class for CellOverlayEditor and CellOverlayViewer — positioning, dismiss observers, raise-to-front. Editor down 295→120 LOC, viewer 235→70 LOC, base 200 LOC.
  • JSONViewerView(isEditable: false) reused for read-only JSON popover via new JSONViewerContentView wrapper.
  • HexEditorContentView gets isEditable parameter; viewer mode hides the editable hex section and Save button.

Fixes part 2 of #1336 (part 1 — Cmd+C single-cell — landed via #1337/#1338).

Test plan

  • Open a query result (SELECT 'A', 'B'). Double-click A cell — inline overlay opens with A selected. Cmd+C copies just A.
  • Cmd+A in the viewer then Cmd+C → copies full cell value.
  • Esc, click outside, scroll, or column resize — viewer dismisses.
  • Press Return on a focused read-only cell — viewer opens.
  • JSON column cell in read-only mode → JSON viewer popover opens with syntax highlighting + Tree mode.
  • BLOB column cell in read-only mode → hex viewer popover opens (no editable hex section, no Save).
  • Editable browse table: double-click still routes to inline edit / overlay editor / JSON editor / BLOB editor / FK popover as before.
  • Run resolver tests: xcodebuild test -only-testing:TableProTests/CellInteractionResolverReadOnlyTests + CellInteractionResolverEditableTests.

Architecture

The refactor introduces three new value-types and one new sibling overlay class, eliminating ~140 LOC of geometry+observer duplication. Cell-interaction routing is now driven by one resolver; double-click, Return key, and (future) chevron action all consume the same CellInteractionMode.

@datlechin datlechin merged commit ff967c8 into main May 20, 2026
2 checks passed
@datlechin datlechin deleted the feat/datagrid-readonly-cell-viewer branch May 20, 2026 05:59
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.

1 participant