@jswork/react-ant-form-schema 1.0.2 → 1.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jswork/react-ant-form-schema",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "main": "dist/main.cjs.js",
5
5
  "module": "dist/main.esm.js",
6
6
  "types": "dist/main.d.ts",
package/src/index.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import cx from 'classnames';
2
2
  import React, { FC, ReactNode } from 'react';
3
- import { Form, FormProps, Spin } from 'antd';
3
+ import { Form, FormProps } from 'antd';
4
4
  import NiceForm, { NiceFormMeta } from '@ebay/nice-form-react';
5
5
  import { deepMerge } from './utils';
6
6
 
@@ -36,30 +36,34 @@ export type ReactAntdFormSchemaProps = {
36
36
  * The form content.
37
37
  */
38
38
  footerClassName?: string;
39
- /**
40
- * Form loading status.
41
- */
42
- loading?: boolean;
43
39
  } & FormProps;
44
40
 
41
+ const defaultProps = {
42
+ className: '',
43
+ header: null,
44
+ footer: null,
45
+ footerClassName: '',
46
+ };
47
+
45
48
  const ReactAntdFormSchema: FC<ReactAntdFormSchemaProps> = (props) => {
46
- const { className, meta, header, footer, children, loading, footerClassName, ...rest } = props;
49
+ const { className, meta, header, footer, children, footerClassName, ...rest } = {
50
+ ...defaultProps,
51
+ ...props,
52
+ };
47
53
  const footerNode = footer || (children as ReactNode);
48
54
  const _meta = deepMerge(DEFAULT_META, meta);
49
55
  const _offset = _meta?.wrapperProps?.labelCol?.span || 4;
50
56
 
51
57
  return (
52
58
  <Form data-component={CLASS_NAME} className={cx(CLASS_NAME, className)} {...rest}>
53
- <Spin spinning={loading}>
54
- {header}
55
- <NiceForm meta={_meta} />
56
- <Form.Item
57
- wrapperCol={{ offset: _offset }}
58
- className={footerClassName}
59
- style={{ marginBottom: 0 }}>
60
- {footerNode}
61
- </Form.Item>
62
- </Spin>
59
+ {header}
60
+ <NiceForm meta={_meta} />
61
+ <Form.Item
62
+ wrapperCol={{ offset: _offset }}
63
+ className={footerClassName}
64
+ style={{ marginBottom: 0 }}>
65
+ {footerNode}
66
+ </Form.Item>
63
67
  </Form>
64
68
  );
65
69
  };
package/src/main.tsx CHANGED
@@ -1,3 +1,5 @@
1
1
  import ReactAntdFormSchema from '.';
2
+ import { ReactAntdFormSchemaProps } from '.';
2
3
 
3
4
  export default ReactAntdFormSchema;
5
+ export type { ReactAntdFormSchemaProps };