import { HTMLAttributes, PropsWithChildren, ReactNode } from 'react'; import { ITableCellProps, ITableRowProps, TTableCellVariant, TTableSortDirection } from '../Table'; import { IFlexProps } from '../Flex'; export type TDataTableRowKey = string | number; export type TDataTableRowSelector = (row: R, key: TDataTableRowKey) => boolean; export type TDataTableRowRenderer = (row: R, key: TDataTableRowKey) => ReactNode; export type TDataTableRowClickHandler = (row: R) => void; export interface IDataTableColumn extends ITableCellProps { key?: keyof R; label?: string; variant?: TTableCellVariant; isSortable?: boolean; sortDirection?: TTableSortDirection; onSort?: (sortDirection: TTableSortDirection) => void; render?: (row: R) => ReactNode; renderLabel?: (rows: Array) => ReactNode; } export interface IDataTableProps extends PropsWithChildren { className?: string; tableClassName?: string; rows: Array; columns: Array>; isHeaderHidden?: boolean; isPending?: boolean; withStickyHeader?: boolean; getRowKey: (row: R) => TDataTableRowKey; getRowClassName?: (row: R, key: TDataTableRowKey) => string | undefined; renderCustomRow?: TDataTableRowRenderer; selectCustomRow?: TDataTableRowSelector; onRowClick?: TDataTableRowClickHandler; isSubTable?: boolean; } export interface IDataTableRowProps extends Omit { row: R; columns: Array>; getRowKey: (row: R) => TDataTableRowKey; onClick?: TDataTableRowClickHandler; } export interface IExpandableDataTableRowProps extends IDataTableRowProps, PropsWithChildren { isExpanded: boolean; } export interface IDataTableFooterProps extends HTMLAttributes, PropsWithChildren { } export type IDataTableEmptyViewProps = IFlexProps;