Repository navigation
Commit 6db1dc2
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_
Fixes #36043
repo:objectstack#7 · zhuangjianguo · session_01QsR2jTbWpneBrqq7SJvrNt
Clause-②: yes (widening)
Metadata-protocol: semantic
Skills-docs: none — no skill names the inline grid column `type` values
or keys (`git grep` of `skills/` for `inlineColumns` and the column type
list: one passing mention in `objectstack-data/rules/relationships.md`,
which lists no types)
## 维护者速读
-
表单里的明细表(主从表单的行项目表格)中,人员格子可以直接搜索选人,多选格子可以选多个选项,标签格子可以加标签,勾选格子是复选框,评分格子是星星;以前这些都是普通文本框,人员要手填用户编号,多选只能填一个值。
- 属于列表页重做专题的单元格编辑那一组,替在主从表单里录入明细行的用户解决「人员、多选填不进去」的问题。
-
已有表单的明细表会直接变样:布尔字段从「是/否」下拉变成复选框,评分字段从数字框变成星星;作者在列上明确写了类型的不受影响;出错时最坏是这几类格子不好用,已存的数据不受影响,可直接撤回。
- 无
## What changes
The card's words map onto the enum by the spec's existing rule that
every column type is spelled as its namesake field type (the
`inline-grid-column-carriers` probe and the `field.json` liveness note
rely on it): people = `user`, multi-select = `multiselect`, tags =
`tags`, check = `boolean`, rating = `rating`.
**Spec (`packages/spec/src/data/field.zod.ts`).**
`InlineGridColumnSchema.type` gains `user`, `multiselect`, `tags`,
`boolean` and `rating` (nine → fourteen). The column gains one optional
key, `max`: the star count of a `rating` cell (default 5), because a
column carries no field definition and a `max: 10` rating would
otherwise draw five stars. `options` and `multiple` describe what the
new cells read from them. `inline-grid-columns.ts`
(`deriveInlineGridColumns`' cell-type mirror) maps the same way, and
each new cell type keeps the fill priority its field types had before,
so which derived columns are visible by default does not change (the
existing budget pins stay green unchanged). Liveness ledger: the `type`
note lists fourteen types, and a `max` child row. Regenerated: reference
docs, `authorable-surface/data.json` (one new key), liveness state
counts.
**Derivation (`ui/packages/plugin-form/src/deriveMasterDetail.ts`).**
`fieldTypeToColumnType` maps `user` → `user`, `multiselect` /
`checkboxes` → `multiselect`, `tags` → `tags`, `boolean` / `toggle` →
`boolean`, `rating` → `rating`. A derived or hydrated column carries
`multiple` from a multi-person field, `max` from a rating field, and the
child's options on `multiselect` columns. A `tags` column takes no
options: its cell holds free-form tags and reads no option list. A
`boolean` column keeps the two options it carried as a select (`'true'`
/ `'false'`, labelled with the session's words through `booleanLabel`):
they are the words its read-only and list-mode cells read as, so
`booleanLabel` stays live. A column that declares its `type` is left
alone, as before.
**Cells
(`ui/packages/fields/src/widgets/grid-field/GridFieldWidget.tsx`,
`gridCellPanels.tsx`).** The cells reuse the main list's in-cell faces
rather than forking them:
- `GridPanelCell` (new, beside S5's `GridSelectCell`) is a panel shell
under the cell that hosts a widget's own `inCell` face over a draft: a
click outside or Tab writes the draft, Esc writes nothing, and a face
that ends on one pick calls `commit`. The cell keeps drawing its value
while the panel is open.
- `multiselect` hosts `MultiSelectField inCell`, `tags` hosts `TagsField
inCell`, and `user` hosts `UserField inCell` (the main list's person
picker: searchable list, recents, Clear; a single pick writes and
closes).
- `boolean` is the `Checkbox` primitive (click / Space), writing `true`
/ `false`.
- `rating` draws `RatingField inCell` (a click on a star sets it); a
digit key on the cell sets that many stars, 0 clears, a digit above
`max` does nothing.
- Read-only table and list mode: people by name (`UserField readonly`),
a rating as its stars, a multi-select's option labels, a check cell as
its option word (else the session's yes/no word).
- A required cell holding an empty list (multi-select, tags, several
people) reads invalid, as an empty scalar does.
- A multi-select, tags or several-people cell that is emptied writes
`null`, not `[]`: the save path counts only `null` / `''` as blank
(`isBlankRow`), and a cleared multi-value field stores `null` elsewhere
too. An emptied cell reads `—`.
Item 2 of the card (interim read-only columns) is not built: the seat
reads it as superseded once item 1 ships, and this PR ships item 1.
**Visible change on existing master-detail forms** (named in the
changeset): a derived `boolean` / `toggle` column is a checkbox instead
of the yes/no select and writes booleans instead of the strings `'true'`
/ `'false'` (the server's write normalisation reads both the same); a
derived `rating` column is stars instead of a number box; `user`,
`multiselect`, `checkboxes` and `tags` columns are no longer plain text
boxes.
## Tests
- `ui/packages/fields/src/widgets/GridField.test.tsx`, new top-level
`describe` "the cells that edit as in the main list": multi-select
(labels, several picks staged then written on leaving, Esc writes
nothing, empty list reads invalid when required), tags (a new tag added
from the list, Tab writes and moves to the next cell), check (checkbox
over `true` and `'false'`, click writes a boolean, read-only reads the
option word), rating (five stars by default, a click sets, digit keys
set and 0 clears, a digit above the stars sets nothing, `max: 10` draws
ten), people (the person picker opens under the cell; its Clear writes
and closes). An emptied multi-select and an emptied tags cell each write
`null` (both pins go red with the fix taken out), and the emptied tags
cell reads `—`.
- `ui/packages/plugin-form/src/deriveMasterDetail.test.ts`: the five
mappings with their neighbours as controls; a new `describe` pinning the
extras on both the derive and the hydrate path (`multiple`, options on a
multi-select and none on a tags column, the check column's two words,
`max` from the field and none when the field declares none), and that an
authored column, a `type: 'select'` over a boolean field included, keeps
its type and extras.
- `deriveMasterDetail.booleanOptions-12924.test.tsx`: the derived
boolean column is now `type: 'boolean'` with the same two
session-language options; the editable grid pins read checkbox states
instead of picker text; the language-switch pin now re-labels the
read-only table (the editable check cell shows no word).
- `MasterDetailForm.lateCatalogue-12924.test.tsx`: the late-catalogue
re-label is read where the grid still draws a boolean's word, a second
detail in `inlineMode: 'form'`; the editable `Lines` detail keeps the
unsaved edit and its checkboxes through the catalogue landing.
- `deriveMasterDetail.inlineGridColumns-11345.test.ts`: the "output
unchanged" corpus moves its one derived boolean column (`gift`) from
`select` to `boolean`, marked where it sits; nothing else in the corpus
moves.
## Deviations
Four files outside the claim's surface, each a direct consequence of the
widening. Seat 7 counts them inside the card.
- `packages/metadata-core/src/object-schema-fls-references.ts`:
`INLINE_COLUMN_POSITIONS` classifies the new `max` key as `keep` (a
number, never a field name). `object-schema-fls-references.test.ts`
refuses an unclassified `InlineGridColumnSchema` key, so it was red in
Test Core 3/10 at `10767ef3`.
- `ui/packages/types/src/__tests__/strict-face-read-keys-11070.test.ts`:
the refused-column-type row used `boolean`, which is now a cell type, so
it moves to `toggle`, which is still refused. It was red in Test UI
12/16 at `10767ef3`.
- `ui/packages/types/src/form.ts`: a docblock no longer counts "nine"
cell controls.
- `content/docs/data-modeling/field-types.mdx`: the inline grid bullets
list the fourteen cell types and the checkbox booleans, and add the
people, multi-select, tags and rating cells.
The changeset adds `'@objectstack/metadata-core': patch` and
`'@object-ui/types': patch` for the first two packages.
## Acceptance notes
- A click outside a multi-select / tags / people panel writes through
the popover's own dismiss (`onOpenChange`). The jsdom pins leave the
panel through Tab, because that harness's pointer events do not reach
the dismiss. The click outside is measured live below.
## Live click-through
Showcase app (`objectstack dev --seed-admin`, fresh database) plus the
Console from source (Vite), Chromium through Playwright. To host the
three cells, the run added, without committing, `inlineEdit: 'grid'` and
`inlineColumns` (`name`, `f_multiselect`, `f_tags`, `f_users`) to
`showcase_field_zoo.f_master_detail`, and a `fieldGroups` entry placing
that child on `showcase_project`. The edits were reverted afterwards.
Project "Website Relaunch", Edit, row 0 of the zoo grid. "Outside" is a
click on the dialog's "Edit Project" heading.
| Step | Multi-select | Tags | People (multiple) |
| --- | --- | --- | --- |
| Stored before | `["red","green"]` | `["alpha","beta"]` | `null` |
| Pick | Blue | type `gamma`, Enter | Dev Admin |
| Panels open after the click outside | 0 | 0 | 0 |
| Cell after the click outside | Red, Green, Blue | alpha, beta, gamma |
Dev Admin |
| Stored after Update | `["red","green","blue"]` |
`["alpha","beta","gamma"]` | `["<Dev Admin's user id>"]` |
| Cell after a page reload and Edit again | Red, Green, Blue | alpha,
beta, gamma | Dev Admin |
| Emptied, click outside, Update: cell / stored | — / `null` | — /
`null` | not run |
The run found one defect, fixed in `2197dbdd`: an emptied tags cell drew
nothing instead of `—`. The display helper now reads an empty list as
empty for every type. It is pinned in `GridField.test.tsx`, and the
final row above was read with the fix served.
- `rating` cells keep `RatingField`'s one button per star, so Tab visits
each star; the arrows and digit keys work from any of them.
## Verification
Final head `6185caed`. It adds three commits to `f73a4351`:
- `6e74cfe0`: the review rework. Metadata-protocol is `semantic`; a
`tags` column takes no options; an emptied multi-value cell writes
`null`; the stale "twenty keys" and liveness prose is fixed.
- `2197dbdd`: the emptied tags cell reads `—`, found by the live run.
- A merge of `origin/main` at `07b17542` (#36523, #36478, #36522,
#36514, #36508), and `6185caed`, which regenerates
`content/docs/references/ui/component.mdx` from the merged tree. The
merge had taken that page's `mobileMaxVisible` line from one side.
Checks at the final head:
- `dispatch-gates --ran` at `6185caed`: 120 derived families accounted
for, 120 run, 0 NOT MEASURED, every one exit 0. That includes
`check:generated` and `check:liveness` after a spec rebuild, and `pnpm
--dir ui exec vitest run scripts/` run alone under the verify lock.
- `ui/packages/fields/` + `ui/packages/plugin-form/` (whole packages) at
`6185caed`: 567 files, 7,629 tests passed, 8 skipped.
- The new pins were ablated: both "emptied, it writes null" pins and the
tags `—` pin go red with their fix taken out.
- `overlap-check` at `6185caed`, verdict read before the push. It merges
cleanly with `origin/main` `a10987ae` and with 6 of 7 open PR heads.
#36543 conflicts only in `packages/spec/liveness/state-counts/field.md`,
a generated count: whichever lands second regenerates it with
`gen:liveness-counts`, not a hand merge.
- Earlier heads: at `10767ef3`, `pnpm --filter @objectstack/spec test`
(871 files, 27,909 tests) and `test:repo` (92 files, 1,562 tests)
passed. CI was green at `f73a4351`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jTbWpneBrqq7SJvrNt)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jTbWpneBrqq7SJvrNt
<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jTbWpneBrqq7SJvrNt -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent f3a8a13 commit 6db1dc2
26 files changed
Lines changed: 834 additions & 102 deletions
File tree
- .changeset
- content/docs
- data-modeling
- references
- data
- system
- ui
- packages
- metadata-core/src
- spec
- authorable-surface
- liveness
- state-counts
- src
- data
- system
- ui
- ui/packages
- fields/src/widgets
- grid-field
- plugin-form/src
- types/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
606 | 607 | | |
607 | 608 | | |
608 | 609 | | |
609 | 610 | | |
610 | | - | |
611 | | - | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
612 | 618 | | |
613 | 619 | | |
614 | 620 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
| 233 | + | |
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
| |||
417 | 418 | | |
418 | 419 | | |
419 | 420 | | |
420 | | - | |
| 421 | + | |
421 | 422 | | |
422 | 423 | | |
423 | | - | |
| 424 | + | |
424 | 425 | | |
425 | 426 | | |
426 | 427 | | |
427 | 428 | | |
428 | 429 | | |
429 | | - | |
| 430 | + | |
| 431 | + | |
430 | 432 | | |
431 | 433 | | |
432 | 434 | | |
| |||
0 commit comments