11import { GridTable } from "@databiosphere/findable-ui/lib/components/Table/table.styles" ;
22import { TableHead } from "@databiosphere/findable-ui/lib/components/Table/components/TableHead/tableHead" ;
33import { ROW_DIRECTION } from "@databiosphere/findable-ui/lib/components/Table/common/entities" ;
4- import { TableBody } from "@databiosphere/findable-ui/lib/components/Detail/components/ Table/components/TableBody/tableBody" ;
4+ import { TableBody } from "@databiosphere/findable-ui/lib/components/Table/components/TableBody/tableBody" ;
55import { StyledGrid } from "./table.styles" ;
66import { StyledRoundedPaper } from "./table.styles" ;
77import { TableContainer } from "@mui/material" ;
88import { getColumnTrackSizing } from "@databiosphere/findable-ui/lib/components/TableCreator/options/columnTrackSizing/utils" ;
99import { Props } from "./types" ;
1010import { NoResults } from "@databiosphere/findable-ui/lib/components/NoResults/noResults" ;
1111import { TableToolbar2 } from "@databiosphere/findable-ui/lib/components/Table/components/TableToolbar2/tableToolbar2" ;
12+ import { useVirtualization } from "@databiosphere/findable-ui/lib/components/Table/hooks/UseVirtualization/hook" ;
1213
1314export const Table = ( { table } : Props ) : JSX . Element => {
15+ const { rows, scrollElementRef, virtualizer } = useVirtualization ( {
16+ rowDirection : ROW_DIRECTION . DEFAULT ,
17+ table,
18+ } ) ;
1419 return (
1520 < StyledGrid container >
1621 < StyledRoundedPaper elevation = { 0 } >
1722 < TableToolbar2 table = { table } />
1823 { table . getRowModel ( ) . rows . length === 0 ? (
1924 < NoResults Paper = { null } title = "No Results" />
2025 ) : (
21- < TableContainer >
26+ < TableContainer ref = { scrollElementRef } >
2227 < GridTable
2328 gridTemplateColumns = { getColumnTrackSizing (
2429 table . getVisibleFlatColumns ( )
@@ -28,7 +33,9 @@ export const Table = ({ table }: Props): JSX.Element => {
2833 < TableHead tableInstance = { table } />
2934 < TableBody
3035 rowDirection = { ROW_DIRECTION . DEFAULT }
36+ rows = { rows }
3137 tableInstance = { table }
38+ virtualizer = { virtualizer }
3239 />
3340 </ GridTable >
3441 </ TableContainer >
0 commit comments