Skip to content

fix(app-shell): Studio's form view canvas honours layout horizontal and the other form view keys - #29759

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-n3jojj
Nov 3, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-n3jojj

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #29676

Clause-②: no
Metadata-protocol: none

Claim 6593560214, surface amendment 6593906746.

维护者速读

  • 改了什么:Studio「界面」里打开表单视图时,画布(设计和运行两种模式)现在按视图的 layout 画字段:horizontal 时标签在输入框左侧同一行,vertical 或未设置时标签在上方,和以前一样。画布同时会用上视图的 columns、defaultTab、tabPosition(分页表单)、allowSkip、showStepIndicator(向导表单)。
  • 为什么改:画布拼表单时只拿了 type、sections、fields,其余键全部丢掉。作者在属性面板里选了 horizontal,画布毫无变化,而终端用户的表单页其实已经按 horizontal 画了,两边看到的不一样。
  • 风险与回滚:只改 Studio 画布的显示,不改保存内容,也不改终端用户的表单页。layout 走的是控制台表单宿主自己用的同一个映射(resolveFormViewChrome),所以两边读法一致。回滚即 revert 本 PR。
  • 先看:ViewPreview.tsx 的 buildFormPreviewSchema;新测试 ViewPreview.formLayout-29676.test.tsx。
  • 两分钟验证:在可写包里存一个 config.layout: 'horizontal' 的表单视图并发布,打开 /studio/包ID/interfaces?surface=view:视图名:设计和运行两种模式下,"Project Name" 标签都在输入框左边同一行;手机宽度下仍是上下排列(断点设计如此)。
  • 需要你做的:无,席位落地。

What changes

  • buildFormPreviewSchema (the form view canvas, shared by Studio Design and Run) forwards the form view keys ObjectForm reads. It built the object-form schema from type, sections and fields only, so a view stored with config.layout: 'horizontal' drew every label above its control in Studio while the console's form page drew it beside.
  • layout is read through resolveFormViewChrome, the mapping the console's form hosts (RecordFormPage, the New/Edit modal) already use, so the canvas and the runtime read the key one way. Only its layout is taken: the canvas draws no submit or cancel and seeds no create values.
  • columns, defaultTab, tabPosition, allowSkip and showStepIndicator are passed as authored, as RecordFormPage passes them: columns to the field grid, defaultTab / tabPosition to the tabbed layout, allowSkip / showStepIndicator to the wizard. A tabbed view now opens on its authored tab in Studio.
  • title and description are deliberately not forwarded. Measured in @object-ui/plugin-form: only DrawerForm, ModalForm and MasterDetailForm read schema.title / schema.description. The canvas folds drawer / modal to simple (toInlineFormType), and simple, tabbed and wizard read neither key, so forwarding them would be a pin on a value nothing draws. Drawing a form's heading and description on the canvas would need new canvas markup, so it is listed under Acceptance notes rather than done here.
  • buildFormPreviewSchema is now a named export, so the test can pin it directly. No other module reads it. It adds one react-refresh/only-export-components warning of the same kind the file's existing resolveObjectName export carries.
  • The renderer's horizontal branch (components/src/renderers/form/form.tsx, console forms: form-view keys that save and publish are not rendered — buttons, layout: "horizontal", drawerSide / drawerWidth; defaults apply only on the full-page /new; a tabbed form with subforms loses defaultTab / tabPosition #26843) is unchanged; it was already correct.

Why

Studio's form view inspector offers Layout, so an author could pick horizontal, publish it, and see nothing change on the canvas, even though end users got it (#29672 acceptance[1]). Declared and enforced at runtime, but misdrawn where it is authored.

Tests

ViewPreview.formLayout-29676.test.tsx (new, real ViewPreview, @object-ui/plugin-form registered):

  • horizontal draws the field item with the renderer's label-column grid (sm:grid plus the two-column template) in Run, in Design (editing), and on a tabbed view.
  • CONTROL: vertical and no layout draw the stacked item, with no sm:grid.
  • The built schema carries layout through the console hosts' mapping (horizontal kept, vertical kept, unset becomes the renderer default vertical), and carries columns, defaultTab, tabPosition, allowSkip and showStepIndicator as authored.
  • CONTROL: unauthored keys stay unset, and the canvas still draws no submit or cancel (mode: 'create').
  • defaultTab: 'details' opens the Details tab on the drawn tabbed form (aria-selected).

Acceptance notes

Verification

Live, on the showcase (dev --fresh, Vite source console, scratch package over REST)

Three published form views on showcase_project (layout: horizontal, vertical, unset), each with one two-column section (Project Name, Status). Label and control positions from getBoundingClientRect at 1440 px, x,y in px:

