16 lines
9.6 KiB
JavaScript
16 lines
9.6 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("primeng/dom"),require("primeng/api"),require("primeng/ripple"),require("@angular/animations")):"function"==typeof define&&define.amd?define("primeng/toast",["exports","@angular/core","@angular/common","primeng/dom","primeng/api","primeng/ripple","@angular/animations"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).primeng=e.primeng||{},e.primeng.toast={}),e.ng.core,e.ng.common,e.primeng.dom,e.primeng.api,e.primeng.ripple,e.ng.animations)}(this,(function(e,t,s,n,i,o,a){"use strict";
|
|
/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */Object.create;function r(e,t){var s="function"==typeof Symbol&&e[Symbol.iterator];if(!s)return e;var n,i,o=s.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}return a}function p(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e}Object.create;var m=function(){function e(e){this.zone=e,this.onClose=new t.EventEmitter}return e.prototype.ngAfterViewInit=function(){this.initTimeout()},e.prototype.initTimeout=function(){var e=this;this.message.sticky||this.zone.runOutsideAngular((function(){e.timeout=setTimeout((function(){e.onClose.emit({index:e.index,message:e.message})}),e.message.life||3e3)}))},e.prototype.clearTimeout=function(){this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},e.prototype.onMouseEnter=function(){this.clearTimeout()},e.prototype.onMouseLeave=function(){this.initTimeout()},e.prototype.onCloseIconClick=function(e){this.clearTimeout(),this.onClose.emit({index:this.index,message:this.message}),e.preventDefault()},e.prototype.ngOnDestroy=function(){this.clearTimeout()},e}();m.decorators=[{type:t.Component,args:[{selector:"p-toastItem",template:'\n <div #container [attr.id]="message.id" class="p-toast-message" [ngClass]="\'p-toast-message-\' + message.severity" [@messageState]="{value: \'visible\', params: {showTransformParams: showTransformOptions, hideTransformParams: hideTransformOptions, showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}"\n (mouseenter)="onMouseEnter()" (mouseleave)="onMouseLeave()">\n <div class="p-toast-message-content" role="alert" aria-live="assertive" aria-atomic="true">\n <ng-container *ngIf="!template">\n <span class="p-toast-message-icon pi" [ngClass]="{\'pi-info-circle\': message.severity == \'info\', \'pi-exclamation-triangle\': message.severity == \'warn\',\n \'pi-times-circle\': message.severity == \'error\', \'pi-check\' :message.severity == \'success\'}"></span>\n <div class="p-toast-message-text">\n <div class="p-toast-summary">{{message.summary}}</div>\n <div class="p-toast-detail">{{message.detail}}</div>\n </div>\n </ng-container>\n <button type="button" class="p-toast-icon-close p-link" (click)="onCloseIconClick($event)" (keydown.enter)="onCloseIconClick($event)" *ngIf="message.closable !== false" pRipple>\n <span class="p-toast-icon-close-icon pi pi-times"></span>\n </button>\n <ng-container *ngTemplateOutlet="template; context: {$implicit: message}"></ng-container>\n </div>\n </div>\n ',animations:[a.trigger("messageState",[a.state("visible",a.style({transform:"translateY(0)",opacity:1})),a.transition("void => *",[a.style({transform:"{{showTransformParams}}",opacity:0}),a.animate("{{showTransitionParams}}")]),a.transition("* => void",[a.animate("{{hideTransitionParams}}",a.style({height:0,opacity:0,transform:"{{hideTransformParams}}"}))])])],encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush}]}],m.ctorParameters=function(){return[{type:t.NgZone}]},m.propDecorators={message:[{type:t.Input}],index:[{type:t.Input}],template:[{type:t.Input}],showTransformOptions:[{type:t.Input}],hideTransformOptions:[{type:t.Input}],showTransitionOptions:[{type:t.Input}],hideTransitionOptions:[{type:t.Input}],onClose:[{type:t.Output}],containerViewChild:[{type:t.ViewChild,args:["container"]}]};var l=function(){function e(e,s){this.messageService=e,this.cd=s,this.autoZIndex=!0,this.baseZIndex=0,this.position="top-right",this.preventOpenDuplicates=!1,this.preventDuplicates=!1,this.showTransformOptions="translateY(100%)",this.hideTransformOptions="translateY(-100%)",this.showTransitionOptions="300ms ease-out",this.hideTransitionOptions="250ms ease-in",this.onClose=new t.EventEmitter}return e.prototype.ngOnInit=function(){var e=this;this.messageSubscription=this.messageService.messageObserver.subscribe((function(t){if(t)if(t instanceof Array){var s=t.filter((function(t){return e.canAdd(t)}));e.add(s)}else e.canAdd(t)&&e.add([t])})),this.clearSubscription=this.messageService.clearObserver.subscribe((function(t){t?e.key===t&&(e.messages=null):e.messages=null,e.cd.markForCheck()}))},e.prototype.add=function(e){this.messages=this.messages?p(this.messages,e):p(e),this.preventDuplicates&&(this.messagesArchieve=this.messagesArchieve?p(this.messagesArchieve,e):p(e)),this.cd.markForCheck()},e.prototype.canAdd=function(e){var t=this.key===e.key;return t&&this.preventOpenDuplicates&&(t=!this.containsMessage(this.messages,e)),t&&this.preventDuplicates&&(t=!this.containsMessage(this.messagesArchieve,e)),t},e.prototype.containsMessage=function(e,t){return!!e&&null!=e.find((function(e){return e.summary===t.summary&&e.detail==t.detail&&e.severity===t.severity}))},e.prototype.ngAfterContentInit=function(){var e=this;this.templates.forEach((function(t){switch(t.getType()){case"message":default:e.template=t.template}}))},e.prototype.onMessageClose=function(e){this.messages.splice(e.index,1),this.onClose.emit({message:e.message}),this.cd.detectChanges()},e.prototype.onAnimationStart=function(e){"void"===e.fromState&&this.autoZIndex&&(this.containerViewChild.nativeElement.style.zIndex=String(this.baseZIndex+ ++n.DomHandler.zindex))},e.prototype.ngOnDestroy=function(){this.messageSubscription&&this.messageSubscription.unsubscribe(),this.clearSubscription&&this.clearSubscription.unsubscribe()},e}();l.decorators=[{type:t.Component,args:[{selector:"p-toast",template:'\n <div #container [ngClass]="\'p-toast p-component p-toast-\' + position" [ngStyle]="style" [class]="styleClass">\n <p-toastItem *ngFor="let msg of messages; let i=index" [message]="msg" [index]="i" (onClose)="onMessageClose($event)"\n [template]="template" @toastAnimation (@toastAnimation.start)="onAnimationStart($event)" \n [showTransformOptions]="showTransformOptions" [hideTransformOptions]="hideTransformOptions" \n [showTransitionOptions]="showTransitionOptions" [hideTransitionOptions]="hideTransitionOptions"></p-toastItem>\n </div>\n ',animations:[a.trigger("toastAnimation",[a.transition(":enter, :leave",[a.query("@*",a.animateChild())])])],changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,styles:[".p-toast{position:fixed;width:25rem}.p-toast-message{overflow:hidden}.p-toast-message-content{-ms-flex-align:start;align-items:flex-start;display:-ms-flexbox;display:flex}.p-toast-message-text{-ms-flex:1 1 auto;flex:1 1 auto}.p-toast-top-right{right:20px;top:20px}.p-toast-top-left{left:20px;top:20px}.p-toast-bottom-left{bottom:20px;left:20px}.p-toast-bottom-right{bottom:20px;right:20px}.p-toast-top-center{left:50%;margin-left:-10em;top:20px}.p-toast-bottom-center{bottom:20px;left:50%;margin-left:-10em}.p-toast-center{-ms-transform:translate(-50%,-50%);left:50%;min-width:20vw;top:50%;transform:translate(-50%,-50%)}.p-toast-icon-close{-ms-flex-align:center;-ms-flex-pack:center;align-items:center;display:-ms-flexbox;display:flex;justify-content:center;overflow:hidden;position:relative}.p-toast-icon-close.p-link{cursor:pointer}"]}]}],l.ctorParameters=function(){return[{type:i.MessageService},{type:t.ChangeDetectorRef}]},l.propDecorators={key:[{type:t.Input}],autoZIndex:[{type:t.Input}],baseZIndex:[{type:t.Input}],style:[{type:t.Input}],styleClass:[{type:t.Input}],position:[{type:t.Input}],preventOpenDuplicates:[{type:t.Input}],preventDuplicates:[{type:t.Input}],showTransformOptions:[{type:t.Input}],hideTransformOptions:[{type:t.Input}],showTransitionOptions:[{type:t.Input}],hideTransitionOptions:[{type:t.Input}],onClose:[{type:t.Output}],containerViewChild:[{type:t.ViewChild,args:["container"]}],templates:[{type:t.ContentChildren,args:[i.PrimeTemplate]}]};var c=function(){};c.decorators=[{type:t.NgModule,args:[{imports:[s.CommonModule,o.RippleModule],exports:[l,i.SharedModule],declarations:[l,m]}]}],e.Toast=l,e.ToastItem=m,e.ToastModule=c,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
//# sourceMappingURL=primeng-toast.umd.min.js.map
|