Skip to content

fix(components): an editable list's lookup column is wide enough for its record picker - #34693

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-34601-lookup-column-width
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-34601-lookup-column-width

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

Fixes #34601
Clause-②: no
Metadata-protocol: none
File surface amended: ui/packages/components/src/renderers/complex/data-table.tsx, ui/packages/components/src/renderers/complex/tests/data-table-lookup-picker-floor-34601.test.tsx, ui/packages/types/src/data-display.ts (doc comment only) — per claim 6940933031 (item 2, branch claude/issue-34601-lookup-column-width).

维护者速读

  • 改了什么:列表开启「行内编辑」后,查找类列(产品、负责人这类引用字段)的宽度不再小于 168px,和行项目表格(GridField)里查找列的最小宽度一致;只读列表、作者写死的列宽、用户手动拖的列宽都不变。
  • 为什么改:实测查明 Product 列偏窄的来源:行内编辑列表的表格按单元格里显示的短名称自动定宽(如 "Consulting Hour" 只给 121px),而这列的编辑器是查找选择器,触发框只剩约 50px,下拉选项被截成「C..」「W.」。
  • 风险与回滚:只改了表格自动列宽的一处下限,仅在「表格可编辑、该列是引用字段、该列可编辑」三者同时成立时生效;回滚即 revert 本 PR。
  • 先看:ui/packages/components/src/renderers/complex/data-table.tsx 里 autoSizedWidths 的 pickerFloor;其次是新测试文件。
  • 两分钟验证:打开 Showcase 的 Invoice Lines 列表,把窗口调到约 820px 宽,在 Display 里打开 Edit inline,点 Product 单元格:该列应为 168px 宽(修复前 121px);关闭行内编辑后该列回到 121px。
  • 需要你做的:无,席位落地。

What changes

  • data-table sizes a column with no explicit width from what its cells draw, with an 80px floor. In an editable table, a foreign-key column (the foreignKey flag ObjectGrid already stamps on lookup, master-detail, tree and user columns) opens the record picker as its cell editor. Sized from the short names it draws, the picker's trigger got a few dozen pixels.
  • Now, when the table is editable, the column carries foreignKey: true and the column itself is not editable: false, the auto-sized width is floored at 168px, the width GridField gives its lookup columns (MIN_WIDTH_BY_TYPE.lookup). The value is a private constant in data-table.tsx: @object-ui/components cannot import @object-ui/fields, and adding a public export for it would widen a published surface.
  • Only the estimate is floored. An explicit width (the view's pin, or the user's persisted resize) is drawn as written, so the seat's ruling that a pinned width stays exact holds here too. GridField is not touched.
  • The TableColumn.foreignKey doc comment in @object-ui/types now says what an editable table does with the flag.
  • Patch changeset for @object-ui/components and @object-ui/types.

Live measurement (item 2: where the narrow lookup column comes from)

Showcase app, own backend (objectstack dev --fresh) plus the Console Vite dev server from this tree, Chromium. hotcrm ddcd6e60 (read-only clone): crm_quote_line_item declares no inlineEdit, so quote lines are a related-list card on the quote page (a read-only data-table, no picker). The record picker in a line table is reached two ways, and both were measured:

  1. Inline line-item grid in the record form (GridField, DOM div[data-testid=line-items] > table), showcase Invoice "Edit", Product column: unpinned, style width: 168px, laid out 205px at 1280 and 209px at 375. Not the source.
  2. A list with "Edit inline" on (data-table, DOM div[data-testid=console-route] > div[data-testid=record-list-host] > div[data-table-scroll-box] > table, column data-auto-width-key="product"), showcase Invoice Lines, Product column. This is the source:
