@minto-ai/mt-ui
Version:
UI组件库
125 lines (124 loc) • 3.38 kB
TypeScript
import { ExtractPropTypes, InjectionKey, PropType, Ref } from 'vue';
declare const dialogProps: {
/**
* 是否显示 Dialog
*/
readonly modelValue: {
readonly type: BooleanConstructor;
readonly default: false;
};
/**
* Dialog 挂载到哪个 DOM 元素
*/
readonly appendTo: {
readonly type: PropType<string | HTMLElement>;
readonly default: "body";
};
/**
* 是否显示遮罩层
*/
readonly mask: {
readonly type: BooleanConstructor;
readonly default: true;
};
/**
* 关闭时是否销毁 DOM 元素
*/
readonly destroyOnClose: {
readonly type: BooleanConstructor;
readonly default: false;
};
/**
* 弹框距离顶部的距离
*/
readonly top: {
readonly type: PropType<string | number>;
readonly validator: (value: number | string) => boolean;
readonly default: "15vh";
};
/**
* 弹框的宽度,默认值为 fit-content
*/
readonly width: {
readonly type: PropType<string | number>;
readonly validator: (value: number | string) => boolean;
readonly default: "fit-content";
};
/**
* 弹框内边距
*/
readonly padding: {
readonly type: PropType<Array<number | number> | number | string>;
readonly validator: (value: number | string | Array<number | string>) => boolean;
readonly default: () => number[];
};
/**
* 是否显示关闭按钮
*/
readonly showClose: {
readonly type: BooleanConstructor;
readonly default: true;
};
/**
* 弹框的标题
*/
readonly title: {
readonly type: StringConstructor;
readonly default: "";
};
/**
* 是否设置弹框的位置居中
*/
readonly alignCenter: {
readonly type: BooleanConstructor;
readonly default: false;
};
/**
* 是否可以通过点击 modal 关闭 Dialog
*/
readonly closeOnClickModal: {
readonly type: BooleanConstructor;
readonly default: true;
};
/**
* 关闭前的回调函数。
* 当用户尝试关闭 Dialog 时,会触发此回调。
* 回调函数返回一个 Promise,只有当 Promise 被解析(resolve)时,Dialog 才会关闭。
* 如果 Promise 被拒绝(reject),Dialog 不会关闭。
* 这可以用于在关闭前执行异步操作,例如确认用户意图或保存数据。
*/
readonly beforeClose: {
readonly type: PropType<() => Promise<any>>;
readonly default: () => Promise<void>;
};
/**
* 弹框的背景色
*/
readonly background: {
readonly type: StringConstructor;
readonly default: "#fff";
};
/**
* 设置z-index
*/
readonly zIndex: {
readonly type: NumberConstructor;
};
/**
* 是否为全屏 Dialog
*/
readonly fullscreen: {
readonly type: BooleanConstructor;
readonly default: false;
};
};
export { dialogProps };
export type DialogProps = ExtractPropTypes<typeof dialogProps>;
interface DialogContext {
visible: Ref<boolean>;
}
declare const DialogKey: InjectionKey<DialogContext>;
export { DialogKey, };
export interface DialogExpose {
close: () => void;
}