import { default as React } from 'react';
import { TUseValues } from '../../AHooks/useValues';
import { TCanCallback } from '../../AUtils/cbF';
import { IItem } from '../../AUtils/objF';
import { IABaseProps } from '../ABase/ABase';
import { TIcons } from '../AIcon/AIcon';
import { Resources } from '../AResource/AResource';
import { TActionRef, TIdx, TPromisable } from '../ATypes/ATypes';
import { IDateRange } from '../ADatePicker/ADateRangePicker';
import { IATableRowProps } from './ATableBody';
export interface IATableTHProps<T extends IItem> {
    /**
     * def : IATableDef<T>
     *
     * Description : def of the given defs
     */
    def: IATableDef<T>;
    /**
     * defKey : TIdx
     *
     * Description : defKey of the given defs
     */
    defKey: TIdx;
}
export interface IATableTRProps<T extends IItem> {
    /**
     * item : T
     *
     * Description : item of the given items
     */
    item: T;
}
export interface IATableTDProps<T extends IItem> extends IATableTHProps<T>, IATableTRProps<T> {
}
export interface IATableDef<T extends IItem> {
    /**
     * align? : TCanCallback<IATableTHProps<T>, React.CSSProperties['justifyContent']>
     *
     * Description : align of the column. type of justifyContent
     */
    align?: TCanCallback<IATableTHProps<T>, React.CSSProperties['justifyContent']>;
    /**
     * asText? : TCanCallback<IATableTDProps<T>, string | number>
     *
     * Description : for filteration. complicated contents can be filtered using asText.
     */
    asText?: TCanCallback<IATableTDProps<T>, string | number>;
    /**
     * colSpan? : TCanCallback<IATableTHProps<T>, number>
     *
     * Description : colSpan of the column. headers will be not affected and td will overlap.
     */
    colSpan?: TCanCallback<IATableTHProps<T>, number>;
    /**
     * content? : TCanCallback<IATableTDProps<T>, React.ReactNode>
     *
     * Description : content of the td
     */
    content?: TCanCallback<IATableTDProps<T>, React.ReactNode>;
    /**
     * hAlign? : TCanCallback<IATableTHProps<T>, React.CSSProperties['justifyContent']>
     *
     * Description : align of the th. type of justifyContent
     */
    hAlign?: TCanCallback<IATableTHProps<T>, React.CSSProperties['justifyContent']>;
    /**
     * hContent? : TCanCallback<IATableTHProps<T>, React.ReactNode>
     *
     * Description : content of the th
     */
    hContent?: TCanCallback<IATableTHProps<T>, React.ReactNode>;
    /**
     * hStyle? : TCanCallback<IATableTHProps<T>, React.CSSProperties>
     *
     * Description : style of the th. I woudn't touch width, minWidth, maxWidth if I were you.
     */
    hStyle?: TCanCallback<IATableTHProps<T>, React.CSSProperties>;
    /**
     * isSortable? : boolean
     *
     * Description : decides whether the column is sortable or not
     */
    isSortable?: boolean;
    /**
     * maxWidth? : number
     *
     * Description : maxWidth of the column
     */
    maxWidth?: number;
    /**
     * minWidth? : number = 25
     *
     * Description : minWidth of the column
     */
    minWidth?: number;
    /**
     * name? : string
     *
     * Description : name of the column. if proivded, it will be used as the followings.
     * - hContent (but hContent will be first in priority)
     * - filter placeholder
     * - filter iconTooltip
     */
    name?: string;
    /**
     * sortF? : (a: T, b: T, isAsc?: boolean) => number
     *
     * Description : sortF of the column
     */
    sortF?: (a: T, b: T, isAsc?: boolean) => number;
    /**
     * style? : TCanCallback<IATableTDProps<T>, React.CSSProperties>
     *
     * Description : style of the td. I woudn't touch width, minWidth, maxWidth, flexGrow if I were you.
     */
    style?: TCanCallback<IATableTDProps<T>, React.CSSProperties>;
    /**
     * width? : number = 80
     *
     * Description : width of the column
     */
    width?: number;
}
export type TATableDefs<T extends IItem> = {
    [key in Exclude<keyof T, symbol>]?: IATableDef<T>;
} & {
    [key: TIdx]: IATableDef<T>;
};
export type TATableFilterType = 'String' | 'Select' | 'Date' | 'DateRange';
export interface IATableFilter<T extends IItem, K extends IItem = any> {
    Date: {
        /**
         * filterKey? : keyof K = [key of this filter]
         *
         * Description : filterKey of the filter. if not provided, it will use the key of the filter. This is used when to make apiParams using tableF.getFilterParams()
         */
        filterKey?: keyof K;
        /**
         * icon? : TIcons | Exclude<React.ReactNode, string> = 'CalerdarDay'
         *
         * Description : icon of the String filter
         */
        icon?: TIcons | Exclude<React.ReactNode, string>;
        /**
         * iconTooltip? : React.ReactNode = def.Name ?? placeholder
         *
         * Description : tooltip of the filter icon.
         */
        iconTooltip?: React.ReactNode;
        /**
         * maxDate? : Date
         *
         * Description : maxDate of the Date filter
         */
        maxDate?: Date;
        /**
         * minDate? : Date
         *
         * Description : minDate of the Date filter
         */
        minDate?: Date;
        /**
         * placeholder : string = def.Name
         *
         * Description : placeholder of the Date filter
         */
        placeholder?: string;
        /**
         * predicate? : (item: T, defs: TATableDefs<T>, filterKey: keyof T, filter: IATableFilter<T>['Date']) => any
         *
         * Description : predicate of the Date filter. if not provided, it will have default predicate.
         */
        predicate?: (item: T, defs: TATableDefs<T>, filterKey: keyof T, filter: IATableFilter<T>['Date']) => any;
        /**
         * type : 'Date'
         *
         * Description : type of the Date filter
         */
        type: 'Date';
        /**
         * validation? : (value?: Date) => string | undefined
         *
         * Description : validation of the Date filter
         */
        validation?: (value?: Date) => string;
        /**
         * value : Date = new Date()
         *
         * Description : value of the Date filter
         */
        value?: Date;
    };
    DateRange: {
        /**
         * eFilterKey : keyof K
         *
         * Description : filterKey of the filter.value.eDate. This is used when to make apiParams using tableF.getFilterParams()
         */
        eFilterKey: keyof K;
        /**
         * icon? : TIcons | Exclude<React.ReactNode, string> = 'CalendarDay'
         *
         * Description : icon of the String filter
         */
        icon?: TIcons | Exclude<React.ReactNode, string>;
        /**
         * iconTooltip? : React.ReactNode = def.Name ?? placeholder
         *
         * Description : tooltip of the filter icon.
         */
        iconTooltip?: React.ReactNode;
        /**
         * maxDate? : Date
         *
         * Description : maxDate of the DateRange filter
         */
        maxDate?: Date;
        /**
         * minDate? : Date
         *
         * Description : minDate of the DateRange filter
         */
        minDate?: Date;
        /**
         * noClearButton? : boolean
         *
         * Description : true 일 경우 기간 삭제 버튼을 숨깁니다.
         */
        noClearButton?: boolean;
        /**
         * noDefaultChoices? : boolean
         *
         * Description : if true, default choices will not be shown.
         */
        noDefaultChoices?: boolean;
        /**
         * placeholder : string = def.Name
         *
         * Description : placeholder of the Select filter
         */
        placeholder?: string;
        /**
         * predicate? : (item: T, defs: TATableDefs<T>, filterKey: keyof T | string, filter: IATableFilter<T>['DateRange']) => any
         *
         * Description : predicate of the DateRange filter. if not provided, it will have default predicate.
         */
        predicate?: (item: T, defs: TATableDefs<T>, filterKey: keyof T, filter: IATableFilter<T>['DateRange']) => any;
        /**
         * sFilterKey : keyof K
         *
         * Description : filterKey of the filter.value.sDate. This is used when to make apiParams using tableF.getFilterParams()
         */
        sFilterKey: keyof K;
        /**
         * type : 'DateRange'
         *
         * Description : type of the DateRange filter
         */
        type: 'DateRange';
        /**
         * validation? : (value?: IDateRange) => string | undefined
         *
         * Description : validation of the DateRange filter
         */
        validation?: (value?: IDateRange) => string;
        /**
         * value : IDateRange
         *
         * Description : value of the DateRange filter
         */
        value?: IDateRange;
    };
    Select: {
        /**
         * OptionRenderer? : (props: { option: string | number }) => React.ReactNode;
         *
         * Description : OptionRenderer of the Select filter
         */
        OptionRenderer?: (props: {
            option: string | number | null;
        }) => React.ReactNode;
        /**
         * filterKey? : keyof K = [key of this filter]
         *
         * Description : filterKey of the filter. if not provided, it will use the key of the filter. This is used when to make apiParams using tableF.getFilterParams()
         */
        filterKey?: keyof K;
        /**
         * icon? : TIcons | Exclude<React.ReactNode, string> = 'Info'
         *
         * Description : icon of the String filter
         */
        icon?: TIcons | Exclude<React.ReactNode, string>;
        /**
         * iconTooltip? : React.ReactNode = def.Name ?? placeholder
         *
         * Description : tooltip of the filter icon.
         */
        iconTooltip?: React.ReactNode;
        /**
         * options :
         *
         * Description : options of the Select filter
         */
        options: string[] | number[];
        /**
         * placeholder : string = def.Name
         *
         * Description : placeholder of the Select filter
         */
        placeholder?: string;
        /**
         * predicate? : (item: T, defs: TATableDefs<T>, filterKey: keyof T | string, filter: IATableFilter<T>['Select']) => any
         *
         * Description : predicate of the Select filter. if not provided, it will have default predicate.
         */
        predicate?: (item: T, defs: TATableDefs<T>, filterKey: keyof T | string, filter: IATableFilter<T>['Select']) => any;
        /**
         * type : 'Select'
         *
         * Description : type of the Select filter
         */
        type: 'Select';
        /**
         * value : string | number | null = null
         *
         * Description : values of the Select filter
         */
        value?: string | number | null;
    };
    String: {
        /**
         * autoFocus? : boolean
         *
         * Description : decides whether the input is focused or not
         */
        autoFocus?: boolean;
        /**
         * dataList? : string[] | readonly string[]
         *
         * Description : dataList of the String filter
         */
        dataList?: string[] | readonly string[];
        /**
         * filterKey? : keyof K = [key of this filter]
         *
         * Description : filterKey of the filter. if not provided, it will use the key of the filter. This is used when to make apiParams using tableF.getFilterParams()
         */
        filterKey?: keyof K;
        /**
         * icon? : TIcons | Exclude<React.ReactNode, string> = 'Info'
         *
         * Description : icon of the String filter
         */
        icon?: TIcons | Exclude<React.ReactNode, string>;
        /**
         * iconTooltip? : React.ReactNode = def.Name ?? placeholder
         *
         * Description : tooltip of the filter icon.
         */
        iconTooltip?: React.ReactNode;
        /**
         * maxLength? : number
         *
         * Description : maxLength of the String filter
         */
        maxLength?: number;
        /**
         * pattern? : string
         *
         * Description : pattern attribute for input validation
         */
        pattern?: string;
        /**
         * placeholder? : string = def.Name
         *
         * Description : placeholder of the String filter
         * default is tableDef.HContent
         */
        placeholder?: string;
        /**
         * predicate? : (item: T, defs: TATableDefs<T>, filterKey: keyof T | string, filter: IATableFilter<T>['String']) => any
         *
         * Description : predicate of the String filter
         */
        predicate?: (item: T, defs: TATableDefs<T>, filterKey: keyof T | string, filter: IATableFilter<T>['String']) => any;
        /**
         * type : 'String'
         *
         * Description : type of the String filter
         */
        type: 'String';
        /**
         * validation? : (value?: string) => string | undefined
         *
         * Description : validation of the String filter
         */
        validation?: (value: string) => string;
        /**
         * value : string = ''
         *
         * Description : value of the String filter
         */
        value?: string;
    };
}
export type TATableSomeFilter<T extends IItem, K extends IItem = any> = IATableFilter<T, K>[TATableFilterType];
export type TATableFilteration<T extends IItem, K extends IItem = any> = {
    [key in keyof T]?: TATableSomeFilter<T, K>;
} & {
    [key: string]: TATableSomeFilter<T, K>;
};
export type TATableSortF<T extends IItem> = (a: T, b: T, isAsc?: boolean) => number;
export interface IATableSortation<T extends IItem> {
    /**
     * defKey? : keyof T
     *
     * Description : defKey of the sortation
     */
    defKey: keyof T;
    /**
     * isAsc? : boolean
     *
     * Description : isAsc of the sortation
     */
    isAsc: boolean;
    /**
     * sortF? : TATableSortF<T>
     *
     * Description : sortF of the sortation
     */
    sortF?: TATableSortF<T>;
}
export interface IATablePagination {
    /**
     * page : number
     *
     * Description : page of the pagination
     */
    page: number;
    /**
     * pageRange : number
     *
     * Description : pageRange of the pagination
     */
    pageRange: number;
    /**
     * pageSize : number
     *
     * Description : pageSize of the pagination
     */
    pageSize: number;
}
/**
 * IATableState<T extends IItem, K extends IItem = any>
 *
 * Description : IATableState of ATable. K is used for tableF.getMultiFilterValues. if used, it specifies the type of the filteration.
 */
