Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(module:table): no data virtual height #8457

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions components/table/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ The data passed to `[nzData]` is exported with [Template Context](https://angula
| `[nzVirtualMaxBufferPx]` | The number of pixels worth of buffer to render for when rendering new items, same as [cdk maxBufferPx](https://material.angular.io/cdk/scrolling/api) | `number` | `200` |
| `[nzVirtualMinBufferPx]` | The minimum amount of buffer rendered beyond the viewport (in pixels),same as [cdk minBufferPx](https://material.angular.io/cdk/scrolling/api) | `number` | `100` |
| `[nzVirtualForTrackBy]` | The TrackByFunction to be used for tracking changes. | `TrackByFunction<T>` | - |
| `[noDataVirtualHeight]` | Height of inner scroll when having no data, if nothing is passed the default value is used. | `string` | `'182px'` |
| `(nzPageIndexChange)` | Callback when `pageIndex` changes | `EventEmitter<number>` | - |
| `(nzPageSizeChange)` | Callback when `pageSize` changes | `EventEmitter<number>` | - |
| `(nzCurrentPageDataChange)` | Callback when current pageData changes | `EventEmitter<T[]>` | - |
Expand Down
15 changes: 8 additions & 7 deletions components/table/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ Table 组件同时具备了易用性和高度可定制性

过滤属性

| 参数 | 说明 | 类型 | 默认值 |
| -------------------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ------ |
| `[nzShowFilter]` | 是否显示过滤 | `boolean` | - |
| `[nzFilterFn]` | 前端排序时,确定筛选的运行函数,服务端排序时,传入 true | `NzTableFilterFn<T> \| boolean` | - |
| `[nzFilters]` | 过滤器内容, 显示数据 `text`,回调函数传出 `value`,设置 `byDefault` 以默认应用过滤规则 | `Array<{ text: string; value: any; byDefault?: boolean }>` | - |
| `[nzFilterMultiple]` | 是否为多选过滤器 | `boolean` | `true` |
| `(nzFilterChange)` | 过滤器内容选择的 value 数据回调 | `EventEmitter<any[] \| any>` | - |
| 参数 | 说明 | 类型 | 默认值 |
| ----------------------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------- | --------- |
| `[nzShowFilter]` | 是否显示过滤 | `boolean` | - |
| `[nzFilterFn]` | 前端排序时,确定筛选的运行函数,服务端排序时,传入 true | `NzTableFilterFn<T> \| boolean` | - |
| `[noDataVirtualHeight]` | 没有数据时内部滚动的高度,如果没有传递任何内容,则使用默认值。 | `string` | `'182px'` |
| `[nzFilters]` | 过滤器内容, 显示数据 `text`,回调函数传出 `value`,设置 `byDefault` 以默认应用过滤规则 | `Array<{ text: string; value: any; byDefault?: boolean }>` | - |
| `[nzFilterMultiple]` | 是否为多选过滤器 | `boolean` | `true` |
| `(nzFilterChange)` | 过滤器内容选择的 value 数据回调 | `EventEmitter<any[] \| any>` | - |

样式属性

Expand Down
4 changes: 2 additions & 2 deletions components/table/src/table/table-inner-scroll.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import { NzTbodyComponent } from './tbody.component';
[itemSize]="virtualItemSize"
[maxBufferPx]="virtualMaxBufferPx"
[minBufferPx]="virtualMinBufferPx"
[style.height]="data.length ? scrollY : noDateVirtualHeight"
[style.height]="data.length ? scrollY : noDataVirtualHeight"
>
<table nz-table-content tableLayout="fixed" [scrollX]="scrollX" [listOfColWidth]="listOfColWidth">
<tbody>
Expand Down Expand Up @@ -111,7 +111,7 @@ export class NzTableInnerScrollComponent<T> implements OnChanges, AfterViewInit,
headerStyleMap = {};
bodyStyleMap = {};
@Input() verticalScrollBarWidth = 0;
noDateVirtualHeight = '182px';
@Input() noDataVirtualHeight = '182px';
private data$ = new Subject<void>();
private scroll$ = new Subject<void>();
private destroy$ = new Subject<void>();
Expand Down
2 changes: 2 additions & 0 deletions components/table/src/table/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'table';
[virtualMinBufferPx]="nzVirtualMinBufferPx"
[tableMainElement]="tableMainElement"
[virtualForTrackBy]="nzVirtualForTrackBy"
[noDataVirtualHeight]="noDataVirtualHeight"
></nz-table-inner-scroll>
<ng-template #defaultTemplate>
<nz-table-inner-default
Expand Down Expand Up @@ -184,6 +185,7 @@ export class NzTableComponent<T> implements OnInit, OnDestroy, OnChanges, AfterV

@Input() nzPaginationPosition: NzTablePaginationPosition = 'bottom';
@Input() nzScroll: { x?: string | null; y?: string | null } = { x: null, y: null };
@Input() noDataVirtualHeight = '182px';
@Input() nzPaginationType: NzTablePaginationType = 'default';
@Input() @InputBoolean() nzFrontPagination = true;
@Input() @InputBoolean() nzTemplateMode = false;
Expand Down