diff --git a/components/form/nz-form-item.component.ts b/components/form/nz-form-item.component.ts index df2edf9faa7..332ee5ff111 100644 --- a/components/form/nz-form-item.component.ts +++ b/components/form/nz-form-item.component.ts @@ -19,6 +19,7 @@ import { NgZone, OnChanges, OnDestroy, + OnInit, QueryList, Renderer2, SimpleChanges, @@ -51,12 +52,21 @@ import { NzFormExplainComponent } from './nz-form-explain.component'; ` ] }) -export class NzFormItemComponent extends NzRowDirective implements AfterContentInit, OnDestroy, OnChanges { +export class NzFormItemComponent extends NzRowDirective + implements AfterContentInit, OnDestroy, OnChanges, OnInit, OnDestroy { @Input() @InputBoolean() nzFlex: boolean = false; @ContentChildren(NzFormExplainComponent, { descendants: true }) listOfNzFormExplainComponent: QueryList; + updateFlexStyle(): void { + if (this.nzFlex) { + this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'flex'); + } else { + this.renderer.removeStyle(this.elementRef.nativeElement, 'display'); + } + } + constructor( elementRef: ElementRef, renderer: Renderer2, @@ -78,15 +88,19 @@ export class NzFormItemComponent extends NzRowDirective implements AfterContentI } } + ngOnInit(): void { + super.ngOnInit(); + this.updateFlexStyle(); + } + + ngOnDestroy(): void { + super.ngOnDestroy(); + } + ngOnChanges(changes: SimpleChanges): void { super.ngOnChanges(changes); if (changes.hasOwnProperty('nzFlex')) { - const flex = changes.nzFlex.currentValue; - if (flex) { - this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'flex'); - } else { - this.renderer.removeStyle(this.elementRef.nativeElement, 'display'); - } + this.updateFlexStyle(); } } } diff --git a/components/table/nz-table.component.ts b/components/table/nz-table.component.ts index e4592dd231f..150d48c1616 100644 --- a/components/table/nz-table.component.ts +++ b/components/table/nz-table.component.ts @@ -56,6 +56,10 @@ import { NzVirtualScrollDirective } from './nz-virtual-scroll.directive'; nz-table { display: block; } + + cdk-virtual-scroll-viewport.ant-table-body { + overflow-y: scroll; + } ` ] }) diff --git a/components/table/nz-th.component.html b/components/table/nz-th.component.html index fed3dce6887..a5f4ad8230c 100644 --- a/components/table/nz-th.component.html +++ b/components/table/nz-th.component.html @@ -28,6 +28,7 @@ +