fix(form): 新建/编辑弹窗渲染对象字段分组;分组表单自动布局对齐平铺路径#2154
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
…t parity for grouped ObjectForm (#2152) ModalForm ignored the object's fieldGroups designer metadata entirely — the global create modal rendered grouped objects as one flat field pile. ObjectForm's grouped path bypassed applyAutoLayout: no system-field filtering, always single column, hairline group titles on an endlessly scrolling form. - ModalForm: when no explicit sections/customFields are passed, derive sections from objectSchema.fieldGroups + field.group (same deriveFieldGroupSections as ObjectForm), with flat-path auto-layout parity: system/auto-generated fields filtered, columns inferred from field count, wide fields spanning the row, modal size auto-upgraded for multi-column. Explicit curated sections always win. - The derived groups render as ONE form with virtual section-divider fields (DrawerForm's pattern) — NOT one SchemaRenderer per section. Per-section renderers create N <form> elements sharing the footer button's form id, so only the first section's values ever submit (verified live: group 2's required status showed a value in the UI but was absent from the POST body → VALIDATION_FAILED). That latent flaw still affects the explicit-sections path; tracked in #2153. - ModalForm's flat field builder now carries Field.group so derivation sees group membership; section headers go through sectionLabel i18n. - ObjectForm grouped path: filter system/auto-generated fields, infer columns, applyAutoColSpan, container-query grid — matching the flat path. Verified against a real console (:5180) + real hotcrm backend (:4001): crm_campaign_member (fieldGroups, no form view) modal now shows both group headers in a 2-column xl dialog, and a cross-group create submits all values (record persisted, POST body contains every group's fields). crm_lead's explicit "Quick Lead Creation" view renders and submits unchanged. plugin-form: 155/155 tests, type-check green. Closes #2152
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2152. 相关存量缺陷:#2153。
问题
对象声明了
fieldGroups[]+fields[].group后:修复
ModalForm(核心)
sections/customFields时,从objectSchema.fieldGroups+field.group推导分组(复用deriveFieldGroupSections),并做与平铺路径完全对等的自动布局:过滤系统/自动生成字段、按字段数推断列数、宽字段(textarea/markdown 等)跨整行、多列时弹窗自动升级为 xl 宽度。显式 form view sections 永远优先,行为不变。section-divider标题字段(DrawerForm 同款模式),所有分组共享一个 react-hook-form 实例。不能复用现有 sections 渲染:那条路径是"每 section 一个<form>"且共享formId,提交按钮只关联第一个 form,第 2+ 组的值静默丢失(实测:第二组必填status界面已选值、POST body 缺失 → 后端 VALIDATION_FAILED)。该存量缺陷波及显式多 section 弹窗,另在 ModalForm 显式多 section 表单:每个 section 独立 <form>,提交时丢弃第 2+ 个 section 的值 #2153 跟踪。Field.group;分组标题走sectionLabeli18n。ObjectForm 分组路径
applyAutoColSpan、容器查询网格类。真实环境验证(console dev :5180 + hotcrm 后端 :4001,非 app-shell)
crm_campaign_member(声明 basic/response 两个 fieldGroups、无 form view):status,后端 400。{"crm_campaign":…,"crm_lead":…,"status":"sent"},记录入库、列表可见、无 console 报错。crm_lead显式 "Quick Lead Creation" form view —— 渲染(卡片、双列)与提交行为均不变;单<form>。:objectName/new(ObjectForm 分组路径):分组标题 + 双列,系统字段不再出现。测试
modalFieldGroups.test.tsx:分组标题渲染、单<form>结构断言、跨组提交 payload 断言(钉死 ModalForm 显式多 section 表单:每个 section 独立 <form>,提交时丢弃第 2+ 个 section 的值 #2153 那类丢数据回归)、显式 sections 优先。备注