cnd-components-mcp
Version:
An MCP service for Cnd components query | 一个减少 Cnd 组件代码生成幻觉的 MCP 服务,包含系统提示词、组件文档、API 文档、代码示例和更新日志查询
56 lines • 9.76 kB
Markdown
---
group:
title: 云原生业务组件
order: 0
---
https://code.alibaba-inc.com/cn-lowcode/cnd-form
CndForm.Item的用法与 xconsole中Form.Item相同,具体参考Form
| 属性 | 说明 | 类型 | 默认值 |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ------- |
| formType | 表单类型 | 'basic' \| 'detail' \| 'group' | 'basic' |
| formProps | 表单属性 | { [key: string]: any } | |
| formItems | 表单项 | [] | |
| dataSource | formType 设置为 group 时,内容分组表单配置数据源 | [{title:分组名称,key:分组 key,fomItems:表单项 formItems[]}] | |
| canCollapse | formType 设置为 group 时, 是否支持折叠 | boolean | false |
| expandKeys | formType 设置为 group,并且 canCollapse 为 true 时,设置默认展开的分组 <br/> 取值为 dataSource 中 key<br/>如果不设置 expandKeys,则默认展开所有分组 | [] | |
> formProps 属性,基于 xconsole 的 Form 组件,新增 title 参数,支持 Form 的所有参数
| 属性 | 说明 | 类型 | 默认值 |
| ----- | -------- | ------------------------- | ------ |
| title | 表单标题 | string \| `React.ReactNode` | |
> formItems 属性,基于 xconsole 的 Form 组件,新增如下参数,其余参数可参考 xconsole 中 Form.Item
| 属性 | 说明 | 类型 | 默认值 |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | --------------------------------- |
| component | 表单子项类型 <br/> 当前支持 input \| textarea \| select \| numberPicker \| datePicker \| radio \| checkbox \| switch \| tag \| upload \| range \| text \| custom <br/> custom 为自定义表单子项内容 <br/> 表单子项类型为 custom 时,subProps 必填,且需包含 children 属性,为自定义的 ReactNode | Enum | |
| subProps | 表单子项本身的属性 | { [key: string]: any } | |
| labelTip | 表单 label 提示信息 | string \| `React.ReactNode` | |
| labelTipProps | label 的 Balloon 属性<br/>包含 icon: 图标类型,size: 图标大小,align: 图标对齐方式 | { icon: string; size: string; align: string } | {icon:'info',size:'xs',align:'t'} |
| subFormItemProps | 嵌套的 FormItem 的属性,仅在需要 FormItem 嵌套时使用,subFormItemProps 中每一项继承了 FormItem 的所有属性 | subFormItemProps[] | |
| subColSpan | 仅设置于嵌套的 FormItem 的属性中,用于确定子 FormItem 的宽度占比<br />仅在 subFormItemProps 中生效 | number | |
| operateProps | 自定义操作按钮属性 | {} | |
| extraHelp | 自定义提示信息 | HelpItemProps[] | |
> operateProps 定义格式如下:
| 属性 | 说明 | 类型 | 默认值 |
| -------- | ------------------------------------------------ | ----------------------------------- | ------ |
| position | 按钮位置,可选值: right \| bottom | Enum |
| actions | 按钮列表,数组项的数据结构见 IActionProps 的 API | [{text:按钮文本,onClick:点击事件}] | |
> HelpItemProps 子项属性定义如下:
| 属性 | 说明 | 类型 | 默认值 |
| ------------ | --------------------------------------------------------------------------- | ------------------------- | ------ |
| content | 提示内容 | string \| `React.ReactNode` |
| hasIcon | 主要用于单行提示时是否需要显示图标, | boolean | false |
| type | 提示类型,可选值: success \| warning \| error \| notice \| help \| loading | Enum |
| isMultiLines | 提示内容是否为多行 | boolean | false |
| canCollapse | 提示内容为多行提示时,是否可以折叠 | boolean | false |
> 参照 xconsole 中的 RcDataFields 组件
| 属性 | 说明 | 类型 | 默认值 |
| ---------- | ---------------------------------------------------------------------- | ---------------------- | ------ |
| formType | 表单类型,详情类表单必填 | string | basic |
| dataSource | 字段列表数据 | { [key: string]: any } | |
| items | 定义要展示哪些字段,以及如何展示。数组项的数据结构见 IItemProps 的 API | IItemProps[] | |
> IItemProps[]每个字段(数组项)的定义格式如下:
| 属性 | 说明 | 类型 | 默认值 |
| --------- | -------------------------------------------------------- | ------------------------- | ------ |
| dataIndex | 字段名,对应 dataSource 中的 key | string | |
| label | 定义字段 label 的展示。如果不指定,则不展示 label 区域 | string \| `React.ReactNode` | |
| span | 字段宽度占比,24 表示占整行 | number | 24 |
| render | 自定义渲染函数,接收当前字段的值作为参数,返回 ReactNode | (value: any) => ReactNode | |