UNPKG

vue-admin-core

Version:
41 lines (40 loc) 2.31 kB
import { Component, DefineComponent, VNode } from "vue"; import { buttonProps } from "element-plus"; import { IMiddleware } from "@formily/shared"; export type PopupFooterProps = { addonAfter?: null | Component | VNode | (() => VNode); addonBefore?: null | Component | VNode | (() => VNode); addonCenter?: null | Component | VNode | (() => VNode); footer?: null | Component | VNode | (() => VNode); cancelText?: string | Component | VNode | (() => VNode); cancelButtonProps?: typeof buttonProps; okText?: string | Component | VNode | (() => VNode); okButtonProps?: typeof buttonProps; onCancel?: (flag: Boolean, fn: () => void) => void; onOK?: (flag: Boolean, fn: () => void) => void; okButtonHidden?: Boolean; cancelButtonHidden?: Boolean; }; export type PopupProps = { title?: PopupTitle; loadingText?: string; reject?: () => void; resolve?: () => void; } & PopupFooterProps; export type PopupTitle = string | number | Component | VNode | (() => VNode); export type PopupContent = Component | (() => VNode); export interface IPopup<Payload = any, Result = any, OpenProps = any> { forOpen(middleware: IMiddleware<Payload | OpenProps, OpenProps>): IPopup<Payload, Result, OpenProps>; forConfirm(middleware: IMiddleware<Payload, Result>): IPopup<Payload, Result, OpenProps>; forCancel(middleware: IMiddleware<Payload, Result>): IPopup<Payload, Result, OpenProps>; forReset(middleware: IMiddleware<Payload, Result>): IPopup<Payload, Result, OpenProps>; open(props?: OpenProps): Promise<Result>; resolve(props?: Payload): Promise<void>; reject(props?: Payload): Promise<void>; reset(props?: Payload): Promise<void>; close(): void; } export type UseElPopupResultType<Payload = PopupProps | PopupTitle, Result = PopupProps | PopupTitle, OpenProps = PopupProps | PopupTitle> = [IPopup<Payload, Result, OpenProps>, DefineComponent]; export declare const isPopupTitle: (props: any) => boolean; export declare const getPopupProps: (props: any) => any; export declare function useCorePopup<Payload = PopupProps | PopupTitle, Result = PopupProps | PopupTitle, OpenProps = PopupProps | PopupTitle>(title: PopupProps | PopupTitle, PopupComponent: any, content: PopupContent): UseElPopupResultType<Payload, Result, OpenProps>;