Skip to content

Commit 079edad

Browse files
fix(ui): rich-text cell docs, the read-only data-table warning and the onBatchSave refusal describe the select-first model (#38097)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoPm5yqPvuwrjEV9JhFTrVJj)_ Part of #37521 repo:objectstack#3 · os-tesla · session_01L9qibxEbSk19qJRPHrm3v9 Clause-②: no Metadata-protocol: none ## 维护者速读 - 表格只剩「先选中、每格提交即保存」一种编辑方式。fields 包随包发布的 README 和注释、`data-table` 只读警告、`onBatchSave` 的拒收文字,现在都按这一种方式说话。 - 读包文档或看控制台警告的宿主开发者不会再被指向已经没有的保存按钮,也不会被叫去挂一个挂不上的类型名。 - 只改文字,并删掉表格里恒为真的判断;哪些写法被拒、键盘怎么用都不变。 - 无。卡的另一半(5 个已发布 CHANGELOG 里的两行)按座位裁定在本 PR 合入后单开纯文档 PR。 ## What changes - **`@object-ui/fields` README, "The grid cell editor's face"** and the `IN_CELL_PANEL_EDIT_WIDGETS` docblock in `FieldEditWidget.tsx`: the sentence "a grid without `cellSelection` opens it over the cell, where Ctrl/Cmd+Enter does nothing and a click outside keeps the text as a pending change for the grid's save buttons" is gone. They now say the grid edits only in its select-first model and opens the rich-text box in the panel under the cell. - **The over-the-cell branch is unreachable, and its residue in `data-table.tsx` is retired.** `editable` is `editableProp && selectFirst && onRowSave`, and `startEdit` returns at once when the table is not `editable`, so no editor ever opens outside the select-first model. Removed as always-true or always-false: the `selectFirst` conjunct in `editsBelow`; in the host-injected editor's key handler, the `selectFirst &&` guards on Ctrl/Cmd+Enter in a textarea, on Tab, and on `commitMoves`; `focusSelectionRef.current = selectFirst` in the injected editor's `commit` and Escape paths (now `true`); `!selectFirst ||` in the injected-editor caret effect. The comment describing Tab "outside the select-first model" is replaced by the invariant. The non-edit `selectFirst` branches (selection, the read-only table's arrow navigation, `onRowClick`'s pointer cursor) are live and untouched, and `CellOverlay`'s `cover` placement stays (plain editors use it). - **N3.** `describeUnsavableEditable` (`dataTableBindDiagnostic.ts`) named `GridCellSelection`, the context's value type, as the thing to mount. It now names `GridCellSelectionProvider` in both places, and in its docblock. - **N4.** `handlerKeyRefusal` (`tombstone.zod.ts`, internal to `@object-ui/types`, not exported) takes an optional fourth argument: a `'retired'` key's own remedy, which replaces the node-type remedy. Omitted, the message is byte-for-byte unchanged. Passed for a `'runtime-slot'` key, it throws at declaration. `DataTableSchema.onBatchSave` passes "`onBatchSave` → `onRowSave` on `object-grid`…", ending "Delete the key." The key is refused exactly as before (`custom` at its own path, a live function too). - **N5.** Removed: the two queries of the deleted `data-table-edit-column-header` test id (autosave and select-first harnesses; both tests keep their live assertions, and the autosave test name drops "no edit column"); `inlineEditPermissionGate.test.tsx` case e and its `headerCellCount` helper; `defaultBatchSave` from the `affordanceGrantMap-12082` comment. - One `patch` changeset for `@object-ui/fields`, `@object-ui/components`, `@object-ui/types`. ## Why #35827 retired the staged editing model. Shipped text (the fields README is in the package's `files[]`) still described it, and the warning told hosts to mount a type. Contract record 7189751333 on PR #37437 named all of it. ## Verification Tests added or tightened, each ablated on the committed fix (put back, run, restored from `HEAD`, tree clean): - `data-table-autosave-35685.test.tsx` "without the provider: …": the warning names `` `GridCellSelectionProvider` `` twice and never `` `GridCellSelection` ``. Ablation (both names back): `1 failed | 23 passed (24)`. - `handler-keys-json-refusal-6124.test.ts`: the per-site guidance test now takes an `OWN_RETIREMENT_REMEDY` table (`onBatchSave` → its FROM → TO, `GridCellSelectionProvider`, "Delete the key.", and no `action:button`); a new top-level describe pins the helper itself (default text byte-exact, the remedy replaces only the remedy sentence, a runtime slot refuses one, every own-remedy key is a retired ledger site). Ablations: `onBatchSave` back to the generic call, `1 failed | 343 passed (344)`; the helper ignoring the argument, `2 failed | 342 passed (344)`. - `data-table-select-first-35684.test.tsx`, new describe "an injected editor keeps the model's keys": a host-injected textarea editor commits on Tab and moves right, keeps Enter as a new line and commits on Ctrl/Cmd+Enter with the cell still selected. These hold the two arms whose `selectFirst &&` guard was removed. Ablations: Tab arm removed, `1 failed | 38 passed (39)`; the textarea Ctrl/Cmd+Enter arm removed, `1 failed | 38 passed (39)`. - Case e's replacement: "sends one update with that cell only, draws no save bar, no row Save button and no amber row" in `data-table-autosave-35685.test.tsx` and "no edit-only column, ever" in `data-table-select-first-35684.test.tsx` pin at the table itself that an editable table draws no save column; case e compared three header counts that can no longer differ. - No table without a select-first host edits: already pinned by "no staged fallback" in `data-table-autosave-35685.test.tsx` (no editor opens, no save bar, one warning). <details><summary>Readings at c6bf4f6 (base origin/main 815e882)</summary> - Six touched test files: `Test Files 6 passed (6)`, `Tests 499 passed (499)`. - `vitest run packages/components/ packages/types/ packages/fields/ packages/plugin-grid/ packages/plugin-form/` after an `OS_SKIP_DTS=1` build: `1796 passed | 6 failed | 2 skipped`. The six are spec-parity tests that read `packages/spec/dist/*.d.mts`, which that build does not write ("no module symbol for …/spec/dist/system/index.d.mts"). After a dts build of `@object-ui/plugin-grid^...` and `@object-ui/plugin-form^...`, those six: `Test Files 6 passed (6)`, `Tests 145 passed (145)`. - `type-check` exit 0 for `@object-ui/types`, `components`, `fields`, `plugin-grid`, `plugin-form`. - `eslint` on the ten changed `.ts`/`.tsx` files: 0 errors (warnings pre-existing). - `check:doc-authoring` exit 0; `check:new-line-citations` 0 new; `check-changeset-claims`, `check-changeset-no-major`, `check-adr-0087-registration`, `check-changeset-fixed` exit 0. - `dispatch-gates --tier --repo objectstack-ai/objectstack` on the surface: no path-derived tier mandate; no governed path. </details> ## Acceptance notes - The `.changeset/pre/35827-…` file and the five published CHANGELOG entries (spec, app-shell, components, plugin-grid, types) still say `mount GridCellSelection` / `inside a GridCellSelection host`. Seat ruling: a dedicated docs-only PR after this one merges, which then `Fixes #37521`. - Seen and left, outside the claimed surface: the `renderSelectFirstTable` docblock in `ui/packages/components/src/__tests__/test-utils.tsx` says "a select-first host (`GridCellSelection`)", naming the model, not the thing to mount. - The test harness `handler-keys-json-refusal-6124.test.ts` is the shared harness for `handlerKeyRefusal`; its per-site guidance assertion had to learn the own-remedy case, which is why it is in the diff. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (Not touched.) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L9qibxEbSk19qJRPHrm3v9 --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibxEbSk19qJRPHrm3v9)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 77edd2a commit 079edad

12 files changed

Lines changed: 157 additions & 76 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@object-ui/fields': patch
3+
'@object-ui/components': patch
4+
'@object-ui/types': patch
5+
---
6+
7+
fix(ui): the rich-text cell text, the read-only `data-table` warning and the `onBatchSave` refusal describe the one editing model the grid has
8+
9+
Clause-②: no
10+
Metadata-protocol: none
11+
12+
The list grid has one way to edit: select-first, each committed cell saved at once. Three shipped texts still described the retired staged model or named the wrong thing to mount.
13+
14+
- **`@object-ui/fields`.** The README's "grid cell editor's face" section and the `FieldEditWidget` comment on the rich-content cell panel no longer say that a grid without `cellSelection` opens the `markdown`, `html` or `richtext` box over the cell and keeps its text for the grid's save buttons. The grid edits only in its select-first model, and it opens the box in a panel under the cell: Enter is a new line, Ctrl/Cmd+Enter or a click outside saves, Esc discards.
15+
- **`@object-ui/components`.** The console warning for an editable `data-table` that renders read-only now tells the host to mount `GridCellSelectionProvider`. It named `GridCellSelection`, which is the context's value type and cannot be mounted. The table's host-injected cell editor no longer checks for the select-first model on each key, because an editor only opens inside that model. Tab and Ctrl/Cmd+Enter behave as before.
16+
- **`@object-ui/types`.** The `data-table` schema's refusal of `onBatchSave` names its successor: `onBatchSave` → `onRowSave` on `object-grid`. Render an `object-grid`, which writes each committed cell through its data source, or pass `onRowSave` inside a `GridCellSelectionProvider` from a React host, and delete the key. It used to point the author at a toast or an `action:button` node. The key is refused exactly as before.
17+
18+
Nothing to migrate.

‎ui/packages/components/src/__tests__/data-table-autosave-35685.test.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* `data-table`'s per-cell save in the select-first model (objectstack#35685),
11-
* behind the `GridCellSelection` a host mounts.
11+
* behind the `GridCellSelectionProvider` a host mounts.
1212
*
1313
* 1. A committed cell sends its record's update at once: one call, that
1414
* cell only; no save bar, no row Save/Cancel column, no amber row; the
@@ -115,7 +115,7 @@ function deferredSave() {
115115
}
116116

117117
describe('data-table autosave — a committed cell saves at once (objectstack#35685)', () => {
118-
it('sends one update with that cell only, draws no save bar, no edit column and no amber row', async () => {
118+
it('sends one update with that cell only, draws no save bar, no row Save button and no amber row', async () => {
119119
const { onRowSave, calls } = deferredSave();
120120
const t = renderTable(onRowSave);
121121
t.typeAndEnter(0, 0, 'Alpha 2');
@@ -127,7 +127,6 @@ describe('data-table autosave — a committed cell saves at once (objectstack#35
127127
expect(screen.queryByText(/Save All/)).toBeNull();
128128
expect(screen.queryByText(/row modified/)).toBeNull();
129129
expect(t.container.querySelector('button[title="Save row"]')).toBeNull();
130-
expect(t.container.querySelector('[data-testid="data-table-edit-column-header"]')).toBeNull();
131130
const firstRow = t.container.querySelectorAll('tbody tr')[0] as HTMLElement;
132131
expect(firstRow.className).not.toContain('bg-amber-50');
133132
expect(t.cell(0, 0).className).not.toContain('text-amber-700');
@@ -291,7 +290,10 @@ describe('data-table autosave — no staged fallback: a table that cannot save r
291290
expect(onRowSave).not.toHaveBeenCalled();
292291
const lines = warn.mock.calls.map((c) => String(c[0])).filter((m) => m.startsWith('[ObjectUI] DataTable editable:'));
293292
expect(lines).toHaveLength(1);
294-
expect(lines[0]).toMatch(/GridCellSelection/);
293+
// The component a host mounts is the provider; `GridCellSelection` is the
294+
// context's value type, which cannot be mounted.
295+
expect(lines[0].match(/`GridCellSelectionProvider`/g)).toHaveLength(2);
296+
expect(lines[0]).not.toContain('`GridCellSelection`');
295297
});
296298

297299
it('under the provider with no onRowSave: no editor opens, no save bar, one console warning naming onRowSave', () => {

‎ui/packages/components/src/__tests__/data-table-select-first-35684.test.tsx‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* `data-table`'s select-first cell model (objectstack#35684), behind the
11-
* `GridCellSelection` a host mounts. The list page mounts it through
11+
* `GridCellSelectionProvider` a host mounts. The list page mounts it through
1212
* `ObjectGrid`'s `cellSelection`; its keys while selected and while editing
1313
* are `data-table-keys-35687.test.tsx`.
1414
*
@@ -336,20 +336,17 @@ describe('data-table select-first — a cell that opens no editor says why', ()
336336
});
337337

338338
describe('data-table select-first — no edit-only column, ever (objectstack#35554, objectstack#35685)', () => {
339-
const editHeader = (c: HTMLElement) => c.querySelector('[data-testid="data-table-edit-column-header"]');
340339
const lastHeader = (c: HTMLElement) => [...c.querySelectorAll('thead th')].pop()!;
341340
// The shape `ObjectGrid` hands the list page: a save path and no row menu.
342341
const EDIT_ONLY = { rowActions: true, onRowSave: () => Promise.resolve() };
343342

344343
it('none at rest and none after a commit: the commit saves itself', () => {
345344
const onRowSave = vi.fn(() => Promise.resolve());
346345
const t = renderTable({ extra: { ...EDIT_ONLY, onRowSave } });
347-
expect(editHeader(t.container)).toBeNull();
348346
expect(lastHeader(t.container)).toHaveTextContent('Site');
349347
fireEvent.click(t.cell(0, 0));
350348
fireEvent.change(t.catcher()!, { target: { value: 'A' } });
351349
fireEvent.keyDown(t.editor()!, { key: 'Enter' });
352-
expect(editHeader(t.container)).toBeNull();
353350
expect(lastHeader(t.container)).toHaveTextContent('Site');
354351
expect(t.container.querySelector('button[title="Save row"]')).toBeNull();
355352
expect(onRowSave).toHaveBeenCalledTimes(1);
@@ -627,3 +624,38 @@ describe('data-table select-first — a read-only cell says so in the grid (obje
627624
expect(t.container.querySelector('[aria-readonly]')).toBeNull();
628625
});
629626
});
627+
628+
describe('data-table select-first — an injected editor keeps the model\'s keys (objectstack#35687)', () => {
629+
// An editor opens only inside the select-first model (an `editable` table
630+
// with no select-first host is read-only), so a host-injected editor's Tab
631+
// and Ctrl/Cmd+Enter always follow that model.
632+
const renderCellEditor = (ctx: { value: unknown; stage: (v: unknown) => void }) => (
633+
<textarea aria-label="name editor" value={String(ctx.value ?? '')} onChange={(e) => ctx.stage(e.target.value)} />
634+
);
635+
const openEditor = () => {
636+
const t = renderTable({ extra: { renderCellEditor } });
637+
fireEvent.click(t.cell(0, 0));
638+
fireEvent.keyDown(t.catcher()!, { key: 'Enter' });
639+
const area = screen.getByLabelText('name editor');
640+
fireEvent.change(area, { target: { value: 'Alpha 2' } });
641+
return { t, area };
642+
};
643+
644+
it('Tab commits a multi-line editor and moves to the next cell', () => {
645+
const { t, area } = openEditor();
646+
fireEvent.keyDown(area, { key: 'Tab' });
647+
expect(screen.queryByLabelText('name editor')).toBeNull();
648+
expect(t.onCellChange).toHaveBeenLastCalledWith(0, 'name', 'Alpha 2', ROWS[0]);
649+
expect(t.cell(0, 1)).toHaveAttribute('aria-selected', 'true');
650+
});
651+
652+
it('Enter is a new line; Ctrl/Cmd+Enter commits and the cell stays selected', () => {
653+
const { t, area } = openEditor();
654+
fireEvent.keyDown(area, { key: 'Enter' });
655+
expect(screen.getByLabelText('name editor')).toBeInTheDocument();
656+
fireEvent.keyDown(area, { key: 'Enter', ctrlKey: true });
657+
expect(screen.queryByLabelText('name editor')).toBeNull();
658+
expect(t.onCellChange).toHaveBeenLastCalledWith(0, 'name', 'Alpha 2', ROWS[0]);
659+
expect(t.cell(0, 0)).toHaveAttribute('aria-selected', 'true');
660+
});
661+
});

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

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4069,7 +4069,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
40694069
// its first control, once it has drawn one (a lazily loaded picker draws it
40704070
// a few frames late). Before this the caret stayed on the cell.
40714071
useEffect(() => {
4072-
if (!selectFirst || !editingCell) return undefined;
4072+
if (!editingCell) return undefined;
40734073
let frame = 0;
40744074
let frames = 0;
40754075
const place = () => {
@@ -4083,7 +4083,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
40834083
};
40844084
place();
40854085
return () => cancelAnimationFrame(frame);
4086-
}, [editingCell, selectFirst]);
4086+
}, [editingCell]);
40874087

40884088
// Commit a host-injected widget editor on click-outside (objectui#2321).
40894089
//
@@ -5080,7 +5080,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
50805080
const cellValue = hasPendingChange ? rowChanges[col.accessorKey] : originalValue;
50815081
const isEditing = editingCell !== null && editingCell.rowKey === rowKey && editingCell.columnKey === col.accessorKey;
50825082
// objectstack#36023 — a picker's panel opens under the cell, which keeps its value drawn.
5083-
const editsBelow = isEditing && selectFirst && editorBelow;
5083+
const editsBelow = isEditing && editorBelow;
50845084
// The reason the last refusal gave for THIS cell, if it
50855085
// named it (objectstack-ai/objectstack#27520).
50865086
const cellError = rowCellErrors?.[col.accessorKey];
@@ -5394,7 +5394,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
53945394
// objectstack#35688 — a pick that commits hands the
53955395
// focus back to the selected cell, as Enter does.
53965396
commit: (v?: any) => {
5397-
focusSelectionRef.current = selectFirst;
5397+
focusSelectionRef.current = true;
53985398
if (!saveEdit(true, v)) focusSelectionRef.current = false;
53995399
},
54005400
cancel: cancelEdit,
@@ -5417,17 +5417,10 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
54175417
// textarea it's left alone so Enter opens the
54185418
// dropdown / inserts a newline as usual.
54195419
//
5420-
// Outside the select-first model, Tab is
5421-
// deliberately NOT in that list, and
5422-
// tabbing out therefore does not leave edit
5423-
// mode — measured, `64d937c53`. It costs
5424-
// nothing: the widget has already staged
5425-
// every keystroke into `pendingChanges` (or,
5426-
// reading its input on blur, staged on the
5427-
// Tab's own blur — objectui#12664), so
5428-
// the value is safe; the cell simply stays
5429-
// open until Enter, Escape, or a pointer
5430-
// press outside closes it.
5420+
// An editor opens only in the select-first
5421+
// model (`startEdit` refuses a table that is
5422+
// not `editable`, and `editable` needs that
5423+
// model), so its keys are always the model's.
54315424
return (
54325425
<div
54335426
ref={(n) => { injectedEditorElRef.current = n; }}
@@ -5439,19 +5432,19 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
54395432
const tag = (e.target as HTMLElement).tagName;
54405433
// The select-first model (objectstack#35687): in a
54415434
// multi-line editor Ctrl/Cmd+Enter commits, and Tab
5442-
// commits and moves, superseding the Tab-stays rule.
5435+
// commits and moves.
54435436
const commits = (e.key === 'Enter' && (tag === 'INPUT'
5444-
|| (selectFirst && tag === 'TEXTAREA' && (e.ctrlKey || e.metaKey))))
5445-
|| (selectFirst && e.key === 'Tab');
5437+
|| (tag === 'TEXTAREA' && (e.ctrlKey || e.metaKey))))
5438+
|| e.key === 'Tab';
54465439
if (commits) {
54475440
e.preventDefault();
54485441
// A commit-on-blur widget stages
54495442
// on this blur (objectui#12664).
54505443
flushInjectedEditor();
5451-
if (saveEdit(true) && selectFirst) commitMoves(e);
5444+
if (saveEdit(true)) commitMoves(e);
54525445
} else if (e.key === 'Escape') {
54535446
e.preventDefault();
5454-
focusSelectionRef.current = selectFirst;
5447+
focusSelectionRef.current = true;
54555448
exitEdit(true);
54565449
}
54575450
}}

‎ui/packages/components/src/renderers/complex/dataTableBindDiagnostic.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ export const DATA_TABLE_EDITABLE_DIAGNOSTIC_PREFIX = '[ObjectUI] DataTable edita
299299
* The table has ONE editing model: select-first, each committed cell saved at
300300
* once through `onRowSave`. The staged model — click-to-edit, a
301301
* pending-changes bar and "Save All" through `onBatchSave` — is retired, so an
302-
* `editable` table without both a select-first host (`GridCellSelection`) and
302+
* `editable` table without both a select-first host (`GridCellSelectionProvider`) and
303303
* an `onRowSave` slot has no way to save an edit. It draws read-only rather
304304
* than hold an edit nothing sends; this line says so, once per node, on the
305305
* channel the other diagnostics in this module use.
@@ -314,12 +314,12 @@ export function describeUnsavableEditable(
314314
): string | null {
315315
if (!editable || (savePath.selectFirst && savePath.rowSave)) return null;
316316
const missing = [
317-
savePath.selectFirst ? null : 'no select-first cell model is mounted around it (`GridCellSelection`)',
317+
savePath.selectFirst ? null : 'no select-first cell model is mounted around it (`GridCellSelectionProvider`)',
318318
savePath.rowSave ? null : 'no `onRowSave` slot is supplied to save each committed cell',
319319
].filter((part): part is string => part !== null);
320320
return `${DATA_TABLE_EDITABLE_DIAGNOSTIC_PREFIX} ${describeAddress(address)} — `
321321
+ `\`editable: true\` is refused and the table renders read-only: ${missing.join(', and ')}. `
322322
+ 'Inline editing saves each committed cell on its own; there is no staged "Save All" mode.\n'
323323
+ ' Render an `object-grid` (`ObjectGrid`), which mounts both and writes through its data '
324-
+ 'source, or mount `GridCellSelection` and pass `onRowSave` in code.';
324+
+ 'source, or mount `GridCellSelectionProvider` and pass `onRowSave` in code.';
325325
}

‎ui/packages/fields/README.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,10 @@ they stay in `INLINE_EXCLUDED_FIELD_TYPES` and `hasFieldEditWidget` answers
167167
`false` for them, so every other host keeps them out, while
168168
`hasInCellPanelEditWidget(type)` answers `true` and `FieldEditWidget` draws the
169169
form's rich-text box for them (loaded lazily) when the host asks for the cell
170-
face. A select-first list grid (`cellSelection`) opens it in a panel under the
171-
cell, where Enter is a new line, Ctrl/Cmd+Enter saves, Esc discards and a click
172-
outside saves; a grid without `cellSelection` opens it over the cell, where
173-
Ctrl/Cmd+Enter does nothing and a click outside keeps the text as a pending
174-
change for the grid's save buttons.
170+
face. The list grid edits only in its select-first model, and it opens the box
171+
in a panel under the cell, where Enter is a new line, Ctrl/Cmd+Enter saves, Esc
172+
discards and a click outside saves; the cell keeps showing its value. A table
173+
with no select-first host edits nothing, rich text included.
175174

176175
### Resolving declared action params
177176

‎ui/packages/fields/src/FieldEditWidget.tsx‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,9 @@ export const INLINE_EXCLUDED_FIELD_TYPES = new Set<string>([
212212
* Members of {@link INLINE_EXCLUDED_FIELD_TYPES} that the LIST GRID's cell
213213
* nevertheless edits, in a panel opened under the cell (objectstack#36023):
214214
* the rich-content types, whose panel is the form's own text box over the
215-
* stored source. Enter in it is a new line; a select-first grid
216-
* (`cellSelection`) saves on Ctrl/Cmd+Enter or a click outside and discards on
217-
* Esc. A grid without `cellSelection` opens the box over the cell instead, where
218-
* Ctrl/Cmd+Enter does nothing, Esc discards and a click outside keeps the text
219-
* as a pending change for the grid's save buttons.
215+
* stored source. Enter in it is a new line; Ctrl/Cmd+Enter or a click outside
216+
* saves and Esc discards. The grid edits only in its select-first model, so
217+
* the panel under the cell is the only place these types are edited in a grid.
220218
*
221219
* Only a host that asks for the cell face (`inCell`) gets them, so the record
222220
* page's field editor, the required-fields dialogs and every other host of

‎ui/packages/plugin-form/src/affordanceGrantMap-12082.test.tsx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,9 +904,8 @@ const WRITE_SITES: Record<string, WriteSite> = {
904904
...mapped(['listImport'], CONSOLE_LIST, 'packages/app-shell/src/views/importTargetFields.ts'),
905905
note: "the console list's Import reads the row where it offers Import; HOST_GATED below holds every mount of the wizard to this list",
906906
} as WriteSite,
907-
// The inline-edit saves (objectui#12292): `defaultRowSave` and
908-
// `defaultBatchSave` both write through `writeRowGuarded`, the `If-Match`
909-
// write; `resolveRowConflict` is the same save's Overwrite after a 409, re-keyed
907+
// The inline-edit save (objectui#12292): `defaultRowSave` writes through
908+
// `writeRowGuarded`, the `If-Match` write; `resolveRowConflict` is the same save's Overwrite after a 409, re-keyed
910909
// to the server's version. One affordance, the grid's `listInlineEdit` row.
911910
'packages/plugin-grid/src/ObjectGrid.tsx :: ObjectGrid > writeRowGuarded :: update': mapped(['listInlineEdit'], OBJECT_GRID),
912911
'packages/plugin-grid/src/ObjectGrid.tsx :: ObjectGrid > resolveRowConflict :: update': mapped(['listInlineEdit'], OBJECT_GRID),

‎ui/packages/plugin-grid/src/__tests__/inlineEditPermissionGate.test.tsx‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,6 @@ async function kebabOffersEdit(c: Case): Promise<boolean> {
201201
return screen.queryAllByTestId('row-action-builtin-edit').length > 0;
202202
}
203203

204-
/** Header cell count — the observable for the save/cancel `rowActions` column. */
205-
async function headerCellCount(c: Case): Promise<number> {
206-
const { container } = renderGrid(c);
207-
await waitFor(() => expect(screen.getByText('Row One')).toBeInTheDocument());
208-
await waitFor(() => expect(screen.getByText('Row Two')).toBeInTheDocument());
209-
return container.querySelectorAll('thead th').length;
210-
}
211-
212204
beforeEach(() => {
213205
state.permUpdate = true;
214206
state.effectiveOps = undefined;
@@ -248,22 +240,6 @@ describe("ObjectGrid `editable` vs can(object, 'update') (#5143)", () => {
248240
cleanup();
249241
expect(await entersEditState({ editable: true, permUpdate: true })).toBe(true);
250242
});
251-
252-
it('e — no verdict draws a save/cancel column: the gated grid IS the non-editable grid', async () => {
253-
// The staged model drew a trailing save/cancel column on an editable grid,
254-
// and this case pinned that a read-only principal did not get it. That
255-
// column is retired with the staged model (objectstack#35827): each cell
256-
// saves on its own, so an editable grid, a gated one and a never-editable
257-
// one are column-for-column the same.
258-
const editableWithGrant = await headerCellCount({ editable: true, permUpdate: true });
259-
cleanup();
260-
const editableNoGrant = await headerCellCount({ editable: true, permUpdate: false });
261-
cleanup();
262-
const neverEditable = await headerCellCount({ permUpdate: true });
263-
264-
expect(editableNoGrant).toBe(neverEditable);
265-
expect(editableWithGrant).toBe(neverEditable);
266-
});
267243
});
268244

269245
describe('ObjectGrid inline edit vs the object-level affordance (#5143)', () => {

0 commit comments

Comments
 (0)