import clsx from 'clsx'; import classes from './MRT_TableBody.module.css'; import { useMemo } from 'react'; import { createRow } from '@tanstack/react-table'; import { type TableProps, TableTd, type TableTrProps, Text, } from '@mantine/core'; import { MRT_TableBodyRow } from './MRT_TableBodyRow'; import { type MRT_Row, type MRT_RowData, type MRT_TableInstance, } from '../../types'; import { MRT_ExpandButton } from '../buttons/MRT_ExpandButton'; interface Props extends TableTrProps { table: MRT_TableInstance; tableProps: Partial; } export const MRT_TableBodyEmptyRow = ({ table, tableProps, ...commonRowProps }: Props) => { 'use no memo'; const { getState, options: { layoutMode, localization, renderDetailPanel, renderEmptyRowsFallback, }, refs: { tablePaperRef }, } = table; const { columnFilters, globalFilter } = getState(); const emptyRow = useMemo( () => createRow( table as any, 'mrt-row-empty', {} as TData, 0, 0, ) as MRT_Row, [], ); const emptyRowProps = { ...commonRowProps, renderedRowIndex: 0, row: emptyRow, virtualRow: undefined, }; return ( {renderDetailPanel && ( )} {renderEmptyRowsFallback?.({ table }) ?? ( {globalFilter || columnFilters.length ? localization.noResultsFound : localization.noRecordsToDisplay} )} ); };