angular-infinity-scrolling 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,16 +27,17 @@ followed by consuming the directive in example.component.
27
27
  ### Currently Directive has 2 properties
28
28
 
29
29
  ```
30
- scrollDistance - input which accpet a number between 1 and 10.
30
+ scrollDistance - input which accpet a number between 1 and 9.
31
31
  Describing to emit the data if scrollable height is less than or equal to (number*10) percent.
32
32
  [scrollDistance]='2' value will be emitted if scrollable height is less than or 20%.
33
+ NOTE: if invalid scrollDistance is given, then default value of 2 will be used for calculation;
33
34
 
34
35
  onScrolled - output that accept a voidFunction to be invoked on emit
35
36
  (onScrolled)="handleScroll()"
36
37
  ```
37
38
 
38
39
  ```ruby
39
- <div class='scrollable-parent' angularInfinityScroller [scrollDistance]="4" (onScrolled)="handleScroll()">
40
+ <div class='scrollable-parent' angularInfinityScroller [scrollDistance]="2" (onScrolled)="handleScroll()">
40
41
  </div>
41
42
  ```
42
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-infinity-scrolling",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Jayant061/angular-infinity-scroller"
@@ -30,6 +30,9 @@ export class AngularInfinityScrollerDirective {
30
30
  const height = Math.floor(this.el?.nativeElement.scrollHeight - this.el.nativeElement.clientHeight);
31
31
  const scrollValue = Math.floor(this.el?.nativeElement.scrollTop);
32
32
  const unexploredContentHeight = height - this.prevScrollHeight();
33
+ if (unexploredContentHeight < 0) {// if the list item quantity reduced (applying filter)
34
+ this.prevScrollHeight.set(0);
35
+ }
33
36
  const emitTriggerHeight = this.prevScrollHeight() + Math.ceil((1 - ((this.scrollDistanceCoefficient()) / 10)) * unexploredContentHeight);
34
37
  if (scrollValue >= (emitTriggerHeight) && this.prevScrollHeight() !== height) {
35
38
  this.onScrolled.emit();