@lobehub/ui 1.122.0 → 1.122.2
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/FormGroup.d.ts +14 -1
- package/es/Form/components/FormGroup.js +54 -14
- package/es/Form/components/FormItem.d.ts +4 -0
- package/es/Form/components/FormItem.js +23 -11
- package/es/Form/components/FormTitle.d.ts +3 -0
- package/es/Form/components/FormTitle.js +17 -7
- package/es/Form/index.d.ts +5 -2
- package/es/Form/index.js +38 -17
- package/es/Form/style.js +1 -1
- package/package.json +1 -1
- package/es/Form/components/style.d.ts +0 -10
- package/es/Form/components/style.js +0 -22
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { type IconProps } from "../..";
|
|
2
2
|
import { type CollapseProps } from 'antd';
|
|
3
3
|
import { type ReactNode } from 'react';
|
|
4
|
+
export type FormVariant = 'default' | 'block' | 'ghost' | 'pure';
|
|
5
|
+
export type ItemsType = 'group' | 'flat';
|
|
6
|
+
export declare const useStyles: (props?: FormVariant | undefined) => import("antd-style").ReturnStyles<{
|
|
7
|
+
flatGroup: string;
|
|
8
|
+
group: string;
|
|
9
|
+
icon: import("antd-style").SerializedStyles;
|
|
10
|
+
mobileGroupBody: import("antd-style").SerializedStyles;
|
|
11
|
+
mobileGroupHeader: import("antd-style").SerializedStyles;
|
|
12
|
+
title: import("antd-style").SerializedStyles;
|
|
13
|
+
}>;
|
|
4
14
|
export interface FormGroupProps extends CollapseProps {
|
|
5
15
|
children: ReactNode;
|
|
16
|
+
defaultActive?: boolean;
|
|
6
17
|
extra?: ReactNode;
|
|
7
18
|
icon?: IconProps['icon'];
|
|
8
|
-
|
|
19
|
+
itemsType?: ItemsType;
|
|
20
|
+
title?: string;
|
|
21
|
+
variant?: FormVariant;
|
|
9
22
|
}
|
|
10
23
|
declare const FormGroup: import("react").NamedExoticComponent<FormGroupProps>;
|
|
11
24
|
export default FormGroup;
|
|
@@ -1,27 +1,54 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
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;
|
|
4
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
8
|
import { Icon } from "../..";
|
|
7
9
|
import { Collapse } from 'antd';
|
|
8
|
-
import { useResponsive } from 'antd-style';
|
|
10
|
+
import { createStyles, useResponsive } from 'antd-style';
|
|
9
11
|
import { ChevronDown } from 'lucide-react';
|
|
10
12
|
import { memo } from 'react';
|
|
11
13
|
import { Flexbox } from 'react-layout-kit';
|
|
12
|
-
import { useStyles } from "./style";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
export var useStyles = createStyles(function (_ref, variant) {
|
|
17
|
+
var css = _ref.css,
|
|
18
|
+
cx = _ref.cx,
|
|
19
|
+
token = _ref.token,
|
|
20
|
+
isDarkMode = _ref.isDarkMode,
|
|
21
|
+
responsive = _ref.responsive,
|
|
22
|
+
prefixCls = _ref.prefixCls;
|
|
23
|
+
var pureStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: transparent;\n border: none;\n border-radius: 0;\n\n .", "-collapse-header {\n background: transparent !important;\n border-radius: 0 !important;\n }\n\n .", "-collapse-content-box {\n background: transparent;\n border-radius: 0;\n }\n "])), prefixCls, prefixCls);
|
|
24
|
+
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);
|
|
25
|
+
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);
|
|
26
|
+
var defaultStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.colorBorderSecondary, token.borderRadiusLG);
|
|
27
|
+
var variantStyle = cx(variant === 'default' && defaultStyle, variant === 'block' && blockStyle, variant === 'ghost' && ghostStyle, variant === 'pure' && pureStyle);
|
|
28
|
+
return {
|
|
29
|
+
flatGroup: cx(css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n overflow: hidden;\n padding-inline: 16px;\n "]))), variantStyle),
|
|
30
|
+
group: cx(isDarkMode && css(_templateObject6 || (_templateObject6 = _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(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n overflow: hidden;\n\n .", "-collapse-item {\n border: none;\n }\n\n .", "-collapse-header {\n align-items: center !important;\n border-radius: 0 !important;\n }\n\n .", "-collapse-content-box {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n }\n\n .", "-form-item-label {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n "])), prefixCls, prefixCls, prefixCls, prefixCls), variantStyle),
|
|
31
|
+
icon: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n transition: all 100ms ", ";\n "])), token.motionEaseOut),
|
|
32
|
+
mobileGroupBody: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding: 0 16px;\n background: ", ";\n "])), token.colorBgContainer),
|
|
33
|
+
mobileGroupHeader: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: 16px;\n background: ", ";\n "])), token.colorBgLayout),
|
|
34
|
+
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)
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
var FormGroup = /*#__PURE__*/memo(function (_ref2) {
|
|
38
|
+
var className = _ref2.className,
|
|
39
|
+
icon = _ref2.icon,
|
|
40
|
+
title = _ref2.title,
|
|
41
|
+
children = _ref2.children,
|
|
42
|
+
extra = _ref2.extra,
|
|
43
|
+
itemsType = _ref2.itemsType,
|
|
44
|
+
_ref2$variant = _ref2.variant,
|
|
45
|
+
variant = _ref2$variant === void 0 ? 'default' : _ref2$variant,
|
|
46
|
+
_ref2$defaultActive = _ref2.defaultActive,
|
|
47
|
+
defaultActive = _ref2$defaultActive === void 0 ? true : _ref2$defaultActive,
|
|
48
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
22
49
|
var _useResponsive = useResponsive(),
|
|
23
50
|
mobile = _useResponsive.mobile;
|
|
24
|
-
var _useStyles = useStyles(),
|
|
51
|
+
var _useStyles = useStyles(variant),
|
|
25
52
|
cx = _useStyles.cx,
|
|
26
53
|
styles = _useStyles.styles;
|
|
27
54
|
var titleContent = /*#__PURE__*/_jsxs(Flexbox, {
|
|
@@ -32,6 +59,19 @@ var FormGroup = /*#__PURE__*/memo(function (_ref) {
|
|
|
32
59
|
icon: icon
|
|
33
60
|
}), title]
|
|
34
61
|
});
|
|
62
|
+
if (itemsType === 'flat') {
|
|
63
|
+
if (mobile) return /*#__PURE__*/_jsx(Flexbox, {
|
|
64
|
+
className: className,
|
|
65
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
66
|
+
className: styles.mobileGroupBody,
|
|
67
|
+
children: children
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
return /*#__PURE__*/_jsx(Flexbox, {
|
|
71
|
+
className: cx(styles.flatGroup, className),
|
|
72
|
+
children: children
|
|
73
|
+
});
|
|
74
|
+
}
|
|
35
75
|
if (mobile) return /*#__PURE__*/_jsxs(Flexbox, {
|
|
36
76
|
className: className,
|
|
37
77
|
children: [/*#__PURE__*/_jsxs(Flexbox, {
|
|
@@ -46,9 +86,9 @@ var FormGroup = /*#__PURE__*/memo(function (_ref) {
|
|
|
46
86
|
});
|
|
47
87
|
return /*#__PURE__*/_jsx(Collapse, _objectSpread({
|
|
48
88
|
className: cx(styles.group, className),
|
|
49
|
-
defaultActiveKey: [1],
|
|
50
|
-
expandIcon: function expandIcon(
|
|
51
|
-
var isActive =
|
|
89
|
+
defaultActiveKey: defaultActive ? [1] : undefined,
|
|
90
|
+
expandIcon: function expandIcon(_ref3) {
|
|
91
|
+
var isActive = _ref3.isActive;
|
|
52
92
|
return /*#__PURE__*/_jsx(Icon, {
|
|
53
93
|
className: styles.icon,
|
|
54
94
|
icon: ChevronDown,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormItemProps as AntdFormItemProps } from 'antd';
|
|
3
3
|
import { type FormTitleProps } from './FormTitle';
|
|
4
|
+
export declare const useStyles: (props?: string | number | undefined) => import("antd-style").ReturnStyles<{
|
|
5
|
+
item: import("antd-style").SerializedStyles;
|
|
6
|
+
itemNoDivider: import("antd-style").SerializedStyles;
|
|
7
|
+
}>;
|
|
4
8
|
export interface FormItemProps extends AntdFormItemProps {
|
|
5
9
|
avatar?: FormTitleProps['avatar'];
|
|
6
10
|
desc?: FormTitleProps['desc'];
|
|
@@ -1,27 +1,39 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
3
4
|
var _excluded = ["desc", "tag", "minWidth", "avatar", "className", "label", "children", "divider"];
|
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
4
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
8
|
import { Form } from 'antd';
|
|
9
|
+
import { createStyles } from 'antd-style';
|
|
10
|
+
import { isNumber } from 'lodash-es';
|
|
7
11
|
import { memo } from 'react';
|
|
8
12
|
import FormDivider from "./FormDivider";
|
|
9
13
|
import FormTitle from "./FormTitle";
|
|
10
|
-
import { useStyles } from "./style";
|
|
11
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
17
|
var Item = Form.Item;
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
export var useStyles = createStyles(function (_ref, itemMinWidth) {
|
|
19
|
+
var css = _ref.css,
|
|
20
|
+
responsive = _ref.responsive,
|
|
21
|
+
prefixCls = _ref.prefixCls;
|
|
22
|
+
return {
|
|
23
|
+
item: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 16px 0;\n\n .", "-row {\n justify-content: space-between;\n\n > div {\n flex: unset !important;\n flex-grow: unset !important;\n }\n }\n\n .", "-form-item-required::before {\n align-self: flex-start;\n }\n\n ", "\n\n ", " {\n padding: 16px 0;\n\n ", "\n }\n "])), prefixCls, prefixCls, itemMinWidth && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-form-item-control {\n width: ", ";\n }\n "])), prefixCls, isNumber(itemMinWidth) ? "".concat(itemMinWidth, "px") : itemMinWidth), responsive.mobile, itemMinWidth ? css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .", "-form-item-control {\n flex: 1;\n width: 100%;\n }\n "])), prefixCls, prefixCls) : css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .", "-row {\n flex-wrap: wrap;\n gap: 4px;\n }\n "])), prefixCls)),
|
|
24
|
+
itemNoDivider: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n &:not(:first-child) {\n padding-top: 0;\n }\n "])))
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
var FormItem = /*#__PURE__*/memo(function (_ref2) {
|
|
28
|
+
var desc = _ref2.desc,
|
|
29
|
+
tag = _ref2.tag,
|
|
30
|
+
minWidth = _ref2.minWidth,
|
|
31
|
+
avatar = _ref2.avatar,
|
|
32
|
+
className = _ref2.className,
|
|
33
|
+
label = _ref2.label,
|
|
34
|
+
children = _ref2.children,
|
|
35
|
+
divider = _ref2.divider,
|
|
36
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
25
37
|
var _useStyles = useStyles(minWidth),
|
|
26
38
|
cx = _useStyles.cx,
|
|
27
39
|
styles = _useStyles.styles;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { DivProps } from "../../types";
|
|
3
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
4
|
+
formTitle: import("antd-style").SerializedStyles;
|
|
5
|
+
}>;
|
|
3
6
|
export interface FormTitleProps extends DivProps {
|
|
4
7
|
avatar?: ReactNode;
|
|
5
8
|
desc?: ReactNode;
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
1
4
|
import { memo } from 'react';
|
|
2
5
|
import { Flexbox } from 'react-layout-kit';
|
|
3
6
|
import Tag from "../../Tag";
|
|
4
|
-
import { useStyles } from "./style";
|
|
5
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export var useStyles = createStyles(function (_ref) {
|
|
10
|
+
var css = _ref.css,
|
|
11
|
+
token = _ref.token,
|
|
12
|
+
prefixCls = _ref.prefixCls;
|
|
13
|
+
return {
|
|
14
|
+
formTitle: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n text-align: left;\n\n > div {\n font-weight: 500;\n line-height: 1;\n }\n\n > small {\n display: block;\n\n line-height: 1.2;\n color: ", ";\n word-wrap: break-word;\n white-space: pre-wrap;\n }\n\n .", "-tag {\n font-family: ", ";\n }\n "])), token.colorTextDescription, prefixCls, token.fontFamilyCode)
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
var FormTitle = /*#__PURE__*/memo(function (_ref2) {
|
|
18
|
+
var className = _ref2.className,
|
|
19
|
+
tag = _ref2.tag,
|
|
20
|
+
title = _ref2.title,
|
|
21
|
+
desc = _ref2.desc,
|
|
22
|
+
avatar = _ref2.avatar;
|
|
13
23
|
var _useStyles = useStyles(),
|
|
14
24
|
cx = _useStyles.cx,
|
|
15
25
|
styles = _useStyles.styles;
|
package/es/Form/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FormProps as AntFormProps, type FormInstance } from 'antd';
|
|
2
2
|
import { type ReactNode, RefAttributes } from 'react';
|
|
3
|
-
import FormGroup, { type FormGroupProps } from './components/FormGroup';
|
|
3
|
+
import FormGroup, { type FormGroupProps, FormVariant, ItemsType } from './components/FormGroup';
|
|
4
4
|
import FormItem, { type FormItemProps } from './components/FormItem';
|
|
5
5
|
export interface ItemGroup {
|
|
6
6
|
children: FormItemProps[] | ReactNode;
|
|
7
|
+
defaultActive?: boolean;
|
|
7
8
|
extra?: FormGroupProps['extra'];
|
|
8
9
|
icon?: FormGroupProps['icon'];
|
|
9
10
|
title: FormGroupProps['title'];
|
|
@@ -12,7 +13,9 @@ export interface FormProps extends AntFormProps {
|
|
|
12
13
|
children?: ReactNode;
|
|
13
14
|
footer?: ReactNode;
|
|
14
15
|
itemMinWidth?: FormItemProps['minWidth'];
|
|
15
|
-
items?: ItemGroup[];
|
|
16
|
+
items?: ItemGroup[] | FormItemProps[];
|
|
17
|
+
itemsType?: ItemsType;
|
|
18
|
+
variant?: FormVariant;
|
|
16
19
|
}
|
|
17
20
|
export interface IForm {
|
|
18
21
|
(props: FormProps & RefAttributes<FormInstance>): ReactNode;
|
package/es/Form/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "itemMinWidth", "footer", "form", "items", "children"];
|
|
3
|
+
var _excluded = ["className", "itemMinWidth", "footer", "form", "items", "children", "itemsType", "variant"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { Form as AntForm } from 'antd';
|
|
@@ -16,12 +16,37 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
16
16
|
itemMinWidth = _ref.itemMinWidth,
|
|
17
17
|
footer = _ref.footer,
|
|
18
18
|
form = _ref.form,
|
|
19
|
-
items = _ref.items,
|
|
19
|
+
_ref$items = _ref.items,
|
|
20
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
20
21
|
children = _ref.children,
|
|
22
|
+
_ref$itemsType = _ref.itemsType,
|
|
23
|
+
itemsType = _ref$itemsType === void 0 ? 'group' : _ref$itemsType,
|
|
24
|
+
_ref$variant = _ref.variant,
|
|
25
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
21
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
22
27
|
var _useStyles = useStyles(),
|
|
23
28
|
cx = _useStyles.cx,
|
|
24
29
|
styles = _useStyles.styles;
|
|
30
|
+
var mapFlat = function mapFlat(item, itemIndex) {
|
|
31
|
+
return /*#__PURE__*/_jsx(FormItem, _objectSpread({
|
|
32
|
+
divider: itemIndex !== 0,
|
|
33
|
+
minWidth: itemMinWidth
|
|
34
|
+
}, item), itemIndex);
|
|
35
|
+
};
|
|
36
|
+
var mapTree = function mapTree(group, groupIndex) {
|
|
37
|
+
return /*#__PURE__*/_jsx(FormGroup, {
|
|
38
|
+
defaultActive: group === null || group === void 0 ? void 0 : group.defaultActive,
|
|
39
|
+
extra: group === null || group === void 0 ? void 0 : group.extra,
|
|
40
|
+
icon: group === null || group === void 0 ? void 0 : group.icon,
|
|
41
|
+
title: group.title,
|
|
42
|
+
variant: variant,
|
|
43
|
+
children: Array.isArray(group.children) ? group.children.filter(function (item) {
|
|
44
|
+
return !item.hidden;
|
|
45
|
+
}).map(function (item, i) {
|
|
46
|
+
return mapFlat(item, i);
|
|
47
|
+
}) : group.children
|
|
48
|
+
}, groupIndex);
|
|
49
|
+
};
|
|
25
50
|
return /*#__PURE__*/_jsxs(AntForm, _objectSpread(_objectSpread({
|
|
26
51
|
className: cx(styles.form, className),
|
|
27
52
|
colon: false,
|
|
@@ -29,21 +54,17 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
29
54
|
layout: "horizontal",
|
|
30
55
|
ref: ref
|
|
31
56
|
}, rest), {}, {
|
|
32
|
-
children: [items === null || items === void 0 ? void 0 : items.map(function (
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, item), itemIndex);
|
|
44
|
-
}) : group.children
|
|
45
|
-
}, groupIndex);
|
|
46
|
-
}), children, footer && /*#__PURE__*/_jsx(FormFooter, {
|
|
57
|
+
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
|
+
return mapTree(item, i);
|
|
59
|
+
}) : /*#__PURE__*/_jsx(FormGroup, {
|
|
60
|
+
itemsType: 'flat',
|
|
61
|
+
variant: variant,
|
|
62
|
+
children: items === null || items === void 0 ? void 0 : items.filter(function (item) {
|
|
63
|
+
return !item.hidden;
|
|
64
|
+
}).map(function (item, i) {
|
|
65
|
+
return mapFlat(item, i);
|
|
66
|
+
})
|
|
67
|
+
}) : null, children, footer && /*#__PURE__*/_jsx(FormFooter, {
|
|
47
68
|
children: footer
|
|
48
69
|
})]
|
|
49
70
|
}));
|
package/es/Form/style.js
CHANGED
|
@@ -7,6 +7,6 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
7
7
|
prefixCls = _ref.prefixCls,
|
|
8
8
|
responsive = _ref.responsive;
|
|
9
9
|
return {
|
|
10
|
-
form: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 16px;\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-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, prefixCls, token.borderRadius)
|
|
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\n .", "-form-item-control {\n position: relative;\n\n display: flex;\n flex: 0;\n align-items: center;\n\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, prefixCls, prefixCls, token.borderRadius)
|
|
11
11
|
};
|
|
12
12
|
});
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: (props?: string | number | undefined) => import("antd-style").ReturnStyles<{
|
|
2
|
-
formTitle: import("antd-style").SerializedStyles;
|
|
3
|
-
group: string;
|
|
4
|
-
icon: import("antd-style").SerializedStyles;
|
|
5
|
-
item: import("antd-style").SerializedStyles;
|
|
6
|
-
itemNoDivider: import("antd-style").SerializedStyles;
|
|
7
|
-
mobileGroupBody: import("antd-style").SerializedStyles;
|
|
8
|
-
mobileGroupHeader: import("antd-style").SerializedStyles;
|
|
9
|
-
title: import("antd-style").SerializedStyles;
|
|
10
|
-
}>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
3
|
-
import { createStyles } from 'antd-style';
|
|
4
|
-
import { isNumber } from 'lodash-es';
|
|
5
|
-
export var useStyles = createStyles(function (_ref, itemMinWidth) {
|
|
6
|
-
var css = _ref.css,
|
|
7
|
-
cx = _ref.cx,
|
|
8
|
-
token = _ref.token,
|
|
9
|
-
isDarkMode = _ref.isDarkMode,
|
|
10
|
-
responsive = _ref.responsive,
|
|
11
|
-
prefixCls = _ref.prefixCls;
|
|
12
|
-
return {
|
|
13
|
-
formTitle: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n text-align: left;\n\n > div {\n font-weight: 500;\n line-height: 1;\n }\n\n > small {\n display: block;\n\n line-height: 1;\n color: ", ";\n word-wrap: break-word;\n white-space: pre-wrap;\n }\n\n .", "-tag {\n font-family: ", ";\n }\n "])), token.colorTextDescription, prefixCls, token.fontFamilyCode),
|
|
14
|
-
group: cx(isDarkMode && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-collapse-content {\n background: transparent;\n }\n\n .", "-collapse-header {\n background: ", ";\n }\n "])), prefixCls, prefixCls, token.colorFillTertiary), css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-collapse-header {\n align-items: center !important;\n border-radius: 0 !important;\n }\n\n .", "-collapse-content-box {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n }\n\n .", "-form-item-label {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n "])), prefixCls, prefixCls, prefixCls)),
|
|
15
|
-
icon: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transition: all 100ms ", ";\n "])), token.motionEaseOut),
|
|
16
|
-
item: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: 16px 0;\n\n .", "-row {\n justify-content: space-between;\n\n > div {\n flex: unset !important;\n flex-grow: unset !important;\n }\n }\n\n .", "-form-item-required::before {\n align-self: flex-start;\n }\n\n ", "\n\n ", " {\n padding: 16px 0;\n\n ", "\n }\n "])), prefixCls, prefixCls, itemMinWidth && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n .", "-form-item-control {\n width: ", ";\n }\n "])), prefixCls, isNumber(itemMinWidth) ? "".concat(itemMinWidth, "px") : itemMinWidth), responsive.mobile, itemMinWidth ? css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n .", "-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .", "-form-item-control {\n flex: 1;\n width: 100%;\n }\n "])), prefixCls, prefixCls) : css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n .", "-row {\n flex-wrap: wrap;\n gap: 4px;\n }\n "])), prefixCls)),
|
|
17
|
-
itemNoDivider: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n &:not(:first-child) {\n padding-top: 0;\n }\n "]))),
|
|
18
|
-
mobileGroupBody: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: 0 16px;\n background: ", ";\n "])), token.colorBgContainer),
|
|
19
|
-
mobileGroupHeader: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n padding: 16px;\n background: ", ";\n "])), token.colorBgLayout),
|
|
20
|
-
title: css(_templateObject12 || (_templateObject12 = _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)
|
|
21
|
-
};
|
|
22
|
-
});
|