@ant-design/pro-components 3.1.3-1 → 3.1.5-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/dist/pro-components.min.js +1 -1
- package/es/card/ProCard.js +15 -7
- package/es/card/components/Actions/index.js +1 -4
- package/es/card/components/Card/index.js +60 -28
- package/es/card/components/Card/style.js +46 -9
- package/es/card/components/CheckCard/Group.js +1 -3
- package/es/card/components/CheckCard/index.js +0 -1
- package/es/card/components/Divider/index.d.ts +1 -1
- package/es/card/components/Divider/index.js +2 -2
- package/es/card/components/Divider/style.d.ts +4 -1
- package/es/card/components/Divider/style.js +6 -39
- package/es/card/components/Statistic/index.js +3 -3
- package/es/card/components/StatisticCard/index.js +1 -1
- package/es/card/typing.d.ts +29 -14
- package/es/descriptions/index.d.ts +3 -5
- package/es/descriptions/index.js +6 -6
- package/es/descriptions/useFetchData.js +0 -1
- package/es/field/AllProField.d.ts +2 -0
- package/es/field/AllProField.js +3 -4
- package/es/field/PureProField.d.ts +2 -0
- package/es/field/PureProField.js +2 -5
- package/es/field/components/Cascader/index.js +8 -1
- package/es/field/components/Checkbox/index.js +7 -6
- package/es/field/components/DatePicker/index.d.ts +1 -1
- package/es/field/components/DatePicker/index.js +13 -1
- package/es/field/components/Digit/index.js +20 -3
- package/es/field/components/DigitRange/index.js +1 -0
- package/es/field/components/Money/index.js +51 -3
- package/es/field/components/Options/index.js +0 -3
- package/es/field/components/Password/index.js +12 -11
- package/es/field/components/Percent/util.d.ts +1 -1
- package/es/field/components/Radio/index.js +5 -1
- package/es/field/components/RangePicker/index.d.ts +1 -1
- package/es/field/components/Segmented/index.js +2 -1
- package/es/field/components/Select/SearchSelect/index.js +0 -1
- package/es/field/components/Select/index.d.ts +1 -1
- package/es/field/components/Select/index.js +1 -1
- package/es/field/components/Switch/index.js +10 -3
- package/es/field/components/Text/index.js +11 -2
- package/es/field/components/TextArea/index.js +6 -3
- package/es/field/components/TimePicker/index.js +10 -1
- package/es/field/components/TreeSelect/index.d.ts +2 -12
- package/es/field/components/TreeSelect/index.js +31 -17
- package/es/form/BaseForm/BaseForm.js +4 -6
- package/es/form/BaseForm/LightWrapper/index.d.ts +2 -1
- package/es/form/BaseForm/Submitter/index.d.ts +1 -1
- package/es/form/components/Captcha/index.js +0 -3
- package/es/form/components/Checkbox/index.js +5 -1
- package/es/form/components/DatePicker/index.js +0 -2
- package/es/form/components/Digit/DigitRange.js +5 -2
- package/es/form/components/Digit/index.js +7 -2
- package/es/form/components/FieldSet/index.js +16 -6
- package/es/form/components/FormItem/FormItemRender/index.d.ts +1 -1
- package/es/form/components/FormItem/FormItemRender/index.js +10 -2
- package/es/form/components/FormItem/Group/index.js +1 -1
- package/es/form/components/FormItem/index.js +9 -7
- package/es/form/components/FormItem/warpField.js +3 -15
- package/es/form/components/List/ListContainer.js +2 -1
- package/es/form/components/List/index.d.ts +1 -1
- package/es/form/components/List/index.js +0 -2
- package/es/form/components/Radio/index.js +5 -4
- package/es/form/components/SchemaForm/index.js +0 -1
- package/es/form/components/SchemaForm/layoutType/StepsForm.js +0 -1
- package/es/form/components/Select/index.js +11 -2
- package/es/form/components/Text/index.js +0 -3
- package/es/form/components/UploadButton/index.js +4 -2
- package/es/form/components/UploadDragger/index.js +0 -1
- package/es/form/helpers/grid.js +1 -5
- package/es/form/layouts/DrawerForm/index.d.ts +4 -4
- package/es/form/layouts/DrawerForm/index.js +2 -6
- package/es/form/layouts/LightFilter/index.js +5 -6
- package/es/form/layouts/LoginForm/index.js +8 -8
- package/es/form/layouts/LoginFormPage/index.js +15 -15
- package/es/form/layouts/ModalForm/index.d.ts +2 -2
- package/es/form/layouts/ModalForm/index.js +1 -4
- package/es/form/layouts/QueryFilter/Actions.js +2 -1
- package/es/form/layouts/QueryFilter/index.js +40 -24
- package/es/form/layouts/StepsForm/StepForm.js +0 -1
- package/es/form/layouts/StepsForm/index.js +5 -14
- package/es/layout/ProLayout.d.ts +1 -1
- package/es/layout/ProLayout.js +2 -7
- package/es/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
- package/es/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
- package/es/layout/components/AppsLogoComponents/style/index.js +4 -0
- package/es/layout/components/FooterToolbar/index.d.ts +1 -1
- package/es/layout/components/FooterToolbar/index.js +2 -5
- package/es/layout/components/GlobalFooter/index.js +3 -3
- package/es/layout/components/GlobalHeader/ActionsContent.js +6 -7
- package/es/layout/components/GlobalHeader/index.js +1 -1
- package/es/layout/components/GridContent/index.js +1 -1
- package/es/layout/components/Header/index.js +1 -3
- package/es/layout/components/Help/ProHelpPanel.js +11 -10
- package/es/layout/components/PageContainer/index.js +9 -10
- package/es/layout/components/PageContainer/style/index.js +4 -0
- package/es/layout/components/PageHeader/index.js +10 -10
- package/es/layout/components/SettingDrawer/BlockCheckbox.js +2 -3
- package/es/layout/components/SettingDrawer/LayoutChange.js +3 -2
- package/es/layout/components/SettingDrawer/RegionalChange.js +3 -2
- package/es/layout/components/SettingDrawer/ThemeColor.js +3 -2
- package/es/layout/components/SettingDrawer/index.js +5 -5
- package/es/layout/components/SettingDrawer/style/index.js +4 -0
- package/es/layout/components/SiderMenu/BaseMenu.js +5 -9
- package/es/layout/components/SiderMenu/SiderMenu.js +6 -8
- package/es/layout/components/SiderMenu/index.js +0 -1
- package/es/layout/components/TopNavHeader/index.js +4 -5
- package/es/layout/style/index.js +4 -0
- package/es/layout/utils/getBreadcrumbProps.js +1 -1
- package/es/layout/utils/getMenuData.js +0 -1
- package/es/list/Item.d.ts +4 -7
- package/es/list/Item.js +82 -104
- package/es/list/ListView.d.ts +6 -4
- package/es/list/ListView.js +42 -55
- package/es/list/ProListBase.d.ts +74 -0
- package/es/list/ProListBase.js +358 -0
- package/es/list/constants.d.ts +2 -2
- package/es/list/constants.js +2 -5
- package/es/list/index.d.ts +23 -13
- package/es/list/index.js +78 -41
- package/es/list/style/index.d.ts +0 -1
- package/es/list/style/index.js +228 -86
- package/es/provider/index.d.ts +2 -2
- package/es/provider/index.js +0 -3
- package/es/provider/useStyle/index.d.ts +1 -21
- package/es/provider/useStyle/index.js +6 -3
- package/es/skeleton/components/Descriptions/index.js +1 -4
- package/es/skeleton/components/List/index.js +1 -4
- package/es/table/Store/Provide.js +0 -2
- package/es/table/Table.js +17 -17
- package/es/table/components/Alert/index.js +6 -5
- package/es/table/components/ColumnSetting/index.js +9 -10
- package/es/table/components/DragSortTable/index.js +8 -4
- package/es/table/components/EditableTable/index.d.ts +1 -1
- package/es/table/components/EditableTable/index.js +6 -8
- package/es/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
- package/es/table/components/ListToolBar/HeaderMenu.js +4 -3
- package/es/table/components/ListToolBar/index.d.ts +1 -1
- package/es/table/components/ListToolBar/index.js +18 -21
- package/es/table/components/ListToolBar/style.js +3 -3
- package/es/table/components/ToolBar/index.d.ts +1 -1
- package/es/table/style/index.js +4 -0
- package/es/table/typing.d.ts +10 -5
- package/es/table/useFetchData.js +4 -4
- package/es/table/utils/cellRenderToFromItem.js +2 -4
- package/es/table/utils/index.js +0 -1
- package/es/table/utils/useDragSort.js +1 -1
- package/es/utils/components/DropdownFooter/index.d.ts +1 -1
- package/es/utils/components/FieldLabel/index.js +1 -1
- package/es/utils/components/FilterDropdown/index.d.ts +1 -1
- package/es/utils/components/FilterDropdown/index.js +1 -1
- package/es/utils/components/InlineErrorFormItem/index.js +5 -4
- package/es/utils/components/LabelIconTip/index.d.ts +3 -4
- package/es/utils/components/LabelIconTip/index.js +2 -2
- package/es/utils/genCopyable/index.d.ts +6 -0
- package/es/utils/genCopyable/index.js +28 -8
- package/es/utils/hooks/useDebounceValue/index.js +1 -3
- package/es/utils/hooks/useDeepCompareEffect/index.js +0 -2
- package/es/utils/hooks/useFetchData/index.js +0 -2
- package/es/utils/index.d.ts +2 -1
- package/es/utils/isDeepEqualReact/index.js +0 -8
- package/es/utils/isUrl/index.js +1 -1
- package/es/utils/merge/index.js +0 -3
- package/es/utils/nanoid/index.d.ts +1 -3
- package/es/utils/nanoid/index.js +2 -10
- package/es/utils/proFieldParsingText/index.d.ts +2 -2
- package/es/utils/proFieldParsingText/index.js +3 -5
- package/es/utils/typing.d.ts +2 -1
- package/es/utils/useEditableArray/index.js +1 -1
- package/es/utils/useEditableMap/index.js +1 -1
- package/guidelines/components/pro-card.md +5 -4
- package/guidelines/overview-components.md +1 -1
- package/lib/card/ProCard.js +15 -7
- package/lib/card/components/Actions/index.js +1 -4
- package/lib/card/components/Card/index.js +60 -28
- package/lib/card/components/Card/style.js +46 -9
- package/lib/card/components/CheckCard/Group.js +1 -3
- package/lib/card/components/CheckCard/index.js +0 -1
- package/lib/card/components/Divider/index.d.ts +1 -1
- package/lib/card/components/Divider/index.js +2 -2
- package/lib/card/components/Divider/style.d.ts +4 -1
- package/lib/card/components/Divider/style.js +5 -39
- package/lib/card/components/Statistic/index.js +3 -3
- package/lib/card/components/StatisticCard/index.js +1 -1
- package/lib/card/typing.d.ts +29 -14
- package/lib/descriptions/index.d.ts +3 -5
- package/lib/descriptions/index.js +6 -6
- package/lib/descriptions/useFetchData.js +0 -1
- package/lib/field/AllProField.d.ts +2 -0
- package/lib/field/AllProField.js +3 -4
- package/lib/field/PureProField.d.ts +2 -0
- package/lib/field/PureProField.js +2 -5
- package/lib/field/components/Cascader/index.js +8 -1
- package/lib/field/components/Checkbox/index.js +7 -6
- package/lib/field/components/DatePicker/index.d.ts +1 -1
- package/lib/field/components/DatePicker/index.js +13 -1
- package/lib/field/components/Digit/index.js +20 -3
- package/lib/field/components/DigitRange/index.js +1 -0
- package/lib/field/components/Money/index.js +50 -2
- package/lib/field/components/Options/index.js +0 -3
- package/lib/field/components/Password/index.js +11 -10
- package/lib/field/components/Percent/util.d.ts +1 -1
- package/lib/field/components/Radio/index.js +5 -1
- package/lib/field/components/RangePicker/index.d.ts +1 -1
- package/lib/field/components/Segmented/index.js +2 -1
- package/lib/field/components/Select/SearchSelect/index.js +0 -1
- package/lib/field/components/Select/index.d.ts +1 -1
- package/lib/field/components/Select/index.js +1 -1
- package/lib/field/components/Switch/index.js +10 -3
- package/lib/field/components/Text/index.js +11 -2
- package/lib/field/components/TextArea/index.js +6 -3
- package/lib/field/components/TimePicker/index.js +10 -1
- package/lib/field/components/TreeSelect/index.d.ts +2 -12
- package/lib/field/components/TreeSelect/index.js +30 -16
- package/lib/form/BaseForm/BaseForm.js +4 -7
- package/lib/form/BaseForm/LightWrapper/index.d.ts +2 -1
- package/lib/form/BaseForm/Submitter/index.d.ts +1 -1
- package/lib/form/components/Captcha/index.js +0 -3
- package/lib/form/components/Checkbox/index.js +5 -1
- package/lib/form/components/DatePicker/index.js +0 -2
- package/lib/form/components/Digit/DigitRange.js +5 -2
- package/lib/form/components/Digit/index.js +7 -2
- package/lib/form/components/FieldSet/index.js +16 -6
- package/lib/form/components/FormItem/FormItemRender/index.d.ts +1 -1
- package/lib/form/components/FormItem/FormItemRender/index.js +10 -2
- package/lib/form/components/FormItem/Group/index.js +1 -1
- package/lib/form/components/FormItem/index.js +9 -7
- package/lib/form/components/FormItem/warpField.js +3 -15
- package/lib/form/components/List/ListContainer.js +2 -1
- package/lib/form/components/List/index.d.ts +1 -1
- package/lib/form/components/List/index.js +0 -2
- package/lib/form/components/Radio/index.js +5 -4
- package/lib/form/components/SchemaForm/index.js +0 -1
- package/lib/form/components/SchemaForm/layoutType/StepsForm.js +0 -1
- package/lib/form/components/Select/index.js +11 -2
- package/lib/form/components/Text/index.js +0 -3
- package/lib/form/components/UploadButton/index.js +4 -2
- package/lib/form/components/UploadDragger/index.js +0 -1
- package/lib/form/helpers/grid.js +1 -5
- package/lib/form/layouts/DrawerForm/index.d.ts +4 -4
- package/lib/form/layouts/DrawerForm/index.js +2 -6
- package/lib/form/layouts/LightFilter/index.js +5 -6
- package/lib/form/layouts/LoginForm/index.js +8 -8
- package/lib/form/layouts/LoginFormPage/index.js +15 -15
- package/lib/form/layouts/ModalForm/index.d.ts +2 -2
- package/lib/form/layouts/ModalForm/index.js +1 -4
- package/lib/form/layouts/QueryFilter/Actions.js +2 -1
- package/lib/form/layouts/QueryFilter/index.js +39 -24
- package/lib/form/layouts/StepsForm/StepForm.js +0 -1
- package/lib/form/layouts/StepsForm/index.js +5 -14
- package/lib/layout/ProLayout.d.ts +1 -1
- package/lib/layout/ProLayout.js +2 -7
- package/lib/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
- package/lib/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
- package/lib/layout/components/AppsLogoComponents/style/index.js +4 -0
- package/lib/layout/components/FooterToolbar/index.d.ts +1 -1
- package/lib/layout/components/FooterToolbar/index.js +2 -6
- package/lib/layout/components/GlobalFooter/index.js +3 -3
- package/lib/layout/components/GlobalHeader/ActionsContent.js +6 -7
- package/lib/layout/components/GlobalHeader/index.js +1 -1
- package/lib/layout/components/GridContent/index.js +1 -1
- package/lib/layout/components/Header/index.js +1 -3
- package/lib/layout/components/Help/ProHelpPanel.js +11 -10
- package/lib/layout/components/PageContainer/index.js +9 -10
- package/lib/layout/components/PageContainer/style/index.js +4 -0
- package/lib/layout/components/PageHeader/index.js +10 -10
- package/lib/layout/components/SettingDrawer/BlockCheckbox.js +2 -3
- package/lib/layout/components/SettingDrawer/LayoutChange.js +3 -2
- package/lib/layout/components/SettingDrawer/RegionalChange.js +3 -2
- package/lib/layout/components/SettingDrawer/ThemeColor.js +3 -2
- package/lib/layout/components/SettingDrawer/index.js +5 -5
- package/lib/layout/components/SettingDrawer/style/index.js +4 -0
- package/lib/layout/components/SiderMenu/BaseMenu.js +5 -9
- package/lib/layout/components/SiderMenu/SiderMenu.js +6 -8
- package/lib/layout/components/SiderMenu/index.js +0 -1
- package/lib/layout/components/TopNavHeader/index.js +4 -5
- package/lib/layout/style/index.js +4 -0
- package/lib/layout/utils/getBreadcrumbProps.js +1 -1
- package/lib/layout/utils/getMenuData.js +0 -1
- package/lib/list/Item.d.ts +4 -7
- package/lib/list/Item.js +81 -103
- package/lib/list/ListView.d.ts +6 -4
- package/lib/list/ListView.js +41 -54
- package/lib/list/ProListBase.d.ts +74 -0
- package/lib/list/ProListBase.js +365 -0
- package/lib/list/constants.d.ts +2 -2
- package/lib/list/constants.js +2 -5
- package/lib/list/index.d.ts +23 -13
- package/lib/list/index.js +77 -40
- package/lib/list/style/index.d.ts +0 -1
- package/lib/list/style/index.js +227 -86
- package/lib/provider/index.d.ts +2 -2
- package/lib/provider/index.js +0 -3
- package/lib/provider/useStyle/index.d.ts +1 -21
- package/lib/provider/useStyle/index.js +6 -3
- package/lib/skeleton/components/Descriptions/index.js +1 -4
- package/lib/skeleton/components/List/index.js +1 -4
- package/lib/table/Store/Provide.js +0 -2
- package/lib/table/Table.js +17 -17
- package/lib/table/components/Alert/index.js +6 -5
- package/lib/table/components/ColumnSetting/index.js +9 -10
- package/lib/table/components/DragSortTable/index.js +8 -4
- package/lib/table/components/EditableTable/index.d.ts +1 -1
- package/lib/table/components/EditableTable/index.js +6 -8
- package/lib/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
- package/lib/table/components/ListToolBar/HeaderMenu.js +4 -3
- package/lib/table/components/ListToolBar/index.d.ts +1 -1
- package/lib/table/components/ListToolBar/index.js +18 -21
- package/lib/table/components/ListToolBar/style.js +3 -3
- package/lib/table/components/ToolBar/index.d.ts +1 -1
- package/lib/table/style/index.js +4 -0
- package/lib/table/typing.d.ts +10 -5
- package/lib/table/useFetchData.js +4 -4
- package/lib/table/utils/cellRenderToFromItem.js +2 -4
- package/lib/table/utils/index.js +0 -1
- package/lib/table/utils/useDragSort.js +1 -1
- package/lib/utils/components/DropdownFooter/index.d.ts +1 -1
- package/lib/utils/components/FieldLabel/index.js +1 -1
- package/lib/utils/components/FilterDropdown/index.d.ts +1 -1
- package/lib/utils/components/FilterDropdown/index.js +1 -1
- package/lib/utils/components/InlineErrorFormItem/index.js +5 -4
- package/lib/utils/components/LabelIconTip/index.d.ts +3 -4
- package/lib/utils/components/LabelIconTip/index.js +2 -2
- package/lib/utils/genCopyable/index.d.ts +6 -0
- package/lib/utils/genCopyable/index.js +28 -8
- package/lib/utils/hooks/useDebounceValue/index.js +1 -3
- package/lib/utils/hooks/useDeepCompareEffect/index.js +0 -2
- package/lib/utils/hooks/useFetchData/index.js +0 -2
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/isDeepEqualReact/index.js +0 -8
- package/lib/utils/isUrl/index.js +1 -1
- package/lib/utils/merge/index.js +0 -3
- package/lib/utils/nanoid/index.d.ts +1 -3
- package/lib/utils/nanoid/index.js +2 -10
- package/lib/utils/proFieldParsingText/index.d.ts +2 -2
- package/lib/utils/proFieldParsingText/index.js +3 -5
- package/lib/utils/typing.d.ts +2 -1
- package/lib/utils/useEditableArray/index.js +0 -2
- package/lib/utils/useEditableMap/index.js +0 -2
- package/package.json +32 -32
|
@@ -51,7 +51,7 @@ const FilterDropdown = props => {
|
|
|
51
51
|
return htmlRef.current || document.body;
|
|
52
52
|
},
|
|
53
53
|
children: /*#__PURE__*/_jsx("div", {
|
|
54
|
-
className: `${prefixCls}-content
|
|
54
|
+
className: clsx(`${prefixCls}-content`, hashId),
|
|
55
55
|
children: children
|
|
56
56
|
})
|
|
57
57
|
}), footer && /*#__PURE__*/_jsx(DropdownFooter, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LoadingOutlined } from '@ant-design/icons';
|
|
2
2
|
import { get } from '@rc-component/util';
|
|
3
3
|
import { ConfigProvider, Form, Popover, theme } from 'antd';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
4
5
|
import React, { useContext, useEffect, useState } from 'react';
|
|
5
6
|
import { useStyle } from "./style";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -47,13 +48,13 @@ const InlineErrorFormItemPopover = ({
|
|
|
47
48
|
getPopupContainer: popoverProps?.getPopupContainer,
|
|
48
49
|
getTooltipContainer: popoverProps?.getTooltipContainer,
|
|
49
50
|
content: wrapSSR( /*#__PURE__*/_jsx("div", {
|
|
50
|
-
className: `${prefixCls}-form-item
|
|
51
|
+
className: clsx(`${prefixCls}-form-item`, hashId, token.hashId),
|
|
51
52
|
style: {
|
|
52
53
|
margin: 0,
|
|
53
54
|
padding: 0
|
|
54
55
|
},
|
|
55
56
|
children: /*#__PURE__*/_jsxs("div", {
|
|
56
|
-
className: `${prefixCls}-form-item-with-help
|
|
57
|
+
className: clsx(`${prefixCls}-form-item-with-help`, hashId, token.hashId),
|
|
57
58
|
children: [loading ? /*#__PURE__*/_jsx(LoadingOutlined, {}) : null, errorList]
|
|
58
59
|
})
|
|
59
60
|
})),
|
|
@@ -82,7 +83,7 @@ const InternalFormItemFunction = ({
|
|
|
82
83
|
}
|
|
83
84
|
try {
|
|
84
85
|
return JSON.stringify(get(prev, shouldName)) !== JSON.stringify(get(next, shouldName));
|
|
85
|
-
} catch (
|
|
86
|
+
} catch (_error) {
|
|
86
87
|
return true;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -132,7 +133,7 @@ export const InlineErrorFormItem = props => {
|
|
|
132
133
|
}
|
|
133
134
|
try {
|
|
134
135
|
return JSON.stringify(get(prev, shouldName)) !== JSON.stringify(get(next, shouldName));
|
|
135
|
-
} catch (
|
|
136
|
+
} catch (_error) {
|
|
136
137
|
return true;
|
|
137
138
|
}
|
|
138
139
|
} : undefined,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import type { ProEllipsis } from '../../genCopyable';
|
|
3
|
+
import type { LabelTooltipType } from '../../typing';
|
|
3
4
|
/**
|
|
4
5
|
* 在 form 的 label 后面增加一个 tips 来展示一些说明文案
|
|
5
6
|
*
|
|
@@ -9,7 +10,5 @@ export declare const LabelIconTip: React.FC<{
|
|
|
9
10
|
label: React.ReactNode;
|
|
10
11
|
subTitle?: React.ReactNode;
|
|
11
12
|
tooltip?: string | LabelTooltipType;
|
|
12
|
-
ellipsis?:
|
|
13
|
-
showTitle?: boolean;
|
|
14
|
-
};
|
|
13
|
+
ellipsis?: ProEllipsis;
|
|
15
14
|
}>;
|
|
@@ -47,12 +47,12 @@ export const LabelIconTip = /*#__PURE__*/React.memo(props => {
|
|
|
47
47
|
}),
|
|
48
48
|
children: label
|
|
49
49
|
}), subTitle && /*#__PURE__*/_jsx("div", {
|
|
50
|
-
className: `${className}-subtitle
|
|
50
|
+
className: clsx(`${className}-subtitle`, hashId),
|
|
51
51
|
children: subTitle
|
|
52
52
|
}), tooltip && /*#__PURE__*/_jsx(Tooltip, {
|
|
53
53
|
...tooltipProps,
|
|
54
54
|
children: /*#__PURE__*/_jsx("span", {
|
|
55
|
-
className: `${className}-icon
|
|
55
|
+
className: clsx(`${className}-icon`, hashId),
|
|
56
56
|
children: icon
|
|
57
57
|
})
|
|
58
58
|
})]
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import type { TooltipProps } from 'antd';
|
|
1
2
|
import React from 'react';
|
|
3
|
+
export type ProEllipsisTooltip = {
|
|
4
|
+
showTitle?: boolean;
|
|
5
|
+
tooltip?: TooltipProps;
|
|
6
|
+
};
|
|
7
|
+
export type ProEllipsis = ProEllipsisTooltip | boolean;
|
|
2
8
|
/**
|
|
3
9
|
* 生成 Copyable 或 Ellipsis 的 dom
|
|
4
10
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Typography } from 'antd';
|
|
2
|
+
import isObject from 'lodash-es/isObject';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -23,16 +24,35 @@ const normalizeCopyText = text => {
|
|
|
23
24
|
return text === null || text === undefined ? '' : String(text).trimEnd();
|
|
24
25
|
};
|
|
25
26
|
const genEllipsis = (dom, item, text) => {
|
|
27
|
+
const ellipsis = getEllipsis(item);
|
|
28
|
+
if (!ellipsis || !text) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
26
31
|
/** 有些 valueType 需要设置copy的为string */
|
|
27
32
|
const needTranText = isNeedTranText(item);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
|
|
34
|
+
// 支持一下 tooltip 的关闭
|
|
35
|
+
if (needTranText && item?.tooltip !== false) {
|
|
36
|
+
return {
|
|
37
|
+
tooltip: /*#__PURE__*/_jsx("div", {
|
|
38
|
+
className: "pro-table-tooltip-text",
|
|
39
|
+
children: dom
|
|
40
|
+
})
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 如果 ellipsis 是对象且包含 tooltip 属性,合并 tooltip 的属性
|
|
45
|
+
if (isObject(ellipsis) && isObject(ellipsis.tooltip)) {
|
|
46
|
+
return {
|
|
47
|
+
tooltip: {
|
|
48
|
+
title: text,
|
|
49
|
+
...ellipsis.tooltip
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
tooltip: text
|
|
55
|
+
};
|
|
36
56
|
};
|
|
37
57
|
|
|
38
58
|
/**
|
|
@@ -15,8 +15,6 @@ export function useDebounceValue(value, delay = 100, deps) {
|
|
|
15
15
|
setDebouncedValue(valueRef.current);
|
|
16
16
|
}, delay);
|
|
17
17
|
return () => clearTimeout(handler);
|
|
18
|
-
},
|
|
19
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
-
deps ? [delay, ...deps] : undefined);
|
|
18
|
+
}, deps ? [delay, ...deps] : undefined);
|
|
21
19
|
return debouncedValue;
|
|
22
20
|
}
|
|
@@ -12,7 +12,6 @@ export function useDeepCompareMemoize(value, ignoreKeys) {
|
|
|
12
12
|
return ref.current;
|
|
13
13
|
}
|
|
14
14
|
export function useDeepCompareEffect(effect, dependencies, ignoreKeys) {
|
|
15
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
15
|
useEffect(effect, useDeepCompareMemoize(dependencies || [], ignoreKeys));
|
|
17
16
|
}
|
|
18
17
|
export function useDeepCompareEffectDebounce(effect, dependencies, ignoreKeys, waitTime) {
|
|
@@ -21,6 +20,5 @@ export function useDeepCompareEffectDebounce(effect, dependencies, ignoreKeys, w
|
|
|
21
20
|
}, waitTime || 16);
|
|
22
21
|
useEffect(() => {
|
|
23
22
|
effectDn.run();
|
|
24
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
23
|
}, useDeepCompareMemoize(dependencies || [], ignoreKeys));
|
|
26
24
|
}
|
|
@@ -11,7 +11,6 @@ export function useFetchData(props) {
|
|
|
11
11
|
testId += 1;
|
|
12
12
|
return testId.toString();
|
|
13
13
|
});
|
|
14
|
-
const proFieldKeyRef = useRef(cacheKey);
|
|
15
14
|
const fetchData = async () => {
|
|
16
15
|
abortRef.current?.abort();
|
|
17
16
|
const abort = new AbortController();
|
|
@@ -31,7 +30,6 @@ export function useFetchData(props) {
|
|
|
31
30
|
};
|
|
32
31
|
const {
|
|
33
32
|
data,
|
|
34
|
-
error,
|
|
35
33
|
isValidating
|
|
36
34
|
} = useSWR(props.request ? [cacheKey, props.params] : null, fetchData, {
|
|
37
35
|
revalidateOnFocus: false,
|
package/es/utils/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { ProFormInstanceType } from './components/ProFormContext';
|
|
|
9
9
|
import { ProFormContext } from './components/ProFormContext';
|
|
10
10
|
import { conversionMomentValue, convertMoment, dateFormatterMap } from './conversionMomentValue';
|
|
11
11
|
import { dateArrayFormatter } from './dateArrayFormatter';
|
|
12
|
+
import type { ProEllipsis } from './genCopyable';
|
|
12
13
|
import { genCopyable } from './genCopyable';
|
|
13
14
|
import { getFieldPropsOrFormItemProps } from './getFieldPropsOrFormItemProps';
|
|
14
15
|
import { useDebounceFn } from './hooks/useDebounceFn';
|
|
@@ -48,4 +49,4 @@ import { useEditableMap } from './useEditableMap';
|
|
|
48
49
|
import { useBreakpoint } from './useMediaQuery';
|
|
49
50
|
export * from './typing';
|
|
50
51
|
export { conversionMomentValue, conversionMomentValue as conversionSubmitValue, convertMoment, dateArrayFormatter, dateFormatterMap, DropdownFooter, editableRowByKey, ErrorBoundary, FieldLabel, FilterDropdown, genCopyable, getFieldPropsOrFormItemProps, InlineErrorFormItem, isBrowser, isDeepEqualReact, isDropdownValueType, isImg, isNil, isUrl, LabelIconTip, lighten, merge, nanoid, objectToMap, omitBoolean, omitUndefined, omitUndefinedAndEmptyArr, operationUnit, parseValueToDay, pickProFormItemProps, pickProProps, proFieldParsingText, ProFormContext, recordKeyToString, resetComponent, runFunction, setAlpha, stringify, transformKeySubmitValue, useBreakpoint, useDebounceFn, useDebounceValue, useDeepCompareEffect, useDeepCompareEffectDebounce, useDeepCompareMemo, useDocumentTitle, useEditableArray, useEditableMap, useFetchData, useLatest, usePrevious, useReactiveRef, useRefCallback, useRefFunction, useStyle, };
|
|
51
|
-
export type { ProFormInstanceType, ProRequestData, RowEditableConfig, RowEditableType, UseEditableMapType, UseEditableMapUtilType, UseEditableType, UseEditableUtilType, };
|
|
52
|
+
export type { ProEllipsis, ProFormInstanceType, ProRequestData, RowEditableConfig, RowEditableType, UseEditableMapType, UseEditableMapUtilType, UseEditableType, UseEditableUtilType, };
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-restricted-syntax */
|
|
2
|
-
/* eslint-disable no-continue */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4
|
-
/* eslint-disable no-self-compare */
|
|
5
|
-
/* eslint-disable eqeqeq */
|
|
6
|
-
/* eslint-disable no-plusplus */
|
|
7
1
|
// do not edit .js files directly - edit src/index.jst
|
|
8
2
|
|
|
9
3
|
export function isDeepEqualReact(a, b, ignoreKeys) {
|
|
@@ -42,8 +36,6 @@ export function isDeepEqualReact(a, b, ignoreKeys) {
|
|
|
42
36
|
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
43
37
|
if (a.valueOf !== Object.prototype.valueOf && a.valueOf) return a.valueOf() === b.valueOf();
|
|
44
38
|
if (a.toString !== Object.prototype.toString && a.toString) return a.toString() === b.toString();
|
|
45
|
-
|
|
46
|
-
// eslint-disable-next-line prefer-const
|
|
47
39
|
keys = Object.keys(a);
|
|
48
40
|
length = keys.length;
|
|
49
41
|
if (length !== Object.keys(b).length) return false;
|
package/es/utils/isUrl/index.js
CHANGED
package/es/utils/merge/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable prefer-rest-params */
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* 用于合并 n 个对象
|
|
5
3
|
* @param {any[]} ...rest
|
|
@@ -11,7 +9,6 @@ const merge = (...rest) => {
|
|
|
11
9
|
let key;
|
|
12
10
|
let i = 0;
|
|
13
11
|
for (; i < il; i += 1) {
|
|
14
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
15
12
|
for (key in rest[i]) {
|
|
16
13
|
if (rest[i].hasOwnProperty(key)) {
|
|
17
14
|
if (typeof obj[key] === 'object' && typeof rest[i][key] === 'object' && obj[key] !== undefined && obj[key] !== null && !Array.isArray(obj[key]) && !Array.isArray(rest[i][key])) {
|
package/es/utils/nanoid/index.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
/* eslint-disable prefer-const */
|
|
2
|
-
|
|
3
1
|
let index = 0;
|
|
4
2
|
let genNanoid = (t = 21) => {
|
|
5
3
|
if (typeof window === 'undefined') return (index += 1).toFixed(0);
|
|
6
4
|
if (!window.crypto) return (index += 1).toFixed(0);
|
|
7
5
|
let e = '',
|
|
8
6
|
r = crypto.getRandomValues(new Uint8Array(t));
|
|
9
|
-
// eslint-disable-next-line no-param-reassign
|
|
10
7
|
for (; t--;) {
|
|
11
8
|
let n = 63 & r[t];
|
|
12
9
|
e += n < 36 ? n.toString(36) : n < 62 ? (n - 26).toString(36).toUpperCase() : n < 63 ? '_' : '-';
|
|
@@ -15,15 +12,10 @@ let genNanoid = (t = 21) => {
|
|
|
15
12
|
};
|
|
16
13
|
|
|
17
14
|
/**
|
|
18
|
-
* 生成uuid,如果不支持 randomUUID,就用 genNanoid
|
|
19
|
-
*
|
|
20
|
-
* @returns string
|
|
15
|
+
* @description 生成uuid,如果不支持 randomUUID,就用 genNanoid
|
|
21
16
|
*/
|
|
22
17
|
export const nanoid = () => {
|
|
23
|
-
if (typeof
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
if (window.crypto && window.crypto.randomUUID && typeof crypto.randomUUID == 'function') {
|
|
26
|
-
// @ts-ignore
|
|
18
|
+
if (window?.crypto?.randomUUID && typeof crypto.randomUUID === 'function') {
|
|
27
19
|
return crypto.randomUUID();
|
|
28
20
|
}
|
|
29
21
|
return genNanoid();
|
|
@@ -14,8 +14,8 @@ export declare const objectToMap: (value: ProFieldValueEnumType | undefined) =>
|
|
|
14
14
|
* 转化 text 和 valueEnum 通过 type 来添加 Status
|
|
15
15
|
*
|
|
16
16
|
* @param text
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
17
|
+
* @param valueEnumParams
|
|
18
|
+
* @param key
|
|
19
19
|
*/
|
|
20
20
|
export declare const proFieldParsingText: (text: string | number | (string | number)[], valueEnumParams: ProFieldValueEnumType, key?: number | string) => React.ReactNode;
|
|
21
21
|
export {};
|
|
@@ -93,8 +93,8 @@ const TableStatus = {
|
|
|
93
93
|
* 转化 text 和 valueEnum 通过 type 来添加 Status
|
|
94
94
|
*
|
|
95
95
|
* @param text
|
|
96
|
-
* @param
|
|
97
|
-
* @param
|
|
96
|
+
* @param valueEnumParams
|
|
97
|
+
* @param key
|
|
98
98
|
*/
|
|
99
99
|
export const proFieldParsingText = (text, valueEnumParams, key) => {
|
|
100
100
|
if (Array.isArray(text)) {
|
|
@@ -102,9 +102,7 @@ export const proFieldParsingText = (text, valueEnumParams, key) => {
|
|
|
102
102
|
separator: ",",
|
|
103
103
|
size: 2,
|
|
104
104
|
wrap: true,
|
|
105
|
-
children: text.map((value, index) =>
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
proFieldParsingText(value, valueEnumParams, index))
|
|
105
|
+
children: text.map((value, index) => proFieldParsingText(value, valueEnumParams, index))
|
|
108
106
|
}, key);
|
|
109
107
|
}
|
|
110
108
|
const valueEnum = objectToMap(valueEnumParams);
|
package/es/utils/typing.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { AvatarProps, CascaderProps, CheckboxProps, ColorPickerProps, DatePickerProps, DividerProps, ImageProps, InputNumberProps, InputProps, PopoverProps, ProgressProps, RadioProps, RateProps, SegmentedProps, SelectProps, SliderSingleProps, SpaceProps, SwitchProps, TimeRangePickerProps, TreeSelectProps } from 'antd';
|
|
2
2
|
import type { RangePickerProps } from 'antd/lib/date-picker';
|
|
3
3
|
import type { FormInstance, FormItemProps } from 'antd/lib/form';
|
|
4
|
-
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel';
|
|
5
4
|
import type { NamePath } from 'antd/lib/form/interface';
|
|
6
5
|
import type { PasswordProps, TextAreaProps } from 'antd/lib/input';
|
|
7
6
|
import type { SliderRangeProps } from 'antd/lib/slider';
|
|
8
7
|
import type { ReactNode } from 'react';
|
|
9
8
|
import type { ProSchemaValueEnumType } from '../provider';
|
|
10
9
|
import type { UseEditableUtilType } from './useEditableArray';
|
|
10
|
+
export type LabelTooltipType = any;
|
|
11
|
+
export type WrapperTooltipProps = any;
|
|
11
12
|
export type ProFormBaseGroupProps = {
|
|
12
13
|
/**
|
|
13
14
|
* @name 分组的标题
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { LoadingOutlined } from '@ant-design/icons';
|
|
2
2
|
import { get, warning as rcWarning, set, useControlledState } from '@rc-component/util';
|
|
3
3
|
import { Form, Popconfirm, message } from 'antd';
|
|
4
4
|
import React, { createRef, forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { get, useControlledState } from '@rc-component/util';
|
|
2
2
|
import { message } from 'antd';
|
|
3
3
|
import { useCallback, useMemo, useRef } from 'react';
|
|
4
4
|
import { useRefFunction } from '..';
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- `tabs`: Configure tabs inside the card.
|
|
20
20
|
- `collapsible`: Whether the card can be collapsed.
|
|
21
21
|
- `ghost`: Transparent background.
|
|
22
|
+
- `variant`: `'outlined'` | `'borderless'`. Card border style.
|
|
22
23
|
|
|
23
24
|
**Usage Pattern**:
|
|
24
25
|
|
|
@@ -31,7 +32,7 @@ export default () => {
|
|
|
31
32
|
title="Card Title"
|
|
32
33
|
extra="More"
|
|
33
34
|
split="vertical"
|
|
34
|
-
|
|
35
|
+
variant="outlined"
|
|
35
36
|
headerBordered
|
|
36
37
|
>
|
|
37
38
|
<ProCard title="Left Details" colSpan="50%">
|
|
@@ -49,13 +50,13 @@ export default () => {
|
|
|
49
50
|
|
|
50
51
|
```tsx
|
|
51
52
|
<ProCard gutter={16} ghost>
|
|
52
|
-
<ProCard colSpan={12} layout="center"
|
|
53
|
+
<ProCard colSpan={12} layout="center" variant="outlined">
|
|
53
54
|
Col 12
|
|
54
55
|
</ProCard>
|
|
55
|
-
<ProCard colSpan={6} layout="center"
|
|
56
|
+
<ProCard colSpan={6} layout="center" variant="outlined">
|
|
56
57
|
Col 6
|
|
57
58
|
</ProCard>
|
|
58
|
-
<ProCard colSpan={6} layout="center"
|
|
59
|
+
<ProCard colSpan={6} layout="center" variant="outlined">
|
|
59
60
|
Col 6
|
|
60
61
|
</ProCard>
|
|
61
62
|
</ProCard>
|
|
@@ -14,7 +14,7 @@ Here are the guidelines files and additional guidelines for the ProComponents:
|
|
|
14
14
|
| DrawerForm | Form inside a drawer | [drawer-form.md](components/drawer-form.md) |
|
|
15
15
|
| StepsForm | Multi-step form wizard | [steps-form.md](components/steps-form.md) |
|
|
16
16
|
| ProLayout | Heavy-duty layout component | [pro-layout.md](components/pro-layout.md) |
|
|
17
|
-
| ProList | List component with table-like features | [
|
|
17
|
+
| ProList | List component with table-like features | [list.md](components/list.md) |
|
|
18
18
|
| ProSkeleton | Skeleton loading component | [pro-skeleton.md](components/pro-skeleton.md) |
|
|
19
19
|
| ProTable | Advanced table with search, filter, and valueType | [pro-table.md](components/pro-table.md) |
|
|
20
20
|
| EditableProTable | Editable table for inline editing | [editable-pro-table.md](components/editable-pro-table.md) |
|
package/lib/card/ProCard.js
CHANGED
|
@@ -8,14 +8,22 @@ exports.default = void 0;
|
|
|
8
8
|
var _Card = _interopRequireDefault(require("./components/Card"));
|
|
9
9
|
var _Divider = _interopRequireDefault(require("./components/Divider"));
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
const Group = props =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const Group = props => {
|
|
12
|
+
const {
|
|
13
|
+
styles,
|
|
14
|
+
...rest
|
|
15
|
+
} = props;
|
|
16
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.default, {
|
|
17
|
+
...rest,
|
|
18
|
+
styles: {
|
|
19
|
+
...styles,
|
|
20
|
+
body: {
|
|
21
|
+
...styles?.body,
|
|
22
|
+
padding: 0
|
|
23
|
+
}
|
|
15
24
|
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
});
|
|
25
|
+
});
|
|
26
|
+
};
|
|
19
27
|
|
|
20
28
|
// 当前不对底层 Card 做封装,仅挂载子组件,直接导出
|
|
21
29
|
const ProCard = _Card.default;
|
|
@@ -21,10 +21,7 @@ const ProCardActions = props => {
|
|
|
21
21
|
if (Array.isArray(actions) && actions?.length) {
|
|
22
22
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
23
23
|
className: (0, _clsx.clsx)(`${prefixCls}-actions`, hashId),
|
|
24
|
-
children: actions.map((action, index) =>
|
|
25
|
-
/*#__PURE__*/
|
|
26
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
27
|
-
(0, _jsxRuntime.jsx)("li", {
|
|
24
|
+
children: actions.map((action, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
28
25
|
style: {
|
|
29
26
|
width: `${100 / actions.length}%`,
|
|
30
27
|
padding: 0,
|
|
@@ -22,9 +22,8 @@ const {
|
|
|
22
22
|
const Card = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
23
23
|
const {
|
|
24
24
|
className,
|
|
25
|
+
rootClassName,
|
|
25
26
|
style,
|
|
26
|
-
bodyStyle,
|
|
27
|
-
headStyle,
|
|
28
27
|
styles,
|
|
29
28
|
title,
|
|
30
29
|
subTitle,
|
|
@@ -36,7 +35,9 @@ const Card = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
36
35
|
tooltip,
|
|
37
36
|
split,
|
|
38
37
|
headerBordered = false,
|
|
39
|
-
variant
|
|
38
|
+
variant: customVariant,
|
|
39
|
+
cover,
|
|
40
|
+
classNames,
|
|
40
41
|
boxShadow = false,
|
|
41
42
|
children,
|
|
42
43
|
size,
|
|
@@ -56,6 +57,16 @@ const Card = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
56
57
|
type,
|
|
57
58
|
...rest
|
|
58
59
|
} = props;
|
|
60
|
+
const variant = customVariant ?? 'outlined';
|
|
61
|
+
const mergedStyles = {
|
|
62
|
+
header: styles?.header,
|
|
63
|
+
body: styles?.body,
|
|
64
|
+
root: styles?.root,
|
|
65
|
+
extra: styles?.extra,
|
|
66
|
+
title: styles?.title,
|
|
67
|
+
actions: styles?.actions,
|
|
68
|
+
cover: styles?.cover
|
|
69
|
+
};
|
|
59
70
|
const {
|
|
60
71
|
getPrefixCls
|
|
61
72
|
} = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext);
|
|
@@ -201,7 +212,7 @@ const Card = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
201
212
|
}
|
|
202
213
|
return element;
|
|
203
214
|
});
|
|
204
|
-
const cardCls = (0, _clsx.clsx)(`${prefixCls}`, className, hashId, {
|
|
215
|
+
const cardCls = (0, _clsx.clsx)(`${prefixCls}`, className, rootClassName, hashId, classNames?.root, {
|
|
205
216
|
[`${prefixCls}-border`]: variant === 'outlined',
|
|
206
217
|
[`${prefixCls}-box-shadow`]: boxShadow,
|
|
207
218
|
[`${prefixCls}-contain-card`]: containProCard,
|
|
@@ -214,34 +225,53 @@ const Card = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
214
225
|
[`${prefixCls}-collapse`]: collapsed,
|
|
215
226
|
[`${prefixCls}-checked`]: checked
|
|
216
227
|
});
|
|
217
|
-
const bodyCls = (0, _clsx.clsx)(`${prefixCls}-body`, hashId, {
|
|
228
|
+
const bodyCls = (0, _clsx.clsx)(`${prefixCls}-body`, hashId, classNames?.body, {
|
|
218
229
|
[`${prefixCls}-body-center`]: layout === 'center',
|
|
219
230
|
[`${prefixCls}-body-direction-column`]: split === 'horizontal' || direction === 'column',
|
|
220
231
|
[`${prefixCls}-body-wrap`]: wrap && containProCard
|
|
221
232
|
});
|
|
222
|
-
|
|
223
|
-
// 支持新的 styles API,同时保持向后兼容
|
|
224
|
-
const cardBodyStyle = styles?.body || bodyStyle;
|
|
225
|
-
const cardHeadStyle = styles?.header || headStyle;
|
|
233
|
+
const bodyStylePadding = mergedStyles.body?.padding;
|
|
226
234
|
const loadingDOM = /*#__PURE__*/_react.default.isValidElement(loading) ? loading : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.default, {
|
|
227
235
|
prefix: prefixCls,
|
|
228
|
-
style:
|
|
236
|
+
style: bodyStylePadding === 0 || bodyStylePadding === '0px' ? {
|
|
229
237
|
padding: 24
|
|
230
238
|
} : undefined
|
|
231
239
|
});
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
240
|
+
const handleCollapsibleIconClick = (0, _react.useCallback)(() => {
|
|
241
|
+
if (collapsible === 'icon') setCollapsed(prev => !prev);
|
|
242
|
+
}, [collapsible, setCollapsed]);
|
|
243
|
+
const collapsibleButton = collapsible && (collapsibleIconRender ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
244
|
+
role: "button",
|
|
245
|
+
tabIndex: collapsible === 'icon' ? 0 : undefined,
|
|
246
|
+
className: (0, _clsx.clsx)(`${prefixCls}-collapsible-icon`, hashId),
|
|
247
|
+
onClick: collapsible === 'icon' ? handleCollapsibleIconClick : undefined,
|
|
248
|
+
onKeyDown: collapsible === 'icon' ? e => {
|
|
249
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
250
|
+
e.preventDefault();
|
|
251
|
+
handleCollapsibleIconClick();
|
|
252
|
+
}
|
|
253
|
+
} : undefined,
|
|
254
|
+
children: collapsibleIconRender({
|
|
255
|
+
collapsed
|
|
256
|
+
})
|
|
235
257
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.RightOutlined, {
|
|
236
|
-
onClick:
|
|
237
|
-
if (collapsible === 'icon') setCollapsed(!collapsed);
|
|
238
|
-
},
|
|
258
|
+
onClick: handleCollapsibleIconClick,
|
|
239
259
|
rotate: !collapsed ? 90 : undefined,
|
|
240
|
-
className: `${prefixCls}-collapsible-icon
|
|
260
|
+
className: (0, _clsx.clsx)(`${prefixCls}-collapsible-icon`, hashId)
|
|
241
261
|
}));
|
|
262
|
+
const headerCls = (0, _clsx.clsx)(`${prefixCls}-header`, hashId, classNames?.header, {
|
|
263
|
+
[`${prefixCls}-header-border`]: headerBordered || type === 'inner',
|
|
264
|
+
[`${prefixCls}-header-collapsible`]: collapsibleButton
|
|
265
|
+
});
|
|
266
|
+
const titleCls = (0, _clsx.clsx)(`${prefixCls}-title`, hashId, classNames?.title);
|
|
267
|
+
const extraCls = (0, _clsx.clsx)(`${prefixCls}-extra`, hashId, classNames?.extra);
|
|
268
|
+
const rootStyle = {
|
|
269
|
+
...mergedStyles.root,
|
|
270
|
+
...style
|
|
271
|
+
};
|
|
242
272
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
243
273
|
className: cardCls,
|
|
244
|
-
style:
|
|
274
|
+
style: rootStyle,
|
|
245
275
|
ref: ref,
|
|
246
276
|
onClick: e => {
|
|
247
277
|
onChecked?.(e);
|
|
@@ -249,38 +279,40 @@ const Card = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
249
279
|
},
|
|
250
280
|
...(0, _util.omit)(rest, ['prefixCls', 'colSpan']),
|
|
251
281
|
children: [(title || extra || collapsibleButton) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
252
|
-
className:
|
|
253
|
-
|
|
254
|
-
[`${prefixCls}-header-collapsible`]: collapsibleButton
|
|
255
|
-
}),
|
|
256
|
-
style: cardHeadStyle,
|
|
282
|
+
className: headerCls,
|
|
283
|
+
style: mergedStyles.header,
|
|
257
284
|
onClick: () => {
|
|
258
285
|
if (collapsible === 'header' || collapsible === true) setCollapsed(!collapsed);
|
|
259
286
|
},
|
|
260
287
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
261
|
-
className:
|
|
288
|
+
className: titleCls,
|
|
289
|
+
style: mergedStyles.title,
|
|
262
290
|
children: [collapsibleButton, /*#__PURE__*/(0, _jsxRuntime.jsx)(_utils.LabelIconTip, {
|
|
263
291
|
label: title,
|
|
264
292
|
tooltip: tooltip,
|
|
265
293
|
subTitle: subTitle
|
|
266
294
|
})]
|
|
267
295
|
}), extra && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
268
|
-
className:
|
|
296
|
+
className: extraCls,
|
|
297
|
+
style: mergedStyles.extra,
|
|
269
298
|
onClick: e => e.stopPropagation(),
|
|
270
299
|
children: extra
|
|
271
300
|
})]
|
|
301
|
+
}), cover && !collapsed && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
302
|
+
className: (0, _clsx.clsx)(`${prefixCls}-cover`, hashId, classNames?.cover),
|
|
303
|
+
style: mergedStyles.cover,
|
|
304
|
+
children: cover
|
|
272
305
|
}), tabs ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
273
|
-
className: `${prefixCls}-tabs
|
|
306
|
+
className: (0, _clsx.clsx)(`${prefixCls}-tabs`, hashId),
|
|
274
307
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tabs, {
|
|
275
308
|
onChange: tabs.onChange,
|
|
276
309
|
...(0, _util.omit)(tabs, ['cardProps']),
|
|
277
|
-
// @ts-ignore
|
|
278
310
|
items: ModifyTabItemsContent,
|
|
279
311
|
children: loading ? loadingDOM : children
|
|
280
312
|
})
|
|
281
313
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
282
314
|
className: bodyCls,
|
|
283
|
-
style:
|
|
315
|
+
style: mergedStyles.body,
|
|
284
316
|
children: loading ? loadingDOM : childrenModified
|
|
285
317
|
}), actions ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.default, {
|
|
286
318
|
actions: actions,
|