export interface IATableState<T extends IItem, K extends IItem = any> {
    /**
     * entireItems? : T[]
     *
     * Description : entireItems of the state
     */
    entireItems?: T[];
    /**
     * filteration : TATableFilteration<T, K>
     *
     * Description : the applied filteration of the table. NOT the filteration shown in the header.
     */
    filteration: TATableFilteration<T, K>;
    /**
     * pagination : IATablePagination
     *
     * Description : pagination of the state
     */
    pagination: IATablePagination;
    /**
     * sortation? : IATableSortation<T>
     *
     * Description : sortation of the state
     */
    sortation?: IATableSortation<T>;
}
type TATableDisabledResult = string | boolean | undefined;
export interface IATableActions<T extends IItem> {
    applyFilteration: (cb?: (oldFilteration: TATableFilteration<T>) => TATableFilteration<T>) => TPromisable<void>;
    fireOnStateChange: (cb?: (oldState: IATableState<T>) => IATableState<T>) => TPromisable<void>;
    scrollToSelected: (block?: ScrollLogicalPosition) => void;
}
export interface IATableProps<T extends IItem> {
    /**
     * RowRenderer? : (props: IATableRowProps<T>) => React.ReactNode
     *
     * Description : RowRenderer of ATable
     */
    RowRenderer?: (props: IATableRowProps<T>) => React.ReactNode;
    /**
     * TopLeftAddon? : React.ReactNode
     *
     * Description : TopLeftAddon of ATable
     */
    TopLeftAddon?: React.ReactNode;
    /**
     * TopRightAddon? : React.ReactNode
     *
     * Description : TopRightAddon of ATable
     */
    TopRightAddon?: React.ReactNode;
    /**
     * actionRef? : TActionRef<IATableActions<T>>
     *
     * Description : actionRef of ATable
     */
    actionRef?: TActionRef<IATableActions<T>>;
    /**
     * checkDisabled? : (item: T) => string | boolean | undefined
     *
     * Description : checkDisabled of ATable. if string is returned, it will be displayed as tooltip.
     */
    checkDisabled?: (item: T) => TATableDisabledResult;
    /**
     * defaultDef? : IATableDef<T>
     *
     * Description : defaultDef of ATable
     */
    defaultDef?: IATableDef<T>;
    /**
     * defs : TATableDefs<T>
     *
     * Description : defs of ATable
     */
    defs: TATableDefs<T>;
    /**
     * entireItems? : T[]
     *
     * Description : entireItems of ATable. entireItems will be affected by filteration, sortation, and pagination.
     */
    entireItems?: T[];
    /**
     * filterType? : 'Default' | 'Select'
     *
     * Description : filterType of ATable. When 'Select', it behaves like the old useSelectFilteration.
     */
    filterType?: 'Default' | 'Select';
    /**
     * isDisabled? : boolean
     *
     * Description : decides whether the table is disabled or not
     */
    isDisabled?: string | boolean;
    /**
     * isLoading? : boolean
     *
     * Description : decides whether the table is loading or not
     */
    isLoading?: boolean;
    /**
     * isSelectMulti? : boolean
     *
     * Description : isSelectMulti of ATable. if true, multiple items can be selected.
     */
    isSelectMulti?: boolean;
    /**
     * noCount? : boolean
     *
     * Description : hides count if set to true
     */
    noCount?: boolean;
    /**
     * noDefHeader? : boolean
     *
     * Description : hides defHeader if set to true
     */
    noDefHeader?: boolean;
    /**
     * noFilter? : boolean
     *
     * Description : hides filter if set to true
     */
    noFilter?: boolean;
    /**
     * noFooter? : boolean
     *
     * Description : hides footer if set to true
     */
    noFooter?: boolean;
    /**
     * noHeader? : boolean
     *
     * Description : hides header if set to true
     */
    noHeader?: boolean;
    /**
     * noMarking? : boolean
     *
     * Description : hides marking if set to true
     */
    noMarking?: boolean;
    /**
     * noStateChangeOnMount? : boolean
     *
     * Description : if true, onStateChange will not be called on render.
     */
    noStateChangeOnMount?: boolean;
    /**
     * onStateChange? : (params: IATableState<T>) => void
     *
     * Description : onStateChange of ATable. will be called when filteration, sortation, and pagination changes.
     */
    onStateChange?: (params: IATableState<T>) => TPromisable<void>;
    /**
     * pagedItems? : T[]
     *
     * Description : pagedItems of ATable. if provided, entireItems will be ignored. pagedItems will not be affected by filteration, sortation, and pagination.
     */
    pagedItems?: T[];
    /**
     * pk? : keyof T | (keyof T)[]
     *
     * Description : pk of ATable
     */
    pk?: keyof T | (keyof T)[];
    /**
     * placeholder? : string
     *
     * Description : placeholder of ATable.
     */
    placeholder?: string;
    /**
     * rProps? : TCanCallback<IATableTRProps<T>, IABaseProps>
     *
     * Description : rProps of ATable
     */
    rProps?: TCanCallback<IATableTRProps<T>, IABaseProps>;
    /**
     * resources? : Partial<typeof Resources.ATable>
     *
     * Description : resources of ATable
     */
    resources?: Partial<typeof Resources.ATable>;
    /**
     * rowHeight? : number
     *
     * Description : rowHeight of ATable.
     */
    rowHeight?: number;
    /**
     * selectDisabled? : (item: T) => string | boolean | undefined
     *
     * Description : selectDisabled of ATable. if string is returned, it will be displayed as tooltip.
     */
    selectDisabled?: (item: T) => TATableDisabledResult;
    /**
     * showRows? : number
     *
     * Description : showRows of ATable. if provided, it will show the rows of the table.
     */
    showRows?: number;
    /**
     * title? : React.ReactNode
     *
     * Description : title of ATable
     */
    title?: React.ReactNode;
    /**
     * totalCount? : number
     *
     * Description : totalCount of ATable. if provided, pagination will be affected.
     */
    totalCount?: number;
    /**
     * useCheck? : TUseValues<T[]>
     *
     * Description : useCheck of ATable
     */
    useCheck?: TUseValues<T[]>;
    /**
     * useFilteration? : TUseValues<TATableFilteration<T>>
     *
     * Description : useFilteration of ATable. filteration can be controlled by useFilteration.
     */
    useFilteration?: TUseValues<TATableFilteration<T>>;
    /**
     * usePagination? : TUseValues<IATablePagination>
     *
     * Description : usePagination of ATable. pagination can be controlled by usePagination.
     */
    usePagination?: TUseValues<Partial<IATablePagination>, IATablePagination>;
    /**
     * useSelect? : TUseValues<T[]>
     *
     * Description : useSelect of ATable.
     */
    useSelect?: TUseValues<T[]>;
    /**
     * useSortation? : TUseValues<IATableSortation<T> | undefined>;
     *
     * Description : useSortation of ATable. sortation can be controlled by useSortation.
     */
    useSortation?: TUseValues<IATableSortation<T> | undefined>;
    /**
     * useToggleFilteration? : TUseValues<TATableFilteration<T>>
     *
     * Description : useToggleFilteration of ATable. toggleFilteration can be controlled by useToggleFilteration.
     */
    useToggleFilteration?: TUseValues<TATableFilteration<T>>;
}
/**
 * AComponent : ATable
 *
 * Description : ATable is a table component. it can have defs and items to display the table. and has select, check, filteration, sortation, pagination options available.
 *
 * Basic Usage :
 *
 *     const entireItems = [{name: 'John', age: 20}, {name: 'Jane', age: 21}];
 *     const [pagedItems, setPagedItems] = useState<T[]>([{name: 'John', age: 20}, {name: 'Jane', age: 21}]);
 *     const [totalCount, setTotalCount] = useState<number>(pagedItems.length);
 *     const defs = {
 *       name: {content: ({item}) => item.name},
 *       age: {content: ({item}) => item.age},
 *       height : {}
 *     }
 *     const defaultDefs = {
 *       content : ({item}) => 'default value!'
 *     }
 *     const onStateChange = ({entireItems, filteration, pagination, sortation}) => {
 *       const {items, totalCount} = apiCall(entireItems, filteration, pagination, sortation);
 *       setPagedItems(items);
 *       setTotalCount(totalCount);
 *     }
 *     const [selectedItems, setSelectedItems] = useState<T[]>([]);
 *     const [checkedItems, setCheckedItems] = useState<T[]>([]);
 *     const selectDisabled = (item) => item.name === 'John' ? 'John is disabled' : false;
 *     const checkDisabled = (item) => item.name === 'Jane' ? 'Jane is disabled' : false;
 *     const filterationDefs = {type: 'Or', defs: [{type: 'String', placeholder: 'Search'}]};
 *     const defaultPagination = {page: 1, pageSize: 50, pageRange: 10}; *
 *
 *     if (case 1)
 *       <ATable defs={defs}
 *         entireItems={entireItems}
 *         defaultDef={defaultDefs}/>
 *
 *     if (case 2)
 *       <ATable defs={defs}
 *         pagedItems={pagedItems}
 *         totalCount={totalCount}
 *         onStateChange={onStateChange}/>
 *
 *     if (case 3)
 *       <ATable defs={defs}
 *         entireItems={entireItems}
 *         useSelect={[selectedItems, setSelectedItems]}
 *         useCheck={[checkedItems, setCheckedItems]}
 *         selectDisabled={selectDisabled}
 *         checkDisabled={checkDisabled}/>
 *
 *     if (case 4)
 *       <ATable defs={defs}
 *         entireItems={entireItems}
 *         filterationDefs={filterationDefs}
 *         usePagination={[defaultPagination, undefined]}/>
 */
export declare const ATable: <T extends IItem>(props: IATableProps<T>) => import("react/jsx-runtime").JSX.Element;
export {};
