ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
81 lines • 8.04 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { ChangeDetectorRef, Component, Input, ViewEncapsulation } from '@angular/core';
import { notificationMotion } from '../core/animation/notification';
import { NzMessageComponent } from '../message/nz-message.component';
import { NzNotificationContainerComponent } from './nz-notification-container.component';
var NzNotificationComponent = /** @class */ (function (_super) {
tslib_1.__extends(NzNotificationComponent, _super);
function NzNotificationComponent(container, cdr) {
var _this = _super.call(this, container, cdr) || this;
_this.container = container;
_this.cdr = cdr;
return _this;
}
/**
* @return {?}
*/
NzNotificationComponent.prototype.close = /**
* @return {?}
*/
function () {
this._destroy(true);
};
Object.defineProperty(NzNotificationComponent.prototype, "state", {
get: /**
* @return {?}
*/
function () {
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;
}
},
enumerable: true,
configurable: true
});
NzNotificationComponent.decorators = [
{ type: Component, args: [{
encapsulation: ViewEncapsulation.None,
selector: 'nz-notification',
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 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>"
}] }
];
/** @nocollapse */
NzNotificationComponent.ctorParameters = function () { return [
{ type: NzNotificationContainerComponent },
{ type: ChangeDetectorRef }
]; };
NzNotificationComponent.propDecorators = {
nzMessage: [{ type: Input }]
};
return NzNotificationComponent;
}(NzMessageComponent));
export { NzNotificationComponent };
if (false) {
/** @type {?} */
NzNotificationComponent.prototype.nzMessage;
/**
* @type {?}
* @private
*/
NzNotificationComponent.prototype.container;
/**
* @type {?}
* @protected
*/
NzNotificationComponent.prototype.cdr;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotbm90aWZpY2F0aW9uLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLXpvcnJvLWFudGQvIiwic291cmNlcyI6WyJub3RpZmljYXRpb24vbnotbm90aWZpY2F0aW9uLmNvbXBvbmV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