-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathel-data-table.d.ts
More file actions
186 lines (161 loc) · 4.38 KB
/
el-data-table.d.ts
File metadata and controls
186 lines (161 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import Vue, {VueConstructor, VNode} from 'vue'
import {AxiosRequestConfig} from 'axios'
import {Table,Form, Dialog} from '@femessage/types/element-ui'
import {TableColumn} from '@femessage/types/element-ui/table-column'
declare module '@femessage/el-data-table' {
class FemessageComponent extends Vue {
static install(vue: typeof Vue): void
}
type CombinedVueInstance<
Instance extends Vue,
Data,
Methods,
Computed,
Props
> = Data & Methods & Computed & Props & Instance
type ExtendedVue<
Instance extends Vue,
Data,
Methods,
Computed,
Props
> = VueConstructor<
CombinedVueInstance<Instance, Data, Methods, Computed, Props> & Vue
>
type Combined<Data, Methods, Computed, Props> = Data &
Methods &
Computed &
Props
type ElDataTableData = {
data: any[]
size: number
page: number
total: null | number
loading: boolean
selected: any[]
row: any
initExtraQuery: any
isSearchCollapse: boolean
showNoData: boolean
}
type ElDataTableMethods = {
getList: ({loading}?: {loading?: boolean}) => void
resetSearch: () => void
toggleRowSelection: (row: any, isSelected?: boolean) => any
clearSelection: () => void
onDefaultDelete: (data: any) => void
correctPage: () => void
}
type ElDataTableComputed = {
tableEventHandlersInner: any
hasSelect: boolean
selectable: () => boolean
columnsAlign: string
routerMode: string
hasSearchForm: boolean
hasHeader: boolean
_extraBody: object
_extraQuery: object
selectStrategy: any
searchLocatedSlotKeys: any
collapseForm: any
_searchForm: any
}
export interface FormContentItem {
id: string
label?: string | VNode
[key: string]: any
}
export type FormContent = Array<FormContentItem>
export interface DataTableColumn {
label: string
prop: string
formatter?: (row: any, column: TableColumn) => any
[key: string]: any
}
export type DataTableColumns = Array<DataTableColumn>
export type OperationButton = {
type?: string
text: string
atClick: (row: any) => Promise<any>
show?: (row: any) => boolean
disabled?: (row: any) => boolean
}
export type OperationButtons = OperationButton[]
// props 都有默认值,都是可选的
export type ElDataTableProps = Partial<{
url: string
id: string
firstPage: number
dataPath: string
totalPath: string
pageKey: string
pageSizeKey: string
columns: DataTableColumns
searchForm: FormContent
canSearchCollapse: boolean
beforeSearch: (formValue: any) => any
single: boolean
persistSelection: boolean
hasOperation: boolean
extraButtons: OperationButtons
headerButtons: OperationButtons
hasNew: boolean
hasEdit: boolean
hasView: boolean
hasDelete: boolean
newText: string
editText: string
viewText: string
deleteText: string
deleteMessage: (data: any) => string
canDelete: (row: any) => boolean
onNew: (data: any, row?: any) => Promise<any>
onEdit: (data: any, row: any) => Promise<any>
onDelete: (data: any) => Promise<any>
onSuccess: (type: 'new' | 'edit' | 'delete', data: any) => Promise<any>
hasPagination: boolean
paginationLayout: string
paginationSizes: number[]
paginationSize: number
noPaginationSize: number
isTree: boolean
treeChildKey: string
treeParentKey: string
treeParentValue: string
expandAll: boolean
tableAttrs: Partial<Table>
tableEventHandlers: object
operationAttrs: object
dialogNewTitle: string
dialogEditTitle: string
dialogViewTitle: string
form: FormContent
formAttrs: Partial<Form>
dialogAttrs: Partial<Dialog>
extraParams: object
extraBody: object
beforeConfirm: (data: any, isNew: boolean) => Promise<any>
customQuery: object
extraQuery: object
saveQuery: boolean
operationButtonType: string
buttonSize: string
axiosConfig: AxiosRequestConfig
}>
type ElDataTable = Combined<
ElDataTableData,
ElDataTableMethods,
ElDataTableComputed,
Required<ElDataTableProps>
>
export interface ElDataTableType extends FemessageComponent, ElDataTable {}
const ElDataTableConstruction: ExtendedVue<
Vue,
ElDataTableData,
ElDataTableMethods,
ElDataTableComputed,
Required<ElDataTableProps>
>
export default ElDataTableConstruction
}