import { IconName } from '@fortawesome/fontawesome-svg-core'; import { ReactElement, ReactNode, TableHTMLAttributes } from 'react'; import { CheckTypes } from './input-checkbox.model'; import { PageObj, TablePaginationTypes } from './pagination.model'; import { TableStateAction, TableStateActionSelectRowProps } from './table-actions'; export interface TableContextProps extends Omit>, 'rows' | 'title'> { tableId?: string; columns: TableColumn[]; firstRender: boolean; rows: TableRowTreated[]; paging: PageObj; selectAllStatus: CheckTypes; selectedRowsId: string[]; numRowsSelected: number; isLoading?: boolean; hasActions?: boolean; hasSearch?: boolean; hasSelect?: boolean; ordering?: TableOrdering; onPaginationChange?: (pageObj: PageObj) => void; onSelectRow?: (payload: TableStateActionSelectRowProps) => void; selectedOrder?: TableSelectedOrdering; paginated?: TablePaginationTypes; tableDispatch: (value: TableStateAction) => void; tableWidth?: number; title?: string; onSelectChange?: (selectedRows: TableRow[], selectedRowId: string[]) => void; selectedItems?: string[]; } export declare const tableContextInitialValues: TableContextProps; export declare type TableColumn = TableColumnCustom | TableColumnActions | TableColumnDefault; export declare type TableColumnTypes = 'text' | 'number' | 'number_min' | 'date' | 'date_time' | 'boolean' | 'money' | 'money_min' | 'action'; export interface TableColumnDefault { title: string; accessor: string; type?: TableColumnTypes; } export interface TableColumnCustom { type: 'custom'; title: string; accessor: string; renderer: (value: string | number) => ReactNode; } export interface TableColumnActions { type: 'actions'; accessor: 'actions'; title: string; actions: TableColumnAction[]; } export declare type TableRow = TableRowDefault | TableRowAction; export interface TableRowTreated { id: string; index: number; row: TableRow; disabledSelect?: boolean; } export interface TableRowDefault { [key: string]: any; } export interface TableRowAction { actions: TableColumnAction[]; } export declare type TableOrderingTypes = 'asc' | 'desc' | 'none'; export declare type TableOrderType = 'external' | 'internal'; export declare type TableOrdering = { columnsOrder: string[]; type: TableOrderType; multiple?: boolean; onOrderChange?: (lastClicked: string, orderValue: TableSelectedOrdering) => void; }; export declare type TableSelectedOrdering = { [key: string]: { order: TableOrderingTypes; }; }; export declare type TableTdTypes = TableTdTypeCheckBox | TableTdTypeCustom | TableTdTypeActions | TableTdTypeGeneric; export interface TableTdTypeCheckBox extends TableTdTypesDefault { type: 'checkbox'; payload: { id?: string; name: string; checked: CheckTypes; onSelectRow?: (e: any) => void; disabledSelect?: boolean; }; } export interface TableTdTypeCustom extends TableTdTypesDefault { type: 'custom'; payload: { value: string | number; renderer: (value: any) => ReactNode; }; } export interface TableTdTypeActions extends TableTdTypesDefault { type: 'actions'; payload: { func: TableColumnAction[]; }; } export interface TableTdTypeGeneric extends TableTdTypesDefault { type: TableColumnTypes; children: ReactNode; } export interface TableTdTypesDefault { width?: string; payload: {}; } export interface TableColumnAction { icon: IconName | ReactElement; id?: string; name?: string; label: string; disabled?: boolean; fn?: (payload?: IData) => void; } //# sourceMappingURL=table.d.ts.map