1
1
import * as React from 'react' ;
2
2
import { CSSProperties } from 'styled-components' ;
3
3
4
- export interface IDataTableProps < T = any > {
5
- title ?: React . ReactNode ;
6
- columns : IDataTableColumn < T > [ ] ;
7
- data : T [ ] ;
8
- keyField ?: string ;
9
- striped ?: boolean ;
10
- highlightOnHover ?: boolean ;
11
- pointerOnHover ?: boolean ;
12
- noDataComponent ?: React . ReactNode ;
13
- className ?: string ;
14
- style ?: CSSProperties ;
15
- responsive ?: boolean ;
16
- disabled ?: boolean ;
17
- onRowClicked ?: ( row : T , e : MouseEvent ) => void ;
18
- onRowDoubleClicked ?: ( row : T , e : MouseEvent ) => void ;
19
- overflowY ?: boolean ;
20
- overflowYOffset ?: string ;
21
- dense ?: boolean ;
22
- noTableHead ?: boolean ;
23
- defaultSortField ?: string ;
24
- defaultSortAsc ?: boolean ;
25
- sortIcon ?: React . ReactNode ;
26
- onSort ?: (
27
- column : IDataTableColumn < T > ,
28
- sortDirection : 'asc' | 'desc'
29
- ) => void ;
30
- sortFunction ?: (
31
- rows : T [ ] ,
32
- field : string ,
33
- sortDirection : 'asc' | 'desc'
34
- ) => T [ ] ;
35
- sortServer ?: boolean ;
36
- pagination ?: boolean ;
37
- paginationServer ?: boolean ;
38
- paginationServerOptions ?: {
39
- persistSelectedOnSort ?: boolean ;
40
- persistSelectedOnPageChange ?: boolean ;
41
- } ;
42
- paginationDefaultPage ?: number ;
43
- paginationResetDefaultPage ?: boolean ;
44
- paginationTotalRows ?: number ;
45
- paginationPerPage ?: number ;
46
- paginationRowsPerPageOptions ?: number [ ] ;
47
- paginationComponentOptions ?: IDataTablePaginationOptions ;
48
- onChangeRowsPerPage ?: (
49
- currentRowsPerPage : number ,
50
- currentPage : number
51
- ) => void ;
52
- onChangePage ?: ( page : number , totalRows : number ) => void ;
53
- paginationComponent ?: React . ReactNode ;
54
- paginationIconFirstPage ?: React . ReactNode ;
55
- paginationIconLastPage ?: React . ReactNode ;
56
- paginationIconNext ?: React . ReactNode ;
57
- paginationIconPrevious ?: React . ReactNode ;
58
- progressPending ?: boolean ;
59
- persistTableHead ?: boolean ;
60
- progressComponent ?: React . ReactNode ;
61
- expandableRows ?: boolean ;
62
- expandableRowsComponent ?: React . ReactNode ;
63
- expandOnRowClicked ?: boolean ;
64
- expandOnRowDoubleClicked ?: boolean ;
65
- expandableRowsHideExpander ?: boolean ;
66
- onRowExpandToggled ?: ( expanded : boolean , row : T ) => void ;
67
- expandableRowExpanded ?: ( row : T ) => boolean ;
68
- expandableRowDisabled ?: ( row : T ) => boolean ;
69
- expandableIcon ?: IExpandableIcon ;
70
- expandableInheritConditionalStyles ?: boolean ;
71
- selectableRows ?: boolean ;
72
- selectableRowsComponent ?: React . ReactNode ;
73
- selectableRowsComponentProps ?: { } ;
74
- selectableRowsHighlight ?: boolean ;
75
- selectableRowsVisibleOnly ?: boolean ;
76
- selectableRowSelected ?: ( row : T ) => boolean ;
77
- selectableRowDisabled ?: ( row : T ) => boolean ;
78
- selectableRowsNoSelectAll ?: boolean ;
79
- clearSelectedRows ?: boolean ;
80
- onSelectedRowsChange ?: ( selectedRowState : {
81
- allSelected : boolean ;
82
- selectedCount : number ;
83
- selectedRows : T [ ] ;
84
- } ) => void ;
85
- actions ?: React . ReactNode | React . ReactNode [ ] ;
86
- noContextMenu ?: boolean ;
87
- contextMessage ?: IContextMessage ;
88
- contextActions ?: React . ReactNode | React . ReactNode [ ] ;
89
- contextComponent ?: React . ReactNode ;
90
- noHeader ?: boolean ;
91
- fixedHeader ?: boolean ;
92
- fixedHeaderScrollHeight ?: string ;
93
- subHeader ?: React . ReactNode | React . ReactNode [ ] ;
94
- subHeaderAlign ?: string ;
95
- subHeaderWrap ?: boolean ;
96
- subHeaderComponent ?: React . ReactNode | React . ReactNode [ ] ;
97
- customStyles ?: IDataTableStyles ;
98
- theme ?: string ;
99
- conditionalRowStyles ?: IDataTableConditionalRowStyles < T > [ ] ;
100
- direction ?: 'ltr' | 'rtl' | 'auto' ;
4
+ export interface IDataTableConditionalCellStyles < T = any > {
5
+ when : ( row : T ) => boolean ;
6
+ style : CSSProperties ;
101
7
}
102
8
103
9
export interface IDataTableColumn < T = any > {
@@ -185,11 +91,6 @@ export interface IDataTableStyles {
185
91
} ;
186
92
}
187
93
188
- export interface IDataTableConditionalCellStyles < T = any > {
189
- when : ( row : T ) => boolean ;
190
- style : CSSProperties ;
191
- }
192
-
193
94
export interface IDataTableConditionalRowStyles < T = any > {
194
95
when : ( row : T ) => boolean ;
195
96
style : CSSProperties ;
@@ -214,6 +115,105 @@ export interface IContextMessage {
214
115
message : string ;
215
116
}
216
117
118
+ export interface IDataTableProps < T = any > {
119
+ title ?: React . ReactNode ;
120
+ columns : IDataTableColumn < T > [ ] ;
121
+ data : T [ ] ;
122
+ keyField ?: string ;
123
+ striped ?: boolean ;
124
+ highlightOnHover ?: boolean ;
125
+ pointerOnHover ?: boolean ;
126
+ noDataComponent ?: React . ReactNode ;
127
+ className ?: string ;
128
+ style ?: CSSProperties ;
129
+ responsive ?: boolean ;
130
+ disabled ?: boolean ;
131
+ onRowClicked ?: ( row : T , e : MouseEvent ) => void ;
132
+ onRowDoubleClicked ?: ( row : T , e : MouseEvent ) => void ;
133
+ overflowY ?: boolean ;
134
+ overflowYOffset ?: string ;
135
+ dense ?: boolean ;
136
+ noTableHead ?: boolean ;
137
+ defaultSortField ?: string ;
138
+ defaultSortAsc ?: boolean ;
139
+ sortIcon ?: React . ReactNode ;
140
+ onSort ?: (
141
+ column : IDataTableColumn < T > ,
142
+ sortDirection : 'asc' | 'desc'
143
+ ) => void ;
144
+ sortFunction ?: (
145
+ rows : T [ ] ,
146
+ field : string ,
147
+ sortDirection : 'asc' | 'desc'
148
+ ) => T [ ] ;
149
+ sortServer ?: boolean ;
150
+ pagination ?: boolean ;
151
+ paginationServer ?: boolean ;
152
+ paginationServerOptions ?: {
153
+ persistSelectedOnSort ?: boolean ;
154
+ persistSelectedOnPageChange ?: boolean ;
155
+ } ;
156
+ paginationDefaultPage ?: number ;
157
+ paginationResetDefaultPage ?: boolean ;
158
+ paginationTotalRows ?: number ;
159
+ paginationPerPage ?: number ;
160
+ paginationRowsPerPageOptions ?: number [ ] ;
161
+ paginationComponentOptions ?: IDataTablePaginationOptions ;
162
+ onChangeRowsPerPage ?: (
163
+ currentRowsPerPage : number ,
164
+ currentPage : number
165
+ ) => void ;
166
+ onChangePage ?: ( page : number , totalRows : number ) => void ;
167
+ paginationComponent ?: React . ReactNode ;
168
+ paginationIconFirstPage ?: React . ReactNode ;
169
+ paginationIconLastPage ?: React . ReactNode ;
170
+ paginationIconNext ?: React . ReactNode ;
171
+ paginationIconPrevious ?: React . ReactNode ;
172
+ progressPending ?: boolean ;
173
+ persistTableHead ?: boolean ;
174
+ progressComponent ?: React . ReactNode ;
175
+ expandableRows ?: boolean ;
176
+ expandableRowsComponent ?: React . ReactNode ;
177
+ expandOnRowClicked ?: boolean ;
178
+ expandOnRowDoubleClicked ?: boolean ;
179
+ expandableRowsHideExpander ?: boolean ;
180
+ onRowExpandToggled ?: ( expanded : boolean , row : T ) => void ;
181
+ expandableRowExpanded ?: ( row : T ) => boolean ;
182
+ expandableRowDisabled ?: ( row : T ) => boolean ;
183
+ expandableIcon ?: IExpandableIcon ;
184
+ expandableInheritConditionalStyles ?: boolean ;
185
+ selectableRows ?: boolean ;
186
+ selectableRowsComponent ?: React . ReactNode ;
187
+ selectableRowsComponentProps ?: any ;
188
+ selectableRowsHighlight ?: boolean ;
189
+ selectableRowsVisibleOnly ?: boolean ;
190
+ selectableRowSelected ?: ( row : T ) => boolean ;
191
+ selectableRowDisabled ?: ( row : T ) => boolean ;
192
+ selectableRowsNoSelectAll ?: boolean ;
193
+ clearSelectedRows ?: boolean ;
194
+ onSelectedRowsChange ?: ( selectedRowState : {
195
+ allSelected : boolean ;
196
+ selectedCount : number ;
197
+ selectedRows : T [ ] ;
198
+ } ) => void ;
199
+ actions ?: React . ReactNode | React . ReactNode [ ] ;
200
+ noContextMenu ?: boolean ;
201
+ contextMessage ?: IContextMessage ;
202
+ contextActions ?: React . ReactNode | React . ReactNode [ ] ;
203
+ contextComponent ?: React . ReactNode ;
204
+ noHeader ?: boolean ;
205
+ fixedHeader ?: boolean ;
206
+ fixedHeaderScrollHeight ?: string ;
207
+ subHeader ?: React . ReactNode | React . ReactNode [ ] ;
208
+ subHeaderAlign ?: string ;
209
+ subHeaderWrap ?: boolean ;
210
+ subHeaderComponent ?: React . ReactNode | React . ReactNode [ ] ;
211
+ customStyles ?: IDataTableStyles ;
212
+ theme ?: string ;
213
+ conditionalRowStyles ?: IDataTableConditionalRowStyles < T > [ ] ;
214
+ direction ?: 'ltr' | 'rtl' | 'auto' ;
215
+ }
216
+
217
217
export interface ITheme {
218
218
text : {
219
219
primary : string ;
0 commit comments