@coding-form/form-engine 0.0.9 → 0.0.11
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 -2
- package/dist/form/sub-view.d.ts +4 -2
- package/dist/form/sub-view.js +6 -2
- package/dist/types/view.d.ts +4 -0
- package/package.json +1 -1
package/dist/form/index.js
CHANGED
|
@@ -18,6 +18,9 @@ const FormViewContent = (props)=>{
|
|
|
18
18
|
const handleOnBlur = (formCode)=>{
|
|
19
19
|
props.onBlur?.(formCode);
|
|
20
20
|
};
|
|
21
|
+
const handleOnValuesChange = (partial, values, formCode)=>{
|
|
22
|
+
props.onValuesChange?.(partial, values, formCode);
|
|
23
|
+
};
|
|
21
24
|
return /*#__PURE__*/ react.createElement(FormContext.Provider, {
|
|
22
25
|
value: context
|
|
23
26
|
}, props.header, /*#__PURE__*/ react.createElement(FormSubView, {
|
|
@@ -26,13 +29,17 @@ const FormViewContent = (props)=>{
|
|
|
26
29
|
review: review,
|
|
27
30
|
onFinish: handleOnFinish,
|
|
28
31
|
onBlur: handleOnBlur,
|
|
29
|
-
children: props.children
|
|
32
|
+
children: props.children,
|
|
33
|
+
layout: props.layout,
|
|
34
|
+
onValuesChange: handleOnValuesChange
|
|
30
35
|
}), subFormList && subFormList.map((item)=>/*#__PURE__*/ react.createElement(FormSubView, {
|
|
31
36
|
Form: Form,
|
|
32
37
|
formCode: item.code,
|
|
33
38
|
review: review,
|
|
34
39
|
onFinish: handleOnFinish,
|
|
35
|
-
onBlur: handleOnBlur
|
|
40
|
+
onBlur: handleOnBlur,
|
|
41
|
+
layout: props.layout,
|
|
42
|
+
onValuesChange: handleOnValuesChange
|
|
36
43
|
})), props.footer);
|
|
37
44
|
};
|
|
38
45
|
const FormView = (props)=>{
|
package/dist/form/sub-view.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ interface FormSubViewProps {
|
|
|
3
3
|
formCode: string;
|
|
4
4
|
Form: React.ComponentType<any>;
|
|
5
5
|
review: boolean;
|
|
6
|
-
onFinish
|
|
7
|
-
|
|
6
|
+
onFinish?: (values: any, formCode: string) => void;
|
|
7
|
+
onValuesChange?: (partial: any, values: any, formCode: string) => void;
|
|
8
|
+
onBlur?: (formCode: string) => void;
|
|
8
9
|
children?: React.ReactNode;
|
|
10
|
+
layout?: 'horizontal' | 'vertical';
|
|
9
11
|
}
|
|
10
12
|
export declare const FormSubView: React.FC<FormSubViewProps>;
|
|
11
13
|
export {};
|
package/dist/form/sub-view.js
CHANGED
|
@@ -24,11 +24,15 @@ const FormSubView = (props)=>{
|
|
|
24
24
|
}, []);
|
|
25
25
|
return /*#__PURE__*/ react.createElement(Form, {
|
|
26
26
|
form: formTarget,
|
|
27
|
+
layout: props.layout,
|
|
27
28
|
onBlur: ()=>{
|
|
28
|
-
props.onBlur(props.formCode);
|
|
29
|
+
props.onBlur?.(props.formCode);
|
|
29
30
|
},
|
|
30
31
|
onFinish: (values)=>{
|
|
31
|
-
props.onFinish(values, props.formCode);
|
|
32
|
+
props.onFinish?.(values, props.formCode);
|
|
33
|
+
},
|
|
34
|
+
onValuesChange: (partial, values)=>{
|
|
35
|
+
props.onValuesChange?.(partial, values, props.formCode);
|
|
32
36
|
}
|
|
33
37
|
}, props.children, layoutContext.render(props.formCode, fields, review, context));
|
|
34
38
|
};
|
package/dist/types/view.d.ts
CHANGED
|
@@ -68,6 +68,10 @@ export interface FormViewProps {
|
|
|
68
68
|
meta: FormMeta;
|
|
69
69
|
/** 表单操控对象 */
|
|
70
70
|
form?: FormInstance;
|
|
71
|
+
/** 布局方向 **/
|
|
72
|
+
layout?: 'horizontal' | 'vertical';
|
|
73
|
+
/** 表单值更新事件 **/
|
|
74
|
+
onValuesChange?: (partial: any, values: any, formCode?: string) => void;
|
|
71
75
|
/** 表单提交数据 **/
|
|
72
76
|
onFinish?: (values: any, formCode?: string) => void;
|
|
73
77
|
/** 表单失去焦点事件 **/
|