zy-react-library 1.0.68 → 1.0.69

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.
@@ -31,6 +31,8 @@ export interface FormBuilderProps extends FormProps {
31
31
  customActionButtons?: ReactNode;
32
32
  /** 额外操作按钮组 */
33
33
  extraActionButtons?: ReactNode;
34
+ /** 是否处于加载状态,默认 false */
35
+ loading?: boolean;
34
36
  }
35
37
 
36
38
  /**
@@ -1,4 +1,4 @@
1
- import { Button, Col, Form, Row, Space } from "antd";
1
+ import { Button, Col, Form, Row, Space, Spin } from "antd";
2
2
  import FormItemsRenderer from "./FormItemsRenderer";
3
3
 
4
4
  /**
@@ -19,6 +19,7 @@ const FormBuilder = (props) => {
19
19
  showCancelButton = true,
20
20
  customActionButtons,
21
21
  extraActionButtons,
22
+ loading = false,
22
23
  ...restProps
23
24
  } = props;
24
25
 
@@ -27,45 +28,47 @@ const FormBuilder = (props) => {
27
28
  };
28
29
 
29
30
  return (
30
- <Form
31
- labelCol={labelCol}
32
- scrollToFirstError
33
- wrapperCol={{ span: 24 - labelCol.span }}
34
- initialValues={values}
35
- style={{ width: `calc(100% - ${gutter * 2}px)`, margin: `0 auto` }}
36
- {...restProps}
37
- >
38
- <Row gutter={gutter}>
39
- <FormItemsRenderer
40
- options={options}
41
- labelCol={labelCol}
42
- span={span}
43
- useAutoGenerateRequired={useAutoGenerateRequired}
44
- initialValues={values}
45
- />
46
- </Row>
47
- {showActionButtons && (
48
- <Row gutter={gutter} style={{ marginTop: 24 }}>
49
- <Col span={24} style={{ textAlign: "center" }}>
50
- {customActionButtons || (
51
- <Space>
52
- {showSubmitButton && (
53
- <Button type="primary" htmlType="submit">
54
- {submitButtonText}
55
- </Button>
56
- )}
57
- {showCancelButton && (
58
- <Button onClick={handleCancel} style={{ marginRight: 8 }}>
59
- {cancelButtonText}
60
- </Button>
61
- )}
62
- {extraActionButtons}
63
- </Space>
64
- )}
65
- </Col>
31
+ <Spin spinning={loading}>
32
+ <Form
33
+ labelCol={labelCol}
34
+ scrollToFirstError
35
+ wrapperCol={{ span: 24 - labelCol.span }}
36
+ initialValues={values}
37
+ style={{ width: `calc(100% - ${gutter * 2}px)`, margin: `0 auto` }}
38
+ {...restProps}
39
+ >
40
+ <Row gutter={gutter}>
41
+ <FormItemsRenderer
42
+ options={options}
43
+ labelCol={labelCol}
44
+ span={span}
45
+ useAutoGenerateRequired={useAutoGenerateRequired}
46
+ initialValues={values}
47
+ />
66
48
  </Row>
67
- )}
68
- </Form>
49
+ {showActionButtons && (
50
+ <Row gutter={gutter} style={{ marginTop: 24 }}>
51
+ <Col span={24} style={{ textAlign: "center" }}>
52
+ {customActionButtons || (
53
+ <Space>
54
+ {showSubmitButton && (
55
+ <Button type="primary" htmlType="submit">
56
+ {submitButtonText}
57
+ </Button>
58
+ )}
59
+ {showCancelButton && (
60
+ <Button onClick={handleCancel} style={{ marginRight: 8 }}>
61
+ {cancelButtonText}
62
+ </Button>
63
+ )}
64
+ {extraActionButtons}
65
+ </Space>
66
+ )}
67
+ </Col>
68
+ </Row>
69
+ )}
70
+ </Form>
71
+ </Spin>
69
72
  );
70
73
  };
71
74
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.0.68",
4
+ "version": "1.0.69",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",