Repository navigation
feat(grid): a list cell's right-click menu copies, pastes and clears that cell - #36790
Conversation
…that cell Claude-Session: https://claude.ai/code/session_01JQwxbXwSwKtFLjfawUUTVG Co-authored-by: Claude <noreply@anthropic.com>
…changeset Claude-Session: https://claude.ai/code/session_01JQwxbXwSwKtFLjfawUUTVG Co-authored-by: Claude <noreply@anthropic.com>
…, so their note stays on the cell Claude-Session: https://claude.ai/code/session_01JQwxbXwSwKtFLjfawUUTVG Co-authored-by: Claude <noreply@anthropic.com>
…erated Claude-Session: https://claude.ai/code/session_01JQwxbXwSwKtFLjfawUUTVG Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj Contract reviewServed-tier: 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 ① Derived judgmentsThe widening declaration is right and complete.
The new member's shape works for consumers.
Behaviour changes a consumer will see are declared. Ctrl/Cmd+V on a selected cell now runs ② Semver level
③ Boundary flags
④ Design judgmentThis PR's surfaces are the
Findings:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj 维护者速读列表格子上点右键,菜单上半段是这个格子的动作(复制、粘贴、清空、修改历史),下半段是整行原来的动作,顺序不变。粘贴和 Ctrl+V 都按这个字段的输入规则检查,不合格的会在格子上说明原因;必填字段不能清空,只读或不能改的格子不能粘贴和清空。 席位核对 — ACCEPT (L1) · repo:objectstack#1 · head
|
Requested by Warren · project thread
Fixes #36289
Clause-②: yes (widening) — an optional
cellmember on the contextdata-tablehands a host'srenderRowContextMenu, and five newtable.*language-pack keys in every localeMetadata-protocol: none
维护者速读
What changes
The table (
@object-ui/components,data-table)renderRowContextMenunow also receivescontext.cellwhenever it receivescontext.column:copy,paste,clearfor that data cell, each absent where the table would refuse it.copyis the Ctrl/Cmd+C path (one function now,copyCellValue; a masked cell copies nothing, socopyis absent there).pastereadsnavigator.clipboard.readText()inside the click that chose it and writes the text throughpasteIntoCell, the selected-cell paste path.clearisclearCell, the Backspace path.pasteandclearare absent on a cellreadOnlyReasonOfrefuses;clearalso on a two-state cell and on a cell whose facts carry aclearRefusal(required).pasteIntoCellnow 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.table.pasteUnavailableon the cell, which names Ctrl/Cmd+V.whenRowContextMenuClosed); otherwise that focus move dismisses the note the write puts on the cell.The list (
@object-ui/plugin-grid)RowContextMenuItemsdraws 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.ObjectGridpasses the table'scellthrough, and draws Paste unavailable on a field type pasted text cannot stand for (pastesFromTextinobjectGridCellFacts.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.Language packs —
table.copyCell,table.pasteCell,table.clearCell,table.pasteNotValue,table.pasteUnavailablein all 11 locales (zh-Hantregenerated fromzh-Hansbygen: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.mdxand the plugin-grid README.Tests
ui/packages/plugin-grid/src/__tests__/cellContextMenu-36289.test.tsx(12), through the realObjectGrid→data-tablechain with a data source recording eachupdate: the section order (cell items, separator,row-context-openbelow 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 ofnot an addressinto an email cell saves nothing and showsPlease 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 savesnull; 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 carriescell({ copy }on a table the reader cannot edit), plus two cases: an editable cell handscopy,paste,clearandcopywrites the value; a masked, non-editable cell hands none.rowContextMenu-28434.test.tsxandphoneCardRowActions-29150.test.tsxcompare the row's section only: a menu opened on a data cell now lists the cell's items first.Runs
Acceptance notes
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.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:1-cell-menuzh-1-cell-menu,zh-2-contact-cell-menu2-required-clear-grey3a-before-paste,3b-pasted-savedPATCH /api/v1/data/showcase_contact/RECORD_ID {"company":"华宁科技"}4-email-refusednot an addressinto an Email cell: the cell's note says "Please enter a valid email address" and no request is sent5-checkbox-row-only6-lookup-paste-grey7-formula-readonly8a-draft-sort-before-paste,8b-draft-sort-after-pasteTwo-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
packages/specholds no runtime logic.pnpm lintpasses. (no formatter ran; lint read from CI:Lint UIandLint · ESLintsuccess at 2f73214)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code