@lobehub/ui 1.155.2 → 1.155.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.
@@ -2,20 +2,18 @@
2
2
 
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["className", "children"];
5
+ var _excluded = ["children"];
6
6
  import { memo } from 'react';
7
7
  import { Flexbox } from 'react-layout-kit';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  var FormFooter = /*#__PURE__*/memo(function (_ref) {
10
- var className = _ref.className,
11
- children = _ref.children,
10
+ var children = _ref.children,
12
11
  rest = _objectWithoutProperties(_ref, _excluded);
13
12
  return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
14
- className: className,
15
13
  gap: 8,
14
+ horizontal: true,
16
15
  justify: 'flex-end'
17
16
  }, rest), {}, {
18
- horizontal: true,
19
17
  children: children
20
18
  }));
21
19
  });
@@ -1,5 +1,5 @@
1
1
  import { Form as AntForm, FormProps as AntFormProps, type FormInstance } from 'antd';
2
- import { type ReactNode, RefAttributes } from 'react';
2
+ import { CSSProperties, type ReactNode, RefAttributes } from 'react';
3
3
  import FormGroup, { type FormGroupProps, FormVariant, ItemsType } from './components/FormGroup';
4
4
  import FormItem, { type FormItemProps } from './components/FormItem';
5
5
  export interface ItemGroup {
@@ -11,12 +11,18 @@ export interface ItemGroup {
11
11
  }
12
12
  export interface FormProps extends Omit<AntFormProps, 'variant'> {
13
13
  children?: ReactNode;
14
+ classNames?: {
15
+ footer?: string;
16
+ };
14
17
  collapsible?: boolean;
15
18
  footer?: ReactNode;
16
19
  gap?: number | string;
17
20
  itemMinWidth?: FormItemProps['minWidth'];
18
21
  items?: ItemGroup[] | FormItemProps[];
19
22
  itemsType?: ItemsType;
23
+ styles?: {
24
+ footer?: CSSProperties;
25
+ };
20
26
  variant?: FormVariant;
21
27
  }
22
28
  export type { FormInstance } from 'antd';
@@ -24,6 +30,7 @@ export interface IForm {
24
30
  (props: FormProps & RefAttributes<FormInstance>): ReactNode;
25
31
  Group: typeof FormGroup;
26
32
  Item: typeof FormItem;
33
+ Provider: typeof AntForm.Provider;
27
34
  useForm: typeof AntForm.useForm;
28
35
  }
29
36
  declare const Form: IForm;
package/es/Form/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["className", "itemMinWidth", "footer", "form", "items", "children", "itemsType", "variant", "gap", "style", "collapsible"];
5
+ var _excluded = ["className", "itemMinWidth", "footer", "form", "items", "children", "itemsType", "variant", "gap", "style", "collapsible", "classNames", "styles"];
6
6
  import { Form as AntForm } from 'antd';
7
7
  import { forwardRef } from 'react';
8
8
  import FormFooter from "./components/FormFooter";
@@ -26,10 +26,14 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
26
26
  gap = _ref.gap,
27
27
  style = _ref.style,
28
28
  collapsible = _ref.collapsible,
29
+ _ref$classNames = _ref.classNames,
30
+ classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
31
+ _ref$styles = _ref.styles,
32
+ styles = _ref$styles === void 0 ? {} : _ref$styles,
29
33
  rest = _objectWithoutProperties(_ref, _excluded);
30
34
  var _useStyles = useStyles(),
31
35
  cx = _useStyles.cx,
32
- styles = _useStyles.styles;
36
+ s = _useStyles.styles;
33
37
  var mapFlat = function mapFlat(item, itemIndex) {
34
38
  return /*#__PURE__*/_jsx(FormItem, _objectSpread({
35
39
  divider: itemIndex !== 0,
@@ -52,7 +56,7 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
52
56
  }, groupIndex);
53
57
  };
54
58
  return /*#__PURE__*/_jsxs(AntForm, _objectSpread(_objectSpread({
55
- className: cx(styles.form, variant === 'pure' && styles.pure, styles.mobile, className),
59
+ className: cx(s.form, variant === 'pure' && s.pure, s.mobile, className),
56
60
  colon: false,
57
61
  form: form,
58
62
  layout: 'horizontal',
@@ -72,6 +76,8 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
72
76
  return mapFlat(item, i);
73
77
  })
74
78
  }) : undefined, children, footer && /*#__PURE__*/_jsx(FormFooter, {
79
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.footer,
80
+ style: styles === null || styles === void 0 ? void 0 : styles.footer,
75
81
  children: footer
76
82
  })]
77
83
  }));
@@ -80,4 +86,5 @@ var Form = FormParent;
80
86
  Form.Item = FormItem;
81
87
  Form.Group = FormGroup;
82
88
  Form.useForm = AntForm.useForm;
89
+ Form.Provider = AntForm.Provider;
83
90
  export default Form;
@@ -7,12 +7,13 @@ export interface FormModalProps extends PickModalProps, PickFormProps {
7
7
  classNames?: {
8
8
  form?: FormProps['className'];
9
9
  } & ModalProps['classNames'];
10
- finishButtonProps?: ModalProps['okButtonProps'];
11
- finishLoading?: ModalProps['confirmLoading'];
12
- finishText?: ModalProps['okText'];
10
+ onSubmit?: ModalProps['onOk'];
13
11
  styles?: {
14
12
  form?: FormProps['style'];
15
13
  } & ModalProps['styles'];
14
+ submitButtonProps?: ModalProps['okButtonProps'];
15
+ submitLoading?: ModalProps['confirmLoading'];
16
+ submitText?: ModalProps['okText'];
16
17
  }
17
18
  declare const FormModal: import("react").ForwardRefExoticComponent<FormModalProps & import("react").RefAttributes<FormInstance<any>>>;
