e4bf35aa3e8c2fee3dac5c16c9c9202155967dca72aa8d23bf5db1d645a59816173fb3bc5ccc4113e904ebac6d3ddc5ecd3354449b00c1ea96b4410fddcb13 5.8 KB

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