@ant-design/pro-components 3.0.1-0 → 3.1.0-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 +4 -2
- package/es/card/components/Actions/style.d.ts +1 -1
- package/es/card/components/Card/index.js +8 -4
- package/es/card/components/Card/style.d.ts +1 -1
- package/es/card/components/CheckCard/index.d.ts +6 -0
- package/es/card/components/CheckCard/index.js +2 -1
- package/es/card/components/CheckCard/style.d.ts +1 -1
- package/es/card/components/Divider/style.d.ts +1 -1
- package/es/card/components/Loading/style.d.ts +1 -1
- package/es/card/components/Operation/style.d.ts +1 -1
- package/es/card/components/Statistic/style.d.ts +1 -1
- package/es/card/components/Statistic/style.js +2 -6
- package/es/card/components/StatisticCard/index.js +4 -2
- package/es/card/components/StatisticCard/style.d.ts +1 -1
- package/es/card/typing.d.ts +5 -0
- package/es/descriptions/index.js +2 -1
- package/es/field/ValueTypeToComponent.js +4 -4
- package/es/field/components/Cascader/index.d.ts +0 -1
- package/es/field/components/Checkbox/index.d.ts +0 -1
- package/es/field/components/ColorPicker/index.d.ts +1 -1
- package/es/field/components/Percent/util.d.ts +1 -1
- package/es/field/components/Radio/index.d.ts +0 -1
- package/es/field/components/Segmented/index.d.ts +0 -1
- package/es/field/components/Select/LightSelect/index.js +1 -2
- package/es/field/components/Select/SearchSelect/index.d.ts +6 -1
- package/es/field/components/Select/SearchSelect/index.js +101 -15
- package/es/field/components/Select/index.d.ts +0 -3
- package/es/field/components/Select/index.js +5 -3
- package/es/field/components/TreeSelect/index.d.ts +0 -1
- package/es/form/BaseForm/BaseForm.d.ts +3 -0
- package/es/form/BaseForm/BaseForm.js +9 -2
- package/es/form/BaseForm/LightWrapper/style.d.ts +1 -1
- package/es/form/components/Captcha/index.d.ts +8 -2
- package/es/form/components/Captcha/index.js +9 -1
- package/es/form/components/DatePicker/BaseDatePicker.js +20 -12
- package/es/form/components/DateRangePicker/BaseDateRanger.js +38 -13
- package/es/form/components/FormItem/Group/index.js +1 -1
- package/es/form/components/FormItem/Group/style.d.ts +1 -1
- package/es/form/components/List/index.d.ts +1 -1
- package/es/form/components/List/style.d.ts +1 -1
- package/es/form/components/SchemaForm/index.js +1 -2
- package/es/form/components/Text/index.js +4 -2
- package/es/form/components/UploadButton/index.d.ts +1 -1
- package/es/form/components/UploadButton/index.js +3 -3
- package/es/form/index.d.ts +1 -0
- package/es/form/layouts/DrawerForm/index.d.ts +1 -1
- package/es/form/layouts/DrawerForm/index.js +3 -2
- package/es/form/layouts/DrawerForm/style.d.ts +1 -1
- package/es/form/layouts/LightFilter/style.d.ts +1 -1
- package/es/form/layouts/LoginForm/index.d.ts +1 -1
- package/es/form/layouts/LoginForm/style.d.ts +1 -1
- package/es/form/layouts/LoginFormPage/index.d.ts +1 -1
- package/es/form/layouts/LoginFormPage/style.d.ts +1 -1
- package/es/form/layouts/ModalForm/index.js +2 -1
- package/es/form/layouts/ProForm/index.d.ts +1 -1
- package/es/form/layouts/QueryFilter/index.d.ts +2 -1
- package/es/form/layouts/QueryFilter/style.d.ts +1 -1
- package/es/form/layouts/StepsForm/index.js +15 -2
- package/es/form/layouts/StepsForm/style.d.ts +1 -1
- package/es/layout/components/AppsLogoComponents/index.js +3 -1
- package/es/layout/components/AppsLogoComponents/style/index.d.ts +1 -1
- package/es/layout/components/CollapsedIcon/style.d.ts +1 -1
- package/es/layout/components/FooterToolbar/style/index.d.ts +1 -1
- package/es/layout/components/FooterToolbar/style/stylish.d.ts +1 -1
- package/es/layout/components/GlobalFooter/index.d.ts +1 -1
- package/es/layout/components/GlobalFooter/style.d.ts +1 -1
- package/es/layout/components/GlobalHeader/rightContentStyle.d.ts +1 -1
- package/es/layout/components/GlobalHeader/style.d.ts +1 -1
- package/es/layout/components/GridContent/style.d.ts +1 -1
- package/es/layout/components/Header/style/header.d.ts +1 -1
- package/es/layout/components/Header/style/stylish.d.ts +1 -1
- package/es/layout/components/Help/ProHelpDrawer.d.ts +1 -1
- package/es/layout/components/Help/ProHelpDrawer.js +3 -1
- package/es/layout/components/Help/ProHelpPopover.js +1 -1
- package/es/layout/components/Help/style.d.ts +1 -1
- package/es/layout/components/PageContainer/style/index.d.ts +1 -1
- package/es/layout/components/PageContainer/style/stylish.d.ts +1 -1
- package/es/layout/components/PageHeader/style/index.d.ts +1 -1
- package/es/layout/components/SettingDrawer/index.js +2 -2
- package/es/layout/components/SettingDrawer/style/index.d.ts +1 -1
- package/es/layout/components/SiderMenu/BaseMenu.d.ts +1 -1
- package/es/layout/components/SiderMenu/BaseMenu.js +3 -3
- package/es/layout/components/SiderMenu/SiderMenu.js +8 -8
- package/es/layout/components/SiderMenu/index.js +11 -6
- package/es/layout/components/SiderMenu/style/index.d.ts +1 -1
- package/es/layout/components/SiderMenu/style/menu.d.ts +1 -1
- package/es/layout/components/SiderMenu/style/stylish.d.ts +1 -1
- package/es/layout/components/TopNavHeader/style.d.ts +1 -1
- package/es/layout/defaultSettings.d.ts +6 -0
- package/es/layout/style/index.d.ts +1 -1
- package/es/list/style/index.d.ts +1 -1
- package/es/provider/index.d.ts +1 -0
- package/es/provider/index.js +11 -6
- package/es/provider/useStyle/index.d.ts +2 -1
- package/es/provider/useStyle/index.js +20 -12
- package/es/table/Table.js +412 -280
- package/es/table/components/Alert/index.d.ts +1 -1
- package/es/table/components/Alert/style.d.ts +1 -1
- package/es/table/components/ColumnSetting/index.d.ts +1 -1
- package/es/table/components/ColumnSetting/index.js +15 -3
- package/es/table/components/ColumnSetting/style.d.ts +1 -1
- package/es/table/components/DragSortTable/index.d.ts +1 -1
- package/es/table/components/DragSortTable/style.d.ts +1 -1
- package/es/table/components/EditableTable/index.js +530 -197
- package/es/table/components/ListToolBar/style.d.ts +1 -1
- package/es/table/style/index.d.ts +1 -1
- package/es/table/typing.d.ts +37 -12
- package/es/table/useFetchData.js +8 -13
- package/es/table/utils/columnRender.d.ts +1 -1
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +5 -17
- package/es/table/utils/index.d.ts +60 -5
- package/es/table/utils/index.js +157 -18
- package/es/utils/components/DropdownFooter/style.d.ts +1 -1
- package/es/utils/components/FieldLabel/style.d.ts +1 -1
- package/es/utils/components/FilterDropdown/index.js +1 -1
- package/es/utils/components/FilterDropdown/style.d.ts +1 -1
- package/es/utils/components/InlineErrorFormItem/style.d.ts +1 -1
- package/es/utils/components/LabelIconTip/style.d.ts +1 -1
- package/es/utils/conversionMomentValue/index.js +14 -2
- package/es/utils/proFieldParsingText/index.js +1 -1
- package/es/utils/typing.d.ts +1 -1
- package/es/utils/useEditableArray/index.d.ts +3 -6
- package/es/utils/useEditableArray/index.js +562 -318
- package/es/utils/useEditableMap/index.js +82 -25
- package/es/utils/useMediaQuery/query.js +11 -5
- package/lib/card/ProCard.js +4 -2
- package/lib/card/components/Actions/style.d.ts +1 -1
- package/lib/card/components/Card/index.js +8 -4
- package/lib/card/components/Card/style.d.ts +1 -1
- package/lib/card/components/CheckCard/index.d.ts +6 -0
- package/lib/card/components/CheckCard/index.js +2 -1
- package/lib/card/components/CheckCard/style.d.ts +1 -1
- package/lib/card/components/Divider/style.d.ts +1 -1
- package/lib/card/components/Loading/style.d.ts +1 -1
- package/lib/card/components/Operation/style.d.ts +1 -1
- package/lib/card/components/Statistic/style.d.ts +1 -1
- package/lib/card/components/Statistic/style.js +2 -6
- package/lib/card/components/StatisticCard/index.js +4 -2
- package/lib/card/components/StatisticCard/style.d.ts +1 -1
- package/lib/card/typing.d.ts +5 -0
- package/lib/descriptions/index.js +2 -1
- package/lib/field/ValueTypeToComponent.js +4 -4
- package/lib/field/components/Cascader/index.d.ts +0 -1
- package/lib/field/components/Checkbox/index.d.ts +0 -1
- package/lib/field/components/ColorPicker/index.d.ts +1 -1
- package/lib/field/components/Percent/util.d.ts +1 -1
- package/lib/field/components/Radio/index.d.ts +0 -1
- package/lib/field/components/Segmented/index.d.ts +0 -1
- package/lib/field/components/Select/LightSelect/index.js +1 -2
- package/lib/field/components/Select/SearchSelect/index.d.ts +6 -1
- package/lib/field/components/Select/SearchSelect/index.js +101 -15
- package/lib/field/components/Select/index.d.ts +0 -3
- package/lib/field/components/Select/index.js +5 -3
- package/lib/field/components/TreeSelect/index.d.ts +0 -1
- package/lib/form/BaseForm/BaseForm.d.ts +3 -0
- package/lib/form/BaseForm/BaseForm.js +9 -2
- package/lib/form/BaseForm/LightWrapper/style.d.ts +1 -1
- package/lib/form/components/Captcha/index.d.ts +8 -2
- package/lib/form/components/Captcha/index.js +9 -1
- package/lib/form/components/DatePicker/BaseDatePicker.js +19 -11
- package/lib/form/components/DateRangePicker/BaseDateRanger.js +37 -12
- package/lib/form/components/Digit/DigitRange.d.ts +1 -1
- package/lib/form/components/FormItem/Group/index.js +1 -1
- package/lib/form/components/FormItem/Group/style.d.ts +1 -1
- package/lib/form/components/List/index.d.ts +1 -1
- package/lib/form/components/List/style.d.ts +1 -1
- package/lib/form/components/SchemaForm/index.js +1 -2
- package/lib/form/components/Text/index.js +4 -2
- package/lib/form/components/UploadButton/index.d.ts +1 -1
- package/lib/form/components/UploadButton/index.js +3 -3
- package/lib/form/index.d.ts +1 -0
- package/lib/form/layouts/DrawerForm/index.d.ts +1 -1
- package/lib/form/layouts/DrawerForm/index.js +3 -2
- package/lib/form/layouts/DrawerForm/style.d.ts +1 -1
- package/lib/form/layouts/LightFilter/style.d.ts +1 -1
- package/lib/form/layouts/LoginForm/index.d.ts +1 -1
- package/lib/form/layouts/LoginForm/style.d.ts +1 -1
- package/lib/form/layouts/LoginFormPage/index.d.ts +1 -1
- package/lib/form/layouts/LoginFormPage/style.d.ts +1 -1
- package/lib/form/layouts/ModalForm/index.js +2 -1
- package/lib/form/layouts/ProForm/index.d.ts +2 -2
- package/lib/form/layouts/QueryFilter/index.d.ts +2 -1
- package/lib/form/layouts/QueryFilter/style.d.ts +1 -1
- package/lib/form/layouts/StepsForm/index.js +15 -2
- package/lib/form/layouts/StepsForm/style.d.ts +1 -1
- package/lib/layout/components/AppsLogoComponents/index.js +3 -1
- package/lib/layout/components/AppsLogoComponents/style/index.d.ts +1 -1
- package/lib/layout/components/CollapsedIcon/style.d.ts +1 -1
- package/lib/layout/components/FooterToolbar/style/index.d.ts +1 -1
- package/lib/layout/components/FooterToolbar/style/stylish.d.ts +1 -1
- package/lib/layout/components/GlobalFooter/index.d.ts +1 -1
- package/lib/layout/components/GlobalFooter/style.d.ts +1 -1
- package/lib/layout/components/GlobalHeader/rightContentStyle.d.ts +1 -1
- package/lib/layout/components/GlobalHeader/style.d.ts +1 -1
- package/lib/layout/components/GridContent/style.d.ts +1 -1
- package/lib/layout/components/Header/style/header.d.ts +1 -1
- package/lib/layout/components/Header/style/stylish.d.ts +1 -1
- package/lib/layout/components/Help/ProHelpDrawer.d.ts +1 -1
- package/lib/layout/components/Help/ProHelpDrawer.js +3 -1
- package/lib/layout/components/Help/ProHelpPopover.js +1 -1
- package/lib/layout/components/Help/style.d.ts +1 -1
- package/lib/layout/components/PageContainer/style/index.d.ts +1 -1
- package/lib/layout/components/PageContainer/style/stylish.d.ts +1 -1
- package/lib/layout/components/PageHeader/style/index.d.ts +1 -1
- package/lib/layout/components/SettingDrawer/index.js +2 -2
- package/lib/layout/components/SettingDrawer/style/index.d.ts +1 -1
- package/lib/layout/components/SiderMenu/BaseMenu.d.ts +1 -1
- package/lib/layout/components/SiderMenu/BaseMenu.js +3 -3
- package/lib/layout/components/SiderMenu/SiderMenu.js +8 -8
- package/lib/layout/components/SiderMenu/index.js +11 -6
- package/lib/layout/components/SiderMenu/style/index.d.ts +1 -1
- package/lib/layout/components/SiderMenu/style/menu.d.ts +1 -1
- package/lib/layout/components/SiderMenu/style/stylish.d.ts +1 -1
- package/lib/layout/components/TopNavHeader/style.d.ts +1 -1
- package/lib/layout/defaultSettings.d.ts +6 -0
- package/lib/layout/style/index.d.ts +1 -1
- package/lib/list/style/index.d.ts +1 -1
- package/lib/provider/index.d.ts +1 -0
- package/lib/provider/index.js +11 -6
- package/lib/provider/useStyle/index.d.ts +2 -1
- package/lib/provider/useStyle/index.js +20 -12
- package/lib/table/Table.js +422 -290
- package/lib/table/components/Alert/index.d.ts +1 -1
- package/lib/table/components/Alert/style.d.ts +1 -1
- package/lib/table/components/ColumnSetting/index.d.ts +1 -1
- package/lib/table/components/ColumnSetting/index.js +15 -3
- package/lib/table/components/ColumnSetting/style.d.ts +1 -1
- package/lib/table/components/DragSortTable/index.d.ts +1 -1
- package/lib/table/components/DragSortTable/style.d.ts +1 -1
- package/lib/table/components/EditableTable/index.js +529 -196
- package/lib/table/components/ListToolBar/style.d.ts +1 -1
- package/lib/table/style/index.d.ts +1 -1
- package/lib/table/typing.d.ts +37 -12
- package/lib/table/useFetchData.js +8 -13
- package/lib/table/utils/columnRender.d.ts +1 -1
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +4 -16
- package/lib/table/utils/index.d.ts +60 -5
- package/lib/table/utils/index.js +159 -20
- package/lib/utils/components/DropdownFooter/style.d.ts +1 -1
- package/lib/utils/components/FieldLabel/style.d.ts +1 -1
- package/lib/utils/components/FilterDropdown/index.js +1 -1
- package/lib/utils/components/FilterDropdown/style.d.ts +1 -1
- package/lib/utils/components/InlineErrorFormItem/style.d.ts +1 -1
- package/lib/utils/components/LabelIconTip/style.d.ts +1 -1
- package/lib/utils/conversionMomentValue/index.js +14 -2
- package/lib/utils/proFieldParsingText/index.js +1 -1
- package/lib/utils/typing.d.ts +1 -1
- package/lib/utils/useEditableArray/index.d.ts +3 -6
- package/lib/utils/useEditableArray/index.js +568 -324
- package/lib/utils/useEditableMap/index.js +82 -25
- package/lib/utils/useMediaQuery/query.js +10 -4
- package/package.json +45 -45
|
@@ -4,6 +4,6 @@ export interface ProListToken extends ProAliasToken {
|
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useStyle(prefixCls: string): {
|
|
7
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
7
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
hashId: string;
|
|
9
9
|
};
|
|
@@ -5,6 +5,6 @@ export interface ProListToken extends ProAliasToken {
|
|
|
5
5
|
}
|
|
6
6
|
export declare const turn: any;
|
|
7
7
|
export declare function useStyle(prefixCls: string): {
|
|
8
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
8
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
9
9
|
hashId: string;
|
|
10
10
|
};
|
package/es/table/typing.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import type { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
|
3
3
|
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel';
|
|
4
4
|
import type { NamePath } from 'antd/lib/form/interface';
|
|
5
5
|
import type { SearchProps } from 'antd/lib/input';
|
|
6
|
-
import type { ColumnFilterItem, ColumnType, CompareFn, SortOrder } from 'antd/lib/table/interface';
|
|
6
|
+
import type { ColumnFilterItem, ColumnType, CompareFn, SorterResult, SortOrder } from 'antd/lib/table/interface';
|
|
7
7
|
import type dayjs from 'dayjs';
|
|
8
8
|
import type React from 'react';
|
|
9
|
-
import type { CSSProperties } from 'react';
|
|
9
|
+
import type { CSSProperties, Key } from 'react';
|
|
10
10
|
import type { ProCardProps } from '../card';
|
|
11
11
|
import type { ProFieldEmptyText } from '../field';
|
|
12
12
|
import type { LightWrapperProps, ProFormProps, QueryFilterProps } from '../form';
|
|
@@ -49,13 +49,24 @@ export type ColumnRenderInterface<T> = {
|
|
|
49
49
|
counter: ReturnType<ContainerType>;
|
|
50
50
|
};
|
|
51
51
|
export type TableRowSelection = TableProps<any>['rowSelection'];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Request filter 參數
|
|
54
|
+
* @description 与 antd 不同,Pro 有自己定义的 request FilterValue 类型,主要做了值内容的转换
|
|
55
|
+
*/
|
|
56
|
+
export type FilterValue = (string | number)[] | null;
|
|
57
|
+
export type ProSorter<T> = string | boolean | CompareFn<T> | {
|
|
58
|
+
compare?: CompareFn<T>;
|
|
59
|
+
/** Config multiple sorter order priority */
|
|
60
|
+
multiple?: number;
|
|
61
|
+
};
|
|
62
|
+
export type ProSorterResult<T> = Omit<SorterResult<T>, 'column'> & {
|
|
63
|
+
column?: ColumnType<T> & {
|
|
64
|
+
sorter?: ProSorter<T>;
|
|
57
65
|
};
|
|
58
66
|
};
|
|
67
|
+
export type ExtraProColumnType<T> = Omit<ColumnType<T>, 'render' | 'children' | 'title' | 'filters' | 'onFilter' | 'sorter'> & {
|
|
68
|
+
sorter?: ProSorter<T>;
|
|
69
|
+
};
|
|
59
70
|
export type ProColumnType<T = unknown, ValueType = 'text'> = ProSchema<T, ExtraProColumnType<T> & {
|
|
60
71
|
children?: ProColumns<T>[];
|
|
61
72
|
index?: number;
|
|
@@ -159,12 +170,12 @@ export type ProTableProps<DataSource, U, ValueType = 'text'> = {
|
|
|
159
170
|
/**
|
|
160
171
|
* @name 渲染 table
|
|
161
172
|
*/
|
|
162
|
-
tableRender?: (props: ProTableProps<DataSource, U, ValueType>, defaultDom:
|
|
173
|
+
tableRender?: (props: ProTableProps<DataSource, U, ValueType>, defaultDom: React.ReactNode,
|
|
163
174
|
/** 各个区域的 dom */
|
|
164
175
|
domList: {
|
|
165
|
-
toolbar:
|
|
166
|
-
alert:
|
|
167
|
-
table:
|
|
176
|
+
toolbar: React.ReactNode;
|
|
177
|
+
alert: React.ReactNode;
|
|
178
|
+
table: React.ReactNode;
|
|
168
179
|
}) => React.ReactNode;
|
|
169
180
|
/**
|
|
170
181
|
* @name 渲染 table 视图,用于定制 ProList,不推荐直接使用
|
|
@@ -187,7 +198,7 @@ export type ProTableProps<DataSource, U, ValueType = 'text'> = {
|
|
|
187
198
|
pageSize?: number;
|
|
188
199
|
current?: number;
|
|
189
200
|
keyword?: string;
|
|
190
|
-
}, sort: Record<string, SortOrder>, filter: Record<string,
|
|
201
|
+
}, sort: Record<string, SortOrder>, filter: Record<string, FilterValue>) => Promise<Partial<RequestData<DataSource>>>;
|
|
191
202
|
/** @name 对数据进行一些处理 */
|
|
192
203
|
postData?: any;
|
|
193
204
|
/** @name 默认的数据 */
|
|
@@ -322,8 +333,22 @@ export type ProTableProps<DataSource, U, ValueType = 'text'> = {
|
|
|
322
333
|
ErrorBoundary?: React.ComponentClass<any, any> | false;
|
|
323
334
|
} & Omit<TableProps<DataSource>, 'columns' | 'rowSelection'>;
|
|
324
335
|
export type ActionType = ProCoreActionType & {
|
|
336
|
+
/** 原生 DOM 元素引用 */
|
|
337
|
+
nativeElement?: HTMLDivElement;
|
|
338
|
+
/** 聚焦方法 */
|
|
339
|
+
focus?: () => void;
|
|
325
340
|
fullScreen?: () => void;
|
|
326
341
|
setPageInfo?: (page: Partial<PageInfo>) => void;
|
|
342
|
+
/**
|
|
343
|
+
* 对齐 antd Table ScrollConfig
|
|
344
|
+
* - number: 作为 top 处理
|
|
345
|
+
* - { index?, key?, top? }
|
|
346
|
+
*/
|
|
347
|
+
scrollTo?: (arg: number | {
|
|
348
|
+
index?: number;
|
|
349
|
+
key?: Key;
|
|
350
|
+
top?: number;
|
|
351
|
+
}) => void;
|
|
327
352
|
};
|
|
328
353
|
/**
|
|
329
354
|
* 用于定义 useFetch 的参数类型
|
package/es/table/useFetchData.js
CHANGED
|
@@ -7,7 +7,6 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
8
|
var _excluded = ["data", "success", "total"];
|
|
9
9
|
import { useEffect, useRef } from 'react';
|
|
10
|
-
import { unstable_batchedUpdates } from 'react-dom';
|
|
11
10
|
import { runFunction, useDebounceFn, useDeepCompareEffect, useMountMergeState, usePrevious, useRefFunction } from "../utils";
|
|
12
11
|
import { postDataPipeline } from "./utils/index";
|
|
13
12
|
|
|
@@ -137,14 +136,12 @@ var useFetchData = function useFetchData(getData, defaultData, options) {
|
|
|
137
136
|
|
|
138
137
|
// Batching update https://github.com/facebook/react/issues/14259
|
|
139
138
|
var setDataAndLoading = function setDataAndLoading(newData, dataTotal) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
});
|
|
139
|
+
setTableDataList(newData);
|
|
140
|
+
if ((pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.total) !== dataTotal) {
|
|
141
|
+
_setPageInfo(_objectSpread(_objectSpread({}, pageInfo), {}, {
|
|
142
|
+
total: dataTotal || newData.length
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
148
145
|
};
|
|
149
146
|
|
|
150
147
|
/**
|
|
@@ -170,10 +167,8 @@ var useFetchData = function useFetchData(getData, defaultData, options) {
|
|
|
170
167
|
* https://github.com/ant-design/pro-components/issues/4390
|
|
171
168
|
*/
|
|
172
169
|
var requestFinally = useRefFunction(function () {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
setPollingLoading(false);
|
|
176
|
-
});
|
|
170
|
+
setTableLoading(false);
|
|
171
|
+
setPollingLoading(false);
|
|
177
172
|
});
|
|
178
173
|
/** 请求数据 */
|
|
179
174
|
var fetchList = /*#__PURE__*/function () {
|
|
@@ -22,7 +22,7 @@ type ColumnRenderInterface<T> = {
|
|
|
22
22
|
*
|
|
23
23
|
* @param item
|
|
24
24
|
*/
|
|
25
|
-
export declare const renderColumnsTitle: (item: ProColumns<any>) => string | number | boolean | import("react/jsx-runtime").JSX.Element |
|
|
25
|
+
export declare const renderColumnsTitle: (item: ProColumns<any>) => string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
26
26
|
/**
|
|
27
27
|
* 默认的 filter 方法
|
|
28
28
|
*
|
|
@@ -4,7 +4,7 @@ import { SortOrder } from 'antd/lib/table/interface';
|
|
|
4
4
|
import type { ProFieldEmptyText } from '../../field';
|
|
5
5
|
import type { ProSchemaComponentTypes, UseEditableUtilType } from '../../utils';
|
|
6
6
|
import type { ContainerType } from '../Store/Provide';
|
|
7
|
-
import type { ProColumns } from '../typing';
|
|
7
|
+
import type { FilterValue, ProColumns } from '../typing';
|
|
8
8
|
type ColumnToColumnReturnType<T> = (TableColumnType<T> & {
|
|
9
9
|
index?: number;
|
|
10
10
|
})[];
|
|
@@ -14,7 +14,7 @@ type ColumnToColumnParams<T> = {
|
|
|
14
14
|
columnEmptyText: ProFieldEmptyText;
|
|
15
15
|
type: ProSchemaComponentTypes;
|
|
16
16
|
editableUtils: UseEditableUtilType;
|
|
17
|
-
proFilter: Record<string,
|
|
17
|
+
proFilter: Record<string, FilterValue>;
|
|
18
18
|
proSort: Record<string, SortOrder>;
|
|
19
19
|
} & Pick<TableProps<T>, 'rowKey' | 'childrenColumnName'>;
|
|
20
20
|
/**
|
|
@@ -4,7 +4,7 @@ import { Table } from 'antd';
|
|
|
4
4
|
import { proFieldParsingValueEnumToArray } from "../../field";
|
|
5
5
|
import { omitBoolean, omitUndefinedAndEmptyArr, runFunction } from "../../utils";
|
|
6
6
|
import { columnRender, defaultOnFilter, renderColumnsTitle } from "./columnRender";
|
|
7
|
-
import { genColumnKey } from "./index";
|
|
7
|
+
import { genColumnKey, parseProFilteredValue, parseProSortOrder } from "./index";
|
|
8
8
|
/**
|
|
9
9
|
* 转化 columns 到 pro 的格式 主要是 render 方法的自行实现
|
|
10
10
|
*
|
|
@@ -24,8 +24,7 @@ export function genProColumnToColumn(params, parents) {
|
|
|
24
24
|
rowKey = _params$rowKey === void 0 ? 'id' : _params$rowKey,
|
|
25
25
|
_params$childrenColum = params.childrenColumnName,
|
|
26
26
|
childrenColumnName = _params$childrenColum === void 0 ? 'children' : _params$childrenColum,
|
|
27
|
-
|
|
28
|
-
proFilter = _params$proFilter === void 0 ? {} : _params$proFilter,
|
|
27
|
+
proFilter = params.proFilter,
|
|
29
28
|
proSort = params.proSort;
|
|
30
29
|
var subNameRecord = new Map();
|
|
31
30
|
return columns === null || columns === void 0 || (_columns$map = columns.map(function (columnProps, columnsIndex) {
|
|
@@ -40,9 +39,7 @@ export function genProColumnToColumn(params, parents) {
|
|
|
40
39
|
children = _ref.children,
|
|
41
40
|
onFilter = _ref.onFilter,
|
|
42
41
|
_ref$filters = _ref.filters,
|
|
43
|
-
filters = _ref$filters === void 0 ? [] : _ref$filters
|
|
44
|
-
sorter = _ref.sorter,
|
|
45
|
-
columnFilteredValue = _ref.filteredValue;
|
|
42
|
+
filters = _ref$filters === void 0 ? [] : _ref$filters;
|
|
46
43
|
var columnKey = genColumnKey(key || (dataIndex === null || dataIndex === void 0 ? void 0 : dataIndex.toString()), [parents === null || parents === void 0 ? void 0 : parents.key, columnsIndex].filter(Boolean).join('-'));
|
|
47
44
|
// 这些都没有,说明是普通的表格不需要 pro 管理
|
|
48
45
|
var noNeedPro = !valueEnum && !valueType && !children;
|
|
@@ -62,11 +59,6 @@ export function genProColumnToColumn(params, parents) {
|
|
|
62
59
|
}
|
|
63
60
|
return omitBoolean(onFilter);
|
|
64
61
|
};
|
|
65
|
-
|
|
66
|
-
// 对应筛选值,用作双向绑定
|
|
67
|
-
var filteredValue = columnKey && (proFilter === null || proFilter === void 0 ? void 0 : proFilter[columnKey]) !== undefined ? proFilter === null || proFilter === void 0 ? void 0 : proFilter[columnKey] : null;
|
|
68
|
-
// 对应排序值,用作双向绑定
|
|
69
|
-
var sortOrder = columnKey && proSort[columnKey] !== undefined ? proSort[columnKey] : null;
|
|
70
62
|
var keyName = rowKey;
|
|
71
63
|
var tempColumns = _objectSpread(_objectSpread({
|
|
72
64
|
index: columnsIndex,
|
|
@@ -78,12 +70,8 @@ export function genProColumnToColumn(params, parents) {
|
|
|
78
70
|
return valueItem && valueItem.value !== 'all';
|
|
79
71
|
}) : filters,
|
|
80
72
|
onFilter: genOnFilter(),
|
|
81
|
-
filteredValue:
|
|
82
|
-
|
|
83
|
-
columnFilteredValue !== undefined ? columnFilteredValue :
|
|
84
|
-
// 否则,只有在服务端筛选时才使用计算的 filteredValue
|
|
85
|
-
filters && genOnFilter() == null && filteredValue !== null ? filteredValue : undefined,
|
|
86
|
-
sortOrder: sorter === true ? sortOrder : undefined,
|
|
73
|
+
filteredValue: parseProFilteredValue(proFilter, columnProps),
|
|
74
|
+
sortOrder: parseProSortOrder(proSort, columnProps),
|
|
87
75
|
fixed: config.fixed,
|
|
88
76
|
width: columnProps.width || (columnProps.fixed ? 200 : undefined),
|
|
89
77
|
children: columnProps.children ? genProColumnToColumn(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { TablePaginationConfig } from 'antd';
|
|
2
|
-
import type { SortOrder } from 'antd/lib/table/interface';
|
|
2
|
+
import type { FilterValue as AntFilterValue, SorterResult, SortOrder } from 'antd/lib/table/interface';
|
|
3
3
|
import type React from 'react';
|
|
4
4
|
import { Key } from 'react';
|
|
5
5
|
import type { IntlType } from '../../provider';
|
|
6
6
|
import type { UseEditableUtilType } from '../../utils';
|
|
7
|
-
import type { ActionType, Bordered, BorderedType, ProColumns, UseFetchDataAction } from '../typing';
|
|
7
|
+
import type { ActionType, Bordered, BorderedType, FilterValue, ProColumns, ProColumnType, ProSorter, UseFetchDataAction } from '../typing';
|
|
8
8
|
/**
|
|
9
9
|
* 检查值是否存在 为了 避开 0 和 false
|
|
10
10
|
*
|
|
@@ -29,10 +29,14 @@ export declare function mergePagination<T>(pagination: TablePaginationConfig | b
|
|
|
29
29
|
* @param onCleanSelected
|
|
30
30
|
*/
|
|
31
31
|
export declare function useActionType<T>(ref: React.MutableRefObject<ActionType | undefined>, action: UseFetchDataAction<T>, props: {
|
|
32
|
+
nativeElement?: HTMLDivElement;
|
|
33
|
+
focus?: () => void;
|
|
32
34
|
fullScreen: () => void;
|
|
33
35
|
onCleanSelected: () => void;
|
|
34
36
|
resetAll: () => void;
|
|
35
37
|
editableUtils: UseEditableUtilType;
|
|
38
|
+
/** 透传给 ActionType 的滚动能力 */
|
|
39
|
+
scrollTo?: ActionType['scrollTo'];
|
|
36
40
|
}): void;
|
|
37
41
|
type PostDataType<T> = (data: T) => T;
|
|
38
42
|
/**
|
|
@@ -53,12 +57,63 @@ export declare const isMergeCell: (dom: any) => any;
|
|
|
53
57
|
*/
|
|
54
58
|
export declare const genColumnKey: (key?: string | number | Key, index?: number | string) => string;
|
|
55
59
|
/**
|
|
56
|
-
*
|
|
60
|
+
* 将 ProTable - column - dataIndex 转为字符串形式
|
|
57
61
|
*
|
|
62
|
+
* @param dataIndex Column 中的 dataIndex
|
|
63
|
+
*/
|
|
64
|
+
export declare const parseDataIndex: (dataIndex: ProColumnType['dataIndex']) => string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* 平铺所有columns, 用于判断是用的是本地筛选/排序
|
|
67
|
+
* @param data 列配置
|
|
68
|
+
* @returns 平铺后的列配置
|
|
69
|
+
*/
|
|
70
|
+
export declare const flattenColumns: (data: any[]) => any[];
|
|
71
|
+
/**
|
|
72
|
+
* 判断是否为本地筛选
|
|
73
|
+
* @param filters 筛选配置
|
|
74
|
+
* @param onFilter 筛选函数
|
|
75
|
+
* @returns 是否为本地筛选
|
|
76
|
+
*/
|
|
77
|
+
export declare const isLocaleFilter: <T>(filters: ProColumnType<T>['filters'], onFilter: ProColumnType<T>['onFilter']) => boolean;
|
|
78
|
+
/**
|
|
79
|
+
* 判断是否为本地排序
|
|
80
|
+
* @param sorter 排序配置
|
|
81
|
+
* @returns 是否为本地排序
|
|
82
|
+
*/
|
|
83
|
+
export declare const isLocaleSorter: <T>(sorter: ProSorter<T>) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* 获取服务端筛选数据
|
|
86
|
+
* @param filters 筛选数据
|
|
87
|
+
* @param columns 列配置
|
|
88
|
+
* @returns 服务端筛选数据
|
|
89
|
+
*/
|
|
90
|
+
export declare const getServerFilterResult: <T>(filters: Record<string, AntFilterValue | null>, columns: ProColumnType<T>[]) => Record<string, FilterValue>;
|
|
91
|
+
/**
|
|
92
|
+
* 获取服务端排序数据
|
|
93
|
+
* @param sorterResult 排序数据
|
|
94
|
+
* @returns 服务端排序数据
|
|
95
|
+
*/
|
|
96
|
+
export declare const getServerSorterResult: <T>(sorterResult: SorterResult<T> | SorterResult<T>[]) => Record<string, SortOrder | undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* 从 ProColumns 数组中取出默认的服务端排序和筛选数据
|
|
58
99
|
* @param columns ProColumns
|
|
59
100
|
*/
|
|
60
|
-
export declare
|
|
101
|
+
export declare const parseServerDefaultColumnConfig: <T, Value>(columns: ProColumns<T, Value>[]) => {
|
|
61
102
|
sort: Record<string, SortOrder>;
|
|
62
|
-
filter: Record<string,
|
|
103
|
+
filter: Record<string, FilterValue>;
|
|
63
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* 解析对应排序值,用作双向绑定
|
|
107
|
+
* @param proSort 排序配置
|
|
108
|
+
* @param columnProps 列配置
|
|
109
|
+
* @returns 排序值
|
|
110
|
+
*/
|
|
111
|
+
export declare const parseProSortOrder: <T>(proSort: Record<string, SortOrder>, columnProps: ProColumnType<T>) => SortOrder | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* 解析对应筛选值,用作双向绑定
|
|
114
|
+
* @param proFilter 筛选配置
|
|
115
|
+
* @param columnProps 列配置
|
|
116
|
+
* @returns 筛选值
|
|
117
|
+
*/
|
|
118
|
+
export declare const parseProFilteredValue: <T>(proFilter: Record<string, FilterValue>, columnProps: ProColumnType<T>) => FilterValue | undefined;
|
|
64
119
|
export {};
|
package/es/table/utils/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
3
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
4
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
@@ -62,6 +64,8 @@ export function useActionType(ref, action, props) {
|
|
|
62
64
|
/** 这里生成action的映射,保证 action 总是使用的最新 只需要渲染一次即可 */
|
|
63
65
|
var userAction = _objectSpread(_objectSpread({}, props.editableUtils), {}, {
|
|
64
66
|
pageInfo: action.pageInfo,
|
|
67
|
+
nativeElement: props.nativeElement,
|
|
68
|
+
focus: props.focus,
|
|
65
69
|
reload: function () {
|
|
66
70
|
var _reload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resetPageIndex) {
|
|
67
71
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -147,7 +151,9 @@ export function useActionType(ref, action, props) {
|
|
|
147
151
|
},
|
|
148
152
|
setPageInfo: function setPageInfo(rest) {
|
|
149
153
|
return action.setPageInfo(rest);
|
|
150
|
-
}
|
|
154
|
+
},
|
|
155
|
+
// 透出 scrollTo(如上层提供)
|
|
156
|
+
scrollTo: props.scrollTo
|
|
151
157
|
});
|
|
152
158
|
// eslint-disable-next-line no-param-reassign
|
|
153
159
|
ref.current = userAction;
|
|
@@ -202,41 +208,174 @@ export var genColumnKey = function genColumnKey(key, index) {
|
|
|
202
208
|
*
|
|
203
209
|
* @param dataIndex Column 中的 dataIndex
|
|
204
210
|
*/
|
|
205
|
-
function parseDataIndex(dataIndex) {
|
|
211
|
+
export var parseDataIndex = function parseDataIndex(dataIndex) {
|
|
206
212
|
if (Array.isArray(dataIndex)) {
|
|
207
213
|
return dataIndex.join(',');
|
|
208
214
|
}
|
|
209
215
|
return dataIndex === null || dataIndex === void 0 ? void 0 : dataIndex.toString();
|
|
210
|
-
}
|
|
216
|
+
};
|
|
211
217
|
|
|
212
218
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
219
|
+
* 平铺所有columns, 用于判断是用的是本地筛选/排序
|
|
220
|
+
* @param data 列配置
|
|
221
|
+
* @returns 平铺后的列配置
|
|
222
|
+
*/
|
|
223
|
+
export var flattenColumns = function flattenColumns(data) {
|
|
224
|
+
var _columns = [];
|
|
225
|
+
for (var i = 0; i < data.length; i++) {
|
|
226
|
+
var _curItem = data[i];
|
|
227
|
+
if (_curItem.children) {
|
|
228
|
+
_columns.push.apply(_columns, _toConsumableArray(flattenColumns(_curItem.children)));
|
|
229
|
+
} else {
|
|
230
|
+
_columns.push(_curItem);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return _columns;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* 判断是否为本地筛选
|
|
238
|
+
* @param filters 筛选配置
|
|
239
|
+
* @param onFilter 筛选函数
|
|
240
|
+
* @returns 是否为本地筛选
|
|
241
|
+
*/
|
|
242
|
+
export var isLocaleFilter = function isLocaleFilter(filters, onFilter) {
|
|
243
|
+
return !!filters && !!onFilter;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* 判断是否为本地排序
|
|
248
|
+
* @param sorter 排序配置
|
|
249
|
+
* @returns 是否为本地排序
|
|
250
|
+
*/
|
|
251
|
+
export var isLocaleSorter = function isLocaleSorter(sorter) {
|
|
252
|
+
return typeof sorter === 'function' || _typeof(sorter) === 'object' && typeof sorter.compare === 'function';
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* 获取服务端筛选数据
|
|
257
|
+
* @param filters 筛选数据
|
|
258
|
+
* @param columns 列配置
|
|
259
|
+
* @returns 服务端筛选数据
|
|
260
|
+
*/
|
|
261
|
+
export var getServerFilterResult = function getServerFilterResult(filters, columns) {
|
|
262
|
+
// 过滤掉本地筛选的列
|
|
263
|
+
return Object.entries(filters).reduce(function (acc, _ref2) {
|
|
264
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
265
|
+
key = _ref3[0],
|
|
266
|
+
value = _ref3[1];
|
|
267
|
+
var column = columns.find(function (column) {
|
|
268
|
+
return parseDataIndex(column.dataIndex) === key;
|
|
269
|
+
});
|
|
270
|
+
if (column != null && !isLocaleFilter(column.filters, column.onFilter)) acc[key] = value;
|
|
271
|
+
return acc;
|
|
272
|
+
}, {});
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* 获取服务端排序数据
|
|
277
|
+
* @param sorterResult 排序数据
|
|
278
|
+
* @returns 服务端排序数据
|
|
279
|
+
*/
|
|
280
|
+
export var getServerSorterResult = function getServerSorterResult(sorterResult) {
|
|
281
|
+
var result = Array.isArray(sorterResult) ? sorterResult : [sorterResult];
|
|
282
|
+
var serverSorter = result.reduce(function (acc, item) {
|
|
283
|
+
var _item$column, _item$column2;
|
|
284
|
+
var sorter = (_item$column = item.column) === null || _item$column === void 0 ? void 0 : _item$column.sorter;
|
|
285
|
+
if (sorter != null && isLocaleSorter(sorter)) return acc;
|
|
286
|
+
var sortKey = typeof sorter === 'string' ? sorter : parseDataIndex((_item$column2 = item.column) === null || _item$column2 === void 0 ? void 0 : _item$column2.dataIndex);
|
|
287
|
+
if (sortKey != null) acc[sortKey] = item.order;
|
|
288
|
+
return acc;
|
|
289
|
+
}, {});
|
|
290
|
+
return serverSorter;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* 从 ProColumns 数组中取出默认的服务端排序和筛选数据
|
|
215
295
|
* @param columns ProColumns
|
|
216
296
|
*/
|
|
217
|
-
export function
|
|
297
|
+
export var parseServerDefaultColumnConfig = function parseServerDefaultColumnConfig(columns) {
|
|
218
298
|
var filter = {};
|
|
219
299
|
var sort = {};
|
|
220
300
|
columns.forEach(function (column) {
|
|
221
301
|
// 转换 dataIndex
|
|
222
302
|
var dataIndex = parseDataIndex(column.dataIndex);
|
|
223
|
-
if (!dataIndex)
|
|
224
|
-
|
|
303
|
+
if (!dataIndex) return; // 没有 dataIndex 的列不参与服务端排序/筛选
|
|
304
|
+
|
|
305
|
+
// 当 column 启用服务端 filters 功能时,取出默认的筛选值
|
|
306
|
+
if (column.filters && !isLocaleFilter(column.filters, column.onFilter)) {
|
|
307
|
+
var _ref4;
|
|
308
|
+
filter[dataIndex] = (_ref4 = column.defaultFilteredValue) !== null && _ref4 !== void 0 ? _ref4 : null;
|
|
225
309
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (
|
|
230
|
-
|
|
310
|
+
|
|
311
|
+
// 当 column 启用服务端 sorter 功能时,取出默认的排序值
|
|
312
|
+
if (column.sorter && !isLocaleSorter(column.sorter)) {
|
|
313
|
+
if (typeof column.sorter === 'string') {
|
|
314
|
+
var _column$defaultSortOr;
|
|
315
|
+
sort[column.sorter] = (_column$defaultSortOr = column.defaultSortOrder) !== null && _column$defaultSortOr !== void 0 ? _column$defaultSortOr : null;
|
|
316
|
+
} else {
|
|
317
|
+
var _column$defaultSortOr2;
|
|
318
|
+
sort[dataIndex] = (_column$defaultSortOr2 = column.defaultSortOrder) !== null && _column$defaultSortOr2 !== void 0 ? _column$defaultSortOr2 : null;
|
|
231
319
|
}
|
|
232
320
|
}
|
|
233
|
-
// 当 column 启用 sorter 功能时,取出默认的排序值
|
|
234
|
-
if (column.sorter && column.defaultSortOrder) {
|
|
235
|
-
sort[dataIndex] = column.defaultSortOrder;
|
|
236
|
-
}
|
|
237
321
|
});
|
|
238
322
|
return {
|
|
239
323
|
sort: sort,
|
|
240
324
|
filter: filter
|
|
241
325
|
};
|
|
242
|
-
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* 解析对应排序值,用作双向绑定
|
|
330
|
+
* @param proSort 排序配置
|
|
331
|
+
* @param columnProps 列配置
|
|
332
|
+
* @returns 排序值
|
|
333
|
+
*/
|
|
334
|
+
export var parseProSortOrder = function parseProSortOrder(proSort, columnProps) {
|
|
335
|
+
var sorter = columnProps.sorter,
|
|
336
|
+
columnSortOrder = columnProps.sortOrder,
|
|
337
|
+
dataIndex = columnProps.dataIndex;
|
|
338
|
+
|
|
339
|
+
// 优先使用用户明确设置的 sortOrder
|
|
340
|
+
if (columnSortOrder !== undefined) return columnSortOrder;
|
|
341
|
+
|
|
342
|
+
// 如果没有排序器配置,直接返回 undefined
|
|
343
|
+
if (sorter == null) return undefined;
|
|
344
|
+
|
|
345
|
+
// 如果是本地排序,不使用 proSort 中的值
|
|
346
|
+
if (isLocaleSorter(sorter)) return undefined;
|
|
347
|
+
|
|
348
|
+
// 服务端排序:确定排序键
|
|
349
|
+
var sortKey = typeof sorter === 'string' ? sorter : parseDataIndex(dataIndex);
|
|
350
|
+
|
|
351
|
+
// 返回对应的排序值
|
|
352
|
+
return sortKey ? proSort[sortKey] : undefined;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* 解析对应筛选值,用作双向绑定
|
|
357
|
+
* @param proFilter 筛选配置
|
|
358
|
+
* @param columnProps 列配置
|
|
359
|
+
* @returns 筛选值
|
|
360
|
+
*/
|
|
361
|
+
export var parseProFilteredValue = function parseProFilteredValue(proFilter, columnProps) {
|
|
362
|
+
var filters = columnProps.filters,
|
|
363
|
+
onFilter = columnProps.onFilter,
|
|
364
|
+
columnFilteredValue = columnProps.filteredValue,
|
|
365
|
+
dataIndex = columnProps.dataIndex;
|
|
366
|
+
|
|
367
|
+
// 优先使用用户设置的 filteredValue
|
|
368
|
+
if (columnFilteredValue !== undefined) return columnFilteredValue;
|
|
369
|
+
|
|
370
|
+
// 如果没有筛选配置,直接返回 undefined
|
|
371
|
+
if (filters == null) return undefined;
|
|
372
|
+
|
|
373
|
+
// 如果是本地筛选,不使用 proFilter 中的值
|
|
374
|
+
if (isLocaleFilter(filters, onFilter)) return undefined;
|
|
375
|
+
|
|
376
|
+
// 服务端排序:获取筛选键
|
|
377
|
+
var filterKey = parseDataIndex(dataIndex);
|
|
378
|
+
|
|
379
|
+
// 返回对应的筛选值
|
|
380
|
+
return filterKey ? proFilter[filterKey] : undefined;
|
|
381
|
+
};
|
|
@@ -4,6 +4,6 @@ export interface ProToken extends ProAliasToken {
|
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useStyle(prefixCls: string): {
|
|
7
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
7
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
hashId: string;
|
|
9
9
|
};
|
|
@@ -4,6 +4,6 @@ export interface ProToken extends ProAliasToken {
|
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useStyle(prefixCls: string): {
|
|
7
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
7
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
hashId: string;
|
|
9
9
|
};
|
|
@@ -4,6 +4,6 @@ export interface ProToken extends ProAliasToken {
|
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useStyle(prefixCls: string): {
|
|
7
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
7
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
hashId: string;
|
|
9
9
|
};
|
|
@@ -4,6 +4,6 @@ export interface ProToken extends ProAliasToken {
|
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useStyle(prefixCls: string): {
|
|
7
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
7
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
hashId: string;
|
|
9
9
|
};
|
|
@@ -4,6 +4,6 @@ export interface ProToken extends ProAliasToken {
|
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useStyle(prefixCls: string): {
|
|
7
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
7
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
hashId: string;
|
|
9
9
|
};
|
|
@@ -132,17 +132,29 @@ export var conversionMomentValue = function conversionMomentValue(value, dateFor
|
|
|
132
132
|
tmpValue[valueKey] = conversionMomentValue(itemValue, dateFormatter, valueTypeMap, omitNil, namePath);
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
+
var currentDateFormatter = dateFormatter !== null && dateFormatter !== void 0 ? dateFormatter : 'string';
|
|
136
|
+
var finalDateFormatter;
|
|
137
|
+
if (currentDateFormatter === 'number' || currentDateFormatter === false || typeof currentDateFormatter === 'function') {
|
|
138
|
+
finalDateFormatter = currentDateFormatter;
|
|
139
|
+
} else if (currentDateFormatter === 'string') {
|
|
140
|
+
finalDateFormatter = dateFormat || dateFormatterMap[valueType];
|
|
141
|
+
} else {
|
|
142
|
+
// Custom format string
|
|
143
|
+
finalDateFormatter = currentDateFormatter;
|
|
144
|
+
}
|
|
135
145
|
// 处理 FormList 的 value
|
|
136
146
|
if (Array.isArray(itemValue)) {
|
|
137
147
|
tmpValue[valueKey] = itemValue.map(function (arrayValue, index) {
|
|
138
148
|
if (dayjs.isDayjs(arrayValue) || isMoment(arrayValue)) {
|
|
139
|
-
|
|
149
|
+
// For arrays, if no format is defined and dateFormatter is 'string', use 'string' with default format
|
|
150
|
+
var arrayDateFormatter = finalDateFormatter === undefined && currentDateFormatter === 'string' ? 'string' : finalDateFormatter;
|
|
151
|
+
return convertMoment(arrayValue, arrayDateFormatter, valueType);
|
|
140
152
|
}
|
|
141
153
|
return conversionMomentValue(arrayValue, dateFormatter, valueTypeMap, omitNil, [valueKey, "".concat(index)].flat(1));
|
|
142
154
|
});
|
|
143
155
|
return;
|
|
144
156
|
}
|
|
145
|
-
tmpValue[valueKey] = convertMoment(itemValue,
|
|
157
|
+
tmpValue[valueKey] = convertMoment(itemValue, finalDateFormatter, valueType);
|
|
146
158
|
});
|
|
147
159
|
return tmpValue;
|
|
148
160
|
};
|
|
@@ -111,7 +111,7 @@ var TableStatus = {
|
|
|
111
111
|
export var proFieldParsingText = function proFieldParsingText(text, valueEnumParams, key) {
|
|
112
112
|
if (Array.isArray(text)) {
|
|
113
113
|
return /*#__PURE__*/_jsx(Space, {
|
|
114
|
-
|
|
114
|
+
separator: ",",
|
|
115
115
|
size: 2,
|
|
116
116
|
wrap: true,
|
|
117
117
|
children: text.map(function (value, index) {
|