ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
93 lines • 5.6 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { Injectable, RendererFactory2 } from '@angular/core';
var NzUpdateHostClassService = /** @class */ (function () {
function NzUpdateHostClassService(rendererFactory2) {
this.classMap = {};
this.renderer = rendererFactory2.createRenderer(null, null);
}
/**
* @param {?} el
* @param {?} classMap
* @return {?}
*/
NzUpdateHostClassService.prototype.updateHostClass = /**
* @param {?} el
* @param {?} classMap
* @return {?}
*/
function (el, classMap) {
this.removeClass(el, this.classMap, this.renderer);
this.classMap = tslib_1.__assign({}, classMap);
this.addClass(el, this.classMap, this.renderer);
};
/**
* @private
* @param {?} el
* @param {?} classMap
* @param {?} renderer
* @return {?}
*/
NzUpdateHostClassService.prototype.removeClass = /**
* @private
* @param {?} el
* @param {?} classMap
* @param {?} renderer
* @return {?}
*/
function (el, classMap, renderer) {
for (var i in classMap) {
if (classMap.hasOwnProperty(i)) {
renderer.removeClass(el, i);
}
}
};
/**
* @private
* @param {?} el
* @param {?} classMap
* @param {?} renderer
* @return {?}
*/
NzUpdateHostClassService.prototype.addClass = /**
* @private
* @param {?} el
* @param {?} classMap
* @param {?} renderer
* @return {?}
*/
function (el, classMap, renderer) {
for (var i in classMap) {
if (classMap.hasOwnProperty(i)) {
if (classMap[i]) {
renderer.addClass(el, i);
}
}
}
};
NzUpdateHostClassService.decorators = [
{ type: Injectable }
];
/** @nocollapse */
NzUpdateHostClassService.ctorParameters = function () { return [
{ type: RendererFactory2 }
]; };
return NzUpdateHostClassService;
}());
export { NzUpdateHostClassService };
if (false) {
/**
* @type {?}
* @private
*/
NzUpdateHostClassService.prototype.classMap;
/**
* @type {?}
* @private
*/
NzUpdateHostClassService.prototype.renderer;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaW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