Skip to content

Commit f3a8a13

Browse files
feat(spec,ui)!: every grid that renders editable selects a cell first, and object-grid singleClickEdit is retired (#36357)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9Ubb2rJZB694pnkwLCMmCEJ3ev)_ Fixes #36270 repo:objectstack#7 · zhuangjianguo · session_01QsR2jSHfkSrXZxbdWoQxnW Clause-②: no (narrowing) Metadata-protocol: narrowed Skills-docs: none — skills/ never names singleClickEdit, keyboardNavigation or object-grid's editing gestures (git grep at the head) ## 维护者速读 - 用户看到的变化:所有「可编辑」的表格(对象视图自己画的表格、页面里放的 object-grid 表格,和列表页一样)都改成「先选中、再编辑」:单击选中单元格,双击、回车、F2 或直接打字进入编辑,改完一格立刻保存;「全部保存 / 全部取消」那条保存栏不再出现。不可编辑的表格不变,单击仍然打开记录。元数据里的 `singleClickEdit`(单击即编辑)作废:写了会报错并提示删掉,`os migrate meta` 能自动删除。 - 为什么:按您的裁定 A「统一新编辑方式」。新方式里单击是「选中」,`singleClickEdit` 已经没有可切换的东西,按 ADR-0049「要么执行、要么删除」退役;`keyboardNavigation` 的说明也改成实际行为(可编辑表格上方向键导航始终开启)。 - 最坏情况:有人在页面元数据里写了 `singleClickEdit`,升级后该页面校验失败,需要删掉这个键(提示里写明了怎么做,迁移工具可自动删);或者某张可编辑表格的使用者习惯了单击就编辑,现在要多一次双击。本仓、hotcrm、gallery 中没有任何地方写过这个键。 - 需要您做的:无(L2 由席位在最终提交上做)。 ## What changes The ruling A on #36270 (record 7076617499): one editing model. Every grid that renders editable uses the list page's select-first cell model, and the key that only made sense in the old model is retired. - **`ui/packages/plugin-grid/src/ObjectGrid.tsx`** (the one behaviour hunk): `hostCellSelection = cellSelectionProp ?? inlineEditable`. Absent a host's `cellSelection`, a grid that renders editable (`editable` AND the object's inline-edit verdict AND the reader's `update` grant) is select-first; a read-only grid keeps click-to-open. A host's `true` (`ListView`, the related tab) or `false` still wins. The data table is handed `singleClickEdit: true` unconditionally: it is inert under select-first, and it is the staged model's old default for a host that passes `false`. - **`@objectstack/spec`**: `ComponentPropsMap['object-grid'].singleClickEdit` is a `retiredKey()` tombstone; D2 conversion `object-grid-single-click-edit-removed` (strip, whatever the value; order 83), D3 `object-grid-single-click-edit-retired`, `RETIRED_KEYS_BY_MAJOR[18]` row `ui/ObjectGridProps:singleClickEdit`, a `STEP18_RATIONALE` fragment (order 123), ledger `page.json` regions note [122] plus the narrowed [43]. `keyboardNavigation`'s describe narrows to what is enforced: always on for a grid that renders editable, `true` turns it on for a read-only grid. - **`@object-ui/types`**: `ObjectGridSchema.singleClickEdit?: never` with a `retirementTombstone()` zod twin; the `object-view` `table` slot inherits it (`TABLE_INHERITED_TOMBSTONES`, as `defaultSort`). `DataTableSchema.singleClickEdit` (host-paired) is unchanged. - **`@object-ui/plugin-view`**: `table.singleClickEdit` leaves `OBJECT_VIEW_TABLE_RELAY_KEYS`. The earlier host-level `cellSelection` spread is gone: `ObjectGrid`'s default covers the object-view grid, authored nodes and react pages in one place. - **`object-grid` inputs, `sdui.manifest.json`, `content/docs/ui/components/*`**: the `singleClickEdit` input is gone and the `editable` / `keyboardNavigation` descriptions say what the grid does. Docs and READMEs (`plugin-grid.mdx`, `plugin-view.mdx`, both packages' READMEs) describe select-first everywhere and the staged model as a host's `cellSelection={false}`. - BREAKING changeset `.changeset/36270-object-grid-single-click-edit-retired.md` (`@objectstack/spec` minor plus the three ui packages), with the FROM → TO table and `<!-- adr-0087: registered … -->`. ## The card's Done-when: the five grid families - **The object-view grid** (Studio view preview, a page placing an `object-view`) and **the authored `object-grid` node**: changed here. Pinned by `ObjectView.perCellSave-36270.test.tsx` and `authoredGridPerCellSave-36270.test.tsx`, with the ablation below. - **The related tab**: already select-first. `RelatedList.tsx` passes `cellSelection: true`, pinned by `RelatedList.tab-35892.test.tsx`; unchanged. - **The record picker and the designer grids** (`RecordPickerDialog`, `ObjectManager`, `FieldDesigner`): they render `ObjectGrid` without `editable`, so they are read-only and unchanged. - **Dashboard tables**: they are `data-table` / `object-data-table` nodes, not `ObjectGrid`, and have no save path. The card's dashboard-table pin therefore has no subject: there is no editable dashboard grid to pin. A bare `data-table` that a host hands `editable` still stages edits and draws its bar; that is the table primitive, which no in-repo grid host reaches. - So every grid that renders editable through `ObjectGrid` selects a cell first, and no in-repo host passes `cellSelection={false}`. - **The card's second Read-first question** (a child list inside a parent form saved together, #35590): no in-repo host draws such a list through an editable `ObjectGrid`. The form's line items are the `GridField` widget, which this PR does not touch, and no in-repo host passes `cellSelection={false}` or its own `onBatchSave`. So no saved-together list loses its staging here. - **A React host's `onBatchSave`**: a host that passes `onBatchSave` alone on an editable `ObjectGrid` now has it bypassed (each cell writes through `onRowSave` or the grid's own `dataSource.update`). No in-repo host passes it. The changeset carries a FROM → TO row for it and `ObjectGridComponentProps.onBatchSave` is marked `@deprecated`. ## Tests - New: `packages/spec/src/ui/object-grid-single-click-edit.pin.test.ts` (tombstone at both channels for `true` / `false`, `editable` control, the narrowed describe, the conversion's delete and its controls, the step-18 wiring), `object-grid-single-click-edit-retirement.test.ts` (tree-scoped absence, `repo` project), `ui/packages/plugin-grid/src/__tests__/authoredGridPerCellSave-36270.test.tsx` (an authored editable node saves one cell with no Save All; read-only and host-`false` controls), and the earlier `ObjectView.perCellSave-36270.test.tsx`. - Migrated to the enforced contract: `ObjectGrid.keyboardNavigation-11068.test.tsx` (editable grids read the select-first pattern and `false` no longer turns it off; a host `cellSelection={false}` control keeps the old roving-focus reading), `ObjectGrid.cellSelection-35684.test.tsx`, `rowContextMenu-28434.test.tsx`, the types slot/round-6 tests, the ObjectView relay test. - 25 plugin-grid inline-edit files that pin the staged path now pass `cellSelection={false}` and no longer author `singleClickEdit`; two that passed `cellSelection={x || undefined}` pass `cellSelection={x}` (under the new default `undefined` means select-first). - `retired-key-removal-version.pin.test.ts` joins the new conversion. ## Acceptance notes - Select-first only where a grid renders editable, per the ruling; read-only grids keep click-to-open (pinned by the controls above). - `Clause-②: no (narrowing)`: the house spelling for a retirement; the seat re-amended the claim to it (7077058264). - Census of authored `singleClickEdit` in this repository's examples, hotcrm and gallery: zero, so the conversion is for stored rows and outside authors. - `check-governed-merges --pr 36357`: NOT governed (0 of 60 paths), 1,355 changed lines, under the 3,000 human-merge threshold. - With #36332 (seat delta review 7077725274): once both land, a touch never edits in place on any editable grid. The one exception is a host that passes `cellSelection={false}`, which keeps the staged click-to-edit, so there a touch edits in place. Whichever of the two lands second re-runs overlap-check against the other's head. - #35827 (retire `onBatchSave`) is unblocked by this: no authored or ObjectView grid reaches the batch save any more; only a host's explicit `cellSelection={false}` does. ## Verification Two-minute check: author `{ "type": "object-grid", "properties": { "objectName": "<any>", "editable": true } }` on a page; click a cell (it is selected, nothing opens), press Enter, type, press Enter: the value saves at once and no "Save All" bar appears. Add `"singleClickEdit": true`: the page refuses it with the prescription. Files to read first, by risk: `ui/packages/plugin-grid/src/ObjectGrid.tsx` (two hunks), `packages/spec/src/ui/component.zod.ts`, `packages/spec/src/conversions/entries/18/object-grid-single-click-edit-removed.ts`, `ui/packages/types/src/zod/objectql.zod.ts`. <details><summary>Local runs (final head 493b6a0)</summary> Final head `493b6a01` = `2bd02429` plus a merge of main `0b2118f4` after #36478 landed (`719e8674`: main's side of `scripts/sdui-manifest.record.json`, and `component.mdx` regenerated with main's new `mobileMaxVisible` describe), then the regenerated manifest record (`493b6a01`, one `sha256` line). No rebase. - Dogfood battery on head 493b6a0: os-verify-lock `VERDICT command-exit 0` · `Test Files 485 passed | 3 skipped (488) · Tests 4108 passed | 68 skipped (4176)`, no failures. - Derived gate families on 493b6a0: 132 run, 0 NOT-MEASURED, every exit 0. `check-sdui-manifest` intact; `check-regen-pending` clear. - `overlap-check` on 493b6a0: clean against main `43916f3a` and every open PR sharing files. - CI at 493b6a0: 61 success, 9 skipped, 0 failed. Runs at 2bd0242: Final head `2bd02429` = a merge of `67fe4551` and main `dda5e74f`, made after the merge queue dropped the PR on a conflict in the generated `content/docs/references/ui/component.mdx`. The merge's only own change is that file, regenerated (main's new `showStar` describe). The code auto-merged, and `check-regen-pending` reports every deferred artifact current. - Dogfood battery on 2bd0242 (superseded by the run on 493b6a0 above): os-verify-lock `VERDICT command-exit 0` · `Test Files 485 passed | 3 skipped (488) · Tests 4108 passed | 68 skipped (4176)`, no failures. - Derived gate families on 2bd0242: 132 run, 0 NOT-MEASURED, every exit 0. - `overlap-check` on 2bd0242: clean against main `70194ffc`; the known conflict with draft #36478 on `scripts/sdui-manifest.record.json` stands. Runs at 67fe455: Final head `67fe4551` = `4e94a273` plus the S4 changeset fix (the touch sentence, and one comment's wording). That commit changes only the changeset and that comment. - Dogfood battery on head 67fe455 (`pnpm --filter @objectstack/dogfood test`, closure built under the lock): os-verify-lock `VERDICT command-exit 0` · `Test Files 485 passed | 3 skipped (488) · Tests 4108 passed | 68 skipped (4176)`, no failures. - Derived gate families on 67fe455: 132 derived; `--ran` reconciles 132 run, 0 NOT-MEASURED, every exit 0. - `overlap-check` on 67fe455: clean against main; one conflict with draft #36478 in `scripts/sdui-manifest.record.json` (the regenerated manifest record both PRs carry): whichever lands second merges main and regenerates it. `4e94a273` = the review rework (`3894ea44`: TSDoc and comments, `onBatchSave` `@deprecated`, changeset rows, docs) plus a merge of main after #36332 landed (no rebase, no conflicts). - Dogfood battery on 4e94a27 (superseded by the run on 67fe455 above) (`pnpm --filter @objectstack/dogfood test`, closure built under the lock): os-verify-lock `VERDICT command-exit 0` · `Test Files 485 passed | 3 skipped (488) · Tests 4108 passed | 68 skipped (4176)`, no failures. - Derived gate families on 4e94a27: 132 derived; `--ran` reconciles 132 run, 0 NOT-MEASURED, every exit 0 (also 132/132 exit 0 on `3894ea44` before the merge). - After the merge: `@object-ui/plugin-grid` `Test Files 305 passed · Tests 2705 passed`; `@object-ui/plugin-view` `Test Files 67 passed · Tests 732 passed`. `type-check` for `@object-ui/types` and `@object-ui/plugin-grid` exit 0 on `3894ea44`. - `overlap-check --exclude-pr=36357` on 4e94a27: clean against main and the eight open PRs sharing files (#36439, #36438, #36435, #36411, #36392, #36351, #36343, #36316). #36332 is merged and is in this head. Earlier runs (head 579f99a; suites on 1c2a16b): - `@object-ui/plugin-grid` whole package: `Test Files 298 passed | 3 failed (301) · Tests 2676 passed | 6 failed`; the 6 (keyboardNavigation ×4, cellSelection ×1, rowContextMenu ×1) were fixed and those three files re-run green (8 + 28 + 18). - `@object-ui/plugin-view` whole package: `Test Files 67 passed (67) · Tests 732 passed (732)`. `@object-ui/types`: `Test Files 389 passed · Tests 10498 passed`. - `type-check` for `@object-ui/types`, `@object-ui/plugin-grid`, `@object-ui/plugin-view`: exit 0. - `@objectstack/spec` test under the verify lock: 1 failed of 27,924 (`retired-key-removal-version.pin`, the JOIN row this PR then added; that file re-run 63 passed). `test:repo`: `Test Files 93 passed · Tests 1564 passed`. - Derived gate families (`dispatch-gates --commands`): 132 derived; `--ran` reconciles 132 run, 0 NOT-MEASURED. Six first read exit 3 on a stale spec dist and `check:generated` exit 1 on the same stamp; after `pnpm --filter @objectstack/spec build` all seven re-ran exit 0. `check-plugin-teardown-shape --self-test` needed its pinned fixture commit fetched into the shallow clone, then exit 0. - `node scripts/gen-sdui-manifest-node.mjs` under the lock, then `gen-sdui-reference.mjs`; `check-doc-component-types.mjs` green. - `overlap-check --exclude-pr=36357`: clean against main and the six open PRs sharing files (#36392, #36380, #36351, #36343, #36332, #36316). - Earlier dogfood battery on 1c2a16b (superseded by the run on 4e94a27 above): `Test Files 484 passed | 3 skipped (487) · Tests 4107 passed | 68 skipped (4175)`. The one commit after it (579f99a) touches two docs snippets only. - `pnpm --dir ui check:doc-snippets` after a scoped build: 544 of 544 blocks judged, 0 failed (the Lint UI red on 1c2a16b was the new staged-model snippet missing its import, fixed in 579f99a). </details> <details><summary>Ablation (`scripts/ablation-replace.mjs`, restored to the HEAD blob, `git diff HEAD` empty)</summary> - `cellSelectionProp ?? inlineEditable` → `cellSelectionProp` (the base's behaviour): 3 failed of 6 — the object-view `table.editable` and named-view `inlineEdit` per-cell saves and the authored-node per-cell save; the three controls (read-only object-view, read-only node, host `false`) stay green. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jSHfkSrXZxbdWoQxnW)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jSHfkSrXZxbdWoQxnW <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jSHfkSrXZxbdWoQxnW --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent aad35e6 commit f3a8a13

60 files changed

Lines changed: 1221 additions & 201 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@object-ui/types': minor
4+
'@object-ui/plugin-grid': minor
5+
'@object-ui/plugin-view': minor
6+
---
7+
8+
feat(spec,ui)!: every grid that renders editable selects a cell first and saves each cell on its own, and `object-grid`'s `singleClickEdit` is retired
9+
10+
Clause-②: no (narrowing)
11+
Metadata-protocol: narrowed
12+
13+
<!-- adr-0087: registered object-grid-single-click-edit-removed, object-grid-single-click-edit-retired -->
14+
15+
**BREAKING** accept-set narrowing on the `object-grid` page block (`@objectstack/spec`, `ComponentPropsMap['object-grid'].singleClickEdit`) and on `@object-ui/types` (`ObjectGridSchema.singleClickEdit`, and the `object-view` `table` slot that relayed it), with the grids following it in the same release.
16+
17+
- **Now.** A grid that renders editable (`editable` set and the viewer allowed to edit the object) uses the list page's select-first cell model wherever it is drawn: the grid an `object-view` draws itself (the Studio's view preview, a page that places an `object-view`) and an authored `object-grid` node. A click selects a cell; double-click, Enter, F2 or typing opens its editor; Esc cancels; and each committed cell is saved at once as one update for its record. The pending-changes bar, its "Save All" and "Cancel All" buttons and the per-row save column are no longer drawn there. On a touch screen a tap on these grids opens the record, and a touch never edits a cell in place.
18+
- **Unchanged.** A grid that renders read-only keeps its click-to-open row. Neither `editable` nor a view's `inlineEdit` can open editing that the object or the reader's `update` grant refuses, and a refused cell now says why when it is asked to edit, as on the list page. A React host that draws `ObjectGrid` itself can still pass `cellSelection={false}` to keep the staged model with its Save All bar.
19+
- **`keyboardNavigation` narrowed to what is enforced.** On a grid that renders editable the arrow-key navigation is always on, because the selection moves with those keys; `false` no longer turns it off there. On a read-only grid `true` still turns it on.
20+
21+
| FROM | TO |
22+
|:--|:--|
23+
| `object-grid` `properties.singleClickEdit: true` (or absent: the old default) | delete the key; a click selects the cell and double-click, Enter, F2 or typing opens its editor |
24+
| `object-grid` `properties.singleClickEdit: false` | delete the key; double-click still opens the editor |
25+
| `object-view` `table.singleClickEdit` | delete the key |
26+
| a React host passing `ObjectGrid` `onBatchSave` alone (no `onRowSave`, no `cellSelection`) on an editable grid: "Save All" called it | each cell now saves through `onRowSave`, or through the grid's own `dataSource.update` when there is none, and `onBatchSave` is never called. Pass `onRowSave` to own the write per cell, or pass `cellSelection={false}` to keep the staged model, where `onBatchSave` is still called. The prop is marked `@deprecated` |
27+
28+
The one-line fix: delete `singleClickEdit` wherever it is written; `os migrate meta --from 17 --write` deletes it from page sources. Writing it after upgrade fails `tsc` (the input type is `never`) and fails the parse with that prescription.
29+
30+
The retirement kit:
31+
32+
- **`@objectstack/spec`**: `singleClickEdit` is a `retiredKey()` tombstone on `ObjectGridPropsSchema`, registered in `RETIRED_KEYS_BY_MAJOR[18]` as `ui/ObjectGridProps:singleClickEdit`. The D2 conversion `object-grid-single-click-edit-removed` deletes it from `object-grid` components (top-level regions, nested `children` and named slots), whatever its value, and the D3 entry `object-grid-single-click-edit-retired` names what the upgrade still owes: help text and tests that describe the old gestures. `keyboardNavigation`'s describe says what is enforced. The liveness ledger records the retirement and the narrowed read.
33+
- **`@object-ui/types`**: `ObjectGridSchema.singleClickEdit` is `?: never` with a `retirementTombstone()` twin, and the `object-view` `table` slot inherits it. `DataTableSchema.singleClickEdit`, a flag a host sets in code, is unchanged.
34+
- **`@object-ui/plugin-grid`**: `ObjectGrid` turns the select-first model on wherever the grid renders editable (a host's `cellSelection` still wins), and no longer reads `singleClickEdit`. The `object-grid` inputs no longer list it. `ObjectGridComponentProps.onBatchSave` is `@deprecated`: it is called only under the staged model.
35+
- **`@object-ui/plugin-view`**: `table.singleClickEdit` is no longer relayed to the grid.

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

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -347,20 +347,23 @@ Enable inline cell editing for quick data updates:
347347
{ "field": "email", "label": "Email" },
348348
{ "field": "status", "label": "Status", "type": "select" }
349349
],
350-
"editable": true,
351-
"singleClickEdit": false
350+
"editable": true
352351
}
353352
}
354353
```
355354

356355
`editable` is the only switch: it is a grid-level flag, and edits persist
357356
through the host's data source (`dataSource.update`) with no callback to wire.
357+
A grid that renders editable (`editable` set and the reader allowed to edit
358+
the object) uses the **select-first** cell model described below: a click
359+
selects a cell, and double-click, Enter, F2 or typing opens its editor. A grid
360+
that renders read-only keeps its click-to-open row. `singleClickEdit` is
361+
retired (objectstack#36270): `@objectstack/spec` refuses it, and
362+
`os migrate meta` deletes it from existing sources.
358363

359364
**Features:**
360-
- **Double-click to edit**: double-click any editable cell to enter edit mode
361-
(`singleClickEdit: true` opens it on the first click instead)
362-
- **Keyboard shortcuts**: press Enter on a focused cell to start editing, Enter
363-
again to save, Escape to cancel
365+
- **Select, then edit**: a click selects a cell; double-click, Enter, F2 or
366+
typing opens its editor, Enter commits, Escape cancels
364367
- **Per-field read-only**: which cells open is decided by the **field
365368
definition**, not by a column key — a field marked `readonly`, and
366369
computed/binary field types (formula, autonumber, file, …), never open an
@@ -395,14 +398,17 @@ through the host's data source (`dataSource.update`) with no callback to wire.
395398
To own persistence in a React host, supply `onCellChange` as a **component
396399
prop** — it is not a schema key.
397400

398-
#### On an object's list page
401+
#### The select-first cell model
399402

400-
The console's list page draws its grid with the **select-first** cell model
401-
(objectstack#35684, objectstack#35687), which its host turns on (the
402-
`cellSelection` component prop, not a schema key). There is no inline-edit
403-
mode and no toggle: the grid is editable wherever the reader may edit the
404-
object and the view does not declare `userActions.editInline: false`, and
405-
`singleClickEdit` is not read there.
403+
Every grid that renders editable uses the **select-first** cell model
404+
(objectstack#35684, objectstack#35687, objectstack#36270): the console's list
405+
page, the grid an `object-view` draws, and an authored `object-grid`. There is
406+
no inline-edit mode and no toggle. On the list page the grid is editable
407+
wherever the reader may edit the object and the view does not declare
408+
`userActions.editInline: false`; elsewhere it is editable where `editable` is
409+
set and the reader may edit the object. A React host can pass the
410+
`cellSelection` component prop (not a schema key) as `false` to keep the staged
411+
model described under [Batch Editing](#batch-editing--multi-row-save).
406412

407413
- **A click selects** a cell (a ring around it); it neither edits nor opens the
408414
record. Only the name link keeps its own click (it opens the record). Every
@@ -559,37 +565,49 @@ WAI-ARIA grid pattern (objectui#11068):
559565
- **Editing.** On an editable grid, Enter still opens the focused cell, and an
560566
open cell's editor keeps every key. An edit ended with Enter or Escape hands
561567
focus back to its cell, so the arrows carry on from there.
562-
- **Default.** On when the grid renders editable — the authored `editable` *and*
563-
the viewer's permission to update the object, the same value inline editing
564-
obeys. A read-only grid keeps every cell its own Tab stop unless you write
565-
`true`, and `false` turns it off on an editable grid.
568+
- **Default.** Always on when the grid renders editable — the authored
569+
`editable` *and* the viewer's permission to update the object, the same value
570+
inline editing obeys — because that grid selects a cell first and moves the
571+
selection with these keys; `false` does not turn it off there
572+
(objectstack#36270), except where a React host keeps the staged model with
573+
`cellSelection={false}` (see Batch Editing below). A read-only grid keeps every
574+
cell its own Tab stop unless you write `true`.
566575
- While it is on, the table is exposed to assistive technology as a `grid`. A
567576
grouped grid navigates within each group's table; the mobile card layout has
568577
no cells and is unaffected.
569578

570579
### Batch Editing & Multi-Row Save
571580

572581
Edit multiple cells across multiple rows and save them individually or all at
573-
once. This is the model of a grid without the select-first cell model (a
574-
related list, a dashboard table, an `object-grid` outside a list page); a list
575-
page saves each cell as it is committed (above). The schema half is just
576-
`editable` — the save/cancel affordances appear on their own once a row has
577-
pending changes:
582+
once. This is the staged model, which no metadata selects: since
583+
objectstack#36270 every grid that renders editable saves each cell as it is
584+
committed (above). A React host that draws `ObjectGrid` itself opts back into
585+
it by passing `cellSelection={false}`; then a click opens a cell's editor, and
586+
the save/cancel affordances appear on their own once a row has pending
587+
changes:
578588

579-
```json
580-
{
581-
"type": "object-grid",
582-
"properties": {
583-
"objectName": "products",
584-
"columns": [
585-
{ "field": "sku", "label": "SKU" },
586-
{ "field": "name", "label": "Name" },
587-
{ "field": "price", "label": "Price", "type": "currency", "align": "right" },
588-
{ "field": "stock", "label": "Stock", "type": "number", "align": "right" }
589-
],
590-
"editable": true
591-
}
592-
}
589+
```tsx
590+
import { ObjectGrid, type ObjectGridComponentProps } from '@object-ui/plugin-grid';
591+
592+
declare const dataSource: NonNullable<ObjectGridComponentProps['dataSource']>;
593+
594+
export const ProductsGrid = () => (
595+
<ObjectGrid
596+
cellSelection={false}
597+
dataSource={dataSource}
598+
schema={{
599+
type: 'object-grid',
600+
objectName: 'products',
601+
columns: [
602+
{ field: 'sku', label: 'SKU' },
603+
{ field: 'name', label: 'Name' },
604+
{ field: 'price', label: 'Price', type: 'currency', align: 'right' },
605+
{ field: 'stock', label: 'Stock', type: 'number', align: 'right' },
606+
],
607+
editable: true,
608+
}}
609+
/>
610+
);
593611
```
594612

