Skip to content

Commit 543585d

Browse files
feat(record-page): one field's change history, from the field and from a list cell's menu (#36661)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8X8kSCzcbcWxbzbjcuNrVrv)_ Fixes #36290 Fixes #36615 Clause-②: yes (widening) Metadata-protocol: none Part 3 of the card, the last one: the per-field change history, its two entry points and the read-permission rule (card items 3, 4 and the 修改历史 half of item 5). Part 1 (#36399) made the server serve each changed field's old → new values narrowed per reader; part 2 (#36613) drew them under the record's activity entries; part 1 of the Studio producers (#36641) moved them to `fieldHistory`. Ruling-ref: 7076513167 — a value the viewer cannot read is never sent to the browser, and the `sys_audit_log` grant is never widened. #36615 rides along: it is the one sentence in `packages/spec` that still told authors to write `trackHistory: true`. ## 维护者速读 - 记录页上会记录修改前后值的字段,值旁边多了一个「修改历史」小按钮(鼠标移上去或键盘聚焦时出现),列表里在这类字段的格子上右键也多了「修改历史」;点开就地弹一张小卡片,列出这一个字段改过几次、谁改的、什么时候、从什么改成什么,最新的在上,先给十条,可以继续加载。没开修改历史的字段(比如图片、附件、密码,或被设置关掉的字段)不显示这个入口。 - 属于「记录详情页重做」专题里的字段修改历史,这是最后一段:前几段让服务器把前后值按权限发出来、在动态里画出来,这一段让人能只看一个字段的历史。 - 出错时,用户会看到卡片排版不对或加载不出来;不会多看到任何没权限的字段,因为没有读取权限的字段既不显示入口、服务器也本来就不发值;可以整体撤回,数据不受影响。 - 无 ## What changes **The card** (`ui/packages/plugin-detail/src/FieldHistory.tsx`, new) - `FieldHistoryCard` lists one field's changes on one record: `who · when` over `old → new`, newest first, the newest ten with **Load more**. The values are worded exactly as the activity lines word them — an option by the field's option label in the reader's language, a yes/no by the pack's word, an empty side by the pack's word for empty — through one new shared hook (`fieldChangeText.ts`, `useFieldChangeWording`), which `RecordActivityTimeline` now reads too, so the two surfaces cannot word the same change apart. - A field never changed: **No changes recorded**, with who created the record and when, read off the record's `created` activity row. - A refused read (401 / 403) says the reader may not see this record's activity; any other failure says the activity could not be loaded. - `useFieldHistory` reads `sys_activity` **by record**, newest first, fifty rows at a time (`$skip` / `$top`), keeping the rows whose served change code names the field. One user action — the open, or one **Load more** — reads at most `FIELD_HISTORY_SCAN_BATCHES_PER_LOAD` (4) batches: it stops sooner when it has the page it shows or the rows run out, and otherwise stops there and offers **Load more** to read on. When those batches held no change of the field and older rows remain, the card says **No changes in the recent activity** (new key `detail.fieldHistoryNoneRecent`); **No changes recorded** needs every row read. A row repeated by a `$skip` shifted under a concurrent write is kept once. It reads no change column, because a query naming one is refused for a reader withheld any field of the object (`parent-field-query-guard.ts`), and it never reads `sys_audit_log`. **The two entry points** - The record page: `FieldHistoryButton`, a history icon beside the value in `DetailSection`, revealed on hover and on keyboard focus like the copy button, opening the card in a popover. Drawn only for a field the object declares, on the page's own record, and only when `fieldHistoryOffered` says so: not a platform record column (`id`, `created_at`, …), not a field whose old → new values the writer never records (`resolveFieldHistory(field, object)` from `@objectstack/spec/data`, the one predicate plugin-audit's `changeValuesShownFor` keeps values by — false for `fieldHistory: false`, object `enable.fieldHistory: false`, a credential field, and a default-off type such as image, file or JSON that does not opt in), and not a field the reader may not read (`checkField(object, field, 'read')`). - The list: `data-table` now names the data cell a context menu opened on to its host (`context.column`, a new optional member of the context `renderRowContextMenu` receives — a `data-cell-column` attribute on the cell), `ObjectGrid` adds **Change history** for a cell of a declared field that `fieldHistoryOffered` accepts (recorded and readable, the same gate as the record page) when its data source can read activity, and choosing it opens the same card at the pointer (`FieldHistoryPopover`). - `FieldChangeItem` draws no label for `label: ''`, so the card can name the field once above its lines. **`packages/spec`** — the unknown-key guidance row for the mistyped field key `tracked` now names `fieldHistory: false` (and `enable.fieldHistory: false` on the object) instead of `trackHistory: true`, which after #36399 changes nothing for most field types. Wording only: `tracked` stays rejected, no key, shape or default moves. **Language packs** — `detail.fieldHistory`, `detail.fieldHistoryNone` and `detail.fieldHistoryNoneRecent` in all 11 locales `@object-ui/i18n` ships, mirrored byte-identically in `DETAIL_DEFAULT_TRANSLATIONS`. ## Tests New pins at head `c429064ab8`: - `ui/packages/plugin-detail/src/__tests__/FieldHistory-36290.test.tsx` (13): only this field's changes, newest first, with actor and timestamp; a save of two fields gives this field's line alone; the read names no change column (`$filter` is the record, and the params hold no `changed_fields` / `metadata`); an option side reads as its label and an empty side as `Empty`; the newest ten, then **Load more** to the rest; paging past a full batch of another field's rows to find this field's changes (two reads, the second `$skip`ped); one open reads exactly 4 batches on a record whose field change lies past them, says `No changes in the recent activity` (not `No changes recorded`), reads nothing more without a click, and **Load more** reads the fifth batch at `$skip` 200 and finds the change; never changed → `No changes recorded` with the creator and the creation time; a refused read. For the entry point: every declared field offers it and `created_at` does not, nothing is read until it is opened, a field the reader may not read has no entry (CONTROL: the readable sibling keeps it), a field whose values are not recorded has no entry — `fieldHistory: false`, a `json` field, a `password` field (CONTROL: a `json` field with `fieldHistory: true` keeps it) — an object with `enable.fieldHistory: false` offers none (CONTROL: the same object without it offers both), and a section not drawing the page's record offers none. - `ui/packages/plugin-grid/src/__tests__/fieldHistoryCellMenu-36290.test.tsx` (5): the cell's menu item opens that record's changes of that field (and the read is scoped to that record); a field the reader may not read has no column, so no cell offers it (CONTROL: a readable field's cell still does); a host-joined column the object does not declare offers none; a cell of a `fieldHistory: false` field opens no row menu at all on a table with no row actions (CONTROL: a recorded field's cell offers it); a data source that cannot read activity offers none. - `ui/packages/components/src/renderers/complex/__tests__/data-table-row-context-menu-28434.test.tsx`: the existing host-renderer pin now asserts `column`, plus one new case — the column of the data cell the menu opened on, and no column off a data cell (the row's "⋮" cell). <details><summary>Runs</summary> ``` # the two new pin files, at c429064 Test Files 2 passed (2) Tests 18 passed (18) # affected packages at c429064, under scripts/pm/os-verify-lock.sh (plugin-detail, plugin-grid, i18n, # types, components/renderers/complex, app-shell defaults-maps-mirror-en-pack) os-verify-lock: VERDICT command-exit 0 Test Files 1260 passed | 1 skipped (1261) Tests 19388 passed | 31 skipped (19419) # + app-shell RecordDetailView.harness and the i18n call-site parity suite Test Files 2 passed (2) Tests 234 passed (234) # packages/spec (the tracked row; no spec file moved since 975c4c5) packages/spec src/data/field.test.ts Test Files 1 passed Tests 308 passed (308) # type-check at c429064, exit 0 each: plugin-detail, plugin-grid, i18n (components, types unchanged since 975c4c5, exit 0 there) # dispatch-gates at c429064: the same 117 derived commands as at 975c4c5 (diffed), re-run, 117/117 exit 0 ``` Ablations through `scripts/ablation-replace.mjs` (anchor hit and blob move printed by the tool; each restored, `git diff HEAD` empty and the file's blob equal to its `HEAD` blob afterwards): | Mutation | Result | |---|---| | the read-permission gate in `fieldHistoryOffered` removed | 1 red: `a field the reader may not read has no entry` | | the batch read always marks itself exhausted | 1 red: `pages past rows of other fields until it finds this field's changes` | | the card keeps the first served change instead of the one naming the field | 3 red, the field-identity pins | | at c429064: the `resolveFieldHistory` gate in `fieldHistoryOffered` made a no-op | 3 red: the two record-page history-off pins and the grid's | | at c429064: the per-action batch cap removed (`needsRead = wantsMore`) | 1 red: `one open reads at most 4 batches, then "Load more" reads on` | </details> ## Acceptance notes - Rework after contract review 7097637110 (FAIL, two should-fix, no must-fix): **S1** the entry points are now gated by `resolveFieldHistory`, so a field whose values are never recorded offers no history instead of a card that would say 「No changes recorded」 of a changed field; **S2** the scan is bounded per user action as described above, and this body now says what the code does; the changeset's Clause-② line names the exported constants and the third key. The two notes taken as well: a row repeated by a shifted `$skip` is kept once. Not taken: the keyboard-opened cell menu path stays unpinned (as the review noted); a data source that ignores `$skip` now stops after four reads per click instead of looping until the card closes. - Card lines this PR covers: 「在记录页「客户备注」上打开修改历史:列出历次修改,和动态里的一致。」 — yes, and worded by the one hook both surfaces now read. 「在列表的格子上右键「修改历史」:同一张卡片。」 — yes. 「一个没改过的字段:显示「没有修改记录」和创建信息。」 — yes. 「用一个没有某字段读取权限的账号:…那个字段上也没有「修改历史」。」 — yes, pinned on both entry points; the 动态 half landed in #36613. - Not done, as the card says: 「不做「恢复到某个历史值」」, no change to how the audit log is stored or kept, no change to the 动态 tab's grouping or filters. - The card's unchecked note on per-field reads is now measured, not assumed: there is no server-side per-field history read, and adding one would mean a query over a change column, which `parent-field-query-guard.ts` refuses for exactly the readers this feature is for. So the card reads the record's rows in batches of fifty, at most four batches (200 rows) per open or 「Load more」. On a record with thousands of activity rows and a field changed rarely, each click reads the next 200; a server-side per-field door would be a separate Feature card, not this one. - The `FieldChangeItem` line inside the card clamps each side to its line and offers **Show all**, as the activity lines do. - `ui/AGENTS.md` #2's second half: the two package READMEs and the two `content/docs/frontend/plugins/*.mdx` pages are updated in this PR. - Screenshots: below, driven in the running Console (`examples/app-showcase` + `apps/console`) as the seeded admin, on `showcase_account`. GitHub's image store takes uploads only from the browser, and `ui/AGENTS.md` #185 forbids committing screenshots into the tree, so they are described here and handed to the requester in the thread; the frames themselves are in the project files. ## Screenshots Taken at `975c4c5576`. The rework leaves these frames as they are: every field shown is a text or email field, whose values are recorded, so the gate still offers it; the batch cap shows only on a record with more than 200 activity rows. Driven at 1440×900, `deviceScaleFactor: 2`, record **Stark Industries**, field **Billing Email** (edited three times: `ap@…` → `accounts.payable@…` → `billing@…`). 1. **The button** — hovering the Billing Email row reveals a history icon beside the existing copy icon; nothing else about the row moves (`1-field-history-button.png`, crop `…-crop.png`). 2. **The card, from the field** — clicking it opens a popover anchored to the value: a header `Billing Email` / `Change history`, then `Dev Admin · Nov 23, 2026, 10:01 AM` over `accounts.payable…` struck through `→ billing@sta…` with **Show all**, and the older change under it, newest first (`2-field-history-card.png`). 3. **The list's entry point** — a right-click on the `Account Name` cell of Stark Industries lists **Change history** between **Open in new tab** and **Edit**, with the same history icon (`3-cell-context-menu.png`). 4. **The card, from the cell** — choosing it opens the same card at the pointer, headed `Account Name`, listing that record's four changes of that field, newest first (`4-cell-field-history-card.png`). 5. **A field never changed** — on a record created through the API, Tax ID's card reads `No changes recorded` over `Created by Dev Admin · Nov 23, 2026, 10:03 AM` (`5-never-changed.png`). A note worth having on the record: on a **seeded** row the same empty card shows `No changes recorded` with **no** creator line, because the seed writes no `created` activity row and the card states only what the server served it — it does not fall back to `created_by`, which is a column the reader may be withheld. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbZFiKZ188iQxqGgmnY <!-- signed: repo:objectstack#1 · os-warren · session_01JQwxbZFiKZ188iQxqGgmnY --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4034a6d commit 543585d

32 files changed

Lines changed: 1448 additions & 67 deletions
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
'@object-ui/plugin-grid': patch
4+
'@object-ui/components': patch
5+
'@object-ui/types': patch
6+
'@object-ui/i18n': patch
7+
'@objectstack/spec': patch
8+
---
9+
10+
feat(record-page): one field's change history, opened in place from the field or from a list cell's context menu
11+
12+
Clause-②: yes (widening) — three new `detail.*` language-pack keys in every locale `@object-ui/i18n` ships (`fieldHistory`, `fieldHistoryNone`, `fieldHistoryNoneRecent`); new exports from `@object-ui/plugin-detail` (`FieldHistoryButton`, `FieldHistoryCard`, `FieldHistoryPopover`, `useFieldHistory`, `useFieldHistoryOffered`, `fieldHistoryOffered`, the constants `FIELD_HISTORY_PAGE_SIZE`, `FIELD_HISTORY_SCAN_BATCH` and `FIELD_HISTORY_SCAN_BATCHES_PER_LOAD`, and their types); an optional `column` member on the context `data-table` hands a host's `renderRowContextMenu`; `FieldChangeItem` draws no label for `label: ''`; nothing is removed or renamed
13+
Metadata-protocol: none
14+
15+
A reader can now see one field's past changes on one record without reading the whole activity stream.
16+
17+
- On the record page, each field of the object has a history button beside its value, shown on hover and focus like the copy button. In a list, right-clicking a cell of a field the object declares adds 「Change history」 to the row's menu. Both open the same small card in place. Neither is offered on a field whose old → new values are not recorded (`fieldHistory: false` on the field, `enable.fieldHistory: false` on the object, a credential field, or a media or JSON-like type that does not opt in), judged by the same `resolveFieldHistory` the audit writer keeps values by.
18+
- The card lists only that field's changes: who, when, and old → new in the reader's words (an option by its label, an empty side as the pack's word for empty), newest first, ten at a time with 「Load more」.
19+
- A field never changed reads 「No changes recorded」 with who created the record and when.
20+
- The changes are the record's activity rows the server already serves, narrowed to the reader: a change of a field the reader may not read is never sent. A field the reader may not read offers no entry point at all. The full audit log is not read.
21+
- The rows are read by record, newest first, fifty at a time, keeping those that changed the field; a query naming the change columns is refused for a reader withheld any field of the object, so the field is never part of the query. Opening the card reads at most four batches, and each 「Load more」 at most four more; when they hold no change of the field and older rows remain, the card reads 「No changes in the recent activity」 and offers 「Load more」 to read on.
22+
23+
`@objectstack/spec`: the authoring hint for the mistyped field key `tracked` now names what turns one field's change history on or off today (`fieldHistory: false`, `true` for a media or JSON field, `enable.fieldHistory: false` on the object), where it named `trackHistory: true`, which changes nothing for most field types. Wording only; `tracked` stays rejected.

‎content/docs/frontend/plugins/plugin-detail.mdx‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,39 @@ draws its own field editor reuses the write by rendering
227227
shortcuts (its dialogs only), and `ref.current(draft)` saves. The default
228228
`face` is `"bar"`.
229229

230+
## A field's change history
231+
232+
Each field of the object on the record page has a history button beside its
233+
value, shown on hover and on keyboard focus like the copy button. In a list,
234+
right-clicking a cell of a field the object declares adds **Change history**
235+
to the row's menu. Both open the same small card in place
236+
(`FieldHistoryButton`, `FieldHistoryPopover`, both drawing `FieldHistoryCard`):
237+
238+
- only that field's changes on that record: who, when, and old → new in the
239+
reader's words (an option by its label, an empty side as the word for empty),
240+
newest first, ten at a time with **Load more**;
241+
- for a field never changed, **No changes recorded** with who created the
242+
record and when.
243+
244+
The card reads the record's activity rows (`sys_activity`), the rows the
245+
activity stream draws, and keeps those that changed the field. The server
246+
serves each row's changes narrowed to the reader, so a value the reader may not
247+
read never reaches the browser, and a field the reader may not read
248+
(`checkField(object, field, 'read')`) offers no history at all. Nor does a
249+
field whose old → new values are not recorded (`resolveFieldHistory` from
250+
`@objectstack/spec/data`: `fieldHistory: false` on the field,
251+
`enable.fieldHistory: false` on the object, a credential field, or a media or
252+
JSON-like type that does not opt in with `fieldHistory: true`), and nor do the
253+
platform's own record columns (`id`, `created_at`, …).
254+
255+
The rows are read by record, fifty at a time: a query naming a change column
256+
is refused for a reader withheld any field of the object, so the field is never
257+
part of the query. Opening the card reads at most four batches
258+
(`FIELD_HISTORY_SCAN_BATCHES_PER_LOAD`), and each **Load more** at most four
259+
more. When they hold no change of the field and older rows remain, the card
260+
says **No changes in the recent activity** and offers **Load more** to read on;
261+
it says **No changes recorded** only once every row has been read.
262+
230263
## The record's comment panel
231264

232265
On the desktop console, a record's comments live in a panel of their own,

‎content/docs/frontend/plugins/plugin-grid.mdx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,18 @@ authored `navigation: { mode: 'none' }` or `navigation.preventNavigation: true`
332332
(whatever its mode, objectstack#33549) and for an object whose data API serves
333333
no single-record read (objectstack#33317).
334334

335+
### A cell's change history
336+
337+
Right-clicking a cell of a field the object declares adds **Change history**
338+
to the row's context menu, when the grid's data source can read activity
339+
(`find`), the field's changes are recorded with their values
340+
(`resolveFieldHistory` from `@objectstack/spec/data`) and the reader may read
341+
the field. Choosing it opens
342+
`@object-ui/plugin-detail`'s `FieldHistoryPopover` at that point: that
343+
record's changes of that field, newest first, ten at a time, or **No changes
344+
recorded** with who created the record. `data-table` names the cell's column to
345+
the host's `renderRowContextMenu` as `context.column`.
346+
335347
### Inline Editing
336348

337349
Enable inline cell editing for quick data updates:

‎packages/spec/src/data/field.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,26 @@ describe('FieldSchema — field-level `currency` key guidance, naming `currencyC
188188
});
189189
});
190190

191+
// objectstack#36615 — the `tracked` answer names the switch a field's change
192+
// history has today (`fieldHistory`), not `trackHistory: true`, which turns
193+
// nothing on for most field types since field history became on by default.
194+
describe('FieldSchema — field-level `tracked` key guidance, naming `fieldHistory`', () => {
195+
const FIELD = { name: 'notes', label: 'Notes', type: 'textarea' } as const;
196+
197+
it('`tracked` stays rejected and names `fieldHistory`, whose off form really parses', () => {
198+
const m = unrecognizedKeyMessage({ ...FIELD, tracked: true });
199+
expect(m).toContain('`tracked` is not a field key');
200+
expect(m).toContain('fieldHistory: false');
201+
expect(m).not.toContain('trackHistory: true');
202+
expect(FieldSchema.safeParse({ ...FIELD, fieldHistory: false }).success).toBe(true);
203+
});
204+
205+
it('a sibling unknown key does NOT get the field-history prescription (anti-vacuity)', () => {
206+
const m = unrecognizedKeyMessage({ ...FIELD, totallyBogusKey: true });
207+
expect(m).not.toContain('fieldHistory');
208+
});
209+
});
210+
191211
describe('FieldSchema', () => {
192212
describe('Basic Field Properties', () => {
193213
it('should accept valid field with minimal properties', () => {

‎packages/spec/src/data/field.zod.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,10 @@ export const FieldSchema = lazySchema(() => {
16851685
// CASE-SENSITIVELY on the authored spelling, so a row per spelling is the
16861686
// only way this channel can cover a family, and `not_null` was the spelling
16871687
// it would have missed.
1688-
tracked: '`tracked` is not a field key — per-field timeline tracking is `trackHistory: true` (ADR-0052 §5b).',
1688+
tracked:
1689+
'`tracked` is not a field key — a field\'s old → new values show on the record activity timeline '
1690+
+ 'by default. Write `fieldHistory: false` to turn them off for this field (`true` opts a media or '
1691+
+ 'structured-JSON field in), or `enable.fieldHistory: false` on the object to turn them off for every field.',
16891692
// [ADR-0158 L3] The natural spellings of a quantity's unit on the field
16901693
// itself, answered in prose because the targets are NESTED keys of
16911694
// `unitConfig` — the form the `currency` answer above takes. None of them

‎ui/packages/components/src/renderers/complex/__tests__/data-table-row-context-menu-28434.test.tsx‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,27 @@ describe('objectstack#28434 · a host renderer decides alone', () => {
129129
// The host's items only — the table's own are not mixed in.
130130
expect(itemIds(menu)).toEqual(['host-item']);
131131
expect(menu).toHaveTextContent('Host item for r2');
132-
expect(renderRowContextMenu).toHaveBeenCalledWith(expect.objectContaining({ id: 'r2' }), { selected: false });
132+
// objectstack#36290 — the context also names the data cell's column.
133+
expect(renderRowContextMenu).toHaveBeenCalledWith(expect.objectContaining({ id: 'r2' }), { selected: false, column: 'name' });
134+
});
135+
136+
it('objectstack#36290 · names the column of the data cell it opened on, and none off a data cell', async () => {
137+
const renderRowContextMenu = vi.fn(() => <DropdownMenuItem data-testid="host-item">Host item</DropdownMenuItem>);
138+
renderTable({
139+
...RELATED_LIST_SCHEMA,
140+
columns: [{ header: 'Name', accessorKey: 'name' }, { header: 'Code', accessorKey: 'code' }],
141+
data: ROWS.map((row) => ({ ...row, code: `C-${row.id}` })),
142+
renderRowContextMenu,
143+
});
144+
act(() => { rightClick(cellOf('C-r1')); });
145+
await screen.findByTestId('row-context-menu');
146+
expect(renderRowContextMenu).toHaveBeenLastCalledWith(expect.objectContaining({ id: 'r1' }), { selected: false, column: 'code' });
147+
await userEvent.keyboard('{Escape}');
148+
await waitFor(() => expect(contextMenu()).toBeNull());
149+
// The row's own "⋮" cell is not a data cell: no column.
150+
act(() => { rightClick(within(rowOf('Open contract')).getByTestId('data-table-row-actions').closest('td') as HTMLElement); });
151+
await screen.findByTestId('row-context-menu');
152+
expect(renderRowContextMenu).toHaveBeenLastCalledWith(expect.objectContaining({ id: 'r1' }), { selected: false });
133153
});
134154

135155
it('a host answering null keeps the browser\'s menu', () => {

‎ui/packages/components/src/renderers/complex/data-table.tsx‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
22322232
// objectstack#28434 — the row context menu: which row it is open on, where,
22332233
// and the element focus goes back to when it closes (the focused cell for
22342234
// the keyboard, the cell under the pointer for a right-click).
2235-
const [rowContextMenu, setRowContextMenu] = useState<{ row: any; selected: boolean; x: number; y: number } | null>(null);
2235+
const [rowContextMenu, setRowContextMenu] = useState<{ row: any; selected: boolean; column?: string; x: number; y: number } | null>(null);
22362236
const rowContextMenuReturnFocusRef = useRef<HTMLElement | null>(null);
22372237
// The last pointer that pressed a row: a touch long-press raises
22382238
// `contextmenu` too, and touch keeps the row's "⋮" instead.
@@ -4426,9 +4426,9 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
44264426
* selection of two or more — a selection is a bulk act, and this table holds
44274427
* no bulk actions to offer it — and never on a row with nothing to offer.
44284428
*/
4429-
const rowContextMenuItems = (row: any, selected: boolean): React.ReactNode => {
4429+
const rowContextMenuItems = (row: any, selected: boolean, column?: string): React.ReactNode => {
44304430
if (schema.renderRowContextMenu) {
4431-
const items = schema.renderRowContextMenu(row, { selected });
4431+
const items = schema.renderRowContextMenu(row, column !== undefined ? { selected, column } : { selected });
44324432
return items === false || items === undefined ? null : items;
44334433
}
44344434
if (!rowActions || rowActionsColumnIsEditOnly) return null;
@@ -4472,7 +4472,10 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
44724472
if (pointerType === 'touch') return;
44734473
}
44744474
if (keepsBrowserContextMenu(target, rowEl)) return;
4475-
const items = rowContextMenuItems(row, selected);
4475+
// The data cell the menu opened on (objectstack#36290): its column's
4476+
// accessor, for the host's cell-level items.
4477+
const column = target.closest<HTMLElement>('[data-cell-column]')?.getAttribute('data-cell-column') ?? undefined;
4478+
const items = rowContextMenuItems(row, selected, column);
44764479
if (items == null) return;
44774480
e.preventDefault();
44784481
const pointer = fromKeyboard ? null : (e as React.MouseEvent);
@@ -4491,11 +4494,11 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
44914494
const focusable = fromKeyboard ? target : target.closest<HTMLElement>('[tabindex]');
44924495
rowContextMenuReturnFocusRef.current = focusable && rowEl.contains(focusable) ? focusable : null;
44934496
rowContextMenuClosedOutsideRef.current = false;
4494-
setRowContextMenu({ row, selected, x, y });
4497+
setRowContextMenu({ row, selected, column, x, y });
44954498
};
44964499
// The open menu's items, re-asked each render so they follow the row.
44974500
const openRowContextMenuItems = rowContextMenu
4498-
? rowContextMenuItems(rowContextMenu.row, rowContextMenu.selected)
4501+
? rowContextMenuItems(rowContextMenu.row, rowContextMenu.selected, rowContextMenu.column)
44994502
: null;
45004503
const showToolbar = searchEnabled || exportable || (showSelectionCount && selectable && selectedRowIds.size > 0) || hasPendingChanges;
45014504

@@ -5431,6 +5434,8 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
54315434
// focus tracking exist only in the first case.
54325435
tabIndex={keyboardNavigation ? (rowIndex === rovingRowIndex && colIndex === rovingColIndex && !isSelectedCell ? 0 : -1) : 0}
54335436
data-grid-cell={keyboardNavigation ? `${rowIndex}:${colIndex}` : undefined}
5437+
// objectstack#36290 — which column a context menu opened on.
5438+
data-cell-column={col.accessorKey}
54345439
onFocus={keyboardNavigation ? () => rove(rowIndex, colIndex) : undefined}
54355440
aria-invalid={cellError !== undefined || undefined}
54365441
// objectstack#28434 — a cell in edit mode keeps the

‎ui/packages/i18n/src/locales/ar.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,9 @@ const ar = {
17071707
fieldChangeEmpty: "فارغ",
17081708
fieldChangeExpand: "عرض الكل",
17091709
fieldChangeCollapse: "عرض أقل",
1710+
fieldHistory: "سجل التغييرات",
1711+
fieldHistoryNone: "لا توجد تغييرات مسجلة",
1712+
fieldHistoryNoneRecent: "لا توجد تغييرات في النشاط الأخير",
17101713
replyCount: "{{count}} رد",
17111714
replyCount_zero: "{{count}} رد",
17121715
replyCount_one: "{{count}} رد",

‎ui/packages/i18n/src/locales/de.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,6 +1526,9 @@ const de = {
15261526
fieldChangeEmpty: "Leer",
15271527
fieldChangeExpand: "Alles anzeigen",
15281528
fieldChangeCollapse: "Weniger anzeigen",
1529+
fieldHistory: "Änderungsverlauf",
1530+
fieldHistoryNone: "Keine Änderungen erfasst",
1531+
fieldHistoryNoneRecent: "Keine Änderungen in den letzten Aktivitäten",
15291532
replyCount: "{{count}} Antwort",
15301533
replyCount_one: "{{count}} Antwort",
15311534
replyCount_other: "{{count}} Antworten",

‎ui/packages/i18n/src/locales/en.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,6 +2068,11 @@ const en = {
20682068
fieldChangeEmpty: 'Empty',
20692069
fieldChangeExpand: 'Show all',
20702070
fieldChangeCollapse: 'Show less',
2071+
// objectstack#36290 — one field's change-history card: its entry point's
2072+
// name and what it says for a field never changed.
2073+
fieldHistory: 'Change history',
2074+
fieldHistoryNone: 'No changes recorded',
2075+
fieldHistoryNoneRecent: 'No changes in the recent activity',
20712076
// Replies
20722077
replyCount: '{{count}} reply',
20732078
replyCount_one: '{{count}} reply',

0 commit comments

Comments
 (0)