Skip to content

Commit b98402b

Browse files
committed
add some more autosize demos for testing
1 parent df4f002 commit b98402b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/demo-app/virtual-scroll/virtual-scroll-demo.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
<h2>Autosize</h2>
22

3+
<h3>Uniform size</h3>
34
<cdk-virtual-scroll-viewport class="demo-viewport" autosize>
45
<div *cdkVirtualFor="let size of fixedSizeData; let i = index" class="demo-item"
56
[style.height.px]="size">
67
Item #{{i}} - ({{size}}px)
78
</div>
89
</cdk-virtual-scroll-viewport>
910

11+
<h3>Increasing size</h3>
12+
<cdk-virtual-scroll-viewport class="demo-viewport" autosize>
13+
<div *cdkVirtualFor="let size of increasingSizeData; let i = index" class="demo-item"
14+
[style.height.px]="size">
15+
Item #{{i}} - ({{size}}px)
16+
</div>
17+
</cdk-virtual-scroll-viewport>
18+
19+
<h3>Decreasing size</h3>
20+
<cdk-virtual-scroll-viewport class="demo-viewport" autosize>
21+
<div *cdkVirtualFor="let size of decreasingSizeData; let i = index" class="demo-item"
22+
[style.height.px]="size">
23+
Item #{{i}} - ({{size}}px)
24+
</div>
25+
</cdk-virtual-scroll-viewport>
26+
27+
<h3>Random size</h3>
1028
<cdk-virtual-scroll-viewport class="demo-viewport" autosize>
1129
<div *cdkVirtualFor="let size of randomData; let i = index" class="demo-item"
1230
[style.height.px]="size">

src/demo-app/virtual-scroll/virtual-scroll-demo.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ import {Component, ViewEncapsulation} from '@angular/core';
1717
})
1818
export class VirtualScrollDemo {
1919
fixedSizeData = Array(10000).fill(50);
20+
increasingSizeData = Array(10000).fill(0).map((_, i) => i / 10000 * 300);
21+
decreasingSizeData = Array(10000).fill(0).map((_, i) => (10000 - i) / 10000 * 300);
2022
randomData = Array(10000).fill(0).map(() => Math.round(Math.random() * 100));
2123
}

0 commit comments

Comments
 (0)