Types
The exported types in VueFinalModal.
ModalId
export type ModalId = number | string | symbol
StyleValue
export type StyleValue = string | CSSProperties | (string | CSSProperties)[]
ModalSlot
export interface ModalSlotOptions { component: Raw<ComponentType>; attrs?: Record<string, any> }
export type ModalSlot = string | ComponentType | ModalSlotOptions
UseModalOptions
export type UseModalOptions<T extends ComponentType> = {
defaultModelValue?: boolean
keepAlive?: boolean
component?: T
attrs?: ComponentProps<T>
slots?: {
[key: string]: ModalSlot
}
}
UseModalOptionsPrivate
export type UseModalOptionsPrivate = {
id: symbol
modelValue: boolean
resolveOpened: () => void
resolveClosed: () => void
}
UseModalReturnType
export interface UseModalReturnType<T extends ComponentType> {
options: UseModalOptions<T> & UseModalOptionsPrivate
open: () => Promise<string>
close: () => Promise<string>
patchOptions: (options: Partial<UseModalOptions<T>>) => void
destroy: () => void
}
Vfm
export type Vfm = {
install(app: App): void
modals: ComputedRef<Modal>[]
openedModals: ComputedRef<Modal>[]
openedModalOverlays: ComputedRef<Modal>[]
dynamicModals: (UseModalOptions<any> & UseModalOptionsPrivate)[]
modalsContainers: Ref<symbol[]>
get: (modalId: ModalId) => undefined | ComputedRef<Modal>
toggle: (modalId: ModalId, show?: boolean) => undefined | Promise<string>
open: (modalId: ModalId) => undefined | Promise<string>
close: (modalId: ModalId) => undefined | Promise<string>
closeAll: () => Promise<[PromiseSettledResult<Promise<string>[]>]>
}
Modal
export type Modal = {
modalId?: ModalId
hideOverlay: Ref<boolean | undefined> | undefined
overlayVisible: Ref<boolean>
toggle: (show?: boolean) => Promise<string>
}