import { Component, CSSProperties } from 'vue'; import { useModal } from './hooks/use-modal'; export interface SizeOptions { small: string | number; middle: string | number; large: string | number; } export interface ShowLoadingOptions { duration?: number; text?: string; } export interface OpenModalOptions { closeable?: boolean; esc?: boolean; mask?: boolean; maskClosable?: boolean; title?: string; header?: boolean; footer?: boolean; width?: number | string; height?: number | string; size?: 'large' | 'middle' | 'small'; fullscreen?: boolean; draggable?: boolean; form?: string; mode?: 'dialog' | 'drawer'; position?: 'top' | 'right' | 'bottom' | 'left'; backgroundColor?: string; bodyStyle?: CSSProperties; submitText?: string; cancelText?: string; onOk?: (options: { close: () => void; }) => void; onCancel?: () => void; } export interface ModalElement extends OpenModalOptions { id: string; resolve: (data?: any) => void; reject: (key: 'CANCEL') => void; component: Component; props: Record; options: OpenModalOptions & { type?: string; }; listeners: { event: string; callback: (actions: ReturnType) => void; }[]; } export interface ModalActions { open: (component: Component | 'confirm' | 'info' | 'warning' | 'error' | 'success', props?: Record, options?: OpenModalOptions) => Promise & { close: () => void; }; close: (id: string, data?: any) => void; closeAll: () => void; addEventListener: (id: string, event: 'submit', callback: (modal: ReturnType) => void) => void; showLoading: (id?: string, options?: ShowLoadingOptions) => () => void; hideLoading: (id?: string) => void; }