Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .changeset/36270-object-grid-single-click-edit-retired.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
'@objectstack/spec': minor
'@object-ui/types': minor
'@object-ui/plugin-grid': minor
'@object-ui/plugin-view': minor
---

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

Clause-②: no (narrowing)
Metadata-protocol: narrowed

<!-- adr-0087: registered object-grid-single-click-edit-removed, object-grid-single-click-edit-retired -->

**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.

- **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.
- **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.
- **`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.

| FROM | TO |
|:--|:--|
| `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 |
| `object-grid` `properties.singleClickEdit: false` | delete the key; double-click still opens the editor |
| `object-view` `table.singleClickEdit` | delete the key |
| 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` |

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.

The retirement kit:

- **`@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.
- **`@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.
- **`@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.
- **`@object-ui/plugin-view`**: `table.singleClickEdit` is no longer relayed to the grid.
94 changes: 57 additions & 37 deletions content/docs/frontend/plugins/plugin-grid.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -347,20 +347,23 @@ Enable inline cell editing for quick data updates:
{ "field": "email", "label": "Email" },
{ "field": "status", "label": "Status", "type": "select" }
],
"editable": true,
"singleClickEdit": false
"editable": true
}
}
```

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

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

#### On an object's list page
#### The select-first cell model

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

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

### Batch Editing & Multi-Row Save

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

```json
{
"type": "object-grid",
"properties": {
"objectName": "products",
"columns": [
{ "field": "sku", "label": "SKU" },
{ "field": "name", "label": "Name" },
{ "field": "price", "label": "Price", "type": "currency", "align": "right" },
{ "field": "stock", "label": "Stock", "type": "number", "align": "right" }
],
"editable": true
}
}
```tsx
import { ObjectGrid, type ObjectGridComponentProps } from '@object-ui/plugin-grid';

declare const dataSource: NonNullable<ObjectGridComponentProps['dataSource']>;

export const ProductsGrid = () => (
<ObjectGrid
cellSelection={false}
dataSource={dataSource}
schema={{
type: 'object-grid',
objectName: 'products',
columns: [
{ field: 'sku', label: 'SKU' },
{ field: 'name', label: 'Name' },
{ field: 'price', label: 'Price', type: 'currency', align: 'right' },
{ field: 'stock', label: 'Stock', type: 'number', align: 'right' },
],
editable: true,
}}
/>
);
```

Left alone, saving goes through the host's data source. A React host that needs
Expand Down Expand Up @@ -626,7 +644,9 @@ const persistence = (
- **Flexible callbacks** — all three are `ObjectGridComponentProps`, never schema
keys: `onRowSave` for a single row, `onBatchSave` for many, `onCellChange` for
each committed cell edit, including one that leaves the value as loaded (only a
real change is staged)
real change is staged). `onBatchSave` is `@deprecated`: only this staged model calls it;
on a select-first grid each cell saves through `onRowSave` (or the grid's own
write) and `onBatchSave` is never called
- **A concurrent write is refused, not overwritten**: the default saves send each
row's `updated_at` as `If-Match`, and an editable grid asks for that column even
when no column shows it. A row someone else saved after it was read answers
Expand Down
2 changes: 1 addition & 1 deletion content/docs/frontend/plugins/plugin-view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ object through:

| Sub-config | Keys `ObjectView` forwards |
| --- | --- |
| `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` |
| `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` |
| `form` | `fields`, `customFields`, `sections`, `groups`, `layout`, `columns`, `title`, `description`, `subforms`, `buttons`, `defaults`, `initialValues`, `readOnly`, `showSubmit`, `submitText`, `showCancel`, `cancelText`, `showReset`, `className` |

`table` declares exactly these keys (objectui#10976). Any other grid key —
Expand Down
4 changes: 2 additions & 2 deletions content/docs/references/ui/component.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -847,8 +847,8 @@ Sort field and direction pair
| **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 |
| **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 }`) |
| **editable** | `boolean` | optional | Enable inline cell editing |
| **singleClickEdit** | `boolean` | optional | Enter cell edit on single click (default true when editable) |
| **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 |
| **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. |
| **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` |
| **resizable** | `boolean` | optional | Allow column resize (the renderer default is on) |
| **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. |
| **reorderableColumns** | `boolean` | optional | Allow column drag-reorder |
Expand Down
2 changes: 1 addition & 1 deletion content/docs/ui/components/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ regenerates from the renderer registry. Regenerate it with
| [`object-chart`](/docs/ui/components/plugins#object-chart) | `plugin-charts` | 6 | [Plugin Blocks](/docs/ui/components/plugins) |
| [`object-form`](/docs/ui/components/plugins#object-form) | `plugin-form` | 37 | [Plugin Blocks](/docs/ui/components/plugins) |
| [`object-gantt`](/docs/ui/components/plugins#object-gantt) | `plugin-gantt` | 18 | [Plugin Blocks](/docs/ui/components/plugins) |
| [`object-grid`](/docs/ui/components/plugins#object-grid) | `plugin-grid` | 31 | [Plugin Blocks](/docs/ui/components/plugins) |
| [`object-grid`](/docs/ui/components/plugins#object-grid) | `plugin-grid` | 30 | [Plugin Blocks](/docs/ui/components/plugins) |
| [`object-kanban`](/docs/ui/components/plugins#object-kanban) | `plugin-kanban` | 15 | [Plugin Blocks](/docs/ui/components/plugins) |
| [`object-map`](/docs/ui/components/plugins#object-map) | `plugin-map` | 10 | [Plugin Blocks](/docs/ui/components/plugins) |
| [`object-master-detail-form`](/docs/ui/components/plugins#object-master-detail-form) | `plugin-form` | 15 | [Plugin Blocks](/docs/ui/components/plugins) |
Expand Down
5 changes: 2 additions & 3 deletions content/docs/ui/components/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,8 @@ Namespace `plugin-grid`.
| `bulkActions` | `array` | | Names of actions offered once rows are selected. Needs a multi-row `selection` to be reachable. |
| `batchActions` | `array` | | Legacy alias of `bulkActions`, and the one the renderer reads FIRST when both are set. Prefer `bulkActions` in new schemas. |
| `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. |
| `editable` | `boolean` | | Enable inline cell editing (double-click or Enter opens a cell). |
| `singleClickEdit` | `boolean` | | With `editable`, a single click opens the cell instead of a double-click. Has no effect on a non-editable grid. |
| `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. |
| `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. |
| `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`. |
| `navigation` | `object` | | What a row click does, `{ mode: "drawer" \| "page" \| "new_window" \| "none", … }`; a block written without `mode` opens the drawer. |
| `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. |
| `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. |
Expand Down
Loading
Loading