diff --git a/src/app/components/toast/toast.interface.ts b/src/app/components/toast/toast.interface.ts index 3c01b9eac73..b73f8ebebe0 100644 --- a/src/app/components/toast/toast.interface.ts +++ b/src/app/components/toast/toast.interface.ts @@ -1,6 +1,5 @@ import { TemplateRef } from '@angular/core'; import { Message } from 'primeng/api'; -import { Toast } from './toast'; /** * Defines valid templates in Toast. @@ -17,6 +16,7 @@ export interface ToastTemplates { $implicit: any; }): TemplateRef<{ $implicit: any }>; } + /** * Custom close event. * @see {@link Toast.onClose} @@ -28,6 +28,7 @@ export interface ToastCloseEvent { */ message: Message; } + /** * Custom close event. * @see {@link ToastItem.onClose} @@ -38,3 +39,5 @@ export interface ToastItemCloseEvent extends ToastCloseEvent { */ index: number; } + +export type ToastPositionType = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center'; diff --git a/src/app/components/toast/toast.ts b/src/app/components/toast/toast.ts index 842bec2f66d..167b033439b 100755 --- a/src/app/components/toast/toast.ts +++ b/src/app/components/toast/toast.ts @@ -31,7 +31,7 @@ import { TimesCircleIcon } from 'primeng/icons/timescircle'; import { RippleModule } from 'primeng/ripple'; import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils'; import { Subscription } from 'rxjs'; -import { ToastCloseEvent, ToastItemCloseEvent } from './toast.interface'; +import { ToastCloseEvent, ToastItemCloseEvent, ToastPositionType } from './toast.interface'; @Component({ selector: 'p-toastItem', @@ -92,7 +92,13 @@ import { ToastCloseEvent, ToastItemCloseEvent } from './toast.interface'; opacity: 1 }) ), - transition('void => *', [style({ transform: '{{showTransformParams}}', opacity: 0 }), animate('{{showTransitionParams}}')]), + transition('void => *', [ + style({ + transform: '{{showTransformParams}}', + opacity: 0 + }), + animate('{{showTransitionParams}}') + ]), transition('* => void', [ animate( '{{hideTransitionParams}}', @@ -183,6 +189,7 @@ export class ToastItem implements AfterViewInit, OnDestroy { this.clearTimeout(); } } + /** * Toast is used to display messages in an overlay. * @group Components @@ -190,7 +197,7 @@ export class ToastItem implements AfterViewInit, OnDestroy { @Component({ selector: 'p-toast', template: ` -