fix(#28,#29): DEFAULTS补全notifyWhenHidden; types补全action/group/QueueControl/ActionButton等新增API类型
This commit is contained in:
@@ -47,6 +47,7 @@ export const DEFAULTS = Object.freeze({
|
|||||||
|
|
||||||
// 高级
|
// 高级
|
||||||
resetTimerOnUpdate: false,
|
resetTimerOnUpdate: false,
|
||||||
|
notifyWhenHidden: false,
|
||||||
|
|
||||||
// 国际化
|
// 国际化
|
||||||
locale: 'zh-CN',
|
locale: 'zh-CN',
|
||||||
|
|||||||
Vendored
+55
-1
@@ -268,12 +268,58 @@ export interface ToastConfig {
|
|||||||
onClose?: (toast: ToastInstance) => void;
|
onClose?: (toast: ToastInstance) => void;
|
||||||
/** 点击回调 */
|
/** 点击回调 */
|
||||||
onClick?: (toast: ToastInstance) => void;
|
onClick?: (toast: ToastInstance) => void;
|
||||||
|
/** 更新回调 */
|
||||||
|
onUpdate?: (toast: ToastInstance) => void;
|
||||||
|
/** 自定义渲染函数 */
|
||||||
|
render?: (toast: ToastInstance) => string;
|
||||||
|
/** 更新时重置计时器 */
|
||||||
|
resetTimerOnUpdate?: boolean;
|
||||||
|
/** 后台发送系统通知 */
|
||||||
|
notifyWhenHidden?: boolean;
|
||||||
|
/** 分组名称 */
|
||||||
|
group?: string;
|
||||||
/** 语言 */
|
/** 语言 */
|
||||||
locale?: ToastLocale;
|
locale?: ToastLocale;
|
||||||
/** 插件 */
|
/** 插件 */
|
||||||
plugins?: Array<string | Plugin>;
|
plugins?: Array<string | Plugin>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Action Toast 按钮 */
|
||||||
|
export interface ActionButton {
|
||||||
|
text: string;
|
||||||
|
onClick: (toast: ToastInstance) => void;
|
||||||
|
color?: string;
|
||||||
|
style?: Partial<CSSStyleDeclaration>;
|
||||||
|
close?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 可取消的队列 */
|
||||||
|
export interface QueueControl {
|
||||||
|
then: (onFulfilled?: (value: any) => any, onRejected?: (reason: any) => any) => Promise<any>;
|
||||||
|
catch: (onRejected?: (reason: any) => any) => Promise<any>;
|
||||||
|
cancel: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 分组API */
|
||||||
|
export interface GroupAPI {
|
||||||
|
show: (messageOrOpts: string | ToastOptions, opts?: ToastOptions) => ToastInstance;
|
||||||
|
success: (messageOrOpts: string | ToastOptions, opts?: ToastOptions) => ToastInstance;
|
||||||
|
error: (messageOrOpts: string | ToastOptions, opts?: ToastOptions) => ToastInstance;
|
||||||
|
warning: (messageOrOpts: string | ToastOptions, opts?: ToastOptions) => ToastInstance;
|
||||||
|
info: (messageOrOpts: string | ToastOptions, opts?: ToastOptions) => ToastInstance;
|
||||||
|
loading: (messageOrOpts: string | ToastOptions, opts?: ToastOptions) => LoadingControl;
|
||||||
|
action: (messageOrOpts: string | ToastOptions, actions: ActionButton[], opts?: ToastOptions) => ActionControl;
|
||||||
|
dismiss: () => void;
|
||||||
|
count: () => number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Action Toast 控制对象 */
|
||||||
|
export interface ActionControl {
|
||||||
|
id: string;
|
||||||
|
toast: ToastInstance;
|
||||||
|
dismiss: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
// Toast选项
|
// Toast选项
|
||||||
export interface ToastOptions extends ToastConfig {
|
export interface ToastOptions extends ToastConfig {
|
||||||
/** Toast类型 */
|
/** Toast类型 */
|
||||||
@@ -592,11 +638,19 @@ export interface MeToast {
|
|||||||
progress(message: string, options?: ProgressOptions): ProgressControl;
|
progress(message: string, options?: ProgressOptions): ProgressControl;
|
||||||
/** 倒计时Toast */
|
/** 倒计时Toast */
|
||||||
countdown(message: string, seconds: number, options?: CountdownOptions): CountdownControl;
|
countdown(message: string, seconds: number, options?: CountdownOptions): CountdownControl;
|
||||||
|
/** Action Toast */
|
||||||
|
action(message: string, actions: ActionButton[], options?: ToastOptions): ActionControl;
|
||||||
/** 队列Toast */
|
/** 队列Toast */
|
||||||
queue(messages: Array<string | ToastOptions>, options?: QueueOptions): Promise<void>;
|
queue(messages: Array<string | ToastOptions>, options?: QueueOptions): QueueControl;
|
||||||
/** 堆叠Toast */
|
/** 堆叠Toast */
|
||||||
stack(messages: Array<string | ToastOptions>, options?: StackOptions): void;
|
stack(messages: Array<string | ToastOptions>, options?: StackOptions): void;
|
||||||
|
|
||||||
|
// 分组管理
|
||||||
|
/** 创建分组 */
|
||||||
|
group(name: string): GroupAPI;
|
||||||
|
/** 按组关闭 */
|
||||||
|
dismissGroup(name: string): void;
|
||||||
|
|
||||||
// Toast管理
|
// Toast管理
|
||||||
/** 查找Toast */
|
/** 查找Toast */
|
||||||
find(id: string): ToastInstance | undefined;
|
find(id: string): ToastInstance | undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user