@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
package/lib/list/index.d.ts
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import type { ListProps } from 'antd';
|
|
2
|
-
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel';
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import type { CheckCardProps } from '../card';
|
|
5
3
|
import type { ProColumnType, ProTableProps } from '../table';
|
|
4
|
+
import type { LabelTooltipType } from '../utils';
|
|
6
5
|
import type { ItemProps } from './Item';
|
|
6
|
+
import { type ProListItemRender } from './ListView';
|
|
7
|
+
import type { ListProps } from './ProListBase';
|
|
7
8
|
export type AntdListProps<RecordType> = Omit<ListProps<RecordType>, 'rowKey'>;
|
|
8
9
|
export type ProListMeta<T> = Pick<ProColumnType<T>, 'dataIndex' | 'valueType' | 'render' | 'search' | 'title' | 'valueEnum' | 'editable' | 'fieldProps' | 'formItemProps' | 'formItemRender'> & {
|
|
9
10
|
key?: React.Key;
|
|
10
11
|
};
|
|
11
|
-
type ProListMetaAction<T> = ProListMeta<T
|
|
12
|
-
/**
|
|
13
|
-
* @example
|
|
14
|
-
* `cardActionProps = 'actions';`;
|
|
15
|
-
*
|
|
16
|
-
* @name 选择映射到 card 上的 props,默认为extra
|
|
17
|
-
*/
|
|
18
|
-
cardActionProps?: 'extra' | 'actions';
|
|
19
|
-
};
|
|
12
|
+
type ProListMetaAction<T> = ProListMeta<T>;
|
|
20
13
|
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
21
14
|
type IsAny<T> = IfAny<T, true, false>;
|
|
22
15
|
export type BaseProListMetas<T = any> = {
|
|
@@ -29,25 +22,42 @@ export type BaseProListMetas<T = any> = {
|
|
|
29
22
|
content?: ProListMeta<T>;
|
|
30
23
|
actions?: ProListMetaAction<T>;
|
|
31
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated 推荐使用 columns + listSlot 的方式,与 ProTable 共用同一套 API
|
|
27
|
+
*/
|
|
32
28
|
export type ProListMetas<T = any> = BaseProListMetas<T> & {
|
|
33
29
|
[key in keyof T]?: IsAny<T> extends true ? ProListMetaAction<T> : ProListMeta<T>;
|
|
34
30
|
};
|
|
35
31
|
export type GetComponentProps<RecordType> = (record: RecordType, index: number) => React.HTMLAttributes<HTMLElement>;
|
|
36
32
|
export type ProListProps<RecordType = any, Params = Record<string, any>, ValueType = 'text'> = Omit<ProTableProps<RecordType, Params, ValueType>, 'size' | 'footer'> & AntdListProps<RecordType> & {
|
|
37
33
|
tooltip?: LabelTooltipType | string;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated 推荐使用 columns + listSlot 的方式,与 ProTable 共用同一套 API
|
|
36
|
+
*
|
|
37
|
+
* @example 旧 API(metas)
|
|
38
|
+
* metas={{ title: { dataIndex: 'name' }, avatar: { dataIndex: 'avatar' } }}
|
|
39
|
+
*
|
|
40
|
+
* @example 新 API(columns + listSlot)
|
|
41
|
+
* columns={[
|
|
42
|
+
* { title: '名称', dataIndex: 'name', listSlot: 'title' },
|
|
43
|
+
* { dataIndex: 'avatar', listSlot: 'avatar' },
|
|
44
|
+
* ]}
|
|
45
|
+
*/
|
|
38
46
|
metas?: ProListMetas<RecordType>;
|
|
39
|
-
showActions?: 'hover' | 'always';
|
|
40
|
-
showExtra?: 'hover' | 'always';
|
|
41
47
|
onRow?: GetComponentProps<RecordType>;
|
|
42
48
|
onItem?: GetComponentProps<RecordType>;
|
|
43
49
|
itemCardProps?: CheckCardProps;
|
|
44
50
|
rowClassName?: string | ((item: RecordType, index: number) => string);
|
|
45
51
|
itemHeaderRender?: ItemProps<RecordType>['itemHeaderRender'];
|
|
46
52
|
itemTitleRender?: ItemProps<RecordType>['itemTitleRender'];
|
|
53
|
+
/** 自定义列表项渲染,defaultDom 为默认渲染的列表项元素 */
|
|
54
|
+
itemRender?: ProListItemRender<RecordType>;
|
|
47
55
|
};
|
|
48
56
|
export type Key = React.Key;
|
|
49
57
|
export type TriggerEventHandler<RecordType> = (record: RecordType) => void;
|
|
58
|
+
/** BaseProList 默认隐藏卡片、搜索和工具栏 */
|
|
50
59
|
declare function BaseProList<RecordType extends Record<string, any>, U extends Record<string, any> = Record<string, any>>(props: ProListProps<RecordType, U>): import("react/jsx-runtime").JSX.Element;
|
|
51
60
|
declare function ProList<RecordType extends Record<string, any>, U extends Record<string, any> = Record<string, any>>(props: ProListProps<RecordType, U>): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
export type { ProListItemRender } from './ListView';
|
|
52
62
|
export { BaseProList, ProList };
|
|
53
63
|
export default ProList;
|
package/lib/list/index.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.BaseProList = BaseProList;
|
|
9
9
|
exports.ProList = ProList;
|
|
10
10
|
exports.default = void 0;
|
|
11
|
+
var _util = require("@rc-component/util");
|
|
11
12
|
var _antd = require("antd");
|
|
12
13
|
var _clsx = require("clsx");
|
|
13
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -16,10 +17,55 @@ var _table = _interopRequireDefault(require("../table"));
|
|
|
16
17
|
var _ListView = _interopRequireDefault(require("./ListView"));
|
|
17
18
|
var _index = require("./style/index");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated 推荐使用 columns + listSlot 的方式,与 ProTable 共用同一套 API
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** 根据 listSlot 推导默认的 valueType */
|
|
25
|
+
const DEFAULT_VALUE_TYPE_MAP = {
|
|
26
|
+
avatar: 'avatar',
|
|
27
|
+
actions: 'option',
|
|
28
|
+
description: 'textarea'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 将 metas 对象转换为 columns 数组(向后兼容)
|
|
33
|
+
*/
|
|
34
|
+
function metasToColumns(metas) {
|
|
35
|
+
return Object.keys(metas).map(key => {
|
|
36
|
+
const meta = metas[key] || {};
|
|
37
|
+
const valueType = meta.valueType || DEFAULT_VALUE_TYPE_MAP[key];
|
|
38
|
+
return {
|
|
39
|
+
listSlot: key,
|
|
40
|
+
dataIndex: meta.dataIndex || key,
|
|
41
|
+
...meta,
|
|
42
|
+
valueType
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 为带有 listSlot 的 columns 填充默认 valueType
|
|
49
|
+
*/
|
|
50
|
+
function enrichColumnsWithDefaults(columns) {
|
|
51
|
+
return columns.map(col => {
|
|
52
|
+
const {
|
|
53
|
+
listSlot
|
|
54
|
+
} = col;
|
|
55
|
+
if (!listSlot) return col;
|
|
56
|
+
const valueType = col.valueType || DEFAULT_VALUE_TYPE_MAP[listSlot];
|
|
57
|
+
return valueType ? {
|
|
58
|
+
...col,
|
|
59
|
+
valueType
|
|
60
|
+
} : col;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function InternalProList(props) {
|
|
20
64
|
const {
|
|
21
|
-
metas
|
|
65
|
+
metas,
|
|
66
|
+
columns: propsColumns,
|
|
22
67
|
split,
|
|
68
|
+
variant,
|
|
23
69
|
footer,
|
|
24
70
|
rowKey,
|
|
25
71
|
tooltip,
|
|
@@ -27,12 +73,10 @@ function NoProVideProList(props) {
|
|
|
27
73
|
options = false,
|
|
28
74
|
search = false,
|
|
29
75
|
expandable,
|
|
30
|
-
showActions,
|
|
31
|
-
showExtra,
|
|
32
76
|
rowSelection: propRowSelection = false,
|
|
33
77
|
pagination: propsPagination = false,
|
|
34
78
|
itemLayout,
|
|
35
|
-
|
|
79
|
+
itemRender,
|
|
36
80
|
grid,
|
|
37
81
|
itemCardProps,
|
|
38
82
|
onRow,
|
|
@@ -45,44 +89,35 @@ function NoProVideProList(props) {
|
|
|
45
89
|
} = props;
|
|
46
90
|
const actionRef = (0, _react.useRef)();
|
|
47
91
|
(0, _react.useImperativeHandle)(rest.actionRef, () => actionRef.current, [actionRef.current]);
|
|
92
|
+
|
|
93
|
+
// metas 废弃提示,仅在开发环境触发一次
|
|
94
|
+
(0, _react.useEffect)(() => {
|
|
95
|
+
(0, _util.warning)(!metas, '[ProList] `metas` is deprecated. Please use `columns` with `listSlot` instead. ' + 'See: columns={[ { dataIndex: "name", listSlot: "title" } ]}');
|
|
96
|
+
}, []);
|
|
48
97
|
const {
|
|
49
98
|
getPrefixCls
|
|
50
99
|
} = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext);
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* columns 优先级高于 metas
|
|
103
|
+
* - 如果传入了 columns(且含有 listSlot),直接使用 columns
|
|
104
|
+
* - 如果只传入了 metas,将 metas 转换为 columns(向后兼容)
|
|
105
|
+
*/
|
|
51
106
|
const proTableColumns = (0, _react.useMemo)(() => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (!valueType) {
|
|
59
|
-
// 根据 key 给不同的 valueType
|
|
60
|
-
if (key === 'avatar') {
|
|
61
|
-
valueType = 'avatar';
|
|
62
|
-
}
|
|
63
|
-
if (key === 'actions') {
|
|
64
|
-
valueType = 'option';
|
|
65
|
-
}
|
|
66
|
-
if (key === 'description') {
|
|
67
|
-
valueType = 'textarea';
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
columns.push({
|
|
71
|
-
listKey: key,
|
|
72
|
-
dataIndex: meta?.dataIndex || key,
|
|
73
|
-
...meta,
|
|
74
|
-
valueType
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
return columns;
|
|
78
|
-
}, [metals]);
|
|
107
|
+
if (propsColumns && propsColumns.length > 0) {
|
|
108
|
+
return enrichColumnsWithDefaults(propsColumns);
|
|
109
|
+
}
|
|
110
|
+
if (!metas) return [];
|
|
111
|
+
return metasToColumns(metas);
|
|
112
|
+
}, [propsColumns, metas]);
|
|
79
113
|
const prefixCls = getPrefixCls('pro-list', props.prefixCls);
|
|
80
114
|
const {
|
|
81
115
|
wrapSSR,
|
|
82
116
|
hashId
|
|
83
117
|
} = (0, _index.useStyle)(prefixCls);
|
|
84
118
|
const listClassName = (0, _clsx.clsx)(prefixCls, hashId, {
|
|
85
|
-
[`${prefixCls}-no-split`]: !split
|
|
119
|
+
[`${prefixCls}-no-split`]: !split,
|
|
120
|
+
[`${prefixCls}-${variant}`]: variant
|
|
86
121
|
});
|
|
87
122
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)(_table.default, {
|
|
88
123
|
tooltip: tooltip,
|
|
@@ -93,7 +128,7 @@ function NoProVideProList(props) {
|
|
|
93
128
|
rowSelection: propRowSelection,
|
|
94
129
|
search: search,
|
|
95
130
|
options: options,
|
|
96
|
-
className: (0, _clsx.clsx)(
|
|
131
|
+
className: (0, _clsx.clsx)(className, listClassName),
|
|
97
132
|
columns: proTableColumns,
|
|
98
133
|
rowKey: rowKey,
|
|
99
134
|
tableViewRender: ({
|
|
@@ -110,17 +145,16 @@ function NoProVideProList(props) {
|
|
|
110
145
|
itemTitleRender: itemTitleRender,
|
|
111
146
|
prefixCls: props.prefixCls,
|
|
112
147
|
columns: columns,
|
|
113
|
-
|
|
148
|
+
itemRender: itemRender,
|
|
114
149
|
actionRef: actionRef,
|
|
115
150
|
dataSource: dataSource || [],
|
|
116
151
|
size: size,
|
|
117
152
|
footer: footer,
|
|
118
153
|
split: split,
|
|
154
|
+
variant: variant,
|
|
119
155
|
rowKey: rowKey,
|
|
120
156
|
expandable: expandable,
|
|
121
157
|
rowSelection: propRowSelection === false ? undefined : rowSelection,
|
|
122
|
-
showActions: showActions,
|
|
123
|
-
showExtra: showExtra,
|
|
124
158
|
pagination: pagination,
|
|
125
159
|
itemLayout: itemLayout,
|
|
126
160
|
loading: loading,
|
|
@@ -128,15 +162,18 @@ function NoProVideProList(props) {
|
|
|
128
162
|
onRow: onRow,
|
|
129
163
|
onItem: onItem,
|
|
130
164
|
rowClassName: rowClassName,
|
|
131
|
-
locale: locale
|
|
165
|
+
locale: locale,
|
|
166
|
+
hashId: hashId
|
|
132
167
|
});
|
|
133
168
|
}
|
|
134
169
|
}));
|
|
135
170
|
}
|
|
171
|
+
|
|
172
|
+
/** BaseProList 默认隐藏卡片、搜索和工具栏 */
|
|
136
173
|
function BaseProList(props) {
|
|
137
174
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_provider.ProConfigProvider, {
|
|
138
175
|
needDeps: true,
|
|
139
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
176
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalProList, {
|
|
140
177
|
cardProps: false,
|
|
141
178
|
search: false,
|
|
142
179
|
toolBarRender: false,
|
|
@@ -147,7 +184,7 @@ function BaseProList(props) {
|
|
|
147
184
|
function ProList(props) {
|
|
148
185
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_provider.ProConfigProvider, {
|
|
149
186
|
needDeps: true,
|
|
150
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
187
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalProList, {
|
|
151
188
|
...props
|
|
152
189
|
})
|
|
153
190
|
});
|
|
@@ -3,7 +3,6 @@ import type { ProAliasToken } from '../../provider';
|
|
|
3
3
|
export interface ProListToken extends ProAliasToken {
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const techUiListActive: any;
|
|
7
6
|
export declare function useStyle(prefixCls: string): {
|
|
8
7
|
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
9
8
|
hashId: string;
|