@hzab/form-render 1.7.16 → 1.7.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
+ # @hzab/form-render@1.7.18
2
+
3
+ feat: 添加 afterUpload 函数
4
+
5
+ # @hzab/form-render@1.7.17
6
+
7
+ feat: previewConfig 预览相关配置
8
+
1
9
  # @hzab/form-render@1.7.16
2
10
 
3
- fix: 增加带描述和支持单个option禁用的radio和checkbox组件
11
+ fix: 增加带描述和支持单个 option 禁用的 radio checkbox 组件
4
12
 
5
13
  # @hzab/form-render@1.7.15
6
14
 
package/README.md CHANGED
@@ -8,8 +8,40 @@ formily schema 表单渲染组件
8
8
 
9
9
  - antd 组件样式需要手动引入
10
10
 
11
+ ## 自研组件
12
+
13
+ | x-component | 说明 | 文档 |
14
+ | ----------- | ---- | ---- |
15
+ | Upload | 文件上传(OSS / 私有化等) | [README](docs/components/Upload.md) |
16
+ | LocationPicker | 地图选点 | [README](docs/components/LocationPicker.md) |
17
+ | LocationListPicker | 多地址 / 点位列表选择 | [README](docs/components/LocationListPicker.md) |
18
+ | RichEditor / Editor | 富文本编辑器 | [README](docs/components/RichEditor.md) |
19
+ | TreeCheckbox | 树形多选复选框 | [README](docs/components/TreeCheckbox.md) |
20
+ | UserSelect | 人员下拉(本地 options) | [README](docs/components/UserSelect.md) |
21
+ | PersonnelSelect / RemoteSelect | 远程人员搜索下拉 | [README](docs/components/PersonnelSelect.md) |
22
+ | DatePicker | 日期选择(含 RangePicker 拆分字段) | [README](docs/components/DatePicker.md) |
23
+ | RadioGroupWithTip | 带描述的单选 | [README](docs/components/RadioGroupWithTip.md) |
24
+ | CheckboxWithTip | 带描述的多选 | [README](docs/components/CheckboxWithTip.md) |
25
+ | ArrayTable | 自增表格 | [README](docs/components/ArrayTable.md) |
26
+ | ArrayCards | 自增卡片 | [README](docs/components/ArrayCards.md) |
27
+ | Text | 只读文本展示 | [README](docs/components/Text.md) |
28
+
29
+ 内置 antd / c-formily-antd 组件(Input、Select、FormGrid 等)通过 `FormRender` 注册,Schema 约定见下方 Schema 章节。
30
+
11
31
  ## 示例
12
32
 
33
+ 本地文档站(antd 风格):左侧组件列表,组件页上方为 Demo、下方为 API。
34
+
35
+ ```bash
36
+ npm run dev
37
+ ```
38
+
39
+ 打开 http://localhost:3000 (HashRouter,路径形如 `/#/components/upload`):
40
+
41
+ - `/#/` 组件总览
42
+ - `/#/components/*` 各组件 Demo + API
43
+ - `/#/lab/*` 综合 / 场景示例
44
+
13
45
  #### 项目初始化时挂载全局组件
14
46
 
