Skip to content

Commit

Permalink
fix(module:table): fix table data type (NG-ZORRO#4608)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yadong Xie authored Jan 6, 2020
1 parent 9282cdd commit 4cf1f4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
8 changes: 0 additions & 8 deletions bundlesize.config.json

This file was deleted.

18 changes: 11 additions & 7 deletions components/table/nz-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,22 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { EMPTY, fromEvent, merge, Subject } from 'rxjs';
import { flatMap, startWith, takeUntil } from 'rxjs/operators';

import { InputBoolean, InputNumber, measureScrollbar, NzConfigService, NzSizeMDSType, WithConfig } from 'ng-zorro-antd/core';
import { NzI18nService } from 'ng-zorro-antd/i18n';
import { PaginationItemRenderContext } from 'ng-zorro-antd/pagination';
import { EMPTY, fromEvent, merge, Subject } from 'rxjs';
import { flatMap, startWith, takeUntil } from 'rxjs/operators';

import { NzThComponent } from './nz-th.component';
import { NzTheadComponent } from './nz-thead.component';
import { NzVirtualScrollDirective } from './nz-virtual-scroll.directive';

const NZ_CONFIG_COMPONENT_NAME = 'table';
interface TableDataType {
// tslint:disable-next-line:no-any
[key: string]: any;
}

@Component({
selector: 'nz-table',
Expand All @@ -68,9 +72,9 @@ const NZ_CONFIG_COMPONENT_NAME = 'table';
]
})
// tslint:disable-next-line no-any
export class NzTableComponent<T = any> implements OnInit, AfterViewInit, OnDestroy, OnChanges, AfterContentInit {
export class NzTableComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges, AfterContentInit {
/** public data for ngFor tr */
data: T[] = [];
data: TableDataType[] = [];
locale: any = {}; // tslint:disable-line:no-any
nzTheadComponent: NzTheadComponent;
lastScrollLeft = 0;
Expand All @@ -91,7 +95,7 @@ export class NzTableComponent<T = any> implements OnInit, AfterViewInit, OnDestr
@Input() @InputNumber() nzVirtualItemSize = 0;
@Input() @InputNumber() nzVirtualMaxBufferPx = 200;
@Input() @InputNumber() nzVirtualMinBufferPx = 100;
@Input() nzVirtualForTrackBy: TrackByFunction<T> | undefined;
@Input() nzVirtualForTrackBy: TrackByFunction<TableDataType> | undefined;
@Input() nzLoadingDelay = 0;
@Input() nzLoadingIndicator: TemplateRef<void>;
@Input() nzTotal = 0;
Expand All @@ -101,7 +105,7 @@ export class NzTableComponent<T = any> implements OnInit, AfterViewInit, OnDestr
@Input() nzWidthConfig: string[] = [];
@Input() nzPageIndex = 1;
@Input() nzPageSize = 10;
@Input() nzData: T[] = [];
@Input() nzData: TableDataType[] = [];
@Input() nzPaginationPosition: 'top' | 'bottom' | 'both' = 'bottom';
@Input() nzScroll: { x?: string | null; y?: string | null } = { x: null, y: null };

Expand Down Expand Up @@ -303,7 +307,7 @@ export class NzTableComponent<T = any> implements OnInit, AfterViewInit, OnDestr
this.listOfNzThComponent.changes
.pipe(
startWith(true),
flatMap(() => merge(this.listOfNzThComponent.changes, ...this.listOfNzThComponent.map(th => th.nzWidthChange$))),
flatMap(() => merge([this.listOfNzThComponent.changes, ...this.listOfNzThComponent.map(th => th.nzWidthChange$)])),
takeUntil(this.destroy$)
)
.subscribe(() => {
Expand Down

0 comments on commit 4cf1f4b

Please sign in to comment.