@hzab/form-render 1.7.17 → 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 | 单项禁用 |
@@ -0,0 +1,94 @@
1
+ # RichEditor
2
+
3
+ 基于 wangEditor 的富文本编辑器,支持 OSS / 私有化上传。Schema 中可使用 `RichEditor` 或别名 `Editor`。
4
+
5
+ ## PC 使用前安装依赖
6
+
7
+ ```bash
8
+ npm install @wangeditor/editor-for-react
9
+ ```
10
+
11
+ ## Schema 示例
12
+
13
+ ```json
14
+ {
15
+ "x-component": "RichEditor",
16
+ "x-component-props": {
17
+ "height": "400px",
18
+ "uploadMode": "oss",
19
+ "toolbarConfig": {},
20
+ "editorConfig": {
21
+ "placeholder": "请输入内容..."
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ 独立使用:
28
+
29
+ ```jsx
30
+ import { RichEditor } from "@hzab/form-render/src/components";
31
+ import { useRef } from "react";
32
+
33
+ export default function Demo() {
34
+ const editorRef = useRef();
35
+ return <RichEditor ref={editorRef} height="400px" />;
36
+ }
37
+ ```
38
+
39
+ 向富文本 set 内容:`editorRef.current.setEditorContent(HtmlString)`
40
+
41
+ 获取富文本当前内容:`editorRef.current.getEditorContent()`
42
+
43
+ ### RichEditor Attributes
44
+
45
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
46
+ | ----------------- | ----------------------- | ---- | ------ | ---- |
47
+ | value | string | 否 | - | 编辑器 HTML 内容 |
48
+ | onChange | Function | 否 | - | 内容变化回调 |
49
+ | height | string | 否 | - | 编辑器高度 |
50
+ | toolbarConfig | Partial\<IToolbarConfig\> | 否 | {} | 工具栏配置 |
51
+ | editorConfig | Partial\<IEditorConfig\> | 否 | `{ placeholder: '请输入内容...' }` | 编辑器配置 |
52
+ | uploadMode | string | 否 | oss | 上传模式:`oss` / `offline` 等 |
53
+ | ossOpt | Object | 否 | - | OSS 上传配置 |
54
+ | uploadParams | Object | 否 | {} | 上传入参 |
55
+ | ossServerUrl | string | 否 | 全局配置或 `/api/v1/user/oss/getWebOssConfig` | 获取 OSS 配置接口 |
56
+ | ossUrl | string | 否 | 同 ossServerUrl | OSS 配置接口(兼容字段) |
57
+ | offlineServerUrl | string | 否 | - | 私有化上传接口 |
58
+ | offlinePreviewUrl | string | 否 | - | 私有化预览前缀 |
59
+ | customRequest | Function | 否 | - | 自定义上传请求 |
60
+ | zIndex | number | 否 | 9999 | 编辑器层级 |
61
+
62
+ 图片上传可在 `editorConfig.MENU_CONF.uploadImage` 中配置,参考 [wangEditor 文档](https://www.wangeditor.com/v5/menu-config.html#upload-image)。
63
+
64
+ ```jsx
65
+ editorConfig = {
66
+ MENU_CONF: {
67
+ uploadImage: {
68
+ server: "/api/upload",
69
+ fieldName: "your-custom-name",
70
+ maxFileSize: 1 * 1024 * 1024,
71
+ maxNumberOfFiles: 10,
72
+ allowedFileTypes: ["image/*"],
73
+ meta: { token: "xxx" },
74
+ headers: { Accept: "text/x-json" },
75
+ withCredentials: true,
76
+ timeout: 5 * 1000,
77
+ },
78
+ },
79
+ };
80
+ ```
81
+
82
+ ## 移动端使用前安装依赖
83
+
84
+ ```bash
85
+ npm install lib-flexible
86
+ ```
87
+
88
+ ```jsx
89
+ import HandleMobile from "./components/handleMobileVw";
90
+
91
+ export default function Demo() {
92
+ return <HandleMobile content={HtmlString} />;
93
+ }
94
+ ```
@@ -0,0 +1,26 @@
1
+ # Text
2
+
3
+ 只读文本展示组件,常用于 schema 合并、LocationListPicker 弹层等内部场景;也可在 schema 中直接使用。
4
+
5
+ ## Schema 示例
6
+
7
+ ```json
8
+ {
9
+ "x-component": "Text",
10
+ "x-component-props": {
11
+ "content": "静态文案",
12
+ "mode": "div"
13
+ }
14
+ }
15
+ ```
16
+
17
+ 表单字段有值时优先展示 `value`,否则展示 `content`。
18
+
19
+ ### Text Attributes
20
+
21
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
22
+ | --------- | ------ | ---- | ------ | ---- |
23
+ | value | any | 否 | - | 字段值,优先展示 |
24
+ | content | any | 否 | - | 无 value 时的静态内容 |
25
+ | mode | string | 否 | div | 渲染标签名;`normal` 或不传时为 `div`,也可设为 `span` / `p` 等 |
26
+ | className | string | 否 | - | 附加 class,根节点带 `formily-text` |
@@ -0,0 +1,52 @@
1
+ # TreeCheckbox
2
+
3
+ 树形多选复选框,支持按层级合并叶子节点,以及最外层 Tab 展示。
4
+
5
+ ## Schema 示例
6
+
7
+ ```json
8
+ {
9
+ "x-component": "TreeCheckbox",
10
+ "x-component-props": {
11
+ "mergeLeaf": true,
12
+ "mergeFullLeaf": true,
13
+ "tabBox": false,
14
+ "fieldNames": {
15
+ "label": "label",
16
+ "value": "value",
17
+ "children": "children"
18
+ }
19
+ },
20
+ "enum": [
21
+ {
22
+ "label": "一级",
23
+ "value": "1",
24
+ "children": [
25
+ { "label": "二级-1", "value": "1-1" },
26
+ { "label": "二级-2", "value": "1-2" }
27
+ ]
28
+ }
29
+ ]
30
+ }
31
+ ```
32
+
33
+ 数据也可通过 `x-component-props.dataSource` 或 `field.dataSource` 传入。
34
+
35
+ ### TreeCheckbox Attributes
36
+
37
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
38
+ | ------------- | ------- | ---- | -------------------------------------------------- | ---- |
39
+ | dataSource | Array | 否 | field.dataSource | 树数据 |
40
+ | mergeFullLeaf | boolean | 否 | true | 合并不存在 children 的层级 |
41
+ | mergeLeaf | boolean | 否 | true | 合并每一层级的叶子节点 |
42
+ | fieldNames | Object | 否 | `{ label, value, children }` | 自定义 options 中字段名 |
43
+ | disabled | boolean | 否 | false | 禁用状态 |
44
+ | readOnly | boolean | 否 | false | 只读状态 |
45
+ | tabBox | boolean | 否 | false | 最外层使用 tab |
46
+ | tabConfList | Array | 否 | - | tab 配置列表;存在时优先用于计算 tab 层级数 |
47
+ | tabLevel | number | 否 | - | tab 层级数(`tabBox === true` 时为 1) |
48
+ | labelKey | string | 否 | label | 兼容旧字段,后续废弃 |
49
+ | valueKey | string | 否 | value | 兼容旧字段,后续废弃 |
50
+ | childrenKey | string | 否 | children | 兼容旧字段,后续废弃 |
51
+
52
+ 表单值为选中节点 `value` 组成的数组。
@@ -0,0 +1,59 @@
1
+ # UserSelect
2
+
3
+ 人员下拉选择器,基于 antd Select,支持头像、手机号、身份证号等扩展展示。
4
+
5
+ ## Schema 示例
6
+
7
+ ```json
8
+ {
9
+ "x-component": "UserSelect",
10
+ "x-component-props": {
11
+ "isAvatar": true,
12
+ "avatarSize": "default",
13
+ "configKey": {
14
+ "phoneKey": "phone",
15
+ "idCardKey": "idCard"
16
+ }
17
+ },
18
+ "enum": [
19
+ {
20
+ "label": "张三",
21
+ "value": "1",
22
+ "phone": "13800000000",
23
+ "idCard": "3301**********1234",
24
+ "avatar": "https://example.com/avatar.png"
25
+ }
26
+ ]
27
+ }
28
+ ```
29
+
30
+ 数据源也可通过 Formily `field.dataSource` 或 `x-component-props.options` 传入。
31
+
32
+ ### UserSelect Attributes
33
+
34
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
35
+ | ---------- | -------- | ---- | ------- | ---- |
36
+ | options | Array | 否 | - | 下拉数据;也可使用 schema `enum` / `field.dataSource` |
37
+ | isAvatar | boolean | 否 | false | 是否显示头像 |
38
+ | avatarSize | AvatarSize | 否 | default | antd Avatar 尺寸 |
39
+ | configKey | Object | 否 | - | 自定义字段映射,见下表 |
40
+ | InfoRender | Function | 否 | - | 自定义 option 信息区渲染,入参为 option 对象 |
41
+
42
+ 其余 props 透传 antd Select。
43
+
44
+ ### configKey
45
+
46
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
47
+ | --------- | ------ | ---- | ------ | ---- |
48
+ | phoneKey | string | 否 | phone | 手机号字段名 |
49
+ | idCardKey | string | 否 | idCard | 身份证号字段名 |
50
+
51
+ ### options 子项
52
+
53
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
54
+ | ------ | -------------- | ---- | ------ | ---- |
55
+ | label | string | 是 | - | 展示名称 |
56
+ | value | string\|number | 是 | - | 选项值 |
57
+ | avatar | string | 否 | - | 头像 URL |
58
+ | phone | string | 否 | - | 手机号(可被 configKey 覆盖) |
59
+ | idCard | string | 否 | - | 身份证号(可被 configKey 覆盖) |
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@hzab/form-render",
3
- "version": "1.7.17",
3
+ "version": "1.7.18",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
7
7
  "dev": "webpack serve -c ./config/webpack.config.js --env local",
8
8
  "build": "webpack -c ./config/webpack.config.js --env production",
9
+ "test": "vitest run",
10
+ "test:watch": "vitest",
11
+ "test:coverage": "vitest run --coverage",
9
12
  "version:alpha": "npm version prerelease --preid=alpha",
10
13
  "publish:alpha": "npm publish --tag alpha",
11
14
  "version:beta": "npm version prerelease --preid=beta",
@@ -17,6 +20,7 @@
17
20
  },
18
21
  "files": [
19
22
  "src",
23
+ "docs",
20
24
  "CHANGELOG.md"
21
25
  ],
22
26
  "keywords": [],
@@ -27,16 +31,21 @@
27
31
  "@hzab/permissions": "^0.1.1",
28
32
  "@hzab/utils": "^1.0.16",
29
33
  "@hzab/webpack-config": "0.0.12",
34
+ "@testing-library/jest-dom": "^5.17.0",
35
+ "@testing-library/react": "^12.1.5",
36
+ "@testing-library/user-event": "^13.5.0",
30
37
  "@types/react": "^17.0.62",
31
38
  "@types/react-dom": "^17.0.20",
32
39
  "antd": "^4.24.12",
33
40
  "dayjs": "1.11.10",
34
41
  "eslint": "^8.30.0",
42
+ "jsdom": "^30.0.1",
35
43
  "less": "^4.1.3",
36
44
  "react": "^17.0.2",
37
45
  "react-dom": "^17.0.2",
38
46
  "react-router-dom": "^6.8.1",
39
- "typescript": "^4.9.4"
47
+ "typescript": "^4.9.4",
48
+ "vitest": "^4.1.10"
40
49
  },
41
50
  "peerDependencies": {
42
51
  "@hzab/utils": ">=1.0.6",
@@ -55,7 +55,7 @@ export const LocationListPicker = observer((props) => {
55
55
  // 取消监听
56
56
  mapUtilsRef.current?.off("click", onMapClick);
57
57
  mapUtilsRef.current?.off("dblclick", onMapDbClick);
58
- mapDomRef.current.current.removeEventListener("mousemove", onMouseMove);
58
+ mapDomRef.current?.current?.removeEventListener?.("mousemove", onMouseMove);
59
59
  };
60
60
  }, []);
61
61
 
@@ -1,3 +1,5 @@
1
+ import AMapLoader from "@amap/amap-jsapi-loader"
2
+
1
3
  const defaultVersion = "2.0";
2
4
  const defaultPlugins = ["AMap.Geocoder", "AMap.AutoComplete", "AMap.PolygonEditor", "AMap.PolylineEditor"];
3
5
 
@@ -33,9 +35,6 @@ function Loader(opt) {
33
35
 
34
36
  window._AMapLoaderTemp.plugins = plugins ? [...defaultPlugins, ...(plugins || [])] : defaultPlugins;
35
37
 
36
- // 不用地图组件时可以不安装 "@amap/amap-jsapi-loader"
37
- const AMapLoader = require("@amap/amap-jsapi-loader");
38
-
39
38
  window._AMapLoaderTemp.loading = true;
40
39
  window._AMapLoaderTemp.promise = AMapLoader.load({
41
40
  key: key || window._AMapLoaderTemp.key, // 申请好的Web端开发者Key,首次调用 load 时必填
@@ -1,5 +1,6 @@
1
1
  import { useState, useRef, useEffect, useMemo } from "react";
2
2
  import { Button, Modal, message } from "antd";
3
+ import _ from "lodash";
3
4
 
4
5
  import ItemList from "./components/ItemList";
5
6
 
@@ -9,8 +10,6 @@ import { handleOssUpload } from "./common/ossUpload";
9
10
 
10
11
  import "./uploader.less";
11
12
 
12
- const _ = require("lodash");
13
-
14
13
  function Uploader(props) {
15
14
  const {
16
15
  name,
@@ -68,6 +68,7 @@ export function Uploader({ onChange, ...props }) {
68
68
  isFileJson = false,
69
69
  thumbnailParams = { image_process: "resize,w_200" },
70
70
  readPretty,
71
+ afterUpload
71
72
  } = props;
72
73
  const isPrivateStore =
73
74
  props.uploadParams?.fileAcl === "private" || props.ossOpt?.signatureParams?.fileAcl === "private";
@@ -119,6 +120,7 @@ export function Uploader({ onChange, ...props }) {
119
120
  * @returns
120
121
  */
121
122
  const handleChange = async ({ fileList, file, event }) => {
123
+
122
124
  setFileList(fileList);
123
125
  // 上传中不进行处理,结局 ossPromise 不存在的问题
124
126
  if (file.status !== "done") {
@@ -126,6 +128,7 @@ export function Uploader({ onChange, ...props }) {
126
128
  }
127
129
 
128
130
  let _files = [...fileList];
131
+
129
132
  // 取出异步 url
130
133
  for (let i = 0; i < _files.length; i++) {
131
134
  let _file = _files[i]?.originFileObj || _files[i];
@@ -155,8 +158,16 @@ export function Uploader({ onChange, ...props }) {
155
158
  });
156
159
 
157
160
  onChange && onChange?.(_files);
161
+ afterUpload && await afterUpload({
162
+ files: fileList,
163
+ urls: _files
164
+ })
165
+
166
+ setChecking(false);
167
+
158
168
  };
159
169
 
170
+
160
171
  useEffect(() => {
161
172
  const list = handleInputFileList(value, {
162
173
  ...fileListConf,
@@ -294,7 +305,6 @@ export function Uploader({ onChange, ...props }) {
294
305
  return AUpload.LIST_IGNORE;
295
306
  }
296
307
  }
297
- setChecking(false);
298
308
  },
299
309
  customRequest,
300
310
  ...(props || {}),
@@ -335,6 +345,7 @@ export function Uploader({ onChange, ...props }) {
335
345
  // },
336
346
  ...(props || {}),
337
347
  };
348
+
338
349
  const isShowUploadBtn = useMemo(() => {
339
350
  if (disabled || readOnly || readPretty) {
340
351
  return null;
@@ -353,6 +364,8 @@ export function Uploader({ onChange, ...props }) {
353
364
  )
354
365
  ) : null;
355
366
  }, [maxCount, fileList, disabled, readOnly, readPretty, checking, btnText, listType]);
367
+
368
+
356
369
  return (
357
370
  <>
358
371
  <AUpload className="oss-uploader" {..._uploadProps}>
@@ -1,44 +0,0 @@
1
- ## 使用前安装依赖
2
-
3
- npm install @amap/amap-jsapi-loader
4
-
5
- ## 注意事项
6
-
7
- - isObjectRes 在 @hzab/form-render0.5.0 版本中去除,结果全部存放在对象中
8
- - changeMode 在 @hzab/form-render0.5.1 版本中去除,仅允许点击地图选点
9
-
10
- ## 引入
11
-
12
- ```jsx
13
- import MapLocationPoint from "./mapLocationPoint";
14
-
15
- export default function AMap(props) {
16
- return <MapLocationPoint hasSearch={true}></MapLocationPoint>;
17
- }
18
- ```
19
-
20
- ### InfoPanel Attributes
21
-
22
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
23
- | ------------------ | ------- | ---- | --------- | ------------------------------------------------ |
24
- | mode | string | 否 | dialog | 地图显示的类型, dialog 弹窗显示、 show 直接显示 |
25
- | element | string | 否 | Polypoint | 地图绘制的元素名Polypoint&Polyline&Polygon |
26
- | layout | string | 否 | ver | 选择器和地图的布局 hor 水平、 ver 垂直 |
27
- | hasSearch | boolean | 否 | true | 是否允许搜索 |
28
- | isAutoFixAddr | boolean | 否 | false | 打开地图时是否根据经纬度自动修正已填的地址 |
29
- | lonKey | string | 否 | longitude | 经度字段 key |
30
- | latKey | string | 否 | latitude | 维度字段 key |
31
- | addrKey | string | 否 | address | 地址字段 key |
32
- | isAutoSearch | boolean | 否 | false | 搜索框是否自动搜索 |
33
- | markerIconConf | Object | 否 | - | markerIcon 配置对象 |
34
- | icons | Object | 否 | - | icon 图片配置 |
35
- | getCurPositionConf | Object | 否 | - | getCurrentPosition Config |
36
-
37
- #### icons
38
-
39
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
40
- | ------------ | ------ | ---- | ------ | ------------------------ |
41
- | markerIcon | string | 否 | dialog | marker icon 图片地址 |
42
- | pickerIcon | string | 否 | dialog | 选点 icon 图片地址或元素 |
43
- | positionIcon | string | 否 | dialog | 定位 icon 图片地址或元素 |
44
- | resetIcon | string | 否 | dialog | 重置 icon 图片地址或元素 |
@@ -1,82 +0,0 @@
1
- ## PC使用前安装依赖
2
-
3
- npm install @wangeditor/editor-for-react
4
-
5
- ## 引入
6
-
7
- ```jsx
8
- import wangEditor from "./wangEditor";
9
-
10
- export default function AMap(props) {
11
- return <wangEditor ref={editorRef}></wangEditor>;
12
- }
13
- ```
14
- 向富文本内set内容
15
- editorRef.current.setEditorContent(HtmlString)
16
-
17
- 获取富文本当前内容
18
- editorRef.current.getEditorContent()
19
-
20
-
21
- ### InfoPanel Attributes
22
-
23
- | 参数 | 类型 | 必填 | 默认值 |
24
- | ------------------ | ---------------------- | ---- | --------- |
25
- | toolbarConfig | Partial<IToolbarConfig> | 否 | {} |
26
- | editorConfig | Partial<IEditorConfig> | 否 | { placeholder: '请输入内容...' } |
27
-
28
- 图片上传的配置
29
- ```jsx
30
- editorConfig = {
31
- MENU_CONF{
32
- uploadImage:{
33
-
34
- server: '/api/upload',
35
-
36
- // form-data fieldName ,默认值 'wangeditor-uploaded-image'
37
- fieldName: 'your-custom-name',
38
-
39
- // 单个文件的最大体积限制,默认为 2M
40
- maxFileSize: 1 * 1024 * 1024, // 1M
41
-
42
- // 最多可上传几个文件,默认为 100
43
- maxNumberOfFiles: 10,
44
-
45
- // 选择文件时的类型限制,默认为 ['image/*'] 。如不想限制,则设置为 []
46
- allowedFileTypes: ['image/*'],
47
-
48
- // 自定义上传参数,例如传递验证的 token 等。参数会被添加到 formData 中,一起上传到服务端。
49
- meta: {
50
- token: 'xxx',
51
- otherKey: 'yyy'
52
- },
53
-
54
- // 将 meta 拼接到 url 参数中,默认 false
55
- metaWithUrl: false,
56
-
57
- // 自定义增加 http header
58
- headers: {
59
- Accept: 'text/x-json',
60
- otherKey: 'xxx'
61
- },
62
-
63
- // 跨域是否传递 cookie ,默认为 false
64
- withCredentials: true,
65
-
66
- // 超时时间,默认为 10 秒
67
- timeout: 5 * 1000, // 5 秒
68
- }
69
- }
70
- }
71
- ```
72
-
73
- ## 移动端使用前安装依赖
74
- npm install lib-flexible
75
-
76
- ```jsx
77
- import wangEditor from "./wangEditor/handleMobile";
78
-
79
- export default function AMap(props) {
80
- return <HandleMobile content={HtmlString}></HandleMobile>;
81
- }
82
- ```
@@ -1,11 +0,0 @@
1
- ### InfoPanel Attributes
2
-
3
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
4
- | ------------- | ------- | ---- | -------------------------------------------------- | --------------------------------------------- |
5
- | dataSource | Array | 是 | - | 树数据 |
6
- | mergeFullLeaf | boolean | 否 | true | 合并不存在 children 的层级 |
7
- | mergeLeaf | boolean | 否 | true | 合并每一层级的叶子节点 |
8
- | fieldNames | Object | 否 | { label: label, value: value, children: children } | 自定义 options 中 label value children 的字段 |
9
- | disabled | boolean | 否 | false | 禁用状态 |
10
- | readOnly | boolean | 否 | false | 只读状态 |
11
- | tabBox | boolean | 否 | false | 最外层使用 tab |