@hzab/form-render 1.6.21-beta1 → 1.7.0
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 +3 -2
- package/README.md +23 -0
- package/package.json +3 -2
- package/src/components/Upload/common/checkFileType.ts +4 -4
- package/src/index.tsx +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -10,6 +10,29 @@ formily schema 表单渲染组件
|
|
|
10
10
|
|
|
11
11
|
## 示例
|
|
12
12
|
|
|
13
|
+
#### 项目初始化时挂载全局组件
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import { setFormilyGlobalComponents } from "@hzab/utils/src/formily/global-components";
|
|
17
|
+
|
|
18
|
+
// 挂载 Test1 组件到 formRender 组件
|
|
19
|
+
setFormilyGlobalComponents({
|
|
20
|
+
Test1() {
|
|
21
|
+
return <div>Test1</div>;
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// 挂载 Test2 组件到 formRender 组件
|
|
26
|
+
setFormilyGlobalComponents({
|
|
27
|
+
Test2() {
|
|
28
|
+
return <div>Test2</div>;
|
|
29
|
+
},
|
|
30
|
+
Test3() {
|
|
31
|
+
return <div>Test3</div>;
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
13
36
|
```jsx
|
|
14
37
|
import FormRender from "@hzab/form-render";
|
|
15
38
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/form-render",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@hzab/data-model": "^1.8.8",
|
|
23
23
|
"@hzab/permissions": "^0.1.1",
|
|
24
|
+
"@hzab/utils": "^1.0.6",
|
|
24
25
|
"@hzab/webpack-config": "0.0.12",
|
|
25
26
|
"@types/react": "^17.0.62",
|
|
26
27
|
"@types/react-dom": "^17.0.20",
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"typescript": "^4.9.4"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
|
-
"@hzab/utils": ">=1.0.
|
|
38
|
+
"@hzab/utils": ">=1.0.6",
|
|
38
39
|
"antd": "4.x",
|
|
39
40
|
"axios": ">=1.6.2",
|
|
40
41
|
"react": ">=16.8.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "@hzab/utils/src/file/fileType";
|
|
2
|
-
import { getFileTypeStr } from "@hzab/utils/src/file/fileType";
|
|
3
|
-
|
|
4
|
-
export const checkFileType = getFileTypeStr;
|
|
1
|
+
export * from "@hzab/utils/src/file/fileType";
|
|
2
|
+
import { getFileTypeStr } from "@hzab/utils/src/file/fileType";
|
|
3
|
+
|
|
4
|
+
export const checkFileType = getFileTypeStr;
|
package/src/index.tsx
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
ArrayCards,
|
|
31
31
|
} from "c-formily-antd";
|
|
32
32
|
import { Card, Slider, Rate } from "antd";
|
|
33
|
+
import { getFormilyGlobalComponents } from "@hzab/utils/src/formily/global-components";
|
|
33
34
|
|
|
34
35
|
// 自定义组件
|
|
35
36
|
import * as customComponents from "./components/index";
|
|
@@ -67,8 +68,6 @@ const antdComponents = {
|
|
|
67
68
|
ArrayCards,
|
|
68
69
|
};
|
|
69
70
|
|
|
70
|
-
const noop = () => {};
|
|
71
|
-
|
|
72
71
|
const FormRender = forwardRef((props: any, parentRef) => {
|
|
73
72
|
/** schema scope 解决父级无 schema Scope 导致 scope 对象刷新的问题 */
|
|
74
73
|
const schemaScopeRef = useRef<{ _$tempData: Object }>();
|
|
@@ -112,6 +111,7 @@ const FormRender = forwardRef((props: any, parentRef) => {
|
|
|
112
111
|
Slider,
|
|
113
112
|
Rate,
|
|
114
113
|
...customComponents,
|
|
114
|
+
...getFormilyGlobalComponents(),
|
|
115
115
|
...props.components,
|
|
116
116
|
},
|
|
117
117
|
scope: schemaScopeRef.current,
|