@ant-design/pro-components 3.1.3-0 → 3.1.4-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/components/Actions/index.js +1 -4
- package/es/card/components/Actions/style.js +1 -0
- package/es/card/components/Card/index.js +23 -15
- package/es/card/components/Card/style.js +34 -8
- package/es/card/components/CheckCard/Group.js +1 -3
- package/es/card/components/CheckCard/index.js +0 -1
- package/es/card/components/CheckCard/style.js +1 -0
- 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 -38
- package/es/card/components/Loading/style.js +1 -0
- package/es/card/components/Operation/style.js +1 -0
- package/es/card/components/Statistic/index.js +1 -1
- package/es/card/components/Statistic/style.js +1 -0
- package/es/card/components/StatisticCard/style.js +1 -0
- package/es/card/typing.d.ts +2 -6
- 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.js +0 -4
- package/es/field/PureProField.js +0 -5
- package/es/field/components/Checkbox/index.js +2 -5
- package/es/field/components/DatePicker/index.d.ts +1 -1
- package/es/field/components/DigitRange/index.js +1 -0
- package/es/field/components/Options/index.js +0 -3
- package/es/field/components/Percent/util.d.ts +1 -1
- package/es/field/components/RangePicker/index.d.ts +1 -1
- package/es/field/components/Select/SearchSelect/index.js +0 -1
- package/es/field/components/Switch/index.js +0 -1
- package/es/field/components/Text/index.js +4 -1
- package/es/form/BaseForm/BaseForm.js +0 -3
- package/es/form/BaseForm/LightWrapper/index.d.ts +2 -1
- package/es/form/BaseForm/LightWrapper/style.js +2 -0
- 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/FieldSet/index.js +16 -6
- package/es/form/components/FormItem/Group/style.js +1 -0
- package/es/form/components/FormItem/index.js +9 -7
- package/es/form/components/FormItem/warpField.js +3 -15
- package/es/form/components/List/index.d.ts +1 -1
- package/es/form/components/List/index.js +0 -2
- package/es/form/components/List/style.js +1 -0
- 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 +0 -1
- 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.js +1 -5
- package/es/form/layouts/DrawerForm/style.js +1 -0
- package/es/form/layouts/LightFilter/index.js +0 -1
- package/es/form/layouts/LightFilter/style.js +1 -0
- package/es/form/layouts/LoginForm/style.js +1 -0
- package/es/form/layouts/LoginFormPage/style.js +1 -0
- package/es/form/layouts/ModalForm/index.js +1 -4
- package/es/form/layouts/ProForm/index.d.ts +1 -1
- package/es/form/layouts/QueryFilter/index.js +0 -1
- package/es/form/layouts/QueryFilter/style.js +1 -0
- package/es/form/layouts/StepsForm/StepForm.js +0 -1
- package/es/form/layouts/StepsForm/index.js +3 -12
- package/es/form/layouts/StepsForm/style.js +1 -0
- package/es/layout/ProLayout.js +1 -6
- package/es/layout/components/AppsLogoComponents/style/index.js +4 -0
- package/es/layout/components/CollapsedIcon/style.js +1 -0
- package/es/layout/components/FooterToolbar/index.js +0 -3
- package/es/layout/components/GlobalFooter/style.js +1 -0
- package/es/layout/components/GlobalHeader/ActionsContent.js +0 -1
- package/es/layout/components/GridContent/style.js +1 -0
- package/es/layout/components/Header/index.js +1 -3
- package/es/layout/components/PageContainer/index.js +0 -1
- package/es/layout/components/PageContainer/style/index.js +4 -0
- package/es/layout/components/SettingDrawer/BlockCheckbox.js +0 -1
- package/es/layout/components/SettingDrawer/index.js +0 -1
- package/es/layout/components/SettingDrawer/style/index.js +4 -0
- package/es/layout/components/SiderMenu/BaseMenu.js +2 -6
- package/es/layout/components/SiderMenu/SiderMenu.js +1 -3
- package/es/layout/components/SiderMenu/index.js +0 -1
- package/es/layout/components/TopNavHeader/index.js +1 -2
- package/es/layout/components/TopNavHeader/style.js +1 -0
- package/es/layout/style/index.js +4 -0
- package/es/layout/utils/getMenuData.js +0 -1
- package/es/list/Item.d.ts +1 -4
- package/es/list/Item.js +75 -104
- package/es/list/ListView.d.ts +6 -4
- package/es/list/ListView.js +41 -53
- package/es/list/ProListBase.d.ts +74 -0
- package/es/list/ProListBase.js +350 -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 +215 -86
- package/es/provider/index.js +0 -3
- package/es/provider/useStyle/index.d.ts +1 -21
- package/es/provider/useStyle/index.js +7 -5
- 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 +5 -14
- package/es/table/components/Alert/style.js +1 -0
- package/es/table/components/ColumnSetting/index.js +0 -1
- package/es/table/components/ColumnSetting/style.js +1 -0
- package/es/table/components/DragSortTable/style.js +1 -0
- package/es/table/components/EditableTable/index.js +0 -1
- package/es/table/components/ListToolBar/index.d.ts +1 -1
- package/es/table/components/ListToolBar/index.js +4 -10
- package/es/table/components/ListToolBar/style.js +2 -1
- 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 +0 -3
- package/es/table/utils/cellRenderToFromItem.js +1 -3
- package/es/table/utils/index.js +0 -1
- package/es/utils/components/DropdownFooter/style.js +1 -0
- package/es/utils/components/FieldLabel/index.js +1 -1
- package/es/utils/components/FieldLabel/style.js +15 -6
- package/es/utils/components/InlineErrorFormItem/style.js +1 -0
- package/es/utils/components/LabelIconTip/index.d.ts +3 -4
- package/es/utils/components/LabelIconTip/style.js +1 -0
- 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/index.d.ts +2 -1
- package/es/utils/isDeepEqualReact/index.js +0 -8
- 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.js +1 -3
- 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/overview-components.md +1 -1
- package/lib/card/components/Actions/index.js +1 -4
- package/lib/card/components/Actions/style.js +1 -0
- package/lib/card/components/Card/index.js +23 -15
- package/lib/card/components/Card/style.js +34 -8
- package/lib/card/components/CheckCard/Group.js +1 -3
- package/lib/card/components/CheckCard/index.js +0 -1
- package/lib/card/components/CheckCard/style.js +1 -0
- 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 -38
- package/lib/card/components/Loading/style.js +1 -0
- package/lib/card/components/Operation/style.js +1 -0
- package/lib/card/components/Statistic/index.js +1 -1
- package/lib/card/components/Statistic/style.js +1 -0
- package/lib/card/components/StatisticCard/style.js +1 -0
- package/lib/card/typing.d.ts +2 -6
- 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.js +0 -4
- package/lib/field/PureProField.js +0 -5
- package/lib/field/components/Checkbox/index.js +2 -5
- package/lib/field/components/DatePicker/index.d.ts +1 -1
- package/lib/field/components/DigitRange/index.js +1 -0
- package/lib/field/components/Options/index.js +0 -3
- package/lib/field/components/Percent/util.d.ts +1 -1
- package/lib/field/components/RangePicker/index.d.ts +1 -1
- package/lib/field/components/Select/SearchSelect/index.js +0 -1
- package/lib/field/components/Switch/index.js +0 -1
- package/lib/field/components/Text/index.js +4 -1
- package/lib/form/BaseForm/BaseForm.js +0 -4
- package/lib/form/BaseForm/LightWrapper/index.d.ts +2 -1
- package/lib/form/BaseForm/LightWrapper/style.js +2 -0
- 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/FieldSet/index.js +16 -6
- package/lib/form/components/FormItem/Group/style.js +1 -0
- package/lib/form/components/FormItem/index.js +9 -7
- package/lib/form/components/FormItem/warpField.js +3 -15
- package/lib/form/components/List/index.d.ts +1 -1
- package/lib/form/components/List/index.js +0 -2
- package/lib/form/components/List/style.js +1 -0
- 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 +0 -1
- 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.js +1 -5
- package/lib/form/layouts/DrawerForm/style.js +1 -0
- package/lib/form/layouts/LightFilter/index.js +0 -1
- package/lib/form/layouts/LightFilter/style.js +1 -0
- package/lib/form/layouts/LoginForm/style.js +1 -0
- package/lib/form/layouts/LoginFormPage/style.js +1 -0
- package/lib/form/layouts/ModalForm/index.js +1 -4
- package/lib/form/layouts/ProForm/index.d.ts +1 -1
- package/lib/form/layouts/QueryFilter/index.js +0 -2
- package/lib/form/layouts/QueryFilter/style.js +1 -0
- package/lib/form/layouts/StepsForm/StepForm.js +0 -1
- package/lib/form/layouts/StepsForm/index.js +3 -12
- package/lib/form/layouts/StepsForm/style.js +1 -0
- package/lib/layout/ProLayout.js +1 -6
- package/lib/layout/components/AppsLogoComponents/style/index.js +4 -0
- package/lib/layout/components/CollapsedIcon/style.js +1 -0
- package/lib/layout/components/FooterToolbar/index.js +0 -4
- package/lib/layout/components/GlobalFooter/style.js +1 -0
- package/lib/layout/components/GlobalHeader/ActionsContent.js +0 -1
- package/lib/layout/components/GridContent/style.js +1 -0
- package/lib/layout/components/Header/index.js +1 -3
- package/lib/layout/components/PageContainer/index.js +0 -1
- package/lib/layout/components/PageContainer/style/index.js +4 -0
- package/lib/layout/components/SettingDrawer/BlockCheckbox.js +0 -1
- package/lib/layout/components/SettingDrawer/index.js +0 -1
- package/lib/layout/components/SettingDrawer/style/index.js +4 -0
- package/lib/layout/components/SiderMenu/BaseMenu.js +2 -6
- package/lib/layout/components/SiderMenu/SiderMenu.js +1 -3
- package/lib/layout/components/SiderMenu/index.js +0 -1
- package/lib/layout/components/TopNavHeader/index.js +1 -2
- package/lib/layout/components/TopNavHeader/style.js +1 -0
- package/lib/layout/style/index.js +4 -0
- package/lib/layout/utils/getMenuData.js +0 -1
- package/lib/list/Item.d.ts +1 -4
- package/lib/list/Item.js +74 -103
- package/lib/list/ListView.d.ts +6 -4
- package/lib/list/ListView.js +40 -52
- package/lib/list/ProListBase.d.ts +74 -0
- package/lib/list/ProListBase.js +357 -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 +214 -86
- package/lib/provider/index.js +0 -3
- package/lib/provider/useStyle/index.d.ts +1 -21
- package/lib/provider/useStyle/index.js +7 -5
- 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 +5 -14
- package/lib/table/components/Alert/style.js +1 -0
- package/lib/table/components/ColumnSetting/index.js +0 -1
- package/lib/table/components/ColumnSetting/style.js +1 -0
- package/lib/table/components/DragSortTable/style.js +1 -0
- package/lib/table/components/EditableTable/index.js +0 -1
- package/lib/table/components/ListToolBar/index.d.ts +1 -1
- package/lib/table/components/ListToolBar/index.js +4 -10
- package/lib/table/components/ListToolBar/style.js +2 -1
- 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 +0 -3
- package/lib/table/utils/cellRenderToFromItem.js +1 -3
- package/lib/table/utils/index.js +0 -1
- package/lib/utils/components/DropdownFooter/style.js +1 -0
- package/lib/utils/components/FieldLabel/index.js +1 -1
- package/lib/utils/components/FieldLabel/style.js +15 -6
- package/lib/utils/components/InlineErrorFormItem/style.js +1 -0
- package/lib/utils/components/LabelIconTip/index.d.ts +3 -4
- package/lib/utils/components/LabelIconTip/style.js +1 -0
- 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/index.d.ts +2 -1
- package/lib/utils/isDeepEqualReact/index.js +0 -8
- 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.js +1 -3
- 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 +4 -5
|
@@ -102,9 +102,7 @@ const DefaultHeader = props => {
|
|
|
102
102
|
});
|
|
103
103
|
if (layout === 'side' && !isMobile) return null;
|
|
104
104
|
return stylish.wrapSSR(wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
105
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.ConfigProvider
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
, {
|
|
105
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.ConfigProvider, {
|
|
108
106
|
theme: {
|
|
109
107
|
hashed: (0, _provider.isNeedOpenHash)(),
|
|
110
108
|
components: {
|
|
@@ -9,6 +9,10 @@ const [sm, md, lg, xl] = [576, 768, 992, 1200].map(bp => `@media (max-width: ${b
|
|
|
9
9
|
const genPageContainerStyle = token => {
|
|
10
10
|
return {
|
|
11
11
|
[token.componentCls]: {
|
|
12
|
+
boxSizing: 'border-box',
|
|
13
|
+
'*, *::before, *::after': {
|
|
14
|
+
boxSizing: 'border-box'
|
|
15
|
+
},
|
|
12
16
|
position: 'relative',
|
|
13
17
|
'&-children-container': {
|
|
14
18
|
paddingBlockStart: 0,
|
|
@@ -36,7 +36,6 @@ const BlockCheckbox = ({
|
|
|
36
36
|
})
|
|
37
37
|
}, item.key));
|
|
38
38
|
return domList;
|
|
39
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
39
|
}, [value, list?.length, onChange]);
|
|
41
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
42
41
|
className: (0, _clsx.clsx)(baseClassName, hashId),
|
|
@@ -8,6 +8,10 @@ var _provider = require("../../../../provider");
|
|
|
8
8
|
const genSettingDrawerStyle = token => {
|
|
9
9
|
return {
|
|
10
10
|
[`${token.componentCls}-handle`]: {
|
|
11
|
+
boxSizing: 'border-box',
|
|
12
|
+
'*, *::before, *::after': {
|
|
13
|
+
boxSizing: 'border-box'
|
|
14
|
+
},
|
|
11
15
|
position: 'fixed',
|
|
12
16
|
insetBlockStart: '240px',
|
|
13
17
|
insetInlineEnd: '0px',
|
|
@@ -163,7 +163,6 @@ class MenuUtil {
|
|
|
163
163
|
disabled: item.disabled,
|
|
164
164
|
key: item.key || item.path,
|
|
165
165
|
onClick: item.onTitleClick,
|
|
166
|
-
// eslint-disable-next-line react/no-is-mounted
|
|
167
166
|
label: this.getMenuItemPath(item, level, noGroupLevel)
|
|
168
167
|
};
|
|
169
168
|
};
|
|
@@ -381,7 +380,6 @@ const BaseMenu = props => {
|
|
|
381
380
|
setOpenKeys(matchMenuKeys);
|
|
382
381
|
setSelectedKeys(matchMenuKeys);
|
|
383
382
|
}
|
|
384
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
385
383
|
}, [matchMenuKeys.join('-')]);
|
|
386
384
|
(0, _react.useEffect)(() => {
|
|
387
385
|
// reset IconFont
|
|
@@ -413,9 +411,7 @@ const BaseMenu = props => {
|
|
|
413
411
|
},
|
|
414
412
|
// 依赖项加上 props.collapsed,保证折叠时能正确响应
|
|
415
413
|
[matchMenuKeys.join('-'), props.collapsed]);
|
|
416
|
-
const openKeysProps = (0, _react.useMemo)(() => getOpenKeysProps(openKeys, props),
|
|
417
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
418
|
-
[openKeys && openKeys.join(','), props.layout, props.collapsed]);
|
|
414
|
+
const openKeysProps = (0, _react.useMemo)(() => getOpenKeysProps(openKeys, props), [openKeys && openKeys.join(','), props.layout, props.collapsed]);
|
|
419
415
|
const {
|
|
420
416
|
wrapSSR,
|
|
421
417
|
hashId
|
|
@@ -458,7 +454,7 @@ const BaseMenu = props => {
|
|
|
458
454
|
}
|
|
459
455
|
return wrapSSR( /*#__PURE__*/(0, _react.createElement)(_antd.Menu, {
|
|
460
456
|
...openKeysProps,
|
|
461
|
-
|
|
457
|
+
tooltip: false,
|
|
462
458
|
key: "Menu",
|
|
463
459
|
mode: mode,
|
|
464
460
|
inlineIndent: 16,
|
|
@@ -175,9 +175,7 @@ const SiderMenu = props => {
|
|
|
175
175
|
}, index);
|
|
176
176
|
})
|
|
177
177
|
});
|
|
178
|
-
},
|
|
179
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
180
|
-
[actionsRender, baseClassName, collapsed]);
|
|
178
|
+
}, [actionsRender, baseClassName, collapsed]);
|
|
181
179
|
const appsDom = (0, _react.useMemo)(() => {
|
|
182
180
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppsLogoComponents.AppsLogoComponents, {
|
|
183
181
|
onItemClick: props.itemClick,
|
|
@@ -51,8 +51,7 @@ const TopNavHeader = props => {
|
|
|
51
51
|
token
|
|
52
52
|
} = (0, _react.useContext)(_provider.ProProvider);
|
|
53
53
|
const contentDom = (0, _react.useMemo)(() => {
|
|
54
|
-
const defaultDom = /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.ConfigProvider
|
|
55
|
-
, {
|
|
54
|
+
const defaultDom = /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.ConfigProvider, {
|
|
56
55
|
theme: {
|
|
57
56
|
hashed: (0, _provider.isNeedOpenHash)(),
|
|
58
57
|
components: {
|
|
@@ -11,6 +11,10 @@ const genProLayoutStyle = token => {
|
|
|
11
11
|
backgroundColor: 'transparent !important'
|
|
12
12
|
},
|
|
13
13
|
[token.componentCls]: {
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
'*, *::before, *::after': {
|
|
16
|
+
boxSizing: 'border-box'
|
|
17
|
+
},
|
|
14
18
|
[`& ${token.antCls}-layout`]: {
|
|
15
19
|
display: 'flex',
|
|
16
20
|
backgroundColor: 'transparent',
|
package/lib/list/Item.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ListGridType } from 'antd/lib/list';
|
|
2
1
|
import type { ExpandableConfig } from 'antd/lib/table/interface';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import type { CheckCardProps } from '../card';
|
|
5
4
|
import type { GetComponentProps } from './index';
|
|
5
|
+
import type { ListGridType } from './ProListBase';
|
|
6
6
|
export type RenderExpandIconProps<RecordType> = {
|
|
7
7
|
prefixCls: string;
|
|
8
8
|
expanded: boolean;
|
|
@@ -39,11 +39,8 @@ export type ItemProps<RecordType> = {
|
|
|
39
39
|
grid?: ListGridType;
|
|
40
40
|
expand?: boolean;
|
|
41
41
|
rowSupportExpand?: boolean;
|
|
42
|
-
cardActionProps?: 'actions' | 'extra';
|
|
43
42
|
onExpand?: (expand: boolean) => void;
|
|
44
43
|
expandable?: ExpandableConfig<any>;
|
|
45
|
-
showActions?: 'hover' | 'always';
|
|
46
|
-
showExtra?: 'hover' | 'always';
|
|
47
44
|
type?: 'new' | 'top' | 'inline' | 'subheader';
|
|
48
45
|
isEditable: boolean;
|
|
49
46
|
recordKey: string | number | undefined;
|
package/lib/list/Item.js
CHANGED
|
@@ -13,6 +13,7 @@ var _clsx = require("clsx");
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _card = require("../card");
|
|
15
15
|
var _provider = require("../provider");
|
|
16
|
+
var _ProListBase = require("./ProListBase");
|
|
16
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
function renderExpandIcon({
|
|
18
19
|
prefixCls,
|
|
@@ -45,26 +46,26 @@ function renderExpandIcon({
|
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
function ProListItem(props) {
|
|
48
|
-
const {
|
|
49
|
-
prefixCls: customizePrefixCls
|
|
50
|
-
} = props;
|
|
51
49
|
const {
|
|
52
50
|
getPrefixCls
|
|
53
51
|
} = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext);
|
|
54
52
|
const {
|
|
55
53
|
hashId
|
|
56
54
|
} = (0, _react.useContext)(_provider.ProProvider);
|
|
57
|
-
const prefixCls = getPrefixCls('pro-list',
|
|
55
|
+
const prefixCls = getPrefixCls('pro-list', props.prefixCls);
|
|
58
56
|
const defaultClassName = `${prefixCls}-row`;
|
|
59
57
|
const {
|
|
60
58
|
title,
|
|
61
59
|
subTitle,
|
|
62
60
|
content,
|
|
63
61
|
itemTitleRender,
|
|
64
|
-
prefixCls:
|
|
62
|
+
prefixCls: _prefixCls,
|
|
63
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
65
64
|
actions,
|
|
66
|
-
item,
|
|
67
|
-
|
|
65
|
+
item: _item,
|
|
66
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
67
|
+
recordKey: _recordKey,
|
|
68
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
68
69
|
avatar,
|
|
69
70
|
cardProps,
|
|
70
71
|
description,
|
|
@@ -77,8 +78,6 @@ function ProListItem(props) {
|
|
|
77
78
|
onExpand: propsOnExpand,
|
|
78
79
|
expandable: expandableConfig,
|
|
79
80
|
rowSupportExpand,
|
|
80
|
-
showActions,
|
|
81
|
-
showExtra,
|
|
82
81
|
type,
|
|
83
82
|
style,
|
|
84
83
|
className: propsClassName = defaultClassName,
|
|
@@ -86,7 +85,6 @@ function ProListItem(props) {
|
|
|
86
85
|
onRow,
|
|
87
86
|
onItem,
|
|
88
87
|
itemHeaderRender,
|
|
89
|
-
cardActionProps,
|
|
90
88
|
extra,
|
|
91
89
|
...rest
|
|
92
90
|
} = props;
|
|
@@ -107,37 +105,14 @@ function ProListItem(props) {
|
|
|
107
105
|
}, [propsOnExpand]);
|
|
108
106
|
const className = (0, _clsx.clsx)({
|
|
109
107
|
[`${defaultClassName}-selected`]: !cardProps && selected,
|
|
110
|
-
[`${defaultClassName}-show-action-hover`]: showActions === 'hover',
|
|
111
108
|
[`${defaultClassName}-type-${type}`]: !!type,
|
|
112
|
-
[`${defaultClassName}-editable`]: isEditable
|
|
113
|
-
[`${defaultClassName}-show-extra-hover`]: showExtra === 'hover'
|
|
109
|
+
[`${defaultClassName}-editable`]: isEditable
|
|
114
110
|
}, hashId, defaultClassName);
|
|
115
|
-
const extraClassName = (0, _clsx.clsx)(hashId, {
|
|
116
|
-
[`${propsClassName}-extra`]: showExtra === 'hover'
|
|
117
|
-
});
|
|
118
111
|
const needExpanded = expanded || Object.values(expandableConfig || {}).length === 0;
|
|
119
112
|
const expandedRowDom = expandedRowRender && expandedRowRender(record, index, indentSize, expanded);
|
|
120
|
-
const
|
|
121
|
-
if (!actions || cardActionProps === 'actions') {
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
return [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
125
|
-
onClick: e => e.stopPropagation(),
|
|
126
|
-
children: actions
|
|
127
|
-
}, "action")];
|
|
128
|
-
}, [actions, cardActionProps]);
|
|
129
|
-
const actionsDom = (0, _react.useMemo)(() => {
|
|
130
|
-
if (!actions || !cardActionProps || cardActionProps === 'extra') {
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
return [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
134
|
-
className: `${defaultClassName}-actions ${hashId}`.trim(),
|
|
135
|
-
onClick: e => e.stopPropagation(),
|
|
136
|
-
children: actions
|
|
137
|
-
}, "action")];
|
|
138
|
-
}, [actions, cardActionProps, defaultClassName, hashId]);
|
|
113
|
+
const actionsArray = (0, _react.useMemo)(() => actions ? _react.default.Children.toArray(actions) : undefined, [actions]);
|
|
139
114
|
const titleDom = title || subTitle ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
140
|
-
className: `${defaultClassName}-header-container
|
|
115
|
+
className: (0, _clsx.clsx)(`${defaultClassName}-header-container`, hashId),
|
|
141
116
|
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
142
117
|
className: (0, _clsx.clsx)(`${defaultClassName}-title`, hashId, {
|
|
143
118
|
[`${defaultClassName}-title-editable`]: isEditable
|
|
@@ -151,41 +126,77 @@ function ProListItem(props) {
|
|
|
151
126
|
})]
|
|
152
127
|
}) : null;
|
|
153
128
|
const metaTitle = (itemTitleRender && itemTitleRender?.(record, index, titleDom)) ?? titleDom;
|
|
154
|
-
const metaDom = metaTitle || avatar || subTitle || description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
129
|
+
const metaDom = metaTitle || avatar || subTitle || description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProListBase.ProListItemMeta, {
|
|
155
130
|
avatar: avatar,
|
|
156
131
|
title: metaTitle,
|
|
157
132
|
description: description && needExpanded && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
158
|
-
className: `${className}-description
|
|
133
|
+
className: (0, _clsx.clsx)(`${className}-description`, hashId),
|
|
159
134
|
children: description
|
|
160
135
|
})
|
|
161
136
|
}) : null;
|
|
137
|
+
const itemProps = onItem?.(record, index);
|
|
138
|
+
const hasExpandableConfig = Object.keys(expandableConfig || {}).length > 0;
|
|
139
|
+
const expandedRowClassStr = typeof expandedRowClassName === 'function' ? expandedRowClassName(record, index, indentSize) : expandedRowClassName;
|
|
140
|
+
const headerDom = typeof itemHeaderRender === 'function' ? itemHeaderRender(record, index, metaDom) : metaDom;
|
|
141
|
+
|
|
142
|
+
// 卡片模式渲染
|
|
143
|
+
if (cardProps) {
|
|
144
|
+
const cardTitleDom = avatar || title ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
145
|
+
children: [avatar, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
146
|
+
className: (0, _clsx.clsx)(`${prefixCls}-item-meta-title`, hashId),
|
|
147
|
+
children: title
|
|
148
|
+
})]
|
|
149
|
+
}) : null;
|
|
150
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
151
|
+
className: (0, _clsx.clsx)(hashId, `${className}-card-container`, {
|
|
152
|
+
[propsClassName]: propsClassName !== defaultClassName
|
|
153
|
+
}),
|
|
154
|
+
style: style,
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_card.CheckCard, {
|
|
156
|
+
bordered: true,
|
|
157
|
+
style: {
|
|
158
|
+
width: '100%'
|
|
159
|
+
},
|
|
160
|
+
className: (0, _clsx.clsx)(`${defaultClassName}-card`, hashId),
|
|
161
|
+
...cardProps,
|
|
162
|
+
title: cardTitleDom,
|
|
163
|
+
subTitle: subTitle,
|
|
164
|
+
extra: actionsArray,
|
|
165
|
+
bodyStyle: {
|
|
166
|
+
padding: 24,
|
|
167
|
+
...cardProps.bodyStyle
|
|
168
|
+
},
|
|
169
|
+
...itemProps,
|
|
170
|
+
onClick: e => {
|
|
171
|
+
cardProps?.onClick?.(e);
|
|
172
|
+
itemProps?.onClick?.(e);
|
|
173
|
+
},
|
|
174
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Skeleton, {
|
|
175
|
+
avatar: true,
|
|
176
|
+
title: false,
|
|
177
|
+
loading: loading,
|
|
178
|
+
active: true,
|
|
179
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
180
|
+
className: (0, _clsx.clsx)(`${className}-header`, hashId),
|
|
181
|
+
children: [typeof itemTitleRender === 'function' && itemTitleRender(record, index, titleDom), content]
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// 列表模式渲染
|
|
162
189
|
const rowClassName = (0, _clsx.clsx)(hashId, {
|
|
163
190
|
[`${defaultClassName}-item-has-checkbox`]: checkbox,
|
|
164
191
|
[`${defaultClassName}-item-has-avatar`]: avatar,
|
|
165
192
|
[className]: className
|
|
166
193
|
});
|
|
167
|
-
|
|
168
|
-
if (avatar || title) {
|
|
169
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
170
|
-
children: [avatar, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
171
|
-
className: `${getPrefixCls('list-item-meta-title')} ${hashId}`.trim(),
|
|
172
|
-
children: title
|
|
173
|
-
})]
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
return null;
|
|
177
|
-
}, [avatar, getPrefixCls, hashId, title]);
|
|
178
|
-
const itemProps = onItem?.(record, index);
|
|
179
|
-
const defaultDom = !cardProps ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.List.Item, {
|
|
194
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProListBase.ProListItem, {
|
|
180
195
|
className: (0, _clsx.clsx)(rowClassName, hashId, {
|
|
181
196
|
[propsClassName]: propsClassName !== defaultClassName
|
|
182
197
|
}),
|
|
183
198
|
...rest,
|
|
184
|
-
|
|
185
|
-
extra: !!extra && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
186
|
-
className: extraClassName,
|
|
187
|
-
children: extra
|
|
188
|
-
}),
|
|
199
|
+
extra: extra,
|
|
189
200
|
...onRow?.(record, index),
|
|
190
201
|
...itemProps,
|
|
191
202
|
onClick: e => {
|
|
@@ -201,13 +212,13 @@ function ProListItem(props) {
|
|
|
201
212
|
loading: loading,
|
|
202
213
|
active: true,
|
|
203
214
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
204
|
-
className: `${className}-header
|
|
215
|
+
className: (0, _clsx.clsx)(`${className}-header`, hashId),
|
|
205
216
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
206
|
-
className: `${className}-header-option
|
|
217
|
+
className: (0, _clsx.clsx)(`${className}-header-option`, hashId),
|
|
207
218
|
children: [!!checkbox && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
208
|
-
className: `${className}-checkbox
|
|
219
|
+
className: (0, _clsx.clsx)(`${className}-checkbox`, hashId),
|
|
209
220
|
children: checkbox
|
|
210
|
-
}),
|
|
221
|
+
}), hasExpandableConfig && rowSupportExpand && renderExpandIcon({
|
|
211
222
|
prefixCls,
|
|
212
223
|
hashId,
|
|
213
224
|
expandIcon,
|
|
@@ -215,55 +226,15 @@ function ProListItem(props) {
|
|
|
215
226
|
expanded,
|
|
216
227
|
record
|
|
217
228
|
})]
|
|
218
|
-
}),
|
|
229
|
+
}), headerDom, actionsArray]
|
|
219
230
|
}), needExpanded && (content || expandedRowDom) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
220
|
-
className: `${className}-content
|
|
231
|
+
className: (0, _clsx.clsx)(`${className}-content`, hashId),
|
|
221
232
|
children: [content, expandedRowRender && rowSupportExpand && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
222
|
-
className:
|
|
233
|
+
className: expandedRowClassStr,
|
|
223
234
|
children: expandedRowDom
|
|
224
235
|
})]
|
|
225
236
|
})]
|
|
226
237
|
})
|
|
227
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_card.CheckCard, {
|
|
228
|
-
bordered: true,
|
|
229
|
-
style: {
|
|
230
|
-
width: '100%'
|
|
231
|
-
},
|
|
232
|
-
...cardProps,
|
|
233
|
-
title: cardTitleDom,
|
|
234
|
-
subTitle: subTitle,
|
|
235
|
-
extra: extraDom,
|
|
236
|
-
actions: actionsDom,
|
|
237
|
-
bodyStyle: {
|
|
238
|
-
padding: 24,
|
|
239
|
-
...cardProps.bodyStyle
|
|
240
|
-
},
|
|
241
|
-
...itemProps,
|
|
242
|
-
onClick: e => {
|
|
243
|
-
cardProps?.onClick?.(e);
|
|
244
|
-
itemProps?.onClick?.(e);
|
|
245
|
-
},
|
|
246
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Skeleton, {
|
|
247
|
-
avatar: true,
|
|
248
|
-
title: false,
|
|
249
|
-
loading: loading,
|
|
250
|
-
active: true,
|
|
251
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
252
|
-
className: `${className}-header ${hashId}`.trim(),
|
|
253
|
-
children: [itemTitleRender && itemTitleRender?.(record, index, titleDom), content]
|
|
254
|
-
})
|
|
255
|
-
})
|
|
256
|
-
});
|
|
257
|
-
if (!cardProps) {
|
|
258
|
-
return defaultDom;
|
|
259
|
-
}
|
|
260
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
261
|
-
className: (0, _clsx.clsx)(hashId, {
|
|
262
|
-
[`${className}-card`]: cardProps,
|
|
263
|
-
[propsClassName]: propsClassName !== defaultClassName
|
|
264
|
-
}),
|
|
265
|
-
style: style,
|
|
266
|
-
children: defaultDom
|
|
267
238
|
});
|
|
268
239
|
}
|
|
269
240
|
var _default = exports.default = ProListItem;
|
package/lib/list/ListView.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TableProps } from 'antd';
|
|
2
2
|
import type { AnyObject } from 'antd/lib/_util/type';
|
|
3
3
|
import type { PaginationConfig } from 'antd/lib/pagination';
|
|
4
4
|
import type { GetRowKey, TableRowSelection } from 'antd/lib/table/interface';
|
|
@@ -7,15 +7,16 @@ import type { CheckCardProps } from '../card';
|
|
|
7
7
|
import type { ActionType } from '../table';
|
|
8
8
|
import type { GetComponentProps } from './index';
|
|
9
9
|
import type { ItemProps } from './Item';
|
|
10
|
+
import type { ListProps } from './ProListBase';
|
|
10
11
|
type AntdListProps<RecordType> = Omit<ListProps<RecordType>, 'rowKey'>;
|
|
12
|
+
/** 自定义列表项渲染,defaultDom 为 ProList 默认渲染的列表项元素 */
|
|
13
|
+
export type ProListItemRender<RecordType> = (item: RecordType, index: number, defaultDom: React.ReactElement) => React.ReactNode;
|
|
11
14
|
export type ListViewProps<RecordType> = Omit<AntdListProps<RecordType>, 'renderItem'> & Pick<TableProps<RecordType>, 'columns' | 'dataSource' | 'expandable' | 'pagination'> & {
|
|
12
15
|
rowKey?: string | keyof RecordType | GetRowKey<RecordType>;
|
|
13
|
-
showActions?: 'hover' | 'always';
|
|
14
|
-
showExtra?: 'hover' | 'always';
|
|
15
16
|
rowSelection?: TableRowSelection<RecordType>;
|
|
16
17
|
prefixCls?: string;
|
|
17
18
|
dataSource: readonly RecordType[];
|
|
18
|
-
|
|
19
|
+
itemRender?: ProListItemRender<RecordType>;
|
|
19
20
|
actionRef: React.MutableRefObject<ActionType | undefined>;
|
|
20
21
|
onRow?: GetComponentProps<RecordType>;
|
|
21
22
|
onItem?: GetComponentProps<RecordType>;
|
|
@@ -25,6 +26,7 @@ export type ListViewProps<RecordType> = Omit<AntdListProps<RecordType>, 'renderI
|
|
|
25
26
|
itemTitleRender?: ItemProps<RecordType>['itemTitleRender'];
|
|
26
27
|
itemCardProps?: CheckCardProps;
|
|
27
28
|
pagination?: PaginationConfig;
|
|
29
|
+
hashId?: string;
|
|
28
30
|
};
|
|
29
31
|
declare function ListView<RecordType extends AnyObject>(props: ListViewProps<RecordType>): import("react/jsx-runtime").JSX.Element;
|
|
30
32
|
export default ListView;
|