Skip to content

Commit

Permalink
fix(module:table): fix table custom filter icon position & virtual sc…
Browse files Browse the repository at this point in the history
…roll style (NG-ZORRO#3365)

close NG-ZORRO#3357 close NG-ZORRO#3348 close NG-ZORRO#3359
  • Loading branch information
vthinkxie authored Apr 25, 2019
1 parent e28e05e commit 037f605
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
28 changes: 21 additions & 7 deletions components/form/nz-form-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
NgZone,
OnChanges,
OnDestroy,
OnInit,
QueryList,
Renderer2,
SimpleChanges,
Expand Down Expand Up @@ -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<NzFormExplainComponent>;

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,
Expand All @@ -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();
}
}
}
4 changes: 4 additions & 0 deletions components/table/nz-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
`
]
})
Expand Down
1 change: 1 addition & 0 deletions components/table/nz-th.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</div>
<ng-content></ng-content>
</span>
<ng-content selector="nz-dropdown"></ng-content>
<div class="ant-table-column-sorter" *ngIf="nzShowSort">
<div class="ant-table-column-sorter-inner ant-table-column-sorter-inner-full">
<i nz-icon
Expand Down

0 comments on commit 037f605

Please sign in to comment.