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
19 changes: 19 additions & 0 deletions .changeset/35688-in-cell-typed-lookup-rating.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@object-ui/components': patch
'@object-ui/fields': patch
'@object-ui/plugin-grid': patch
---

feat(fields): typed values edit flat in their list cell, a record picker opens its list in place, and a rating is set without an editor

Clause-②: yes (widening)
Metadata-protocol: none

In the list grid's cell editor (the layer over the cell, `inCell`):

- Text, email, phone, URL, number, currency and percent are the cell itself: one row tall, square, with no border, fill or shadow of their own, the layer's 2px frame the only line around them (square and flat even under a host theme that rounds and lifts every dialog with `!important`). The box starts as wide as its column and grows to the right with the text, over the next cells, without moving them. Numbers are right-aligned and raw (`34500.5`, not `34,500.50`); a currency shows its code before the amount; a percent shows its points and a `%`, without the slider. The grid's built-in text and number editors take the same flat look.
- A lookup, master-detail or user cell opens its searchable candidate list at once (recently used first, then results); a pick is the whole edit. Under the list, Browse all records opens the full record picker (classic lookups, gated by `dependsOn` like the list), where a single pick ends the edit too, and Clear is offered while the cell holds a value.
- On a select-first grid a rating opens no editor: a digit key sets that many stars (0 clears, capped at the field's scale), a click on a star of the already selected cell sets it, and Backspace or Delete clears it. `GridCellFacts` gains the optional `stars` fact a host sets for this (`ObjectGrid` sets it for `rating` fields).
- The record pickers' local "recently used" ring is kept per signed-in user as well as per object, so two accounts in one browser no longer share it. Rings stored under the old object-only key are not read, so each user's recents start empty once after the upgrade.

Forms, dialogs and the record page draw these widgets as before. No i18n key is added.
24 changes: 18 additions & 6 deletions docs/qa/platform-checklist/areas/records-forms.json
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@
"title": "Form-view gallery: every FormViewSchema layout type renders and submits",
"since": "v15",
"status": "active",
"revision": 8,
"revision": 9,
"priority": "P1",
"surface": "browser",
"personas": [
Expand Down Expand Up @@ -991,7 +991,7 @@
"overlay the default form with the tabbed variant (type tabbed + the sections of formViews.tabbed, through the fixtures.requires[0] recipe with item-level isDefault:true); reopen the page form; verify the three tabs (Overview / Schedule / Details) and that switching tabs preserves entered values",
"overlay the default form with the wizard variant; open the PAGE form (…/showcase_task/new, or the record's /edit route — RecordFormPage passes the type in both modes); walk Basics → Assignment → Schedule with next/back; verify back preserves values and submit happens ONCE at the end. The New/Edit MODAL renders a wizard as a stacked section list by design (resolveFormViewLayout), so the steps are walked on the page route",
"RETIRED-TYPE refusal: put the default-form overlay of fixtures.requires[0] with type 'split', then 'drawer', then 'modal' (any sections), and capture each refusal: a 422 whose message names the retired value with its prescription (FORM_VIEW_TYPE_RETIRED). Record whether the draft PUT or its publish answered it. Then re-read GET /api/v1/meta/view/showcase_task.form and confirm none of the three landed. There is no split pane to look for: the showcase's formViews.split is now a two-tab tabbed form",
"drawer and modal: open task-desk.page.ts; click a task row — ObjectForm formType=\"drawer\" opens as a side panel over the list with the task's fields; click New task — ObjectForm formType=\"modal\" opens as a dialog. These are the React block's containers, which ADR-0050 keeps (the block is the caller that opens the form); a form view can no longer name either (steps[3])",
"drawer and modal: open task-desk.page.ts; click a task's title (or select one of its cells and press Space) — ObjectForm formType=\"drawer\" opens as a side panel over the list with the task's fields; click New task — ObjectForm formType=\"modal\" opens as a dialog. These are the React block's containers, which ADR-0050 keeps (the block is the caller that opens the form); a form view can no longer name either (steps[3])",
"on the simple form, set priority to 'urgent' and verify the notes field appears (FormField.visibleWhen CEL); set it back and verify notes hides",
"save an edit through each rendered variant; capture each save request; re-read via GET /api/v1/data/showcase_task/<id>. The page form's /new and /edit routes are reached by URL only: the record page's Edit opens the form as a modal (?form=ID, footer 'Update'), not the page (QA run #33861). A deep-linked page form saves and stays in the app: RecordFormPage's goBack goes back one entry only when the console pushed one (history.state.idx above 0) and otherwise replaces to the record page (edit) or the list (create) (ui/packages/app-shell/src/views/RecordFormPage.tsx)",
"revert the default-form overlay so the stock simple form is back — DELETE /api/v1/meta/view/showcase_task.form, the reset door, which restores the artifact default byte-identically (QA run #24572) — and confirm it with a re-read of the view"
Expand Down Expand Up @@ -1097,6 +1097,12 @@
"date": "2026-11-15",
"change": "steps[6] re-pointed: the record page's Edit opens a modal (?form=ID), so the page routes are reached by URL (QA run #33861, ledger row 140), and a deep-linked page form no longer leaves the document on save (RecordFormPage goBack replaces to the record or the list when nothing was pushed). No clause changed. Ledger 6896511848 of the v18.5.0 sweep anchor #33761, carried by batch-A card #33963; read at base 895783a1.",
"ref": "#33990"
},
{
"revision": 9,
"date": "2026-11-21",
"change": "steps[4] opens the edit drawer from a task's title link, or Space on a selected cell: the list is select-first since #35684, so a click on an assignee, status or priority cell only selects it. No clause changed. Read at base c00be39b",
"ref": "#35794"
}
]
},
Expand Down Expand Up @@ -6510,7 +6516,7 @@
"title": "Defaults that changed meaning on v18 (ADR-0087 D3 18.* entries): an omitted list-view page size is 50 (was 25), an omitted editInline means editable in place, an autonumber with no `unique` is unique per organization, and a field-heavy form opens as a bounded modal on desktop",
"since": "v18",
"status": "active",
"revision": 8,
"revision": 9,
"priority": "P2",
"surface": "mixed",
"personas": [
Expand All @@ -6530,8 +6536,8 @@
]
},
"steps": [
"GET /api/v1/meta/view/VIEW to confirm the view declares no pagination and no userActions block — the meta read serves the authored view, so nothing resolved can be read there; the defaults show only in the renderer (the list request's top=50, the Edit inline switch). Seed more than 50 rows on the object whose list you count first (fixtures.requires[2]: no stock object holds that many), then open the list in the console and count the first page",
"as a member who may update, open the list and confirm the inline-edit affordance — the 'Edit inline' switch in the list's Display / view-settings popover at desktop width; as a read-only member confirm it is absent. The edit mode itself is session state that starts OFF (objectui app-shell ObjectView.tsx: 'The edit mode is now session state'), so cells are not editable on load until the switch is turned on — a click on a cell opens the record before then",
"GET /api/v1/meta/view/VIEW to confirm the view declares no pagination and no userActions block — the meta read serves the authored view, so nothing resolved can be read there; the defaults show only in the renderer (the list request's top=50, cells editable in place). Seed more than 50 rows on the object whose list you count first (fixtures.requires[2]: no stock object holds that many), then open the list in the console and count the first page",
"as a member who may update, open the list and confirm the inline-edit affordance — the list is editable in place with no switch and no mode: a click on a data cell selects it, and a double-click, Enter or typing opens its editor; as a read-only member select a cell and press Enter — the cell says why it cannot be edited and no editor opens",
"create two rows of an autonumber object in the same org and read their numbers",
"open New on a field-heavy object on a desktop viewport, then on a mobile viewport"
],
Expand All @@ -6549,7 +6555,7 @@
"evidence": "row count + one-line screenshot description"
},
{
"clause": "inline edit is offered to an updater and absent for a read-only member with editInline omitted — 'offered' means the Edit inline switch is present (the edit mode starts off for the session, steps[1])",
"clause": "inline edit is offered to an updater and absent for a read-only member with editInline omitted — 'offered' means a selected cell opens its editor on Enter or a double-click, and 'absent' means the cell says why instead (steps[1])",
"oracle": "screenshot",
"verify": "per-persona affordance",
"evidence": "two one-line descriptions"
Expand Down Expand Up @@ -6623,6 +6629,12 @@
"date": "2026-11-19",
"change": "acceptance[1] reads 'first window' for 'first page': since #35554 a list view with no declared `pagination` draws no pager and loads its next 50 as it scrolls; the 50-row default it pins is unchanged. Read at base 93fa4f97",
"ref": "#35554"
},
{
"revision": 9,
"date": "2026-11-21",
"change": "steps[0], steps[1] and acceptance[2].clause follow #35684: the list is editable in place with no Edit inline switch and no session mode; a click selects a cell, a double-click, Enter or typing edits it, and for a read-only member the cell says why it cannot be edited. The 50-row and form-shape clauses are unchanged. Read at base c00be39b",
"ref": "#35794"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion examples/app-showcase/src/ui/pages/task-desk.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Page() {
<div>
<h1 style={{ fontSize: 24, fontWeight: 700, letterSpacing: '-0.01em', color: 'hsl(var(--foreground))', margin: 0 }}>Task Desk</h1>
<p style={{ marginTop: 4, fontSize: 14, color: 'hsl(var(--muted-foreground))' }}>
Click a task to edit it in a <strong>drawer</strong>; create one in a <strong>modal</strong> — both render the platform's pre-styled <code>&lt;ObjectForm&gt;</code> overlay.
Click a task's title to edit it in a <strong>drawer</strong>; create one in a <strong>modal</strong> — both render the platform's pre-styled <code>&lt;ObjectForm&gt;</code> overlay.
</p>
</div>
<button onClick={() => setCreating(true)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,30 @@ const LEDGER: Readonly<Record<string, LedgerRow>> = {
why: 'RUNTIME SLOT — a host-supplied function; JSON has no function value (the objectui#6124 shape).',
},
// objectstack#35688 — the list grid's cell editor (`ObjectGrid` through
// `FieldEditWidget`) sets these two; a form never does.
// `FieldEditWidget`) sets these two; a form never does. The typed inputs,
// rating and record pickers read them since S3 (objectstack#36023).
inCell: {
readers: [
'props@fields/src/widgets/ColorField.tsx', 'props@fields/src/widgets/MultiSelectField.tsx',
'props@fields/src/widgets/TagsField.tsx', 'props@fields/src/widgets/TimeField.tsx',
'props@fields/src/widgets/ColorField.tsx', 'props@fields/src/widgets/CurrencyField.tsx',
'props@fields/src/widgets/EmailField.tsx', 'props@fields/src/widgets/LookupField.tsx',
'props@fields/src/widgets/MultiSelectField.tsx', 'props@fields/src/widgets/NumberField.tsx',
'props@fields/src/widgets/PercentField.tsx', 'props@fields/src/widgets/PhoneField.tsx',
'props@fields/src/widgets/RatingField.tsx', 'props@fields/src/widgets/TagsField.tsx',
'props@fields/src/widgets/TextField.tsx', 'props@fields/src/widgets/TimeField.tsx',
'props@fields/src/widgets/UrlField.tsx',
],
why: 'RUNTIME SLOT (objectstack#35688) — host plumbing: the grid cell editor asks for the in-cell face; where a '
+ 'widget is drawn is the host\'s fact, not something a form document authors.',
},
onCommit: {
readers: [
'props@fields/src/widgets/ColorField.tsx', 'props@fields/src/widgets/MultiSelectField.tsx',
'props@fields/src/widgets/TagsField.tsx', 'props@fields/src/widgets/TimeField.tsx',
'props@fields/src/widgets/ColorField.tsx', 'props@fields/src/widgets/CurrencyField.tsx',
'props@fields/src/widgets/EmailField.tsx', 'props@fields/src/widgets/LookupField.tsx',
'props@fields/src/widgets/MultiSelectField.tsx', 'props@fields/src/widgets/NumberField.tsx',
'props@fields/src/widgets/PercentField.tsx', 'props@fields/src/widgets/PhoneField.tsx',
'props@fields/src/widgets/RatingField.tsx', 'props@fields/src/widgets/TagsField.tsx',
'props@fields/src/widgets/TextField.tsx', 'props@fields/src/widgets/TimeField.tsx',
'props@fields/src/widgets/UrlField.tsx',
],
why: 'RUNTIME SLOT (objectstack#35688) — a host-supplied function (the grid cell editor\'s commit); JSON has no '
+ 'function value (the objectui#6124 shape).',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ afterEach(() => {
}
});

function renderTable(extra: Record<string, unknown> = {}) {
function renderTable(extra: Record<string, unknown> = {}, selection: React.ComponentProps<typeof GridCellSelectionProvider>['value'] = {}) {
const DataTable = ComponentRegistry.get('data-table')!;
const onCellChange = vi.fn();
const schema = {
Expand All @@ -82,7 +82,7 @@ function renderTable(extra: Record<string, unknown> = {}) {
...extra,
};
const utils = render(
<GridCellSelectionProvider value={{}}>
<GridCellSelectionProvider value={selection}>
<DataTable schema={schema} />
</GridCellSelectionProvider>,
);
Expand Down Expand Up @@ -147,7 +147,8 @@ describe('data-table — the editor and a cut-off cell draw on a layer over the
// The utility that reads the seed survives the per-type floor, which rides an inner box.
expect(layer.className).toContain('min-w-[max(var(--radix-popper-anchor-width),var(--cell-overlay-min-w,0px))]');
expect(layer.className).not.toMatch(/(^|\s)min-w-40(\s|$)/);
expect(layer.querySelector('.min-w-40')).not.toBeNull();
// objectstack#36023 — a typed value takes no per-type floor: it starts at the cell's width.
expect(layer.querySelector('.min-w-40')).toBeNull();
fireEvent.keyDown(layer.querySelector('input')!, { key: 'Escape' });
expect(t.editorLayer()).toBeNull();
expect(t.previewLayer()).toBeNull();
Expand Down Expand Up @@ -191,3 +192,88 @@ describe('data-table — the editor and a cut-off cell draw on a layer over the
expect(t.onCellChange).toHaveBeenCalledWith(0, 'name', 'Alpha 2', expect.anything());
});
});

describe('data-table — typed values edit flat in the cell; a rating is set in place (objectstack#36023)', () => {
it('the built-in text editor is the flat face, and the layer drops its padding, radius and shadow for it', () => {
const t = renderTable();
fireEvent.click(t.cell(0, 0));
fireEvent.keyDown(t.catcher(), { key: 'Enter' });
const layer = t.editorLayer()!;
const input = layer.querySelector<HTMLInputElement>('[data-in-cell-face="input"] input[data-in-cell-input]')!;
expect(input).toHaveValue('Alpha');
expect(input.className).toMatch(/\bborder-0\b/);
expect(input.className).toMatch(/\brounded-none\b/);
expect(input.className).not.toMatch(/(^|\s)h-10(\s|$)/);
// The layer reads the marked face (`:has()` utilities, spelled in full for Tailwind).
expect(layer.className).toContain('has-[[data-in-cell-face=input]]:p-0');
expect(layer.className).toContain('has-[[data-in-cell-face=input]]:rounded-none');
expect(layer.className).toContain('has-[[data-in-cell-face=input]]:border-2');
// The form-density height skips the flat input.
expect(layer.className).toContain(':not([data-in-cell-input])]:h-8');
});

function renderRating() {
const onCellChange = vi.fn();
const t = renderTable(
{
columns: [
{ header: 'Name', accessorKey: 'name' },
{
header: 'Score',
accessorKey: 'score',
// The stars the rating cell renderer draws, one hit target each.
cell: (value: number) => (
<span>{[1, 2, 3, 4, 5].map((n) => <svg key={n} data-rating-star={n} data-filled={n <= value ? '' : undefined} />)}</span>
),
},
],
data: [{ id: '1', name: 'Alpha', score: 2 }],
onCellChange,
},
{ describeCell: (_row, key) => (key === 'score' ? { stars: 5 } : null) },
);
return { ...t, onCellChange };
}

it('a digit on the selected rating sets that many stars, at most the scale; 0 and Backspace clear', () => {
const t = renderRating();
fireEvent.click(t.cell(0, 1));
fireEvent.keyDown(t.catcher(), { key: '3' });
expect(t.onCellChange).toHaveBeenLastCalledWith(0, 'score', 3, expect.anything());
fireEvent.keyDown(t.catcher(), { key: '9' });
expect(t.onCellChange).toHaveBeenLastCalledWith(0, 'score', 5, expect.anything());
fireEvent.keyDown(t.catcher(), { key: '0' });
expect(t.onCellChange).toHaveBeenLastCalledWith(0, 'score', null, expect.anything());
fireEvent.keyDown(t.catcher(), { key: '4' });
fireEvent.keyDown(t.catcher(), { key: 'Backspace' });
expect(t.onCellChange).toHaveBeenLastCalledWith(0, 'score', null, expect.anything());
expect(t.editorLayer()).toBeNull();
});

it('Enter, F2 and a double-click open no editor on a rating', () => {
const t = renderRating();
fireEvent.click(t.cell(0, 1));
fireEvent.keyDown(t.catcher(), { key: 'Enter' });
fireEvent.keyDown(t.catcher(), { key: 'F2' });
fireEvent.doubleClick(t.cell(0, 1));
expect(t.editorLayer()).toBeNull();
expect(t.onCellChange).not.toHaveBeenCalled();
});

it('the first click on a star only selects; a click on a star of the selected cell sets it', () => {
const t = renderRating();
const star = (n: number) => t.cell(0, 1).querySelector(`[data-rating-star="${n}"]`)!;
fireEvent.click(star(4));
expect(t.cell(0, 1)).toHaveAttribute('data-selected-cell');
expect(t.onCellChange).not.toHaveBeenCalled();
fireEvent.click(star(4));
expect(t.onCellChange).toHaveBeenCalledWith(0, 'score', 4, expect.anything());
});

it('CONTROL: without the stars fact a digit opens the editor as typing does', () => {
const t = renderTable();
fireEvent.click(t.cell(0, 0));
fireEvent.keyDown(t.catcher(), { key: '3' });
expect(t.onCellChange).not.toHaveBeenCalled();
});
});
8 changes: 8 additions & 0 deletions ui/packages/components/src/context/gridCellSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ export interface GridCellFacts {
typing?: 'replace' | 'open';
/** A two-state value: a click on the selected cell, or Space, flips it and commits. */
toggles?: boolean;
/**
* A rating out of this many stars, set in place and never in an editor: on
* the selected cell a digit key sets that many stars (0 clears), a click on
* a star the cell draws (`data-rating-star`) sets it, and Backspace or
* Delete clears it; each commits. A digit sets at most 9, so on a wider
* scale the top values are set by a click.
*/
stars?: number;
/**
* The value pasted text stands for in this cell, or `undefined` when the
* text is not one (Ctrl/Cmd+V on the selected cell then writes nothing).
Expand Down
Loading
Loading