UNPKG

ng-zorro-antd

Version:

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

2 lines 7.85 kB
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("rxjs"),require("ng-zorro-antd/core"),require("ng-zorro-antd/message"),require("@angular/cdk/overlay"),require("@angular/common"),require("ng-zorro-antd/icon")):"function"==typeof define&&define.amd?define("ng-zorro-antd/notification",["exports","@angular/core","rxjs","ng-zorro-antd/core","ng-zorro-antd/message","@angular/cdk/overlay","@angular/common","ng-zorro-antd/icon"],n):n((t["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].notification={}),t.ng.core,t.rxjs,t["ng-zorro-antd"].core,t["ng-zorro-antd"].message,t.ng.cdk.overlay,t.ng.common,t["ng-zorro-antd"].icon)}(this,function(t,n,o,a,e,c,i,r){"use strict";var s=new n.InjectionToken("NZ_NOTIFICATION_DEFAULT_CONFIG"),p=new n.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=function(){return(u=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)},m=function(i){function t(t,n,e){var o=i.call(this,t,n,e)||this;return o.messages=[],o}return g(t,i),t.prototype.setConfig=function(t){var n=this.config=u({},this.config,t),e=this.config.nzPlacement;this.top="topLeft"===e||"topRight"===e?a.toCssPixel(n.nzTop):null,this.bottom="bottomLeft"===e||"bottomRight"===e?a.toCssPixel(n.nzBottom):null,this.cdr.markForCheck()},t.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()},t.prototype.replaceNotification=function(t,n){t.title=n.title,t.content=n.content,t.template=n.template,t.type=n.type},t.decorators=[{type:n.Component,args:[{changeDetection:n.ChangeDetectionStrategy.OnPush,encapsulation:n.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>"}]}],t.ctorParameters=function(){return[{type:n.ChangeDetectorRef},{type:undefined,decorators:[{type:n.Optional},{type:n.Inject,args:[s]}]},{type:undefined,decorators:[{type:n.Optional},{type:n.Inject,args:[p]}]}]},t}(e.NzMessageContainerComponent),y=function(o){function t(t,n){var e=o.call(this,t,n)||this;return e.container=t,e.cdr=n,e}return g(t,o),t.prototype.close=function(){this._destroy(!0)},Object.defineProperty(t.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}),t.decorators=[{type:n.Component,args:[{encapsulation:n.ViewEncapsulation.None,selector:"nz-notification",exportAs:"nzNotification",preserveWhitespaces:!1,animations:[a.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>'}]}],t.ctorParameters=function(){return[{type:m},{type:n.ChangeDetectorRef}]},t.propDecorators={nzMessage:[{type:n.Input}]},t}(e.NzMessageComponent),z=function(i){function t(t,n,e,o){return i.call(this,t,m,n,e,o,"notification-")||this}return g(t,i),t.prototype.success=function(t,n,e){return this.createMessage({type:"success",title:t,content:n},e)},t.prototype.error=function(t,n,e){return this.createMessage({type:"error",title:t,content:n},e)},t.prototype.info=function(t,n,e){return this.createMessage({type:"info",title:t,content:n},e)},t.prototype.warning=function(t,n,e){return this.createMessage({type:"warning",title:t,content:n},e)},t.prototype.blank=function(t,n,e){return this.createMessage({type:"blank",title:t,content:n},e)},t.prototype.create=function(t,n,e,o){return this.createMessage({type:t,title:n,content:e},o)},t.prototype.template=function(t,n){return this.createMessage({template:t},n)},t.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:c.Overlay},{type:n.Injector},{type:n.ComponentFactoryResolver},{type:n.ApplicationRef}]},t.ngInjectableDef=n.defineInjectable({factory:function(){return new t(n.inject(c.Overlay),n.inject(n.INJECTOR),n.inject(n.ComponentFactoryResolver),n.inject(n.ApplicationRef))},token:t,providedIn:"root"}),t}(e.NzMessageBaseService),d=function(){function t(){}return t.decorators=[{type:n.NgModule,args:[{imports:[i.CommonModule,c.OverlayModule,r.NzIconModule],declarations:[y,m],providers:[l,z],entryComponents:[m]}]}],t}();t.NZ_NOTIFICATION_DEFAULT_CONFIG=s,t.NZ_NOTIFICATION_CONFIG=p,t.NZ_NOTIFICATION_DEFAULT_CONFIG_PROVIDER=l,t.NzNotificationComponent=y,t.NzNotificationModule=d,t.NzNotificationService=z,t.NzNotificationContainerComponent=m,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ng-zorro-antd-notification.umd.min.js.map