You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
5.2 KiB

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