({
cell,
state,
layout
}: {
cell: any;
state: any;
layout: any;
})
| 333 | } |
| 334 | |
| 335 | export function TableCell({ |
| 336 | cell, |
| 337 | state, |
| 338 | layout |
| 339 | }: { |
| 340 | cell: any; |
| 341 | state: any; |
| 342 | layout: any; |
| 343 | }): JSX.Element { |
| 344 | let ref = useRef<HTMLTableCellElement | null>(null); |
| 345 | let {gridCellProps} = useTableCell({node: cell}, state, ref); |
| 346 | let {isFocusVisible, focusProps} = useFocusRing(); |
| 347 | let column = cell.column; |
| 348 | let isSelected = state.selectionManager.isSelected(cell.parentKey); |
| 349 | |
| 350 | return ( |
| 351 | <td |
| 352 | {...mergeProps(gridCellProps, focusProps)} |
| 353 | style={{ |
| 354 | width: layout.getColumnWidth(column.key), |
| 355 | padding: '5px 10px', |
| 356 | outline: isFocusVisible ? '2px solid orange inset' : 'none', |
| 357 | cursor: 'default', |
| 358 | overflow: 'hidden', |
| 359 | whiteSpace: 'nowrap', |
| 360 | textOverflow: 'ellipsis', |
| 361 | display: 'block', |
| 362 | flex: '0 0 auto', |
| 363 | // eslint-disable-next-line no-nested-ternary |
| 364 | background: isSelected |
| 365 | ? 'blueviolet' |
| 366 | : cell.parentKey % 2 |
| 367 | ? 'var(--spectrum-gray-75)' |
| 368 | : 'var(--spectrum-gray-100)' |
| 369 | }} |
| 370 | ref={ref}> |
| 371 | {cell.rendered} |
| 372 | </td> |
| 373 | ); |
| 374 | } |
| 375 | |
| 376 | export function TableCheckboxCell({ |
| 377 | cell, |
nothing calls this directly
no test coverage detected