Skip to content

feat(grid): a list cell's right-click menu copies, pastes and clears that cell - #36790

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-xov5ie
Nov 23, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-xov5ie

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Fixes #36289

Clause-②: yes (widening) — an optional cell member on the context data-table hands a host's renderRowContextMenu, and five new table.* language-pack keys in every locale
Metadata-protocol: none

维护者速读

  • 列表里在格子上点右键,菜单上半段多了这个格子的「复制、粘贴、清空」,后面接着已有的「修改历史」;一条分隔线下面还是原来整行的「打开、在新标签页打开、编辑、删除」,内容和顺序都没动。
  • 属于「列表专题」里对照 Attio 定的第 2 条:右键菜单放格子自己的动作,同时保留整行的动作。
  • 出错时最多是菜单项该灰没灰、或格子上的提示不对;粘贴和在格子里直接输入走同一套检查和保存(邮箱格粘贴非邮箱文字、清空必填格都会被拒并说明原因),不会存进不合规的值,可以整体撤回。
  • 无

What changes

The table (@object-ui/components, data-table)

  • renderRowContextMenu now also receives context.cell whenever it receives context.column: copy, paste, clear for that data cell, each absent where the table would refuse it. copy is the Ctrl/Cmd+C path (one function now, copyCellValue; a masked cell copies nothing, so copy is absent there). paste reads navigator.clipboard.readText() inside the click that chose it and writes the text through pasteIntoCell, the selected-cell paste path. clear is clearCell, the Backspace path. paste and clear are absent on a cell readOnlyReasonOf refuses; clear also on a two-state cell and on a cell whose facts carry a clearRefusal (required).
  • pasteIntoCell now holds the converted value to the cell editor's own check (GridCellFacts.validate: required, length, range, email / URL shape) before it writes, and says on the cell why when the check refuses or the text stands for no value of the column (table.pasteNotValue). Before, a paste into an email cell sent any text to be saved, and text a number or lookup cell cannot read was dropped without a word.
  • A clipboard the browser will not hand over (no API, permission declined) puts table.pasteUnavailable on the cell, which names Ctrl/Cmd+V.
  • A cell item's write waits until the menu has closed and focus is back on the cell (whenRowContextMenuClosed); otherwise that focus move dismisses the note the write puts on the cell.

The list (@object-ui/plugin-grid)

  • RowContextMenuItems draws two sections: the cell's Copy, Paste, Clear, then Change history (moved up from the row's items), a separator, then the row's items in their existing order (Open, Open in new tab, the row's actions). Unavailable items are drawn disabled.
  • ObjectGrid passes the table's cell through, and draws Paste unavailable on a field type pasted text cannot stand for (pastesFromText in objectGridCellFacts.ts: text, textarea, email, url, phone, number, currency, percent, date, datetime, select, radio). A lookup, a person, a multi-choice and other types: Paste unavailable.
  • A grid with no row action and no selection still keeps the browser's menu unless the cell can be changed (Paste or Clear available) or has a change history; Copy alone does not take the browser's menu away.

Language packs — table.copyCell, table.pasteCell, table.clearCell, table.pasteNotValue, table.pasteUnavailable in all 11 locales (zh-Hant regenerated from zh-Hans by gen:zh-hant); the two notes are mirrored in the table's English defaults.

Docs — "A cell's own menu items" in content/docs/frontend/plugins/plugin-grid.mdx and the plugin-grid README.

Tests

  • New ui/packages/plugin-grid/src/__tests__/cellContextMenu-36289.test.tsx (12), through the real ObjectGrid → data-table chain with a data source recording each update: the section order (cell items, separator, row-context-open below it); a right-click on the selection cell opens the row's section only; Copy writes the cell's text; Paste writes and saves (update('account', 'r2', { notes })); Paste of not an address into an email cell saves nothing and shows Please enter a valid email address; Ctrl+V on the selected cell refuses the same text the same way (CONTROL: a real address saves); a refused clipboard read says so on the cell; Clear saves null; Clear disabled on a required field (CONTROL: enabled on an optional one); a read-only field has Copy only; a lookup and a multi-select have Paste disabled and Clear enabled; a grid that is not editable has Copy only.
  • data-table-row-context-menu-28434.test.tsx: the host context now carries cell ({ copy } on a table the reader cannot edit), plus two cases: an editable cell hands copy, paste, clear and copy writes the value; a masked, non-editable cell hands none.
  • rowContextMenu-28434.test.tsx and phoneCardRowActions-29150.test.tsx compare the row's section only: a menu opened on a data cell now lists the cell's items first.
