UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 3.62 kB
{"version":3,"file":"notification.mjs","sources":["../../../../../../packages/components/notification/src/notification.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils/props'\n\nimport type { VNode, ExtractPropTypes } from 'vue'\n\nexport const notificationTypes = [\n 'success',\n 'info',\n 'warning',\n 'error',\n] as const\n\nexport const notificationProps = buildProps({\n customClass: {\n type: String,\n default: '',\n },\n dangerouslyUseHTMLString: {\n type: Boolean,\n default: false,\n },\n duration: {\n type: Number,\n default: 4500,\n },\n icon: {\n type: definePropType<string | Comment>([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 offset: {\n type: Number,\n default: 0,\n },\n onClick: {\n type: definePropType<() => void>(Function),\n default: () => undefined,\n },\n onClose: {\n type: definePropType<() => void>(Function),\n required: true,\n },\n position: {\n type: String,\n values: ['top-right', 'top-left', 'bottom-right', 'bottom-left'],\n default: 'top-right',\n },\n showClose: {\n type: Boolean,\n default: true,\n },\n title: {\n type: String,\n default: '',\n },\n type: {\n type: String,\n values: [...notificationTypes, ''],\n default: '',\n },\n zIndex: {\n type: Number,\n default: 0,\n },\n} as const)\nexport type NotificationProps = ExtractPropTypes<typeof notificationProps>\n\nexport const notificationEmits = {\n destroy: () => true,\n}\nexport type NotificationEmits = typeof notificationEmits\n\nexport type NotificationOptions = Omit<NotificationProps, 'id'> & {\n appendTo?: HTMLElement | string\n}\nexport type NotificationOptionsTyped = Omit<NotificationOptions, 'type'>\n\nexport interface NotificationHandle {\n close: () => void\n}\n\nexport type NotificationParams = Partial<NotificationOptions> | string | VNode\nexport type NotificationParamsTyped =\n | Partial<NotificationOptionsTyped>\n | string\n | VNode\n\nexport type NotifyFn = ((\n options?: NotificationParams\n) => NotificationHandle) & { closeAll: () => void }\n\nexport type NotifyTypedFn = (\n options?: NotificationParamsTyped\n) => NotificationHandle\n\nexport interface Notify extends NotifyFn {\n success: NotifyTypedFn\n warning: NotifyTypedFn\n error: NotifyTypedFn\n info: NotifyTypedFn\n}\n\nexport interface NotificationQueueItem {\n vm: VNode\n}\n\nexport type NotificationQueue = NotificationQueueItem[]\n"],"names":[],"mappings":";;MAIa,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;MAGW,oBAAoB,WAAW;AAAA,EAC1C,aAAa;AAAA,IACX,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,eAAiC,CAAC,QAAQ;AAAA,IAChD,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,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,SAAS;AAAA,IACP,MAAM,eAA2B;AAAA,IACjC,SAAS,MAAM;AAAA;AAAA,EAEjB,SAAS;AAAA,IACP,MAAM,eAA2B;AAAA,IACjC,UAAU;AAAA;AAAA,EAEZ,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ,CAAC,aAAa,YAAY,gBAAgB;AAAA,IAClD,SAAS;AAAA;AAAA,EAEX,WAAW;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,OAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ,CAAC,GAAG,mBAAmB;AAAA,IAC/B,SAAS;AAAA;AAAA,EAEX,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA;AAAA;MAKA,oBAAoB;AAAA,EAC/B,SAAS,MAAM;AAAA;;;;"}