UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 3.24 kB
{"version":3,"file":"message.mjs","sources":["../../../../../../packages/components/message/src/message.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils/props'\n\nimport type { VNode, ExtractPropTypes, Component } from 'vue'\n\nexport const messageTypes = ['success', 'info', 'warning', 'error'] as const\n\nexport const messageProps = buildProps({\n customClass: {\n type: String,\n default: '',\n },\n center: {\n type: Boolean,\n default: false,\n },\n dangerouslyUseHTMLString: {\n type: Boolean,\n default: false,\n },\n duration: {\n type: Number,\n default: 3000,\n },\n icon: {\n type: definePropType<string | Component>([String, Object]),\n default: '',\n },\n id: {\n type: String,\n default: '',\n },\n message: {\n type: definePropType<string | VNode>([String, Object]),\n default: '',\n },\n onClose: {\n type: definePropType<() => void>(Function),\n required: false,\n },\n showClose: {\n type: Boolean,\n default: false,\n },\n type: {\n type: String,\n values: messageTypes,\n default: 'info',\n },\n offset: {\n type: Number,\n default: 20,\n },\n zIndex: {\n type: Number,\n default: 0,\n },\n grouping: {\n type: Boolean,\n default: false,\n },\n repeatNum: {\n type: Number,\n default: 1,\n },\n} as const)\nexport type MessageProps = ExtractPropTypes<typeof messageProps>\n\nexport const messageEmits = {\n destroy: () => true,\n}\nexport type MessageEmits = typeof messageEmits\n\nexport type MessageOptions = Omit<MessageProps, 'id'> & {\n appendTo?: HTMLElement | string\n}\nexport type MessageOptionsTyped = Omit<MessageOptions, 'type'>\n\nexport interface MessageHandle {\n close: () => void\n}\n\nexport type MessageParams = Partial<MessageOptions> | string | VNode\nexport type MessageParamsTyped = Partial<MessageOptionsTyped> | string | VNode\n\nexport type MessageFn = ((options?: MessageParams) => MessageHandle) & {\n closeAll(): void\n}\nexport type MessageTypedFn = (options?: MessageParamsTyped) => MessageHandle\n\nexport interface Message extends MessageFn {\n success: MessageTypedFn\n warning: MessageTypedFn\n info: MessageTypedFn\n error: MessageTypedFn\n}\n\ntype MessageQueueItem = {\n vm: VNode\n}\n\nexport type MessageQueue = MessageQueueItem[]\n"],"names":[],"mappings":";;MAIa,eAAe,CAAC,WAAW,QAAQ,WAAW;MAE9C,eAAe,WAAW;AAAA,EACrC,aAAa;AAAA,IACX,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,0BAA0B;AAAA,IACxB,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,UAAU;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,MAAM;AAAA,IACJ,MAAM,eAAmC,CAAC,QAAQ;AAAA,IAClD,SAAS;AAAA;AAAA,EAEX,IAAI;AAAA,IACF,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,SAAS;AAAA,IACP,MAAM,eAA+B,CAAC,QAAQ;AAAA,IAC9C,SAAS;AAAA;AAAA,EAEX,SAAS;AAAA,IACP,MAAM,eAA2B;AAAA,IACjC,UAAU;AAAA;AAAA,EAEZ,WAAW;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA;AAAA,EAEX,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,UAAU;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,WAAW;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA;AAAA;MAKA,eAAe;AAAA,EAC1B,SAAS,MAAM;AAAA;;;;"}