1.1.0 • Published 5 years ago
dd-virt-list v1.1.0
DdVirtList
DdVirtList (Source) is an Angular component for showing a virtual list for both large data arrays and lazy loaded chunks.
Info
Embeds to be rendered items as ng-content
and expects all items to have the same height.
HowTo: Simple Data
Template:
<dd-virt-list #elemVlist vlHeight="300px" [vlData]="data">
<label *ngFor="let ii of elemVlist.items" [style.font-family]="'monospace'">{{ ii }}</label>
</dd-virt-list>
Code:
data = Array.from(Array(1000000), (ii, jj) => jj); // create array of numbers
HowTo: Lazy Loading
Template:
<dd-virt-list #elemVlist vlHeight="300px" [vlCount]="count" [vlLazyStream]="stream" (vlLazyRequest)="onLazy($event)">
<label *ngFor="let ii of elemVlist.items" [style.font-family]="'monospace'">{{ ii }}</label>
</dd-virt-list>
Code:
stream = new Subject<{from: number, to: number, items: any[]}>();
onLazy = (request: {from: number, to: number}) =>
// ... get lazy data page into 'data'
this.stream.next({ ...request, items: data });
API
Setter | Default | Info |
---|---|---|
vlBatchSize | 30 | number Batch size hint used for page size calculation (min. 10). |
vlHeight | 'auto' | string Height of the scrolling container (expects any valid CSS height). |
vlChildrenPerRow | 0 | number If bigger than 0 then the content is expected to be a container of the actual list items (instead of being the list of items otherwise). |
vlData | null | any[] For non-lazy data representation (auto-sets vlCount). |
vlCount | 0 | number Set to total count for lazy data. |
vlTrigger | null | Observable Can be used to trigger re-requesting data. |
vlLazyStream | null | Observable<{from: number, to: number, items: any[]}> Used as source of lazy data. |
vlDebugMode | false | boolean Logs some info when set to true . |
Emitter | Info |
---|---|
vlLazyRequest | EventEmitter<{from: number, to: number, items: any[]}> Lazy data request stream. |
Getter | Info |
---|---|
items | any[] Current items the component provides for rendering. |
License
MIT
1.1.0
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago
0.10.4
6 years ago
0.10.3
6 years ago
0.10.2
6 years ago
0.10.1
6 years ago
0.10.0
6 years ago
0.9.25
6 years ago
0.9.24
6 years ago
0.9.23
6 years ago
0.9.22
6 years ago
0.9.21
6 years ago
0.9.2
6 years ago
0.9.19
6 years ago
0.9.18
6 years ago
0.9.17
6 years ago
0.9.16
6 years ago
0.9.15
6 years ago
0.9.14
6 years ago
0.9.13
6 years ago
0.9.11
6 years ago
0.9.1
6 years ago
0.9.0
6 years ago