@coding-form/form-engine 0.0.5 → 0.0.7
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/dist/form/index.js +9 -3
- package/dist/form/sub-view.d.ts +2 -0
- package/dist/form/sub-view.js +4 -1
- package/dist/types/item.d.ts +3 -0
- package/dist/types/view.d.ts +6 -4
- package/package.json +3 -3
package/dist/form/index.js
CHANGED
|
@@ -12,21 +12,27 @@ const FormViewContent = (props)=>{
|
|
|
12
12
|
const meta = props.meta;
|
|
13
13
|
const subFormList = meta.subForms || [];
|
|
14
14
|
const review = props.review || false;
|
|
15
|
-
const
|
|
15
|
+
const handleOnFinish = (values, formCode)=>{
|
|
16
16
|
props.onFinish?.(values, formCode);
|
|
17
17
|
};
|
|
18
|
+
const handleOnBlur = (formCode)=>{
|
|
19
|
+
props.onBlur?.(formCode);
|
|
20
|
+
};
|
|
18
21
|
return /*#__PURE__*/ react.createElement(FormContext.Provider, {
|
|
19
22
|
value: context
|
|
20
23
|
}, props.header, /*#__PURE__*/ react.createElement(FormSubView, {
|
|
21
24
|
Form: Form,
|
|
22
25
|
formCode: meta.code,
|
|
23
26
|
review: review,
|
|
24
|
-
onFinish:
|
|
27
|
+
onFinish: handleOnFinish,
|
|
28
|
+
onBlur: handleOnBlur,
|
|
29
|
+
children: props.children
|
|
25
30
|
}), subFormList && subFormList.map((item)=>/*#__PURE__*/ react.createElement(FormSubView, {
|
|
26
31
|
Form: Form,
|
|
27
32
|
formCode: item.code,
|
|
28
33
|
review: review,
|
|
29
|
-
onFinish:
|
|
34
|
+
onFinish: handleOnFinish,
|
|
35
|
+
onBlur: handleOnBlur
|
|
30
36
|
})), props.footer);
|
|
31
37
|
};
|
|
32
38
|
const FormView = (props)=>{
|
package/dist/form/sub-view.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ interface FormSubViewProps {
|
|
|
4
4
|
Form: React.ComponentType<any>;
|
|
5
5
|
review: boolean;
|
|
6
6
|
onFinish: (values: any, formCode: string) => void;
|
|
7
|
+
onBlur: (formCode: string) => void;
|
|
8
|
+
children?: React.ReactNode;
|
|
7
9
|
}
|
|
8
10
|
export declare const FormSubView: React.FC<FormSubViewProps>;
|
|
9
11
|
export {};
|
package/dist/form/sub-view.js
CHANGED
|
@@ -24,9 +24,12 @@ const FormSubView = (props)=>{
|
|
|
24
24
|
}, []);
|
|
25
25
|
return /*#__PURE__*/ react.createElement(Form, {
|
|
26
26
|
form: formTarget,
|
|
27
|
+
onBlur: ()=>{
|
|
28
|
+
props.onBlur(props.formCode);
|
|
29
|
+
},
|
|
27
30
|
onFinish: (values)=>{
|
|
28
31
|
props.onFinish(values, props.formCode);
|
|
29
32
|
}
|
|
30
|
-
}, layoutContext.render(props.formCode, fields, review, context));
|
|
33
|
+
}, props.children, layoutContext.render(props.formCode, fields, review, context));
|
|
31
34
|
};
|
|
32
35
|
export { FormSubView };
|
package/dist/types/item.d.ts
CHANGED
package/dist/types/view.d.ts
CHANGED
|
@@ -68,14 +68,16 @@ export interface FormViewProps {
|
|
|
68
68
|
meta: FormMeta;
|
|
69
69
|
/** 表单操控对象 */
|
|
70
70
|
form?: FormInstance;
|
|
71
|
-
/** 表单数据更新事件 */
|
|
72
|
-
onValuesChange?: (values: any) => void;
|
|
73
71
|
/** 表单提交数据 **/
|
|
74
72
|
onFinish?: (values: any, formCode?: string) => void;
|
|
75
|
-
/**
|
|
73
|
+
/** 表单失去焦点事件 **/
|
|
74
|
+
onBlur?: (formCode?: string) => void;
|
|
75
|
+
/** 表单头内容(表单外部) **/
|
|
76
76
|
header?: React.ReactNode;
|
|
77
|
-
/**
|
|
77
|
+
/** 表单底部内容(表单外部) **/
|
|
78
78
|
footer?: React.ReactNode;
|
|
79
|
+
/** 主表单自定义内容(表单内部) **/
|
|
80
|
+
children?: React.ReactNode;
|
|
79
81
|
/** 是否预览模式 */
|
|
80
82
|
review?: boolean;
|
|
81
83
|
/** 字段校验逻辑 */
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coding-form/form-engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "form-engine components",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"coding-
|
|
7
|
-
"
|
|
6
|
+
"coding-form",
|
|
7
|
+
"form-engine"
|
|
8
8
|
],
|
|
9
9
|
"homepage": "https://github.com/codingapi/form-engine",
|
|
10
10
|
"bugs": {
|