595613
Left alone, saving goes through the host's data source. A React host that needs
@@ -626,7 +644,9 @@ const persistence = (
626644
- **Flexible callbacks** — all three are `ObjectGridComponentProps`, never schema
627645
keys: `onRowSave` for a single row, `onBatchSave` for many, `onCellChange` for
628646
each committed cell edit, including one that leaves the value as loaded (only a
629-
real change is staged)
647+
real change is staged). `onBatchSave` is `@deprecated`: only this staged model calls it;
648+
on a select-first grid each cell saves through `onRowSave` (or the grid's own
649+
write) and `onBatchSave` is never called
630650
- **A concurrent write is refused, not overwritten**: the default saves send each
631651
row's `updated_at` as `If-Match`, and an editable grid asks for that column even
632652
when no column shows it. A row someone else saved after it was read answers

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ object through:
235235

236236
| Sub-config | Keys `ObjectView` forwards |
237237
| --- | --- |
238-
| `table` | read by name: `columns`, `fields`, `title`, `filter`, `sort`, `pagination`, `pageSize`, `selection`, `selectable`, `operations`, `className`; handed to the grid as written: `editable`, `singleClickEdit`, `frozenColumns`, `rowHeight`, `resizable`, `reorderableColumns`, `searchableFields`, `showSearch`, `showPagination`, `showColumnTypeIcons`, `conditionalFormatting`, `rowActions`, `bulkActions`, `bulkActionDefs`, `exportOptions`, `grouping`, `aggregations`, `rowColor`, `label` |
238+
| `table` | read by name: `columns`, `fields`, `title`, `filter`, `sort`, `pagination`, `pageSize`, `selection`, `selectable`, `operations`, `className`; handed to the grid as written: `editable`, `frozenColumns`, `rowHeight`, `resizable`, `reorderableColumns`, `searchableFields`, `showSearch`, `showPagination`, `showColumnTypeIcons`, `conditionalFormatting`, `rowActions`, `bulkActions`, `bulkActionDefs`, `exportOptions`, `grouping`, `aggregations`, `rowColor`, `label` |
239239
| `form` | `fields`, `customFields`, `sections`, `groups`, `layout`, `columns`, `title`, `description`, `subforms`, `buttons`, `defaults`, `initialValues`, `readOnly`, `showSubmit`, `submitText`, `showCancel`, `cancelText`, `showReset`, `className` |
240240

