UNPKG

ng-zorro-antd

Version:

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

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