A2UI v0.8
A2UI v0.8
通用属性参考:通用属性
Box 组件作为容器,用于管理 Card 实例和命令分发。
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| children | 子元素 | React.ReactNode | - | - |
| components | 自定义组件映射,组件名称必须以大写字母开头 | Record<string, React.ComponentType<any>> | - | - |
| commands | A2UI 命令对象 | A2UICommand_v0_9 | XAgentCommand_v0_8 | - | - |
| onAction | Card 内部组件触发 action 时的回调函数 | (payload: ActionPayload) => void | - | - |
Card 组件用于渲染单个 Surface。
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| id | Surface ID,对应命令中的 surfaceId | string | - | - |
action 事件的数据结构。
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| name | 事件名称 | string | - | - |
| surfaceId | 触发该 action 的 surfaceId | string | - | - |
| context | 当前 surface 的完整 dataModel 快照 | Record<string, any> | - | - |
v0.8 版本的命令类型,支持以下命令:
更新 Surface 上的组件。
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| surfaceUpdate.surfaceId | Surface ID | string | - | - |
| surfaceUpdate.components | 组件列表 | ComponentWrapper_v0_8[] | - | - |
v0.8 版本的组件包装结构。
interface ComponentWrapper_v0_8 {id: string;component: {[componentType: string]: {child?: string;children?: string[] | ExplicitList;[key: string]: any | PathValue | LiteralStringValue;};};}
interface ExplicitList {explicitList: string[];}
更新数据模型(v0.8 格式)。
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| dataModelUpdate.surfaceId | Surface ID | string | - | - |
| dataModelUpdate.contents | 数据内容列表 | Array<{ key: string; valueMap: Array<{ key: string; valueString: string }> }> | - | - |
开始渲染。
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| beginRendering.surfaceId | Surface ID | string | - | - |
| beginRendering.root | 根组件 ID | string | - | - |
删除 Surface。
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| deleteSurface.surfaceId | Surface ID | string | - | - |
数据绑定路径对象。
interface PathValue {path: string;}
字面字符串值对象(v0.8 特有)。
interface LiteralStringValue {literalString: string;}