import React, { useContext } from "react" import classnames from "classnames" import { flexRender, Row } from "@tanstack/react-table" import { GenericObject } from "../../types" import { buildCss } from "../../utilities/props" import { globalProps } from "../../utilities/globalProps" import { isChrome } from "../Utilities/BrowserCheck" import LoadingInline from "../../pb_loading_inline/_loading_inline" import { SubRowHeaderRow } from "../Components/SubRowHeaderRow" import { LoadingCell } from "../Components/LoadingCell" import { renderCollapsibleTrail } from "../Components/CollapsibleTrail" import AdvancedTableContext from "../Context/AdvancedTableContext" type TableBodyProps = { className?: string collapsibleTrail?: boolean dark?: boolean id?: string subRowHeaders?: string[] } export const TableBody = ({ className, collapsibleTrail = true, dark = false, id, subRowHeaders, ...props }: TableBodyProps) => { const { columnDefinitions, enableToggleExpansion, handleExpandOrCollapse, isPinnedLeft = false, inlineRowLoading, loading, responsive, table, } = useContext(AdvancedTableContext) const classes = classnames( buildCss("pb_advanced_table_body"), { 'pinned-left': responsive === "scroll" && isPinnedLeft }, globalProps(props), className ) const columnPinning = table.getState().columnPinning; return ( <>
{table.getRowModel().rows.map((row: Row