@@ -15,9 +15,36 @@ import withRowExpansion from './row-expand/row-consumer';
15
15
class Body extends React . Component {
16
16
constructor ( props ) {
17
17
super ( props ) ;
18
- if ( props . cellEdit . createContext ) {
19
- this . EditingCell = props . cellEdit . createEditingCell ( _ , props . cellEdit . options . onStartEdit ) ;
18
+ const {
19
+ keyField,
20
+ visibleColumnSize,
21
+ cellEdit,
22
+ selectRow,
23
+ expandRow
24
+ } = props ;
25
+
26
+ // Construct Editing Cell Component
27
+ if ( cellEdit . createContext ) {
28
+ this . EditingCell = cellEdit . createEditingCell ( _ , cellEdit . options . onStartEdit ) ;
20
29
}
30
+
31
+ // Construct Row Component
32
+ let RowComponent = SimpleRow ;
33
+ const selectRowEnabled = selectRow . mode !== Const . ROW_SELECT_DISABLED ;
34
+ const expandRowEnabled = ! ! expandRow . renderer ;
35
+
36
+ if ( expandRowEnabled ) {
37
+ RowComponent = withRowExpansion ( RowAggregator , visibleColumnSize ) ;
38
+ }
39
+
40
+ if ( selectRowEnabled ) {
41
+ RowComponent = withRowSelection ( expandRowEnabled ? RowComponent : RowAggregator ) ;
42
+ }
43
+
44
+ if ( cellEdit . createContext ) {
45
+ RowComponent = cellEdit . withRowLevelCellEdit ( RowComponent , selectRowEnabled , keyField , _ ) ;
46
+ }
47
+ this . RowComponent = RowComponent ;
21
48
}
22
49
23
50
render ( ) {
@@ -46,21 +73,12 @@ class Body extends React.Component {
46
73
}
47
74
content = < RowSection content = { indication } colSpan = { visibleColumnSize } /> ;
48
75
} else {
49
- let RowComponent = SimpleRow ;
50
76
const selectRowEnabled = selectRow . mode !== Const . ROW_SELECT_DISABLED ;
51
77
const expandRowEnabled = ! ! expandRow . renderer ;
52
78
53
79
const additionalRowProps = { } ;
54
- if ( expandRowEnabled ) {
55
- RowComponent = withRowExpansion ( RowAggregator , visibleColumnSize ) ;
56
- }
57
-
58
- if ( selectRowEnabled ) {
59
- RowComponent = withRowSelection ( expandRowEnabled ? RowComponent : RowAggregator ) ;
60
- }
61
80
62
81
if ( cellEdit . createContext ) {
63
- RowComponent = cellEdit . withRowLevelCellEdit ( RowComponent , selectRowEnabled , keyField , _ ) ;
64
82
additionalRowProps . EditingCellComponent = this . EditingCell ;
65
83
}
66
84
@@ -88,7 +106,7 @@ class Body extends React.Component {
88
106
baseRowProps . style = _ . isFunction ( rowStyle ) ? rowStyle ( row , index ) : rowStyle ;
89
107
baseRowProps . className = ( _ . isFunction ( rowClasses ) ? rowClasses ( row , index ) : rowClasses ) ;
90
108
91
- return < RowComponent { ...baseRowProps } /> ;
109
+ return < this . RowComponent { ...baseRowProps } /> ;
92
110
} ) ;
93
111
}
94
112
0 commit comments