Repository navigation
Commit a6607c7
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuFtZePhJzziPWQwzHnzpoZ1)_
repo:objectstack#1 · os-sales · session_01L6bhgVyFBp1oC6H2XfBmrm
Part of #35688 (slice S1 of three; S2 pickers and dates, S3 lookups,
numbers and wrap-up follow in their own pull requests, so the card stays
open)
Clause-②: no — `CellOverlay` and its geometry helpers live in two new
modules that the `@object-ui/components` entry does not re-export, and
the per-type width table stays private to `ObjectGrid`; no prop, type or
i18n key is added or removed (the claim expected `yes`; measured `no`
against the package entries)
Metadata-protocol: none
## 维护者速读
-
列表里按回车(或双击)编辑任何格子,编辑框不再塞进格子把整行撑高,而是浮在格子上方:左上角对齐格子,至少和列一样宽,需要时更宽更高;行高和其他列都不动(实测
20 种可编辑类型全部 32 → 32,现状最高撑到 204)。
-
选中一个被截断的格子(长文本、多行、多选、标签、地址),原地浮出全文;再按回车或双击就在同一位置变成编辑框,Esc、点别处或方向键收起。布尔格按回车直接切换,不再弹出一个复选框。
- 最后一行、最右一列、冻结列里的格子、窄屏(768
宽)都完整可见:靠底自动向上翻,靠右自动左移;格子一半藏在冻结列下时先把它滚出来;编辑中把格子滚出表格可见区,就像点别处一样提交并收起。
- 下拉、日期、关联等控件本身还是现在的样子,只是换到了浮层里;它们的"格内"样式在 S2、S3 里改。
## What changes
**The editor draws on a layer over its cell** (`@object-ui/components`,
`data-table`). New `CellOverlay` (`dataTableCellOverlay.tsx`): a Radix
Popover with no portal, anchored on the cell (`side="bottom"
align="start"`, offset by minus the cell's height, so its top-left
corner sits on the cell's own corner).
- The layer is `position: fixed`, so neither the row's height nor any
column's width changes while a cell is edited.
- It stays inside the cell's DOM subtree. Every `contains` read the grid
already makes (click-outside, focus, keydown routing) still sees the
editor inside its cell, so commit and cancel keep their current rules:
Enter, Tab, a click elsewhere commit; Esc cancels.
- It is at least the column's width (`--radix-popper-anchor-width`),
grows to fit up to `min(32rem, available width)`, and its height is
capped at the space available and scrolls inside. Near the viewport's
bottom it flips so its bottom edge sits on the cell's bottom edge; near
the right edge it shifts left (`avoidCollisions`, padding 8).
- The host cell is raised (`z-30`, plus `relative` when not frozen)
while its layer is open, because a fixed descendant still paints inside
the cell's stacking context; without it a frozen column or the sticky
header would cover the layer.
- On open the cell is scrolled clear of the left-frozen columns, the
right-pinned columns and the sticky header (`revealCell` in
`dataTableCellOverlayDom.ts`). Once a scroll hides the cell behind them
or out of the table's box, the editor commits and closes, as a click
elsewhere would.
- Radix keeps the layer hidden until it is placed, and a hidden control
refuses focus, so the editor takes the caret on the first frame the
layer is placed (retried for up to 30 frames).
- Tab inside the layer never reaches Radix's focus loop, so it stays the
grid's commit-and-move key.
- All outside, Escape and auto-focus handlers of the popover are no-ops:
the grid owns them.
- An injected editor (`renderCellEditor`, which `ObjectGrid` passes)
goes on the same layer.
**At the row's density.** Inside the layer, single-line inputs and
comboboxes are 32px tall with 13px text, and a textarea starts at least
as tall as the preview it replaces. The built-in editor gets a starting
width per type (`min-w-56` for dates, `min-w-40` otherwise);
`ObjectGrid` wraps `FieldEditWidget` in a per-type width
(address/location 22rem, long text 20rem, lookup/user 18rem,
multi-select/tags 16rem, date/phone/url/email/currency 14rem, others
10rem).
**A cut-off cell shows its whole value.** When the selection lands on a
cell whose content is truncated (the check reads the cell's descendants,
because cell renderers truncate on an inner span), the full content
draws on the same kind of layer, wrapping, up to 16rem tall.
- Enter, F2 or a double-click opens the editor in its place, at least as
large as the preview was (the preview's size is passed as
`--cell-overlay-min-w` / `--cell-overlay-min-h`).
- Esc closes the preview and keeps the cell selected; an arrow key moves
the selection, and the preview follows only if the next cell is cut off
too.
- After Esc in an editor opened from a preview, the preview does not
come back; it shows again only when the selection moves onto a cut-off
cell.
**Enter on a two-state cell flips it** (boolean, toggle) instead of
opening an editor holding one checkbox; Space and a second click already
did.
## Tests
- New
`ui/packages/components/src/__tests__/data-table-cell-overlay-35688.test.tsx`
(7 cases): the editor is in a fixed layer inside its cell and the cell
is raised; an injected editor goes on the same layer; a cut-off cell
shows a preview and one that fits does not; Enter on the preview opens
the editor at least the preview's size and Esc does not bring the
preview back; Esc on the preview keeps the selection and an arrow key
moves on; Enter flips a two-state cell; scrolling the editing cell out
of the table's box commits it.
- No existing test was changed or deleted. The prototype failed one
existing case (6859 C, Tab out of an injected editor) because of the
popover's focus loop; the Tab guard above fixes the cause and the case
passes unchanged.
- Local runs: `@object-ui/components` 4771 passed / 24 skipped;
`@object-ui/plugin-grid` 2591 passed; `@object-ui/plugin-list` 1970
passed. Typecheck (src and tests) clean for both changed packages;
`data-table.tsx` lint warnings equal `main`'s (78), the new files have
none.
## Acceptance notes (behaviour changes a reviewer should know)
- The seeded size travels as two CSS custom properties in the layer's
`style`, read by static Tailwind utilities. `ui/AGENTS.md` asks for no
inline layout styles; this is a value the utilities read, not layout
written inline, and the reviewer may prefer another carrier.
- jsdom has no layout: the tests pin structure and gestures; the
geometry (row height, flip, painting above frozen columns) is the
browser reading below.
- The editors themselves (select, date, lookup, percent's slider,
rating) are drawn as they are today, only on the layer; their in-cell
variants are S2 and S3.
- Grids without select-first (no `GridCellSelectionProvider`) also draw
their editor on the layer; the preview is drawn only where a cell can be
selected.
## Review round 1 (head `055c8874`, after `170a2856`)
From the L1 record (REWORK, comment 7057804492):
- should-fix: the built-in editor's per-type `min-w-40` / `min-w-56`,
merged last on the layer's class, replaced the layer's
`min-w-[max(anchor width, seeded width)]` (same tailwind-merge group),
so a grid without an injected editor could draw its editor narrower than
the cell and lose the preview's seeded width → the floor now rides an
inner box inside the layer, as `ObjectGrid`'s wrapper already did. Test
3 now pins the merged class and the inner box.
- should-fix: the preview's `max-h-64` replaced the layer's
`max-h-(--radix-popper-available-height)`, so in a short viewport the
preview could run past the edge → one class,
`max-h-[min(16rem,var(--radix-popper-available-height))]`. Test 2 pins
it.
- Both new assertions fail on `170a2856` (2 of 7 cases) and pass here.
`@object-ui/components` 4771 passed / 24 skipped,
`@object-ui/plugin-grid` 2591 passed, typecheck clean, `data-table.tsx`
warnings unchanged (78).
- Not changed: the CSS-custom-property carrier (L1 read it as
acceptable); the preview covering neighbouring cells and `drawCell()`
running the renderer twice are observations for the later slices.
## Verification
Browser, showcase field zoo (`showcase_field_zoo`), a temporary
22-column view with the name column frozen (not part of this pull
request), Chromium 1600×900 and 768×320, `main` d6be99d against this
branch.
| Reading | `main` | this branch |
|---|---|---|
| Row height when editing starts, 20 editable types | 41–204 (Name 49,
Textarea 107, Percent 65, Multi-select 111, Tags 79, Rating 69, Address
204) | 32 → 32 for every type; other columns do not move |
| Caret in the editor after Enter | — | 20 / 20 |
| Layer's four corners on top (`elementFromPoint`), frozen-column cell
included | — | all pass |
| Last row at 768×320, address | — | the layer flips up, bottom edge on
the cell's bottom edge, fully visible |
| Rightmost columns (color, address) | — | shift left, stay on screen |
| Cell half under the frozen column, Enter | — | scrolled clear first
(layer's left edge 27 → 216) |
| Editing cell scrolled out of the box | — | committed and closed; the
value survives a reload |
| Selected long text | truncated | full text wraps on a 512×72 layer;
Enter opens a 512-wide editor there |
| Boolean, Enter | an editor holding one checkbox | flips in place, no
layer |
Read first:
`ui/packages/components/src/renderers/complex/dataTableCellOverlay.tsx`
(the layer), `dataTableCellOverlayDom.ts` (reveal and hidden geometry),
and the editor and preview blocks in `data-table.tsx`.
Two-minute check: open any object list, select a long text cell (the
full text floats over it), press Enter (the editor opens in the same
place, the row does not grow), press Esc; then scroll to the last row
and press Enter on an address cell (the form opens upward).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgVyFBp1oC6H2XfBmrm)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgVyFBp1oC6H2XfBmrm
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgVyFBp1oC6H2XfBmrm -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent f548bdc commit a6607c7
7 files changed
Lines changed: 592 additions & 8 deletions
File tree
- .changeset
- content/docs/frontend/plugins
- ui/packages
- components/src
- __tests__
- renderers/complex
- plugin-grid/src
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
370 | 377 | | |
371 | 378 | | |
372 | 379 | | |
| |||
383 | 390 | | |
384 | 391 | | |
385 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
386 | 398 | | |
387 | 399 | | |
388 | 400 | | |
| |||
393 | 405 | | |
394 | 406 | | |
395 | 407 | | |
396 | | - | |
| 408 | + | |
397 | 409 | | |
398 | 410 | | |
399 | 411 | | |
| |||
| 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 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
0 commit comments