import {Box} from '@mantine/core'; import {MRT_TableHeadCell} from './MRT_TableHeadCell'; import { type MRT_Header, type MRT_HeaderGroup, type MRT_TableInstance, type MRT_VirtualItem, } from '../types'; interface Props = {}> { headerGroup: MRT_HeaderGroup; table: MRT_TableInstance; virtualColumns?: MRT_VirtualItem[]; virtualPaddingLeft?: number; virtualPaddingRight?: number; } export const MRT_TableHeadRow = = {}>({headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight,}: Props) => { const { getState, options: {enableStickyHeader, layoutMode, mantineTableHeadRowProps}, } = table; const {isFullScreen} = getState(); const tableRowProps = mantineTableHeadRowProps instanceof Function ? mantineTableHeadRowProps({headerGroup, table}) : mantineTableHeadRowProps; const stickyHeader = enableStickyHeader || isFullScreen; return ( ({ backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[7] : theme.white, boxShadow: `0 .5px 1px ${theme.fn.rgba(theme.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: stickyHeader ? 0 : undefined, ...(tableRowProps?.sx instanceof Function ? tableRowProps?.sx(theme) : (tableRowProps?.sx as any)), position: stickyHeader ? 'sticky' : undefined, })} > {virtualPaddingLeft ? ( ) : null} {(virtualColumns ?? headerGroup.headers).map((headerOrVirtualHeader) => { const header = virtualColumns ? headerGroup.headers[headerOrVirtualHeader.index] : (headerOrVirtualHeader as MRT_Header); return ( ); })} {virtualPaddingRight ? ( ) : null} ); };