@extclp/vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
48 lines (47 loc) • 1.64 kB
TypeScript
import { ComponentPublicInstance } from 'vue';
import { ButtonType } from '../button';
import { IconMinorProps } from '../icon';
export type ConfirmButtonType = ButtonType;
export type ConfirmAlign = 'left' | 'center' | 'right';
export interface ConfirmState {
visible: boolean;
loading: boolean;
title: string | (() => any);
content: string | (() => any);
icon: Record<string, any> | (() => any) | null | boolean;
iconProps: IconMinorProps;
className: string | Record<string, any>;
style: string | Record<string, any>;
confirmType: ConfirmButtonType;
cancelType: ConfirmButtonType;
confirmText: string;
cancelText: string;
maskClose: boolean;
parseHtml: boolean;
closable: boolean;
contentAlign: ConfirmAlign;
actionsAlign: ConfirmAlign;
cancelable: boolean;
width: number | string;
height: number | string;
top: number | string;
right: number | string;
bottom: number | string;
left: number | string;
xOffset: number | string;
yOffset: number | string;
/**
* Record the raw option.
*/
raw: Record<any, any>;
}
export type ConfirmRenderFn = (options: ConfirmState, handleConfirm: () => Promise<void>, handleCancel: () => void) => any;
export interface ConfirmOptions extends Partial<Omit<ConfirmState, 'visible' | 'loading' | 'raw'>>, Record<any, any> {
renderer?: ConfirmRenderFn;
onBeforeConfirm?: () => unknown;
}
export interface ConfirmInstance extends ComponentPublicInstance {
openConfirm: (options: ConfirmOptions) => Promise<boolean>;
closeConfirm: () => void;
handleReset: () => void;
}