import React, { ReactNode } from 'react'; import { Cell, Row, ColumnDef, TableOptions, Table as TableType } from '@tanstack/react-table'; import { SystemStyleObject } from '@mui/system'; import { StackProps } from '@mui/material/Stack'; import { TypographyProps } from '@mui/material/Typography'; import { RadioProps } from '@mui/material/Radio'; import { ITableFooterProps } from '../custom-pagination/custom-pagination-2/CustomPagination2'; import { CheckboxProps as MuiCheckboxProps } from '@mui/material/Checkbox'; export type TColumns = ColumnDef[]; export interface IUseTableProps extends Partial, 'getRowId'>> { columns: ColumnDef[]; data: any; pageSize?: number; multiSelect?: boolean; onSelectRow?: (data: any) => void; getRowId?: string; renderSubComponent?: (props: { row: Row; }) => React.ReactElement; getRowCanExpand?: (row: Row) => boolean; } export interface ITablePagination { pageIndex: number; pageSize: number; pageCounts: number; onChangePage: (pageIndex: number) => void; onChangePageSize?: (pageSize: number) => void; } export interface ITableRowStyle { row: Row; hover?: boolean; } export interface ITableCellsStyle { row: Row; cell?: Cell; hover?: boolean; } export type TRowStyle = (props: ITableRowStyle) => SystemStyleObject; export type TCellsStyle = (props: ITableCellsStyle) => SystemStyleObject; export interface ICheckboxProps extends Omit { onChange?: (event: React.ChangeEvent, checked: boolean, row?: Row) => void; } export type TCheckboxProps = ((props: { row?: Row; table: TableType; }) => ICheckboxProps) | ICheckboxProps; export type TTableVariants = 'zebra' | 'linear'; export interface ICustomTable { id?: string; pagination?: ITablePagination; table: TableType; variant?: TTableVariants; wrapperStackProps?: StackProps; footerProps?: Omit; onClickRow?: (row: Row) => void; renderSubComponent?: any; isLoading?: boolean; isError?: boolean; withRadio?: boolean; withSelect?: boolean; withIndex?: boolean; rowStyle?: TRowStyle; cellsStyle?: TCellsStyle; headerStyle?: SystemStyleObject; headerTypoProps?: TypographyProps; checkboxProps?: TCheckboxProps; radioProps?: RadioProps; emptyListComponent?: string | ReactNode; rowBorderRadius?: number; borderRadius?: number; } export interface ITableAction { label: string | React.ReactNode; icon?: React.ReactElement; onClick?: () => void; disabled?: boolean; }