@coding-form/form-engine 0.0.6 → 0.0.8

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.
@@ -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 handleOnSubmit = (values, formCode)=>{
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: handleOnSubmit
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: handleOnSubmit
34
+ onFinish: handleOnFinish,
35
+ onBlur: handleOnBlur
30
36
  })), props.footer);
31
37
  };
32
38
  const FormView = (props)=>{
@@ -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 {};
@@ -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 };
@@ -1,3 +1,5 @@
1
+ import { FieldAttribute } from "./view";
2
+ import { DataType } from "./types";
1
3
  /**
2
4
  * 表单组件属性
3
5
  */
@@ -20,6 +22,12 @@ export interface FormItemProps {
20
22
  onBlur?: (value: string) => void;
21
23
  /** 输入提示信息 **/
22
24
  placeholder?: string;
25
+ /** 提醒提示 **/
26
+ tooltip?: string;
27
+ /** 帮助提示 **/
28
+ help?: string;
29
+ /** 数据类型 **/
30
+ dataType: DataType;
23
31
  /** 是否只读 **/
24
32
  readOnly?: boolean;
25
33
  /** 校验规则,Antd的规则 **/
@@ -28,4 +36,6 @@ export interface FormItemProps {
28
36
  layout?: 'horizontal' | 'vertical';
29
37
  /** 刷新版本号 **/
30
38
  version?: number;
39
+ /** 附加属性 **/
40
+ attributes?: FieldAttribute[];
31
41
  }
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-form/form-engine",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "form-engine components",
5
5
  "keywords": [
6
6
  "coding-form",