forked from NG-ZORRO/ng-zorro-antd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:tree): support virtual scroll (NG-ZORRO#4979)
close NG-ZORRO#4426 close NG-ZORRO#3808 close NG-ZORRO#3436 close NG-ZORRO#2680 close NG-ZORRO#1771
- Loading branch information
Yadong Xie
authored
Apr 4, 2020
1 parent
9db7df1
commit e19f34f
Showing
25 changed files
with
1,376 additions
and
1,112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 8 | ||
title: | ||
zh-CN: 虚拟滚动 | ||
en-US: Virtual Scroll | ||
--- | ||
|
||
## zh-CN | ||
|
||
设定 `nzVirtualHeight` 开启虚拟滚动。 | ||
|
||
## en-US | ||
|
||
Set `nzVirtualHeight` to enable virtual scroll. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { NzTreeNodeOptions } from 'ng-zorro-antd'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-tree-virtual-scroll', | ||
template: ` <nz-tree [nzData]="nodes" nzBlockNode nzVirtualHeight="300px"></nz-tree> ` | ||
}) | ||
export class NzDemoTreeVirtualScrollComponent implements OnInit { | ||
nodes: NzTreeNodeOptions[] = []; | ||
ngOnInit(): void { | ||
const dig = (path = '0', level = 3) => { | ||
const list = []; | ||
for (let i = 0; i < 10; i += 1) { | ||
const key = `${path}-${i}`; | ||
const treeNode: NzTreeNodeOptions = { | ||
title: key, | ||
key, | ||
expanded: true, | ||
children: [], | ||
isLeaf: false | ||
}; | ||
|
||
if (level > 0) { | ||
treeNode.children = dig(key, level - 1); | ||
} else { | ||
treeNode.isLeaf = true; | ||
} | ||
|
||
list.push(treeNode); | ||
} | ||
return list; | ||
}; | ||
|
||
this.nodes = dig(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.