Skip to content

feat(plugin-form): the form dialog maximizes in place like the record drawer, remembered per object - #34703

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-34604-modal-form-maximize
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-34604-modal-form-maximize

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread
Fixes #34604
Clause-②: no
Metadata-protocol: none

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

维护者速读

  • 改了什么:新建 / 编辑表单弹窗的标题栏加了放大 / 还原按钮(和记录抽屉同一个图标、同一个位置,紧挨关闭按钮左边);普通表单和带行项目的表单两种弹窗都有,并按对象记住上次的选择。
  • 为什么改:长表单、带行项目的报价单在弹窗里只能用 90% 高度、受限宽度;维护者要求「展开为整页,现在右侧弹出框已经有放大缩小的图标,可以统一风格」。
  • 风险与回滚:只改弹窗外框的 class,表单本身不重新挂载,已填内容、未保存提示、行项目都保留;回滚即还原本 PR,选择记录在浏览器 localStorage(键 modal-form-maximized:OBJECT),无数据或元数据改动。
  • 先看:ui/packages/plugin-form/src/ModalForm.tsx(effectiveModalSize 里的放大覆盖、heightClass、maximizeButton)、ui/packages/plugin-form/src/modalMaximize.ts(按对象记忆)、__tests__/modalMaximize-34604.test.tsx。
  • 两分钟验证:控制台打开「新建商机」,填两个字段后点标题栏右上角关闭按钮左边的放大图标:弹窗铺满、内容还在;再点还原回原尺寸;关掉重开同一对象仍是放大状态,换一个对象是原尺寸。
  • 需要你做的:无,席位落地。

