@lobehub/ui 1.42.0 → 1.43.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/Form/components/FormItem.d.ts +2 -0
- package/es/Form/components/FormItem.js +5 -3
- package/es/Form/components/FormTitle.d.ts +1 -0
- package/es/Form/components/FormTitle.js +10 -2
- package/es/Form/components/style.d.ts +1 -1
- package/es/Form/components/style.js +9 -7
- package/es/Form/index.d.ts +2 -2
- package/es/Form/index.js +7 -4
- package/es/Form/style.js +3 -2
- package/es/ThemeProvider/GlobalStyle/antdOverride.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,9 @@ import { FormItemProps as AntdFormItemProps } from 'antd';
|
|
|
3
3
|
export interface FormItemProps extends AntdFormItemProps {
|
|
4
4
|
desc?: string;
|
|
5
5
|
divider?: boolean;
|
|
6
|
+
hidden?: boolean;
|
|
6
7
|
minWidth?: string | number;
|
|
8
|
+
tag?: string;
|
|
7
9
|
}
|
|
8
10
|
declare const FormItem: import("react").NamedExoticComponent<FormItemProps>;
|
|
9
11
|
export default FormItem;
|
|
@@ -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 = ["desc", "minWidth", "className", "label", "children", "divider"];
|
|
3
|
+
var _excluded = ["desc", "tag", "minWidth", "className", "label", "children", "divider"];
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
import { Form } from 'antd';
|
|
@@ -14,6 +14,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
var Item = Form.Item;
|
|
15
15
|
var FormItem = /*#__PURE__*/memo(function (_ref) {
|
|
16
16
|
var desc = _ref.desc,
|
|
17
|
+
tag = _ref.tag,
|
|
17
18
|
minWidth = _ref.minWidth,
|
|
18
19
|
className = _ref.className,
|
|
19
20
|
label = _ref.label,
|
|
@@ -26,10 +27,11 @@ var FormItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
26
27
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
27
28
|
children: [divider && /*#__PURE__*/_jsx(FormDivider, {}), /*#__PURE__*/_jsx(Item, _objectSpread(_objectSpread({
|
|
28
29
|
className: cx(styles.item, className),
|
|
29
|
-
label:
|
|
30
|
+
label: /*#__PURE__*/_jsx(FormTitle, {
|
|
30
31
|
desc: desc,
|
|
32
|
+
tag: tag,
|
|
31
33
|
title: String(label)
|
|
32
|
-
})
|
|
34
|
+
})
|
|
33
35
|
}, props), {}, {
|
|
34
36
|
children: children
|
|
35
37
|
}))]
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { Tag } from 'antd';
|
|
1
2
|
import { memo } from 'react';
|
|
3
|
+
import { Flexbox } from 'react-layout-kit';
|
|
2
4
|
import { useStyles } from "./style";
|
|
3
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
7
|
var FormTitle = /*#__PURE__*/memo(function (_ref) {
|
|
6
8
|
var className = _ref.className,
|
|
9
|
+
tag = _ref.tag,
|
|
7
10
|
title = _ref.title,
|
|
8
11
|
desc = _ref.desc;
|
|
9
12
|
var _useStyles = useStyles(),
|
|
@@ -11,8 +14,13 @@ var FormTitle = /*#__PURE__*/memo(function (_ref) {
|
|
|
11
14
|
styles = _useStyles.styles;
|
|
12
15
|
return /*#__PURE__*/_jsxs("div", {
|
|
13
16
|
className: cx(styles.formTitle, className),
|
|
14
|
-
children: [/*#__PURE__*/
|
|
15
|
-
|
|
17
|
+
children: [/*#__PURE__*/_jsxs(Flexbox, {
|
|
18
|
+
align: 'center',
|
|
19
|
+
direction: 'horizontal',
|
|
20
|
+
gap: 8,
|
|
21
|
+
children: [title, tag && /*#__PURE__*/_jsx(Tag, {
|
|
22
|
+
children: tag
|
|
23
|
+
})]
|
|
16
24
|
}), desc && /*#__PURE__*/_jsx("small", {
|
|
17
25
|
children: desc
|
|
18
26
|
})]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const useStyles: (props?: string | number | undefined) => import("antd-style").ReturnStyles<{
|
|
2
2
|
footer: import("antd-style").SerializedStyles;
|
|
3
3
|
formTitle: import("antd-style").SerializedStyles;
|
|
4
|
-
group:
|
|
4
|
+
group: string;
|
|
5
5
|
item: import("antd-style").SerializedStyles;
|
|
6
6
|
title: import("antd-style").SerializedStyles;
|
|
7
7
|
}>;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
import { isNumber } from 'lodash-es';
|
|
5
5
|
export var useStyles = createStyles(function (_ref, itemMinWidth) {
|
|
6
6
|
var css = _ref.css,
|
|
7
|
-
|
|
7
|
+
cx = _ref.cx,
|
|
8
|
+
token = _ref.token,
|
|
9
|
+
isDarkMode = _ref.isDarkMode;
|
|
8
10
|
return {
|
|
9
|
-
footer: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
10
|
-
formTitle: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n
|
|
11
|
-
group: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n
|
|
12
|
-
item: css(
|
|
13
|
-
title: css(
|
|
11
|
+
footer: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n "]))),
|
|
12
|
+
formTitle: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: column;\n gap: 6px;\n\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 .ant-tag {\n font-family: ", ";\n }\n "])), token.colorTextDescription, token.fontFamilyCode),
|
|
13
|
+
group: cx(isDarkMode && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ant-collapse-content {\n background: transparent;\n }\n\n .ant-collapse-header {\n background: ", ";\n }\n "])), token.colorFillTertiary), css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .ant-collapse-header {\n border-radius: 0 !important;\n }\n\n .ant-collapse-content-box {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n }\n\n .ant-form-item-label {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n "])))),
|
|
14
|
+
item: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: 8px 0;\n\n .ant-row {\n justify-content: space-between;\n\n > div {\n flex: unset !important;\n flex-grow: unset !important;\n }\n }\n\n ", "\n "])), itemMinWidth && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n .ant-form-item-control {\n width: ", ";\n }\n "])), isNumber(itemMinWidth) ? "".concat(itemMinWidth, "px") : itemMinWidth)),
|
|
15
|
+
title: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n gap: 8px;\n align-items: center;\n\n font-size: 16px;\n font-weight: 600;\n\n .anticon {\n color: ", ";\n }\n "])), token.colorPrimary)
|
|
14
16
|
};
|
|
15
17
|
});
|
package/es/Form/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormProps as AntFormProps } from 'antd';
|
|
1
|
+
import { FormProps as AntFormProps, type FormInstance } from 'antd';
|
|
2
2
|
import { LucideIcon } from 'lucide-react';
|
|
3
3
|
import { type ReactNode } from 'react';
|
|
4
4
|
import { FormItemProps } from './components/FormItem';
|
|
@@ -13,5 +13,5 @@ export interface FormProps extends AntFormProps {
|
|
|
13
13
|
itemMinWidth?: FormItemProps['minWidth'];
|
|
14
14
|
items?: ItemGroup[];
|
|
15
15
|
}
|
|
16
|
-
declare const Form: import("react").
|
|
16
|
+
declare const Form: import("react").ForwardRefExoticComponent<FormProps & import("react").RefAttributes<FormInstance<any>>>;
|
|
17
17
|
export default Form;
|
package/es/Form/index.js
CHANGED
|
@@ -4,14 +4,14 @@ var _excluded = ["className", "itemMinWidth", "footer", "items", "children"];
|
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
import { Form as AntForm } from 'antd';
|
|
7
|
-
import {
|
|
7
|
+
import { forwardRef } from 'react';
|
|
8
8
|
import FormFooter from "./components/FormFooter";
|
|
9
9
|
import FormGroup from "./components/FormGroup";
|
|
10
10
|
import FormItem from "./components/FormItem";
|
|
11
11
|
import { useStyles } from "./style";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
var Form = /*#__PURE__*/
|
|
14
|
+
var Form = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
15
15
|
var className = _ref.className,
|
|
16
16
|
itemMinWidth = _ref.itemMinWidth,
|
|
17
17
|
footer = _ref.footer,
|
|
@@ -24,13 +24,16 @@ var Form = /*#__PURE__*/memo(function (_ref) {
|
|
|
24
24
|
return /*#__PURE__*/_jsxs(AntForm, _objectSpread(_objectSpread({
|
|
25
25
|
className: cx(styles.form, className),
|
|
26
26
|
colon: false,
|
|
27
|
-
layout: "horizontal"
|
|
27
|
+
layout: "horizontal",
|
|
28
|
+
ref: ref
|
|
28
29
|
}, props), {}, {
|
|
29
30
|
children: [items === null || items === void 0 ? void 0 : items.map(function (group, groupIndex) {
|
|
30
31
|
return /*#__PURE__*/_jsx(FormGroup, {
|
|
31
32
|
icon: group === null || group === void 0 ? void 0 : group.icon,
|
|
32
33
|
title: group.title,
|
|
33
|
-
children: group.children.
|
|
34
|
+
children: group.children.filter(function (item) {
|
|
35
|
+
return !item.hidden;
|
|
36
|
+
}).map(function (item, itemIndex) {
|
|
34
37
|
return /*#__PURE__*/_jsx(FormItem, _objectSpread({
|
|
35
38
|
divider: itemIndex !== 0,
|
|
36
39
|
minWidth: itemMinWidth
|
package/es/Form/style.js
CHANGED
|
@@ -2,9 +2,10 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
|
|
|
2
2
|
var _templateObject, _templateObject2;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
|
-
var css = _ref.css
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token;
|
|
6
7
|
return {
|
|
7
8
|
footer: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n "]))),
|
|
8
|
-
form: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n .ant-form-item {\n margin: 0 !important;\n }\n\n .ant-form-item .ant-form-item-label > label {\n height: unset;\n }\n\n .ant-row {\n position: relative;\n flex-wrap: nowrap;\n }\n\n .ant-form-item-label {\n position: relative;\n flex: 1;\n max-width: 100%;\n }\n\n .ant-form-item-control {\n position: relative;\n flex: 0;\n min-width: unset !important;\n }\n "])))
|
|
9
|
+
form: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n .ant-form-item {\n margin: 0 !important;\n }\n\n .ant-form-item .ant-form-item-label > label {\n height: unset;\n }\n\n .ant-row {\n position: relative;\n flex-wrap: nowrap;\n }\n\n .ant-form-item-label {\n position: relative;\n flex: 1;\n max-width: 100%;\n }\n\n .ant-form-item-control {\n position: relative;\n flex: 0;\n min-width: unset !important;\n }\n\n .ant-collapse-item {\n overflow: hidden !important;\n border-radius: ", "px !important;\n }\n "])), token.borderRadius)
|
|
9
10
|
};
|
|
10
11
|
});
|
|
@@ -2,5 +2,5 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
|
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from 'antd-style';
|
|
4
4
|
export default (function (token) {
|
|
5
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-tooltip-inner {\n display: flex;\n align-items: center;\n justify-content: center;\n\n min-height: unset;\n padding: 4px 8px;\n\n color: ", " !important;\n\n background-color: ", " !important;\n border-radius: ", "px !important;\n }\n\n .ant-tooltip-arrow {\n &::before,\n &::after {\n background: ", " !important;\n }\n }\n"])), token.colorBgLayout, token.colorText, token.borderRadiusSM, token.colorText);
|
|
5
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-tooltip-inner {\n display: flex;\n align-items: center;\n justify-content: center;\n\n min-height: unset;\n padding: 4px 8px;\n\n color: ", " !important;\n\n background-color: ", " !important;\n border-radius: ", "px !important;\n }\n\n .ant-tooltip-arrow {\n &::before,\n &::after {\n background: ", " !important;\n }\n }\n\n .ant-switch-handle::before {\n background: ", " !important;\n }\n"])), token.colorBgLayout, token.colorText, token.borderRadiusSM, token.colorText, token.colorBgContainer);
|
|
6
6
|
});
|