angular-infinity-scrolling 2.2.0 → 2.2.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 +103 -30
- package/package.json +29 -17
package/README.md
CHANGED
|
@@ -1,47 +1,120 @@
|
|
|
1
|
-
|
|
1
|
+
# Angular Infinite Scroller
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> Note: Current version of package is compatible with angular version above 17
|
|
3
|
+
A **lightweight, high‑performance infinite scrolling directive for Angular applications**, designed to work smoothly with modern Angular versions and SSR setups.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
Go to the ts file of component e.g. example.component.ts and add AngularInfinityScrollerDirective inside imports.
|
|
5
|
+
---
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
## ✨ Features
|
|
8
|
+
|
|
9
|
+
- 🚀 Simple directive‑based API
|
|
10
|
+
- ⚡ High‑performance scroll detection
|
|
11
|
+
- 🧩 Works with standalone components
|
|
12
|
+
- 🌐 Compatible with Angular 17+
|
|
13
|
+
- 📦 Zero external dependencies
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 📦 Installation
|
|
18
|
+
|
|
19
|
+
Install the package using npm:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install angular-infinity-scroller
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 🚀 Getting Started
|
|
28
|
+
|
|
29
|
+
Import `AngularInfinityScrollerDirective` into your component and add it to `imports`.
|
|
30
|
+
|
|
31
|
+
### Example Component
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { Component } from '@angular/core';
|
|
35
|
+
import { AngularInfinityScrollerDirective } from 'angular-infinity-scroller';
|
|
11
36
|
|
|
12
37
|
@Component({
|
|
13
38
|
selector: 'app-example',
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
styleUrl: './exaple.component.scss',
|
|
39
|
+
standalone: true,
|
|
40
|
+
imports: [AngularInfinityScrollerDirective],
|
|
41
|
+
templateUrl: './example.component.html',
|
|
42
|
+
styleUrl: './example.component.scss',
|
|
19
43
|
})
|
|
20
|
-
export class ExampleComponent{
|
|
44
|
+
export class ExampleComponent {
|
|
45
|
+
handleScroll() {
|
|
46
|
+
// load more data here
|
|
47
|
+
}
|
|
48
|
+
}
|
|
21
49
|
```
|
|
22
50
|
|
|
23
|
-
|
|
24
|
-
followed by consuming the directive in example.component.
|
|
25
|
-
```
|
|
51
|
+
---
|
|
26
52
|
|
|
27
|
-
|
|
53
|
+
## 🧪 Usage
|
|
28
54
|
|
|
55
|
+
Apply the directive to a scrollable container.
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<div
|
|
59
|
+
class="scrollable-parent"
|
|
60
|
+
angularInfinityScroller
|
|
61
|
+
[scrollDistance]="2"
|
|
62
|
+
(onScrolled)="handleScroll()"
|
|
63
|
+
>
|
|
64
|
+
</div>
|
|
29
65
|
```
|
|
30
|
-
scrollDistance - input which accpet a number between 1 and 9.
|
|
31
|
-
Describing to emit the data if scrollable height is less than or equal to (number*10) percent.
|
|
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;
|
|
34
66
|
|
|
35
|
-
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## ⚙️ Directive API
|
|
70
|
+
|
|
71
|
+
### `scrollDistance` (Input)
|
|
72
|
+
|
|
73
|
+
- **Type:** `number`
|
|
74
|
+
- **Range:** `1 – 9`
|
|
75
|
+
- **Default:** `2`
|
|
76
|
+
|
|
77
|
+
Defines when the scroll event should trigger.
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
- `[scrollDistance]="2"` → emits when remaining scroll height is **≤ 20%**
|
|
81
|
+
|
|
82
|
+
If an invalid value is provided, the directive automatically falls back to the default value.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### `onScrolled` (Output)
|
|
87
|
+
|
|
88
|
+
- **Type:** `() => void`
|
|
89
|
+
|
|
90
|
+
Emits when the scroll threshold is reached.
|
|
91
|
+
|
|
92
|
+
```html
|
|
36
93
|
(onScrolled)="handleScroll()"
|
|
37
94
|
```
|
|
38
95
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 🔧 Compatibility
|
|
99
|
+
|
|
100
|
+
- ✅ Angular **17 and above**
|
|
101
|
+
- ✅ Standalone components
|
|
102
|
+
- ✅ SSR‑friendly
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 🤝 Contributing
|
|
107
|
+
|
|
108
|
+
Suggestions, improvements, and pull requests are welcome.
|
|
109
|
+
|
|
110
|
+
If you encounter any issues, please raise them on GitHub:
|
|
111
|
+
👉 https://github.com/Jayant061/angular-infinity-scroller/issues
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## ⭐ Support
|
|
116
|
+
|
|
117
|
+
If this package helps you, please consider starring the repository ⭐
|
|
118
|
+
|
|
119
|
+
Happy coding! 🚀
|
|
43
120
|
|
|
44
|
-
```
|
|
45
|
-
Any suggestions or contributions are most welcome. If you are facing any issue with the packge please raise the issue in the github, I'll happt to resolve the bugs.
|
|
46
|
-
Happy coding!!
|
|
47
|
-
```
|
package/package.json
CHANGED
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-infinity-scrolling",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
|
+
"description": "High-performance infinite scrolling directive for Angular applications with SSR support.",
|
|
5
|
+
"homepage": "https://github.com/Jayant061/angular-infinity-scroller",
|
|
4
6
|
"repository": {
|
|
5
7
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/Jayant061/angular-infinity-scroller"
|
|
8
|
+
"url": "git+https://github.com/Jayant061/angular-infinity-scroller.git"
|
|
7
9
|
},
|
|
8
10
|
"bugs": {
|
|
9
11
|
"url": "https://github.com/Jayant061/angular-infinity-scroller/issues"
|
|
10
12
|
},
|
|
11
13
|
"keywords": [
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"infinite",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
14
|
+
"angular",
|
|
15
|
+
"angular-library",
|
|
16
|
+
"angular-directive",
|
|
17
|
+
"angular-ssr",
|
|
18
|
+
"infinite-scroll",
|
|
19
|
+
"infinite-scrolling",
|
|
20
|
+
"infinite-scroller",
|
|
21
|
+
"scroll",
|
|
22
|
+
"scrolling",
|
|
23
|
+
"virtual-scroll",
|
|
24
|
+
"pagination",
|
|
25
|
+
"lazy-loading",
|
|
26
|
+
"ngx-infinite-scroll",
|
|
27
|
+
"angular-infinite-scroll"
|
|
22
28
|
],
|
|
23
|
-
"author":
|
|
29
|
+
"author": {
|
|
30
|
+
"name": "Jayant Thakur",
|
|
31
|
+
"url": "https://github.com/Jayant061"
|
|
32
|
+
},
|
|
24
33
|
"license": "ISC",
|
|
34
|
+
"sideEffects": false,
|
|
25
35
|
"peerDependencies": {
|
|
26
|
-
"@angular/
|
|
27
|
-
"@angular/
|
|
36
|
+
"@angular/core": ">=16.0.0 <21.0.0",
|
|
37
|
+
"@angular/common": ">=16.0.0 <21.0.0"
|
|
28
38
|
},
|
|
29
39
|
"dependencies": {
|
|
30
40
|
"tslib": "^2.3.0"
|
|
31
41
|
},
|
|
32
|
-
"
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18"
|
|
44
|
+
},
|
|
33
45
|
"module": "fesm2022/angular-infinity-scrolling.mjs",
|
|
34
46
|
"typings": "index.d.ts",
|
|
35
47
|
"exports": {
|
|
@@ -41,4 +53,4 @@
|
|
|
41
53
|
"default": "./fesm2022/angular-infinity-scrolling.mjs"
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
|
-
}
|
|
56
|
+
}
|