15
47
  ```jsx
@@ -137,7 +169,7 @@ import FormRender from "@hzab/form-render";
137
169
 
138
170
  ## API
139
171
 
140
- ### InfoPanel Attributes
172
+ ### FormRender Attributes
141
173
 
142
174
  | 参数 | 类型 | 必填 | 默认值 | 说明 |
143
175
  | ------------------ | -------- | ---- | ---------- | ------------------------------------------------------------------------------------------ |
@@ -159,6 +191,29 @@ import FormRender from "@hzab/form-render";
159
191
  | ---- | --------- | -------------- |
160
192
  | init | form 实例 | 组件初始化执行 |
161
193
 
194
+ ### 全局配置(缩略图 / 预览域名)
195
+
196
+ 项目初始化时可配置上传预览相关全局参数(见 `src/globalConfig.ts`):
197
+
198
+ ```js
199
+ import {
200
+ setFormRenderPCGlobalServeConfig,
201
+ setFormRenderPCGlobalServeConfigs,
202
+ getFormRenderPCGlobalServeConfig,
203
+ } from "@hzab/form-render/src/globalConfig";
204
+
205
+ // 设置单个配置
206
+ setFormRenderPCGlobalServeConfig("serverUrl", "/api/v1/user/oss/getWebOssConfig");
207
+
208
+ // 批量设置
209
+ setFormRenderPCGlobalServeConfigs({
210
+ serverUrl: "/api/v1/user/oss/getWebOssConfig",
211
+ // 其他如缩略图相关配置
212
+ });
213
+
214
+ getFormRenderPCGlobalServeConfig();
215
+ ```
216
+
162
217
  ### Schema
163
218
 
164
219
  - 使用 表单编辑器生成:https://designable-antd.formilyjs.org/
@@ -231,14 +286,18 @@ import FormRender from "@hzab/form-render";
231
286
 
232
287
  ## 文件目录
233
288
 
234
- - example 本地测试代码
289
+ - example 本地 demo / 手工测试页面
235
290
  - src 组件源码
291
+ - docs 组件文档
292
+ - tests 单元测试
236
293
 
237
294
  ## 命令
238
295
 
239
- - 生成文档:npm run docs
240
296
  - 本地运行:npm run dev
241
297
  - 打包编译:npm run build
298
+ - 单元测试:npm test
299
+ - 测试监听:npm run test:watch
300
+ - 测试覆盖率:npm run test:coverage
242
301
 
243
302
  ## 发布
244
303
 
package/docs/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # 组件文档
2
+
3
+ 自研表单组件说明,与源码目录分离,位于仓库根目录 `docs/`。
4
+
5
+ | 组件 | 文档 |
6
+ | ---- | ---- |
7
+ | Upload | [Upload.md](./components/Upload.md) |
8
+ | LocationPicker | [LocationPicker.md](./components/LocationPicker.md) |
9
+ | LocationListPicker | [LocationListPicker.md](./components/LocationListPicker.md) |
10
+ | RichEditor | [RichEditor.md](./components/RichEditor.md) |
11
+ | TreeCheckbox | [TreeCheckbox.md](./components/TreeCheckbox.md) |
12
+ | UserSelect | [UserSelect.md](./components/UserSelect.md) |
13
+ | PersonnelSelect | [PersonnelSelect.md](./components/PersonnelSelect.md) |
14
+ | DatePicker | [DatePicker.md](./components/DatePicker.md) |
15
+ | RadioGroupWithTip | [RadioGroupWithTip.md](./components/RadioGroupWithTip.md) |
16
+ | CheckboxWithTip | [CheckboxWithTip.md](./components/CheckboxWithTip.md) |
17
+ | ArrayTable | [ArrayTable.md](./components/ArrayTable.md) |
18
+ | ArrayCards | [ArrayCards.md](./components/ArrayCards.md) |
19
+ | Text | [Text.md](./components/Text.md) |
20
+
21
+ FormRender 总览见根目录 [README.md](../README.md)。
@@ -0,0 +1,68 @@
1
+ # ArrayCards
2
+
3
+ 自增卡片列表,基于 Formily ArrayCards,通过 ArrayBase mixin 提供增删改排序子组件。
4
+
5
+ ArrayBase 回调(`onAdd` / `onRemove` / `onSortStart` 等)与导出 hooks 说明见 [ArrayTable README](./ArrayTable.md)。
6
+
7
+ ## Schema 示例
8
+
9
+ ```json
10
+ {
11
+ "type": "array",
12
+ "x-component": "ArrayCards",
13
+ "x-component-props": {
14
+ "title": "卡片"
15
+ },
16
+ "items": {
17
+ "type": "object",
18
+ "properties": {
19
+ "index": { "type": "void", "x-component": "ArrayCards.Index" },
20
+ "name": {
21
+ "type": "string",
22
+ "title": "名称",
23
+ "x-decorator": "FormItem",
24
+ "x-component": "Input"
25
+ },
26
+ "remove": { "type": "void", "x-component": "ArrayCards.Remove" },
27
+ "moveDown": { "type": "void", "x-component": "ArrayCards.MoveDown" },
28
+ "moveUp": { "type": "void", "x-component": "ArrayCards.MoveUp" }
29
+ }
30
+ },
31
+ "properties": {
32
+ "addition": {
33
+ "type": "void",
34
+ "title": "添加条目",
35
+ "x-component": "ArrayCards.Addition"
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ ### ArrayCards Attributes
42
+
43
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
44
+ | --------------------- | -------- | ---- | ------ | ---- |
45
+ | title | ReactNode | 否 | - | 卡片标题(可与 Index 组合) |
46
+ | onAdd | Function | 否 | - | 新增回调 |
47
+ | onCopy | Function | 否 | - | 复制回调 |
48
+ | onRemove | Function | 否 | - | 删除回调 |
49
+ | onMoveDown | Function | 否 | - | 下移回调 |
50
+ | onMoveUp | Function | 否 | - | 上移回调 |
51
+ | deletePopconfirm | boolean | 否 | - | 删除是否二次确认 |
52
+ | deletePopconfirmTitle | Function\|ReactNode | 否 | - | 删除确认文案 |
53
+ | disabled | boolean | 否 | - | 禁用 |
54
+
55
+ 其余 props 透传 antd Card。
56
+
57
+ ### 子组件(x-component)
58
+
59
+ | 名称 | 说明 |
60
+ | -------------------- | ---- |
61
+ | ArrayCards.Index | 序号 |
62
+ | ArrayCards.Remove | 删除 |
63
+ | ArrayCards.Copy | 复制 |
64
+ | ArrayCards.MoveDown | 下移 |
65
+ | ArrayCards.MoveUp | 上移 |
66
+ | ArrayCards.Addition | 新增卡片 |
67
+
68
+ 完整交互示例见 `example/pages/array-base-demo`。
@@ -0,0 +1,111 @@
1
+ # ArrayTable
2
+
3
+ 自增表格,基于 Formily ArrayTable 扩展,支持分页、拖拽排序回调,并通过 ArrayBase mixin 暴露增删改操作子组件。
4
+
5
+ ## Schema 示例
6
+
7
+ ```json
8
+ {
9
+ "type": "array",
10
+ "x-component": "ArrayTable",
11
+ "x-component-props": {
12
+ "onSortStart": "{{onSortStart}}",
13
+ "onSortEnd": "{{onSortEnd}}",
14
+ "deletePopconfirm": true
15
+ },
16
+ "items": {
17
+ "type": "object",
18
+ "properties": {
19
+ "column1": {
20
+ "type": "void",
21
+ "x-component": "ArrayTable.Column",
22
+ "x-component-props": { "title": "排序", "width": 50 },
23
+ "properties": {
24
+ "sort": { "type": "void", "x-component": "ArrayTable.SortHandle" }
25
+ }
26
+ },
27
+ "column2": {
28
+ "type": "void",
29
+ "x-component": "ArrayTable.Column",
30
+ "x-component-props": { "title": "序号", "width": 50 },
31
+ "properties": {
32
+ "index": { "type": "void", "x-component": "ArrayTable.Index" }
33
+ }
34
+ },
35
+ "name": {
36
+ "type": "void",
37
+ "x-component": "ArrayTable.Column",
38
+ "x-component-props": { "title": "名称" },
39
+ "properties": {
40
+ "name": {
41
+ "type": "string",
42
+ "x-decorator": "FormItem",
43
+ "x-component": "Input"
44
+ }
45
+ }
46
+ },
47
+ "operations": {
48
+ "type": "void",
49
+ "x-component": "ArrayTable.Column",
50
+ "x-component-props": { "title": "操作" },
51
+ "properties": {
52
+ "remove": { "type": "void", "x-component": "ArrayTable.Remove" },
53
+ "moveDown": { "type": "void", "x-component": "ArrayTable.MoveDown" },
54
+ "moveUp": { "type": "void", "x-component": "ArrayTable.MoveUp" }
55
+ }
56
+ }
57
+ }
58
+ },
59
+ "properties": {
60
+ "addition": {
61
+ "type": "void",
62
+ "title": "添加条目",
63
+ "x-component": "ArrayTable.Addition"
64
+ }
65
+ }
66
+ }
67
+ ```
68
+
69
+ ### ArrayTable Attributes
70
+
71
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
72
+ | --------------------- | -------- | ---- | ------ | ---- |
73
+ | onAdd | Function | 否 | - | 新增回调 `(index) => void` |
74
+ | onCopy | Function | 否 | - | 复制回调 |
75
+ | onRemove | Function | 否 | - | 删除回调 |
76
+ | onMoveDown | Function | 否 | - | 下移回调 |
77
+ | onMoveUp | Function | 否 | - | 上移回调 |
78
+ | onSortStart | Function | 否 | - | 拖拽排序开始 |
79
+ | onSortEnd | Function | 否 | - | 拖拽排序结束 |
80
+ | deletePopconfirm | boolean | 否 | - | 删除是否二次确认 |
81
+ | deletePopconfirmTitle | Function\|ReactNode | 否 | - | 删除确认文案 |
82
+ | disabled | boolean | 否 | - | 禁用 |
83
+
84
+ 其余 props 透传 antd Table。
85
+
86
+ ### 子组件(x-component)
87
+
88
+ | 名称 | 说明 |
89
+ | ----------------------- | ---- |
90
+ | ArrayTable.Column | 列容器 |
91
+ | ArrayTable.SortHandle | 拖拽排序手柄 |
92
+ | ArrayTable.Index | 行序号 |
93
+ | ArrayTable.Remove | 删除 |
94
+ | ArrayTable.MoveDown | 下移 |
95
+ | ArrayTable.MoveUp | 上移 |
96
+ | ArrayTable.Addition | 新增行 |
97
+
98
+ ### 从 ArrayTable 导出的 API(ArrayBase)
99
+
100
+ 可通过 `ArrayTable`(或直接从包内 ArrayBase 相关导出)使用:
101
+
102
+ | 名称 | 说明 |
103
+ | ------------------- | ---- |
104
+ | useArray | 获取当前 Array 上下文 |
105
+ | useIndex | 获取当前行 index |
106
+ | useRecord | 获取当前行 record |
107
+ | isAdditionComponent | 判断 schema 是否为 Addition 组件 |
108
+ | isColumnComponent | 判断是否为 Column |
109
+ | isOperationsComponent | 判断是否为 Operations |
110
+
111
+ 完整交互示例见 `example/pages/array-base-demo`。
@@ -0,0 +1,43 @@
1
+ # CheckboxWithTip
2
+
3
+ 带描述文案、支持单项禁用的多选组。数据优先取 `dataSource`,否则取 Formily `field.dataSource`(schema `enum`)。
4
+
5
+ ## Schema 示例
6
+
7
+ ```json
8
+ {
9
+ "x-component": "CheckboxWithTip",
10
+ "enum": [
11
+ {
12
+ "label": "人力填报",
13
+ "value": 1,
14
+ "desc": "由人力在后台填报信息。"
15
+ },
16
+ {
17
+ "label": "个人填报",
18
+ "value": 2,
19
+ "desc": "由个人在移动端填报信息。",
20
+ "disabled": true
21
+ }
22
+ ]
23
+ }
24
+ ```
25
+
26
+ ### CheckboxWithTip Attributes
27
+
28
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
29
+ | ---------- | -------- | ---- | ------ | ---- |
30
+ | value | Array | 否 | - | 当前选中值数组 |
31
+ | onChange | Function | 否 | - | 选中变化回调 |
32
+ | dataSource | Array | 否 | field.dataSource | 选项列表,见下表 |
33
+
34
+ 其余 props 透传 antd `Checkbox.Group`。
35
+
36
+ ### dataSource / enum 子项
37
+
38
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
39
+ | -------- | -------------- | ---- | ------ | ---- |
40
+ | label | string | 是 | - | 主标题 |
41
+ | value | string\|number | 是 | - | 选项值 |
42
+ | desc | string | 否 | - | 描述文案 |
43
+ | disabled | boolean | 否 | false | 单项禁用 |
@@ -0,0 +1,54 @@
1
+ # DatePicker
2
+
3
+ 基于 `c-formily-antd` DatePicker 的封装,统一日期格式化;`RangePicker` 支持将起止时间拆分写入同级字段。
4
+
5
+ ## Schema 示例
6
+
7
+ ```json
8
+ {
9
+ "x-component": "DatePicker",
10
+ "x-component-props": {
11
+ "showTime": true
12
+ }
13
+ }
14
+ ```
15
+
16
+ ```json
17
+ {
18
+ "x-component": "DatePicker.RangePicker",
19
+ "x-component-props": {
20
+ "isSplitTimes": true,
21
+ "startKey": "startTime",
22
+ "endKey": "endTime"
23
+ }
24
+ }
25
+ ```
26
+
27
+ ### DatePicker Attributes
28
+
29
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
30
+ | -------- | ------- | ---- | ------ | ---- |
31
+ | format | string | 否 | 按 picker / showTime 推导 | 日期展示与解析格式 |
32
+ | picker | string | 否 | date | `date` / `week` / `month` / `quarter` / `year` |
33
+ | showTime | boolean | 否 | false | 是否显示时间;为 true 时默认 format 为 `YYYY-MM-DD HH:mm:ss` |
34
+
35
+ 未传 `format` 时的默认值:
36
+
37
+ | picker / showTime | 默认 format |
38
+ | ----------------- | ----------- |
39
+ | month | `YYYY-MM` |
40
+ | quarter | `YYYY-\QQ` |
41
+ | year | `YYYY` |
42
+ | week | `gggg-wo` |
43
+ | showTime=true | `YYYY-MM-DD HH:mm:ss` |
44
+ | 其他 | `YYYY-MM-DD` |
45
+
46
+ ### DatePicker.RangePicker Attributes
47
+
48
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
49
+ | ------------ | ------- | ---- | ----------- | ---- |
50
+ | isSplitTimes | boolean | 否 | false | 为 true 时,将起止时间写入同级 `startKey` / `endKey` 字段 |
51
+ | startKey | string | 否 | startTime | 拆分后的开始时间字段名 |
52
+ | endKey | string | 否 | endTime | 拆分后的结束时间字段名 |
53
+
54
+ 嵌套在 `ArrayTable` / `ArrayCards` 内时,拆分结果写入当前行(父级)对象。
@@ -0,0 +1,41 @@
1
+ # LocationListPicker
2
+
3
+ 多地址 / 点位列表选择器,基于高德地图,支持点位与多边形绘制。
4
+
5
+ ## 使用前安装依赖
6
+
7
+ ```bash
8
+ npm install @amap/amap-jsapi-loader
9
+ ```
10
+
11
+ ## Schema 示例
12
+
13
+ ```json
14
+ {
15
+ "x-component": "LocationListPicker",
16
+ "x-component-props": {
17
+ "hasPoint": true,
18
+ "hasPolygon": false,
19
+ "isAutoSearch": true
20
+ }
21
+ }
22
+ ```
23
+
24
+ ### LocationListPicker Attributes
25
+
26
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
27
+ | -------------- | -------- | ---- | ------ | ---- |
28
+ | value | Array | 否 | - | 地址列表数据 |
29
+ | readOnly | boolean | 否 | false | 只读 |
30
+ | disabled | boolean | 否 | false | 禁用 |
31
+ | hasPoint | boolean | 否 | true | 是否支持新增点位 |
32
+ | hasPolygon | boolean | 否 | false | 是否支持新增多边形 |
33
+ | isAutoSearch | boolean | 否 | - | 搜索框是否自动搜索 |
34
+ | listProps | Object | 否 | - | 左侧地址列表区域配置 |
35
+ | popupProps | Object | 否 | - | 弹层 / 编辑弹窗配置 |
36
+ | ItemRender | Function | 否 | - | 自定义列表项渲染 |
37
+ | markerIconConf | Object | 否 | - | marker 图标配置 |
38
+ | loading | boolean | 否 | false | 加载态 |
39
+ | onChange | Function | 否 | - | 列表变化回调 |
40
+
41
+ 表单值一般为地址对象数组(组件会为缺失项自动补 `id`)。
@@ -0,0 +1,67 @@
1
+ # LocationPicker
2
+
3
+ 地图选点组件,基于高德地图。支持弹窗 / 内嵌展示,以及点、线、面绘制。
4
+
5
+ ## 使用前安装依赖
6
+
7
+ ```bash
8
+ npm install @amap/amap-jsapi-loader
9
+ ```
10
+
11
+ ## 注意事项
12
+
13
+ - `isObjectRes` 在 `@hzab/form-render@0.5.0` 版本中去除,结果全部存放在对象中
14
+ - `changeMode` 在 `@hzab/form-render@0.5.1` 版本中去除,仅允许点击地图选点
15
+
16
+ ## Schema 示例
17
+
18
+ ```json
19
+ {
20
+ "x-component": "LocationPicker",
21
+ "x-component-props": {
22
+ "mode": "dialog",
23
+ "hasSearch": true,
24
+ "lonKey": "longitude",
25
+ "latKey": "latitude",
26
+ "addrKey": "address"
27
+ }
28
+ }
29
+ ```
30
+
31
+ 独立使用:
32
+
33
+ ```jsx
34
+ import { LocationPicker } from "@hzab/form-render/src/components";
35
+
36
+ export default function Demo() {
37
+ return <LocationPicker mode="dialog" hasSearch />;
38
+ }
39
+ ```
40
+
41
+ ### LocationPicker Attributes
42
+
43
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
44
+ | ------------------ | ------- | ---- | --------- | ---- |
45
+ | mode | string | 否 | dialog | 地图显示类型:`dialog` 弹窗、`show` 直接显示 |
46
+ | element | string | 否 | Polypoint | 地图绘制元素:`Polypoint` / `Polyline` / `Polygon` |
47
+ | layout | string | 否 | ver | 选择器与地图布局:`hor` 水平、`ver` 垂直 |
48
+ | hasSearch | boolean | 否 | true | 是否允许搜索 |
49
+ | isAutoFixAddr | boolean | 否 | false | 打开地图时是否根据经纬度自动修正已填地址 |
50
+ | lonKey | string | 否 | longitude | 经度字段 key |
51
+ | latKey | string | 否 | latitude | 纬度字段 key |
52
+ | addrKey | string | 否 | address | 地址字段 key |
53
+ | pointsKey | string | 否 | points | 点位集合字段 key |
54
+ | isAutoSearch | boolean | 否 | true | 搜索框是否自动搜索 |
55
+ | modalConf | Object | 否 | - | 弹窗额外配置 |
56
+ | markerIconConf | Object | 否 | - | marker icon 配置对象 |
57
+ | icons | Object | 否 | - | icon 图片配置,见下表 |
58
+ | getCurPositionConf | Object | 否 | - | `getCurrentPosition` 配置 |
59
+
60
+ #### icons
61
+
62
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
63
+ | ------------ | ------ | ---- | ------ | ---- |
64
+ | markerIcon | string | 否 | - | marker icon 图片地址 |
65
+ | pickerIcon | string | 否 | - | 选点 icon 图片地址或元素 |
66
+ | positionIcon | string | 否 | - | 定位 icon 图片地址或元素 |
67
+ | resetIcon | string | 否 | - | 重置 icon 图片地址或元素 |
@@ -0,0 +1,77 @@
1
+ # PersonnelSelect / RemoteSelect
2
+
3
+ 远程人员搜索下拉框。`PersonnelSelect` 为 Formily `connect` 包装;底层实现为 `RemoteSelect`,支持远程分页加载、搜索与自定义列表项。
4
+
5
+ ## Schema 示例
6
+
7
+ ```jsx
8
+ <FormRender
9
+ schema={schema}
10
+ schemaScope={{
11
+ loadPersonnel(search, pagination) {
12
+ return Promise.resolve({
13
+ list: [{ userId: "1", userName: "张三", phoneNumber: "13800000000" }],
14
+ pagination: { ...pagination, total: 1 },
15
+ });
16
+ },
17
+ }}
18
+ />
19
+ ```
20
+
21
+ ```json
22
+ {
23
+ "x-component": "PersonnelSelect",
24
+ "x-component-props": {
25
+ "mode": "multiple",
26
+ "labelInValue": true,
27
+ "loadData": "{{loadPersonnel}}"
28
+ }
29
+ }
30
+ ```
31
+
32
+ 也可直接使用 `RemoteSelect`:
33
+
34
+ ```json
35
+ {
36
+ "x-component": "RemoteSelect",
37
+ "x-component-props": {
38
+ "mode": "tags",
39
+ "loadData": "{{loadPersonnel}}"
40
+ }
41
+ }
42
+ ```
43
+
44
+ ### Attributes
45
+
46
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
47
+ | ----------------- | -------- | ---- | ------ | ---- |
48
+ | loadData | Function | 是 | - | `(search, pagination) => Promise<{ list, pagination }>` |
49
+ | searchData | Function | 否 | - | 额外查询函数 |
50
+ | mode | string | 是 | - | `multiple` 或多选 tags 模式(`tags`) |
51
+ | labelKey | string | 否 | userName | 列表项 label 字段 |
52
+ | valueKey | string | 否 | userId | 列表项 value 字段 |
53
+ | disabledKey | string | 否 | disabled | 禁用字段 |
54
+ | labelInValue | boolean | 否 | false | 是否以 `{ label, value }` 形式回传 |
55
+ | isClearable | boolean | 否 | false | 下拉收起时是否清空列表缓存 |
56
+ | initialPagination | Object | 否 | `{ pageNum: 1, pageSize: 10 }` | 初始分页 |
57
+ | listItemConfigs | Array | 否 | 姓名/主部门/主驻点/手机号/身份证 | 列表项展示字段配置 `{ label, key }[]` |
58
+ | renderItem | Function | 否 | - | 自定义列表项渲染 |
59
+ | customItemNode | ReactNode\|Function | 否 | - | 自定义列表项中附加节点 |
60
+ | avataProps | Object | 否 | - | antd Avatar props |
61
+ | disabledStyle | Function | 否 | - | `(disabled) => CSSProperties` |
62
+
63
+ 其余 props 透传 antd Select(如 `placeholder`、`disabled`)。
64
+
65
+ ### loadData 返回
66
+
67
+ ```ts
68
+ {
69
+ list: Array<{ label?: string; value?: string | number; [key: string]: any }>;
70
+ pagination: {
71
+ pageNum: number;
72
+ pageSize: number;
73
+ total?: number;
74
+ hasMore?: boolean;
75
+ };
76
+ }
77
+ ```
@@ -0,0 +1,43 @@
1
+ # RadioGroupWithTip
2
+
3
+ 带描述文案、支持单项禁用的单选组。数据优先取 `dataSource`,否则取 Formily `field.dataSource`(schema `enum`)。
4
+
5
+ ## Schema 示例
6
+
7
+ ```json
8
+ {
9
+ "x-component": "RadioGroupWithTip",
10
+ "enum": [
11
+ {
12
+ "label": "单次采集",
13
+ "value": 1,
14
+ "desc": "以人员为单位开展信息采集。"
15
+ },
16
+ {
17
+ "label": "按月采集",
18
+ "value": 2,
19
+ "desc": "以自然月为周期定期采集。",
20
+ "disabled": true
21
+ }
22
+ ]
23
+ }
24
+ ```
25
+
26
+ ### RadioGroupWithTip Attributes
27
+
28
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
29
+ | ---------- | -------------- | ---- | ------ | ---- |
30
+ | value | string\|number | 否 | - | 当前选中值 |
31
+ | onChange | Function | 否 | - | 选中变化回调 |
32
+ | dataSource | Array | 否 | field.dataSource | 选项列表,见下表 |
33
+
34
+ 其余 props 透传 antd `Radio.Group`。
35
+
36
+ ### dataSource / enum 子项
37
+
38
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
39
+ | -------- | -------------- | ---- | ------ | ---- |
40
+ | label | string | 是 | - | 主标题 |
41
+ | value | string\|number | 是 | - | 选项值 |
42
+ | desc | string | 否 | - | 描述文案 |
43
+ | disabled | boolean | 否 | false | 单项禁用 |