mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-25 08:52:58 +00:00
契约骨架补充:运行路径上的能力登记函数给出和今天一致的默认实现(并行开发互不卡住),build_tools 加 allow_write 参数;前端补 ViewRenderer、PrincipalPicker 的接口桩和按草稿预览的参数
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 视图渲染器:按服务端解析好的视图模型(agentlab.view/1)渲染应用页(FE-5 实现)。
|
||||
*
|
||||
* 前端只有一张「组件名 → 渲染器」的表;不认识的组件显示「此组件需要更新前端」,不报错、不空白。应用编辑器的预览
|
||||
* (FE-6)也用它:传 draft 解析出的视图模型即可。契约骨架里只有接口和最简实现,props 不变。
|
||||
*/
|
||||
import type { ViewModel, ViewNode } from '../typesApp'
|
||||
|
||||
export interface ViewRendererProps {
|
||||
model: ViewModel
|
||||
appId: string
|
||||
/** 实例页传入:组件里的待办、动作、进度按这个实例解析 */
|
||||
runId?: string
|
||||
/** 预览:不发起运行、不提交表单,点数字照样能看出处 */
|
||||
preview?: boolean
|
||||
/** 页内跳转(页签、页面链接) */
|
||||
onNavigate?: (pageId: string) => void
|
||||
/** 视图刷新、实例发起之后要重新取视图模型 */
|
||||
onReload?: () => void
|
||||
}
|
||||
|
||||
export function ViewRenderer({ model }: ViewRendererProps) {
|
||||
const walk = (nodes: ViewNode[]) => nodes.map((n) => (
|
||||
<div key={n.id} data-component={n.type}>{n.children && walk(n.children)}</div>
|
||||
))
|
||||
return <div>{walk(model.tree)}</div>
|
||||
}
|
||||
Reference in New Issue
Block a user