ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
88 lines (80 loc) • 4.03 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/platform'), require('@angular/core')) :
typeof define === 'function' && define.amd ? define('ng-zorro-antd/core/transition-patch', ['exports', '@angular/cdk/platform', '@angular/core'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['ng-zorro-antd'] = global['ng-zorro-antd'] || {}, global['ng-zorro-antd'].core = global['ng-zorro-antd'].core || {}, global['ng-zorro-antd'].core['transition-patch'] = {}), global.ng.cdk.platform, global.ng.core));
}(this, (function (exports, platform, core) { 'use strict';
/**
* 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
*/
/**
* hack the bug
* angular router change with unexpected transition trigger after calling applicationRef.attachView
* https://github.com/angular/angular/issues/34718
*/
var NzTransitionPatchDirective = /** @class */ (function () {
function NzTransitionPatchDirective(elementRef, renderer) {
this.elementRef = elementRef;
this.renderer = renderer;
this.hidden = null;
this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', '');
}
NzTransitionPatchDirective.prototype.setHiddenAttribute = function () {
if (this.hidden === true) {
this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', '');
}
else if (this.hidden === false || this.hidden === null) {
this.renderer.removeAttribute(this.elementRef.nativeElement, 'hidden');
}
else if (typeof this.hidden === 'string') {
this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', this.hidden);
}
};
NzTransitionPatchDirective.prototype.ngOnChanges = function () {
this.setHiddenAttribute();
};
NzTransitionPatchDirective.prototype.ngAfterViewInit = function () {
this.setHiddenAttribute();
};
return NzTransitionPatchDirective;
}());
NzTransitionPatchDirective.decorators = [
{ type: core.Directive, args: [{
selector: '[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group'
},] }
];
NzTransitionPatchDirective.ctorParameters = function () { return [
{ type: core.ElementRef },
{ type: core.Renderer2 }
]; };
NzTransitionPatchDirective.propDecorators = {
hidden: [{ type: core.Input }]
};
/**
* 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
*/
var NzTransitionPatchModule = /** @class */ (function () {
function NzTransitionPatchModule() {
}
return NzTransitionPatchModule;
}());
NzTransitionPatchModule.decorators = [
{ type: core.NgModule, args: [{
imports: [platform.PlatformModule],
exports: [NzTransitionPatchDirective],
declarations: [NzTransitionPatchDirective]
},] }
];
/**
* 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
*/
/**
* Generated bundle index. Do not edit.
*/
exports.ɵNzTransitionPatchDirective = NzTransitionPatchDirective;
exports.ɵNzTransitionPatchModule = NzTransitionPatchModule;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=ng-zorro-antd-core-transition-patch.umd.js.map