Skip to content

Commit 42e4096

Browse files
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 page: empty fields read 设置分配给 and 设置转化商机](https://github.com/objectstack-ai/objectstack/blob/c515f32858fa6e08e209d0c3fbf913bfd3ab8c3f/evidence/36292/full-empty-set.png?raw=true) Full record page, after one click on 「设置转化商机」 (the inline edit session opens): ![Full page: edit after one click](https://github.com/objectstack-ai/objectstack/blob/c515f32858fa6e08e209d0c3fbf913bfd3ab8c3f/evidence/36292/full-edit-after-click.png?raw=true) Side preview, the same two placeholders: ![Side preview: empty fields read 设置分配给 and 设置转化商机](https://github.com/objectstack-ai/objectstack/blob/c515f32858fa6e08e209d0c3fbf913bfd3ab8c3f/evidence/36292/preview-empty-set.png?raw=true) Side preview, after one click on 「设置转化商机」: ![Side preview: edit after one click](https://github.com/objectstack-ai/objectstack/blob/c515f32858fa6e08e209d0c3fbf913bfd3ab8c3f/evidence/36292/preview-edit-after-click.png?raw=true) - 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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(console): on the record page's field list an empty field you can edit reads 「设置{字段名}」 and one click fills it in; an editable value offers the copy icon too
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
The synthesized record page's field area (the side preview, the phone's 「详情」 tab, the wide page's pinned left column and a full page alone):
12+
13+
- **Empty editable fields read 「设置」 plus their label.** An empty value the reader can edit is drawn as light text, 「设置」 plus the field's label (`Set Phone` in English), and a single click on it opens the field's editor, as a click on any editable value already does. A read-only field, a field the caller may not write and a record that is not inline-editable keep the shared 「—」 placeholder. Empty fields still fold into the list's one 「显示 N 个空字段」 row; shown, they read 「设置…」 instead of 「—」.
14+
- **An editable value can be copied without editing.** Its copy icon is drawn on hover or keyboard focus at the value's right, as a read-only value's is; it copies the value and does not enter edit. A touch screen draws none, as before for read-only values. The keyboard's way into edit (the pencil, drawn on focus only) is unchanged.
15+
- Authored record pages and every other DetailView keep their faces: an empty field there reads 「—」 and an editable row keeps its double-click and pencil.
16+
17+
`@object-ui/i18n` widens: one new key in every pack, `detail.setField` (`Set {{field}}` / `设置{{field}}`).

‎ui/packages/i18n/src/locales/ar.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,7 @@ const ar = {
14411441
updatedTime: "تاريخ التعديل",
14421442
recordNumber: "معرّف السجل",
14431443
clickToEdit: "انقر للتحرير",
1444+
setField: "تعيين {{field}}",
14441445
back: "رجوع",
14451446
edit: "تحرير",
14461447
editInline: "تحرير",

‎ui/packages/i18n/src/locales/de.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,7 @@ const de = {
16591659
updatedTime: "Geändert am",
16601660
recordNumber: "Datensatz-ID",
16611661
clickToEdit: "Zum Bearbeiten klicken",
1662+
setField: "{{field}} festlegen",
16621663
// objectui#3863 — base key. de's categories are exactly `one`/`other`, so this
16631664
// slot is unreachable here and equals `_other` for key-set parity.
16641665
showEmptyRelated: "+ {{count}} leer",

‎ui/packages/i18n/src/locales/en.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,7 @@ const en = {
19061906
updatedTime: 'Updated on',
19071907
recordNumber: 'Record ID',
19081908
clickToEdit: 'Click to edit',
1909+
setField: 'Set {{field}}',
19091910
// Attachments
19101911
dropFilesToUpload: 'Drop files here or click to upload',
19111912
attachmentCount: '{{count}} attachment',

‎ui/packages/i18n/src/locales/es.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,7 @@ const es = {
17131713
updatedTime: "Fecha de modificación",
17141714
recordNumber: "ID del registro",
17151715
clickToEdit: "Haga clic para editar",
1716+
setField: "Establecer {{field}}",
17161717
// objectui#3863 — base key, answering only a call made without a count. es's
17171718
// `many` (exact millions) has its own slot since objectui#11432; it repeats
17181719
// `_other` here because the count governs no noun complement.

‎ui/packages/i18n/src/locales/fr.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,7 @@ const fr = {
13361336
updatedTime: "Modifié le",
13371337
recordNumber: "ID de l’enregistrement",
13381338
clickToEdit: "Cliquez pour modifier",
1339+
setField: "Définir {{field}}",
13391340
back: "Retour",
13401341
edit: "Modifier",
13411342
editInline: "Modifier",

‎ui/packages/i18n/src/locales/ja.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,7 @@ const ja = {
16591659
updatedTime: "更新日時",
16601660
recordNumber: "レコード ID",
16611661
clickToEdit: "クリックで編集",
1662+
setField: "{{field}}を設定",
16621663
// objectui#3863 — base key. ja has a single plural category (`other`), so this
16631664
// slot is unreachable here and equals `_other` for key-set parity.
16641665
showEmptyRelated: "+ {{count}} 件(空)",

‎ui/packages/i18n/src/locales/ko.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,7 @@ const ko = {
16591659
updatedTime: "수정 일시",
16601660
recordNumber: "레코드 ID",
16611661
clickToEdit: "클릭하여 편집",
1662+
setField: "{{field}} 설정",
16621663
// objectui#3863 — base key. ko has a single plural category (`other`), so this
16631664
// slot is unreachable here and equals `_other` for key-set parity.
16641665
showEmptyRelated: "+ {{count}}개 비어 있음",

‎ui/packages/i18n/src/locales/pt-BR.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,7 @@ const pt = {
13361336
updatedTime: "Atualizado em",
13371337
recordNumber: "ID do registro",
13381338
clickToEdit: "Clique para editar",
1339+
setField: "Definir {{field}}",
13391340
back: "Voltar",
13401341
edit: "Editar",
13411342
editInline: "Editar",

‎ui/packages/i18n/src/locales/ru.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,6 +1374,7 @@ const ru = {
13741374
updatedTime: "Дата изменения",
13751375
recordNumber: "ID записи",
13761376
clickToEdit: "Нажмите, чтобы изменить",
1377+
setField: "Указать «{{field}}»",
13771378
back: "Назад",
13781379
edit: "Редактировать",
13791380
editInline: "Редактировать",

0 commit comments

Comments
 (0)