import './Table.scss'; // import Checkbox from '../Checkbox'; import { isFunction } from '../../assets/utils/functionUtils'; import classNames from 'classnames'; import { ColumnsProps, DataProps, TableProps } from './Types'; import { prepareData } from '../../utils/TableCell/TableCell'; // import NoData from '../NoData/NoData'; const Table = ({ data = [], columns = [], headerType, // withCheckbox, // onSelect, // allSelected, // partialSelected = false, withFixedHeader = true, borderWithRadius = false, // headerCheckboxDisabled = false, // noDataContent, // noDataImage, // noDataImageSize, height = '100%', className = '', }: TableProps) => { const hanleOnclick = (column: ColumnsProps, row: DataProps) => { let { onClick, accessor } = column; if (onClick && isFunction(onClick)) { onClick(accessor, row); } }; if (!(data.length >= 0)) return null; return (
{/* columns.map((column, index) */} {columns.map((column) => ( ))} {data.length > 0 && data.map((row: any, index: number) => ( {columns.map((column, i) => { return ( ); })} ))}
{/* {index === 0 && withCheckbox && ( { onSelectClick(e, { allSelected: e.target.checked }); }} checked={ allSelected !== undefined ? allSelected : false } partial={!!partialSelected} disabled={headerCheckboxDisabled} /> )} */} {column.header}
hanleOnclick(column, row)} className={classNames(column.className, { 'clickable-cell': column.onClick, })} >
{/* {i === 0 && withCheckbox && ( { onSelectClick(e, row); }} checked={row.checked} disabled={!!row.disabled} /> )} */} {prepareData(row, column)}
{/* {data.length <= 0 && (
)} */}
); }; export default Table;