ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 8.53 kB
JavaScript
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(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"],t):t(((n=n||self)["ng-zorro-antd"]=n["ng-zorro-antd"]||{},n["ng-zorro-antd"].notification={}),n.ng.core,n["ng-zorro-antd"].core,n["ng-zorro-antd"].message,n.rxjs,n.ng.cdk.overlay,n.ng.common,n["ng-zorro-antd"].icon)}(this,function(n,t,e,o,i,a,c,r){"use strict";var s=function(n,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)t.hasOwnProperty(e)&&(n[e]=t[e])})(n,t)};function p(n,t){function e(){this.constructor=n}s(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}var l=function(){return(l=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}).apply(this,arguments)};var f=new t.InjectionToken("NZ_NOTIFICATION_DEFAULT_CONFIG"),g=new t.InjectionToken("NZ_NOTIFICATION_CONFIG"),u={provide:f,useValue:{nzTop:"24px",nzBottom:"24px",nzPlacement:"topRight",nzDuration:4500,nzMaxStack:7,nzPauseOnHover:!0,nzAnimate:!0}},m=function(n){function o(t,o,i,a){var c=n.call(this,t,o,i,a)||this;return c.messages=[],a&&e.warnDeprecation("Injection token 'NZ_NOTIFICATION_CONFIG' is deprecated and will be removed in 9.0.0. Please use 'NzConfigService' instead."),c}return p(o,n),o.prototype.setConfig=function(n){var t=this.config=l({},this.config,n,this.nzConfigService.getConfigForComponent(e.trimComponentName(this.constructor.name))),o=this.config.nzPlacement;this.top="topLeft"===o||"topRight"===o?e.toCssPixel(t.nzTop):null,this.bottom="bottomLeft"===o||"bottomRight"===o?e.toCssPixel(t.nzBottom):null,this.cdr.markForCheck()},o.prototype.createMessage=function(n){n.options=this._mergeMessageOptions(n.options),n.onClose=new i.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()},o.prototype.subscribeConfigChange=function(){var n=this;this.nzConfigService.getConfigChangeEventForComponent(e.trimComponentName(this.constructor.name)).subscribe(function(){return n.setConfig()})},o.prototype.replaceNotification=function(n,t){n.title=t.title,n.content=t.content,n.template=t.template,n.type=t.type},o.decorators=[{type:t.Component,args:[{changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.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:t.ChangeDetectorRef},{type:e.NzConfigService},{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[f]}]},{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[g]}]}]},o}(o.NzMessageContainerComponent);var z=function(n){function o(t,e){var o=n.call(this,t,e)||this;return o.container=t,o.cdr=e,o}return p(o,n),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:t.Component,args:[{encapsulation:t.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 nzType="check-circle" class="ant-notification-notice-icon ant-notification-notice-icon-success"></i>\n <i *ngSwitchCase="\'info\'" nz-icon nzType="info-circle" class="ant-notification-notice-icon ant-notification-notice-icon-info"></i>\n <i *ngSwitchCase="\'warning\'" nz-icon nzType="exclamation-circle" class="ant-notification-notice-icon ant-notification-notice-icon-warning"></i>\n <i *ngSwitchCase="\'error\'" nz-icon nzType="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 nzType="close" class="ant-notification-close-icon"></i>\n </span>\n </a>\n</div>\n'}]}],o.ctorParameters=function(){return[{type:m},{type:t.ChangeDetectorRef}]},o.propDecorators={nzMessage:[{type:t.Input}]},o}(o.NzMessageComponent);var y=function(){function n(){}return n.decorators=[{type:t.NgModule}],n}(),d=function(){function n(){}return n.decorators=[{type:t.NgModule,args:[{imports:[c.CommonModule,a.OverlayModule,r.NzIconModule,y],declarations:[z,m],providers:[u],entryComponents:[m]}]}],n}();var h=function(n){function o(t,e,o,i,a){return n.call(this,t,e,m,o,i,a,"notification-")||this}return p(o,n),o.prototype.success=function(n,t,e){return this.createMessage({type:"success",title:n,content:t},e)},o.prototype.error=function(n,t,e){return this.createMessage({type:"error",title:n,content:t},e)},o.prototype.info=function(n,t,e){return this.createMessage({type:"info",title:n,content:t},e)},o.prototype.warning=function(n,t,e){return this.createMessage({type:"warning",title:n,content:t},e)},o.prototype.blank=function(n,t,e){return this.createMessage({type:"blank",title:n,content:t},e)},o.prototype.create=function(n,t,e,o){return this.createMessage({type:n,title:t,content:e},o)},o.prototype.template=function(n,t){return this.createMessage({template:n},t)},o.decorators=[{type:t.Injectable,args:[{providedIn:y}]}],o.ctorParameters=function(){return[{type:e.NzSingletonService},{type:a.Overlay},{type:t.Injector},{type:t.ComponentFactoryResolver},{type:t.ApplicationRef}]},o.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new o(t.ɵɵinject(e.NzSingletonService),t.ɵɵinject(a.Overlay),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(t.ComponentFactoryResolver),t.ɵɵinject(t.ApplicationRef))},token:o,providedIn:y}),o}(o.NzMessageBaseService);n.NZ_NOTIFICATION_CONFIG=g,n.NZ_NOTIFICATION_DEFAULT_CONFIG=f,n.NZ_NOTIFICATION_DEFAULT_CONFIG_PROVIDER=u,n.NzNotificationComponent=z,n.NzNotificationContainerComponent=m,n.NzNotificationModule=d,n.NzNotificationService=h,n.NzNotificationServiceModule=y,Object.defineProperty(n,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-notification.umd.min.js.map