import { IToolbarItem } from '@shesha/reactjs'; import { ErrorInfo } from 'apis/admissions/hisHospitals'; import { ReactNodeOrFunc } from '@shesha/reactjs/dist/components/nodeOrFuncRenderer'; import { ILabelParams } from 'components/global/interfaces'; import { ReactNode } from 'react'; export interface IGeneralTableProps extends IStyledProps { /** * Title header of table in top-level panel */ readonly header: string | ReactNode; /** * Column definition */ readonly columns: ISimpleTableColumn[]; /** * Initial column definition */ readonly initialColumns?: ISimpleTableColumn[]; /** * An option to hide the top-leve panel (includes the title and pagination) */ readonly hideControls?: boolean; /** * Toolbar items which are positioned to the left of the panel */ readonly items?: IToolbarItem[]; /** * Toolbar items which are positioned to the right of the panel */ readonly toolbarExtra?: ReactNodeOrFunc; /** * An array of keys which the search will be filter against */ readonly filterRowKeys?: string[]; /** * A callback for selecting the row */ onSelectTableRow?: (index: number, row: object) => void; /** * A callback for double-clicking the rows */ onRowDoubleClick?: (rowData: object) => void; /** * Allow row to be selected */ allowSelectRow?: boolean; /** * Fetch records on load of page */ fetchOnLoad?: boolean; /** * Additional controls on the table. */ extraControls?: ReactNodeOrFunc; /** * Additional controls on the table. */ customFilters?: ReactNodeOrFunc[]; } export interface IGeneralPayload { targetUrl?: string | null; success?: boolean; error?: ErrorInfo; unAuthorizedRequest?: boolean; __abp?: boolean; result?: T; } export interface ITableResponse { paging?: PagingModel; items?: T[] | null; } export interface PagingModel { firstIdx?: number; lastIdx?: number; totalCount?: number; pageNumber?: number; totalPagesCount?: number; } export interface IPopContent { readonly title: string; readonly content: ILabelParams[]; } export interface ISimpleTableCell { readonly value?: string; readonly row?: { original: R; }; } export interface ISimpleTableColumn { readonly Header: string; readonly accessor: keyof T; readonly maxWidth?: number; readonly resizable?: boolean; readonly Cell?: (value: ISimpleTableCell) => object; } export interface IStyledProps { readonly className?: string; }