import { ButtonProps } from 'ant-design-vue/lib/button/buttonTypes'; import { CSSProperties, VNodeChild, VNode, ComputedRef } from 'vue'; /** * @description: 模态框对外暴露的操作方法接口 */ export interface ModalMethods { /** * 设置模态框属性 * @param props 模态框属性的部分配置 */ setModalProps: (props: Partial) => void; /** * 触发模态框打开/关闭事件 * @param open 是否打开 * @param uid 组件唯一标识 */ emitOpen?: (open: boolean, uid: number) => void; /** * 重新计算模态框高度 */ redoModalHeight?: () => void; /** * 滚动到底部 */ scrollBottom?: () => void; } /** * @description: 模态框注册函数类型 */ export type RegisterFn = (modalMethods: ModalMethods, uuid?: string) => void; /** * @description: 模态框对外返回的方法集合(包含基础操作和扩展方法) */ export interface ReturnMethods extends ModalMethods { /** * 打开模态框 * @param props 是否显示(可选) * @param data 传递给模态框的数据 * @param openOnSet 设置属性时是否自动打开 * @returns void */ openModal: (props?: boolean, data?: T, openOnSet?: boolean) => void; /** * 关闭模态框 */ closeModal: () => void; /** * 获取模态框打开状态(计算属性) */ getOpen?: ComputedRef; } /** * @description: useModal函数的返回类型定义 */ export type UseModalReturnType = [RegisterFn, ReturnMethods]; /** * @description: 模态框内部实现方法接口 */ export interface ReturnInnerMethods extends ModalMethods { /** * 关闭模态框 */ closeModal: () => void; /** * 更改加载状态 * @param loading 是否显示加载状态 */ changeLoading: (loading: boolean) => void; /** * 更改确认按钮加载状态 * @param loading 是否显示加载状态 */ changeOkLoading: (loading: boolean) => void; /** * 获取模态框打开状态(计算属性) */ getOpen?: ComputedRef; /** * 重新计算模态框高度 */ redoModalHeight: () => void; } /** * @description: useModalInner函数的返回类型定义 */ export type UseModalInnerReturnType = [RegisterFn, ReturnInnerMethods]; /** * @description: 模态框组件属性配置接口 */ export interface HlxbModalProps { minHeight?: number; height?: number; wrapperFooterOffset?: number; draggable?: boolean; scrollTop?: boolean; canFullscreen?: boolean; defaultFullscreen?: boolean; open?: boolean; helpMessage: string | string[]; useWrapper: boolean; loading: boolean; loadingTip?: string; wrapperProps: Omit; showOkBtn: boolean; showCancelBtn: boolean; closeFunc: () => Promise; /** * 指定一个在模态框完全关闭时调用的函数 * @type Function */ afterClose?: () => any; /** * 模态框内容区域样式(如高度、内边距等) * @default {} * @type object */ bodyStyle?: CSSProperties; /** * 取消按钮文字 * @default '取消' * @type string */ cancelText?: string; /** * 是否居中显示模态框 * @default false * @type boolean */ centered?: boolean; /** * 是否显示右上角关闭按钮 * @default true * @type boolean */ closable?: boolean; /** * 自定义关闭图标 */ closeIcon?: VNodeChild | VNode; /** * 确认按钮是否显示加载状态 * @default false * @type boolean */ confirmLoading?: boolean; /** * 是否在关闭时销毁子组件 * @default false * @type boolean */ destroyOnClose?: boolean; /** * 底部内容,设置为 null 时不显示默认按钮 * @default 显示确认和取消按钮 * @type any (string | slot) */ footer?: VNodeChild | VNode; /** * 返回模态框挂载的DOM节点 * @default () => document.body * @type Function */ getContainer?: (instance: any) => HTMLElement; /** * 是否显示遮罩层 * @default true * @type boolean */ mask?: boolean; /** * 点击遮罩层是否关闭模态框 * @default true * @type boolean */ maskClosable?: boolean; /** * 遮罩层样式 * @default {} * @type object */ maskStyle?: CSSProperties; /** * 确认按钮文字 * @default '确认' * @type string */ okText?: string; /** * 确认按钮类型 * @default 'primary' * @type string */ okType?: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default'; /** * 确认按钮属性配置 * @type object */ okButtonProps?: ButtonProps; /** * 取消按钮属性配置 * @type object */ cancelButtonProps?: ButtonProps; /** * 模态框标题 * @type any (string | slot) */ title?: VNodeChild | VNode; /** * 模态框宽度 * @default 520 * @type string | number */ width?: string | number; /** * 模态框容器类名 * @type string */ wrapClassName?: string; /** * 模态框z-index层级 * @default 1000 * @type number */ zIndex?: number; } /** * @description: 模态框包装器属性配置接口 */ export interface ModalWrapperProps { /** * 底部偏移量(用于调整内容区域高度) */ footerOffset?: number; /** * 是否显示加载状态 */ loading: boolean; /** * 模态框头部高度 */ modalHeaderHeight: number; /** * 模态框底部高度 */ modalFooterHeight: number; /** * 最小高度限制 */ minHeight: number; /** * 内容区域高度 */ height: number; /** * 是否打开 */ open: boolean; /** * 是否全屏 */ fullScreen: boolean; /** * 是否使用包装器 */ useWrapper: boolean; }