Repository navigation
Commit 42e4096
feat(record-page): an empty field you can edit reads 「设置{字段名}」 and one click fills it; an editable value offers the copy icon (#36385)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
Fixes #36292
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbVF7sWPNE4HmjkgyaVxQYif)_
repo:objectstack#7 · zhuangjianguo · session_01QsR2jRaJbQ4vqdv4J5peqA
Part of epic #35590 (record page redo). Claim 7075947584 (`Premise:
corrected`); binding linked ruling: #36147 record 7066516044 (option A),
shipped by #36234.
Clause-②: yes (widening)
Metadata-protocol: none
The claim's line reads `Clause-②: no (expected …)` with the instruction
to amend it to `yes (widening)` if a key is added: one key is added,
`detail.setField`, in every `@object-ui/i18n` pack. No prop, export or
schema key is removed or narrowed.
## 维护者速读
-
记录页字段区(右侧预览、手机「详情」、整页)里可以编辑的空字段,从「—」变成浅色的「设置某某」,点一下直接进编辑;可编辑的值鼠标移上去右边也有复制图标。
- 属于记录页重做专题,按维护者「立」的第 4 条(单击进编辑、空字段可点)补齐还没做的部分。
- 出错时最多是空字段显示的字或复制图标位置不对,不影响保存的数据;撤回这个改动即可恢复原样。
- 无
## What changes
Measured on `origin/main` b3bcfef before writing anything (the card's
items, one by one, on the synthesized record page's field area, which is
`DetailSection`'s frameless face in all of the side preview, the phone
「详情」 tab, the pinned left column and a full page alone):
| Card item | On main before this PR | This PR |
|:---|:---|:---|
| 1. Single click enters edit | **Already shipped** by #36234: the row's
`onClick` on the frameless face calls `onEnterInlineEdit` (guarded by
`clickBelongsElsewhere`) | unchanged |
| 2a. Links, phone, email, chips: a click on the text opens it, the rest
of the value edits | **Already shipped** by #36234:
`clickBelongsElsewhere` hands a click on an `a`, a button or a
`role=link` to that element | unchanged |
| 2b. Hover copy icon on any value | **Half**: read-only values only.
The button block was `canInlineEditField ? pencil : copyOffered ? copy :
null`, so an editable value had no copy icon | an editable value on the
frameless face also draws the copy button (hover / keyboard focus,
`pointer-coarse:hidden` per ruling item 1); the keyboard-only pencil
stays beside it |
| 3. Empty editable value reads 「设置某某」, one click edits | **Missing**:
every empty value drew the shared `EmptyValue` dash | an empty value
with `canInlineEditField` on the frameless face reads
`t('detail.setField', { field })` in `text-muted-foreground/70`; the
row's existing click enters edit. Read-only, no write grant, record not
inline-editable: the dash, unchanged |
| 4. "Show N empty fields" fold unchanged; shown, empty rows read 「设置某某」
| fold **already shipped** by #36234 (`EmptyFieldsRow`) | shown rows now
read the placeholder |
| 5. Full page, side preview, phone alike | the three places are the one
frameless face (`DefaultRecordPageContext`) | follows from the one face
|
- **Authored record pages** (and every other `DetailView`) keep their
faces, as #36234 left them: double-click and the pencil, and the dash on
an empty value. A "set" placeholder there would invite a single click
that does nothing. Raised as an open question in the report, not built.
- i18n: `detail.setField` in all eleven packs (en `Set {{field}}`,
zh-Hans `设置{{field}}`, zh-Hant `設定{{field}}`, ja `{{field}}を設定`, ko
`{{field}} 설정`, de `{{field}} festlegen`, fr `Définir {{field}}`, es
`Establecer {{field}}`, pt-BR `Definir {{field}}`, ru `Указать
«{{field}}»`, ar `تعيين {{field}}`).
- Changeset `.changeset/36292-record-field-set-placeholder.md`
(`@object-ui/plugin-detail`, `@object-ui/i18n`: patch).
Files to read first, by risk:
1. `ui/packages/plugin-detail/src/DetailSection.tsx`, the `displayValue`
closure's new first branch (`isEmpty && frameless &&
canInlineEditField`), where the placeholder replaces the dash.
2. Same file, the button block at the end of the read row: the pencil
and the copy button are now siblings, the copy one gated `copyOffered &&
(!canInlineEditField || frameless)`.
3.
`ui/packages/plugin-detail/src/__tests__/DetailSection.fieldList-36147.test.tsx`,
the two new top-level `describe` blocks.
## Tests
New pins in the existing field-list harness (two top-level `describe`s,
objectstack#36292):
- an empty editable value reads `Set Note` / `Set Phone` and a click on
it enters edit with `note`;
- CONTROL: a non-empty value reads as before;
- CONTROL: a read-only field keeps the `No value` placeholder and its
click does not enter edit;
- CONTROL: a record that is not inline-editable keeps the placeholder on
every empty row;
- CONTROL: a field the caller may not write (a real
`MePermissionsProvider` envelope, `editable: false`) keeps the
placeholder;
- CONTROL: off the field face (the section's own empty-fields toggle
opened, so the row is on screen) the placeholder is the dash;
- through a real `I18nProvider` in `zh-CN` the placeholder reads `设置备注`;
- the copy button sits beside an editable value, hidden at rest,
revealed on hover / focus, `pointer-coarse:hidden`, copies `Atlas deal`
and does not enter edit; CONTROL: an empty editable value has none;
CONTROL: off the field face an editable row keeps the pencil alone.
<details><summary>Local runs</summary>
All under `scripts/pm/os-verify-lock.sh`, vitest from `ui/` with
`--maxWorkers=1`:
- `vitest run
packages/plugin-detail/src/__tests__/DetailSection.fieldList-36147.test.tsx`:
`Tests 25 passed (25)`, VERDICT command-exit 0.
- `vitest run packages/plugin-detail/ packages/i18n/` (head `7b0e4d41`;
the one later commit `2c35661f` edits only the changeset): `Test Files
514 passed | 1 skipped (515)`, `Tests 5790 passed | 31 skipped (5821)`,
VERDICT command-exit 0.
- `pnpm --filter @object-ui/plugin-detail --filter @object-ui/i18n run
type-check` (both `tsc --noEmit` and `tsc -p tsconfig.test.json`):
VERDICT command-exit 0.
</details>
<details><summary>Ablations (one per changed behaviour, through
scripts/ablation-replace.mjs)</summary>
Both ran on head `2c35661f` inside one hold of the shared lock; each leg
is the pin file above, the restore proven by the tool (blob
`932402dfeeb2` == HEAD, `git diff HEAD` empty).
1. Placeholder branch disabled (`if (isEmpty && frameless &&
canInlineEditField) {` to `if (false && isEmpty && frameless &&
canInlineEditField) {`; mutation landed, anchor 1 to 0, blob
`932402dfeeb2` to `dfd20d6b8e8c`): `Tests 4 failed | 21 passed (25)` —
the "Set Note" pin, the read-only and no-write-grant controls (each also
asserts the remaining `Set Phone`) and the zh-CN pin. Restored.
2. Copy button narrowed back to read-only rows (`{copyOffered &&
(!canInlineEditField || frameless) && (` to `{copyOffered &&
!canInlineEditField && (`; blob `932402dfeeb2` to `d71eb76d821d`):
`Tests 1 failed | 24 passed (25)` — the editable-value copy pin.
Restored.
Unmutated, the same pin file: `Tests 25 passed (25)` (the local run
above).
</details>
<details><summary>Derived gate families (dispatch-gates --commands,
41)</summary>
All 41 families `node scripts/pm/dispatch-gates.mjs --commands` derives
for this diff ran locally on head `7b0e4d41`, every one exit 0 (`pnpm
check:type-check-debt` first answered exit 3, PREREQUISITE NOT MET
because its closure build never got a lock turn; re-run under the lock:
`TCDEBT_EXIT=0`, re-measure OK; `pnpm --dir ui exec vitest run
scripts/`: `Tests 5127 passed | 2 skipped`). `--ran` reconciliation: `41
derived famil(ies) accounted for — 41 run, 0 NOT-MEASURED (a DERIVED
zero — all 41 recorded an exit code and none of them is 3)`. On the
final head `2c35661f` (changeset-only commit) the changeset families
were re-run, exit 0 each: `check-adr-0087-registration`,
`check-changeset-no-major`, `check-empty-changeset`, `check:nul-bytes`,
`check:published-files`. The required CI contexts (`Test UI`, `Type
Check UI`, `Lint UI`, `Lint & Repo Gates`, …) are CI's, not re-run here.
</details>
## Acceptance notes
- Screenshots the card asks for, taken on head `2c35661f` in a live CRM
example app (`examples/app-crm`, `objectstack dev --fresh`) with the
Console dev server built from that head; Chromium 1440x900 at
deviceScaleFactor 2, UI language zh-CN, the lead "Marie Curie" after 「显示
2 个空字段」. Hosted on the side branch `claude/issue-36292-evidence` (never
merged), not on this branch. No read-only empty field is cheaply
reachable on this record (every empty body field is editable for the
admin), so the 「—」 control rests on the jsdom pins above.
Full record page, empty editable fields read 「设置分配给」 / 「设置转化商机」:

Full record page, after one click on 「设置转化商机」 (the inline edit session
opens):

Side preview, the same two placeholders:

Side preview, after one click on 「设置转化商机」:

- Not re-verified in a browser: Enter / click-away saves and Esc
cancels; those are the existing inline-edit session's keys, untouched
here.
- The card's 没有核对的 items (approval-locked records; tap-vs-scroll on a
phone) are unchanged by this PR: a locked record is not inline-editable,
so its empty fields keep the dash.
## Verification
Two minutes: on a default record page (HotCRM 线索, or any object without
an authored record page) open the side preview, click 「显示 N 个空字段」.
Expected: each empty field you can edit reads light 「设置字段名」; one click
opens its editor. A read-only empty field still reads 「—」. Hover a
filled editable value: a copy icon appears at its right, and clicking it
copies without entering edit.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jRaJbQ4vqdv4J5peqA)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jRaJbQ4vqdv4J5peqA
<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jRaJbQ4vqdv4J5peqA -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent 647eb92 commit 42e4096
14 files changed
Lines changed: 204 additions & 7 deletions
File tree
- .changeset
- ui/packages
- i18n/src/locales
- plugin-detail/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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1441 | 1441 | | |
1442 | 1442 | | |
1443 | 1443 | | |
| 1444 | + | |
1444 | 1445 | | |
1445 | 1446 | | |
1446 | 1447 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1659 | 1659 | | |
1660 | 1660 | | |
1661 | 1661 | | |
| 1662 | + | |
1662 | 1663 | | |
1663 | 1664 | | |
1664 | 1665 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1906 | 1906 | | |
1907 | 1907 | | |
1908 | 1908 | | |
| 1909 | + | |
1909 | 1910 | | |
1910 | 1911 | | |
1911 | 1912 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1713 | 1713 | | |
1714 | 1714 | | |
1715 | 1715 | | |
| 1716 | + | |
1716 | 1717 | | |
1717 | 1718 | | |
1718 | 1719 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1336 | 1336 | | |
1337 | 1337 | | |
1338 | 1338 | | |
| 1339 | + | |
1339 | 1340 | | |
1340 | 1341 | | |
1341 | 1342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1659 | 1659 | | |
1660 | 1660 | | |
1661 | 1661 | | |
| 1662 | + | |
1662 | 1663 | | |
1663 | 1664 | | |
1664 | 1665 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1659 | 1659 | | |
1660 | 1660 | | |
1661 | 1661 | | |
| 1662 | + | |
1662 | 1663 | | |
1663 | 1664 | | |
1664 | 1665 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1336 | 1336 | | |
1337 | 1337 | | |
1338 | 1338 | | |
| 1339 | + | |
1339 | 1340 | | |
1340 | 1341 | | |
1341 | 1342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1374 | 1374 | | |
1375 | 1375 | | |
1376 | 1376 | | |
| 1377 | + | |
1377 | 1378 | | |
1378 | 1379 | | |
1379 | 1380 | | |
| |||
0 commit comments