@hzab/form-render 1.6.18 → 1.6.20

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +247 -239
  3. package/package.json +57 -57
  4. package/src/common/formily-utils.ts +125 -125
  5. package/src/common/schema-handler.ts +253 -253
  6. package/src/common/schema-merge.ts +68 -68
  7. package/src/components/ArrayBase/index.tsx +349 -349
  8. package/src/components/ArrayBase/style.less +90 -90
  9. package/src/components/ArrayBase/style.ts +2 -2
  10. package/src/components/ArrayCards/index.tsx +149 -149
  11. package/src/components/ArrayCards/style.less +14 -14
  12. package/src/components/ArrayCards/style.ts +4 -4
  13. package/src/components/ArrayTable/index.tsx +411 -411
  14. package/src/components/ArrayTable/style.less +52 -52
  15. package/src/components/ArrayTable/style.ts +7 -7
  16. package/src/components/DatePicker/index.tsx +108 -108
  17. package/src/components/LocationListPicker/assets/icon.js +1 -1
  18. package/src/components/LocationListPicker/components/AddrList/index.less +55 -55
  19. package/src/components/LocationListPicker/components/AddrList/index.tsx +75 -75
  20. package/src/components/LocationListPicker/components/Popup/address.schema.json +21 -21
  21. package/src/components/LocationListPicker/components/Popup/index.less +22 -22
  22. package/src/components/LocationListPicker/components/Popup/index.tsx +92 -92
  23. package/src/components/LocationListPicker/index.less +34 -34
  24. package/src/components/LocationListPicker/index.tsx +521 -520
  25. package/src/components/LocationPicker/Map/AMap/common/loader.ts +58 -58
  26. package/src/components/LocationPicker/Map/AMap/common/utils.ts +431 -431
  27. package/src/components/LocationPicker/Map/AMap/index.jsx +51 -51
  28. package/src/components/LocationPicker/README.md +44 -44
  29. package/src/components/LocationPicker/common/utils.ts +30 -30
  30. package/src/components/LocationPicker/components/ModalContent/index.tsx +387 -387
  31. package/src/components/LocationPicker/components/PickerInfo/index.tsx +109 -109
  32. package/src/components/LocationPicker/components/ResInfo/index.less +38 -38
  33. package/src/components/LocationPicker/components/ResInfo/index.tsx +65 -65
  34. package/src/components/LocationPicker/index.tsx +197 -197
  35. package/src/components/PersonnelSelect/index.less +21 -21
  36. package/src/components/PersonnelSelect/index.module.less +33 -33
  37. package/src/components/PersonnelSelect/type.ts +92 -92
  38. package/src/components/RichEditor/index.less +38 -38
  39. package/src/components/RichEditor/index.tsx +238 -238
  40. package/src/components/TreeCheckbox/components/CheckboxTable/index.tsx +61 -55
  41. package/src/components/TreeCheckbox/components/Render/index.tsx +28 -28
  42. package/src/components/TreeCheckbox/components/TabsRender/index.tsx +61 -58
  43. package/src/components/TreeCheckbox/index.less +18 -12
  44. package/src/components/TreeCheckbox/index.tsx +63 -63
  45. package/src/components/Upload/README.md +64 -64
  46. package/src/components/Upload/common/OfflineUpload.ts +339 -339
  47. package/src/components/Upload/common/customRequest.ts +81 -81
  48. package/src/components/Upload/common/fileName.ts +142 -142
  49. package/src/components/Upload/common/handleIOFileList.ts +393 -393
  50. package/src/components/Upload/common/nanoid.ts +7 -7
  51. package/src/components/Upload/common/ossUpload.js +159 -159
  52. package/src/components/Upload/common/utils.js +194 -194
  53. package/src/components/Upload/components/ItemList/index.tsx +52 -52
  54. package/src/components/Upload/components/PreviewModal/previewRender.tsx +80 -80
  55. package/src/components/Upload/index.tsx +17 -17
  56. package/src/components/Upload/uploader-input.jsx +187 -187
  57. package/src/components/Upload/uploader.jsx +316 -316
  58. package/src/components/UserSelect/index.tsx +123 -123
  59. package/src/components/index.tsx +17 -17
  60. package/src/index.tsx +198 -198
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # @hzab/form-render@1.6.20
2
+ feat: 新增 TreeCheckbox的readOnly属性
3
+
4
+ # @hzab/form-render@1.6.19
5
+
6
+ fix: LocationListPicker 搜索新增时在搜索项切换地址异常问题修复
7
+
1
8
  # @hzab/form-render@1.6.18
