sard-uniapp
Version:
sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库
400 lines (399 loc) • 12.3 kB
TypeScript
import { type StyleValue } from 'vue';
import { type ButtonProps } from '../button';
import { type TransitionHookEmits } from '../popup/common';
export type DialogBeforeClose = (type: 'close' | 'cancel' | 'confirm', loading: {
readonly cancel: boolean;
readonly confirm: boolean;
readonly close: boolean;
}) => any | Promise<any>;
export interface DialogProps {
rootStyle?: StyleValue;
rootClass?: string;
popupStyle?: StyleValue;
popupClass?: string;
visible?: boolean;
title?: string;
message?: string;
headed?: boolean;
buttonType?: 'round' | 'text';
showCancel?: boolean;
cancelText?: string;
showConfirm?: boolean;
confirmText?: string;
overlayClosable?: boolean;
beforeClose?: DialogBeforeClose;
duration?: number;
cancelProps?: ButtonProps;
confirmProps?: ButtonProps;
}
export declare const defaultDialogProps: {
rootStyle?: (string | false | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => string | false | import("vue").CSSProperties | StyleValue[]) | null) | undefined;
rootClass?: (string | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => string)) | undefined;
popupStyle?: (string | false | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => string | false | import("vue").CSSProperties | StyleValue[]) | null) | undefined;
popupClass?: (string | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => string)) | undefined;
visible?: (boolean | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => boolean)) | undefined;
title?: (string | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => string)) | undefined;
message?: (string | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => string)) | undefined;
headed?: (boolean | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => boolean)) | undefined;
buttonType?: ("text" | "round" | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => "text" | "round")) | undefined;
showCancel?: (boolean | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => boolean)) | undefined;
cancelText?: (string | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => string)) | undefined;
showConfirm?: (boolean | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => boolean)) | undefined;
confirmText?: (string | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => string)) | undefined;
overlayClosable?: (boolean | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => boolean)) | undefined;
beforeClose?: (DialogBeforeClose | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => DialogBeforeClose)) | undefined;
duration?: (number | ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => number)) | undefined;
cancelProps?: ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => ButtonProps) | undefined;
confirmProps?: ((props: {
rootStyle: StyleValue;
rootClass: string;
popupStyle: StyleValue;
popupClass: string;
visible: boolean;
title: string;
message: string;
headed: boolean;
buttonType: "round" | "text";
showCancel: boolean;
cancelText: string;
showConfirm: boolean;
confirmText: string;
overlayClosable: boolean;
beforeClose: DialogBeforeClose;
duration: number;
cancelProps: ButtonProps;
confirmProps: ButtonProps;
}) => ButtonProps) | undefined;
};
export interface DialogSlots {
default?(props: Record<string, never>): any;
}
export interface DialogEmits extends TransitionHookEmits {
(e: 'update:visible', visible: boolean): void;
(e: 'close'): void;
(e: 'cancel'): void;
(e: 'confirm'): void;
}