UNPKG

ng-zorro-antd

Version:

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

76 lines (70 loc) 2.68 kB
import { PlatformModule } from '@angular/cdk/platform'; import { Directive, ElementRef, Renderer2, Input, NgModule } from '@angular/core'; /** * 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 */ class NzTransitionPatchDirective { constructor(elementRef, renderer) { this.elementRef = elementRef; this.renderer = renderer; this.hidden = null; this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', ''); } setHiddenAttribute() { 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); } } ngOnChanges() { this.setHiddenAttribute(); } ngAfterViewInit() { this.setHiddenAttribute(); } } NzTransitionPatchDirective.decorators = [ { type: 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 = () => [ { type: ElementRef }, { type: Renderer2 } ]; NzTransitionPatchDirective.propDecorators = { hidden: [{ type: 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 */ class NzTransitionPatchModule { } NzTransitionPatchModule.decorators = [ { type: NgModule, args: [{ imports: [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. */ export { NzTransitionPatchDirective as ɵNzTransitionPatchDirective, NzTransitionPatchModule as ɵNzTransitionPatchModule }; //# sourceMappingURL=ng-zorro-antd-core-transition-patch.js.map