@@ -30,7 +30,12 @@ const getRowProps = (features: Features, props: RowProps) =>
30
30
. map ( ( feature ) => ( feature as any ) . _getRowProps ( props , features ) ) ;
31
31
32
32
const evaluateProps = ( rowPropsByFeature : FeatureProps [ ] , onSingleClick : OnClick | Nullish ) => {
33
- const { themeByFeature, classNamesByFeature, onClickByFeature } = rowPropsByFeature . reduce (
33
+ const {
34
+ themeByFeature,
35
+ classNamesByFeature,
36
+ clickable,
37
+ onClickByFeature,
38
+ } = rowPropsByFeature . reduce (
34
39
( acc , value ) => {
35
40
const { theme, className, onClick } = value ;
36
41
@@ -41,6 +46,8 @@ const evaluateProps = (rowPropsByFeature: FeatureProps[], onSingleClick: OnClick
41
46
42
47
const mergedClassName = cs ( acc . classNamesByFeature , className ) ;
43
48
49
+ const mergedClickable = acc . clickable || ! ! onClick ;
50
+
44
51
const mergedOnClick = ( node : TableNode , event : React . SyntheticEvent ) => {
45
52
onClick ( node , event ) ;
46
53
acc . onClickByFeature ( node , event ) ;
@@ -50,12 +57,14 @@ const evaluateProps = (rowPropsByFeature: FeatureProps[], onSingleClick: OnClick
50
57
...acc ,
51
58
themeByFeature : mergedTheme ,
52
59
classNamesByFeature : mergedClassName ,
60
+ clickable : mergedClickable ,
53
61
onClickByFeature : mergedOnClick ,
54
62
} ;
55
63
} ,
56
64
{
57
65
themeByFeature : '' ,
58
66
classNamesByFeature : '' ,
67
+ clickable : ! ! onSingleClick ,
59
68
onClickByFeature : ( node : TableNode , event : React . SyntheticEvent ) => {
60
69
if ( onSingleClick && isRowClick ( event ) ) {
61
70
onSingleClick ( node , event ) ;
@@ -67,6 +76,7 @@ const evaluateProps = (rowPropsByFeature: FeatureProps[], onSingleClick: OnClick
67
76
return {
68
77
themeByFeature,
69
78
classNamesByFeature,
79
+ clickable,
70
80
onClickByFeature,
71
81
} ;
72
82
} ;
@@ -79,7 +89,7 @@ export const Row: React.FC<RowProps> = (props: RowProps) => {
79
89
80
90
const theme = React . useContext ( ThemeContext ) ;
81
91
82
- const { themeByFeature, classNamesByFeature, onClickByFeature } = evaluateProps (
92
+ const { themeByFeature, classNamesByFeature, clickable , onClickByFeature } = evaluateProps (
83
93
rowPropsByFeature ,
84
94
onClick ,
85
95
) ;
@@ -95,7 +105,7 @@ export const Row: React.FC<RowProps> = (props: RowProps) => {
95
105
role = "row"
96
106
className = { cs ( 'tr' , 'tr-body' , classNamesByFeature , className , {
97
107
disabled,
98
- clickable : onClickByFeature || onDoubleClick ,
108
+ clickable : clickable || ! ! onDoubleClick ,
99
109
} ) }
100
110
css = { css `
101
111
${ themeByFeature }
0 commit comments