18
19
  export default FormModal;
@@ -1,17 +1,15 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["classNames", "className", "style", "closable", "styles", "children", "allowFullscreen", "title", "wrapClassName", "afterOpenChange", "width", "onCancel", "centered", "open", "afterClose", "destroyOnClose", "closeIcon", "paddings", "maxHeight", "enableResponsive", "zIndex", "mask", "getContainer", "keyboard", "focusTriggerAfterClose", "forceRender", "loading", "footer", "finishButtonProps", "finishLoading", "onFinish", "finishText", "variant", "gap"],
3
+ var _excluded = ["classNames", "className", "style", "closable", "styles", "allowFullscreen", "title", "wrapClassName", "afterOpenChange", "width", "onCancel", "centered", "open", "afterClose", "destroyOnClose", "closeIcon", "paddings", "maxHeight", "enableResponsive", "zIndex", "mask", "getContainer", "keyboard", "focusTriggerAfterClose", "forceRender", "loading", "footer", "submitButtonProps", "submitLoading", "onFinish", "submitText", "variant", "gap", "onSubmit"],
4
4
  _excluded2 = ["form", "footer"],
5
5
  _excluded3 = ["form", "footer"];
6
6
  import { Button } from 'antd';
7
7
  import { useResponsive } from 'antd-style';
8
8
  import { forwardRef } from 'react';
9
- import { Flexbox } from 'react-layout-kit';
10
9
  import Form from "../Form";
11
10
  import Modal from "../Modal";
12
11
  import { useStyles } from "./style";
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
- import { jsxs as _jsxs } from "react/jsx-runtime";
15
13
  var FormModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
16
14
  var _ref$classNames = _ref.classNames,
17
15
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
@@ -20,7 +18,6 @@ var FormModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
20
18
  closable = _ref.closable,
21
19
  _ref$styles = _ref.styles,
22
20
  styles = _ref$styles === void 0 ? {} : _ref$styles,
23
- children = _ref.children,
24
21
  allowFullscreen = _ref.allowFullscreen,
25
22
  title = _ref.title,
26
23
  wrapClassName = _ref.wrapClassName,
@@ -43,13 +40,14 @@ var FormModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
43
40
  forceRender = _ref.forceRender,
44
41
  loading = _ref.loading,
45
42
  footer = _ref.footer,
46
- finishButtonProps = _ref.finishButtonProps,
47
- finishLoading = _ref.finishLoading,
43
+ submitButtonProps = _ref.submitButtonProps,
44
+ submitLoading = _ref.submitLoading,
48
45
  onFinish = _ref.onFinish,
49
- finishText = _ref.finishText,
46
+ submitText = _ref.submitText,
50
47
  _ref$variant = _ref.variant,
51
48
  variant = _ref$variant === void 0 ? 'pure' : _ref$variant,
52
49
  gap = _ref.gap,
50
+ onSubmit = _ref.onSubmit,
53
51
  rest = _objectWithoutProperties(_ref, _excluded);
54
52
  var _useResponsive = useResponsive(),
55
53
  mobile = _useResponsive.mobile;
@@ -71,7 +69,7 @@ var FormModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
71
69
  classNames: modalClassNames,
72
70
  closable: closable,
73
71
  closeIcon: closeIcon,
74
- confirmLoading: finishLoading,
72
+ confirmLoading: submitLoading,
75
73
  destroyOnClose: destroyOnClose,
76
74
  enableResponsive: enableResponsive,
77
75
  focusTriggerAfterClose: focusTriggerAfterClose,
@@ -95,34 +93,33 @@ var FormModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
95
93
  width: width,
96
94
  wrapClassName: wrapClassName,
97
95
  zIndex: zIndex,
98
- children: /*#__PURE__*/_jsxs(Form, _objectSpread(_objectSpread({
96
+ children: /*#__PURE__*/_jsx(Form, _objectSpread({
99
97
  className: cx(s.form, formClassName),
98
+ classNames: {
99
+ footer: cx(s.footer, footerClassName)
100
+ },
100
101
  clearOnDestroy: destroyOnClose,
102
+ footer: footer || /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
103
+ block: true,
104
+ htmlType: "submit",
105
+ loading: submitLoading,
106
+ onClick: onSubmit,
107
+ type: 'primary'
108
+ }, submitButtonProps), {}, {
109
+ style: _objectSpread({
110
+ flex: 1
111
+ }, submitButtonProps === null || submitButtonProps === void 0 ? void 0 : submitButtonProps.style),
112
+ children: submitText || 'Submit'
113
+ })),
101
114
  gap: gap || (variant === 'pure' ? 24 : gap),
102
115
  onFinish: onFinish,
103
116
  ref: ref,
104
117
  style: formStyle,
118
+ styles: {
119
+ footer: footerStyle
120
+ },
105
121
  variant: variant
106
- }, rest), {}, {
107
- children: [children, /*#__PURE__*/_jsx(Flexbox, {
108
- className: cx(s.footer, footerClassName),
109
- gap: 8,
110
- horizontal: true,
111
- style: footerStyle,
112
- width: '100%',
113
- children: footer || /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
114
- block: true,
115
- htmlType: "submit",
116
- loading: finishLoading,
117
- type: 'primary'
118
- }, finishButtonProps), {}, {
119
- style: _objectSpread({
120
- flex: 1
121
- }, finishButtonProps === null || finishButtonProps === void 0 ? void 0 : finishButtonProps.style),
122
- children: finishText || 'Submit'
123
- }))
124
- })]
125
- }))
122
+ }, rest))
126
123
  });
127
124
  });
128
125
  export default FormModal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.155.2",
3
+ "version": "1.155.4",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",