Runs
# affected packages, under scripts/pm/os-verify-lock.sh, at 3a524f386f
#   (plugin-grid, i18n, types, components, app-shell defaults-maps-mirror-en-pack)
os-verify-lock: VERDICT command-exit 1
Test Files  2 failed | 1312 passed | 1 skipped (1315)   Tests  2 failed | 20219 passed | 37 skipped (20258)
#   the two reds: zh-hant-generated (zh-Hant hand-written instead of generated) and
#   phoneCardRowActions-29150 (compared the whole menu); both fixed at 2f73214d8a, re-run:
os-verify-lock: VERDICT command-exit 0
Test Files  2 passed (2)   Tests  15 passed (15)
# the touched context-menu and cell-editing pins at 3a524f386f
Test Files  6 passed (6)   Tests  78 passed (78)
# type-check at 2f73214d8a, the four packages joined with && under the lock
#   (types, i18n, components, plugin-grid: tsc --noEmit && tsc -p tsconfig.test.json each)
os-verify-lock: VERDICT command-exit 0
# derived gates at 2f73214d8a: node scripts/pm/dispatch-gates.mjs --commands, each run with its exit code recorded, then --ran
Run reconciliation — 73 derived, 72 run, 1 NOT-MEASURED, 0 UNRUN.
#   72 exited 0. NOT MEASURED: check:skill-examples, reason: exit 3 PREREQUISITE NOT MET
#   (it reads packages/client-react's built .d.ts, which this card does not touch and the container had not built);
#   CI's Lint suites ran it on this head and passed.
# CI at 2f73214d8a: every check suite completed with no failure; mergeable_state clean

Acceptance notes

  • Agreed with the seat before code: Ctrl/Cmd+V on the selected cell reads the same pasteIntoCell, so it now refuses what the editor refuses and says why when the text stands for no value, where it used to save or drop silently. Keyboard bindings are unchanged.
  • Change history moved from the row's items to the cell's section, as the card's layout asks; the row's own items keep their content and order (the queued row-order card is not touched).
  • The card's unverified point on pasting into a reference, person or multi-choice field: Paste is drawn unavailable there, as the card proposed. Ctrl+V on a multi-choice cell still matches options by name as before.
  • An unsaved view draft is unaffected by a paste: a paste writes the record through the same per-cell save as typing, which never reads or writes the view draft. Checked in the browser (frames 8a/8b): with an unsaved draft sort by Company showing its Discard / Save bar, a paste into a contact's Company cell sent only PATCH /api/v1/data/showcase_contact/RECORD_ID {"company":…}; the draft bar, the draft sort and the row order were unchanged after it.

Verification

