@lobehub/ui 1.154.0 → 1.155.0
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/Collapse/index.d.ts +2 -1
- package/es/Collapse/index.js +6 -4
- package/es/Collapse/style.d.ts +4 -3
- package/es/Collapse/style.js +7 -4
- package/es/Form/components/FormGroup.d.ts +3 -3
- package/es/Form/components/FormGroup.js +34 -47
- package/es/Form/components/FormItem.js +1 -1
- package/es/Form/index.d.ts +2 -0
- package/es/Form/index.js +10 -3
- package/es/Form/style.d.ts +1 -0
- package/es/Form/style.js +3 -2
- package/es/FormModal/index.d.ts +17 -0
- package/es/FormModal/index.js +125 -0
- package/es/FormModal/style.d.ts +4 -0
- package/es/FormModal/style.js +13 -0
- package/es/Modal/index.d.ts +1 -3
- package/es/Modal/index.js +59 -45
- package/es/Modal/style.d.ts +9 -0
- package/es/Modal/style.js +17 -0
- package/es/components.d.ts +1 -0
- package/es/components.js +1 -0
- package/package.json +1 -1
package/es/Collapse/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CollapseProps as AntdCollapseProps } from 'antd';
|
|
3
3
|
export type Variant = 'default' | 'block' | 'ghost' | 'pure';
|
|
4
|
-
export interface CollapseProps extends AntdCollapseProps {
|
|
4
|
+
export interface CollapseProps extends Omit<AntdCollapseProps, 'collapsible'> {
|
|
5
|
+
collapsible?: boolean;
|
|
5
6
|
gap?: number;
|
|
6
7
|
padding?: number | string | {
|
|
7
8
|
body?: number | string;
|
package/es/Collapse/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["style", "variant", "gap", "className", "padding"];
|
|
4
|
+
var _excluded = ["style", "variant", "gap", "className", "padding", "collapsible"];
|
|
5
5
|
import { Collapse as AntdCollapse } from 'antd';
|
|
6
6
|
import { ChevronDown } from 'lucide-react';
|
|
7
7
|
import { memo } from 'react';
|
|
@@ -16,12 +16,14 @@ var Collapse = /*#__PURE__*/memo(function (_ref) {
|
|
|
16
16
|
gap = _ref$gap === void 0 ? 0 : _ref$gap,
|
|
17
17
|
className = _ref.className,
|
|
18
18
|
padding = _ref.padding,
|
|
19
|
+
_ref$collapsible = _ref.collapsible,
|
|
20
|
+
collapsible = _ref$collapsible === void 0 ? true : _ref$collapsible,
|
|
19
21
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
22
|
var bodyPadding = _typeof(padding) === 'object' ? padding.body : padding;
|
|
21
23
|
var headerPadding = _typeof(padding) === 'object' ? padding.header : padding;
|
|
22
24
|
var _useStyles = useStyles({
|
|
23
|
-
bodyPadding: bodyPadding
|
|
24
|
-
headerPadding: headerPadding
|
|
25
|
+
bodyPadding: bodyPadding,
|
|
26
|
+
headerPadding: headerPadding,
|
|
25
27
|
isSplit: !!gap
|
|
26
28
|
}),
|
|
27
29
|
cx = _useStyles.cx,
|
|
@@ -29,7 +31,7 @@ var Collapse = /*#__PURE__*/memo(function (_ref) {
|
|
|
29
31
|
var variantStyle = cx(variant === 'default' && styles.defaultStyle, variant === 'block' && styles.blockStyle, variant === 'ghost' && styles.ghostStyle, variant === 'pure' && styles.pureStyle);
|
|
30
32
|
return /*#__PURE__*/_jsx(AntdCollapse, _objectSpread({
|
|
31
33
|
bordered: !gap && (variant === 'default' || variant === 'ghost'),
|
|
32
|
-
className: cx(styles.group, variantStyle, className),
|
|
34
|
+
className: cx(styles.group, !collapsible && styles.hideCollapsibleIcon, variantStyle, className),
|
|
33
35
|
expandIcon: function expandIcon(_ref2) {
|
|
34
36
|
var isActive = _ref2.isActive;
|
|
35
37
|
return /*#__PURE__*/_jsx(Icon, {
|
package/es/Collapse/style.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export declare const useStyles: (props?: {
|
|
2
|
-
bodyPadding
|
|
3
|
-
headerPadding
|
|
4
|
-
isSplit
|
|
2
|
+
bodyPadding?: string | number | undefined;
|
|
3
|
+
headerPadding?: string | number | undefined;
|
|
4
|
+
isSplit?: boolean | undefined;
|
|
5
5
|
} | undefined) => import("antd-style").ReturnStyles<{
|
|
6
6
|
blockStyle: string;
|
|
7
7
|
defaultStyle: string;
|
|
8
8
|
flatGroup: import("antd-style").SerializedStyles;
|
|
9
9
|
ghostStyle: string;
|
|
10
10
|
group: string;
|
|
11
|
+
hideCollapsibleIcon: import("antd-style").SerializedStyles;
|
|
11
12
|
icon: import("antd-style").SerializedStyles;
|
|
12
13
|
pureStyle: import("antd-style").SerializedStyles;
|
|
13
14
|
}>;
|
package/es/Collapse/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
5
|
var css = _ref.css,
|
|
@@ -8,8 +8,10 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
8
8
|
isDarkMode = _ref.isDarkMode,
|
|
9
9
|
prefixCls = _ref.prefixCls;
|
|
10
10
|
var isSplit = _ref2.isSplit,
|
|
11
|
-
bodyPadding = _ref2.bodyPadding,
|
|
12
|
-
|
|
11
|
+
_ref2$bodyPadding = _ref2.bodyPadding,
|
|
12
|
+
bodyPadding = _ref2$bodyPadding === void 0 ? '12px 16px' : _ref2$bodyPadding,
|
|
13
|
+
_ref2$headerPadding = _ref2.headerPadding,
|
|
14
|
+
headerPadding = _ref2$headerPadding === void 0 ? '12px 16px' : _ref2$headerPadding;
|
|
13
15
|
var pureStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: transparent;\n border-radius: 0;\n\n .", "-collapse-header {\n padding-inline: 0 !important;\n background: transparent !important;\n }\n\n .", "-collapse-content {\n background: transparent;\n border-color: ", ";\n }\n\n .", "-collapse-content-box {\n padding-inline: 2px !important;\n background: transparent;\n border-radius: 0;\n }\n "])), prefixCls, prefixCls, token.colorFillSecondary, prefixCls);
|
|
14
16
|
var blockStyle = cx(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: transparent !important;\n .", "-collapse-item {\n background: ", " !important;\n }\n\n .", "-collapse-header {\n background: ", " !important;\n }\n "])), prefixCls, token.colorFillQuaternary, prefixCls, token.colorFillTertiary), isSplit ? css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-collapse-item {\n overflow: hidden;\n border-radius: ", "px !important;\n }\n "])), prefixCls, token.borderRadiusLG) : css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-radius: ", "px;\n "])), token.borderRadiusLG));
|
|
15
17
|
var ghostStyle = cx(css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: transparent;\n\n .", "-collapse-header {\n background: transparent !important;\n }\n\n .", "-collapse-content-box {\n background: transparent;\n }\n "])), prefixCls, prefixCls), isSplit ? css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n .", "-collapse-item {\n overflow: hidden;\n border: 1px solid ", " !important;\n border-radius: ", "px !important;\n &.", "-collapse-item-active {\n .", "-collapse-content-box {\n border-block-start: 1px solid ", " !important;\n }\n }\n }\n "])), prefixCls, token.colorBorderSecondary, token.borderRadiusLG, prefixCls, prefixCls, token.colorBorderSecondary) : css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n .", "-collapse-item:not(:first-child) {\n .", "-collapse-header {\n border-block-start: 1px solid ", ";\n }\n }\n "])), prefixCls, prefixCls, token.colorBorderSecondary));
|
|
@@ -20,7 +22,8 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
20
22
|
flatGroup: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n overflow: hidden;\n padding-inline: 16px;\n "]))),
|
|
21
23
|
ghostStyle: ghostStyle,
|
|
22
24
|
group: cx(isDarkMode && css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n .", "-collapse-content {\n background: transparent;\n border-color: ", ";\n }\n\n .", "-collapse-header {\n background: ", ";\n }\n "])), prefixCls, token.colorBorderSecondary, prefixCls, token.colorFillTertiary), css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n overflow: hidden;\n display: flex;\n flex: none;\n flex-direction: column;\n\n .", "-collapse-item {\n border: none;\n }\n\n .", "-collapse-extra {\n margin-inline-start: 16px;\n }\n\n .", "-collapse-header {\n align-items: center !important;\n padding: ", " !important;\n border-radius: 0 !important;\n }\n\n .", "-collapse-content-box {\n padding: ", " !important;\n }\n\n .", "-form-item-label {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n "])), prefixCls, prefixCls, prefixCls, typeof headerPadding === 'string' ? headerPadding : "".concat(headerPadding, "px"), prefixCls, typeof bodyPadding === 'string' ? bodyPadding : "".concat(bodyPadding, "px"), prefixCls)),
|
|
23
|
-
|
|
25
|
+
hideCollapsibleIcon: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n .", "-collapse-expand-icon {\n display: none !important;\n }\n "])), prefixCls),
|
|
26
|
+
icon: css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n transition: all 100ms ", ";\n "])), token.motionEaseOut),
|
|
24
27
|
pureStyle: pureStyle
|
|
25
28
|
};
|
|
26
29
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type CollapseProps } from 'antd';
|
|
2
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { type CollapseProps } from "../../Collapse";
|
|
3
3
|
import { type IconProps } from "../../Icon";
|
|
4
4
|
export type FormVariant = 'default' | 'block' | 'ghost' | 'pure';
|
|
5
5
|
export type ItemsType = 'group' | 'flat';
|
|
@@ -8,7 +8,6 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
|
|
|
8
8
|
defaultStyle: import("antd-style").SerializedStyles;
|
|
9
9
|
flatGroup: import("antd-style").SerializedStyles;
|
|
10
10
|
ghostStyle: import("antd-style").SerializedStyles;
|
|
11
|
-
group: string;
|
|
12
11
|
icon: import("antd-style").SerializedStyles;
|
|
13
12
|
mobileFlatGroup: import("antd-style").SerializedStyles;
|
|
14
13
|
mobileGroupBody: import("antd-style").SerializedStyles;
|
|
@@ -17,8 +16,9 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
|
|
|
17
16
|
pureTitle: import("antd-style").SerializedStyles;
|
|
18
17
|
title: import("antd-style").SerializedStyles;
|
|
19
18
|
}>;
|
|
20
|
-
export interface FormGroupProps extends CollapseProps {
|
|
19
|
+
export interface FormGroupProps extends Omit<CollapseProps, 'collapsible'> {
|
|
21
20
|
children: ReactNode;
|
|
21
|
+
collapsible?: boolean;
|
|
22
22
|
defaultActive?: boolean;
|
|
23
23
|
extra?: ReactNode;
|
|
24
24
|
icon?: IconProps['icon'];
|
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
4
|
-
var _excluded = ["className", "icon", "title", "children", "extra", "itemsType", "variant", "defaultActive"];
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11
|
|
6
|
-
import { Collapse } from 'antd';
|
|
4
|
+
var _excluded = ["className", "icon", "title", "children", "extra", "itemsType", "variant", "defaultActive", "collapsible"];
|
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
7
6
|
import { createStyles, useResponsive } from 'antd-style';
|
|
8
|
-
import {
|
|
7
|
+
import { isUndefined } from 'lodash-es';
|
|
9
8
|
import { memo } from 'react';
|
|
10
9
|
import { Flexbox } from 'react-layout-kit';
|
|
10
|
+
import Collapse from "../../Collapse";
|
|
11
11
|
import Icon from "../../Icon";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
export var useStyles = createStyles(function (_ref) {
|
|
15
15
|
var css = _ref.css,
|
|
16
|
-
cx = _ref.cx,
|
|
17
16
|
token = _ref.token,
|
|
18
|
-
|
|
19
|
-
responsive = _ref.responsive,
|
|
20
|
-
prefixCls = _ref.prefixCls;
|
|
21
|
-
var pureStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: transparent;\n border: none;\n border-radius: 0;\n\n .", "-collapse-header {\n padding-block: 0 20px !important;\n padding-inline: 2px !important;\n background: transparent !important;\n border-radius: 0 !important;\n }\n\n .", "-collapse-content {\n background: transparent;\n border-color: ", ";\n }\n\n .", "-collapse-content-box {\n padding-inline: 2px !important;\n background: transparent;\n border-radius: 0;\n }\n "])), prefixCls, prefixCls, token.colorFillSecondary, prefixCls);
|
|
22
|
-
var blockStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: ", ";\n border: none;\n border-radius: ", "px;\n\n .", "-collapse-content {\n border: none !important;\n }\n "])), token.colorFillQuaternary, token.borderRadiusLG, prefixCls);
|
|
23
|
-
var ghostStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background: transparent;\n border: 1px solid ", ";\n .", "-collapse-header {\n background: transparent !important;\n }\n\n .", "-collapse-content-box {\n background: transparent;\n }\n "])), token.colorBorderSecondary, prefixCls, prefixCls);
|
|
24
|
-
var defaultStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.colorBorderSecondary, token.borderRadiusLG);
|
|
17
|
+
responsive = _ref.responsive;
|
|
25
18
|
return {
|
|
26
|
-
blockStyle:
|
|
27
|
-
defaultStyle:
|
|
28
|
-
flatGroup: css(
|
|
29
|
-
ghostStyle:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
title: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n align-items: center;\n font-size: 16px;\n font-weight: 600;\n\n .anticon {\n color: ", ";\n }\n\n ", " {\n font-size: 14px;\n font-weight: 400;\n opacity: 0.5;\n }\n "])), token.colorPrimary, responsive.mobile)
|
|
19
|
+
blockStyle: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n border: none;\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.borderRadiusLG),
|
|
20
|
+
defaultStyle: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.colorBorderSecondary, token.borderRadiusLG),
|
|
21
|
+
flatGroup: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: hidden;\n padding-inline: 16px;\n "]))),
|
|
22
|
+
ghostStyle: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background: transparent;\n border: 1px solid ", ";\n "])), token.colorBorderSecondary),
|
|
23
|
+
icon: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n transition: all 100ms ", ";\n "])), token.motionEaseOut),
|
|
24
|
+
mobileFlatGroup: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n border-radius: ", "px;\n "])), token.borderRadiusLG),
|
|
25
|
+
mobileGroupBody: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding-block: 0;\n padding-inline: 16px;\n background: ", ";\n "])), token.colorBgContainer),
|
|
26
|
+
mobileGroupHeader: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding: 16px;\n background: ", ";\n "])), token.colorBgLayout),
|
|
27
|
+
pureStyle: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding: 0;\n background: transparent;\n border: none;\n border-radius: 0;\n "]))),
|
|
28
|
+
pureTitle: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n font-size: 18px;\n font-weight: 700;\n line-height: 24px;\n "]))),
|
|
29
|
+
title: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n align-items: center;\n font-size: 16px;\n font-weight: 600;\n\n .anticon {\n color: ", ";\n }\n\n ", " {\n font-size: 14px;\n font-weight: 400;\n opacity: 0.5;\n }\n "])), token.colorPrimary, responsive.mobile)
|
|
38
30
|
};
|
|
39
31
|
});
|
|
40
32
|
var FormGroup = /*#__PURE__*/memo(function (_ref2) {
|
|
@@ -48,15 +40,22 @@ var FormGroup = /*#__PURE__*/memo(function (_ref2) {
|
|
|
48
40
|
variant = _ref2$variant === void 0 ? 'default' : _ref2$variant,
|
|
49
41
|
_ref2$defaultActive = _ref2.defaultActive,
|
|
50
42
|
defaultActive = _ref2$defaultActive === void 0 ? true : _ref2$defaultActive,
|
|
43
|
+
collapsible = _ref2.collapsible,
|
|
51
44
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
52
45
|
var _useResponsive = useResponsive(),
|
|
53
46
|
mobile = _useResponsive.mobile;
|
|
54
47
|
var _useStyles = useStyles(variant),
|
|
55
48
|
cx = _useStyles.cx,
|
|
56
|
-
styles = _useStyles.styles
|
|
49
|
+
styles = _useStyles.styles,
|
|
50
|
+
prefixCls = _useStyles.prefixCls;
|
|
51
|
+
var groupClassName = "".concat(prefixCls, "-form-group");
|
|
52
|
+
var groupTitleClassName = "".concat(prefixCls, "-form-group-title");
|
|
53
|
+
var groupHeaderClassName = "".concat(prefixCls, "-form-group-header");
|
|
54
|
+
var groupContentClassName = "".concat(prefixCls, "-form-group-content");
|
|
57
55
|
var variantStyle = cx(variant === 'default' && styles.defaultStyle, variant === 'block' && styles.blockStyle, variant === 'ghost' && styles.ghostStyle, variant === 'pure' && styles.pureStyle);
|
|
56
|
+
var defaultCollapsible = isUndefined(collapsible) ? variant !== 'pure' : collapsible;
|
|
58
57
|
var titleContent = /*#__PURE__*/_jsxs(Flexbox, {
|
|
59
|
-
className: cx(styles.title, variant === 'pure' && styles.pureTitle),
|
|
58
|
+
className: cx(groupTitleClassName, styles.title, variant === 'pure' && styles.pureTitle),
|
|
60
59
|
gap: 8,
|
|
61
60
|
horizontal: true,
|
|
62
61
|
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
@@ -65,48 +64,36 @@ var FormGroup = /*#__PURE__*/memo(function (_ref2) {
|
|
|
65
64
|
});
|
|
66
65
|
if (itemsType === 'flat') {
|
|
67
66
|
return mobile ? /*#__PURE__*/_jsx(Flexbox, {
|
|
68
|
-
className: cx(styles.mobileFlatGroup, styles.mobileGroupBody, className),
|
|
67
|
+
className: cx(groupClassName, styles.mobileFlatGroup, styles.mobileGroupBody, className),
|
|
69
68
|
children: children
|
|
70
69
|
}) : /*#__PURE__*/_jsx(Flexbox, {
|
|
71
|
-
className: cx(styles.flatGroup, variantStyle, className),
|
|
70
|
+
className: cx(groupClassName, styles.flatGroup, variantStyle, className),
|
|
72
71
|
children: children
|
|
73
72
|
});
|
|
74
73
|
}
|
|
75
74
|
if (mobile) return /*#__PURE__*/_jsxs(Flexbox, {
|
|
76
|
-
className: className,
|
|
75
|
+
className: cx(groupClassName, className),
|
|
77
76
|
children: [/*#__PURE__*/_jsxs(Flexbox, {
|
|
78
|
-
className: styles.mobileGroupHeader,
|
|
77
|
+
className: cx(groupHeaderClassName, styles.mobileGroupHeader),
|
|
79
78
|
horizontal: true,
|
|
80
79
|
justify: 'space-between',
|
|
81
80
|
children: [titleContent, extra]
|
|
82
81
|
}), /*#__PURE__*/_jsx("div", {
|
|
83
|
-
className: styles.mobileGroupBody,
|
|
82
|
+
className: cx(groupContentClassName, styles.mobileGroupBody),
|
|
84
83
|
children: children
|
|
85
84
|
})]
|
|
86
85
|
});
|
|
87
86
|
return /*#__PURE__*/_jsx(Collapse, _objectSpread({
|
|
88
|
-
className: cx(
|
|
89
|
-
collapsible:
|
|
87
|
+
className: cx(groupClassName, className),
|
|
88
|
+
collapsible: defaultCollapsible,
|
|
90
89
|
defaultActiveKey: defaultActive ? [1] : undefined,
|
|
91
|
-
expandIcon: function expandIcon(_ref3) {
|
|
92
|
-
var isActive = _ref3.isActive;
|
|
93
|
-
return variant === 'pure' ? null : /*#__PURE__*/_jsx(Icon, {
|
|
94
|
-
className: styles.icon,
|
|
95
|
-
icon: ChevronDown,
|
|
96
|
-
size: {
|
|
97
|
-
fontSize: 16
|
|
98
|
-
},
|
|
99
|
-
style: isActive ? {} : {
|
|
100
|
-
rotate: '-90deg'
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
90
|
items: [{
|
|
105
91
|
children: children,
|
|
106
92
|
extra: extra,
|
|
107
93
|
key: 1,
|
|
108
94
|
label: titleContent
|
|
109
|
-
}]
|
|
95
|
+
}],
|
|
96
|
+
variant: variant
|
|
110
97
|
}, rest), 1);
|
|
111
98
|
});
|
|
112
99
|
export default FormGroup;
|
|
@@ -18,7 +18,7 @@ export var useStyles = createStyles(function (_ref, itemMinWidth) {
|
|
|
18
18
|
responsive = _ref.responsive,
|
|
19
19
|
prefixCls = _ref.prefixCls;
|
|
20
20
|
return {
|
|
21
|
-
item: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.", "-form-item {\n padding-block: 16px;\n padding-inline: 0;\n\n .", "-row {\n gap: 12px;\n justify-content: space-between;\n\n > div {\n flex: unset;\n flex-grow: unset;\n }\n }\n\n .", "-form-item-required::before {\n align-self: flex-start;\n }\n\n ", " {\n .", "-row {\n flex-direction: column;\n align-items: stretch;\n\n > div {\n width: 100%;\n }\n }\n }\n\n ", " {\n padding-block: 16px;\n padding-inline: 0;\n\n .", "-row {\n flex-wrap: wrap;\n gap: 4px;\n }\n }\n }\n "])), prefixCls, prefixCls, prefixCls, responsive.md, prefixCls, responsive.mobile, prefixCls),
|
|
21
|
+
item: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.", "-form-item {\n padding-block: 16px;\n padding-inline: 0;\n\n .", "-form-item-label {\n text-align: start;\n }\n\n .", "-row {\n gap: 12px;\n justify-content: space-between;\n\n > div {\n flex: unset;\n flex-grow: unset;\n }\n }\n\n .", "-form-item-required::before {\n align-self: flex-start;\n }\n\n ", " {\n .", "-row {\n flex-direction: column;\n align-items: stretch;\n\n > div {\n width: 100%;\n }\n }\n }\n\n ", " {\n padding-block: 16px;\n padding-inline: 0;\n\n .", "-row {\n flex-wrap: wrap;\n gap: 4px;\n }\n }\n }\n "])), prefixCls, prefixCls, prefixCls, prefixCls, responsive.md, prefixCls, responsive.mobile, prefixCls),
|
|
22
22
|
itemMinWidth: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-form-item-control {\n width: ", ";\n }\n ", " {\n .", "-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .", "-form-item-control {\n flex: 1;\n width: 100%;\n }\n }\n "])), prefixCls, isNumber(itemMinWidth) ? "".concat(itemMinWidth, "px") : itemMinWidth, responsive.mobile, prefixCls, prefixCls),
|
|
23
23
|
itemNoDivider: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:not(:first-child) {\n padding-block-start: 0;\n }\n "])))
|
|
24
24
|
};
|
package/es/Form/index.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ export interface ItemGroup {
|
|
|
11
11
|
}
|
|
12
12
|
export interface FormProps extends Omit<AntFormProps, 'variant'> {
|
|
13
13
|
children?: ReactNode;
|
|
14
|
+
collapsible?: boolean;
|
|
14
15
|
footer?: ReactNode;
|
|
16
|
+
gap?: number | string;
|
|
15
17
|
itemMinWidth?: FormItemProps['minWidth'];
|
|
16
18
|
items?: ItemGroup[] | FormItemProps[];
|
|
17
19
|
itemsType?: ItemsType;
|
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"];
|
|
5
|
+
var _excluded = ["className", "itemMinWidth", "footer", "form", "items", "children", "itemsType", "variant", "gap", "style", "collapsible"];
|
|
6
6
|
import { Form as AntForm } from 'antd';
|
|
7
7
|
import { forwardRef } from 'react';
|
|
8
8
|
import FormFooter from "./components/FormFooter";
|
|
@@ -23,6 +23,9 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
23
23
|
itemsType = _ref$itemsType === void 0 ? 'group' : _ref$itemsType,
|
|
24
24
|
_ref$variant = _ref.variant,
|
|
25
25
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
26
|
+
gap = _ref.gap,
|
|
27
|
+
style = _ref.style,
|
|
28
|
+
collapsible = _ref.collapsible,
|
|
26
29
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
27
30
|
var _useStyles = useStyles(),
|
|
28
31
|
cx = _useStyles.cx,
|
|
@@ -35,6 +38,7 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
35
38
|
};
|
|
36
39
|
var mapTree = function mapTree(group, groupIndex) {
|
|
37
40
|
return /*#__PURE__*/_jsx(FormGroup, {
|
|
41
|
+
collapsible: collapsible,
|
|
38
42
|
defaultActive: group === null || group === void 0 ? void 0 : group.defaultActive,
|
|
39
43
|
extra: group === null || group === void 0 ? void 0 : group.extra,
|
|
40
44
|
icon: group === null || group === void 0 ? void 0 : group.icon,
|
|
@@ -48,11 +52,14 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
48
52
|
}, groupIndex);
|
|
49
53
|
};
|
|
50
54
|
return /*#__PURE__*/_jsxs(AntForm, _objectSpread(_objectSpread({
|
|
51
|
-
className: cx(styles.form, variant === 'pure' && styles.pure, className),
|
|
55
|
+
className: cx(styles.form, variant === 'pure' && styles.pure, styles.mobile, className),
|
|
52
56
|
colon: false,
|
|
53
57
|
form: form,
|
|
54
58
|
layout: 'horizontal',
|
|
55
|
-
ref: ref
|
|
59
|
+
ref: ref,
|
|
60
|
+
style: _objectSpread({
|
|
61
|
+
gap: gap
|
|
62
|
+
}, style)
|
|
56
63
|
}, rest), {}, {
|
|
57
64
|
children: [(items === null || items === void 0 ? void 0 : items.length) > 0 ? itemsType === 'group' ? items === null || items === void 0 ? void 0 : items.map(function (item, i) {
|
|
58
65
|
return mapTree(item, i);
|
package/es/Form/style.d.ts
CHANGED
package/es/Form/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
@@ -8,6 +8,7 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
8
8
|
responsive = _ref.responsive;
|
|
9
9
|
return {
|
|
10
10
|
form: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n width: 100%;\n\n ", " {\n gap: 0;\n }\n\n .", "-form-item {\n margin: 0 !important;\n }\n\n .", "-form-item .", "-form-item-label > label {\n height: unset;\n }\n\n .", "-row {\n position: relative;\n flex-wrap: nowrap;\n }\n\n .", "-form-item-label {\n position: relative;\n flex: 1;\n max-width: 100%;\n }\n\n .", "-form-item-row {\n align-items: center;\n ", " {\n align-items: stretch;\n }\n }\n\n .", "-form-item-control {\n position: relative;\n flex: 0;\n min-width: unset !important;\n }\n\n .", "-collapse-item {\n overflow: hidden !important;\n border-radius: ", "px !important;\n }\n "])), responsive.mobile, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, responsive.mobile, prefixCls, prefixCls, token.borderRadius),
|
|
11
|
-
|
|
11
|
+
mobile: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " {\n gap: 0 !important;\n }\n "])), responsive.mobile),
|
|
12
|
+
pure: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n gap: 64px;\n .", "-collapse-content-box {\n .", "-form-item:first-child {\n border-block-start: 1px solid ", ";\n }\n }\n ", " {\n border-block-start: unset;\n }\n "])), prefixCls, prefixCls, token.colorFillSecondary, responsive.mobile)
|
|
12
13
|
};
|
|
13
14
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormInstance } from 'antd';
|
|
3
|
+
import { type FormProps } from "../Form";
|
|
4
|
+
import { type ModalProps } from "../Modal";
|
|
5
|
+
export interface FormModalProps extends Omit<FormProps, 'className' | 'style' | 'title'>, Pick<ModalProps, 'style' | 'className' | 'allowFullscreen' | 'title' | 'wrapClassName' | 'width' | 'onCancel' | 'open' | 'centered' | 'destroyOnClose' | 'paddings' | 'maxHeight' | 'enableResponsive' | 'afterClose' | 'afterOpenChange' | 'zIndex' | 'mask' | 'getContainer' | 'keyboard' | 'forceRender' | 'focusTriggerAfterClose' | 'closable' | 'loading' | 'closeIcon'> {
|
|
6
|
+
classNames?: {
|
|
7
|
+
form?: FormProps['className'];
|
|
8
|
+
} & ModalProps['classNames'];
|
|
9
|
+
finishButtonProps?: ModalProps['okButtonProps'];
|
|
10
|
+
finishLoading?: ModalProps['confirmLoading'];
|
|
11
|
+
finishText?: ModalProps['okText'];
|
|
12
|
+
styles?: {
|
|
13
|
+
form?: FormProps['style'];
|
|
14
|
+
} & ModalProps['styles'];
|
|
15
|
+
}
|
|
16
|
+
declare const FormModal: import("react").ForwardRefExoticComponent<FormModalProps & import("react").RefAttributes<FormInstance<any>>>;
|
|
17
|
+
export default FormModal;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
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"],
|
|
4
|
+
_excluded2 = ["form"],
|
|
5
|
+
_excluded3 = ["form"];
|
|
6
|
+
import { Button } from 'antd';
|
|
7
|
+
import { useResponsive } from 'antd-style';
|
|
8
|
+
import { forwardRef } from 'react';
|
|
9
|
+
import { Flexbox } from 'react-layout-kit';
|
|
10
|
+
import Form from "../Form";
|
|
11
|
+
import Modal from "../Modal";
|
|
12
|
+
import { useStyles } from "./style";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
var FormModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
16
|
+
var _ref$classNames = _ref.classNames,
|
|
17
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
18
|
+
className = _ref.className,
|
|
19
|
+
style = _ref.style,
|
|
20
|
+
closable = _ref.closable,
|
|
21
|
+
_ref$styles = _ref.styles,
|
|
22
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
allowFullscreen = _ref.allowFullscreen,
|
|
25
|
+
title = _ref.title,
|
|
26
|
+
wrapClassName = _ref.wrapClassName,
|
|
27
|
+
afterOpenChange = _ref.afterOpenChange,
|
|
28
|
+
width = _ref.width,
|
|
29
|
+
onCancel = _ref.onCancel,
|
|
30
|
+
centered = _ref.centered,
|
|
31
|
+
open = _ref.open,
|
|
32
|
+
afterClose = _ref.afterClose,
|
|
33
|
+
destroyOnClose = _ref.destroyOnClose,
|
|
34
|
+
closeIcon = _ref.closeIcon,
|
|
35
|
+
paddings = _ref.paddings,
|
|
36
|
+
maxHeight = _ref.maxHeight,
|
|
37
|
+
enableResponsive = _ref.enableResponsive,
|
|
38
|
+
zIndex = _ref.zIndex,
|
|
39
|
+
mask = _ref.mask,
|
|
40
|
+
getContainer = _ref.getContainer,
|
|
41
|
+
keyboard = _ref.keyboard,
|
|
42
|
+
focusTriggerAfterClose = _ref.focusTriggerAfterClose,
|
|
43
|
+
forceRender = _ref.forceRender,
|
|
44
|
+
loading = _ref.loading,
|
|
45
|
+
footer = _ref.footer,
|
|
46
|
+
finishButtonProps = _ref.finishButtonProps,
|
|
47
|
+
finishLoading = _ref.finishLoading,
|
|
48
|
+
onFinish = _ref.onFinish,
|
|
49
|
+
finishText = _ref.finishText,
|
|
50
|
+
_ref$variant = _ref.variant,
|
|
51
|
+
variant = _ref$variant === void 0 ? 'pure' : _ref$variant,
|
|
52
|
+
gap = _ref.gap,
|
|
53
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
54
|
+
var _useResponsive = useResponsive(),
|
|
55
|
+
mobile = _useResponsive.mobile;
|
|
56
|
+
var _useStyles = useStyles(),
|
|
57
|
+
cx = _useStyles.cx,
|
|
58
|
+
s = _useStyles.styles;
|
|
59
|
+
var formClassName = classNames.form,
|
|
60
|
+
modalClassNames = _objectWithoutProperties(classNames, _excluded2);
|
|
61
|
+
var formStyle = styles.form,
|
|
62
|
+
modalStyles = _objectWithoutProperties(styles, _excluded3);
|
|
63
|
+
return /*#__PURE__*/_jsx(Modal, {
|
|
64
|
+
afterClose: afterClose,
|
|
65
|
+
afterOpenChange: afterOpenChange,
|
|
66
|
+
allowFullscreen: allowFullscreen,
|
|
67
|
+
centered: centered,
|
|
68
|
+
className: className,
|
|
69
|
+
classNames: modalClassNames,
|
|
70
|
+
closable: closable,
|
|
71
|
+
closeIcon: closeIcon,
|
|
72
|
+
confirmLoading: finishLoading,
|
|
73
|
+
destroyOnClose: destroyOnClose,
|
|
74
|
+
enableResponsive: enableResponsive,
|
|
75
|
+
focusTriggerAfterClose: focusTriggerAfterClose,
|
|
76
|
+
footer: null,
|
|
77
|
+
forceRender: forceRender,
|
|
78
|
+
getContainer: getContainer,
|
|
79
|
+
keyboard: keyboard,
|
|
80
|
+
loading: loading,
|
|
81
|
+
mask: mask,
|
|
82
|
+
maxHeight: maxHeight,
|
|
83
|
+
onCancel: onCancel,
|
|
84
|
+
open: open,
|
|
85
|
+
paddings: paddings,
|
|
86
|
+
style: style,
|
|
87
|
+
styles: _objectSpread(_objectSpread({}, modalStyles), {}, {
|
|
88
|
+
body: _objectSpread({
|
|
89
|
+
paddingTop: mobile ? 0 : undefined
|
|
90
|
+
}, modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.body)
|
|
91
|
+
}),
|
|
92
|
+
title: title,
|
|
93
|
+
width: width,
|
|
94
|
+
wrapClassName: wrapClassName,
|
|
95
|
+
zIndex: zIndex,
|
|
96
|
+
children: /*#__PURE__*/_jsxs(Form, _objectSpread(_objectSpread({
|
|
97
|
+
className: cx(formClassName, s.form),
|
|
98
|
+
clearOnDestroy: destroyOnClose,
|
|
99
|
+
gap: gap || (variant === 'pure' ? 24 : gap),
|
|
100
|
+
onFinish: onFinish,
|
|
101
|
+
ref: ref,
|
|
102
|
+
style: formStyle,
|
|
103
|
+
variant: variant
|
|
104
|
+
}, rest), {}, {
|
|
105
|
+
children: [children, /*#__PURE__*/_jsx(Flexbox, {
|
|
106
|
+
className: s.footer,
|
|
107
|
+
gap: 8,
|
|
108
|
+
horizontal: true,
|
|
109
|
+
width: '100%',
|
|
110
|
+
children: footer || /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
111
|
+
block: true,
|
|
112
|
+
htmlType: "submit",
|
|
113
|
+
loading: finishLoading,
|
|
114
|
+
type: 'primary'
|
|
115
|
+
}, finishButtonProps), {}, {
|
|
116
|
+
style: _objectSpread({
|
|
117
|
+
flex: 1
|
|
118
|
+
}, finishButtonProps === null || finishButtonProps === void 0 ? void 0 : finishButtonProps.style),
|
|
119
|
+
children: finishText || 'Submit'
|
|
120
|
+
}))
|
|
121
|
+
})]
|
|
122
|
+
}))
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
export default FormModal;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token,
|
|
7
|
+
prefixCls = _ref.prefixCls,
|
|
8
|
+
responsive = _ref.responsive;
|
|
9
|
+
return {
|
|
10
|
+
footer: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: calc(100% + 32px);\n margin: -16px;\n padding: 16px;\n background: ", ";\n ", " {\n position: fixed;\n inset-block-end: 0;\n inset-inline: 0;\n\n width: 100%;\n margin: 0;\n }\n "])), token.colorBgContainer, responsive.mobile),
|
|
11
|
+
form: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-form-group-title {\n font-size: 15px;\n font-weight: 500;\n }\n\n ", " {\n .", "-form-group-title {\n font-size: 14px;\n }\n\n .", "-form-group {\n width: calc(100% + 32px);\n margin-inline: -16px;\n background: transparent;\n }\n }\n "])), prefixCls, responsive.mobile, prefixCls, prefixCls)
|
|
12
|
+
};
|
|
13
|
+
});
|
package/es/Modal/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type ModalProps as AntModalProps } from 'antd';
|
|
3
|
-
|
|
4
|
-
export type ModalProps = AntModalProps & {
|
|
3
|
+
export type ModalProps = Omit<AntModalProps, 'okType'> & {
|
|
5
4
|
allowFullscreen?: boolean;
|
|
6
|
-
closeIconProps?: Omit<ActionIconProps, 'size'>;
|
|
7
5
|
enableResponsive?: boolean;
|
|
8
6
|
maxHeight?: string | number | false;
|
|
9
7
|
paddings?: {
|
package/es/Modal/index.js
CHANGED
|
@@ -3,56 +3,48 @@
|
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
-
|
|
7
|
-
var _excluded = ["allowFullscreen", "children", "title", "className", "wrapClassName", "width", "onCancel", "open", "destroyOnClose", "paddings", "maxHeight", "enableResponsive", "closeIconProps", "footer", "styles"],
|
|
6
|
+
var _excluded = ["allowFullscreen", "children", "title", "className", "wrapClassName", "width", "onCancel", "open", "destroyOnClose", "paddings", "maxHeight", "enableResponsive", "footer", "styles", "okText", "onOk", "cancelText", "okButtonProps", "cancelButtonProps", "confirmLoading"],
|
|
8
7
|
_excluded2 = ["body"];
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import { createStyles, useResponsive } from 'antd-style';
|
|
8
|
+
import { Modal as AntModal, Button, ConfigProvider, Drawer } from 'antd';
|
|
9
|
+
import { useResponsive } from 'antd-style';
|
|
12
10
|
import { isNumber } from 'lodash-es';
|
|
13
11
|
import { Maximize2, Minimize2, X } from 'lucide-react';
|
|
14
12
|
import { lighten } from 'polished';
|
|
15
13
|
import { memo, useState } from 'react';
|
|
16
14
|
import ActionIcon from "../ActionIcon";
|
|
17
15
|
import Icon from "../Icon";
|
|
16
|
+
import { FOOTER_HEIGHT, HEADER_HEIGHT, useStyles } from "./style";
|
|
18
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
var cx = _ref.cx,
|
|
23
|
-
css = _ref.css,
|
|
24
|
-
token = _ref.token,
|
|
25
|
-
prefixCls = _ref.prefixCls;
|
|
26
|
-
var maxHeight = _ref2.maxHeight;
|
|
27
|
-
return {
|
|
28
|
-
content: cx(maxHeight && css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-modal-body {\n overflow: auto;\n max-height: ", ";\n }\n "])), prefixCls, maxHeight), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-modal-footer {\n margin: 0;\n padding: 16px;\n }\n .", "-modal-header {\n display: flex;\n gap: 4px;\n align-items: center;\n justify-content: center;\n\n height: 56px;\n margin-block-end: 0;\n padding: 16px;\n }\n .", "-modal-content {\n overflow: hidden;\n padding: 0;\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n "])), prefixCls, prefixCls, prefixCls, token.colorSplit, token.borderRadiusLG)),
|
|
29
|
-
drawerContent: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-drawer-close {\n padding: 0;\n }\n .", "-drawer-wrapper-body {\n background: linear-gradient(to bottom, ", ", ", ");\n }\n .", "-drawer-header {\n padding: 8px;\n }\n\n .", "-drawer-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n\n padding: 16px;\n\n border: none;\n }\n "])), prefixCls, prefixCls, token.colorBgContainer, token.colorBgLayout, prefixCls, prefixCls),
|
|
30
|
-
wrap: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden auto;\n "])))
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
var Modal = /*#__PURE__*/memo(function (_ref3) {
|
|
18
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
var Modal = /*#__PURE__*/memo(function (_ref) {
|
|
34
21
|
var _paddings$desktop, _paddings$desktop2;
|
|
35
|
-
var allowFullscreen =
|
|
36
|
-
children =
|
|
37
|
-
|
|
38
|
-
title =
|
|
39
|
-
className =
|
|
40
|
-
wrapClassName =
|
|
41
|
-
|
|
42
|
-
width =
|
|
43
|
-
onCancel =
|
|
44
|
-
open =
|
|
45
|
-
destroyOnClose =
|
|
46
|
-
paddings =
|
|
47
|
-
|
|
48
|
-
maxHeight =
|
|
49
|
-
|
|
50
|
-
enableResponsive =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
22
|
+
var allowFullscreen = _ref.allowFullscreen,
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
_ref$title = _ref.title,
|
|
25
|
+
title = _ref$title === void 0 ? ' ' : _ref$title,
|
|
26
|
+
className = _ref.className,
|
|
27
|
+
wrapClassName = _ref.wrapClassName,
|
|
28
|
+
_ref$width = _ref.width,
|
|
29
|
+
width = _ref$width === void 0 ? 700 : _ref$width,
|
|
30
|
+
onCancel = _ref.onCancel,
|
|
31
|
+
open = _ref.open,
|
|
32
|
+
destroyOnClose = _ref.destroyOnClose,
|
|
33
|
+
paddings = _ref.paddings,
|
|
34
|
+
_ref$maxHeight = _ref.maxHeight,
|
|
35
|
+
maxHeight = _ref$maxHeight === void 0 ? '75dvh' : _ref$maxHeight,
|
|
36
|
+
_ref$enableResponsive = _ref.enableResponsive,
|
|
37
|
+
enableResponsive = _ref$enableResponsive === void 0 ? true : _ref$enableResponsive,
|
|
38
|
+
footer = _ref.footer,
|
|
39
|
+
_ref$styles = _ref.styles,
|
|
40
|
+
stylesProps = _ref$styles === void 0 ? {} : _ref$styles,
|
|
41
|
+
okText = _ref.okText,
|
|
42
|
+
onOk = _ref.onOk,
|
|
43
|
+
cancelText = _ref.cancelText,
|
|
44
|
+
okButtonProps = _ref.okButtonProps,
|
|
45
|
+
cancelButtonProps = _ref.cancelButtonProps,
|
|
46
|
+
confirmLoading = _ref.confirmLoading,
|
|
47
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
56
48
|
var _useState = useState(false),
|
|
57
49
|
_useState2 = _slicedToArray(_useState, 2),
|
|
58
50
|
fullscreen = _useState2[0],
|
|
@@ -67,6 +59,7 @@ var Modal = /*#__PURE__*/memo(function (_ref3) {
|
|
|
67
59
|
theme = _useStyles.theme;
|
|
68
60
|
var body = stylesProps.body,
|
|
69
61
|
restStyles = _objectWithoutProperties(stylesProps, _excluded2);
|
|
62
|
+
var hideFooter = footer === false || footer === null;
|
|
70
63
|
if (enableResponsive && mobile) return /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({
|
|
71
64
|
className: cx(styles.drawerContent, className),
|
|
72
65
|
closeIcon: /*#__PURE__*/_jsx(ActionIcon, {
|
|
@@ -79,7 +72,22 @@ var Modal = /*#__PURE__*/memo(function (_ref3) {
|
|
|
79
72
|
return setFullscreen(!fullscreen);
|
|
80
73
|
}
|
|
81
74
|
}),
|
|
82
|
-
footer: footer,
|
|
75
|
+
footer: hideFooter ? null : footer || /*#__PURE__*/_jsxs(_Fragment, {
|
|
76
|
+
children: [/*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
77
|
+
onClick: onCancel
|
|
78
|
+
}, cancelButtonProps), {}, {
|
|
79
|
+
children: cancelText || 'Cancel'
|
|
80
|
+
})), /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
81
|
+
loading: confirmLoading,
|
|
82
|
+
onClick: onOk,
|
|
83
|
+
type: "primary"
|
|
84
|
+
}, okButtonProps), {}, {
|
|
85
|
+
style: _objectSpread({
|
|
86
|
+
marginInlineStart: 8
|
|
87
|
+
}, okButtonProps === null || okButtonProps === void 0 ? void 0 : okButtonProps.style),
|
|
88
|
+
children: okText || 'OK'
|
|
89
|
+
}))]
|
|
90
|
+
}),
|
|
83
91
|
height: fullscreen ? 'calc(100% - env(safe-area-inset-top))' : maxHeight || '75vh',
|
|
84
92
|
maskClassName: cx(styles.wrap, wrapClassName),
|
|
85
93
|
onClose: onCancel,
|
|
@@ -102,18 +110,24 @@ var Modal = /*#__PURE__*/memo(function (_ref3) {
|
|
|
102
110
|
}
|
|
103
111
|
},
|
|
104
112
|
children: /*#__PURE__*/_jsx(AntModal, _objectSpread(_objectSpread({
|
|
113
|
+
cancelButtonProps: cancelButtonProps,
|
|
114
|
+
cancelText: cancelText,
|
|
105
115
|
className: cx(styles.content, className),
|
|
106
116
|
closable: true,
|
|
107
|
-
closeIcon: /*#__PURE__*/_jsx(Icon,
|
|
117
|
+
closeIcon: /*#__PURE__*/_jsx(Icon, {
|
|
108
118
|
icon: X,
|
|
109
119
|
size: {
|
|
110
120
|
fontSize: 20
|
|
111
121
|
}
|
|
112
|
-
}
|
|
122
|
+
}),
|
|
123
|
+
confirmLoading: confirmLoading,
|
|
113
124
|
destroyOnClose: destroyOnClose,
|
|
114
|
-
footer: footer,
|
|
125
|
+
footer: hideFooter ? null : footer,
|
|
115
126
|
maskClosable: true,
|
|
127
|
+
okButtonProps: okButtonProps,
|
|
128
|
+
okText: okText,
|
|
116
129
|
onCancel: onCancel,
|
|
130
|
+
onOk: onOk,
|
|
117
131
|
open: open,
|
|
118
132
|
styles: _objectSpread({
|
|
119
133
|
body: _objectSpread({
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const HEADER_HEIGHT = 56;
|
|
2
|
+
export declare const FOOTER_HEIGHT = 68;
|
|
3
|
+
export declare const useStyles: (props?: {
|
|
4
|
+
maxHeight?: string | undefined;
|
|
5
|
+
} | undefined) => import("antd-style").ReturnStyles<{
|
|
6
|
+
content: string;
|
|
7
|
+
drawerContent: import("antd-style").SerializedStyles;
|
|
8
|
+
wrap: import("antd-style").SerializedStyles;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var HEADER_HEIGHT = 56;
|
|
5
|
+
export var FOOTER_HEIGHT = 68;
|
|
6
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
7
|
+
var cx = _ref.cx,
|
|
8
|
+
css = _ref.css,
|
|
9
|
+
token = _ref.token,
|
|
10
|
+
prefixCls = _ref.prefixCls;
|
|
11
|
+
var maxHeight = _ref2.maxHeight;
|
|
12
|
+
return {
|
|
13
|
+
content: cx(maxHeight && css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-modal-body {\n overflow: auto;\n max-height: ", ";\n }\n "])), prefixCls, maxHeight), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-modal-footer {\n margin: 0;\n padding: 16px;\n }\n .", "-modal-header {\n display: flex;\n gap: 4px;\n align-items: center;\n justify-content: center;\n\n height: 56px;\n margin-block-end: 0;\n padding: 16px;\n }\n .", "-modal-content {\n overflow: hidden;\n padding: 0;\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n "])), prefixCls, prefixCls, prefixCls, token.colorSplit, token.borderRadiusLG)),
|
|
14
|
+
drawerContent: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &.", "-drawer-content {\n background: ", ";\n }\n\n .", "-drawer-close {\n padding: 0;\n }\n\n .", "-drawer-header {\n flex: none;\n height: ", "px !important;\n padding-block: 0;\n padding-inline: 16px;\n }\n\n .", "-drawer-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n\n padding: 16px;\n\n border: none;\n }\n "])), prefixCls, token.colorBgContainer, prefixCls, prefixCls, HEADER_HEIGHT, prefixCls),
|
|
15
|
+
wrap: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden auto;\n "])))
|
|
16
|
+
};
|
|
17
|
+
});
|
package/es/components.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export { default as FormFooter, type FormFooterProps } from './Form/components/F
|
|
|
27
27
|
export { default as FormGroup, type FormGroupProps } from './Form/components/FormGroup';
|
|
28
28
|
export { default as FormItem, type FormItemProps } from './Form/components/FormItem';
|
|
29
29
|
export { default as FormTitle, type FormTitleProps } from './Form/components/FormTitle';
|
|
30
|
+
export { default as FormModal, type FormModalProps } from './FormModal';
|
|
30
31
|
export { default as Grid, type GridProps } from './Grid';
|
|
31
32
|
export { default as Header, type HeaderProps } from './Header';
|
|
32
33
|
export { default as Highlighter, type HighlighterProps, SyntaxHighlighter, type SyntaxHighlighterProps, } from './Highlighter';
|
package/es/components.js
CHANGED
|
@@ -27,6 +27,7 @@ export { default as FormFooter } from "./Form/components/FormFooter";
|
|
|
27
27
|
export { default as FormGroup } from "./Form/components/FormGroup";
|
|
28
28
|
export { default as FormItem } from "./Form/components/FormItem";
|
|
29
29
|
export { default as FormTitle } from "./Form/components/FormTitle";
|
|
30
|
+
export { default as FormModal } from "./FormModal";
|
|
30
31
|
export { default as Grid } from "./Grid";
|
|
31
32
|
export { default as Header } from "./Header";
|
|
32
33
|
export { default as Highlighter, SyntaxHighlighter } from "./Highlighter";
|