@coding-form/form-engine 0.0.10 → 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.
@@ -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, {
@@ -27,14 +30,16 @@ const FormViewContent = (props)=>{
27
30
  onFinish: handleOnFinish,
28
31
  onBlur: handleOnBlur,
29
32
  children: props.children,
30
- layout: props.layout
33
+ layout: props.layout,
34
+ onValuesChange: handleOnValuesChange
31
35
  }), subFormList && subFormList.map((item)=>/*#__PURE__*/ react.createElement(FormSubView, {
32
36
  Form: Form,
33
37
  formCode: item.code,
34
38
  review: review,
35
39
  onFinish: handleOnFinish,
36
40
  onBlur: handleOnBlur,
37
- layout: props.layout
41
+ layout: props.layout,
42
+ onValuesChange: handleOnValuesChange
38
43
  })), props.footer);
39
44
  };
40
45
  const FormView = (props)=>{
@@ -3,8 +3,9 @@ interface FormSubViewProps {
3
3
  formCode: string;
4
4
  Form: React.ComponentType<any>;
5
5
  review: boolean;
6
- onFinish: (values: any, formCode: string) => void;
7
- onBlur: (formCode: string) => void;
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;
9
10
  layout?: 'horizontal' | 'vertical';
10
11
  }
@@ -26,10 +26,13 @@ const FormSubView = (props)=>{
26
26
  form: formTarget,
27
27
  layout: props.layout,
28
28
  onBlur: ()=>{
29
- props.onBlur(props.formCode);
29
+ props.onBlur?.(props.formCode);
30
30
  },
31
31
  onFinish: (values)=>{
32
- props.onFinish(values, props.formCode);
32
+ props.onFinish?.(values, props.formCode);
33
+ },
34
+ onValuesChange: (partial, values)=>{
35
+ props.onValuesChange?.(partial, values, props.formCode);
33
36
  }
34
37
  }, props.children, layoutContext.render(props.formCode, fields, review, context));
35
38
  };
@@ -70,6 +70,8 @@ export interface FormViewProps {
70
70
  form?: FormInstance;
71
71
  /** 布局方向 **/
72
72
  layout?: 'horizontal' | 'vertical';
73
+ /** 表单值更新事件 **/
74
+ onValuesChange?: (partial: any, values: any, formCode?: string) => void;
73
75
  /** 表单提交数据 **/
74
76
  onFinish?: (values: any, formCode?: string) => void;
75
77
  /** 表单失去焦点事件 **/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-form/form-engine",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "form-engine components",
5
5
  "keywords": [
6
6
  "coding-form",