angular2-virtual-scroll
Advanced tools
Comparing version 0.2.0 to 0.2.1
# v0.2.1 | ||
* Added ability to get viewPortItems as a field instead of event | ||
* Added easier ability of using window scrollbar | ||
# v0.2.0 | ||
@@ -3,0 +8,0 @@ |
@@ -15,5 +15,6 @@ import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; | ||
private refreshHandler; | ||
_parentScroll: Element | Window; | ||
private _parentScroll; | ||
parentScroll: Element | Window; | ||
update: EventEmitter<any[]>; | ||
viewPortItems: any[]; | ||
change: EventEmitter<ChangeEvent>; | ||
@@ -29,2 +30,3 @@ start: EventEmitter<ChangeEvent>; | ||
startupLoop: boolean; | ||
window: Window; | ||
constructor(element: ElementRef); | ||
@@ -31,0 +33,0 @@ onScroll(): void; |
@@ -18,2 +18,3 @@ "use strict"; | ||
this.startupLoop = true; | ||
this.window = window; | ||
} | ||
@@ -172,3 +173,4 @@ Object.defineProperty(VirtualScrollComponent.prototype, "parentScroll", { | ||
// update the scroll list | ||
this.update.emit(items.slice(start, end)); | ||
this.viewPortItems = items.slice(start, end); | ||
this.update.emit(this.viewPortItems); | ||
// emit 'start' event | ||
@@ -175,0 +177,0 @@ if (start !== this.previousStart && this.startupLoop === false) { |
{ | ||
"name": "angular2-virtual-scroll", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Angular 2 module for virtual -infinite- list. Supports multi-column", | ||
@@ -5,0 +5,0 @@ "main": "dist/virtual-scroll.js", |
@@ -39,2 +39,13 @@ | ||
```html | ||
<virtual-scroll #scroll [items]="items"> | ||
<list-item *ngFor="let item of scroll.viewPortItems" [item]="item"> | ||
</list-item> | ||
</virtual-scroll> | ||
``` | ||
alternatively | ||
```html | ||
<div virtualScroll [items]="items" (update)="viewPortItems = $event"> | ||
@@ -144,2 +155,16 @@ | ||
## Getting view port items without events | ||
If you are using AOT compilation (hope you do it) then in classic usage (with listening to `update` event) it is required to create field `viewPortItems` in your component. | ||
There is a way how to avoid it. | ||
```html | ||
<virtual-scroll #scroll [items]="items"> | ||
<list-item *ngFor="let item of scroll.viewPortItems" [item]="item"> | ||
</list-item> | ||
</virtual-scroll> | ||
``` | ||
## Additional elements in scroll | ||
@@ -183,8 +208,9 @@ | ||
```html | ||
<virtual-scroll [items]="items" | ||
[parentScroll]="window" | ||
(update)="viewPortItems = $event"> | ||
<virtual-scroll | ||
#scroll | ||
[items]="items" | ||
[parentScroll]="scroll.window"> | ||
<input type="search"> | ||
<div #container> | ||
<list-item *ngFor="let item of viewPortItems" [item]="item"> | ||
<list-item *ngFor="let item of scroll.viewPortItems" [item]="item"> | ||
</list-item> | ||
@@ -195,10 +221,2 @@ </div> | ||
```ts | ||
... | ||
export class MyComponent { | ||
... | ||
window: window; | ||
... | ||
``` | ||
## Items with variable size | ||
@@ -205,0 +223,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
62276
10
289
396