@lobehub/ui 1.155.3 → 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.
- package/es/Form/components/FormFooter.js +3 -5
- package/es/Form/index.d.ts +7 -1
- package/es/Form/index.js +9 -3
- package/es/FormModal/index.js +21 -26
- package/package.json +1 -1
|
@@ -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 = ["
|
|
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
|
|
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
|
});
|
package/es/Form/index.d.ts
CHANGED
|
@@ -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';
|
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
|
-
|
|
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(
|
|
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
|
}));
|
package/es/FormModal/index.js
CHANGED
|
@@ -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", "
|
|
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,
|
|
@@ -96,35 +93,33 @@ var FormModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
96
93
|
width: width,
|
|
97
94
|
wrapClassName: wrapClassName,
|
|
98
95
|
zIndex: zIndex,
|
|
99
|
-
children: /*#__PURE__*/
|
|
96
|
+
children: /*#__PURE__*/_jsx(Form, _objectSpread({
|
|
100
97
|
className: cx(s.form, formClassName),
|
|
98
|
+
classNames: {
|
|
99
|
+
footer: cx(s.footer, footerClassName)
|
|
100
|
+
},
|
|
101
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
|
+
})),
|
|
102
114
|
gap: gap || (variant === 'pure' ? 24 : gap),
|
|
103
115
|
onFinish: onFinish,
|
|
104
116
|
ref: ref,
|
|
105
117
|
style: formStyle,
|
|
118
|
+
styles: {
|
|
119
|
+
footer: footerStyle
|
|
120
|
+
},
|
|
106
121
|
variant: variant
|
|
107
|
-
}, rest)
|
|
108
|
-
children: [children, /*#__PURE__*/_jsx(Flexbox, {
|
|
109
|
-
className: cx(s.footer, footerClassName),
|
|
110
|
-
gap: 8,
|
|
111
|
-
horizontal: true,
|
|
112
|
-
style: footerStyle,
|
|
113
|
-
width: '100%',
|
|
114
|
-
children: footer || /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
115
|
-
block: true,
|
|
116
|
-
htmlType: "submit",
|
|
117
|
-
loading: submitLoading,
|
|
118
|
-
onClick: onSubmit,
|
|
119
|
-
type: 'primary'
|
|
120
|
-
}, submitButtonProps), {}, {
|
|
121
|
-
style: _objectSpread({
|
|
122
|
-
flex: 1
|
|
123
|
-
}, submitButtonProps === null || submitButtonProps === void 0 ? void 0 : submitButtonProps.style),
|
|
124
|
-
children: submitText || 'Submit'
|
|
125
|
-
}))
|
|
126
|
-
})]
|
|
127
|
-
}))
|
|
122
|
+
}, rest))
|
|
128
123
|
});
|
|
129
124
|
});
|
|
130
125
|
export default FormModal;
|