@@ -22,11 +22,13 @@ import {
22
22
type MRT_TableInstance ,
23
23
type MRT_VirtualItem ,
24
24
} from '../types' ;
25
+ import { funcValue } from '../funcValue' ;
26
+
25
27
import classes from './MRT_TableBodyRow.module.css' ;
26
28
27
29
interface Props < TData extends Record < string , any > = { } > {
28
30
cell : MRT_Cell < TData > ;
29
- isStriped ?: boolean ;
31
+ isStriped ?: boolean | 'odd' | 'even' ;
30
32
measureElement ?: ( element : HTMLTableCellElement ) => void ;
31
33
numRows ?: number ;
32
34
rowIndex : number ;
@@ -81,25 +83,13 @@ export const MRT_TableBodyCell = <TData extends Record<string, any> = {}>({
81
83
const { columnDef } = column ;
82
84
const { columnDefType } = columnDef ;
83
85
84
- const mTableCellBodyProps =
85
- mantineTableBodyCellProps instanceof Function
86
- ? mantineTableBodyCellProps ( { cell, column, row, table } )
87
- : mantineTableBodyCellProps ;
88
-
89
- const mcTableCellBodyProps =
90
- columnDef . mantineTableBodyCellProps instanceof Function
91
- ? columnDef . mantineTableBodyCellProps ( { cell, column, row, table } )
92
- : columnDef . mantineTableBodyCellProps ;
93
-
86
+ const arg = { cell, column, row, table } ;
94
87
const tableCellProps = {
95
- ...mTableCellBodyProps ,
96
- ...mcTableCellBodyProps ,
88
+ ...funcValue ( mantineTableBodyCellProps , arg ) ,
89
+ ...funcValue ( columnDef . mantineTableBodyCellProps , arg ) ,
97
90
} ;
98
91
99
- const skeletonProps =
100
- mantineSkeletonProps instanceof Function
101
- ? mantineSkeletonProps ( { cell, column, row, table } )
102
- : mantineSkeletonProps ;
92
+ const skeletonProps = funcValue ( mantineSkeletonProps , arg ) ;
103
93
104
94
const [ skeletonWidth , setSkeletonWidth ] = useState ( 100 ) ;
105
95
useEffect ( ( ) => {
@@ -152,10 +142,8 @@ export const MRT_TableBodyCell = <TData extends Record<string, any> = {}>({
152
142
} , [ draggingColumn , draggingRow , hoveredColumn , hoveredRow , rowIndex ] ) ;
153
143
154
144
const isEditable =
155
- ( enableEditing instanceof Function ? enableEditing ( row ) : enableEditing ) &&
156
- ( columnDef . enableEditing instanceof Function
157
- ? columnDef . enableEditing ( row )
158
- : columnDef . enableEditing ) !== false ;
145
+ ( funcValue ( enableEditing , row ) &&
146
+ funcValue ( columnDef . enableEditing , row ) ) !== false ;
159
147
160
148
const isEditing =
161
149
isEditable &&
@@ -196,8 +184,8 @@ export const MRT_TableBodyCell = <TData extends Record<string, any> = {}>({
196
184
197
185
const { style, className, __vars } = getCommonCellStyles ( {
198
186
column,
199
- isStriped,
200
- row,
187
+ // isStriped, TODO: why were these here?
188
+ // row,
201
189
table,
202
190
theme,
203
191
tableCellProps,
@@ -230,7 +218,7 @@ export const MRT_TableBodyCell = <TData extends Record<string, any> = {}>({
230
218
'--white-space' : density === 'xs' ? 'nowrap' : 'normal' ,
231
219
'--z-index' :
232
220
draggingColumn ?. id === column . id
233
- ? 2
221
+ ? '2'
234
222
: column . getIsPinned ( )
235
223
? '1'
236
224
: '0' ,
0 commit comments