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
18 changes: 18 additions & 0 deletions .changeset/36023-line-grid-cell-panels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@object-ui/fields': patch
---

feat(fields): the line-item grid's select and date cells open their panel under the cell, and Esc in a cell puts its line back as it was when the cell was entered

Clause-②: no
Metadata-protocol: none

In a form's line-item grid (`GridField`, the master-detail lines):

- A **select** cell shows its option label; a click, Enter, Space or a typed letter opens a searchable option list under the cell (the letter becomes the search), and a pick writes the value. Esc closes the list and writes nothing.
- A **date** or **date-time** cell keeps the browser's own control, typed into as before, and opens a calendar under the cell when the cell is entered, with Today, Tomorrow, Next week and Clear. A day picked on a date-time keeps its time of day.
- A **text** cell whose text is longer than the column floats right over its neighbours while it has the focus.
- **Esc** in a cell puts the line back as it was when the cell was entered, and no longer reaches a dialog the form is open in, so the dialog and its other lines stay.
- A stored day that does not exist is named at the top of the calendar and in the cell's tooltip instead of a line under the cell, so the row keeps its height.

Enter still moves to the next line (and adds one on the last line). Nothing a metadata author writes changes.
10 changes: 10 additions & 0 deletions content/docs/frontend/plugins/plugin-form.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ Which fields an edit save sends, and which fields and line-item actions a caller

A select governed by the object's blocking `state_machine` validation offers only the values the server accepts. On an edit form that is the stored value plus its declared next states; on a create form it is the machine's `initialStates`, plus the value the form opens with (a `default: true` option or a caller's pre-fill), which is never dropped. A machine that declares no `initialStates`, or a `warning`, inactive or update-only one, leaves a create form's options as they are. Every form layout, the master-detail header included, applies the same rule.

## Editing in the line-item grid

The child grid of a master-detail form (and of `record:line_items`) is typed into directly: click a cell or Tab to it and type, and Enter moves to the same column of the next line (on the last line it adds one). Choice cells open a panel under the cell, over the table, so the row keeps its height:

- a **select** cell opens a searchable option list on a click, Enter, Space or a typed letter, and a pick writes the value;
- a **date** or **date-time** cell keeps its typed control and shows a calendar under the cell, with Today, Tomorrow, Next week and Clear;
- a **text** cell whose text is longer than the column floats right over its neighbours while you type.

Esc in a cell puts its line back as it was when you entered the cell (a lookup pick's filled-in fields included) and goes no further: a form open in a dialog stays open, with its other lines. Adding, removing, duplicating or moving a line ends that: after it, Esc in a cell takes back only what was changed since you came back to it.

## Field Types

The plugin supports these field types:
Expand Down
25 changes: 25 additions & 0 deletions ui/packages/fields/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,31 @@ or photo per row without opening the row form (objectui#2360). Columns accept
exported as `FileCell`). Auto-derived subform columns map `file`/`image`/
`avatar` fields to file columns instead of dropping them.

### Cell panels in line-item grids

`GridField` stays a typing-first grid: a text, number, currency, time or date
cell is a live input the user types into on arrival, and Enter moves to the
same column of the next line (on the last line it adds one). What opens a panel
opens it under the cell, over the table, and the row keeps its height:

- **Select** — the cell shows the option label. A click, Enter, Space, F2 or
Alt+ArrowDown opens a searchable option list under it; a typed letter opens it
with that letter as the search. A pick writes the value and closes the list;
Esc closes it and writes nothing; Tab moves on to the next cell.
- **Date and date-time** — the browser's own control stays in the cell, typed
into as before, and the calendar opens under the cell when the cell is
entered, with Today, Tomorrow, Next week and Clear. A day writes the value (a
date-time keeps its time of day) and the cell keeps the focus.
- **Text** — while the cell has the focus and its text is longer than the
column, the input floats right over the neighbouring cells instead of
scrolling its text out of sight.
- **Esc in a cell** takes back what this visit to the cell changed (the whole
line returns to what it held when the cell was entered) and stops there: a
form open in a dialog keeps its dialog. A cell whose panel is open hands Esc
to the panel. Adding, removing, duplicating or moving a line ends the visit,
so Esc never writes a removed or shifted line over the one now at that
position.

### Registry-name pickers (`position-ref`, `permission-ref`)

A `text` field that stores the machine name of one registry item declares
Expand Down
Loading
Loading