easy-antd-modal
Version:
二次开发, 简化 Ant Design Modal 的使用方式
41 lines (40 loc) • 1.82 kB
TypeScript
/// <reference types="react" />
import type { AnyObj, PropsWithModalEnhanced, UseModalEnhancedProps } from '@wuxh/use-modal-enhanced';
import type { ModalProps as AntdModalProps } from 'antd';
/** @internal */
type CloseCallback = Pick<ModalProps, 'onCancel'>;
/**
* @description 方便用户自定义 `Modal` 的 `props`
* @see [easy-antd-modal/typescript](https://wxh16144.github.io/easy-antd-modal/typescript)
* @example
* ```tsx
* // 这段可以直接添加到你的任何 `.ts` 文件中,例如 `antd-modal.ts`
* // 也可以添加到一个 `.d.ts` 文件中。确保这个文件包含在项目的 `tsconfig.json` 中的 "file" 字段内。
* import 'easy-antd-modal'
*
* declare module 'easy-antd-modal' {
* interface ModalProps {
* // `antd` 的 `Modal` 组件的 `visible` 属性
* visible?: boolean
* }
* }
*
* // 为了确保这个文件被当作一个模块,添加至少一个 `export` 声明
* export {}
* ```
*/
export interface ModalProps extends Omit<AntdModalProps, 'visible' | 'children' | 'open'>, UseModalEnhancedProps {
open?: boolean;
}
/**
* @description 方便用户自定义 `Modal` 的 `props`
* @since 1.6.0
*/
export type ModalContentPropsWithEnhanced<P extends AnyObj = AnyObj> = PropsWithModalEnhanced<P, CloseCallback>;
declare const _default: ((props: ModalProps) => import("react/jsx-runtime").JSX.Element) & Omit<import("react").FC<AntdModalProps> & import("antd/es/modal/confirm").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) => import("react").JSX.Element;
}, keyof AntdModalProps>;
export default _default;