You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bbc7e03
Browse filesBrowse the repository at this point in the historyBrowse files
feat(grid): a list cell's right-click menu copies, pastes and clears that cell (#36790)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8TkiiiqHvFYXaB2vYtLWWEC)_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.
<details><summary>Runs</summary>
```
# affected packages, under scripts/pm/os-verify-lock.sh, at 3a524f3
# (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 2f73214, 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 3a524f3
Test Files 6 passed (6) Tests 78 passed (78)
# type-check at 2f73214, 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 2f73214: 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 2f73214: every check suite completed with no failure; mergeable_state clean
```
</details>
## 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
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (no formatter ran; lint
read from CI: `Lint UI` and `Lint · ESLint` success at 2f73214)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbXwSwKtFLjfawUUTVG)_
<!-- signed: repo:objectstack#1 · os-warren ·
session_01JQwxbXwSwKtFLjfawUUTVG -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
feat(grid): a list cell's right-click menu copies, pastes and clears that cell
9
+
10
+
Clause-②: yes (widening) — an optional `cell` member (`copy`, `paste`, `clear`) on the context `data-table` hands a host's `renderRowContextMenu`; five new `table.*` language-pack keys in every locale `@object-ui/i18n` ships (`copyCell`, `pasteCell`, `clearCell`, `pasteNotValue`, `pasteUnavailable`); nothing is removed or renamed
11
+
Metadata-protocol: none
12
+
13
+
Right-clicking a cell in a list now offers what can be done to that cell, above the row's own items.
14
+
15
+
- The menu has two sections. Above a line: **Copy**, **Paste**, **Clear** and, where it was already offered, **Change history**. Below it: the row's items as before (Open, Open in new tab, the row's actions). A right-click off a data cell opens the row's section only.
16
+
-**Copy** copies the cell's value, as Ctrl/Cmd+C does.
17
+
-**Paste** writes the clipboard's text into the cell and saves it, through the same checks as typing into the cell: text that is not an email address in an email cell, a value over a field's length, an empty required field are refused and the cell says why. If the browser will not let the list read the clipboard, the cell says so and names Ctrl/Cmd+V. Paste is offered on text, numbers, dates and single-choice fields (an option by its value or label); on a record reference, a person, a multi-choice and other types it is unavailable.
18
+
-**Clear** empties the cell and saves it, as Backspace does; it is unavailable on a required field.
19
+
- On a read-only field, a calculated field, a grid that is not editable or a record the reader may not change, Paste and Clear are unavailable and Copy still works.
20
+
- A paste into the selected cell with Ctrl/Cmd+V now goes through the same checks: text the cell's editor would refuse is no longer sent to be saved, and text the column cannot read (letters in a number cell, a name in a lookup cell) says why instead of doing nothing.
0 commit comments