ngx-virtual-scroller
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,5 @@ | ||
# v1.0.2 | ||
* Improve AngularUniversal/SSR support | ||
# v1.0.1 | ||
@@ -2,0 +6,0 @@ |
@@ -53,3 +53,2 @@ import { ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, OnInit, Renderer2 } from '@angular/core'; | ||
protected readonly zone: NgZone; | ||
protected platformId: Object; | ||
viewPortItems: any[]; | ||
@@ -114,2 +113,3 @@ window: Window; | ||
scrollToPosition(scrollPosition: number, animationMilliseconds?: number, animationCompletedCallback?: () => void): void; | ||
protected isAngularUniversalSSR: boolean; | ||
constructor(element: ElementRef, renderer: Renderer2, zone: NgZone, platformId: Object, scrollThrottlingTime: any, scrollAnimationTime: any, scrollbarWidth: any, scrollbarHeight: any, checkResizeInterval: any, resizeBypassRefreshThreshold: any); | ||
@@ -116,0 +116,0 @@ protected previousScrollBoundingRect: ClientRect; |
@@ -13,3 +13,2 @@ "use strict"; | ||
this.zone = zone; | ||
this.platformId = platformId; | ||
this.window = window; | ||
@@ -40,2 +39,3 @@ this._enableUnequalChildrenSizes = false; | ||
this.previousScrollNumberElements = 0; | ||
this.isAngularUniversalSSR = common_1.isPlatformServer(platformId); | ||
this.scrollThrottlingTime = typeof (scrollThrottlingTime) === 'number' ? scrollThrottlingTime : 0; | ||
@@ -490,2 +490,5 @@ if (typeof (scrollAnimationTime) === 'number') { | ||
var _this = this; | ||
if (this.isAngularUniversalSSR) { | ||
return; | ||
} | ||
var scrollElement = this.getScrollElement(); | ||
@@ -520,2 +523,5 @@ this.removeScrollEventHandlers(); | ||
VirtualScrollComponent.prototype.getElementsOffset = function () { | ||
if (this.isAngularUniversalSSR) { | ||
return 0; | ||
} | ||
var offset = 0; | ||
@@ -542,2 +548,5 @@ if (this.containerElementRef && this.containerElementRef.nativeElement) { | ||
VirtualScrollComponent.prototype.countItemsPerWrapGroup = function () { | ||
if (this.isAngularUniversalSSR) { | ||
return Math.round(this.horizontal ? this.ssrViewportHeight / this.ssrChildHeight : this.ssrViewportWidth / this.ssrChildWidth); | ||
} | ||
var propertyName = this.horizontal ? 'offsetLeft' : 'offsetTop'; | ||
@@ -601,8 +610,2 @@ var children = ((this.containerElementRef && this.containerElementRef.nativeElement) || this.contentElementRef.nativeElement).children; | ||
var viewportHeight = scrollElement.offsetHeight - (this.scrollbarHeight || this.calculatedScrollbarHeight || (this.horizontal ? maxCalculatedScrollBarSize : 0)); | ||
if (common_1.isPlatformServer(this.platformId)) { | ||
viewportWidth = this.ssrViewportWidth; | ||
viewportHeight = this.ssrViewportHeight; | ||
this.childWidth = this.ssrChildWidth; | ||
this.childHeight = this.ssrChildHeight; | ||
} | ||
var content = (this.containerElementRef && this.containerElementRef.nativeElement) || this.contentElementRef.nativeElement; | ||
@@ -613,3 +616,12 @@ var itemsPerWrapGroup = this.countItemsPerWrapGroup(); | ||
var defaultChildHeight; | ||
if (!this.enableUnequalChildrenSizes) { | ||
if (this.isAngularUniversalSSR) { | ||
viewportWidth = this.ssrViewportWidth; | ||
viewportHeight = this.ssrViewportHeight; | ||
defaultChildWidth = this.ssrChildWidth; | ||
defaultChildHeight = this.ssrChildHeight; | ||
var itemsPerRow = Math.max(Math.ceil(viewportWidth / defaultChildWidth), 1); | ||
var itemsPerCol = Math.max(Math.ceil(viewportHeight / defaultChildHeight), 1); | ||
wrapGroupsPerPage = this.horizontal ? itemsPerRow : itemsPerCol; | ||
} | ||
else if (!this.enableUnequalChildrenSizes) { | ||
if (content.children.length > 0) { | ||
@@ -616,0 +628,0 @@ if (!this.childWidth || !this.childHeight) { |
{ | ||
"name": "ngx-virtual-scroller", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Angular 4+ module for virtual -infinite- list. Supports horizontal/vertical, variable heights, & multi-column", | ||
@@ -10,4 +10,3 @@ "main": "dist/virtual-scroll.js", | ||
"build": "npm run cleanup && npm run ngc", | ||
"build:docs": "rimraf docs && cd demo && npm run build && mv dist ../docs && cd .. && npm run replace:base", | ||
"replace:base": "replace '<base href=\"/\">' '<base href=\"/ngx-virtual-scroller/\">' docs/index.html ", | ||
"build:docs": "cd demo && npm run build && copyfiles dist/* ../docs -f && cd .. && replace \"<base href=\\\"/\\\">\" \"<base href=\\\"/ngx-virtual-scroller/\\\">\" docs/index.html", | ||
"lint": "tslint src/**/*.ts", | ||
@@ -64,3 +63,5 @@ "prepublish": "npm run build", | ||
"core-js": "^2.4.1", | ||
"replace-x": "^1.5.0", | ||
"replace": "^1.0.0", | ||
"copyfiles": "^2.1.0", | ||
"rimraf": "^2.6.1", | ||
@@ -67,0 +68,0 @@ "rxjs": "^5.4.2", |
Sorry, the diff of this file is not supported yet
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
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
13220751
175
16997
8
22