UNPKG

ng-zorro-antd

Version:

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

81 lines 7.99 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Alibaba.com All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ import { ChangeDetectorRef, Component, Input, ViewEncapsulation } from '@angular/core'; import { notificationMotion } from 'ng-zorro-antd/core'; import { NzMessageComponent } from 'ng-zorro-antd/message'; import { NzNotificationContainerComponent } from './nz-notification-container.component'; export class NzNotificationComponent extends NzMessageComponent { /** * @param {?} container * @param {?} cdr */ constructor(container, cdr) { super(container, cdr); this.container = container; this.cdr = cdr; } /** * @return {?} */ close() { this._destroy(true); } /** * @return {?} */ get state() { if (this.nzMessage.state === 'enter') { if (this.container.config.nzPlacement === 'topLeft' || this.container.config.nzPlacement === 'bottomLeft') { return 'enterLeft'; } else { return 'enterRight'; } } else { return this.nzMessage.state; } } } NzNotificationComponent.decorators = [ { type: Component, args: [{ encapsulation: ViewEncapsulation.None, selector: 'nz-notification', exportAs: 'nzNotification', preserveWhitespaces: false, animations: [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" }] } ]; /** @nocollapse */ NzNotificationComponent.ctorParameters = () => [ { type: NzNotificationContainerComponent }, { type: ChangeDetectorRef } ]; NzNotificationComponent.propDecorators = { nzMessage: [{ type: Input }] }; if (false) { /** @type {?} */ NzNotificationComponent.prototype.nzMessage; /** * @type {?} * @private */ NzNotificationComponent.prototype.container; /** * @type {?} * @protected */ NzNotificationComponent.prototype.cdr; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotbm90aWZpY2F0aW9uLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLXpvcnJvLWFudGQvbm90aWZpY2F0aW9uLyIsInNvdXJjZXMiOlsibnotbm90aWZpY2F0aW9uLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQVFBLE9BQU8sRUFBRSxpQkFBa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