提交 | 用户 | age
|
8b3a4d
|
1 |
import type { PropType } from 'vue'; |
V |
2 |
import type { PaginationProps } from './types/pagination'; |
491ba9
|
3 |
import type { |
2407b3
|
4 |
BasicColumn, |
V |
5 |
FetchSetting, |
|
6 |
TableSetting, |
491ba9
|
7 |
SorterResult, |
V |
8 |
TableCustomRecord, |
|
9 |
TableRowSelection, |
2407b3
|
10 |
} from './types/table'; |
ecfb70
|
11 |
import type { FormProps } from '/@/components/Form'; |
9c2f3f
|
12 |
import { DEFAULT_FILTER_FN, DEFAULT_SORT_FN, FETCH_SETTING } from './const'; |
08df19
|
13 |
import { propTypes } from '/@/utils/propTypes'; |
faf3f4
|
14 |
|
陈 |
15 |
export const basicProps = { |
354904
|
16 |
clickToRowSelect: propTypes.bool.def(true), |
5c2735
|
17 |
isTreeTable: propTypes.bool.def(false), |
391da9
|
18 |
tableSetting: propTypes.shape<TableSetting>({}), |
08df19
|
19 |
inset: propTypes.bool, |
491ba9
|
20 |
sortFn: { |
36a7e7
|
21 |
type: Function as PropType<(sortInfo: SorterResult) => any>, |
491ba9
|
22 |
default: DEFAULT_SORT_FN, |
V |
23 |
}, |
9c2f3f
|
24 |
filterFn: { |
V |
25 |
type: Function as PropType<(data: Partial<Recordable<string[]>>) => any>, |
|
26 |
default: DEFAULT_FILTER_FN, |
|
27 |
}, |
08df19
|
28 |
showTableSetting: propTypes.bool, |
V |
29 |
autoCreateKey: propTypes.bool.def(true), |
|
30 |
striped: propTypes.bool.def(true), |
|
31 |
showSummary: propTypes.bool, |
faf3f4
|
32 |
summaryFunc: { |
陈 |
33 |
type: [Function, Array] as PropType<(...arg: any[]) => any[]>, |
|
34 |
default: null, |
|
35 |
}, |
8d7d08
|
36 |
summaryData: { |
V |
37 |
type: Array as PropType<Recordable[]>, |
|
38 |
default: null, |
|
39 |
}, |
9a1ba7
|
40 |
indentSize: propTypes.number.def(24), |
08df19
|
41 |
canColDrag: propTypes.bool.def(true), |
faf3f4
|
42 |
api: { |
陈 |
43 |
type: Function as PropType<(...arg: any[]) => Promise<any>>, |
|
44 |
default: null, |
|
45 |
}, |
|
46 |
beforeFetch: { |
|
47 |
type: Function as PropType<Fn>, |
|
48 |
default: null, |
|
49 |
}, |
|
50 |
afterFetch: { |
|
51 |
type: Function as PropType<Fn>, |
|
52 |
default: null, |
|
53 |
}, |
|
54 |
handleSearchInfoFn: { |
|
55 |
type: Function as PropType<Fn>, |
|
56 |
default: null, |
|
57 |
}, |
|
58 |
fetchSetting: { |
|
59 |
type: Object as PropType<FetchSetting>, |
|
60 |
default: () => { |
|
61 |
return FETCH_SETTING; |
|
62 |
}, |
|
63 |
}, |
|
64 |
// 立即请求接口 |
08df19
|
65 |
immediate: propTypes.bool.def(true), |
V |
66 |
emptyDataIsShowTable: propTypes.bool.def(true), |
faf3f4
|
67 |
// 额外的请求参数 |
陈 |
68 |
searchInfo: { |
8d7d08
|
69 |
type: Object as PropType<Recordable>, |
faf3f4
|
70 |
default: null, |
陈 |
71 |
}, |
|
72 |
// 使用搜索表单 |
08df19
|
73 |
useSearchForm: propTypes.bool, |
faf3f4
|
74 |
// 表单配置 |
陈 |
75 |
formConfig: { |
|
76 |
type: Object as PropType<Partial<FormProps>>, |
|
77 |
default: null, |
|
78 |
}, |
|
79 |
columns: { |
|
80 |
type: [Array] as PropType<BasicColumn[]>, |
116a1f
|
81 |
default: () => [], |
faf3f4
|
82 |
}, |
08df19
|
83 |
showIndexColumn: propTypes.bool.def(true), |
faf3f4
|
84 |
indexColumnProps: { |
陈 |
85 |
type: Object as PropType<BasicColumn>, |
|
86 |
default: null, |
|
87 |
}, |
|
88 |
actionColumn: { |
|
89 |
type: Object as PropType<BasicColumn>, |
|
90 |
default: null, |
|
91 |
}, |
08df19
|
92 |
ellipsis: propTypes.bool.def(true), |
V |
93 |
canResize: propTypes.bool.def(true), |
|
94 |
clearSelectOnPageChange: propTypes.bool, |
|
95 |
resizeHeightOffset: propTypes.number.def(0), |
faf3f4
|
96 |
rowSelection: { |
2407b3
|
97 |
type: Object as PropType<TableRowSelection | null>, |
faf3f4
|
98 |
default: null, |
陈 |
99 |
}, |
|
100 |
title: { |
116a1f
|
101 |
type: [String, Function] as PropType<string | ((data: Recordable) => string)>, |
faf3f4
|
102 |
default: null, |
陈 |
103 |
}, |
|
104 |
titleHelpMessage: { |
|
105 |
type: [String, Array] as PropType<string | string[]>, |
|
106 |
}, |
08df19
|
107 |
maxHeight: propTypes.number, |
faf3f4
|
108 |
dataSource: { |
08df19
|
109 |
type: Array as PropType<Recordable[]>, |
faf3f4
|
110 |
default: null, |
陈 |
111 |
}, |
|
112 |
rowKey: { |
08df19
|
113 |
type: [String, Function] as PropType<string | ((record: Recordable) => string)>, |
faf3f4
|
114 |
default: '', |
陈 |
115 |
}, |
08df19
|
116 |
bordered: propTypes.bool, |
faf3f4
|
117 |
pagination: { |
陈 |
118 |
type: [Object, Boolean] as PropType<PaginationProps | boolean>, |
|
119 |
default: null, |
|
120 |
}, |
08df19
|
121 |
loading: propTypes.bool, |
faf3f4
|
122 |
rowClassName: { |
陈 |
123 |
type: Function as PropType<(record: TableCustomRecord<any>, index: number) => string>, |
|
124 |
}, |
|
125 |
scroll: { |
|
126 |
type: Object as PropType<{ x: number | true; y: number }>, |
|
127 |
default: null, |
|
128 |
}, |
2c867b
|
129 |
beforeEditSubmit: { |
无 |
130 |
type: Function as PropType< |
|
131 |
(data: { |
|
132 |
record: Recordable; |
|
133 |
index: number; |
|
134 |
key: string | number; |
|
135 |
value: any; |
|
136 |
}) => Promise<any> |
|
137 |
>, |
|
138 |
}, |
faf3f4
|
139 |
}; |