Skip to content

Commit 724d841

Browse files
feat(module:table): support setting virtual height when having no data (#8457)
* fix(module:tabs): wrong cursor * feat(module:table): no data virtual height --------- Co-authored-by: Laffery <49607541+Laffery@users.noreply.github.com>
1 parent 6ec38a2 commit 724d841

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

components/table/doc/index.en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ The data passed to `[nzData]` is exported with [Template Context](https://angula
9696
| `[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` |
9797
| `[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` |
9898
| `[nzVirtualForTrackBy]` | The TrackByFunction to be used for tracking changes. | `TrackByFunction<T>` | - |
99+
| `[noDataVirtualHeight]` | Height of inner scroll when having no data, if nothing is passed the default value is used. | `string` | `'182px'` |
99100
| `(nzPageIndexChange)` | Callback when `pageIndex` changes | `EventEmitter<number>` | - |
100101
| `(nzPageSizeChange)` | Callback when `pageSize` changes | `EventEmitter<number>` | - |
101102
| `(nzCurrentPageDataChange)` | Callback when current pageData changes | `EventEmitter<T[]>` | - |

components/table/doc/index.zh-CN.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,14 @@ Table 组件同时具备了易用性和高度可定制性
135135

136136
过滤属性
137137

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

146147
样式属性
147148

components/table/src/table/table-inner-scroll.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import { NzTbodyComponent } from './tbody.component';
6262
[itemSize]="virtualItemSize"
6363
[maxBufferPx]="virtualMaxBufferPx"
6464
[minBufferPx]="virtualMinBufferPx"
65-
[style.height]="data.length ? scrollY : noDateVirtualHeight"
65+
[style.height]="data.length ? scrollY : noDataVirtualHeight"
6666
>
6767
<table nz-table-content tableLayout="fixed" [scrollX]="scrollX" [listOfColWidth]="listOfColWidth">
6868
<tbody>
@@ -114,7 +114,7 @@ export class NzTableInnerScrollComponent<T> implements OnChanges, AfterViewInit,
114114
headerStyleMap = {};
115115
bodyStyleMap = {};
116116
@Input() verticalScrollBarWidth = 0;
117-
noDateVirtualHeight = '182px';
117+
@Input() noDataVirtualHeight = '182px';
118118
private data$ = new Subject<void>();
119119
private scroll$ = new Subject<void>();
120120
private destroy$ = new Subject<void>();

components/table/src/table/table.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'table';
9797
[virtualMinBufferPx]="nzVirtualMinBufferPx"
9898
[tableMainElement]="tableMainElement"
9999
[virtualForTrackBy]="nzVirtualForTrackBy"
100+
[noDataVirtualHeight]="noDataVirtualHeight"
100101
></nz-table-inner-scroll>
101102
} @else {
102103
<nz-table-inner-default
@@ -178,6 +179,7 @@ export class NzTableComponent<T> implements OnInit, OnDestroy, OnChanges, AfterV
178179

179180
@Input() nzPaginationPosition: NzTablePaginationPosition = 'bottom';
180181
@Input() nzScroll: { x?: string | null; y?: string | null } = { x: null, y: null };
182+
@Input() noDataVirtualHeight = '182px';
181183
@Input() nzPaginationType: NzTablePaginationType = 'default';
182184
@Input({ transform: booleanAttribute }) nzFrontPagination = true;
183185
@Input({ transform: booleanAttribute }) nzTemplateMode = false;

0 commit comments

Comments
 (0)