241241
`table` declares exactly these keys (objectui#10976). Any other grid key —

‎content/docs/references/ui/component.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,8 @@ Sort field and direction pair
847847
| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Inline bulk-action definitions (full defs, not names) — the same `BulkActionDef` entries a list view's `bulkActionDefs` declares |
848848
| **navigation** | `{ mode?: Enum<'drawer' \| 'page' \| 'new_window' \| 'none'>; preventNavigation?: boolean; openNewTab?: boolean; size?: Enum<'auto' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'>; … }` | optional | Row-click navigation config — the same block `ListViewSchema.navigation` declares (`{ mode, size, openNewTab, preventNavigation }`) |
849849
| **editable** | `boolean` | optional | Enable inline cell editing |
850-
| **singleClickEdit** | `boolean` | optional | Enter cell edit on single click (default true when editable) |
851-
| **keyboardNavigation** | `boolean` | optional | Arrow-key cell navigation on the WAI-ARIA grid pattern: the grid's data cells become one Tab stop that the arrow keys, Home / End and Ctrl+Home / Ctrl+End move between. Defaults to on when the grid renders editable — `editable` set and the viewer allowed to edit; a grid that renders read-only keeps every cell its own Tab stop unless this is `true`, and `false` turns it off on an editable grid |
850+
| **singleClickEdit** | `never` | optional | [REMOVED] `object-grid` property `singleClickEdit` was removed in @objectstack/spec 18.7.0 (ADR-0049) — a grid that renders editable now selects a cell on a click and opens its editor on double-click, Enter, F2 or typing, so a single-click entry no longer exists for this key to switch. Delete the key; `editable` (with the viewer's write verdict) decides whether the grid edits. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
851+
| **keyboardNavigation** | `boolean` | optional | Arrow-key cell navigation on the WAI-ARIA grid pattern: the grid's data cells become one Tab stop that the arrow keys, Home / End and Ctrl+Home / Ctrl+End move between. Always on when the grid renders editable — `editable` set and the viewer allowed to edit — because that grid selects a cell first and moves the selection with these keys; a grid that renders read-only keeps every cell its own Tab stop unless this is `true` |
852852
| **resizable** | `boolean` | optional | Allow column resize (the renderer default is on) |
853853
| **resizableColumns** | `never` | optional | [REMOVED] `object-grid` property `resizableColumns` was removed in @objectstack/spec 17.7.0 (ADR-0049) — it was the legacy second spelling of `resizable`, read only when `resizable` was absent, so one switch had two spellings and a grid authoring both silently ignored this one. Use `resizable`. Rename the key; the value (a boolean) is unchanged. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
854854
| **reorderableColumns** | `boolean` | optional | Allow column drag-reorder |

‎content/docs/ui/components/index.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ regenerates from the renderer registry. Regenerate it with
9696
| [`object-chart`](/docs/ui/components/plugins#object-chart) | `plugin-charts` | 6 | [Plugin Blocks](/docs/ui/components/plugins) |
9797
| [`object-form`](/docs/ui/components/plugins#object-form) | `plugin-form` | 37 | [Plugin Blocks](/docs/ui/components/plugins) |
9898
| [`object-gantt`](/docs/ui/components/plugins#object-gantt) | `plugin-gantt` | 18 | [Plugin Blocks](/docs/ui/components/plugins) |
99-
| [`object-grid`](/docs/ui/components/plugins#object-grid) | `plugin-grid` | 31 | [Plugin Blocks](/docs/ui/components/plugins) |
99+
| [`object-grid`](/docs/ui/components/plugins#object-grid) | `plugin-grid` | 30 | [Plugin Blocks](/docs/ui/components/plugins) |
100100
| [`object-kanban`](/docs/ui/components/plugins#object-kanban) | `plugin-kanban` | 15 | [Plugin Blocks](/docs/ui/components/plugins) |
101101
| [`object-map`](/docs/ui/components/plugins#object-map) | `plugin-map` | 10 | [Plugin Blocks](/docs/ui/components/plugins) |
102102
| [`object-master-detail-form`](/docs/ui/components/plugins#object-master-detail-form) | `plugin-form` | 15 | [Plugin Blocks](/docs/ui/components/plugins) |

‎content/docs/ui/components/plugins.mdx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,8 @@ Namespace `plugin-grid`.
243243
| `bulkActions` | `array` | | Names of actions offered once rows are selected. Needs a multi-row `selection` to be reachable. |
244244
| `batchActions` | `array` | | Legacy alias of `bulkActions`, and the one the renderer reads FIRST when both are set. Prefer `bulkActions` in new schemas. |
245245
| `bulkActionDefs` | `array` | | Full inline bulk-action definitions, for actions that are not named entries in the object’s action set. Use `bulkActions` when the action already exists. |
246-
| `editable` | `boolean` | | Enable inline cell editing (double-click or Enter opens a cell). |
247-
| `singleClickEdit` | `boolean` | | With `editable`, a single click opens the cell instead of a double-click. Has no effect on a non-editable grid. |
248-
| `keyboardNavigation` | `boolean` | | Arrow-key cell navigation on the WAI-ARIA grid pattern: the grid's data cells take one place in the Tab order instead of one each (a link or button inside a cell keeps its own), and the arrow keys move focus between them (Home / End to the ends of the row, Ctrl+Home / Ctrl+End to the ends of the page). Enter still opens an editable cell, and an edit ended with Enter or Escape returns focus to its cell. Defaults to on when the grid renders editable; a read-only grid keeps every cell its own Tab stop unless this is `true`, and `false` turns it off on an editable grid. |
246+
| `editable` | `boolean` | | Enable inline cell editing where the viewer may edit. A click selects a cell; double-click, Enter, F2 or typing opens its editor, Esc cancels, and each committed cell is saved on its own. A grid that renders read-only keeps click-to-open. |
247+
| `keyboardNavigation` | `boolean` | | Arrow-key cell navigation on the WAI-ARIA grid pattern: the grid's data cells take one place in the Tab order instead of one each (a link or button inside a cell keeps its own), and the arrow keys move focus between them (Home / End to the ends of the row, Ctrl+Home / Ctrl+End to the ends of the page). Enter still opens an editable cell, and an edit ended with Enter or Escape returns focus to its cell. Always on when the grid renders editable, because that grid selects a cell first and moves the selection with these keys; a read-only grid keeps every cell its own Tab stop unless this is `true`. |
249248
| `navigation` | `object` | | What a row click does, `{ mode: "drawer" \| "page" \| "new_window" \| "none", … }`; a block written without `mode` opens the drawer. |
250249
| `operations` | `object` | | Toggles for the built-in affordances, `{ create, update, delete, export }`, e.g. `{ delete: false }`. A declared block replaces the default, so an `update` / `delete` it does not name is withheld. |
251250
| `exportOptions` | `object` | | Export config, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. `streaming` (default true) picks server-side streaming vs browser-side assembly for the export — a behaviour fork, not decoration; set it to `false` to force browser-side assembly. Needs `operations.export` to be reachable from the toolbar. |

0 commit comments

Comments
 (0)