Repository navigation
Commit 13d1e95
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuYSfiVTtk3DgbcGUxvr9M3o)_
repo:objectstack#1 · os-sales · session_01L6bhgTBQ7DZYZt5GQadGKZ
Part of #36023 (slice S4: pop-up panels under the cell and the keyboard
rules. The card stays open: the rich-text panel, the related-list tab
and the long-text / address placement are recorded on #36023 by the
seat, which closes the card when they are delivered or moved)
Clause-②: yes (widening) — `GridCellFacts` (`@object-ui/components`,
`dist/context/gridCellSelection.d.ts`) gains three optional keys:
`editor`, `clearRefusal`, `validate`. Nothing is removed or narrowed; a
host that sets none of them keeps its editor placement and commits.
Metadata-protocol: none
## 维护者速读
-
**选择型格子的面板开在格子下方**:单选、多选、状态、标签、日期、日期时间、时间、颜色、关联、人员,按回车或双击后,列表/日历/色板出现在格子正下方,格子本身照常显示原值(彩色标签还是彩色的),整行高度不变(实测
33 → 33)。日期的可输入框移到面板顶部,日历就在它下面。长文本、地址、普通输入框仍在原格编辑。
- **退格 / Delete 直接清空并立即保存**。必填字段不清空,格子上提示「××为必填」;只读格照旧说明原因;复选框格不受影响。
-
**不合规的值不保存**:规则和记录表单一样(必填、长度、范围、邮箱和网址格式),数字框里读不出数字的文本也拒绝。编辑框保持打开,留着刚输入的内容,下方写明原因;改对再提交,或按
Esc 放弃。拒绝状态下点别处不生效。
- **回车保存后留在原格**(Sales 裁定 D2,7060745834)。这**反转了已合并的
#35687「回车保存并下移」**,单独一个 commit;Tab / Shift+Tab 仍保存并右移 / 左移。
- **选中框不再画到冻结列上**,Esc 取消选中后不再留下浏览器默认的(macOS 上是橙色的)焦点框。
- **人员头像不再撑高行**:原来 32px 头像让行高变 41px,编辑时又掉回 33(行高跳动);现在头像 24px,行高始终 33。
- 表单、对话框、记录页的控件不变。手机宽度(375)列表画成卡片,没有格子,本切片不涉及。
## What changes
**Host facts** (`@object-ui/components`,
`context/gridCellSelection.tsx`). `GridCellFacts` gains:
- `editor?: 'cover' | 'below'` — `below` draws the cell's editor as a
panel under the cell, which keeps drawing its value; absent or `cover`
keeps the layer over the cell.
- `clearRefusal?: string | null` — why Backspace / Delete leave the cell
as it is.
- `validate?: (value) => string | null | undefined` — why a committed
value is refused.
The table cannot tell a select column from a text one
(`TableColumn.type` has eight literals), so the placement is a host
signal. `ObjectGrid.describeCell` (`objectGridCellFacts.ts`) answers all
three from the field definition: `inlineEditorPlacement(type)` (select,
status, radio, multiselect, checkboxes, tags, date, datetime, time,
color, lookup, master_detail, user, owner → `below`), `clearRefusalText`
(a required field; `required_message` or `validation.required`), and
`cellValueRefusal`, which reads the record form's own
`buildValidationRules` (required, min/max length, min/max, email / URL
pattern) and says each with the form's sentence.
**Panel under the cell** (`dataTableCellOverlay.tsx`, `data-table.tsx`).
`CellOverlay` takes `placement`; `below` offsets the layer 2px under the
cell instead of minus the cell's height, and the cell keeps its drawn
value while the panel is open. No preview size is seeded for a panel.
**Date panel** (`@object-ui/fields`, `DatePickerField.tsx`). The in-cell
face is one panel: the typeable box on top, the calendar always showing
beneath it (the panel root gives it the panel's surface and centres it
over the quick picks; the calendar's own `className` literal stays as
the phone-touch spec reads it), then the time row (datetime) and Today /
Tomorrow / Next week / Clear. The form face is unchanged.
**Backspace / Delete** on a selected cell write `null` through the same
`writeCell` path a paste uses (confirm, stage, save), except a two-state
cell (nothing written) and a cell with `clearRefusal` (its sentence
shows on the cell; nothing written). A read-only cell says why, as
before.
**A refused commit** — `saveEdit` now returns whether it committed.
Before staging, the select-first table asks `editRefusalOf`: first the
browser's own reading of the editor's inputs (`validity.badInput` /
`typeMismatch` → `table.cellNotNumber`, `validation.email`,
`validation.url`, `table.cellInvalid`), then the host's `validate`. A
refusal keeps the editor open with what was typed, puts the focus back
in it and draws the reason under it (`role="alert"`,
`data-testid="cell-edit-refusal"`). Enter / Tab do not move; a press
outside is swallowed (pointerdown and its click); Escape discards. The
refusal line hides as soon as the value is edited.
**Enter stays on the cell** (own commit `383cbb2a`). `commitMoves`
replaces `moveSelection`: Enter commits and refocuses the selected cell;
Tab / Shift+Tab commit and move right / left.
**Frame and focus ring.** The selected cell's frame is a child span
(`data-slot="cell-selection-frame"`, `absolute inset-0 border-2
border-primary`, `z-[1]`) instead of the cell's outline: an outline
painted over a frozen column the cell had scrolled under, a child paints
in the cell's layer, which the sticky `z-10` columns cover. Select-first
cells are `outline-none`, so the cell that keeps the focus after Esc
deselects shows no ring.
**User cell face** (`@object-ui/fields`, `UserCellRenderer`). The avatar
is `size-6 -my-0.5` (24px drawn, 20px laid out) in both the single and
the stacked branch, so it is no taller than the cell's line of text.
`@object-ui/i18n` adds `table.cellNotNumber` and `table.cellInvalid` in
all 11 packs (zh-Hant regenerated with `scripts/gen-zh-hant.mjs`).
## Reversal of #35687 (merged), named per the ruling
Two #35687 behaviours are reversed:
1. **Enter in an editor saves and moves down → saves and stays on the
cell** (Sales D2, 7060745834).
2. **Backspace / Delete open an empty editor without saving → clear and
save at once; a required field refuses** (#36023 S4 scope item 3).
Tests migrated
(`ui/packages/components/src/__tests__/data-table-keys-35687.test.tsx`):
- "Enter commits and moves down …": now expects the selection to stay on
`0:0` with the focus on the cell, then Tab → `0:1`, Shift+Tab → `0:0`.
- The multi-line editor case: Ctrl/Cmd+Enter commits and stays (`0:2`).
- "Backspace opens an empty editor" removed; replaced by the clearing
cases below.
Sentences on #35687 to reword (the seat edits the card text):
| Where on #35687 | Now reads | Reword to |
|---|---|---|
| 要做的 › 编辑时 | 回车:保存并下移一格。 | 回车:保存并留在原格。 |
| 要做的 › 未编辑 | 退格、Delete:进入编辑并清空,不直接保存。 | 退格、Delete:清空并立即保存;必填字段不清空并提示。 |
| 验收 (Safari / Chrome pinyin) | …单元格里是「中」字并仍在编辑;再按回车才保存。 |
…单元格里是「中」字并仍在编辑;第二次回车保存并留在原格。 |
| 验收 | 编辑中按 Tab:保存并选中右边一格;按回车:保存并选中下面一格。 | 编辑中按
Tab:保存并选中右边一格;按回车:保存并留在原格。 |
| 验收 | 选中必填的金额格按退格:进入编辑且为空,没有发保存请求。 | 选中必填格按退格:值不变,格上提示必填,没有发保存请求。 |
## Tests
- `data-table-keys-35687.test.tsx`: new describe "clearing, the panel
under the cell, a refused commit (objectstack#36023)", 10 cases —
Backspace / Delete clear and save; a `clearRefusal` keeps the value and
says why; a two-state cell writes nothing; a read-only cell is not
cleared; `below` vs `cover`; a host refusal keeps editor and input and
Enter does not move, then Tab after correcting moves; Escape after a
refusal discards; `badInput` refused by the table; a press outside a
refused injected editor is swallowed (control: an accepted value
commits); the frame is a child under frozen columns and Esc leaves no
ring.
- `data-table-select-first-35684.test.tsx`: the ring assertion reads the
frame child instead of `outline-primary`.
- `objectGridCellFacts-35684.test.ts`: placement per type,
`clearRefusalText`, `cellValueRefusal` (required, length, range,
pattern, messages).
- `ObjectGrid.cellSelection-35684.test.tsx`: a select cell opens below
and keeps its value; a required cell refuses Backspace; a `maxLength`
refusal keeps the editor.
- New `userCell.rowHeight-36023.test.tsx`: single and stacked faces are
`size-6 -my-0.5`, never `size-8`.
- Local runs: `@object-ui/components` + `@object-ui/plugin-grid` full
(793 files) passed; `@object-ui/fields` + `@object-ui/i18n` full 6723
passed / 20 skipped; form-field channel census (3 files, 141) passed;
`turbo run type-check` for components, fields, plugin-grid, i18n: 57/57;
eslint on every changed file: 0 errors; `check:i18n`,
`check:i18n-coverage`, `check:i18n-walk-parity`,
`check:i18n-stale-fill`, `check:i18n-keys`, `check:i18n-dead-keys`:
pass.
## Verification (browser)
Showcase field zoo, a temporary 22-column probe view with the name
column frozen (not in this PR), Chromium, light and dark, 1280 and 768.
Shots: `/mnt/project-files/build-seat1/36023/S4/shots/`.
| Kind | Placement | Row before → while open | Panel top vs cell bottom
|
|---|---|---|---|
| date, datetime, time | below | 33 → 33 | 227 vs 225 |
| select, multi-select, tags | below | 33 → 33 | 227 vs 225 |
| colour | below | 33 → 33 | 227 vs 225 |
| lookup, user | below | 33 → 33 | 227 vs 225 |
| long text, address, email | cover (in place) | 33 → 33 | — |
The same at 768 (date, select, multi-select, user) and in dark (date,
select, tags, colour, long text). At 375 the list draws as cards, so
there is no cell to edit.
Keyboard journeys (1280): Enter on a text cell saves and stays (`1:2`,
focus on the cell), Tab moves to `1:3`; number "1e" is refused with
"Enter a number.", a click away keeps the editor, Esc restores 420;
Backspace on phone clears it to "—"; Backspace on the required name says
"Name is required"; Esc twice leaves no outline (`outline-style: none`,
was the browser's `auto` ring).
Frozen column: a selected cell scrolled under the frozen name column —
before, its outline was drawn over the name column; after, the frame is
clipped at the column's edge like the cell's text
(`frozen-1-2-scrolled.png`).
User face: a row holding "Dev Admin" — before 41px at rest and while
editing, face 32px; after 33px at rest, while editing and after Esc,
face 24px (`avatar-after-rest.png`).
## Acceptance notes
- **Required rating, handed over from S3 (done after #36045 merged).**
`main` is merged in (S3 1c87956). The rating's Backspace / Delete and
the `0` key all go through `clearCell` (`setStars(0)` is a clear), so a
required rating keeps its stars and says it is required; a digit above
zero still sets the stars. Pinned in
`data-table-cell-overlay-35688.test.tsx` ("a required rating is never
cleared: 0, Backspace and Delete …"), next to S3's own rating cases,
which pass unchanged.
- **No second sentence for a number box.** S3's in-cell number, currency
and percent boxes draw their own bad-input line under the box and mark
it `aria-invalid`. For such a box the table refuses the commit without
adding its own line (`editRefusalOf` returns `''`), so the reader sees
one reason, not two. Pinned in `data-table-keys-35687.test.tsx`.
- **DELIBERATE CORRECTION of a pending release note** (`Check Changeset`
stays red on it by design; the seat confirms it by its own record).
Note: `.changeset/35684-35687-list-cells-select-first.md` (from #35747,
not yet released). This PR changed the behaviour two of its sentences
describe, so they are rewritten in commit df048a4 rather than left
false in the same release:
- "Backspace or Delete opens an empty editor and saves nothing." →
"Backspace or Delete clears the cell and saves at once, and a required
field keeps its value and says it is required (objectstack#36023)."
- "While editing, Enter commits and moves down, Tab and Shift+Tab commit
and move right and left, …" → "While editing, Enter commits and stays on
the cell (objectstack#36023), Tab and Shift+Tab commit and move right
and left, …"
Nothing else in that note changes; restoring it from the base would
republish the two false sentences.
- The lookup and user record lists inside the panel are S3's (#36045);
this slice only places them below.
- A refused value whose cell scrolls out of sight is discarded (the
scroll-away path closes the editor as before, and a refused value is not
saved).
- While a refused value is open, a press outside does nothing
(pointerdown and the click it starts are swallowed for one second at
most).
- Overlap: the release PR #35129 rewrites the same pending changeset and
regenerates itself. S3 #36045 has merged and `main` is merged in here
(conflicts in `data-table.tsx`, the Backspace / digit branch, and
`dataTableCellOverlay.tsx`, the layer classes, resolved by keeping both
sides). #36033 still overlaps `data-table.tsx`; the second of the two to
land merges `main`.
## How to try it
Open any object list, select a select or date cell and press Enter (the
panel opens under the cell; the cell still shows its value). Press
Backspace on an optional cell (cleared and saved) and on a required one
(refused with a hint). Type a too-long value into a text field with a
max length and press Enter (the editor stays and says why).
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: n/a.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 block and
the #35687 sentences are in the maintainer's language).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgTBQ7DZYZt5GQadGKZ)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgTBQ7DZYZt5GQadGKZ
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgTBQ7DZYZt5GQadGKZ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent eebb893 commit 13d1e95
28 files changed
Lines changed: 857 additions & 192 deletions
File tree
- .changeset
- content/docs/frontend/plugins
- ui/packages
- components/src
- __tests__
- context
- renderers/complex
- fields/src
- __tests__
- widgets
- date-picker
- i18n/src/locales
- plugin-grid/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| 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 | |
|---|---|---|---|
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
413 | 423 | | |
414 | 424 | | |
415 | 425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
253 | 267 | | |
254 | 268 | | |
255 | 269 | | |
| |||
0 commit comments