ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
127 lines (121 loc) • 3.78 kB
JavaScript
import { CommonModule } from '@angular/common';
import { Directive, ElementRef, Renderer2, Optional, Inject, Input, NgModule } from '@angular/core';
import { __decorate, __metadata } from 'tslib';
import { coerceElement } from '@angular/cdk/coercion';
import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
import { InputBoolean } from 'ng-zorro-antd/core/util';
/**
* @fileoverview added by tsickle
* Generated from: nz-no-animation.directive.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const DISABLED_CLASSNAME = 'nz-animate-disabled';
class NzNoAnimationDirective {
/**
* @param {?} element
* @param {?} renderer
* @param {?} animationType
*/
constructor(element, renderer, animationType) {
this.element = element;
this.renderer = renderer;
this.animationType = animationType;
this.nzNoAnimation = false;
}
/**
* @return {?}
*/
ngOnChanges() {
this.updateClass();
}
/**
* @return {?}
*/
ngAfterViewInit() {
this.updateClass();
}
/**
* @private
* @return {?}
*/
updateClass() {
/** @type {?} */
const element = coerceElement(this.element);
if (!element) {
return;
}
if (this.nzNoAnimation || this.animationType === 'NoopAnimations') {
this.renderer.addClass(element, DISABLED_CLASSNAME);
}
else {
this.renderer.removeClass(element, DISABLED_CLASSNAME);
}
}
}
NzNoAnimationDirective.decorators = [
{ type: Directive, args: [{
selector: '[nzNoAnimation]',
exportAs: 'nzNoAnimation'
},] }
];
/** @nocollapse */
NzNoAnimationDirective.ctorParameters = () => [
{ type: ElementRef },
{ type: Renderer2 },
{ type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] }
];
NzNoAnimationDirective.propDecorators = {
nzNoAnimation: [{ type: Input }]
};
__decorate([
InputBoolean(),
__metadata("design:type", Boolean)
], NzNoAnimationDirective.prototype, "nzNoAnimation", void 0);
if (false) {
/** @type {?} */
NzNoAnimationDirective.ngAcceptInputType_nzNoAnimation;
/** @type {?} */
NzNoAnimationDirective.prototype.nzNoAnimation;
/**
* @type {?}
* @private
*/
NzNoAnimationDirective.prototype.element;
/**
* @type {?}
* @private
*/
NzNoAnimationDirective.prototype.renderer;
/**
* @type {?}
* @private
*/
NzNoAnimationDirective.prototype.animationType;
}
/**
* @fileoverview added by tsickle
* Generated from: nz-no-animation.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzNoAnimationModule {
}
NzNoAnimationModule.decorators = [
{ type: NgModule, args: [{
declarations: [NzNoAnimationDirective],
exports: [NzNoAnimationDirective],
imports: [CommonModule]
},] }
];
/**
* @fileoverview added by tsickle
* Generated from: public-api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: ng-zorro-antd-core-no-animation.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { NzNoAnimationDirective, NzNoAnimationModule };
//# sourceMappingURL=ng-zorro-antd-core-no-animation.js.map