message.d.ts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import type { AppContext, ExtractPropTypes, VNode } from 'vue';
  2. import type { Mutable } from 'element-plus/es/utils';
  3. import type MessageConstructor from './message.vue';
  4. export declare const messageTypes: readonly ["success", "info", "warning", "error"];
  5. export type messageType = typeof messageTypes[number];
  6. export interface MessageConfigContext {
  7. max?: number;
  8. grouping?: boolean;
  9. duration?: number;
  10. offset?: number;
  11. showClose?: boolean;
  12. }
  13. export declare const messageDefaults: Mutable<{
  14. readonly customClass: "";
  15. readonly dangerouslyUseHTMLString: false;
  16. readonly duration: 3000;
  17. readonly icon: undefined;
  18. readonly id: "";
  19. readonly message: "";
  20. readonly onClose: undefined;
  21. readonly showClose: false;
  22. readonly type: "info";
  23. readonly plain: false;
  24. readonly offset: 16;
  25. readonly zIndex: 0;
  26. readonly grouping: false;
  27. readonly repeatNum: 1;
  28. readonly appendTo: HTMLElement;
  29. }>;
  30. export declare const messageProps: {
  31. readonly customClass: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
  32. readonly dangerouslyUseHTMLString: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
  33. readonly duration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 3000, boolean>;
  34. readonly icon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, undefined, boolean>;
  35. readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
  36. readonly message: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
  37. [key: string]: any;
  38. }> | (() => VNode)) | (() => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
  39. [key: string]: any;
  40. }> | (() => VNode)) | ((new (...args: any[]) => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
  41. [key: string]: any;
  42. }> | (() => VNode)) | (() => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
  43. [key: string]: any;
  44. }> | (() => VNode)))[], unknown, unknown, "", boolean>;
  45. readonly onClose: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => () => void) | (() => () => void) | {
  46. (): () => void;
  47. new (): any;
  48. readonly prototype: any;
  49. } | ((new (...args: any[]) => () => void) | (() => () => void) | {
  50. (): () => void;
  51. new (): any;
  52. readonly prototype: any;
  53. })[], unknown, unknown, undefined, boolean>;
  54. readonly showClose: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
  55. readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "error" | "success" | "warning" | "info", unknown, "info", boolean>;
  56. readonly plain: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
  57. readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 16, boolean>;
  58. readonly zIndex: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
  59. readonly grouping: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
  60. readonly repeatNum: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
  61. };
  62. export type MessageProps = ExtractPropTypes<typeof messageProps>;
  63. export declare const messageEmits: {
  64. destroy: () => boolean;
  65. };
  66. export type MessageEmits = typeof messageEmits;
  67. export type MessageInstance = InstanceType<typeof MessageConstructor> & unknown;
  68. export type MessageOptions = Partial<Mutable<Omit<MessageProps, 'id'> & {
  69. appendTo?: HTMLElement | string;
  70. }>>;
  71. export type MessageParams = MessageOptions | MessageOptions['message'];
  72. export type MessageParamsNormalized = Omit<MessageProps, 'id'> & {
  73. /**
  74. * @description set the root element for the message, default to `document.body`
  75. */
  76. appendTo: HTMLElement;
  77. };
  78. export type MessageOptionsWithType = Omit<MessageOptions, 'type'>;
  79. export type MessageParamsWithType = MessageOptionsWithType | MessageOptions['message'];
  80. export interface MessageHandler {
  81. /**
  82. * @description close the Message
  83. */
  84. close: () => void;
  85. }
  86. export type MessageFn = {
  87. (options?: MessageParams, appContext?: null | AppContext): MessageHandler;
  88. closeAll(type?: messageType): void;
  89. };
  90. export type MessageTypedFn = (options?: MessageParamsWithType, appContext?: null | AppContext) => MessageHandler;
  91. export type Message = MessageFn & {
  92. [K in messageType]: MessageTypedFn;
  93. };