38 lines
691 B
TypeScript
38 lines
691 B
TypeScript
import type { Component } from 'vue'
|
|
|
|
export class Popup<P> {
|
|
component?: Component
|
|
payload?: P
|
|
config?: PopupConfig
|
|
|
|
public static component<P>(component: Component): Popup<P> {
|
|
const popup = new Popup<P>()
|
|
popup.component = component
|
|
return popup
|
|
}
|
|
|
|
public setPayload(payload: P) {
|
|
this.payload = payload
|
|
return this
|
|
}
|
|
|
|
public setConfig(config: PopupConfig) {
|
|
this.config = config
|
|
return this
|
|
}
|
|
}
|
|
|
|
export interface PopupConfig {
|
|
heading: string
|
|
size: PopupSize
|
|
closeOnOverlayClick?: boolean
|
|
callback?: (payload?: unknown) => void
|
|
}
|
|
|
|
export enum PopupSize {
|
|
SMALL = 'small',
|
|
MEDIUM = 'medium',
|
|
LARGE = 'large',
|
|
FULL = 'full',
|
|
}
|