import {Box} from '@mantine/core'; import {MRT_TableHeadRow} from './MRT_TableHeadRow'; import {MRT_ToolbarAlertBanner} from '../toolbar'; import {type MRT_TableInstance, type MRT_VirtualItem} from '../types'; interface Props = {}> { table: MRT_TableInstance; virtualColumns?: MRT_VirtualItem[]; virtualPaddingLeft?: number; virtualPaddingRight?: number; } export const MRT_TableHead = = {}>({table, virtualColumns, virtualPaddingLeft, virtualPaddingRight,}: Props) => { const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, mantineTableHeadProps, positionToolbarAlertBanner, }, } = table; const {isFullScreen, showAlertBanner} = getState(); const tableHeadProps = mantineTableHeadProps instanceof Function ? mantineTableHeadProps({table}) : mantineTableHeadProps; const stickyHeader = enableStickyHeader || isFullScreen; return ( ({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', position: stickyHeader && layoutMode === 'grid' ? 'sticky' : 'relative', opacity: 1, top: stickyHeader ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined, ...(tableHeadProps?.sx instanceof Function ? tableHeadProps?.sx(theme) : (tableHeadProps?.sx as any)), })} > {positionToolbarAlertBanner === 'head-overlay' && (showAlertBanner || getSelectedRowModel().rows.length > 0) ? ( ) : ( getHeaderGroups().map((headerGroup) => ( )) )} {} ); };