feat(detail): 详情页支持对象 fieldGroups 分组 + 详情提示迁移到 spec 可写的 detail.* 块 (#2148)#2149
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Contributor
|
感谢这个 PR——问题一/问题二的诊断和 fieldGroups 推导的实现质量都很高,尤其是"先修 spec 可写通道、再接线"的施工顺序。评审过程中我们把整个 hints 面向上追了一层,最终落成了协议级决定 ADR-0085(已合并,framework#2520;spec 执行 PR framework#2521 已开):对象的展示意图只以跨 surface 语义角色声明( 保留(核心价值,约 80% 不动)
调整
两个不阻塞本 PR 的后续(已有跟踪):spec 侧新增了单源推导 合并前建议起 showcase 对一个声明了 fieldGroups 的对象做一轮浏览器验证(分组卡片/折叠/ |
This was referenced Jul 2, 2026
…s from spec-writable detail.* block (#2148) 问题一: 对象上定义的 fieldGroups(字段分组)此前只在表单里生效, 详情页(默认详情 + synth 页面)完全忽略。现在: - plugin-detail synth 新增 deriveFieldGroupDetailSections():按声明顺序 把 fields[].group 归入 fieldGroups[] 定义的分组,透传 collapsible/ collapsed(映射为 defaultCollapsed),空分组丢弃,未分组字段进末尾 无标题分区(跳过审计/系统字段,显式分组的审计字段保留)。 - 新增 resolveDetailSections():options.sections > detail.sections > fieldGroups 推导;buildDefaultDetails 全部 synth 路径接入。 - RecordDetailView 复用该推导:分组标题走 sectionLabel i18n,未分组 剩余字段保留 primary/"更多详情" 折叠拆分。 问题二: console 此前从 spec ObjectSchema 拒绝/剥离的键读取详情提示 (views.detail.highlightFields / views.form.sections / 顶层 stageField)。 现在优先读 spec 可写的 detail.* 透传块,旧键保留为向后兼容回退: - detail.stageField: string 指定 / false 关闭(收编 #2065) - detail.highlightFields: 支持 string 或 {name} 条目 - detail.sections / detail.sectionGroups - detail.useFieldGroups: false 可关闭 fieldGroups 推导 行为变化: 已声明 fieldGroups 的对象,详情页从自动两段式变为按分组 渲染;可用 detail.useFieldGroups: false 退回旧行为。 抽屉(RecordDetailDrawer)分组渲染留待后续 PR,见 #2148。
5 tasks
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.
关联 #2148,同时收编 #2065(
detail.stageField: false关闭阶段条)。问题一:字段分组在详情页不生效
对象上定义的
fieldGroups[]+fields[].group(设计器里的"字段分组")此前只有表单在用(plugin-form 的deriveFieldGroupSections),默认详情页和 synth 详情页完全忽略,全部字段被自动拆成"主要字段 + 更多详情"两段。改动:
plugin-detailsynth 新增导出deriveFieldGroupDetailSections(def):按fieldGroups声明顺序分桶fields[].group,语义对齐 plugin-form——空的已声明分组丢弃、collapsible/collapsed透传(collapsed映射为 DetailSection 的defaultCollapsed)、未分组字段进末尾无标题分区。未分组桶跳过审计/系统字段(created_at、updated_by、tenant_id等,与 app-shell 的 AUDIT+HIDDEN 集合完全一致);显式归入某分组的审计字段保留(显式声明优先,与手写 sections 语义一致)。resolveDetailSections(def, sections?)统一优先级,buildDefaultDetails接入,所以所有 synth 消费方(默认详情页、Studio 预览、metadata-admin)自动获得分组分区。RecordDetailView复用同一推导:命名分组标题走sectionLabeli18n 约定({ns}.objects.{objectName}._sections.{key}.label),未分组剩余字段仍保留 primary/"更多详情" 折叠拆分,不破坏现有"更多详情"按钮体验。分区来源优先级: 显式 sections(
detail.sections??views.form.sections)>fieldGroups推导 > 自动两段式兜底。问题二:详情提示写在 spec 不认的键上
console 此前从
views.detail.highlightFields、views.form.sections、顶层stageField读取提示,但@objectstack/spec的ObjectSchema.create()对这些键直接抛错、safeParse静默剥离——即用户按文档写了也到不了运行时。spec 里顶层detail块是 passthrough(可写),所以:detail.*:detail.stageField(string 指定 /false关闭,详情页:支持 detail.stageField: false 显式关闭自动状态进度条 #2065)、detail.highlightFields(支持string或{name}条目,畸形条目丢弃)、detail.sections、detail.sectionGroups、detail.useFieldGroups: false(关闭 fieldGroups 推导的逃生门)。views.*、顶层stageField/highlightFields)全部保留为回退,零破坏。已声明
fieldGroups的对象,详情页会从自动两段式变为按分组渲染。逃生门:detail: { useFieldGroups: false }。测试
deriveFieldGroupDetailSections各分支、resolveDetailSections优先级、buildDefaultPageSchema集成含detail.stageField: false去掉 record:path),全部通过;synth 定向套件 73/73。turbo type-check(plugin-detail + app-shell)通过;turbo build(两条依赖链 29 个任务)通过。components/dist解析失败——已用git stash在干净树上复现同样 7 个套件失败,属预置环境问题,与本次改动无关。后续(不在本 PR)
RecordDetailDrawer)的分组渲染,见 详情侧字段分组(对象 fieldGroups)未接线 + 详情 UI hints 读取键与 spec 校验层不一致 #2148。detail.highlightFields/detail.stageField/detail.sections收进强类型(详情侧字段分组(对象 fieldGroups)未接线 + 详情 UI hints 读取键与 spec 校验层不一致 #2148 待确认 Q7)。Closes #2065