import { ReactElement, ReactNode } from 'react'; import { BaseConfig, ColumnsConfig, ColumnsState, FooterConfig, EmptyConfig, ExpandingRowConfig, ExpandingRowState, SortState, SelectRowConfig, SelectRowState, SelectionConfig, FilterState, ColumnGroupConfig, GroupByConfig, GroupByState, SettingsConfig, ActionsColumnProps, ColoredRowsState, HiddenColumnsState } from './components'; import { TableProps } from './Table'; import { SettingsType } from './TableModules'; import { AnyObject } from '../Utils'; export interface TableConfig { base: BaseConfig; columns: ColumnsConfig; footer?: FooterConfig; empty?: EmptyConfig; expandingRow?: ExpandingRowConfig; selectRow?: SelectRowConfig; selection?: SelectionConfig; columnGroup?: ColumnGroupConfig; settings?: SettingsConfig; actionsColumn?: ActionsColumnProps; groupBy?: GroupByConfig; } export interface TableState { columns?: ColumnsState; expandingRow?: ExpandingRowState; sort?: SortState; selectRow?: SelectRowState; indeterminateRow?: SelectRowState; disableCheckbox?: SelectRowState; groupBy?: GroupByState; filter?: FilterState; coloredRows?: ColoredRowsState; data?: TableProps['data']; visibleRows?: string[]; allRows?: string[]; hiddenRows?: string[]; hiddenColumns?: HiddenColumnsState; } export type UpdateTableState = (id: string | string[], newState: TableState | ((prev: TableState) => TableState)) => void; interface ModuleParams { child: R; settings: SettingsType; config: Partial; } export type ModuleName = 'actionsColumn' | 'base' | 'coloredRows' | 'columns' | 'columnGroup' | 'empty' | 'expandingRow' | 'groupBy' | 'footer' | 'filter' | 'selectRow' | 'settings' | 'sort'; export interface Module { name: ModuleName | string; feature?: TableFeature; conditionalFeature?: (params: ModuleParams) => TableFeature | null; initConfig?: (params: ModuleParams) => C; initState?: (params: ModuleParams) => S; } export type TableFeature = 'SelectRow' | 'ExpandingRow' | 'ExpandingGroup' | 'ActionsColumn'; export type TableFeatures = Set; export declare enum SortDirection { Asc = "asc", Desc = "desc", None = "none" } export type TableValign = 'baseline' | 'top' | 'middle' | 'bottom' | 'inherit' | 'initial' | 'unset'; export type TableSize = 'xs' | 's' | 'm' | 'l'; export type TableData = AnyObject & { id?: string; }; export type TableReactComponent = ReactElement & { type: ReactElement['type'] & { displayName: string; }; }; export type TableItemGroupByType = T & { groupId?: string; }; export {};