/// <reference types="react" />
import { IExternalFormField } from '../Form/FormField';
import { CellType } from './Cell';
import { FooterType } from './Footer';
/******************************************************************************/
/**                                                                          **/
/******************************************************************************/
export declare enum ColumnAlignment {
    Center = "Center",
    Left = "Left",
    Right = "Right"
}
export declare enum RowState {
    GreenText = "GreenText",
    RedText = "RedText",
    Grey = "Grey",
    Error = "Error",
    Warning = "Warning",
    CrossedOut = "CrossedOut",
    Default = "Default"
}
export declare enum CellStatus {
    Warning = "Warning",
    Danger = "Danger",
    Success = "Success",
    Info = "Info"
}
export interface IStatusDefinition {
    [statusValue: string]: {
        label: string;
        type?: CellStatus;
        color?: string;
    };
}
export interface IGetRowState<T> {
    (row: IRowInfo<T>): RowState;
}
export interface IColumnAccessorFunction<T, R = string> {
    (data: T): R;
}
export interface IColumnAggregateFunction<T, V> {
    (columnValues: V[], tableValues: T[]): V;
}
export interface IFilterFunction {
    (query: {
        pivotId?: string;
        id?: string;
        value: string;
    }, row: any, column: any): boolean;
}
export interface IColumnCellFormatFunction<T> {
    <V>(value: V, row: T): string | React.ReactElement<any>;
}
export interface ICellEventHandler<T> {
    (event: React.SyntheticEvent<HTMLDivElement | HTMLButtonElement>, row: T, original: IRowInfo<T>): void;
}
declare type GenericFormField = Omit<IExternalFormField<any, any, any, any>, 'name' | 'onChange' | 'onBlur'>;
export declare type IFieldProps<P extends GenericFormField> = Partial<P> & {
    component: React.ComponentType<IExternalFormField<any, any, any, any>>;
    name?: (index: number) => string;
    onBlur?: (index: number) => IExternalFormField<any, any, any, any>['onBlur'];
    onChange?: (index: number) => IExternalFormField<any, any, any, any>['onChange'];
    getOptions?: <O = any>(index: number) => O[];
};
export interface ICustomComponentProps<T> {
    (row: T): React.ReactElement<any>;
}
export interface IColumnConfig<T> {
    Cell?: any;
    Header?: React.ComponentType<any>;
    Footer?: React.ComponentType<any> | string;
    accessor?: DeepKeyOf<T> | IColumnAccessorFunction<T, any>;
    aggregate?: IColumnAggregateFunction<T, any>;
    alignment?: ColumnAlignment;
    cellType?: CellType;
    className?: string;
    customComponent?: ICustomComponentProps<T>;
    dateTimeFormat?: string;
    field?: DeepKeyOf<T> | string;
    filterable?: boolean;
    filterMethod?: IFilterFunction;
    fixedWidth?: boolean;
    footerLabel?: string;
    footerType?: FooterType;
    formatter?: IColumnCellFormatFunction<T>;
    minWidth?: number;
    maxWidth?: number;
    sortable?: boolean;
    style?: any;
    title: string;
    weight?: number;
    isExternal?: boolean | ((row: T, url: string) => boolean);
    isVisible?: boolean | (() => boolean);
    actions?: Array<IActionInfo<T>>;
    onClick?: ICellEventHandler<T>;
    onChange?: ICellEventHandler<T>;
    onBlur?: ICellEventHandler<T>;
    url?: string;
    download?: boolean;
    openInNewTab?: boolean;
    constructUrl?: IConstructUrl<T>;
    statusDefinition?: IStatusDefinition;
    fieldProps?: IFieldProps<GenericFormField>;
    sectionName?: string;
    disabled?: boolean | ((row: T) => boolean);
}
export declare type IRowConfig<T> = Array<IColumnConfig<T>>;
export declare type IRowsConfig<Ts extends any[]> = Array<IColumnConfig<Ts[0]>>;
export declare type IAdditionalRowConfig<T> = Array<Omit<IColumnConfig<T>, 'title'>>;
export interface IRowInfo<T> {
    row: any;
    rowValues: any;
    original: T;
    index: number;
    viewIndex: number;
    pageSize: number;
    page: number;
    level: number;
    nestingPath: number[];
    aggregated: boolean;
    groupedByPivot: boolean;
}
interface IInternalRowPluckedValues<A extends any> {
    [key: string]: A;
}
export interface IInternalRowInfo<T> extends IInternalRowPluckedValues<any> {
    _index: number;
    _nestingLevel: number[];
    _original: T;
    _viewIndex: number;
}
/******************************************************************************/
/** Row and Cell props                                                       **/
/******************************************************************************/
export interface IInlineStyle {
    [key: string]: string | number;
}
export interface ITdProps {
}
export interface IResizedInfo {
}
export interface IActionInfo<T> {
    title?: string | ((original: T) => string);
    tooltip?: string | ((original: T) => string);
    icon?: string;
    className?: string;
    isVisible?: boolean | ((row: any) => boolean);
    disabled?: boolean | ((row: any) => boolean);
    onClick?: ICellEventHandler<T>;
    getUrl?: (conflict: T) => string;
    customComponent?: (row: T) => React.ReactElement<any>;
}
export interface IColumnProps<T> {
    actions?: Array<IActionInfo<T>>;
    className?: string;
    customComponent?: ICustomComponentProps<T>;
    styles?: {
        [key: string]: string | number;
    };
    onClick?: ICellEventHandler<T>;
    onChange?: ICellEventHandler<T>;
    onBlur?: ICellEventHandler<T>;
    url?: string;
    openInNewTab?: boolean;
    constructUrl?: IConstructUrl<T>;
    statusDefinition?: IStatusDefinition;
}
export interface ICellInfo<T, V> {
    isExpanded: boolean;
    value: V;
    resized: IResizedInfo;
    show: boolean;
    width: number;
    maxWidth: number;
    tdProps: ITdProps;
    columnProps: IColumnProps<T>;
    className?: string;
    style?: IInlineStyle;
}
export interface IConstructUrl<T> {
    (original: T, row: IRowInfo<T>): string;
}
export interface ICellInternalProps<T, V> {
    actions?: Array<IActionInfo<T>>;
    accessor?: DeepKeyOf<T> | IColumnAccessorFunction<T, V>;
    aggregate?: IColumnAggregateFunction<T, V>;
    customComponent?: ICustomComponentProps<T>;
    dateTimeFormat?: string;
    formatter?: IColumnCellFormatFunction<T>;
    field: DeepKeyOf<T> | string;
    label?: string;
    url?: string;
    download?: boolean;
    openInNewTab?: boolean;
    isExternal?: boolean | ((row: T, url: string) => boolean);
    constructUrl?: IConstructUrl<T>;
    onClick?: ICellEventHandler<T>;
    onChange?: ICellEventHandler<T>;
    onBlur?: ICellEventHandler<T>;
    statusDefinition?: IStatusDefinition;
    tooltipMessage?: string;
    fieldProps?: IFieldProps<GenericFormField>;
    sectionName?: string;
}
export interface ICellProps<T, V> extends IRowInfo<T>, ICellInfo<T, V>, ICellInternalProps<T, V> {
}
export interface IOptionalFieldCellProps<T, V> extends Omit<ICellProps<T, V>, 'formatter'> {
}
export {};
