(props: TableProps)
| 30 | export type TableProps = TableStateProps<object> & AriaTableProps & {children?: ReactNode}; |
| 31 | |
| 32 | export function Table(props: TableProps) { |
| 33 | let state = useTableState({...props, showSelectionCheckboxes: false}); |
| 34 | let ref = useRef<HTMLTableElement>(null); |
| 35 | let {collection} = state; |
| 36 | let {gridProps} = useTable(props, state, ref); |
| 37 | |
| 38 | return ( |
| 39 | <table {...gridProps} ref={ref} className="react-aria-Table"> |
| 40 | <TableRowGroup type="thead"> |
| 41 | {collection.headerRows.map(headerRow => ( |
| 42 | <TableHeaderRow key={headerRow.key} item={headerRow} state={state}> |
| 43 | {[...headerRow.childNodes].map(column => ( |
| 44 | <TableColumnHeader key={column.key} column={column} state={state} /> |
| 45 | ))} |
| 46 | </TableHeaderRow> |
| 47 | ))} |
| 48 | </TableRowGroup> |
| 49 | <TableRowGroup type="tbody"> |
| 50 | {[...collection.body.childNodes].map(row => ( |
| 51 | <TableRow key={row.key} item={row} state={state}> |
| 52 | {[...row.childNodes].map(cell => ( |
| 53 | <TableCell key={cell.key} cell={cell} state={state} /> |
| 54 | ))} |
| 55 | </TableRow> |
| 56 | ))} |
| 57 | </TableRowGroup> |
| 58 | </table> |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | function TableRowGroup({type: Element, children}: {type: 'thead' | 'tbody'; children: ReactNode}) { |
| 63 | let {rowGroupProps} = useTableRowGroup(); |
nothing calls this directly
no test coverage detected