2
9
 
3
10
  fix:修复人员选择组件单选模式自定义节点展示以及选中判断问题
package/README.md CHANGED
@@ -1,239 +1,247 @@
1
- # @hzab/form-render
2
-
3
- formily schema 表单渲染组件
4
-
5
- # 组件
6
-
7
- ## Tips
8
-
9
- - antd 组件样式需要手动引入
10
-
11
- ## 示例
12
-
13
- ```jsx
14
- import FormRender from "@hzab/form-render";
15
-
16
- // testSchema 为 formily 生成的 schema json
17
- <FormRender schema={testSchema} />;
18
- ```
19
-
20
- #### 组件远程数据
21
-
22
- - 使用 schemaScope 传入全局配置变量,在响应器的动作响应中调用
23
-
24
- ```jsx
25
- // schema
26
- {
27
- "form": {
28
- "labelCol": 6,
29
- "wrapperCol": 12
30
- },
31
- "schema": {
32
- "type": "object",
33
- "properties": {
34
- "parentId": {
35
- "type": "string",
36
- "title": "上级菜单",
37
- "x-decorator": "FormItem",
38
- "x-component": "TreeSelect",
39
- "x-validator": [],
40
- "x-component-props": {},
41
- "x-decorator-props": {},
42
- "x-reactions": {
43
- "fulfill": {
44
- "run": "fetchMenuTree($self);"
45
- }
46
- },
47
- "name": "parentId",
48
- "x-designable-id": "i012z5nbd5z",
49
- "x-index": 0
50
- }
51
- }
52
- }
53
- }
54
-
55
- // formRender
56
- <FormRender
57
- schema={testSchema}
58
- schemaScope={{
59
- fetchMenuTree(field) {
60
- // 模拟请求
61
- setTimeout(() => {
62
- // field 目标组件的 配置参数
63
- // 通过 field.component[1] 可以动态配置目标组件的 props
64
- // 树选择器 数据源
65
- field.component[1].treeData = [{ value: 1, label: 1 }];
66
- }, 1000)
67
- },
68
- }}
69
- />
70
- ```
71
-
72
- #### 自定义组件
73
-
74
- - 使用 components 传入自定义组件,在 schema 中 x-component 配置对应的组件名称
75
-
76
- ```jsx
77
- // schema
78
- {
79
- "form": {
80
- "labelCol": 6,
81
- "wrapperCol": 12
82
- },
83
- "schema": {
84
- "type": "object",
85
- "properties": {
86
- "parentId": {
87
- "type": "string",
88
- "title": "图标选择器",
89
- "x-decorator": "FormItem",
90
- "x-component": "IconSelect",
91
- "x-validator": [],
92
- "x-component-props": {},
93
- "x-decorator-props": {},
94
- "x-reactions": {},
95
- "name": "parentId",
96
- "x-designable-id": "i012z5nbd5z",
97
- "x-index": 0
98
- }
99
- }
100
- }
101
- }
102
-
103
- // formRender
104
- <FormRender
105
- schema={testSchema}
106
- components={{
107
- // 自定义组件
108
- IconSelect() {
109
- return "IconSelect";
110
- },
111
- }}
112
- />
113
- ```
114
-
115
- ## API
116
-
117
- ### InfoPanel Attributes
118
-
119
- | 参数 | 类型 | 必填 | 默认值 | 说明 |
120
- | ------------------ | -------- | ---- | ---------- | -------------------------------------- |
121
- | schema | Object | 是 | - | 数据信息的 schema |
122
- | schemaScope | Object | 否 | - | 全局作用域,用于实现协议表达式变量注入 |
123
- | layout | Object | 否 | horizontal | 表单布局,horizontal vertical \ inline |
124
- | initialValues | Object | 否 | - | form 初始值 |
125
- | components | Object | 否 | - | 自定义组件 |
126
- | formOptions | Object | 否 | - | createForm 的参数 |
127
- | disabled | boolean | 否 | - | 禁用状态 |
128
- | readOnly | boolean | 否 | - | 只读状态 |
129
- | onFormValuesChange | Function | 否 | - | 表单事件 (form)=>{} https://core.formilyjs.org/zh-CN/api/entry/form-effect-hooks |
130
- | onFieldValueChange | Function | 否 | - | 表单项事件 (field, form)=>{} https://core.formilyjs.org/zh-CN/api/entry/field-effect-hooks |
131
-
132
- ### 方法 Methods
133
-
134
- | 名称 | 参数 | 说明 |
135
- | ---- | --------- | -------------- |
136
- | init | form 实例 | 组件初始化执行 |
137
-
138
- ### Schema
139
-
140
- - 使用 表单编辑器生成:https://designable-antd.formilyjs.org/
141
-
142
- ```js
143
- {
144
- "form": {
145
- "labelCol": 6,
146
- "wrapperCol": 12
147
- },
148
- "schema": {
149
- "type": "object",
150
- "properties": {
151
- // 参数 key
152
- "parentId": {
153
- "type": "string",
154
- // 参数 label
155
- "title": "上级菜单",
156
- "x-decorator": "FormItem",
157
- // 渲染的组件
158
- "x-component": "TreeSelect",
159
- // 组件校验
160
- "x-validator": [],
161
- // 组件配置
162
- "x-component-props": {
163
- "virtual": true,
164
- "allowClear": true,
165
- "showSearch": true
166
- },
167
- // 容器配置
168
- "x-decorator-props": {},
169
- // 响应器
170
- "x-reactions": {
171
- // 依赖字段
172
- "dependencies": [
173
- {
174
- "property": "value",
175
- "type": "any"
176
- }
177
- ],
178
- // 响应动作
179
- "fulfill": {
180
- // 属性响应,只支持 JS 表达式
181
- "state": {
182
- "visible": "{{$deps.menuType === \"C\" || $deps.menuType === \"F\"}}"
183
- },
184
- // 动作响应,支持 JS 语句
185
- "run": "fetchMenuTree($self);"
186
- }
187
- },
188
- // 参数 key
189
- "name": "parentId",
190
- // 组件在编辑器中的 ID(必须唯一)
191
- "x-designable-id": "i012z5nbd5z",
192
- // 组件在表单中的顺序(必须唯一)
193
- "x-index": 0,
194
- // 是否在 table 中展示,目前需要手动添加配置
195
- "inTable": false
196
- }
197
- }
198
- }
199
- }
200
- ```
201
-
202
- # 组件开发流程
203
-
204
- - 在 config/webpack.config/webpack.config.dev.js 中按需修改 alias 配置的包名,便于本地调试
205
- - 在 example/typings.d.ts 中按需修改 declare module 配置的包名,解决 ts 报错问题
206
- - npm run dev
207
-
208
- ## 文件目录
209
-
210
- - example 本地测试代码
211
- - src 组件源码
212
- - lib 组件打包编译后的代码
213
-
214
- ## 命令
215
-
216
- - 本地运行:npm run dev
217
- - 测试环境打包编译:npm run build-flow-dev
218
- - 生产环境打包编译:npm run build
219
-
220
- ## 发布
221
-
222
- - 在 config/webpack.config/webpack.config.prod.js 中按需修改 entry 配置的文件名
223
- - 编译组件:npm run build
224
- - 命令:npm publish --access public
225
- - 发布目录:
226
- - lib
227
- - src
228
-
229
- ## 配置
230
-
231
- ### 配置文件
232
-
233
- - 本地配置文件:config/global-config/config.local.js
234
- - 测试环境配置文件:config/global-config/config.flowDev.js
235
- - 生产环境配置文件:config/global-config/config.production.js
236
-
237
- ### webpack 配置文件
238
-
239
- - config/webpack.config.js
1
+ # @hzab/form-render
2
+
3
+ formily schema 表单渲染组件
4
+
5
+ # 组件
6
+
7
+ ## Tips
8
+
9
+ - antd 组件样式需要手动引入
10
+
11
+ ## 示例
12
+
13
+ ```jsx
14
+ import FormRender from "@hzab/form-render";
15
+
16
+ // testSchema 为 formily 生成的 schema json
17
+ <FormRender schema={testSchema} />;
18
+ ```
19
+
20
+ #### 组件远程数据
21
+
22
+ - 使用 schemaScope 传入全局配置变量,在响应器的动作响应中调用
23
+
24
+ ```jsx
25
+ // schema
26
+ {
27
+ "form": {
28
+ "labelCol": 6,
29
+ "wrapperCol": 12
30
+ },
31
+ "schema": {
32
+ "type": "object",
33
+ "properties": {
34
+ "parentId": {
35
+ "type": "string",
36
+ "title": "上级菜单",
37
+ "x-decorator": "FormItem",
38
+ "x-component": "TreeSelect",
39
+ "x-validator": [],
40
+ "x-component-props": {},
41
+ "x-decorator-props": {},
42
+ "x-reactions": {
43
+ "fulfill": {
44
+ "run": "fetchMenuTree($self);"
45
+ }
46
+ },
47
+ "name": "parentId",
48
+ "x-designable-id": "i012z5nbd5z",
49
+ "x-index": 0
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ // formRender
56
+ <FormRender
57
+ schema={testSchema}
58
+ schemaScope={{
59
+ fetchMenuTree(field) {
60
+ // 模拟请求
61
+ setTimeout(() => {
62
+ // field 目标组件的 配置参数
63
+ // 通过 field.component[1] 可以动态配置目标组件的 props
64
+ // 树选择器 数据源
65
+ field.component[1].treeData = [{ value: 1, label: 1 }];
66
+ }, 1000)
67
+ },
68
+ }}
69
+ />
70
+ ```
71
+
72
+ #### 自定义组件
73
+
74
+ - 使用 components 传入自定义组件,在 schema 中 x-component 配置对应的组件名称
75
+
76
+ ```jsx
77
+ // schema
78
+ {
79
+ "form": {
80
+ "labelCol": 6,
81
+ "wrapperCol": 12
82
+ },
83
+ "schema": {
84
+ "type": "object",
85
+ "properties": {
86
+ "parentId": {
87
+ "type": "string",
88
+ "title": "图标选择器",
89
+ "x-decorator": "FormItem",
90
+ "x-component": "IconSelect",
91
+ "x-validator": [],
92
+ "x-component-props": {},
93
+ "x-decorator-props": {},
94
+ "x-reactions": {},
95
+ "name": "parentId",
96
+ "x-designable-id": "i012z5nbd5z",
97
+ "x-index": 0
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ // formRender
104
+ <FormRender
105
+ schema={testSchema}
106
+ components={{
107
+ // 自定义组件
108
+ IconSelect() {
109
+ return "IconSelect";
110
+ },
111
+ }}
112
+ />
113
+ ```
114
+
115
+ ## API
116
+
117
+ ### InfoPanel Attributes
118
+
119
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
120
+ | ------------------ | -------- | ---- | ---------- | ------------------------------------------------------------------------------------------ |
121
+ | schema | Object | 是 | - | 数据信息的 schema |
122
+ | schemaScope | Object | 否 | - | 全局作用域,用于实现协议表达式变量注入 |
123
+ | layout | Object | 否 | horizontal | 表单布局,horizontal vertical \ inline |
124
+ | initialValues | Object | 否 | - | form 初始值 |
125
+ | components | Object | 否 | - | 自定义组件 |
126
+ | formOptions | Object | 否 | - | createForm 的参数 |
127
+ | disabled | boolean | 否 | - | 禁用状态 |
128
+ | readOnly | boolean | 否 | - | 只读状态 |
129
+ | onFormValuesChange | Function | 否 | - | 表单事件 (form)=>{} https://core.formilyjs.org/zh-CN/api/entry/form-effect-hooks |
130
+ | onFieldValueChange | Function | 否 | - | 表单项事件 (field, form)=>{} https://core.formilyjs.org/zh-CN/api/entry/field-effect-hooks |
131
+
132
+ ### 方法 Methods
133
+
134
+ | 名称 | 参数 | 说明 |
135
+ | ---- | --------- | -------------- |
136
+ | init | form 实例 | 组件初始化执行 |
137
+
138
+ ### Schema
139
+
140
+ - 使用 表单编辑器生成:https://designable-antd.formilyjs.org/
141
+
142
+ ```js
143
+ {
144
+ "form": {
145
+ "labelCol": 6,
146
+ "wrapperCol": 12
147
+ },
148
+ "schema": {
149
+ "type": "object",
150
+ "properties": {
151
+ // 参数 key
152
+ "parentId": {
153
+ "type": "string",
154
+ // 参数 label
155
+ "title": "上级菜单",
156
+ "x-decorator": "FormItem",
157
+ // 渲染的组件
158
+ "x-component": "TreeSelect",
159
+ // 组件校验
160
+ "x-validator": [],
161
+ // 组件配置
162
+ "x-component-props": {
163
+ "virtual": true,
164
+ "allowClear": true,
165
+ "showSearch": true
166
+ },
167
+ // 容器配置
168
+ "x-decorator-props": {},
169
+ // 响应器
170
+ "x-reactions": {
171
+ // 依赖字段
172
+ "dependencies": [
173
+ {
174
+ "property": "value",
175
+ "type": "any"
176
+ }
177
+ ],
178
+ // 响应动作
179
+ "fulfill": {
180
+ // 属性响应,只支持 JS 表达式
181
+ "state": {
182
+ "visible": "{{$deps.menuType === \"C\" || $deps.menuType === \"F\"}}"
183
+ },
184
+ // 动作响应,支持 JS 语句
185
+ "run": "fetchMenuTree($self);"
186
+ }
187
+ },
188
+ // 参数 key
189
+ "name": "parentId",
190
+ // 组件在编辑器中的 ID(必须唯一)
191
+ "x-designable-id": "i012z5nbd5z",
192
+ // 组件在表单中的顺序(必须唯一)
193
+ "x-index": 0,
194
+ // 是否在 table 中展示,目前需要手动添加配置
195
+ "inTable": false
196
+ }
197
+ }
198
+ }
199
+ }
200
+ ```
201
+
202
+ # 组件开发流程
203
+
204
+ - 在 config/webpack.config/webpack.config.dev.js 中按需修改 alias 配置的包名,便于本地调试
205
+ - 在 example/typings.d.ts 中按需修改 declare module 配置的包名,解决 ts 报错问题
206
+ - npm run dev
207
+
208
+ ## 文件目录
209
+
210
+ - example 本地测试代码
211
+ - src 组件源码
212
+
213
+ ## 命令
214
+
215
+ - 生成文档:npm run docs
216
+ - 本地运行:npm run dev
217
+ - 打包编译:npm run build
218
+
219
+ ## 发布
220
+
221
+ - npm 源和云效源都需要发布
222
+
223
+ - 命令:npm publish --access public
224
+ - 发布目录:
225
+ - src
226
+
227
+ ### nrm
228
+
229
+ - 安装
230
+ npm install -g nrm
231
+ - 增加源
232
+ nrm add aliyun https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
233
+ - 切换源
234
+ nrm use aliyun
235
+ nrm use npm
236
+ - 登录(账号密码在 https://packages.aliyun.com/npm/npm-registry/guide 查看)
237
+ npm login --registry=https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
238
+
239
+ ## 配置
240
+
241
+ ### 配置文件
242
+
243
+ - 本地配置文件:config/config.js
244
+
245
+ ### webpack 配置文件
246
+
247
+ - config/webpack.config.js
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
- {
2
- "name": "@hzab/form-render",
3
- "version": "1.6.18",
4
- "description": "",
5
- "main": "src",
6
- "scripts": {
7
- "dev": "webpack serve -c ./config/webpack.config.js --env local",
8
- "build": "webpack -c ./config/webpack.config.js --env production",
9
- "publish-beta": "npm publish --beta",
10
- "publish-patch": "npm version patch && npm publish --access public",
11
- "publish-minor": "npm version minor && npm publish --access public",
12
- "publish-major": "npm version major && npm publish --access public"
13
- },
14
- "files": [
15
- "src",
16
- "CHANGELOG.md"
17
- ],
18
- "keywords": [],
19
- "author": "CaiYansong",
20
- "license": "ISC",
21
- "devDependencies": {
22
- "@hzab/data-model": "^1.2.0",
23
- "@hzab/permissions": "^0.1.1",
24
- "@hzab/webpack-config": "0.0.12",
25
- "@types/react": "^17.0.62",
26
- "@types/react-dom": "^17.0.20",
27
- "antd": "^4.24.12",
28
- "dayjs": "1.11.10",
29
- "eslint": "^8.30.0",
30
- "less": "^4.1.3",
31
- "react": "^17.0.2",
32
- "react-dom": "^17.0.2",
33
- "react-router-dom": "^6.8.1",
34
- "typescript": "^4.9.4"
35
- },
36
- "peerDependencies": {
37
- "antd": "4.x",
38
- "axios": ">=1.6.2",
39
- "react": ">=16.8.0",
40
- "react-dom": ">=16.8.0"
41
- },
42
- "dependencies": {
43
- "@amap/amap-jsapi-loader": "^1.0.1",
44
- "@formily/core": "2.3.1",
45
- "@formily/react": "2.3.1",
46
- "@formily/reactive-react": "2.3.1",
47
- "@turf/turf": "^6.5.0",
48
- "@wangeditor/editor": "^5.1.23",
49
- "@wangeditor/editor-for-react": "^1.0.6",
50
- "ajv": "^8.12.0",
51
- "c-formily-antd": "^2.3.1",
52
- "nanoid": "^3.3.7"
53
- },
54
- "directories": {
55
- "src": "src"
56
- }
57
- }
1
+ {
2
+ "name": "@hzab/form-render",
3
+ "version": "1.6.20",
4
+ "description": "",
5
+ "main": "src",
6
+ "scripts": {
7
+ "dev": "webpack serve -c ./config/webpack.config.js --env local",
8
+ "build": "webpack -c ./config/webpack.config.js --env production",
9
+ "publish-beta": "npm publish --beta",
10
+ "publish-patch": "npm version patch && npm publish --access public",
11
+ "publish-minor": "npm version minor && npm publish --access public",
12
+ "publish-major": "npm version major && npm publish --access public"
13
+ },
14
+ "files": [
15
+ "src",
16
+ "CHANGELOG.md"
17
+ ],
18
+ "keywords": [],
19
+ "author": "CaiYansong",
20
+ "license": "ISC",
21
+ "devDependencies": {
22
+ "@hzab/data-model": "^1.2.0",
23
+ "@hzab/permissions": "^0.1.1",
24
+ "@hzab/webpack-config": "0.0.12",
25
+ "@types/react": "^17.0.62",
26
+ "@types/react-dom": "^17.0.20",
27
+ "antd": "^4.24.12",
28
+ "dayjs": "1.11.10",
29
+ "eslint": "^8.30.0",
30
+ "less": "^4.1.3",
31
+ "react": "^17.0.2",
32
+ "react-dom": "^17.0.2",
33
+ "react-router-dom": "^6.8.1",
34
+ "typescript": "^4.9.4"
35
+ },
36
+ "peerDependencies": {
37
+ "antd": "4.x",
38
+ "axios": ">=1.6.2",
39
+ "react": ">=16.8.0",
40
+ "react-dom": ">=16.8.0"
41
+ },
42
+ "dependencies": {
43
+ "@amap/amap-jsapi-loader": "^1.0.1",
44
+ "@formily/core": "2.3.1",
45
+ "@formily/react": "2.3.1",
46
+ "@formily/reactive-react": "2.3.1",
47
+ "@turf/turf": "^6.5.0",
48
+ "@wangeditor/editor": "^5.1.23",
49
+ "@wangeditor/editor-for-react": "^1.0.6",
50
+ "ajv": "^8.12.0",
51
+ "c-formily-antd": "^2.3.1",
52
+ "nanoid": "^3.3.7"
53
+ },
54
+ "directories": {
55
+ "src": "src"
56
+ }
57
+ }