viewport column before picker trigger before popover before column after picker trigger after popover after
1280 121 (stretched to 185) 115 115 168 (stretched to 219) 149 149
1024 121 (laid out 145) 75 75 168 (laid out 171) 101 101
820 121 51 51 ("C..", "W.") 168 98 98
375 phone card list, no table n/a n/a unchanged n/a n/a
  • Control: the same list with inline edit off keeps the Product column at 121px after the fix.
  • "Popover after" is the trigger width because item 1 (objectstack#34658, the picker's own 18rem floor) is not on main. With fix(fields): lookup picker is wide enough to read an option and stays inside the viewport #34658's LookupField.tsx change applied locally on top of this branch (not committed, restored to HEAD afterwards, git diff HEAD empty), the popover read 288px at 1024 (right edge 872) and 288px at 820 (right edge 820, inside the viewport). Both items together meet the card's acceptance; this PR alone fixes the column.

Tests

  • New ui/packages/components/src/renderers/complex/__tests__/data-table-lookup-picker-floor-34601.test.tsx (data-table has no shared harness file; each card has its own): an editable foreign-key column drawing "Widget A" is 168px, not 112px. Controls: read-only table, no foreignKey flag, and a column with editable: false all stay 112px. A wide name (320px) and an explicit width: 90 are left as they are. happy-dom has no layout, so this is the arithmetic path. The pixels are the live reading above.
  • Ablation, on the committed head through scripts/ablation-replace.mjs (the test imports ../data-table and @object-ui/types resolves to source through the vitest alias, so there is no dist leg): replacing the floor expression with (width) turned the first test red (expected '112px' to be '168px', 1 failed / 2 passed), and the file was restored to the HEAD blob f19704007c07 with git diff HEAD empty.

Acceptance notes

  • Grouped lists compute their own explicit column widths with the same 80px floor (groupedColumnWidths in ObjectGrid.tsx), so an editable grouped list keeps a narrow lookup column. That file belongs to another in-flight card in this container and is outside this PR's surface. Not measured live.
  • A trigger in a 168px column is about 98px, because the picker's browse-all button takes about 40px of the cell. Names longer than that still read in full only in the open list (item 1).

Verification

Local gates on head bb217f9
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/src/renderers/complex/__tests__/ packages/components/src/__tests__/data-table.dateOnlyZone-10183.test.tsx: lock VERDICT command-exit 0, Test Files 38 passed, 1 skipped (39), Tests 248 passed, 7 skipped (255).
  • Dependency closure pnpm --workspace-concurrency=2 --filter '@object-ui/components^...' build: VERDICT command-exit 0.
  • pnpm --filter @object-ui/components --filter @object-ui/types run type-check: VERDICT command-exit 0. The new test file is in components' tsconfig.test.json program (--listFilesOnly count 1).
  • node scripts/pm/dispatch-gates.mjs --commands: 38 commands, every one exit 0, including pnpm --dir ui exec vitest run scripts/ (5077 passed, 2 skipped) and pnpm check:nul-bytes. pnpm check:type-check-debt first returned exit 3 (queue-timeout on the shared lock, NOT MEASURED) and was re-run under the lock with its kept slot: exit 0.
  • dispatch-gates --ran: "38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN" (a derived zero, all 38 with exit codes).
  • pnpm check:changeset-fixed: exit 0. pnpm --dir ui run check:new-line-citations: exit 0, 0 new citations.
  • node scripts/pm/overlap-check.mjs --branch=claude/issue-34601-lookup-column-width: exit 0 before every push.
  • Every CI family is CI's to report on this PR. These are the local subset only.

signed: repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz


Generated by Claude Code

…icker width

An editable data-table sized a lookup column from the short names its cells
draw, so the record picker opened in it was a few dozen px wide and every
option was cut. The auto-sized width of a foreignKey column whose cells edit is
now floored at LOOKUP_COLUMN_MIN_WIDTH (168px), the width GridField already
gives its lookup columns; an explicit width stays exact.

Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
Co-authored-by: Claude <noreply@anthropic.com>
…eset

The floor value stays private to data-table (no new public export), and the
TableColumn.foreignKey docs say what an editable table does with the flag.

Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 17, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhshTXCAmv9KJXRZkB

席位核对 · L1 (seat 3, L1-a) · 2026-11-17T07:11Z

L1: ACCEPT
Head-sha: bb217f9
Card: #34601 item 2 · claim 6940933031 (continuing 6937484878 under amendment 6939423758) · os-dev-report 6940890993 · item 1 landed as PR #34658

Item 2 is traced to the real producer, measured live, and fixed in the smallest place that covers it. The seat's Q1 = A ruling (an explicit width stays exact) holds. The claim's corrected premise and amended surface name all four files. No must-fix and no should-fix.

Must-fix

None.

Should-fix

None.

Readings that hold

Item Reading
PR shape Draft, base main, Fixes #34601, with no other closing verb. Item 1 (#34658, Part of) is already merged, so closing the card here leaves nothing open. No ! and no (narrowing), so no dogfood battery is owed.
Scope 4 files: data-table.tsx (+22/−3), the new data-table-lookup-picker-floor-34601.test.tsx, types/src/data-display.ts (+6, jsdoc only) and the changeset. Claim 6940933031 names complex/data-table.tsx, complex/__tests__/**, types/src/data-display.ts (doc comment only) and .changeset/. All in surface.
Premise correction The card points at GridField, but the live reading shows GridField draws an unpinned lookup at 168px. The narrow column comes from data-table auto-width on an Edit-inline list ("Consulting Hour" → 121px, trigger 51px at 820). The claim records this as Premise: corrected, and the PR's Live measurement table gives before and after at 1280/1024/820, plus the inline-off control (still 121px).
Code pickerEdits = editable && col.foreignKey === true && col.editable !== false. pickerFloor applies Math.max(width, 168) on both auto paths: the drawn-px path and the char estimate. Explicit-width columns continue before either path, and fitContent keeps its own branch, so a view pin or a persisted user resize is drawn as written (Q1 = A). editable is added to the useMemo deps, so toggling inline edit re-sizes. The cap stays 400 > 168, so the floor never fights it. GridField is untouched.
Clause-② / Metadata-protocol no / none in the claim, PR body and changeset. Read against the diff: no export is added (LOOKUP_PICKER_MIN_WIDTH is module-private), and no key is added to TableColumn. The data-display.ts hunk is jsdoc on the existing foreignKey member, so @object-ui/types' type surface is byte-identical apart from a comment.
Changeset patch on @object-ui/components and @object-ui/types, the two published packages whose src moved. The sentences match the code: "In an editable table, a foreign-key column … whose cells edit is now never narrower than 168px" = pickerEdits. "A wider name still widens the column" = Math.max. "A width the view pins, or the user's own resize, is drawn exactly as written" = the col.width skip. "read-only tables and columns that do not edit are unchanged" = the editable and col.editable !== false terms.
Tests The new file has 3 tests. 168px vs 112px. Controls: a read-only table, no foreignKey, and editable: false all stay 112px. A wide name (320px) and an explicit width: 90 are kept. The ablation (floor → (width)) turns the first test red, 1/3, and is restored to blob f19704007c07 with git diff HEAD empty. Real commands with output: 38 files / 248 tests under the lock. Type-check for components and types exits 0. 38/38 derived gates.
UI strings None added.
Docs Searched content/docs, skills and the components README for the table's auto-width floor and for foreignKey. Nothing describes them, so nothing is made false. The TableColumn.foreignKey jsdoc is updated in this PR.
Acceptance 1 (read each product's full name in the picker) comes from both items together. #34658's 18rem popover floor is on main, and this PR gives the trigger room (98px at 820). With #34658 applied, the PR reads the popover at 288px. 2 (the popover stays inside the viewport on a narrow screen) is #34658's max-w-(--radix-popover-content-available-width), and the right edge reads 820 at an 820 viewport.
Tier check-governed-merges --pr 34693: NOT governed, 124 lines. Tier S, lands through o3-C.
CI on this head 62 check-runs: 46 success, 15 skipped, 1 failure. The failure is the first PR-body-guards job (133869992882, 06:43Z), which ran before claim 6940933031 (06:46Z) named this branch. The re-run on the same head (133871916846, 06:47Z) is success. Test UI 16/16 shards plus the aggregate, Type Check UI, Lint UI, Build & E2E UI, Live E2E UI, Check Changeset, Lint & Repo Gates and TypeScript Type Check are all success.

Notes

  1. A masked foreign-key column is floored too. pickerEdits does not exclude col.masked, but the cell-edit gate does (isEditable = editable && col.editable !== false && !col.masked && …). So a masked lookup column in an editable table is drawn at 168px though it never opens the picker. This is harmless and rare. Adding && col.masked !== true would make the two readings match.
  2. Grouped editable lists are not covered. groupedColumnWidths in ObjectGrid.tsx sets explicit widths with its own 80px floor, so a grouped Edit-inline list keeps a narrow lookup column. Declared in the PR. That file is in 手机端:列表卡片的金额被截断;表单页签在 375 宽下横向溢出 #34615's in-flight surface, and the os-dev report carries it to the seat. A follow-up card would keep it from being lost.
  3. 168 is spelled twice, here and in GridField's MIN_WIDTH_BY_TYPE.lookup. The data-table.tsx constant's comment points at GridField, and GridField is not touched. That is the right call while components cannot import fields and a new export would make this Clause-② yes.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz

Landing · area o3-C · head ba312fd

Probe Reading
check-governed-merges.mjs --pr 34693 NOT governed (0 of 4 paths hit the register); 124 changed lines (+121/−3) ≤ 3000 → Tier S
CI + review L1 ACCEPT 6941377648 at bb217f9; K was 20, so origin/main was merged in by relay pr_update_branch (clean merge commit, no PR change, ACCEPT kept); on ba312fd: 45 check-runs success, 13 skipped, 0 failed, mergeable clean, K = 1.

State: ready + auto-merge now; on MERGED, #34601 closes via Fixes (item 1 landed as #34658) and its pm:* state label comes off.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 07:37
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 2e29287 Nov 17, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34601-lookup-column-width branch November 17, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

内嵌行项目表格里的查找下拉和单元格一样窄,选项名被截断

2 participants