Checked in a browser on the showcase app (examples/app-showcase, local dev stack, this branch's head). GitHub takes image uploads from a browser only, so the twelve frames are attached in the project's card thread; what each one shows:

Frame What it shows
1-cell-menu Right-click on a contact's Company cell (en): Copy, Paste, Clear, Change history, a separator, then Open, Open in new tab, Edit, Delete
zh-1-cell-menu, zh-2-contact-cell-menu The same menu in zh-CN on a project's Name cell and a contact's Company cell: 复制 / 粘贴 / 清空 / 修改历史, separator, 打开 / 在新标签页打开 / 编辑 / 删除
2-required-clear-grey Full name (required): Clear disabled, Copy and Paste enabled
3a-before-paste, 3b-pasted-saved Company copied from one contact and pasted into another's: the cell shows the new value and the request is PATCH /api/v1/data/showcase_contact/RECORD_ID {"company":"华宁科技"}
4-email-refused Pasting not an address into an Email cell: the cell's note says "Please enter a valid email address" and no request is sent
5-checkbox-row-only Right-click on the selection checkbox: the row's section only (Open, Open in new tab, Edit, Delete)
6-lookup-paste-grey A project's Account (a required lookup): Paste and Clear disabled, Copy enabled
7-formula-readonly A project's Remaining budget (a formula): Paste and Clear disabled, Copy enabled
8a-draft-sort-before-paste, 8b-draft-sort-after-paste An unsaved draft sort with its Discard / Save bar, before and after a paste: draft and row order unchanged, only the record PATCH sent

Two-minute check: on any list, right-click a text cell. Expect Copy, Paste, Clear (and Change history) above a line and Open, Open in new tab, Edit, Delete below it; on a required field Clear is grey.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (no formatter ran; lint read from CI: Lint UI and Lint · ESLint success at 2f73214)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 23, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 2f73214d8a7d09d30e3fe605a2a68239b9f2177c
Local-runs: none
Scope: the whole diff of #36790, git diff e0f0e9f7da7355b84da76e13821ba18a082eb9ec 2f73214d8a7d09d30e3fe605a2a68239b9f2177c (23 files, 4 commits). Contract face (the Clause-②: yes (widening) declaration): ui/packages/types/src/data-display.ts (DataTableSchema.renderRowContextMenu), ui/packages/i18n/src/locales/{ar,de,en,es,fr,ja,ko,pt-BR,ru,zh-Hans,zh-Hant}.ts, .changeset/36289-list-cell-context-menu.md. Files in the diff that implement or consume it: ui/packages/components/src/renderers/complex/data-table.tsx, ui/packages/plugin-grid/src/{ObjectGrid.tsx,components/RowContextMenu.tsx,objectGridCellFacts.ts}, the tests components/.../data-table-row-context-menu-28434.test.tsx and plugin-grid/src/__tests__/{cellContextMenu-36289,rowContextMenu-28434,phoneCardRowActions-29150}.test.tsx, ui/packages/plugin-grid/README.md, content/docs/frontend/plugins/plugin-grid.mdx. Cited and read only: components/.../dataTableCellSelection.ts (defaultValueFromText), plugin-grid/src/index.tsx (what the package exports), the exports maps of @object-ui/{types,components,plugin-grid,i18n}, the GridCellFacts producer in ObjectGrid.tsx (describeCell), fieldHistoryCellMenu-36290.test.tsx, AGENTS.md's changeset rule.
Security-touching: no
Rule-change-verified: none

Everything below comes from reading the diff and the tree at the head. Nothing was run. The PR body and card #36289 were read for context. The head matches the PR's head.sha; it did not move.

① Derived judgments

The widening declaration is right and complete.

  • DataTableSchema.renderRowContextMenu's context gains one optional member, cell?: { copy?: () => void; paste?: () => void; clear?: () => void }. This is the seam feat(record-page): one field's change history, from the field and from a list cell's menu #36661 widened with column. A host callback typed against the old context still type-checks, because the context it receives is a subtype of what it declared. Nothing in the context is removed or retyped.
  • Five keys are added under table in all eleven shipped packs: copyCell, pasteCell, clearCell, pasteNotValue, pasteUnavailable (five per pack, checked per file). @object-ui/i18n publishes them through ./locales and ./locales/*. No key is removed or renamed. zh-Hant matches zh-Hans as generated.
  • There are no other new public names. RowContextMenuCell and the cell prop on RowContextMenuItems live in components/RowContextMenu.tsx, and pastesFromText lives in objectGridCellFacts.ts. plugin-grid/src/index.tsx exports none of them, and the package's exports map has only .. The two notes added to TABLE_DEFAULT_TRANSLATIONS and the three items added to CONTEXT_MENU_FALLBACKS are module-private English mirrors of the pack keys. No component prop on a public export changes.
  • Nothing is narrowed on a published type. column keeps its 字段修改历史:动态里的修改显示「旧值 → 新值」;字段和格子上可以看这一个字段的历次修改(数据后端已有) #36290 meaning in every case that can occur (see N1 for the one theoretical exception).

The new member's shape works for consumers.

  • The verbs are nullary and return nothing, and the table owns the outcome: the conversion, the editor's checks, the save, and the note on the cell. A host only has to draw items, so it cannot paste around the checks. That fits the "host supplies only the items" rule the slot already states.
  • "Absent means the table would refuse it" lets a host draw an item as unavailable without knowing the table's rules. The shape gives no reason why an item is unavailable, so a host cannot explain a greyed item. That is acceptable for a first widening, and the member can add a reason later without breaking anyone.
  • cell always appears together with column, so a host reading cell already has the column, and the pair stays consistent.

Behaviour changes a consumer will see are declared. Ctrl/Cmd+V on a selected cell now runs GridCellFacts.validate and shows table.pasteNotValue. Before, it saved any text or dropped it without a word. The changeset says so in its last bullet. This changes what a UI path accepts. It is not a published accepted-set: no schema, metadata key or API input moves, and the server's own rules are unchanged. It does not need a (narrowing) arm.

② Semver level

  • patch on @object-ui/types, @object-ui/components, @object-ui/plugin-grid and @object-ui/i18n, all four published. This follows AGENTS.md's changeset rule: a non-protocol change, widening included, ships patch. Only a Metadata-protocol kind other than none forces minor.
  • Metadata-protocol: none is right. renderRowContextMenu is a runtime slot that the zod twin refuses by name (handlerKeyRefusal), and pack keys are not something a metadata author writes. No spec key, accepted value or metadata type moves.
  • Clause-②: yes (widening) appears at the start of a line in both the PR body and the changeset, and both name the same surfaces: the cell member and the five keys. No major: nothing is removed or retyped.

③ Boundary flags

  • Pins fail without the fix, by reading. On the base, data-table-row-context-menu-28434's exact-equality toHaveBeenCalledWith(..., { selected, column, cell: { copy } }) would fail because the base has no cell. So would the new describe block's ['clear','copy','paste'] key set and the masked {} case. Every case in cellContextMenu-36289 relies on row-context-cell-* items that the base never draws. The Ctrl+V-refuses case fails on the base, which saved not an address.
  • No test was weakened in a way that hides a regression. rowContextMenu-28434 and phoneCardRowActions-29150 now filter out row-context-cell-* and row-context-field-history, so they compare only the row's section. The row's items and their order are still compared exactly. The position of Change history is now pinned by cellContextMenu-36289, and its presence and absence by the unchanged fieldHistoryCellMenu-36290.
  • Downstream apps. No other implementation of renderRowContextMenu in this repo or its UI packages has to change: ObjectGrid is the only host. The new pack keys are additive.
  • SQL / id materialization. Not touched; client-only change.
  • Author. PR user.login is os-warren, not objectstack-fleet[bot].

④ Design judgment

This PR's surfaces are the Clause-②: yes declaration alone. They include no published schema, governed rule text or narrowing, so ④ is not required. For the record:

  • Having the table hand verbs, rather than having the host reimplement copy, paste and clear, keeps one path per action: copyCellValue for Ctrl+C and Copy, pasteIntoCell for Ctrl+V and Paste, clearCell for Backspace and Clear. The card asks for "the same behaviour as the shortcut" and "the same checks and save as in-cell editing". This shape is what makes those hold.
  • The extra pasteable (by field type) gate lives in the host and stays out of the published member. That is the right split: the table cannot know a field type's paste semantics, and ObjectGrid can.

Findings:

Implemented-by: claude/project-thread-xov5ie
Reviewed-by: session_01JQwxbZeHNsF3RWcWpj7rGj

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

维护者速读

列表格子上点右键,菜单上半段是这个格子的动作(复制、粘贴、清空、修改历史),下半段是整行原来的动作,顺序不变。粘贴和 Ctrl+V 都按这个字段的输入规则检查,不合格的会在格子上说明原因;必填字段不能清空,只读或不能改的格子不能粘贴和清空。
要你做的:无(普通改动,席位自动合并)。

席位核对 — ACCEPT (L1) · repo:objectstack#1 · head 2f73214d · 2026-11-23T23:20Z

  • Shape: Fixes #36289. ui/packages/types/src/data-display.ts (optional cell on the row-menu context), components/src/renderers/complex/data-table.tsx, plugin-grid/src/ObjectGrid.tsx, components/RowContextMenu.tsx, objectGridCellFacts.ts, five table.* keys in all 11 locales, tests, the plugin-grid docs page, a patch changeset. Clause-②: yes (widening). Metadata-protocol: none.
  • Record half: same-head TIER_DEFAULT PASS 7116834063 at 2f73214d, nits only.
  • Read:
    • Paste and Ctrl+V share pasteIntoCell, which is held to the cell editor's validation.
    • Clear is disabled on required fields. Paste and Clear are disabled on read-only or unwritable cells (masked, read-only, a non-editable grid, no update permission). Paste is disabled on lookup, person and multi-choice fields.
    • A clipboard denial is explained on the cell.
    • Change history moved into the cell block. The row block's items and order are unchanged, and the existing row-menu tests still compare them exactly.
    • The write path is the record save alone.
  • Acceptance notes (declared in the PR): Ctrl+V of text the editor refuses no longer saves. On an editable grid with no row actions, right-clicking a writable cell now opens the app's menu.
  • Nits, not blocking:
    • Paste reads the field type from the object schema, so it can be greyed on a writable text cell until the schema loads.
    • Under the opt-in staged model (cellSelection={false}, unused in-repo), the required-field rule has no cell facts to read.
    • A Paste from an empty clipboard shows no note.
    • The unaffected-view-draft point is pinned only by browser frames.
  • Gates: 54 success, 12 expected skip, 0 failed on 2f73214d; mergeable_state clean.
  • Landing: the seat readies the PR and arms auto-merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 23, 2026 23:21
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit bbc7e03 Nov 23, 2026
67 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-xov5ie branch November 23, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

列表格子上点右键:菜单上半段是这个格子的动作(复制、粘贴、清空、修改历史),下半段保留整行的动作

2 participants