@@ -39,11 +39,60 @@ function buildSortProps(col, sortBy, onSort) {
39
39
}
40
40
41
41
export default class Table extends Component {
42
+
42
43
constructor ( props ) {
43
44
super ( props ) ;
44
45
this . _headers = [ ] ;
45
46
}
46
47
48
+ static defaultProps = {
49
+ buildRowOptions : ( ) => ( { } ) ,
50
+ sortBy : { } ,
51
+ } ;
52
+
53
+ static propTypes = {
54
+ keys : PropTypes . oneOfType ( [
55
+ PropTypes . arrayOf ( PropTypes . string ) ,
56
+ PropTypes . string ,
57
+ ] ) . isRequired ,
58
+
59
+ columns : PropTypes . arrayOf ( PropTypes . shape ( {
60
+ title : PropTypes . string . isRequired ,
61
+ prop : PropTypes . oneOfType ( [
62
+ PropTypes . string ,
63
+ PropTypes . number ,
64
+ ] ) ,
65
+ render : PropTypes . func ,
66
+ sortable : PropTypes . bool ,
67
+ defaultContent : PropTypes . string ,
68
+ width : PropTypes . oneOfType ( [
69
+ PropTypes . string ,
70
+ PropTypes . number ,
71
+ ] ) ,
72
+ className : PropTypes . oneOfType ( [
73
+ PropTypes . string ,
74
+ PropTypes . func ,
75
+ ] ) ,
76
+ } ) ) . isRequired ,
77
+
78
+ dataArray : PropTypes . arrayOf ( PropTypes . oneOfType ( [
79
+ PropTypes . array ,
80
+ PropTypes . object ,
81
+ ] ) ) . isRequired ,
82
+
83
+ buildRowOptions : PropTypes . func ,
84
+
85
+ sortBy : PropTypes . shape ( {
86
+ prop : PropTypes . oneOfType ( [
87
+ PropTypes . string ,
88
+ PropTypes . number ,
89
+ ] ) ,
90
+ order : PropTypes . oneOf ( [ 'ascending' , 'descending' ] ) ,
91
+ } ) ,
92
+
93
+ onSort : PropTypes . func ,
94
+ } ;
95
+
47
96
componentDidMount ( ) {
48
97
// If no width was specified, then set the width that the browser applied
49
98
// initially to avoid recalculating width between pages.
@@ -118,52 +167,3 @@ export default class Table extends Component {
118
167
}
119
168
120
169
}
121
-
122
-
123
- Table . defaultProps = {
124
- buildRowOptions : ( ) => ( { } ) ,
125
- sortBy : { } ,
126
- } ;
127
-
128
- Table . propTypes = {
129
- keys : PropTypes . oneOfType ( [
130
- PropTypes . arrayOf ( PropTypes . string ) ,
131
- PropTypes . string ,
132
- ] ) . isRequired ,
133
-
134
- columns : PropTypes . arrayOf ( PropTypes . shape ( {
135
- title : PropTypes . string . isRequired ,
136
- prop : PropTypes . oneOfType ( [
137
- PropTypes . string ,
138
- PropTypes . number ,
139
- ] ) ,
140
- render : PropTypes . func ,
141
- sortable : PropTypes . bool ,
142
- defaultContent : PropTypes . string ,
143
- width : PropTypes . oneOfType ( [
144
- PropTypes . string ,
145
- PropTypes . number ,
146
- ] ) ,
147
- className : PropTypes . oneOfType ( [
148
- PropTypes . string ,
149
- PropTypes . func ,
150
- ] ) ,
151
- } ) ) . isRequired ,
152
-
153
- dataArray : PropTypes . arrayOf ( PropTypes . oneOfType ( [
154
- PropTypes . array ,
155
- PropTypes . object ,
156
- ] ) ) . isRequired ,
157
-
158
- buildRowOptions : PropTypes . func ,
159
-
160
- sortBy : PropTypes . shape ( {
161
- prop : PropTypes . oneOfType ( [
162
- PropTypes . string ,
163
- PropTypes . number ,
164
- ] ) ,
165
- order : PropTypes . oneOf ( [ 'ascending' , 'descending' ] ) ,
166
- } ) ,
167
-
168
- onSort : PropTypes . func ,
169
- } ;
0 commit comments