@@ -39,41 +39,8 @@ import joinClasses from './vendor_upstream/core/joinClasses';
39
39
* );
40
40
* ```
41
41
*/
42
- class FixedDataTableCellDefault extends React . Component {
43
- static propTypes = {
44
- /**
45
- * Outer height of the cell.
46
- */
47
- height : PropTypes . number ,
48
-
49
- /**
50
- * Outer width of the cell.
51
- */
52
- width : PropTypes . number ,
53
-
54
- /**
55
- * Optional prop that if specified on the `Column` will be passed to the
56
- * cell. It can be used to uniquely identify which column is the cell is in.
57
- */
58
- columnKey : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
59
-
60
- /**
61
- * Optional prop that represents the rows index in the table.
62
- * For the 'cell' prop of a Column, this parameter will exist for any
63
- * cell in a row with a positive index.
64
- *
65
- * Below that entry point the user is welcome to consume or
66
- * pass the prop through at their discretion.
67
- */
68
- rowIndex : PropTypes . number ,
69
-
70
- /**
71
- * Whether this cell is currently within the viewport.
72
- */
73
- isVisible : PropTypes . bool ,
74
- } ;
75
-
76
- render ( ) {
42
+ const FixedDataTableCellDefault = React . forwardRef (
43
+ function FixedDataTableCellDefault ( props , ref ) {
77
44
//Remove some props which we don't pass into div
78
45
const {
79
46
height,
@@ -92,8 +59,8 @@ class FixedDataTableCellDefault extends React.Component {
92
59
maxWidth,
93
60
minWidth,
94
61
touchEnabled,
95
- ...props
96
- } = this . props ;
62
+ ...cellProps
63
+ } = props ;
97
64
98
65
const innerStyle = {
99
66
height,
@@ -103,19 +70,53 @@ class FixedDataTableCellDefault extends React.Component {
103
70
104
71
return (
105
72
< div
106
- { ...props }
73
+ { ...cellProps }
107
74
className = { joinClasses (
108
75
cx ( 'fixedDataTableCellLayout/wrap' ) ,
109
76
cx ( 'public/fixedDataTableCell/wrap' ) ,
110
77
cx ( 'public/fixedDataTableCell/cellContent' ) ,
111
78
className
112
79
) }
113
80
style = { innerStyle }
81
+ ref = { ref }
114
82
>
115
83
{ children }
116
84
</ div >
117
85
) ;
118
86
}
119
- }
87
+ ) ;
88
+
89
+ FixedDataTableCellDefault . propTypes = {
90
+ /**
91
+ * Outer height of the cell.
92
+ */
93
+ height : PropTypes . number ,
94
+
95
+ /**
96
+ * Outer width of the cell.
97
+ */
98
+ width : PropTypes . number ,
99
+
100
+ /**
101
+ * Optional prop that if specified on the `Column` will be passed to the
102
+ * cell. It can be used to uniquely identify which column is the cell is in.
103
+ */
104
+ columnKey : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
105
+
106
+ /**
107
+ * Optional prop that represents the rows index in the table.
108
+ * For the 'cell' prop of a Column, this parameter will exist for any
109
+ * cell in a row with a positive index.
110
+ *
111
+ * Below that entry point the user is welcome to consume or
112
+ * pass the prop through at their discretion.
113
+ */
114
+ rowIndex : PropTypes . number ,
115
+
116
+ /**
117
+ * Whether this cell is currently within the viewport.
118
+ */
119
+ isVisible : PropTypes . bool ,
120
+ } ;
120
121
121
122
export default FixedDataTableCellDefault ;
0 commit comments