You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ec24363
Browse filesBrowse the repository at this point in the historyBrowse files
fix(fields): the line grid draws no blank entry row beside Add, and its column headers show each field's help (#35998)
Fixes#35507Fixes#35804
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
在主从表单的明细行表格里,业务用户编辑报价、订单时:以前已有行下面总多一条删不掉的空白行,现在只显示真实的行;每列表头旁多了一个小图标,鼠标悬停或用键盘移上去就显示该字段的填写说明。
- 属于体验改进,替通过明细表格录入的业务用户解决"空白行像坏行"和"填写规则在表格里看不到"这两个问题。
- 出错时最坏是表格里少了空白录入行或说明图标不显示,保存发送的内容不变,可以直接撤回本次改动。
- 无。
## What changes
**#35507: no blank entry row beside "Add line".** `GridField` used to
append an always-present empty "ghost" line under the lines (`hasGhost`
/ `displayRows`), directly above the Add button. It had no copy or
remove action and produced no write. The grid no longer draws it.
- Premise as measured on `origin/main` (`9a8bb83d`): the ghost row and
the Add button were both gated on `allowAdd`, so the ghost was **only
ever drawn where Add was drawn**. Dropping it leaves no grid without a
way to add a line. The "Add not drawn" branch of the order has nothing
to restyle: with `allowAdd: false` there was never a ghost row, and that
stays true (CONTROL pin).
- An empty editable grid now shows the existing
`fields.grid.noItemsAddHint` ("No items yet — click "Add line" to
begin.") with the Add button's real label. No new i18n key.
- Keyboard path kept. On main a keyboard user could Tab or Enter into
the ghost line and type. Now: **Add moves focus into the line it
appends** (Tab reaches Add after the last line), and **Enter in the last
line appends a line and moves to the same column in it** (only when
adding is allowed).
- One narrow state still draws the entry line: a **required grid the
form refused while empty** (`hostFailedEmpty`, objectui#3318). There the
line carries the field's failure to assistive tech on the cells a user
types into. The Add button is an action, not the invalid control.
`widget-aria-invalid-registry-e2e` stays green because this line still
exists.
- Saving is unchanged. An edit emits exactly the lines (CONTROL pin),
and a line added through Add then typed sends the same create the ghost
line did. 23 plugin-form test files read the ghost line as the entry
path. Each one now presses Add first, with the expected lengths and the
batch payloads unchanged.
**#35804: column headers show each field's help.** Each grid column
header now draws an info icon beside its label when the field has help.
The help shows on hover and on keyboard focus (Radix tooltip), and the
icon button's accessible name is the help text. The editable grid and
the read-only table both draw it.
- Help source: a grid column (`InlineGridColumn`) is a strict spec shape
with no help key. No spec key is added. Following the `lookupAutofill` /
`columnCurrencies` pattern, the host that holds the child object's
definition passes the help through a new `GridField` prop, `columnHelp`.
New helper: `columnHelpByField(fields)`. It reads each field through
`fieldHelpText`, the same function the record form's help line uses
(`inlineHelpText`, else `description`), so the header and the form show
the same text.
- The child definition is the one `dataSource.getObjectSchema(child)`
serves, which the record form also reads. The server applies
`objectExtensions.fieldPatches` before serving it and translates the
help into the reader's locale
(`packages/rest/src/meta-object-field-patch-i18n.test.ts` pins both on
the served object). The grid does not re-resolve anything.
- Wired in the three line-grid hosts: `MasterDetailForm`,
`LineItemsPanel` and `RecordBodyTableEditor`.
## Tests
All runs are at head `d4100395`, through `scripts/pm/os-verify-lock.sh`.
- New pins in `GridField.test.tsx` (two top-level describes) and
`MasterDetailForm.test.tsx` (one describe).
- On the base, the 9 non-control pins were red: `9 failed | 59 passed`.
The four CONTROL pins (Add off, edit emit, Enter with Add off, no-help
header) were green on both trees.
- `cd ui && pnpm exec vitest run packages/fields/
packages/plugin-form/`: **Test Files 549 passed | 1 skipped (550), Tests
7402 passed | 8 skipped (7410)**, VERDICT command-exit 0.
- `pnpm --filter @object-ui/fields run type-check` and `pnpm --filter
@object-ui/plugin-form run type-check` both passed after building their
`@object-ui` dependency closure. VERDICT command-exit 0.
<details><summary>Ablations (one per fix, through
scripts/ablation-replace.mjs, restored to the HEAD blob)</summary>
- Ghost row back (`hasGhost` without `hostFailedEmpty`): 4 pins red
(lines-only, empty state, Add focus, Enter append) and 3 controls green.
Restore: blob `1a5224d841fb` == HEAD, `git diff HEAD` empty.
- Header help off (`ColumnHeaderHelp` returns null): 5 pins red
(accessible name, focus tooltip, read-only table, and both
MasterDetailForm host cases). Restore: blob == HEAD, `git diff HEAD`
empty.
</details>
## Browser reading (A4)
This run used the showcase on its own `--fresh` backend (:4371) and the
Console dev server (:5371) built from this branch, in headless Chromium
at 1280×900 with deviceScaleFactor 2. The invoice INV-1010 edit form has
one stored line. For the reading only, two fixtures were added and then
reverted (neither is in this PR): a declared `inlineHelpText` on
`showcase_invoice_line.quantity`, and an object extension whose
`fieldPatches` set `unit_price.inlineHelpText` to 「内销填含税价,出口填不含税的 FOB
美元价」.
- tbody rows: 1, the stored line only. The row above Add line is "1 ·
Widget B · … · $230.00", with no blank trailing row.
- Help icons: `Qty *` is named "Whole units; bill partial hours as
decimals." (declared), and `Unit Price` is named 「内销填含税价,出口填不含税的 FOB
美元价」 (fieldPatches). Other headers have no icon.
- Hovering the Unit Price icon shows a tooltip with the patched text.
Keyboard focus on the Qty icon shows a tooltip with the declared text,
and `activeElement`'s accessible name is that help.
- Clicking Add line leaves the focus on `data-cell="1-1"` (Description)
of the new line. The first column is a lookup with no text cell.
- Screenshots (seat share): `a4-35507/1-edit-form-no-trailing-row.png`,
`2-grid-no-trailing-row.png`,
`3-hover-help-fieldPatches-unit-price.png`,
`4-focus-help-declared-qty.png`, `5-after-add-focus-in-new-line.png`.
## Acceptance notes
- File surface: the claim names `GridField.tsx`, its tests, i18n keys
and a changeset. This PR also touches `ui/packages/fields/src/index.tsx`
(one export line), the three host files (`MasterDetailForm.tsx`,
`LineItemsPanel.tsx`, `RecordBodyTableEditor.tsx`, which pass
`columnHelp`), and 23 plugin-form test files that typed into the removed
ghost line. These include `discardGuard.test.tsx` and
`__tests__/modalMaximize-34604.test.tsx`, which exercise ModalForm;
`ModalForm.tsx` itself is untouched. The order's direction for #35804
(find the resolved source the form uses) cannot be met from
`GridField.tsx` alone, because the grid holds no field definition.
- Reach of the help: a master-detail entry whose `relationshipField` and
every column `type` are authored loads no child schema (an existing
short-circuit in `MasterDetailForm`), so its headers show no help, just
as it gets no `lookupAutofill`. The console's own path (`inlineColumns`
names, hydrated from the child schema) loads it, and the showcase
reading above went through that path.
## Verification
Read first, by risk:
1. `ui/packages/fields/src/widgets/GridField.tsx`: the `hasGhost` /
`hostFailedEmpty` hunk and `pendingFocus` / `addRow` / `onCellKeyDown`.
2. `ui/packages/plugin-form/src/MasterDetailForm.tsx`: `columnHelp` at
both resolve sites and on the grid.
3. `ui/packages/fields/src/widgets/GridField.test.tsx`: the two new
top-level describes.
Two-minute check: `cd ui && pnpm exec vitest run
packages/fields/src/widgets/GridField.test.tsx -t
"objectstack#35(507|804)"` should print 12 passed (the new pins).
<details><summary>Local gates (derived by dispatch-gates --commands, 40
commands, all EXIT=0 at d410039)</summary>
check-adr-0087-registration (+self-test), check-changeset-no-major,
check-closing-keyword-parity (+self-test), check-comment-mask-corpus,
check-empty-changeset (+self-test), check-sdui-manifest (+self-test),
snapshot-next self-test, check-governed-queue-guard self-test,
release-rehearsal-clone self-test, release-pending-publish self-test,
`pnpm --dir ui exec vitest run scripts/`, spec check:duration-unit-keys,
spec check:error-code-provenance, check:adr-anchors,
check:changeset-gate-self-tests, check:closed-ceremony-text,
check:cross-package-test-inputs, check:dispatcher-error-vocabulary,
check:driver-memory-census, check:engine-double-contract,
check:error-status-conformance, check:gitlink-declared, check:nul-bytes,
check:published-files, check:query-options-erasure,
check:refd-timer-probe, check:registry-log-declared,
check:rest-log-spy-declared, check:skill-identifier-liveness,
check:test-source-alias, check:tier-file-adoption,
check:type-check-coverage, check:type-check-debt,
check:undeclared-dep-imports, check:watch-hint-literal,
check:where-matcher. Lint and the whole-workspace type-check lanes are
left to CI.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CZrgaiMgTJCnswR6jQ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(fields): the inline line grid draws no blank entry row beside "Add line", and each column header shows its field's help
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
The inline line grid of a master-detail form always drew an empty line under the lines, directly above the "Add line" button. It had no copy or remove action and was never saved, so users read it as a broken line they could not delete. The grid no longer draws it: a grid with lines shows exactly its lines, and an empty grid says "No items yet — click "Add line" to begin." The keyboard path that line carried stays: "Add line" moves focus into the line it adds, and Enter in the last line adds a line and moves to the same column in it. An empty required grid that the form refused still draws one entry line, so the field's failure stays on the cells a user types into.
12
+
13
+
Each column header now shows its field's help as an info icon beside the label. The help appears on hover and on keyboard focus, and it is the icon's accessible name. The text is what the record form shows under the same field: `inlineHelpText`, else `description`, from the child object's definition as the server serves it, so help written by another package's `objectExtensions.fieldPatches` and the reader's language both apply. `GridField` takes the texts as a new `columnHelp` prop, and `columnHelpByField` builds them from a child object's fields. The master-detail form, the line-items panel and the record-body table editor pass them.
14
+
15
+
What does not change: what a save sends, the `allowAdd` / `allowDelete` / `maxRows` behaviour, and every metadata key, value and default. A master-detail entry whose relationship and every column type are authored loads no child schema, so its headers show no help, as it has no lookup autofill.
0 commit comments