ng-zorro-antd-core-transition-patch.mjs 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import * as i0 from '@angular/core';
  2. import { Input, Directive, NgModule } from '@angular/core';
  3. /**
  4. * Use of this source code is governed by an MIT-style license that can be
  5. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  6. */
  7. /**
  8. * hack the bug
  9. * angular router change with unexpected transition trigger after calling applicationRef.attachView
  10. * https://github.com/angular/angular/issues/34718
  11. */
  12. class NzTransitionPatchDirective {
  13. elementRef;
  14. renderer;
  15. hidden = null;
  16. setHiddenAttribute() {
  17. if (this.hidden) {
  18. if (typeof this.hidden === 'string') {
  19. this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', this.hidden);
  20. }
  21. else {
  22. this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', '');
  23. }
  24. }
  25. else {
  26. this.renderer.removeAttribute(this.elementRef.nativeElement, 'hidden');
  27. }
  28. }
  29. constructor(elementRef, renderer) {
  30. this.elementRef = elementRef;
  31. this.renderer = renderer;
  32. this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', '');
  33. }
  34. ngOnChanges() {
  35. this.setHiddenAttribute();
  36. }
  37. ngAfterViewInit() {
  38. this.setHiddenAttribute();
  39. }
  40. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransitionPatchDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
  41. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: NzTransitionPatchDirective, isStandalone: true, selector: "[nz-button], nz-button-group, [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: { hidden: "hidden" }, usesOnChanges: true, ngImport: i0 });
  42. }
  43. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransitionPatchDirective, decorators: [{
  44. type: Directive,
  45. args: [{
  46. selector: '[nz-button], nz-button-group, [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group'
  47. }]
  48. }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { hidden: [{
  49. type: Input
  50. }] } });
  51. /**
  52. * Use of this source code is governed by an MIT-style license that can be
  53. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  54. */
  55. class NzTransitionPatchModule {
  56. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransitionPatchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  57. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzTransitionPatchModule, imports: [NzTransitionPatchDirective], exports: [NzTransitionPatchDirective] });
  58. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransitionPatchModule });
  59. }
  60. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransitionPatchModule, decorators: [{
  61. type: NgModule,
  62. args: [{
  63. imports: [NzTransitionPatchDirective],
  64. exports: [NzTransitionPatchDirective]
  65. }]
  66. }] });
  67. /**
  68. * Use of this source code is governed by an MIT-style license that can be
  69. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  70. */
  71. /**
  72. * Generated bundle index. Do not edit.
  73. */
  74. export { NzTransitionPatchDirective as ɵNzTransitionPatchDirective, NzTransitionPatchModule as ɵNzTransitionPatchModule };
  75. //# sourceMappingURL=ng-zorro-antd-core-transition-patch.mjs.map