@gx-design-vue/pro-table 0.2.0-alpha.7 → 0.2.0-alpha.9
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/ProTable.d.ts +14 -492
- package/dist/ProTable.js +818 -518
- package/dist/components/ScrollBar/Bar.d.ts +81 -0
- package/dist/components/ScrollBar/Bar.js +84 -0
- package/dist/components/ScrollBar/Thumb.d.ts +52 -0
- package/dist/components/ScrollBar/{Thumb/index.js → Thumb.js} +67 -55
- package/dist/components/ScrollBar/context.d.ts +3 -4
- package/dist/components/ScrollBar/context.js +3 -3
- package/dist/components/ScrollBar/util.d.ts +6 -5
- package/dist/components/ScrollBar/util.js +1 -12
- package/dist/components/SearchForm/CollapseToggle.d.ts +55 -0
- package/dist/components/SearchForm/CollapseToggle.js +47 -0
- package/dist/components/SearchForm/FormItemContainer.d.ts +75 -0
- package/dist/components/SearchForm/FormItemContainer.js +225 -0
- package/dist/components/SearchForm/FormItemWrapper.d.ts +82 -0
- package/dist/components/SearchForm/FormItemWrapper.js +62 -0
- package/dist/components/SearchForm/SearchForm.d.ts +130 -0
- package/dist/components/SearchForm/SearchForm.js +319 -0
- package/dist/components/SearchForm/index.d.ts +2 -0
- package/dist/components/SearchForm/index.js +2 -0
- package/dist/components/Toolbar/FullscreenIcon.d.ts +26 -0
- package/dist/components/Toolbar/FullscreenIcon.js +22 -0
- package/dist/components/Toolbar/ListToolBar.d.ts +111 -0
- package/dist/components/Toolbar/ListToolBar.js +101 -0
- package/dist/components/Toolbar/index.d.ts +103 -0
- package/dist/components/Toolbar/index.js +101 -0
- package/dist/components/Toolbar/style.d.ts +8 -0
- package/dist/components/{ListToolBar → Toolbar}/style.js +32 -27
- package/dist/context/TableContext.d.ts +15 -27
- package/dist/context/TableContext.js +3 -3
- package/dist/hooks/index.d.ts +16 -0
- package/dist/hooks/index.js +16 -0
- package/dist/hooks/useBreakpoints.d.ts +13 -0
- package/dist/hooks/useBreakpoints.js +57 -0
- package/dist/hooks/useCellRender.d.ts +13 -0
- package/dist/hooks/useCellRender.js +28 -0
- package/dist/hooks/useColumnResize.d.ts +30 -0
- package/dist/hooks/useColumnResize.js +110 -0
- package/dist/hooks/useColumns.d.ts +35 -24
- package/dist/hooks/useColumns.js +89 -56
- package/dist/hooks/useFetchData.d.ts +40 -65
- package/dist/hooks/useFetchData.js +157 -172
- package/dist/hooks/useFitPage.d.ts +19 -0
- package/dist/hooks/useFitPage.js +90 -0
- package/dist/hooks/useKeepAliveReload.d.ts +21 -0
- package/dist/hooks/useKeepAliveReload.js +24 -0
- package/dist/hooks/useLoading.d.ts +18 -7
- package/dist/hooks/useLoading.js +26 -8
- package/dist/hooks/usePagination.d.ts +10 -7
- package/dist/hooks/usePagination.js +37 -26
- package/dist/hooks/useRequestOptions.d.ts +18 -0
- package/dist/hooks/useRequestOptions.js +39 -0
- package/dist/hooks/useRowSelection.d.ts +27 -15
- package/dist/hooks/useRowSelection.js +92 -77
- package/dist/hooks/useTable.d.ts +19 -77
- package/dist/hooks/useTable.js +66 -54
- package/dist/hooks/useTableForm.d.ts +15 -83
- package/dist/hooks/useTableForm.js +93 -56
- package/dist/hooks/useTableScroll.d.ts +33 -31
- package/dist/hooks/useTableScroll.js +71 -26
- package/dist/hooks/useTableSize.d.ts +17 -7
- package/dist/hooks/useTableSize.js +20 -6
- package/dist/index.d.ts +10 -7
- package/dist/index.js +9 -3
- package/dist/interface.d.ts +492 -0
- package/dist/pro-table.esm.js +3483 -3913
- package/dist/pro-table.js +1 -1
- package/dist/style/fit-page.d.ts +4 -2
- package/dist/style/fit-page.js +9 -3
- package/dist/style/index.d.ts +4 -6
- package/dist/style/index.js +24 -74
- package/dist/style/list.d.ts +4 -2
- package/dist/style/list.js +1 -10
- package/dist/style/resizable.d.ts +8 -0
- package/dist/style/resizable.js +18 -0
- package/dist/style/scroll.d.ts +4 -2
- package/dist/style/scroll.js +8 -6
- package/dist/style/search.d.ts +8 -0
- package/dist/{components/Form/style.js → style/search.js} +22 -8
- package/dist/theme/augment.d.ts +8 -0
- package/dist/theme/interface/components.d.ts +8 -0
- package/dist/utils/dateFormat.d.ts +9 -0
- package/dist/utils/dateFormat.js +29 -0
- package/dist/utils/formConstants.d.ts +9 -0
- package/dist/utils/formConstants.js +29 -0
- package/dist/utils/valueFormat.d.ts +9 -0
- package/dist/utils/valueFormat.js +27 -0
- package/package.json +10 -9
- package/dist/components/Form/components/RequestSelect.d.ts +0 -50
- package/dist/components/Form/components/RequestSelect.js +0 -56
- package/dist/components/Form/hooks/useForm.d.ts +0 -11
- package/dist/components/Form/hooks/useForm.js +0 -30
- package/dist/components/Form/index.d.ts +0 -32
- package/dist/components/Form/index.js +0 -476
- package/dist/components/Form/style.d.ts +0 -6
- package/dist/components/Form/utils/config.d.ts +0 -9
- package/dist/components/Form/utils/config.js +0 -29
- package/dist/components/Form/utils/dateFormat.d.ts +0 -22
- package/dist/components/Form/utils/dateFormat.js +0 -43
- package/dist/components/ListToolBar/index.d.ts +0 -59
- package/dist/components/ListToolBar/index.js +0 -123
- package/dist/components/ListToolBar/style.d.ts +0 -6
- package/dist/components/ScrollBar/Bar/index.d.ts +0 -49
- package/dist/components/ScrollBar/Bar/index.js +0 -68
- package/dist/components/ScrollBar/Bar/props.d.ts +0 -25
- package/dist/components/ScrollBar/Bar/props.js +0 -17
- package/dist/components/ScrollBar/Thumb/index.d.ts +0 -40
- package/dist/components/ScrollBar/Thumb/props.d.ts +0 -20
- package/dist/components/ScrollBar/Thumb/props.js +0 -17
- package/dist/components/TableCell/index.d.ts +0 -37
- package/dist/components/TableCell/index.js +0 -69
- package/dist/components/ToolBar/FullscreenIcon.d.ts +0 -7
- package/dist/components/ToolBar/FullscreenIcon.js +0 -11
- package/dist/components/ToolBar/index.d.ts +0 -34
- package/dist/components/ToolBar/index.js +0 -97
- package/dist/hooks/tryOnActivated.d.ts +0 -6
- package/dist/hooks/tryOnActivated.js +0 -12
- package/dist/hooks/useDebounceFn.d.ts +0 -8
- package/dist/hooks/useDebounceFn.js +0 -31
- package/dist/hooks/useScrollArea.d.ts +0 -24
- package/dist/hooks/useScrollArea.js +0 -102
- package/dist/props.d.ts +0 -340
- package/dist/props.js +0 -247
- package/dist/types/ColumnTypings.d.ts +0 -130
- package/dist/types/SlotsTypings.d.ts +0 -63
- package/dist/types/SlotsTypings.js +0 -12
- package/dist/types/TableTypings.d.ts +0 -359
- package/dist/types/index.d.ts +0 -9
- package/dist/utils/utils.d.ts +0 -10
- package/dist/utils/utils.js +0 -89
- /package/dist/{types/ColumnTypings.js → interface.js} +0 -0
- /package/dist/{types/TableTypings.js → theme/augment.js} +0 -0
- /package/dist/{types/index.js → theme/interface/components.js} +0 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
import { CSSProperties, ComputedRef, Ref } from "vue";
|
|
2
|
+
import { AlignType, Breakpoint, CustomRender, RecordType, SemanticClassNames, SemanticStyles, WithFalse } from "@gx-design-vue/pro-utils";
|
|
3
|
+
import { SpinProps, TableEmits, TableProps, TableSlots, TooltipProps } from "antdv-next";
|
|
4
|
+
import { ColumnType, FilterValue, SorterResult, TableCurrentDataSource, TablePaginationConfig } from "antdv-next/dist/table/interface";
|
|
5
|
+
|
|
6
|
+
//#region src/interface.d.ts
|
|
7
|
+
interface CustomRenderResult<T = RecordType> {
|
|
8
|
+
currentData: T[];
|
|
9
|
+
dataSource: T[];
|
|
10
|
+
}
|
|
11
|
+
type PageItemFn = (opt: {
|
|
12
|
+
page: number;
|
|
13
|
+
type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next';
|
|
14
|
+
originalElement: any;
|
|
15
|
+
}) => CustomRender;
|
|
16
|
+
type PageItemRender = WithFalse<PageItemFn>;
|
|
17
|
+
type CustomDataFn<T = RecordType> = (params: CustomRenderResult<T>) => CustomRender;
|
|
18
|
+
type DefaultRender = WithFalse<CustomRender>;
|
|
19
|
+
type CustomDataRender<T = RecordType> = WithFalse<CustomDataFn<T>>;
|
|
20
|
+
type ToolbarPlacement = 'left' | 'right';
|
|
21
|
+
interface ToolbarOptionConfig {
|
|
22
|
+
reload?: boolean | ((onClick: () => void) => CustomRender);
|
|
23
|
+
fullScreen?: boolean | (() => Promise<void>);
|
|
24
|
+
}
|
|
25
|
+
type ColConfig = Partial<Record<Breakpoint, number>>;
|
|
26
|
+
interface FormConfig {
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* actions 表单动作的配置参数
|
|
30
|
+
*/
|
|
31
|
+
actions?: {
|
|
32
|
+
/**
|
|
33
|
+
* reset 是否展示重置按钮
|
|
34
|
+
*/
|
|
35
|
+
reset?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* resetReload 是否展示重置按钮
|
|
38
|
+
*/
|
|
39
|
+
resetReload?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* searchText 搜索按钮文案
|
|
42
|
+
*/
|
|
43
|
+
searchText?: string;
|
|
44
|
+
/**
|
|
45
|
+
* resetText 重置按钮文案
|
|
46
|
+
*/
|
|
47
|
+
resetText?: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* collapsed 收起状态
|
|
51
|
+
*/
|
|
52
|
+
collapsed?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* defaultCollapsed 默认收起状态
|
|
55
|
+
*/
|
|
56
|
+
defaultCollapsed?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* autoRequest 表单搜索条件变化后自动请求request
|
|
59
|
+
*/
|
|
60
|
+
autoRequest?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* collapseRender 展开收起自定义渲染
|
|
63
|
+
*/
|
|
64
|
+
collapseRender?: WithFalse<(collapsed?: boolean) => CustomRender>;
|
|
65
|
+
/**
|
|
66
|
+
* span 支持断点('xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs')一行展示几个 demo { xl: 4, lg: 3 }
|
|
67
|
+
*/
|
|
68
|
+
span?: ColConfig;
|
|
69
|
+
/**
|
|
70
|
+
* breakpoint 断点配置支持写入具体宽度 一行展示几个(这里是指大于宽度生效),优先级比span要高 demo { 1440: 4 }
|
|
71
|
+
*/
|
|
72
|
+
breakpoint?: Record<number, number>;
|
|
73
|
+
/**
|
|
74
|
+
* gap 每项表单间的间隔
|
|
75
|
+
*/
|
|
76
|
+
gap?: number | string;
|
|
77
|
+
/**
|
|
78
|
+
* label 搜索表单的label配置参数
|
|
79
|
+
*/
|
|
80
|
+
label?: {
|
|
81
|
+
/**
|
|
82
|
+
* label label与表单项之间的间隔:仅支持数字
|
|
83
|
+
*/
|
|
84
|
+
gap?: number;
|
|
85
|
+
/**
|
|
86
|
+
* colon label与表单项之间的间否使用冒号间隔
|
|
87
|
+
*/
|
|
88
|
+
colon?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* width label的宽度:支持数字和字符
|
|
91
|
+
*/
|
|
92
|
+
width?: number | string;
|
|
93
|
+
/**
|
|
94
|
+
* align label在宽度内的对齐方式:'center' | 'left' | 'right'
|
|
95
|
+
*/
|
|
96
|
+
align?: 'center' | 'left' | 'right';
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
type TableSorterRecord = SorterResult<RecordType>;
|
|
100
|
+
interface PageState {
|
|
101
|
+
current: number;
|
|
102
|
+
pageSize: number;
|
|
103
|
+
total?: number;
|
|
104
|
+
}
|
|
105
|
+
interface RequestData<T = any> {
|
|
106
|
+
data: T[] | undefined;
|
|
107
|
+
success?: boolean;
|
|
108
|
+
total?: number;
|
|
109
|
+
}
|
|
110
|
+
interface RequestConfig<T> {
|
|
111
|
+
params: T extends undefined ? PageState : PageState & Partial<T>;
|
|
112
|
+
sorter: TableSorterRecord[];
|
|
113
|
+
filter: Record<string, FilterValue | null>;
|
|
114
|
+
extra?: TableCurrentDataSource;
|
|
115
|
+
signal?: AbortSignal;
|
|
116
|
+
}
|
|
117
|
+
type RequestFunction<T = any, D = undefined> = (props: RequestConfig<D>) => Promise<Partial<RequestData<T>> | undefined>;
|
|
118
|
+
type BeforeSearchSubmit<D = undefined> = (props: RequestConfig<D>) => Promise<RequestConfig<D>['params']> | RequestConfig<D>['params'];
|
|
119
|
+
interface ProTableFetchParams<R = RecordType> {
|
|
120
|
+
params?: R;
|
|
121
|
+
filters?: Record<string, FilterValue | null>;
|
|
122
|
+
sorter?: SorterResult | SorterResult[];
|
|
123
|
+
pagination?: ProTablePagination;
|
|
124
|
+
removeKeys?: (string | number)[];
|
|
125
|
+
isPolling?: boolean;
|
|
126
|
+
extra?: TableCurrentDataSource;
|
|
127
|
+
}
|
|
128
|
+
interface OperateRowProps<T = RecordType> {
|
|
129
|
+
row?: Partial<T>;
|
|
130
|
+
key?: keyof T;
|
|
131
|
+
value?: any;
|
|
132
|
+
type?: 'update' | 'push' | 'delete' | 'unshift';
|
|
133
|
+
}
|
|
134
|
+
interface RowSelectionActions<T = RecordType> {
|
|
135
|
+
clear: () => void;
|
|
136
|
+
select: (record: T, selected: boolean) => void;
|
|
137
|
+
selectAll: (records: T[], selected: boolean) => void;
|
|
138
|
+
remove: (keys: (string | number)[]) => void;
|
|
139
|
+
sync: () => void;
|
|
140
|
+
}
|
|
141
|
+
interface ProCoreActionType<T = RecordType, R = RecordType> {
|
|
142
|
+
loading: Ref<boolean>;
|
|
143
|
+
dataSource: ComputedRef<T[]>;
|
|
144
|
+
pageInfo: PageState;
|
|
145
|
+
reload: (info?: ProTableFetchParams<R>) => void;
|
|
146
|
+
reloadAndReset: (options?: {
|
|
147
|
+
callBack?: () => void;
|
|
148
|
+
wait?: boolean;
|
|
149
|
+
}) => void;
|
|
150
|
+
setPagination: (pagination: ProTablePaginationConfig) => void;
|
|
151
|
+
setPageInfo: (pagination: ProTablePaginationConfig, filters?: Record<string, FilterValue | null>, sorter?: SorterResult | SorterResult[], extra?: TableCurrentDataSource) => void;
|
|
152
|
+
setTableDataList: (data: T[]) => void;
|
|
153
|
+
operateTableDataRow: (props: OperateRowProps<T>) => void;
|
|
154
|
+
setLoading: (loading: boolean) => void;
|
|
155
|
+
selectedKeys: ComputedRef<(string | number)[]>;
|
|
156
|
+
selectedItems: ComputedRef<T[]>;
|
|
157
|
+
rowsSelection: RowSelectionActions<T>;
|
|
158
|
+
}
|
|
159
|
+
interface ProTableRef<T = RecordType, R = RecordType> {
|
|
160
|
+
actionRef: () => ProCoreActionType<T, R>;
|
|
161
|
+
}
|
|
162
|
+
interface ProTablePaginationConfig extends TablePaginationConfig {
|
|
163
|
+
total?: number;
|
|
164
|
+
}
|
|
165
|
+
type ProTablePagination = ProTablePaginationConfig | false;
|
|
166
|
+
type TableSemanticName = 'root' | 'content' | 'search' | 'searchItem' | 'searchControl' | 'searchContent' | 'searchText' | 'searchButtons' | 'card' | 'toolbar' | 'toolbarAfter' | 'toolbarLeft' | 'toolbarRight' | 'toolbarTitle' | 'list' | 'listContent' | 'pagination' | 'table';
|
|
167
|
+
type ProTableStylesType = SemanticStyles<TableSemanticName>;
|
|
168
|
+
type ProTableClassNamesType = SemanticClassNames<TableSemanticName>;
|
|
169
|
+
/**
|
|
170
|
+
* @param text 文本框
|
|
171
|
+
* @param date 日期 YYYY-MM-DD
|
|
172
|
+
* @param dateMonth 月选择器
|
|
173
|
+
* @param dateRange 日期范围 YYYY-MM-DD[]
|
|
174
|
+
* @param time: 时间 HH:mm:ss
|
|
175
|
+
* @param select 下拉选择器
|
|
176
|
+
*/
|
|
177
|
+
type ProFieldValueType = 'text' | 'number' | 'numberRange' | 'select' | 'treeSelect' | 'cascader' | 'date' | 'dateWeek' | 'dateQuarter' | 'dateMonth' | 'dateYear' | 'dateRange' | 'time';
|
|
178
|
+
/**
|
|
179
|
+
* @param text 文本框
|
|
180
|
+
* @param date 日期 YYYY-MM-DD
|
|
181
|
+
* @param dateMonth 月选择器
|
|
182
|
+
* @param dateRange 日期范围 YYYY-MM-DD[]
|
|
183
|
+
* @param time: 时间 HH:mm:ss
|
|
184
|
+
* @param select 下拉选择器
|
|
185
|
+
*/
|
|
186
|
+
type ProFieldValueFormat = 'YYYY-MM-DD' | 'YYYY-MM' | 'YYYY-MM-DD HH:mm:ss' | 'HH:mm:ss';
|
|
187
|
+
interface ProSchemaValueEnumType {
|
|
188
|
+
/** @name 演示的文案 */
|
|
189
|
+
label: any;
|
|
190
|
+
/** @name 演示的value值 */
|
|
191
|
+
value: any;
|
|
192
|
+
/** @name 是否禁用 */
|
|
193
|
+
disabled?: boolean;
|
|
194
|
+
[key: string]: any;
|
|
195
|
+
}
|
|
196
|
+
type ProSchemaValueType<ValueType> = (ValueType | ProFieldValueType);
|
|
197
|
+
interface ProSearchMap<ValueType = 'text', ParamsKey = string> {
|
|
198
|
+
name: ParamsKey;
|
|
199
|
+
order?: number;
|
|
200
|
+
/** 选择如何渲染相应的模式 */
|
|
201
|
+
valueType?: ProSchemaValueType<ValueType>;
|
|
202
|
+
/** valueType为date|dateMonth|dateRange|time生效 */
|
|
203
|
+
valueFormat?: ProFieldValueFormat;
|
|
204
|
+
placeholder?: string | string[];
|
|
205
|
+
/** valueType为select生效 */
|
|
206
|
+
allowClear?: boolean;
|
|
207
|
+
/** valueType为select生效 */
|
|
208
|
+
showSearch?: boolean;
|
|
209
|
+
/** valueType为date生效 */
|
|
210
|
+
showToday?: boolean;
|
|
211
|
+
/** valueType为dateRange生效 */
|
|
212
|
+
rangeStartName?: string;
|
|
213
|
+
/** valueType为dateRange生效 */
|
|
214
|
+
rangeEndName?: string;
|
|
215
|
+
/** valueType为time生效 */
|
|
216
|
+
use12Hours?: boolean;
|
|
217
|
+
/** valueType为select生效 */
|
|
218
|
+
loading?: boolean;
|
|
219
|
+
/** valueType为date、dateRange生效 */
|
|
220
|
+
showTime?: RecordType | boolean;
|
|
221
|
+
/** 搜索表单的默认值 */
|
|
222
|
+
initialValue?: any;
|
|
223
|
+
/** 针对select、treeselect、cascader取值的key */
|
|
224
|
+
valueKey?: string;
|
|
225
|
+
/** 远程查询数据 */
|
|
226
|
+
request?: {
|
|
227
|
+
fetch?: () => Promise<ProSchemaValueEnumType[]>;
|
|
228
|
+
manual?: boolean;
|
|
229
|
+
debounceTime?: number;
|
|
230
|
+
};
|
|
231
|
+
/** 查询表单label */
|
|
232
|
+
label?: string;
|
|
233
|
+
/** 查询表单label - 宽度 */
|
|
234
|
+
labelWidth?: string | number;
|
|
235
|
+
/** 查询表单label - 对齐方式 */
|
|
236
|
+
labelAlign?: 'center' | 'left' | 'right';
|
|
237
|
+
/** 表单的属性值(ant-design) */
|
|
238
|
+
field?: {
|
|
239
|
+
rules?: RegExp;
|
|
240
|
+
[key: string]: any;
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* 支持 object 和Map,Map 是支持其他基础类型作为 key
|
|
244
|
+
*
|
|
245
|
+
* @name 映射值的类型
|
|
246
|
+
*/
|
|
247
|
+
valueEnum?: ProSchemaValueEnumType[];
|
|
248
|
+
}
|
|
249
|
+
type ProColumnsValueType = 'text' | 'link' | 'time' | 'dateMonth' | 'dateTime' | 'date' | {
|
|
250
|
+
node?: string;
|
|
251
|
+
class?: string;
|
|
252
|
+
attr?: string;
|
|
253
|
+
click?: () => void;
|
|
254
|
+
};
|
|
255
|
+
type LooseAutocomplete<T> = T | (string & {});
|
|
256
|
+
type DataIndex<T> = LooseAutocomplete<keyof T | 'action'>;
|
|
257
|
+
type ColumnWithKeyOrDataIndex<T = any[]> = {
|
|
258
|
+
key: DataIndex<T>;
|
|
259
|
+
dataIndex?: DataIndex<T>;
|
|
260
|
+
} | {
|
|
261
|
+
key?: DataIndex<T>;
|
|
262
|
+
dataIndex: DataIndex<T>;
|
|
263
|
+
};
|
|
264
|
+
interface DefaultProColumn {
|
|
265
|
+
uuid?: string | number;
|
|
266
|
+
align?: AlignType;
|
|
267
|
+
fixed?: boolean | 'right' | 'left' | 'start' | 'end';
|
|
268
|
+
width?: number | string;
|
|
269
|
+
}
|
|
270
|
+
type DefaultProColumnWithKeyOrDataIndex<T = any[]> = DefaultProColumn & ColumnWithKeyOrDataIndex<T>;
|
|
271
|
+
type ProColumn<T = undefined, R = any[]> = T extends undefined ? DefaultProColumnWithKeyOrDataIndex<R> : DefaultProColumnWithKeyOrDataIndex<R> & T;
|
|
272
|
+
interface ProTableIndexColumn {
|
|
273
|
+
title?: CustomRender;
|
|
274
|
+
width?: number | string;
|
|
275
|
+
align?: AlignType;
|
|
276
|
+
fixed?: DefaultProColumn['fixed'];
|
|
277
|
+
}
|
|
278
|
+
interface ProTableScrollPolicy {
|
|
279
|
+
mode?: 'auto' | 'manual' | 'disabled';
|
|
280
|
+
breakpoint?: Breakpoint | number;
|
|
281
|
+
modal?: boolean;
|
|
282
|
+
modalY?: number | {
|
|
283
|
+
desktop?: number;
|
|
284
|
+
mobile?: number;
|
|
285
|
+
};
|
|
286
|
+
actionFixed?: boolean | 'auto';
|
|
287
|
+
}
|
|
288
|
+
type ProColumnType<DataValue = RecordType, SearchParams = RecordType> = ProColumn<Omit<ColumnType<DataValue>, keyof DefaultProColumnWithKeyOrDataIndex> & {
|
|
289
|
+
children?: ProColumnType<DataValue, SearchParams>[];
|
|
290
|
+
index?: number;
|
|
291
|
+
copyText?: string | ((record: ProColumnType) => string);
|
|
292
|
+
tooltip?: false | (TooltipProps & {
|
|
293
|
+
width?: number;
|
|
294
|
+
targetStyle?: Partial<CSSProperties>;
|
|
295
|
+
hiddenLine?: number;
|
|
296
|
+
class?: string;
|
|
297
|
+
}); /** 不在列表中显示 */
|
|
298
|
+
show?: boolean; /** 列表顺序值 */
|
|
299
|
+
order?: number; /** 表单搜索配置 */
|
|
300
|
+
searchConfig?: ProSearchMap<undefined, keyof DataValue | keyof SearchParams>; /** 是否拷贝 */
|
|
301
|
+
copyable?: boolean; /** 值为空时,默认取值 */
|
|
302
|
+
columnEmptyText?: string | ((record: DataValue) => string);
|
|
303
|
+
valueType?: ProColumnsValueType;
|
|
304
|
+
}, DataValue>;
|
|
305
|
+
type OmitTableKey = 'columns' | 'dataSource' | 'rowKey' | 'align' | 'pagination' | 'onChange';
|
|
306
|
+
interface ProTableProps<DataRecord = RecordType, ParamsType = RecordType> extends Omit<TableProps<DataRecord>, OmitTableKey> {
|
|
307
|
+
/**
|
|
308
|
+
* table loading 状态
|
|
309
|
+
*/
|
|
310
|
+
loading?: boolean | SpinProps;
|
|
311
|
+
/**
|
|
312
|
+
* table 唯一字段
|
|
313
|
+
*/
|
|
314
|
+
rowKey?: keyof DataRecord;
|
|
315
|
+
/**
|
|
316
|
+
* table 列相关属性
|
|
317
|
+
*/
|
|
318
|
+
columns?: ProColumnType<DataRecord, ParamsType>[];
|
|
319
|
+
/**
|
|
320
|
+
* 自动序号列配置。true 使用默认序号列,对象可覆盖列标题、宽度、对齐和 fixed。
|
|
321
|
+
*/
|
|
322
|
+
indexColumn?: boolean | ProTableIndexColumn;
|
|
323
|
+
/**
|
|
324
|
+
* 表格滚动策略。false 等价于 disabled;disabled 禁用自动滚动和 action 自动固定。
|
|
325
|
+
*/
|
|
326
|
+
scrollPolicy?: false | ProTableScrollPolicy;
|
|
327
|
+
/**
|
|
328
|
+
* fitPage 适配页面高度,使其表格占据一屏
|
|
329
|
+
*/
|
|
330
|
+
fitPage?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* table 数据源
|
|
333
|
+
*/
|
|
334
|
+
dataSource?: DataRecord[];
|
|
335
|
+
/**
|
|
336
|
+
* table 样式 class 语义
|
|
337
|
+
*/
|
|
338
|
+
proClasses?: ProTableClassNamesType;
|
|
339
|
+
/**
|
|
340
|
+
* table 样式 style 语义
|
|
341
|
+
*/
|
|
342
|
+
proStyles?: ProTableStylesType;
|
|
343
|
+
/**
|
|
344
|
+
* table 展示卡片
|
|
345
|
+
*/
|
|
346
|
+
cardBordered?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* table 列对齐方式
|
|
349
|
+
*/
|
|
350
|
+
align?: ProColumnType['align'];
|
|
351
|
+
/**
|
|
352
|
+
* table 等待请求控制
|
|
353
|
+
*/
|
|
354
|
+
waitRequest?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* table 轮询
|
|
357
|
+
*/
|
|
358
|
+
polling?: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* table 轮询时间
|
|
361
|
+
*/
|
|
362
|
+
pollingTime?: number;
|
|
363
|
+
/**
|
|
364
|
+
* table 请求函数
|
|
365
|
+
*/
|
|
366
|
+
request?: RequestFunction<DataRecord, ParamsType>;
|
|
367
|
+
/**
|
|
368
|
+
* table 是否立刻发送请求
|
|
369
|
+
*/
|
|
370
|
+
immediate?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* table 自动请求
|
|
373
|
+
*/
|
|
374
|
+
autoRequest?: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* table 防抖时间
|
|
377
|
+
*/
|
|
378
|
+
debounceTime?: number;
|
|
379
|
+
/**
|
|
380
|
+
* table 是否显示 loading
|
|
381
|
+
*/
|
|
382
|
+
showLoading?: boolean;
|
|
383
|
+
/**
|
|
384
|
+
* table 搜索参数
|
|
385
|
+
*/
|
|
386
|
+
params?: ParamsType;
|
|
387
|
+
/**
|
|
388
|
+
* table 请求结果处理
|
|
389
|
+
*/
|
|
390
|
+
postData?: (data: DataRecord[]) => DataRecord[];
|
|
391
|
+
/**
|
|
392
|
+
* table 搜索表单配置
|
|
393
|
+
*/
|
|
394
|
+
form?: FormConfig | false;
|
|
395
|
+
/**
|
|
396
|
+
* table 搜索表单项配置
|
|
397
|
+
*/
|
|
398
|
+
searchMap?: ProSearchMap<undefined, keyof ParamsType | keyof DataRecord>[];
|
|
399
|
+
/**
|
|
400
|
+
* table 分页配置
|
|
401
|
+
*/
|
|
402
|
+
pagination?: ProTablePagination;
|
|
403
|
+
onChange?: (pagination: ProTablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<DataRecord> | SorterResult<DataRecord>[], extra: TableCurrentDataSource<DataRecord>) => void;
|
|
404
|
+
onReset?: (params?: Partial<ParamsType>) => void;
|
|
405
|
+
onReload?: (params?: Partial<ParamsType>) => void;
|
|
406
|
+
onSubmit?: (params?: Partial<ParamsType>) => void;
|
|
407
|
+
onLoadingChange?: (loading: boolean) => any;
|
|
408
|
+
onRequestError?: (e: Error) => void;
|
|
409
|
+
onSizeChange?: (size: ProTableSizeType) => void;
|
|
410
|
+
onBeforeSearchSubmit?: BeforeSearchSubmit<ParamsType>;
|
|
411
|
+
/** 列宽拖拽调整完成回调 */
|
|
412
|
+
onResizeColumn?: (width: number, column: ProColumnType<DataRecord>) => void;
|
|
413
|
+
/** 启用列宽拖拽调整 */
|
|
414
|
+
draggable?: boolean;
|
|
415
|
+
/**
|
|
416
|
+
* keep-alive 页面重新进入时是否触发数据请求
|
|
417
|
+
*/
|
|
418
|
+
keepAliveReload?: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* 全局空值默认显示文本,可被 column.columnEmptyText 覆盖
|
|
421
|
+
*/
|
|
422
|
+
columnEmptyText?: string | ((record: DataRecord) => string);
|
|
423
|
+
/**
|
|
424
|
+
* 工具栏选项配置,设为 false 时不显示
|
|
425
|
+
*/
|
|
426
|
+
options?: ToolbarOptionConfig | false;
|
|
427
|
+
/**
|
|
428
|
+
* 标题提示文案
|
|
429
|
+
*/
|
|
430
|
+
titleTipText?: string;
|
|
431
|
+
/**
|
|
432
|
+
* 操作按钮配置
|
|
433
|
+
*/
|
|
434
|
+
actionProps?: {
|
|
435
|
+
placement?: ToolbarPlacement;
|
|
436
|
+
actions?: DefaultRender[];
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* 全屏状态变化回调
|
|
440
|
+
*/
|
|
441
|
+
onFullscreenChange?: (isFullscreen: boolean) => void;
|
|
442
|
+
emptyText?: DefaultRender;
|
|
443
|
+
headerTitle?: DefaultRender;
|
|
444
|
+
headerTitleTip?: DefaultRender;
|
|
445
|
+
listToolAfter?: DefaultRender;
|
|
446
|
+
customRender?: CustomDataRender;
|
|
447
|
+
pageItemRender?: PageItemRender;
|
|
448
|
+
}
|
|
449
|
+
interface ProTableBodyCellProps<T = any> {
|
|
450
|
+
text: any;
|
|
451
|
+
value: any;
|
|
452
|
+
record: T;
|
|
453
|
+
index: number;
|
|
454
|
+
column: ProColumnType<T>;
|
|
455
|
+
}
|
|
456
|
+
interface ProTableCustomProps<T = any> {
|
|
457
|
+
currentData: T[];
|
|
458
|
+
dataSource: T[];
|
|
459
|
+
}
|
|
460
|
+
interface ProTableSlots<DataRecord = any> extends Omit<TableSlots<DataRecord>, 'bodyCell' | 'headerCell'> {
|
|
461
|
+
form?: () => any;
|
|
462
|
+
actions?: () => any;
|
|
463
|
+
headerTitle?: () => any;
|
|
464
|
+
headerTitleTip?: () => any;
|
|
465
|
+
listToolAfter?: () => any;
|
|
466
|
+
pageItemRender?: (params: {
|
|
467
|
+
page: number;
|
|
468
|
+
type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next';
|
|
469
|
+
originalElement: any;
|
|
470
|
+
}) => any;
|
|
471
|
+
customRender?: (params: ProTableCustomProps<DataRecord>) => any;
|
|
472
|
+
bodyCell?: (props: ProTableBodyCellProps<DataRecord>) => any;
|
|
473
|
+
headerCell?: (props: {
|
|
474
|
+
column: ProColumnType<DataRecord>;
|
|
475
|
+
index: number;
|
|
476
|
+
text: any;
|
|
477
|
+
}) => any;
|
|
478
|
+
}
|
|
479
|
+
type ProTableSizeType = 'small' | 'medium' | 'middle' | 'large';
|
|
480
|
+
interface ProTableEmits<DataRecord = RecordType, ParamsType = RecordType> extends Omit<TableEmits<DataRecord>, 'change'> {
|
|
481
|
+
'change': ProTableProps<DataRecord, ParamsType>['onChange'];
|
|
482
|
+
'reset': ProTableProps<DataRecord, ParamsType>['onReset'];
|
|
483
|
+
'reload': ProTableProps<DataRecord, ParamsType>['onReload'];
|
|
484
|
+
'submit': ProTableProps<DataRecord, ParamsType>['onSubmit'];
|
|
485
|
+
'loadingChange': ProTableProps<DataRecord, ParamsType>['onLoadingChange'];
|
|
486
|
+
'requestError': ProTableProps<DataRecord, ParamsType>['onRequestError'];
|
|
487
|
+
'sizeChange': ProTableProps<DataRecord, ParamsType>['onSizeChange'];
|
|
488
|
+
'resizeColumn': ProTableProps<DataRecord, ParamsType>['onResizeColumn'];
|
|
489
|
+
'fullscreenChange': ProTableProps<DataRecord, ParamsType>['onFullscreenChange'];
|
|
490
|
+
}
|
|
491
|
+
//#endregion
|
|
492
|
+
export { BeforeSearchSubmit, ColConfig, ColumnWithKeyOrDataIndex, CustomDataFn, CustomDataRender, CustomRenderResult, DefaultProColumn, DefaultProColumnWithKeyOrDataIndex, DefaultRender, FormConfig, OperateRowProps, PageItemFn, PageItemRender, PageState, ProColumn, ProColumnType, ProColumnsValueType, ProCoreActionType, ProFieldValueFormat, ProFieldValueType, ProSchemaValueEnumType, ProSearchMap, ProTableBodyCellProps, ProTableClassNamesType, ProTableCustomProps, ProTableEmits, ProTableFetchParams, ProTableIndexColumn, ProTablePagination, ProTablePaginationConfig, ProTableProps, ProTableRef, ProTableScrollPolicy, ProTableSizeType, ProTableSlots, ProTableStylesType, RequestConfig, RequestData, RequestFunction, RowSelectionActions, TableSemanticName, TableSorterRecord, ToolbarOptionConfig, ToolbarPlacement };
|