import type { ButtonProps, ModalFuncProps, ModalProps } from 'antd'; import type { ModalStaticFunctions } from 'antd/es/modal/confirm'; import React, { CSSProperties, ReactNode } from 'react'; import './index.less'; import { type PromiseType } from '@newgrand/udp-core'; type propsType = { [key: string]: T; }; type Destructor = () => void; export interface IModalIns { destroy: () => void; update: (configUpdate: ModalFuncProps) => void; getApi: () => any; setApi: (events: propsType<(...args: any[]) => void>) => void; subscribe: (fn: Function, type?: string) => Destructor; notify: (value?: any, type?: string) => Promise; updateContent: (content: ReactNode) => void; } interface ICtx { ins: IModalIns; size?: IModalParamProps['size']; params: propsType; okClick?: () => Promise; cancelClick?: () => Promise; } export declare const ModalContext: React.Context; export declare const useModal: () => [IModalIns, ICtx]; export declare const InjectModalCtx: React.MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>; export declare function ModalHeader(props: { title: ReactNode; closable: boolean; fullscreen?: boolean; fullscreenable: boolean; close: Function; children?: ReactNode; }): import("react/jsx-runtime").JSX.Element; export interface IModalParamProps extends ModalFuncProps { /** * @description 设置Context的params参数 */ params?: {}; /** * @description 模态框的宽度 * @default 1000 */ width?: number | string; /** * @description 模态框的高度,设置值后开启resize功能 * @default auto */ height?: number | string; /** * @description 标题 */ title?: ReactNode; /** * @description 内容 */ content: ReactNode; /** * @description 自定义底部按钮 * @default true */ footer?: React.ReactNode | boolean; /** * @description 定义底部按钮左边组件, footer设置true有效 */ footerLeft?: React.ReactNode; /** * @description 定义底部按钮右边组件, footer设置true有效 */ footerRight?: React.ReactNode; /** * @description 是否显示右上角的关闭按钮 * @default true */ closable?: boolean; /** * @description 是否显示右上角的全屏按钮 * @default true */ fullscreenable?: boolean; /** * @description 默认是否全屏展示 * @default false */ fullscreen?: boolean; /** * @description 点击确定回调 */ onOk?: (ins: IModalIns, ...args: any[]) => any; /** * @description 点击取消回调 */ onCancel?: (ins: IModalIns, ...args: any[]) => any; /** * @description ok 按钮 props */ okButtonProps?: ButtonProps; /** * @description cancel 按钮 props */ cancelButtonProps?: ButtonProps; /** * @description 确定按钮文字 * @default 确定 */ okText?: React.ReactNode; /** * @description 取消按钮文字 * @default 取消 */ cancelText?: React.ReactNode; useModal?: boolean | Omit; contentStyle?: CSSProperties; size?: 'large' | 'normal'; } /** * 打开一个模态窗口 */ export declare function showModal(allProps: IModalParamProps & { contentIcon?: { type: string; style?: CSSProperties; }; }): IModalIns; export declare function showAsyncModal(allProps: Omit & { /** * @description promise.resolve前的钩子,返回false取消resolve * @param isOk 是否点击确认按钮 */ beforeResolve?: (isOk: boolean) => PromiseType; /** * @description 是否自动销毁 * @default false */ autoDestroy?: boolean; }): Promise<[Boolean, IModalIns]>; /** * 使用异步confirm * @param props */ export declare function showConfirm(props: ModalFuncProps): Promise; export declare function InnerModal({ styles, bodyStyle, ...props }: ModalProps): import("react/jsx-runtime").JSX.Element; declare const Modal: React.FC & ModalStaticFunctions & { useModal: typeof import("antd/es/modal/useModal").default; destroyAll: () => void; config: typeof import("antd/es/modal/confirm").modalGlobalConfig; _InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/modal/PurePanel").PurePanelProps) => React.JSX.Element; }; export { Modal };