UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

2 lines 7.79 kB
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("rxjs"),require("ng-zorro-antd/core"),require("@angular/common"),require("ng-zorro-antd/icon"),require("@angular/cdk/overlay"),require("@angular/core"),require("ng-zorro-antd/message")):"function"==typeof define&&define.amd?define("ng-zorro-antd/notification",["exports","rxjs","ng-zorro-antd/core","@angular/common","ng-zorro-antd/icon","@angular/cdk/overlay","@angular/core","ng-zorro-antd/message"],n):n((t["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].notification={}),t.rxjs,t["ng-zorro-antd"].core,t.ng.common,t["ng-zorro-antd"].icon,t.ng.cdk.overlay,t.ng.core,t["ng-zorro-antd"].message)}(this,function(t,o,i,n,e,a,c,r){"use strict";var s=new c.InjectionToken("NZ_NOTIFICATION_DEFAULT_CONFIG"),p=new c.InjectionToken("NZ_NOTIFICATION_CONFIG"),l={provide:s,useValue:{nzTop:"24px",nzBottom:"24px",nzPlacement:"topRight",nzDuration:4500,nzMaxStack:7,nzPauseOnHover:!0,nzAnimate:!0}},f=function(t,n){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function g(t,n){function e(){this.constructor=t}f(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var u,m=function(){return(m=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},y=(g(z,u=r.NzMessageContainerComponent),z.prototype.setConfig=function(t){var n=this.config=m({},this.config,t),e=this.config.nzPlacement;this.top="topLeft"===e||"topRight"===e?i.toCssPixel(n.nzTop):null,this.bottom="bottomLeft"===e||"bottomRight"===e?i.toCssPixel(n.nzBottom):null,this.cdr.markForCheck()},z.prototype.createMessage=function(n){n.options=this._mergeMessageOptions(n.options),n.onClose=new o.Subject;var t=n.options.nzKey,e=this.messages.find(function(t){return t.options.nzKey===n.options.nzKey});t&&e?this.replaceNotification(e,n):(this.messages.length>=this.config.nzMaxStack&&this.messages.splice(0,1),this.messages.push(n)),this.cdr.detectChanges()},z.prototype.replaceNotification=function(t,n){t.title=n.title,t.content=n.content,t.template=n.template,t.type=n.type},z.decorators=[{type:c.Component,args:[{changeDetection:c.ChangeDetectionStrategy.OnPush,encapsulation:c.ViewEncapsulation.None,selector:"nz-notification-container",exportAs:"nzNotificationContainer",preserveWhitespaces:!1,template:"<div\n class=\"ant-notification ant-notification-{{config.nzPlacement}}\"\n [style.top]=\"(config.nzPlacement === 'topLeft' || config.nzPlacement === 'topRight') ? top : null\"\n [style.bottom]=\"(config.nzPlacement === 'bottomLeft' || config.nzPlacement === 'bottomRight') ? bottom : null\"\n [style.right]=\"(config.nzPlacement === 'bottomRight' || config.nzPlacement === 'topRight') ? '0px' : null\"\n [style.left]=\"(config.nzPlacement === 'topLeft' || config.nzPlacement === 'bottomLeft') ? '0px' : null\">\n <nz-notification\n *ngFor=\"let message of messages; let i = index\"\n [nzMessage]=\"message\"\n [nzIndex]=\"i\">\n </nz-notification>\n</div>"}]}],z.ctorParameters=function(){return[{type:c.ChangeDetectorRef},{type:undefined,decorators:[{type:c.Optional},{type:c.Inject,args:[s]}]},{type:undefined,decorators:[{type:c.Optional},{type:c.Inject,args:[p]}]}]},z);function z(t,n,e){var o=u.call(this,t,n,e)||this;return o.messages=[],o}var d,h=(g(v,d=r.NzMessageComponent),v.prototype.close=function(){this._destroy(!0)},Object.defineProperty(v.prototype,"state",{get:function(){return"enter"===this.nzMessage.state?"topLeft"===this.container.config.nzPlacement||"bottomLeft"===this.container.config.nzPlacement?"enterLeft":"enterRight":this.nzMessage.state},enumerable:!0,configurable:!0}),v.decorators=[{type:c.Component,args:[{encapsulation:c.ViewEncapsulation.None,selector:"nz-notification",exportAs:"nzNotification",preserveWhitespaces:!1,animations:[i.notificationMotion],template:'<div class="ant-notification-notice ant-notification-notice-closable"\n [ngStyle]="nzMessage.options?.nzStyle"\n [ngClass]="nzMessage.options?.nzClass"\n [@notificationMotion]="state"\n (mouseenter)="onEnter()"\n (mouseleave)="onLeave()">\n <div *ngIf="!nzMessage.template" class="ant-notification-notice-content">\n <div class="ant-notification-notice-content" [ngClass]="{ \'ant-notification-notice-with-icon\': nzMessage.type !== \'blank\' }">\n <div [class.ant-notification-notice-with-icon]="nzMessage.type !== \'blank\'">\n <ng-container [ngSwitch]="nzMessage.type">\n <i *ngSwitchCase="\'success\'" nz-icon type="check-circle" class="ant-notification-notice-icon ant-notification-notice-icon-success"></i>\n <i *ngSwitchCase="\'info\'" nz-icon type="info-circle" class="ant-notification-notice-icon ant-notification-notice-icon-info"></i>\n <i *ngSwitchCase="\'warning\'" nz-icon type="exclamation-circle" class="ant-notification-notice-icon ant-notification-notice-icon-warning"></i>\n <i *ngSwitchCase="\'error\'" nz-icon type="close-circle" class="ant-notification-notice-icon ant-notification-notice-icon-error"></i>\n </ng-container>\n <div class="ant-notification-notice-message" [innerHTML]="nzMessage.title"></div>\n <div class="ant-notification-notice-description" [innerHTML]="nzMessage.content"></div>\n </div>\n </div>\n </div>\n <ng-template\n [ngIf]="nzMessage.template"\n [ngTemplateOutlet]="nzMessage.template"\n [ngTemplateOutletContext]="{ $implicit: this, data: nzMessage.options?.nzData }">\n </ng-template>\n <a tabindex="0" class="ant-notification-notice-close" (click)="close()">\n <span class="ant-notification-notice-close-x">\n <i nz-icon type="close" class="ant-notification-close-icon"></i>\n </span>\n </a>\n</div>'}]}],v.ctorParameters=function(){return[{type:y},{type:c.ChangeDetectorRef}]},v.propDecorators={nzMessage:[{type:c.Input}]},v);function v(t,n){var e=d.call(this,t,n)||this;return e.container=t,e.cdr=n,e}var C,N=(g(M,C=r.NzMessageBaseService),M.prototype.success=function(t,n,e){return this.createMessage({type:"success",title:t,content:n},e)},M.prototype.error=function(t,n,e){return this.createMessage({type:"error",title:t,content:n},e)},M.prototype.info=function(t,n,e){return this.createMessage({type:"info",title:t,content:n},e)},M.prototype.warning=function(t,n,e){return this.createMessage({type:"warning",title:t,content:n},e)},M.prototype.blank=function(t,n,e){return this.createMessage({type:"blank",title:t,content:n},e)},M.prototype.create=function(t,n,e,o){return this.createMessage({type:t,title:n,content:e},o)},M.prototype.template=function(t,n){return this.createMessage({template:t},n)},M.decorators=[{type:c.Injectable,args:[{providedIn:"root"}]}],M.ctorParameters=function(){return[{type:a.Overlay},{type:c.Injector},{type:c.ComponentFactoryResolver},{type:c.ApplicationRef}]},M.ngInjectableDef=c.defineInjectable({factory:function(){return new M(c.inject(a.Overlay),c.inject(c.INJECTOR),c.inject(c.ComponentFactoryResolver),c.inject(c.ApplicationRef))},token:M,providedIn:"root"}),M);function M(t,n,e,o){return C.call(this,t,y,n,e,o,"notification-")||this}var I=(O.decorators=[{type:c.NgModule,args:[{imports:[n.CommonModule,a.OverlayModule,e.NzIconModule],declarations:[h,y],providers:[l,N],entryComponents:[y]}]}],O);function O(){}t.NZ_NOTIFICATION_DEFAULT_CONFIG=s,t.NZ_NOTIFICATION_CONFIG=p,t.NZ_NOTIFICATION_DEFAULT_CONFIG_PROVIDER=l,t.NzNotificationComponent=h,t.NzNotificationModule=I,t.NzNotificationService=N,t.NzNotificationContainerComponent=y,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ng-zorro-antd-notification.umd.min.js.map