table.d.ts
5.63 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
import { ElementUIComponent } from './component'
import { TooltipEffect } from './tooltip'
export type SortOrder = 'ascending' | 'descending'
/** Options to set the default sort column and order */
export interface DefaultSortOptions {
/** Default sort column */
prop: string,
/** Default sort order */
order: SortOrder
}
export interface SummaryMethodParams {
columns: object[],
data: object
}
export interface rowCallbackParams {
row: object,
rowIndex: number
}
export interface cellCallbackParams {
row: object,
rowIndex: number,
column: object,
columnIndex: number
}
export interface treeNode {
rowKey: string | number,
isLeaf: boolean,
level: number,
expanded: boolean,
loaded: boolean
}
/** Table Component */
export declare class ElTable extends ElementUIComponent {
/** Table data */
data: object[]
/** Table's height. By default it has an auto height. If its value is a number, the height is measured in pixels; if its value is a string, the height is affected by external styles */
height: string | number
/** Table's max-height. The height of the table starts from auto until it reaches the maxHeight limit. The maxHeight is measured in pixels, same as height */
maxHeight: string | number
/** Whether table is striped */
stripe: boolean
/** Whether table has vertical border */
border: boolean
/** Whether width of column automatically fits its container */
fit: boolean
/** Whether table header is visible */
showHeader: boolean
/** Whether current row is highlighted */
highlightCurrentRow: boolean
/** Key of current row, a set only prop */
currentRowKey: string | number
/** Whether to lazy load tree structure data, used with load attribute */
lazy: boolean
/** Horizontal indentation of nodes in adjacent levels in pixels */
indent: number
/** Function that returns custom class names for a row, or a string assigning class names for every row */
rowClassName: string | ((param: rowCallbackParams) => string)
/** Function that returns custom style for a row, or an object assigning custom style for every row */
rowStyle: object | ((param: rowCallbackParams) => object)
/** Function that returns custom class names for a cell, or a string assigning class names for every cell */
cellClassName: string | ((param: cellCallbackParams) => string)
/** Function that returns custom style for a cell, or an object assigning custom style for every cell */
cellStyle: object | ((param: cellCallbackParams) => object)
/** Function that returns custom class names for a row in table header, or a string assigning class names for every row in table header */
headerRowClassName: string | ((param: rowCallbackParams) => string)
/** Function that returns custom style for a row in table header, or an object assigning custom style for every row in table header */
headerRowStyle: object | ((param: rowCallbackParams) => object)
/** Function that returns custom class names for a cell in table header, or a string assigning class names for every cell in table header */
headerCellClassName: string | ((param: cellCallbackParams) => string)
/** Function that returns custom style for a cell in table header, or an object assigning custom style for every cell in table header */
headerCellStyle: object | ((param: cellCallbackParams) => object)
/** Key of row data, used for optimizing rendering. Required if reserve-selection is on */
rowKey: (row: object) => any
/** Displayed text when data is empty. You can customize this area with `slot="empty"` */
emptyText: String
/** Whether expand all rows by default. Only works when the table has a column `type="expand"` */
defaultExpandAll: Boolean
/** Set expanded rows by this prop. Prop's value is the keys of expand rows, you should set row-key before using this prop */
expandRowKeys: any[]
/** Set the default sort column and order */
defaultSort: DefaultSortOptions
/** Tooltip effect property */
tooltipEffect: TooltipEffect
/** Whether to display a summary row */
showSummary: boolean
/** Displayed text for the first column of summary row */
sumText: string
/** Custom summary method */
summaryMethod: (param: SummaryMethodParams) => any[]
/** Controls the behavior of master checkbox in multi-select tables when only some rows are selected */
selectOnIndeterminate: boolean
/** Clear selection. Might be useful when `reserve-selection` is on */
clearSelection (): void
/**
* Toggle or set if a certain row is selected
*
* @param row The row that is going to set its selected state
* @param selected Whether the row is selected. The selected state will be toggled if not set
*/
toggleRowSelection (row: object, selected?: boolean): void
/**
* Toggle or set all rows
*/
toggleAllSelection (): void
/**
* Set a certain row as selected
*
* @param row The row that is going to set as selected
*/
setCurrentRow (row?: object): void
/**
* Toggle or set if a certain row is expanded
*
* @param row The row that is going to set its expanded state
* @param expanded Whether the row is expanded. The expanded state will be toggled if not set
*/
toggleRowExpansion (row: object, expanded?: boolean): void
/** Clear sort status, reset the table to unsorted */
clearSort (): void
/** Clear filter, reset the table to unfiltered */
clearFilter (): void
/** Relayout the table, maybe needed when change the table or it's ancestors visibility */
doLayout (): void
/** Sort Table manually */
sort (prop: string, order: string): void
/** method for lazy load subtree data */
load (row: object, treeNode: treeNode, resolve: Function): void
}