surface view before (c76cdeb) after (623f76a)
Studio Design horizontal label 274,282 · control 274,300 (stacked, no grid) label 274,290 · control 450,276 (beside, grid)
Studio Run horizontal label 274,282 · control 274,300 (stacked) label 274,290 · control 450,276 (beside)
Studio Design / Run vertical, unset label 274,282 · control 274,300 unchanged
console /forms/NAME horizontal label 429,191 · control 605,177 (beside) unchanged
console /forms/NAME vertical, unset label 429,177 · control 429,197 unchanged

The label's y sits inside the control's height because the grid aligns the label on the control's first text line (items-baseline). At 390 px the horizontal view stacks on both surfaces (Studio label 34,351 · control 34,369; console label 33,165 · control 33,185).

Ablations (ablation-replace.mjs on 623f76a, src-resolved; each restored blob == HEAD, git diff HEAD empty)
  • A: layout: resolveFormViewChrome( replaced by layout: undefined && resolveFormViewChrome( gives 4 failed / 5 passed (the three horizontal renders and the layout schema pin).
  • B: defaultTab: body.defaultTab, replaced by defaultTab: undefined, gives 2 failed / 7 passed (the schema pin and the drawn tab).
  • C: columns: body.columns, replaced by columns: undefined, gives 1 failed / 8 passed.
Local runs
  • New file: 9/9 tests passed (623f76a).
  • Neighbour sweep, every ui test file naming ViewPreview or resolveFormViewChrome (18 files, locked, 2 workers): 443 tests passed (1718156).
  • turbo run type-check --filter=@object-ui/app-shell: 65/65 (623f76a).
  • eslint on the touched files: 0 errors.
  • dispatch-gates --commands derived 35 commands; all 35 exit 0 (1718156), incl. check-sdui-manifest and its self-test, check:type-check-debt (locked), and pnpm --dir ui exec vitest run scripts/ (170 files passed, 2 skipped, at --maxWorkers=2). --ran reconciliation 35/35, 0 NOT-MEASURED.
  • After merging origin/main again (0d3b9c0, 9 commits, none touching these files; rebuilt 118/118): the 18-file neighbour sweep, 443 tests passed, and the app-shell type-check, 65/65.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (eslint on the touched files, 0 errors; the repo-wide lint is CI's.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (Not touched.)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QsR2jSTfFyWwerNYfs13mT


Generated by Claude Code

The form view preview built its object-form schema from type, sections
and fields and dropped layout, so a horizontal view drew stacked in
Studio Design and Run. Forward it; vertical and absent are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSTfFyWwerNYfs13mT
Read layout through resolveFormViewChrome, the console form hosts'
mapping, and pass columns, defaultTab, tabPosition, allowSkip and
showStepIndicator as the record page does. Pin each on the built
schema and defaultTab on the drawn tab strip.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSTfFyWwerNYfs13mT
@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 3, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#3 · zhuangjianguo · session_01QsR2jV4dWohojjbTJTQq5m

席位核对 · ACCEPT · 2026-11-03T03:55Z

Head-sha: 0d3b9c05a870a778a4f93cbc533b8617a0bbde85

  • Shape: draft → main, Fixes #29676. 3 files, +220 / −2. No governed path: check-governed-merges --pr 29759 reports NOT governed. Clause-②: no and Metadata-protocol: none are line-initial in the body and in the changeset (patch for @object-ui/app-shell), as claimed in 6593560214 and amended in 6593906746.
  • Contract review: none owed (Clause-②: no). buildFormPreviewSchema is newly exported from a module that is not a package entry, and only its pin reads it.
  • File surface: inside the claim as amended: previews/ViewPreview.tsx, the new test ViewPreview.formLayout-29676.test.tsx, and the changeset.
  • Read in the diff:
  • Tests (dev):
    • 9 cases: horizontal reaches the item grid, and each forwarded key is pinned on the built schema. defaultTab is also pinned on the drawn tab strip. CONTROLs: vertical and absent.
    • Ablations: layout gives 4 red, defaultTab 2 red, columns 1 red.
    • 18 neighbouring files are green (443 tests), the app-shell type-check passes, and 35 of 35 derived gates exit 0.
  • Measured (dev): live at 1440 px. With horizontal, Design and Run draw the label at (274, 290) beside the control at (450, 276); before, they were stacked at (274, 282) / (274, 300). Vertical and unset are unchanged, and 390 px stacks by design. Shots and script: /mnt/project-files/issue-29676/. Report: 6594866548.
  • Noted, not blocking: exporting a function from a component module adds one react-refresh/only-export-components warning.
  • Gates (check-runs on this head): 44 success, 11 skipped (opt-in and schedule gates), 0 failed, 0 pending.
  • Landing: ordinary queue landing, pr_ready then automerge_enable.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 3, 2026 03:56
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 3, 2026 03:56
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 7ba8b11 Nov 3, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-n3jojj branch November 3, 2026 04:09
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.

view form: layout horizontal is stored and served, but the label stays above the input

1 participant