import { PaginationProps, PageInfo } from '../pagination';
import { CheckboxProps } from '../checkbox';
import { RadioProps } from '../radio';
import { InputProps } from '../input';
import { TNode, OptionData, SizeEnum, ClassName } from '../common';
export interface TdBaseTableProps<T extends TableRowData = TableRowData> {
    bordered?: boolean;
    columns?: Array<BaseTableCol<T>>;
    data?: Array<T>;
    empty?: string | TNode;
    expandedRow?: string | TNode<{
        row: T;
        index: number;
    }>;
    firstFullRow?: string | TNode;
    height?: string | number;
    hover?: boolean;
    lastFullRow?: string | TNode;
    loading?: boolean | TNode;
    maxHeight?: string | number;
    pagination?: PaginationProps;
    rowClassName?: ClassName | ((params: {
        row: T;
        rowIndex: number;
    }) => ClassName);
    rowKey: string;
    rowspanAndColspan?: (params: RowspanAndColspanParams<T>) => RowspanColspan;
    size?: SizeEnum;
    stripe?: boolean;
    tableLayout?: 'auto' | 'fixed';
    topContent?: string | TNode;
    verticalAlign?: 'top' | 'middle' | 'bottom';
    onPageChange?: (pageInfo: PageInfo, newDataSource: Array<T>) => void;
    onRowClick?: (context: RowEventContext<T>) => void;
    onRowDbClick?: (context: RowEventContext<T>) => void;
    onRowHover?: (context: RowEventContext<T>) => void;
    onRowMousedown?: (context: RowEventContext<T>) => void;
    onRowMouseenter?: (context: RowEventContext<T>) => void;
    onRowMouseleave?: (context: RowEventContext<T>) => void;
    onRowMouseup?: (context: RowEventContext<T>) => void;
    onScrollX?: (params: {
        e: WheelEvent;
    }) => void;
    onScrollY?: (params: {
        e: WheelEvent;
    }) => void;
}
export interface BaseTableCol<T extends TableRowData = TableRowData> {
    align?: 'left' | 'right' | 'center';
    attrs?: object;
    cell?: string | TNode<BaseTableCellParams<T>>;
    children?: Array<BaseTableCol<T>>;
    className?: ClassName | ((context: CellData<T>) => ClassName);
    colKey?: string;
    ellipsis?: boolean | TNode<BaseTableCellParams<T>>;
    fixed?: 'left' | 'right';
    minWidth?: string | number;
    render?: TNode<BaseTableRenderParams<T>>;
    title?: string | TNode<{
        col: BaseTableCol;
        colIndex: number;
    }>;
    width?: string | number;
}
export interface TdPrimaryTableProps<T extends TableRowData = TableRowData> extends Omit<TdBaseTableProps<T>, 'columns'> {
    asyncLoading?: 'loading' | 'load-more' | TNode;
    columns?: Array<PrimaryTableCol<T>>;
    expandedRow?: TNode<{
        row: T;
        index: number;
    }>;
    expandedRowKeys?: Array<string | number>;
    defaultExpandedRowKeys?: Array<string | number>;
    expandIcon?: TNode<ExpandArrowRenderParams<T>>;
    expandOnRowClick?: boolean;
    filterIcon?: TNode;
    filterRow?: string | TNode;
    filterValue?: FilterValue;
    defaultFilterValue?: FilterValue;
    multipleSort?: boolean;
    selectedRowKeys?: Array<string | number>;
    defaultSelectedRowKeys?: Array<string | number>;
    showColumnController?: boolean;
    showDragCol?: boolean;
    sort?: TableSort;
    defaultSort?: TableSort;
    sortOnRowDraggable?: boolean;
    onAsyncLoadingClick?: (context: {
        status: 'loading' | 'load-more';
    }) => void;
    onChange?: (data: TableChangeData, context: TableChangeContext<Array<T>>) => void;
    onDataChange?: (data: Array<T>) => void;
    onDragSort?: (context: DragSortContext<T>) => void;
    onExpandChange?: (expandedRowKeys: Array<string | number>, options: ExpandOptions<T>) => void;
    onFilterChange?: (filterValue: FilterValue, context: {
        col?: PrimaryTableCol<T>;
    }) => void;
    onSelectChange?: (selectedRowKeys: Array<string | number>, options: SelectOptions<T>) => void;
    onSortChange?: (sort: TableSort, options: SortOptions<T>) => void;
}
export interface PrimaryTableCol<T extends TableRowData = TableRowData> extends Omit<BaseTableCol, 'cell' | 'title' | 'render'> {
    addToColumnController?: boolean;
    cell?: string | TNode<PrimaryTableCellParams<T>>;
    checkProps?: CheckProps<T>;
    disabled?: (options: {
        row: T;
        rowIndex: number;
    }) => boolean;
    filter?: TableColumnFilter;
    render?: TNode<PrimaryTableRenderParams<T>>;
    sorter?: boolean | SorterFun<T>;
    sortType?: SortType;
    title?: string | TNode<{
        col: PrimaryTableCol;
        colIndex: number;
    }>;
    type?: 'single' | 'multiple';
}
export interface TdEnhancedTableProps<T extends TableRowData = TableRowData> {
    tree?: TableTreeConfig;
}
export interface EnhancedTableInstanceFunctions<T extends TableRowData = TableRowData> {
    getData: (key: TableRowValue) => TableRowState<T>;
    remove: (key: TableRowValue) => void;
    setData: (key: TableRowValue, newRowData: T) => void;
}
export interface TableRowState<T extends TableRowData = TableRowData> {
    disabled?: boolean;
    expandChildrenLength?: number;
    expanded: boolean;
    level?: number;
    parent?: TableRowState<T>;
    path?: TableRowState<T>[];
    row: T;
    rowIndex: number;
}
export interface TableColumnFilter {
    component?: TNode;
    list?: Array<OptionData>;
    props?: FilterProps;
    resetValue?: any;
    showConfirmAndReset?: boolean;
    type?: FilterType;
}
export interface RowspanColspan {
    colspan: number;
    rowspan: number;
}
export interface RowspanAndColspanParams<T> {
    row: T;
    col: BaseTableCol;
    rowIndex: number;
    colIndex: number;
}
export interface RowEventContext<T> {
    row: T;
    index: number;
    e: MouseEvent;
}
export interface TableRowData {
    [key: string]: any;
    children?: TableRowData[];
}
export interface BaseTableCellParams<T> {
    row: T;
    rowIndex: number;
    col: BaseTableCol<T>;
    colIndex: number;
}
export interface CellData<T> extends BaseTableCellParams<T> {
    type: 'th' | 'td';
}
export interface BaseTableRenderParams<T> extends BaseTableCellParams<T> {
    type: RenderType;
}
export declare type RenderType = 'cell' | 'title';
export declare type DataType = TableRowData;
export interface ExpandArrowRenderParams<T> {
    row: T;
    index: number;
}
export declare type FilterValue = {
    [key: string]: FilterItemValue;
};
export declare type FilterItemValue = string | number | undefined | Array<string | number>;
export declare type TableSort = SortInfo | Array<SortInfo>;
export interface SortInfo {
    sortBy: string;
    descending: boolean;
}
export interface TableChangeData {
    sorter?: TableSort;
    filter?: FilterValue;
    pagination?: PaginationProps;
}
export interface TableChangeContext<T> {
    trigger: TableChangeTrigger;
    currentData?: T;
}
export declare type TableChangeTrigger = 'filter' | 'sorter' | 'pagination';
export interface DragSortContext<T> {
    currentIndex: number;
    current: T;
    targetIndex: number;
    target: T;
}
export interface ExpandOptions<T> {
    expandedRowData: Array<T>;
}
export interface SelectOptions<T> {
    selectedRowData: Array<T>;
    type: 'uncheck' | 'check';
    currentRowKey?: string;
    currentRowData?: T;
}
export interface SortOptions<T> {
    currentDataSource?: Array<T>;
    col: PrimaryTableCol;
}
export interface PrimaryTableCellParams<T> {
    row: T;
    rowIndex: number;
    col: PrimaryTableCol<T>;
    colIndex: number;
}
export declare type CheckProps<T> = CheckboxProps | RadioProps | ((options: {
    row: T;
    rowIndex: number;
}) => CheckboxProps | RadioProps);
export interface PrimaryTableRenderParams<T> extends PrimaryTableCellParams<T> {
    type: RenderType;
}
export declare type SorterFun<T> = (a: T, b: T) => SortNumber;
export declare type SortNumber = 1 | -1 | 0;
export declare type SortType = 'desc' | 'asc' | 'all';
export interface TableTreeConfig {
    indent?: number;
    treeNodeColumnIndex?: number;
    childrenKey?: 'children';
    checkStrictly?: boolean;
}
export declare type TableRowValue = string | number;
export declare type FilterProps = RadioProps | CheckboxProps | InputProps | {
    [key: string]: any;
};
export declare type FilterType = 'input' | 'single' | 'multiple';
