import React, { PureComponent } from 'react';
import { FormProps } from 'antd/lib/form';
import { PaginationConfig, SorterResult, TableCurrentDataSource } from 'antd/lib/table';
import { PopconfirmProps } from 'antd/lib/popconfirm';
import { ItemConfig } from 'antd-form-mate/dist/lib/props';
import { CREATE_NAME, DETAIL_NAME, UPDATE_NAME, DELETE_NAME } from '../../constants';
import { DetailModalProps } from '../../components/DetailModal/index';
import { DetailDrawerProps } from '../../components/DetailDrawer/index';
import { InternalCurd } from '../../Curd';
import { ActionType } from './actions/index';
import { ConfigConsumerProps } from '../../config-provider/context';
export declare type CustomDetailDrawerProps = Omit<DetailDrawerProps, 'setItemsConfig' | 'loading' | 'form' | 'onOk'>;
export declare type CustomDetailModalProps = Omit<DetailModalProps, 'setItemsConfig' | 'loading' | 'form'>;
export declare type PopupMode = typeof CREATE_NAME | typeof DETAIL_NAME | typeof UPDATE_NAME;
export declare type ClickMode = PopupMode | typeof DELETE_NAME;
export declare type SearchableMode = typeof CREATE_NAME | typeof UPDATE_NAME | typeof DELETE_NAME;
export declare type UpdateFieldsValueMode = typeof CREATE_NAME | typeof UPDATE_NAME;
export declare type CurdlLocale = keyof ConfigConsumerProps['acLocale']['curd'];
export declare type ClickFnName = 'handleCreateClick' | 'handleDetailClick' | 'handleUpdateClick' | 'handleDeleteClick';
export interface ActionsConfig<T> {
    showActionsCount?: number;
    extraActions?: ActionType<T>[];
    /** number[] or [number, setTitle()][] */
    confirmKeys?: (number | [number, (record?: T) => string])[];
    confirmProps?: PopconfirmProps;
    hideActions?: number[] | ((record?: T) => void | number[]);
    disabledActions?: (record?: T) => void | number[];
    detailActionTitle?: string;
    updateActionTitle?: string;
    deleteActionTitle?: string;
}
export interface CurdBoxProps<T> {
    modelName?: string;
    createTitle?: string;
    detailTitle?: string;
    updateTitle?: string;
    fetchLoading?: boolean;
    deleteLoading?: boolean;
    createLoading?: boolean;
    detailLoading?: boolean;
    updateLoading?: boolean;
    /** if value is falsy, hide the button */
    createButtonName?: string | false | null;
    popup?: JSX.Element | 'modal' | 'drawer' | false | null;
    popupProps?: CustomDetailDrawerProps | CustomDetailModalProps;
    setFormItemsConfig: (detail: any, mode: PopupMode, form?: FormProps['form']) => ItemConfig[];
    afterPopupClose?: (mode: PopupMode) => void;
    interceptors?: {
        /** update form values after click ok */
        updateFieldsValue?: (fieldsValue: T, mode?: UpdateFieldsValueMode) => Promise<T> | T;
        /** callback on click create button, will break default behavior if return value is true */
        handleCreateClick?: () => boolean | undefined;
        /** callback on click detail button, will break default behavior if return value is true */
        handleDetailClick?: (record: T) => boolean | undefined;
        /** callback on click update button, will break default behavior if return value is true */
        handleUpdateClick?: (record: T) => boolean | undefined;
        handleDeleteClick?: (record: T) => void;
        /** custom how to generate params to query when change of filter or sorter */
        handleFilterAndSort?: (filtersArg: Record<keyof any, string[]>, sorter: SorterResult<any>, extra?: TableCurrentDataSource<any>) => any;
    };
    detail?: {};
    actionsConfig?: ActionsConfig<T> | false | null;
    showOperators?: boolean;
    extraOperators?: JSX.Element[];
    dispatch?: any;
    /** call model's fetch effect when componentDidMount */
    autoFetch?: boolean;
    reSearchAfterUpdate?: boolean;
    __curd__?: InternalCurd<T>;
}
export interface InternalCurdBoxProps<T> extends CurdBoxProps<T> {
    acLocale: ConfigConsumerProps['acLocale']['curd'];
    formatSorter: ConfigConsumerProps['formatSorter'];
    searchFieldName: ConfigConsumerProps['searchFieldName'];
}
interface InternalCurdState<T> {
    mode: PopupMode;
    popupVisible: boolean;
    record: T;
}
export declare class InternalCurdBox<T extends {
    id: number | string;
}> extends PureComponent<InternalCurdBoxProps<T>, InternalCurdState<T>> {
    static defaultProps: {
        fetchLoading: boolean;
        createLoading: boolean;
        updateLoading: boolean;
        deleteLoading: boolean;
        createButtonName: string;
        dispatch: () => void;
        actionsConfig: {};
        popup: string;
        popupProps: {};
        setFormItemsConfig: () => never[];
        interceptors: {};
        showOperators: boolean;
        autoFetch: boolean;
        reSearchAfterUpdate: boolean;
        afterPopupClose: () => void;
        __curd__: null;
    };
    state: {
        mode: PopupMode;
        popupVisible: boolean;
        record: T;
    };
    componentDidMount(): void;
    willFetchDetail: () => boolean;
    fetchDetailOrNot: (record: T) => void;
    handleDefaultActionClick: (action: ClickMode, record?: T | undefined) => void;
    closePopup: () => void;
    handlePopupAfterClose: () => void;
    reSearch: (type?: "create" | "update" | "delete" | undefined) => void;
    renderActions: (record: T) => JSX.Element[] | null;
    getPopupTitle: () => any;
    handleCreateOk: (fieldsValue: any) => Promise<void>;
    handleUpdateOk: (fieldsValue: any) => Promise<void>;
    deleteModel: (id: T["id"]) => void;
    handleOk: (fieldsValue: any) => void;
    defaultHandleFilterAndSort: (filtersArg?: Record<string | number | symbol, string[]>, sorter?: SorterResult<any>, extra?: TableCurrentDataSource<any> | undefined) => any;
    handleDataChange: (pagination: PaginationConfig, filtersArg: Record<string | number | symbol, string[]> | undefined, sorter: SorterResult<any> | undefined, extra: TableCurrentDataSource<any>) => void;
    getLocale: (field: "createOk" | "updateOk" | "deleteOk") => any;
    getSearchFieldName: (field: "page" | "limit" | "sortor") => any;
    getFormatSorter: () => (sorter: SorterResult<any>) => any;
    renderOperators: () => false | JSX.Element | undefined;
    renderContainer: () => any[];
    renderPopup: () => {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
    render(): JSX.Element;
}
export interface InjectContainerProps<T extends {
    id: number | string;
}> {
    renderActions: InternalCurdBox<T>['renderActions'];
    handleDataChange: InternalCurdBox<T>['handleDataChange'];
}
export declare function withCurdBox<T>(WrappedComponent: React.ComponentClass<T> | React.FC<T>): (props: Pick<T & CurdBoxProps<any>, "modelName" | "dispatch" | "detail" | "actionsConfig" | "createTitle" | "detailTitle" | "updateTitle" | "fetchLoading" | "deleteLoading" | "createLoading" | "detailLoading" | "updateLoading" | "createButtonName" | "popup" | "popupProps" | "setFormItemsConfig" | "afterPopupClose" | "interceptors" | "showOperators" | "extraOperators" | "autoFetch" | "reSearchAfterUpdate" | "__curd__" | Exclude<keyof T, "renderActions" | "handleDataChange">>) => JSX.Element | null;
export {};
