import { AffixProps } from '../affix';
import { LoadingProps } from '../loading';
import { PaginationProps, PageInfo } from '../pagination';
import { PopupProps } from '../popup';
import { CheckboxGroupProps } from '../checkbox';
import { DialogProps } from '../dialog';
import { CheckboxGroupValue } from '../checkbox';
import { CheckboxProps } from '../checkbox';
import { RadioProps } from '../radio';
import { InputProps } from '../input';
import { TNode, OptionData, SizeEnum, ClassName, HTMLElementAttributes } from '../common';
export interface TdBaseTableProps<T extends TableRowData = TableRowData> {
    bordered?: boolean;
    columns?: Array<BaseTableCol<T>>;
    data?: Array<T>;
    disableDataPage?: boolean;
    empty?: string | TNode;
    firstFullRow?: string | TNode;
    fixedRows?: Array<number>;
    footData?: Array<T>;
    headerAffixedTop?: boolean;
    headerAffixProps?: AffixProps;
    height?: string | number;
    hover?: boolean;
    lastFullRow?: string | TNode;
    loading?: boolean | TNode;
    loadingProps?: LoadingProps;
    maxHeight?: string | number;
    pagination?: PaginationProps;
    rowAttributes?: TableRowAttributes<T>;
    rowClassName?: ClassName | ((params: RowClassNameParams<T>) => ClassName);
    rowKey: string;
    rowspanAndColspan?: TableRowspanAndColspanFunc<T>;
    scroll?: TableScroll;
    size?: SizeEnum;
    stripe?: boolean;
    tableContentWidth?: string;
    tableLayout?: 'auto' | 'fixed';
    topContent?: string | TNode;
    verticalAlign?: 'top' | 'middle' | 'bottom';
    onCellClick?: (context: BaseTableCellEventContext<T>) => void;
    onPageChange?: (pageInfo: PageInfo, newDataSource: Array<T>) => void;
    onRowClick?: (context: RowEventContext<T>) => void;
    onRowDblclick?: (context: RowEventContext<T>) => void;
    onRowMousedown?: (context: RowEventContext<T>) => void;
    onRowMouseenter?: (context: RowEventContext<T>) => void;
    onRowMouseleave?: (context: RowEventContext<T>) => void;
    onRowMouseover?: (context: RowEventContext<T>) => void;
    onRowMouseup?: (context: RowEventContext<T>) => void;
    onScroll?: (params: {
        e: WheelEvent;
    }) => 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>> | PopupProps;
    fixed?: 'left' | 'right';
    foot?: string | TNode<{
        col: BaseTableCol;
        colIndex: 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;
    columnController?: TableColumnController;
    columnControllerContent?: string | TNode;
    columns?: Array<PrimaryTableCol<T>>;
    dragSort?: 'row' | 'drag-col';
    expandedRow?: TNode<TableExpandedRowParams<T>>;
    expandedRowKeys?: Array<string | number>;
    defaultExpandedRowKeys?: Array<string | number>;
    expandIcon?: boolean | TNode<ExpandArrowRenderParams<T>>;
    expandOnRowClick?: boolean;
    filterIcon?: TNode;
    filterRow?: string | TNode;
    filterValue?: FilterValue;
    defaultFilterValue?: FilterValue;
    multipleSort?: boolean;
    selectedRowKeys?: Array<string | number>;
    defaultSelectedRowKeys?: Array<string | number>;
    sort?: TableSort;
    defaultSort?: TableSort;
    sortIcon?: TNode;
    sortOnRowDraggable?: boolean;
    onAsyncLoadingClick?: (context: {
        status: 'loading' | 'load-more';
    }) => void;
    onCellClick?: (context: PrimaryTableCellEventContext<T>) => void;
    onChange?: (data: TableChangeData, context: TableChangeContext<Array<T>>) => void;
    onColumnChange?: (context: PrimaryTableColumnChange<T>) => void;
    onDataChange?: (data: Array<T>, context: TableDataChangeContext) => 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>;
    colKey?: string;
    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> extends TdPrimaryTableProps<T> {
    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 TableScroll {
    bufferSize?: number;
    isFixedRowHeight?: boolean;
    rowHeight?: number;
    threshold?: number;
    type: 'lazy' | 'virtual';
}
export declare type TableRowAttributes<T> = HTMLElementAttributes | ((params: {
    row: T;
    rowIndex: number;
    type: 'body' | 'foot';
}) => HTMLElementAttributes) | Array<TableRowAttributes<T>>;
export interface RowClassNameParams<T> {
    row: T;
    rowIndex: number;
    type?: 'body' | 'foot';
}
export declare type TableRowspanAndColspanFunc<T> = (params: BaseTableCellParams<T>) => RowspanColspan;
export interface RowspanColspan {
    colspan?: number;
    rowspan?: number;
}
export interface BaseTableCellEventContext<T> {
    row: T;
    col: BaseTableCol;
    rowIndex: number;
    colIndex: number;
    e: MouseEvent;
}
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 TableColumnController {
    fields?: string[];
    displayType: 'fixed-width' | 'auto-width';
    checkboxProps?: CheckboxGroupProps;
    dialogProps?: DialogProps;
}
export interface TableExpandedRowParams<T> {
    row: T;
    index: number;
    columns: PrimaryTableCol<T>[] | BaseTableCol<T>[];
}
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 PrimaryTableCellEventContext<T> {
    row: T;
    col: PrimaryTableCol;
    rowIndex: number;
    colIndex: number;
    e: MouseEvent;
}
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 PrimaryTableColumnChange<T> {
    columns?: CheckboxGroupValue;
    currentColumn?: PrimaryTableCol<T>;
    type?: 'check' | 'uncheck';
}
export interface TableDataChangeContext {
    trigger: 'sort';
}
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) => number;
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';