What changes

  • The form dialog (ModalForm) draws the record drawer's maximize / restore switch in its header: the same RecordTopBarButton, the lucide Maximize2 / Minimize2 pair at h-3.5 w-3.5, the same existing i18n keys (detail.maximize / detail.restoreSize), placed just before the close (X) button in both position and tab order. Both arms carry it: the flat form and the subforms master-detail form (its own MobileDialogContent).
  • Maximized, the effective size is full (sm:max-w-[95vw]) whatever the authored or inferred size, and the height cap is lifted: sm:h-auto sm:max-h-[90vh] becomes sm:h-[95dvh] sm:max-h-[95dvh], so the dialog fills the window and its body scroller (not the page) scrolls a long form. Restore puts back the exact previous classes.
  • Toggling changes the content element's classes only. The form subtree is not remounted: typed values, the dirty state that arms the discard guard, and master-detail lines all survive (pinned by element identity).
  • Every reader of the size reads the effective size, so dialogUndeclaredColumns(fieldCount, modalSize) (表单弹窗:作者没写列数时按容器宽度排到 3–4 列,弹窗尺寸随之放大 #34607) answers four columns for a 16+-field undeclared form when maximized, and three again when restored.
  • The choice is a per-object preference (ui AGENTS.md Convert to monorepo with scoped packages #8): a new package-internal helper modalMaximize.ts stores modal-form-maximized:OBJECT in localStorage (try/catch, SSR-safe; restore removes the entry). It is re-read when a mounted dialog is handed another object. Not re-exported from index.tsx or core.ts.
  • Phone: the sheet already fills the screen, so the switch is drawn from sm up only (hidden sm:inline-flex). The header gets sm:pr-20 so a long title stays clear of the two buttons.
  • Clause-② no holds: no new locale key (the two keys exist in every pack; only the no-provider English defaults table in ModalForm gains the two entries the drawer's table carries), no new export or prop on @object-ui/plugin-form or @object-ui/components, no spec key. mobile-dialog-content.tsx is untouched (the override merges over its base sm:max-h-[90vh]).
  • Kept: 带内嵌子表的表单弹窗:取消 / 保存不固定在底部,长表单要滚到最下面才看得到 #34599's close guard and sticky Save bar in the master-detail arm (pinned maximized: the discard prompt still fires on the X, md-form-submit still drawn); 表单弹窗:作者没写列数时按容器宽度排到 3–4 列,弹窗尺寸随之放大 #34607's dialogUndeclaredColumns.

Tests

New file ui/packages/plugin-form/src/__tests__/modalMaximize-34604.test.tsx (10 tests; no shared ModalForm harness file exists, so a card-named file):

  • flat arm: label/aria and icon, order before Close, sm-only, same content node across toggles, restore gives back the previous width class; typed value and same input element across two toggles, then the X still opens "Discard changes?"; switch present with modalCloseButton: false.
  • preference: reopen maximized for the same object, another object unaffected; restore forgets; a mounted dialog handed another object takes that object's choice; a throwing Storage leaves the switch working.
  • columns: 16 undeclared fields read three per row at @4xl in the inferred xl, four maximized, three restored; the typed value survives.
  • master-detail arm: switch present and toggles the same content node; header value and an added line (same input elements) survive two toggles, Save bar drawn, the X still prompts.

No existing pin changed (dialogDefaultLayout-12521, modalViewportGutter-12593, modalCloseButton-11061, ObjectForm.mobileFullscreen all pass unchanged).

Readings at head 9b6b5b0 (after merge f85988a with #34642; os-dev-report 6942457211, PR comment 6942491477)
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/src/__tests__/modalMaximize-34604.test.tsx: Test Files 1 passed, Tests 11 passed; lock VERDICT command-exit 0.
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/: Test Files 236 passed (236), Tests 2636 passed; lock VERDICT command-exit 0.
  • pnpm --filter @object-ui/plugin-form type-check (tsc --noEmit && tsc -p tsconfig.test.json): exit 0; --listFiles of tsconfig.test.json lists the new test file.
Ablations (one-shot, restored, no permanent test files)

Both through scripts/ablation-replace.mjs (anchor 1 to 0, blob moved, restore verified blob == HEAD and git diff HEAD empty). The test imports ../ModalForm from source, so no build sits on the path.

  1. if (maximized) return 'full'; replaced by a constant-false guard: 10 of 10 tests red.
  2. key={maximized ? 'max' : 'restored'} added to the flat arm's content (a remount on toggle): the two flat-arm identity tests red ("expected the same dialog node", "expected the same input element"), 1 passed.

Acceptance notes

  • Before: the form dialog had no size control; the inferred size stops at xl and the height at 90vh. After: the switch above, in both arms, remembered per object.
  • Escape still runs the close guard while maximized (the drawer's Escape restores first); not asked by the card, left as is.
  • An authored modalSize: 'full' still shows the switch: there maximize only lifts the height cap.
  • ui AGENTS.md ✨ Set up Copilot instructions #2 (README / content/docs/frontend) was not updated: neither page describes the dialog's runtime chrome today and both are outside this card's file surface.
  • feat(plugin-form): section navigation for stacked sectioned forms #34642 landed first; merge f85988ac hand-resolved ModalForm.tsx and keeps both features (L1 ACCEPT 6942536762). overlap-check at 9b6b5b0: clean.

Verification

Local gates (derived by `dispatch-gates.mjs --commands`, reconciled with `--ran`)
  • 38 derived commands, 38 run, each exit 0 (--ran verdict: "38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of them is 3)").
  • pnpm check:new-line-citations (ui): 0 new citations, exit 0.
  • Families CI runs (Test UI, Type Check UI, Lint UI, Build and E2E UI, the rest) are read from this PR's check-runs, not re-run locally.

Generated by Claude Code

@github-actions github-actions Bot added size/l 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
Keeps the section nav strip (#34642) and the maximize switch side by side:
the flat arm's header drops its bottom rule when the nav strip draws one.

Claude-Session: https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Final green head for L1 · 2026-11-17T08:11Z
Head-sha: 9b6b5b02646c2173d6e1513db7946872cd8f0ae1

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

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

L1: ACCEPT
Head-sha: 9b6b5b0
Card: #34604 · claim 6940534843 · os-dev-report 6942457211 (head 9b6b5b0) · final-head note 6942491477

All three card items are built in both arms, inside the claim's surface. The claim's Clause-② condition (no new key, no exported prop or type) holds, and the hand-resolved merge with #34642 keeps both features. No must-fix. One should-fix is paper only (the PR body).

Must-fix

None.

Should-fix

  1. The PR body's readings are stale. "Readings at head ea132c4" (10 tests, 235 files / 2628 tests) and the "Overlaps feat(plugin-form): section navigation for stacked sectioned forms #34642 … conflicts … exit 1" line come from before merge f85988ac. The current readings (11/11, 236 files / 2636 tests, overlap clean) are in os-dev-report 6942457211 and the PR comment 6942491477. The seat refreshes the body when it applies PR-body edits. This does not block landing; the comment already corrects the record on the PR.

Readings that hold

Item Reading
PR shape Draft, base main, Fixes #34604, with no other closing verb. No ! and no (narrowing), so no dogfood battery is owed.
Scope 4 files: ModalForm.tsx (+52/−6), the new modalMaximize.ts, the new modalMaximize-34604.test.tsx and the changeset. All are inside claim 6940534843. mobile-dialog-content.tsx is not touched (the claim allowed it only if needed).
(a) Clause-② condition Labels come from t('detail.maximize') / t('detail.restoreSize'), which exist in all 11 packs (zh-Hans 最大化 / 还原). Only the no-provider English defaults table in ModalForm gains the two entries, and they match en byte for byte. modalMaximize.ts is imported only by ModalForm: index.tsx and core.ts have 0 references to it. ModalFormProps is unchanged, and RecordTopBarButton is an existing @object-ui/components export. No spec key.
(b) Both arms, form stays mounted {maximizeButton} is the last child of both MobileDialogContents (subforms arm and flat arm). Toggling changes only sizeClass / heightClass / data-maximized on the same content node, with no key. Pinned by element identity: the same dialog node and the same input element across two toggles, in both arms. Ablation 2 (adding key={maximized…}) turns the two flat identity tests red. Typed values and an added master-detail line survive.
(c) Columns effectiveModalSize returns 'full' first when maximized, and undeclaredColumns = dialogUndeclaredColumns(layoutFieldCount, effectiveModalSize) reads it. Pinned: 16 undeclared fields read 3 per row at @4xl in the inferred xl, 4 maximized, 3 restored. Ablation 1 (no override) turns 10/10 red.
(d) #34599 discard guard Pinned maximized in both arms: the X still opens "Discard changes?", and the master-detail sticky Save bar (md-form-submit) is still drawn. The guard and attemptClose are not edited.
(e) Merge with #34642 git show --remerge-diff f85988ac: the one conflict is the flat arm's DialogHeader class. It resolves to cn(headerClass, !drawsSectionNav && 'border-b'), keeping #34642's strip-owned rule, with headerClass carrying sm:pr-20 and no border-b. The subforms arm gets cn(headerClass, 'border-b'), so its rule is unchanged. Otherwise the hook call moves above the comment block, with no logic change. Commit 9b6b5b02 pins the nav strip as the same node across two toggles.
Phone and height The switch is hidden sm:inline-flex. heightClass keeps h-[100dvh] on a phone in both states. From sm up, sm:h-auto sm:max-h-[90vh] becomes sm:h-[95dvh] sm:max-h-[95dvh] when maximized, and the author's className / schema.className still come last.
Preference modal-form-maximized:OBJECT in localStorage, with every access in try/catch and a typeof window guard. Restore removes the entry. The render-phase re-seed when objectName changes is the React "adjust state on prop change" pattern. Pinned: the same object reopens maximized, another object does not, restore forgets, a handed-over object takes its own choice, and a throwing Storage keeps the switch working. ui AGENTS.md #8 (per-object preference in local storage) is followed.
Changeset patch on @object-ui/plugin-form, the only published package whose src moved. Each bullet matches the code, including "On a phone … shown from the sm breakpoint up only" and "An authored modalSize is still the size the dialog opens with".
Tests 11 new tests, plus the 236-file / 2636-test package suite on this head, with no existing pin edited (dialogDefaultLayout-12521, modalViewportGutter-12593, modalCloseButton-11061, ObjectForm.mobileFullscreen all unchanged). Type-check exits 0. 38/38 derived gates. The two ablations are restored with git diff HEAD empty.
UI strings No new key; both labels are translated in all 11 packs.
Docs The modalSize description ("Size bucket of the dialog a caller opens this form in", references/ui/view.mdx) and content/docs/frontend/plugins/plugin-form.mdx:90 stay true: the authored size is still the opening size. No page describes the dialog's header chrome, so nothing is made false.
Acceptance 1: maximize keeps the typed values, and restore gives back the previous size class. 2: the subforms arm keeps its lines across toggles. Both are pinned. Not read in a live browser (none claimed).
Tier check-governed-merges --pr 34703: NOT governed, 549 lines. Tier S, lands through o3-B.
CI on this head 52 check-runs: 39 success, 13 skipped, none failed or pending. Test UI 10 planned 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. Escape while maximized runs the close guard, whereas the record drawer's Escape restores first. Declared in the PR, and not asked by the card. If the two surfaces should match exactly, that is a p3 follow-up.
  2. An authored modalSize: 'full' still draws the switch, and there it only lifts the height cap. Declared. It reads as intended.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Landing · area o3-B · 2026-11-17T08:16Z

Probe Reading
L1 ACCEPT 6942536762 at 9b6b5b02646c2173d6e1513db7946872cd8f0ae1 (= current head); one paper-only should-fix (stale ea132c4 readings / "#34642 conflicts" line in the body), not blocking
L2 (Clause-②: no) not required (existing detail.maximize / detail.restoreSize keys reused; modalMaximize.ts is package-internal, no new export)
Checks on head 39 success, 13 skipped, 0 failure / pending; mergeable_state: clean
check-governed-merges.mjs --pr 34703 NOT governed (0 of 4 paths hit the register); 549 changed lines ≤ 3000 (Tier S)
K (first-parent, merge-base..origin/main 77b42a1) 3 < 15; no merge=os-regen path in the diff

State change: ready for review + auto-merge (merge queue). Card #34604 closes on merge via Fixes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 08:16
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit dc66d33 Nov 17, 2026
57 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34604-modal-form-maximize branch November 17, 2026 08:36
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/l 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