ng-virtual-list 17.7.19 → 17.9.0
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/LICENSE +1 -1
- package/README.md +74 -18
- package/esm2022/lib/components/list-item/ng-virtual-list-item.component.mjs +363 -0
- package/esm2022/lib/components/list-item/ng-virtual-list-item.module.mjs +20 -0
- package/esm2022/lib/components/ng-scroll-bar/ng-scroll-bar.component.mjs +181 -0
- package/esm2022/lib/components/ng-scroll-bar/ng-scroll-bar.module.mjs +20 -0
- package/esm2022/lib/components/scroller/enums/index.mjs +3 -0
- package/esm2022/lib/components/scroller/enums/scroller-direction.mjs +6 -0
- package/esm2022/lib/components/scroller/enums/scroller-directions.mjs +2 -0
- package/esm2022/lib/components/scroller/ng-scroller.component.mjs +544 -0
- package/esm2022/lib/components/scroller/ng-scroller.module.mjs +21 -0
- package/esm2022/lib/components/scroller/types/easing.mjs +2 -0
- package/esm2022/lib/components/scroller/types/index.mjs +2 -0
- package/esm2022/lib/components/scroller/utils/ease.mjs +7 -0
- package/esm2022/lib/components/scroller/utils/index.mjs +4 -0
- package/esm2022/lib/components/scroller/utils/scroll-box.mjs +45 -0
- package/esm2022/lib/components/substrate/enums/index.mjs +4 -0
- package/esm2022/lib/components/substrate/enums/substrate-modes.mjs +16 -0
- package/esm2022/lib/components/substrate/enums/substrate-styles.mjs +15 -0
- package/esm2022/lib/components/substrate/index.mjs +5 -0
- package/esm2022/lib/components/substrate/substrate.component.mjs +279 -0
- package/esm2022/lib/components/substrate/substrate.module.mjs +19 -0
- package/esm2022/lib/components/substrate/types/index.mjs +2 -0
- package/esm2022/lib/components/substrate/types/substrate-mode.mjs +2 -0
- package/esm2022/lib/components/substrate/types/substrate-style.mjs +2 -0
- package/esm2022/lib/const/index.mjs +41 -3
- package/esm2022/lib/directives/index.mjs +4 -0
- package/esm2022/lib/directives/item-click/item-click.directive.mjs +58 -0
- package/esm2022/lib/directives/item-click/item-click.module.mjs +19 -0
- package/esm2022/lib/directives/locale-sensitive/locale-sensitive.directive.mjs +46 -0
- package/esm2022/lib/directives/locale-sensitive/locale-sensitive.module.mjs +19 -0
- package/esm2022/lib/enums/collection-mode.mjs +1 -1
- package/esm2022/lib/enums/collection-modes.mjs +2 -2
- package/esm2022/lib/enums/direction.mjs +1 -1
- package/esm2022/lib/enums/directions.mjs +2 -2
- package/esm2022/lib/enums/focus-alignments.mjs +2 -2
- package/esm2022/lib/enums/index.mjs +3 -2
- package/esm2022/lib/enums/method-for-selecting-types.mjs +2 -2
- package/esm2022/lib/enums/method-for-selecting.mjs +1 -1
- package/esm2022/lib/enums/methods-for-selecting.mjs +2 -2
- package/esm2022/lib/enums/snapping-method.mjs +1 -1
- package/esm2022/lib/enums/snapping-methods.mjs +6 -2
- package/esm2022/lib/enums/text-direction.mjs +2 -0
- package/esm2022/lib/enums/text-directions.mjs +14 -0
- package/esm2022/lib/models/base-virtual-list-item-component.mjs +2 -2
- package/esm2022/lib/models/collection.model.mjs +1 -1
- package/esm2022/lib/models/display-object-config.model.mjs +1 -1
- package/esm2022/lib/models/display-object-measures.model.mjs +1 -1
- package/esm2022/lib/models/index.mjs +1 -1
- package/esm2022/lib/models/item-config-map.model.mjs +1 -1
- package/esm2022/lib/models/item.model.mjs +1 -1
- package/esm2022/lib/models/render-collection.model.mjs +1 -1
- package/esm2022/lib/models/render-item-config.model.mjs +1 -1
- package/esm2022/lib/models/render-item-measures.model.mjs +3 -0
- package/esm2022/lib/models/render-item.model.mjs +1 -1
- package/esm2022/lib/models/scroll-event.model.mjs +1 -1
- package/esm2022/lib/models/scroll-options.model.mjs +1 -1
- package/esm2022/lib/ng-virtual-list.component.mjs +710 -202
- package/esm2022/lib/ng-virtual-list.module.mjs +8 -6
- package/esm2022/lib/ng-virtual-list.service.mjs +33 -3
- package/esm2022/lib/types/color.mjs +2 -0
- package/esm2022/lib/types/focus-alignment.mjs +1 -1
- package/esm2022/lib/types/gradient-color-position.mjs +2 -0
- package/esm2022/lib/types/gradient-color-positions.mjs +2 -0
- package/esm2022/lib/types/gradient-color.mjs +2 -0
- package/esm2022/lib/types/id.mjs +1 -1
- package/esm2022/lib/types/index.mjs +1 -1
- package/esm2022/lib/types/rect.mjs +1 -1
- package/esm2022/lib/types/rounded-corner.mjs +2 -0
- package/esm2022/lib/types/scrollbar-theme.mjs +2 -0
- package/esm2022/lib/types/size.mjs +1 -1
- package/esm2022/lib/utils/browser.mjs +9 -2
- package/esm2022/lib/utils/buffer-interpolation.mjs +6 -4
- package/esm2022/lib/utils/cache-map.mjs +154 -0
- package/esm2022/lib/utils/cmap.mjs +34 -0
- package/esm2022/lib/utils/debounce.mjs +2 -2
- package/esm2022/lib/utils/event-emitter/event-emitter.mjs +105 -0
- package/esm2022/lib/utils/event-emitter/index.mjs +3 -0
- package/esm2022/lib/utils/event-emitter/interfaces/event-emitter.mjs +2 -0
- package/esm2022/lib/utils/event-emitter/interfaces/index.mjs +2 -0
- package/esm2022/lib/utils/get-shape-min-size.mjs +13 -0
- package/esm2022/lib/utils/index.mjs +3 -3
- package/esm2022/lib/utils/is-collection-mode.mjs +15 -0
- package/esm2022/lib/utils/is-direction.mjs +15 -0
- package/esm2022/lib/utils/is-method-for-selecting.mjs +18 -0
- package/esm2022/lib/utils/scroll-event.mjs +45 -0
- package/esm2022/lib/utils/snapping-method.mjs +2 -2
- package/esm2022/lib/utils/toggle-class-name.mjs +15 -0
- package/esm2022/lib/utils/track-box.mjs +968 -0
- package/esm2022/lib/utils/tracker.mjs +38 -10
- package/esm2022/public-api.mjs +2 -2
- package/fesm2022/ng-virtual-list.mjs +2576 -507
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/components/{ng-virtual-list-item.component.d.ts → list-item/ng-virtual-list-item.component.d.ts} +29 -10
- package/lib/components/list-item/ng-virtual-list-item.module.d.ts +9 -0
- package/lib/components/ng-scroll-bar/ng-scroll-bar.component.d.ts +56 -0
- package/lib/components/ng-scroll-bar/ng-scroll-bar.module.d.ts +9 -0
- package/lib/components/scroller/enums/index.d.ts +4 -0
- package/lib/components/scroller/enums/scroller-direction.d.ts +4 -0
- package/lib/components/scroller/enums/scroller-directions.d.ts +2 -0
- package/lib/components/scroller/ng-scroller.component.d.ts +113 -0
- package/lib/components/scroller/ng-scroller.module.d.ts +10 -0
- package/lib/components/scroller/types/easing.d.ts +1 -0
- package/lib/components/scroller/types/index.d.ts +2 -0
- package/lib/components/scroller/utils/ease.d.ts +2 -0
- package/lib/components/scroller/utils/index.d.ts +3 -0
- package/lib/components/scroller/utils/scroll-box.d.ts +39 -0
- package/lib/components/substrate/enums/index.d.ts +3 -0
- package/lib/components/substrate/enums/substrate-modes.d.ts +13 -0
- package/lib/components/substrate/enums/substrate-styles.d.ts +12 -0
- package/lib/components/substrate/index.d.ts +7 -0
- package/lib/components/substrate/substrate.component.d.ts +54 -0
- package/lib/components/substrate/substrate.module.d.ts +8 -0
- package/lib/components/substrate/types/index.d.ts +3 -0
- package/lib/components/substrate/types/substrate-mode.d.ts +10 -0
- package/lib/components/substrate/types/substrate-style.d.ts +10 -0
- package/lib/const/index.d.ts +32 -2
- package/lib/directives/index.d.ts +3 -0
- package/lib/directives/item-click/item-click.directive.d.ts +19 -0
- package/lib/directives/item-click/item-click.module.d.ts +8 -0
- package/lib/directives/locale-sensitive/locale-sensitive.directive.d.ts +19 -0
- package/lib/directives/locale-sensitive/locale-sensitive.module.d.ts +8 -0
- package/lib/enums/collection-mode.d.ts +1 -1
- package/lib/enums/collection-modes.d.ts +1 -1
- package/lib/enums/direction.d.ts +1 -1
- package/lib/enums/directions.d.ts +1 -1
- package/lib/enums/focus-alignments.d.ts +1 -1
- package/lib/enums/index.d.ts +4 -2
- package/lib/enums/method-for-selecting-types.d.ts +1 -1
- package/lib/enums/method-for-selecting.d.ts +1 -1
- package/lib/enums/methods-for-selecting.d.ts +1 -1
- package/lib/enums/snapping-method.d.ts +2 -2
- package/lib/enums/snapping-methods.d.ts +6 -2
- package/lib/enums/text-direction.d.ts +10 -0
- package/lib/enums/text-directions.d.ts +12 -0
- package/lib/models/base-virtual-list-item-component.d.ts +2 -4
- package/lib/models/collection.model.d.ts +1 -1
- package/lib/models/display-object-config.model.d.ts +1 -1
- package/lib/models/display-object-measures.model.d.ts +37 -1
- package/lib/models/index.d.ts +2 -2
- package/lib/models/item-config-map.model.d.ts +20 -19
- package/lib/models/item.model.d.ts +2 -6
- package/lib/models/render-collection.model.d.ts +1 -1
- package/lib/models/render-item-config.model.d.ts +1 -2
- package/lib/models/render-item-measures.model.d.ts +49 -0
- package/lib/models/render-item.model.d.ts +11 -8
- package/lib/models/scroll-event.model.d.ts +5 -1
- package/lib/models/scroll-options.model.d.ts +1 -1
- package/lib/ng-virtual-list.component.d.ts +98 -25
- package/lib/ng-virtual-list.module.d.ts +5 -3
- package/lib/ng-virtual-list.service.d.ts +21 -2
- package/lib/types/color.d.ts +7 -0
- package/lib/types/focus-alignment.d.ts +1 -1
- package/lib/types/gradient-color-position.d.ts +7 -0
- package/lib/types/gradient-color-positions.d.ts +8 -0
- package/lib/types/gradient-color.d.ts +8 -0
- package/lib/types/id.d.ts +1 -1
- package/lib/types/index.d.ts +4 -1
- package/lib/types/rect.d.ts +1 -1
- package/lib/types/rounded-corner.d.ts +7 -0
- package/lib/types/scrollbar-theme.d.ts +17 -0
- package/lib/types/size.d.ts +1 -1
- package/lib/utils/browser.d.ts +6 -0
- package/lib/utils/{cacheMap.d.ts → cache-map.d.ts} +12 -16
- package/lib/utils/cmap.d.ts +16 -0
- package/lib/utils/debounce.d.ts +1 -1
- package/lib/utils/{eventEmitter.d.ts → event-emitter/event-emitter.d.ts} +6 -4
- package/lib/utils/event-emitter/index.d.ts +4 -0
- package/lib/utils/event-emitter/interfaces/event-emitter.d.ts +37 -0
- package/lib/utils/event-emitter/interfaces/index.d.ts +2 -0
- package/lib/utils/get-shape-min-size.d.ts +8 -0
- package/lib/utils/index.d.ts +3 -3
- package/lib/utils/{isCollectionMode.d.ts → is-collection-mode.d.ts} +2 -2
- package/lib/utils/{isDirection.d.ts → is-direction.d.ts} +2 -2
- package/lib/utils/{isMethodForSelecting.d.ts → is-method-for-selecting.d.ts} +2 -2
- package/lib/utils/{scrollEvent.d.ts → scroll-event.d.ts} +6 -2
- package/lib/utils/{toggleClassName.d.ts → toggle-class-name.d.ts} +2 -2
- package/lib/utils/{trackBox.d.ts → track-box.d.ts} +61 -55
- package/lib/utils/tracker.d.ts +8 -4
- package/package.json +4 -3
- package/public-api.d.ts +1 -1
- package/esm2022/lib/components/ng-virtual-list-item.component.mjs +0 -350
- package/esm2022/lib/utils/cacheMap.mjs +0 -168
- package/esm2022/lib/utils/eventEmitter.mjs +0 -105
- package/esm2022/lib/utils/isCollectionMode.mjs +0 -15
- package/esm2022/lib/utils/isDirection.mjs +0 -15
- package/esm2022/lib/utils/isMethodForSelecting.mjs +0 -18
- package/esm2022/lib/utils/scrollEvent.mjs +0 -42
- package/esm2022/lib/utils/toggleClassName.mjs +0 -15
- package/esm2022/lib/utils/trackBox.mjs +0 -822
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 djonnyx (Evgenii Alexandrovich Grebennikov)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
Flexible, and actively maintained Angular library that excels with high-performance, feature-rich virtualized lists—including grouping, sticky headers, snapping, animations, collapsing group elements, single and multiple selection of elements and both scroll directions. Whether you're rendering millions of items or building interactive list components, it delivers scalability and customization. Angular (14–20) compatibility.
|
|
6
6
|
|
|
7
|
+
The main advantage of this solution is the elimination of the "empty spaces" effect during fast scrolling, which occurs in the classic implementation of virtualized lists. Visualization is as close as possible to native lists.
|
|
8
|
+
|
|
9
|
+
Works correctly in all browsers and platforms.
|
|
10
|
+
|
|
7
11
|
<img width="1033" height="171" alt="logo" src="https://github.com/user-attachments/assets/b559cfde-405a-4361-b71b-6715478d997d" />
|
|
8
12
|
|
|
9
13
|
<b>Angular version 17.X.X</b>.
|
|
@@ -12,8 +16,8 @@ Flexible, and actively maintained Angular library that excels with high-performa
|
|
|
12
16
|

|
|
13
17
|

|
|
14
18
|
|
|
15
|
-
[Live Demo](https://
|
|
16
|
-
[(Code)](https://github.com/DjonnyX/ng-virtual-list-demo)
|
|
19
|
+
[Live Demo](https://chat-demo.eugene-grebennikov.pro/)
|
|
20
|
+
[(Code)](https://github.com/DjonnyX/ng-virtual-list-chat-demo)
|
|
17
21
|
|
|
18
22
|
[Live Examples (Storybook)](https://ng-virtual-list-examples.eugene-grebennikov.pro/)
|
|
19
23
|
|
|
@@ -83,6 +87,8 @@ Collapsing groups
|
|
|
83
87
|
|
|
84
88
|
Support for element animation
|
|
85
89
|
|
|
90
|
+
Implemented a virtual scroll handler, ensuring stable scrolling on all platforms
|
|
91
|
+
|
|
86
92
|
<br/>
|
|
87
93
|
|
|
88
94
|
## 📦 Installation
|
|
@@ -117,8 +123,8 @@ items = Array.from({ length: 100000 }, (_, i) => ({ id: i, name: `Item #${i}` })
|
|
|
117
123
|
|
|
118
124
|
Template:
|
|
119
125
|
```html
|
|
120
|
-
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalItems" [bufferSize]="
|
|
121
|
-
[itemRenderer]="horizontalItemRenderer" [itemSize]="64" methodForSelecting="select"
|
|
126
|
+
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalItems" [bufferSize]="1" [maxBufferSize]="5"
|
|
127
|
+
[itemRenderer]="horizontalItemRenderer" [itemSize]="64" [methodForSelecting]="'select'"
|
|
122
128
|
[selectedIds]="2" (onSelect)="onSelect($event)" (onItemClick)="onItemClick($event)"></ng-virtual-list>
|
|
123
129
|
|
|
124
130
|
<ng-template #horizontalItemRenderer let-data="data" let-config="config">
|
|
@@ -168,7 +174,7 @@ export class AppComponent {
|
|
|
168
174
|
Template:
|
|
169
175
|
```html
|
|
170
176
|
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalGroupItems" [itemRenderer]="horizontalGroupItemRenderer"
|
|
171
|
-
[bufferSize]="
|
|
177
|
+
[bufferSize]="1" [maxBufferSize]="5" [itemConfigMap]="horizontalGroupItemConfigMap" [itemSize]="54" [snap]="true"
|
|
172
178
|
methodForSelecting="multi-select" [selectedIds]="[3,2]" (onSelect)="onSelect($event)" (onItemClick)="onItemClick($event)"></ng-virtual-list>
|
|
173
179
|
|
|
174
180
|
<ng-template #horizontalGroupItemRenderer let-data="data" let-config="config">
|
|
@@ -241,7 +247,7 @@ export class AppComponent {
|
|
|
241
247
|
|
|
242
248
|
Template:
|
|
243
249
|
```html
|
|
244
|
-
<ng-virtual-list class="list simple" [items]="items" [bufferSize]="
|
|
250
|
+
<ng-virtual-list class="list simple" [items]="items" [bufferSize]="1" [maxBufferSize]="5" [itemRenderer]="itemRenderer"
|
|
245
251
|
[itemSize]="40"></ng-virtual-list>
|
|
246
252
|
|
|
247
253
|
<ng-template #itemRenderer let-data="data">
|
|
@@ -282,7 +288,7 @@ export class AppComponent {
|
|
|
282
288
|
|
|
283
289
|
Template:
|
|
284
290
|
```html
|
|
285
|
-
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="
|
|
291
|
+
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="1" [maxBufferSize]="5" [itemRenderer]="groupItemRenderer"
|
|
286
292
|
[itemConfigMap]="groupItemConfigMap" [itemSize]="40" [snap]="false"></ng-virtual-list>
|
|
287
293
|
|
|
288
294
|
<ng-template #groupItemRenderer let-data="data">
|
|
@@ -309,7 +315,7 @@ Template:
|
|
|
309
315
|
|
|
310
316
|
Template (with snapping):
|
|
311
317
|
```html
|
|
312
|
-
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="
|
|
318
|
+
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="1" [maxBufferSize]="5" [itemRenderer]="groupItemRenderer"
|
|
313
319
|
[itemConfigMap]="groupItemConfigMap" [itemSize]="40" [snap]="true"></ng-virtual-list>
|
|
314
320
|
|
|
315
321
|
<ng-template #groupItemRenderer let-data="data">
|
|
@@ -374,7 +380,7 @@ Template
|
|
|
374
380
|
<button class="scroll-to__button" (click)="onButtonScrollToIdClickHandler($event)">Scroll</button>
|
|
375
381
|
</div>
|
|
376
382
|
|
|
377
|
-
<ng-virtual-list #virtualList class="list" [items]="items" [itemRenderer]="itemRenderer" [bufferSize]="
|
|
383
|
+
<ng-virtual-list #virtualList class="list" [items]="items" [itemRenderer]="itemRenderer" [bufferSize]="1" [maxBufferSize]="5"
|
|
378
384
|
[itemSize]="40"></ng-virtual-list>
|
|
379
385
|
|
|
380
386
|
<ng-template #itemRenderer let-data="data">
|
|
@@ -428,7 +434,7 @@ Virtual list with height-adjustable elements.
|
|
|
428
434
|
|
|
429
435
|
Template
|
|
430
436
|
```html
|
|
431
|
-
<ng-virtual-list #dynamicList class="list" [items]="groupDynamicItems" [itemRenderer]="groupItemRenderer" [bufferSize]="
|
|
437
|
+
<ng-virtual-list #dynamicList class="list" [items]="groupDynamicItems" [itemRenderer]="groupItemRenderer" [bufferSize]="1" [maxBufferSize]="5"
|
|
432
438
|
[itemConfigMap]="groupDynamicItemConfigMap" [dynamicSize]="true" [snap]="true"></ng-virtual-list>
|
|
433
439
|
|
|
434
440
|
<ng-template #groupItemRenderer let-data="data">
|
|
@@ -505,6 +511,47 @@ export class AppComponent {
|
|
|
505
511
|
|
|
506
512
|
## 🖼️ Stylization
|
|
507
513
|
|
|
514
|
+
- Scrollbar theme
|
|
515
|
+
```ts
|
|
516
|
+
import { NgVirtualListComponent, GradientColor, RoundedCorner, ScrollBarTheme } from 'ng-virtual-list';
|
|
517
|
+
|
|
518
|
+
const X_LITE_BLUE_PLASMA_GRADIENT: GradientColor = ["rgba(133, 142, 255, 0)", "rgb(0, 133, 160)"],
|
|
519
|
+
ROUND_CORNER: RoundedCorner = [3, 3, 3, 3],
|
|
520
|
+
SCROLLBAR_GRADIENT: ScrollBarTheme = {
|
|
521
|
+
fill: ["rgba(51, 0, 97, 1)", "rgba(73, 0, 97, 1)"],
|
|
522
|
+
strokeGradientColor: X_LITE_BLUE_PLASMA_GRADIENT,
|
|
523
|
+
strokeAnimationDuration: 1000,
|
|
524
|
+
thickness: 6,
|
|
525
|
+
roundCorner: ROUND_CORNER,
|
|
526
|
+
rippleColor: 'rgba(255,255,255,0.5)',
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
@Component({
|
|
530
|
+
selector: 'app-root',
|
|
531
|
+
imports: [FormsModule, NgVirtualListComponent],
|
|
532
|
+
templateUrl: './app.component.html',
|
|
533
|
+
styleUrl: './app.component.scss'
|
|
534
|
+
})
|
|
535
|
+
export class AppComponent {
|
|
536
|
+
scrollbarTheme = SCROLLBAR_GRADIENT;
|
|
537
|
+
|
|
538
|
+
items = Array.from({ length: 100000 }, (_, i) => ({ id: i, name: `Item #${i}` }));
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
```html
|
|
544
|
+
<ng-virtual-list [scrollbarTheme]="scrollbarTheme" [items]="items" [itemRenderer]="itemRenderer"></ng-virtual-list>
|
|
545
|
+
|
|
546
|
+
<ng-template #horizontalItemRenderer let-data="data" let-config="config">
|
|
547
|
+
@if (data) {
|
|
548
|
+
<div [ngClass]="{'list__h-container': true, 'selected': config.selected}">
|
|
549
|
+
<span>{{data.name}}</span>
|
|
550
|
+
</div>
|
|
551
|
+
}
|
|
552
|
+
</ng-template>
|
|
553
|
+
```
|
|
554
|
+
|
|
508
555
|
List items are encapsulated in shadowDOM, so to override default styles you need to use ::part access
|
|
509
556
|
|
|
510
557
|
- Customize a scroll area of list
|
|
@@ -567,7 +614,7 @@ List items are encapsulated in shadowDOM, so to override default styles you need
|
|
|
567
614
|
Selecting even elements:
|
|
568
615
|
|
|
569
616
|
```html
|
|
570
|
-
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalItems" [bufferSize]="5"
|
|
617
|
+
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalItems" [bufferSize]="1" [maxBufferSize]="5"
|
|
571
618
|
[itemRenderer]="horizontalItemRenderer" [itemSize]="54"></ng-virtual-list>
|
|
572
619
|
|
|
573
620
|
<ng-template #horizontalItemRenderer let-data="data" let-config="config">
|
|
@@ -609,7 +656,7 @@ Inputs
|
|
|
609
656
|
| collectionMode | [CollectionMode? = 'normal'](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/enums/collection-mode.ts) | Determines the action modes for collection elements. Default value is `normal`. |
|
|
610
657
|
| selectByClick | boolean? = true | If `false`, the element is selected using the config.select method passed to the template; if `true`, the element is selected by clicking on it. The default value is `true`. |
|
|
611
658
|
| snap | boolean? = false | Determines whether elements will snap. Default value is "false". |
|
|
612
|
-
| snappingMethod | [SnappingMethod? = 'normal'](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/enums/snapping-method.ts) | Snapping method. 'normal' - Normal group rendering. 'advanced' - The group is rendered on a transparent background. List items below the group are not rendered. |
|
|
659
|
+
| snappingMethod | [SnappingMethod? = 'normal'](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/enums/snapping-method.ts) | Snapping method. 'normal' - Normal group rendering. 'advanced' - The group is rendered on a transparent background. 'chat' - The group is rendered on a background. List items below the group are not rendered. |
|
|
613
660
|
| direction | [Direction? = 'vertical'](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/enums/direction.ts) | Determines the direction in which elements are placed. Default value is "vertical". |
|
|
614
661
|
| dynamicSize | boolean? = false | If true then the items in the list can have different sizes and the itemSize property is ignored. If false then the items in the list have a fixed size specified by the itemSize property. The default value is false. |
|
|
615
662
|
| enabledBufferOptimization | boolean? = true | Experimental! Enables buffer optimization. Can only be used if items in the collection are not added or updated. |
|
|
@@ -617,6 +664,16 @@ Inputs
|
|
|
617
664
|
| selectedIds | Array<[Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts)> \| [Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts) \| undefined | Sets the selected items. |
|
|
618
665
|
| collapsedIds | Array<[Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts)> | Sets the collapsed items. |
|
|
619
666
|
| screenReaderMessage | string? = "Showing items $1 to $2" | Message for screen reader. The message format is: "some text `$1` some text `$2`", where `$1` is the number of the first element of the screen collection, `$2` is the number of the last element of the screen collection. |
|
|
667
|
+
| langTextDir | [TextDirection? = 'ltr'](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/enums/text-direction.ts) | A string indicating the direction of text for the locale. Can be either "ltr" (left-to-right) or "rtl" (right-to-left). |
|
|
668
|
+
| loading | boolean? = false | If `true`, the scrollBar goes into loading state. The default value is `false`. |
|
|
669
|
+
| scrollbarTheme | [ScrollBarTheme?](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/scrollbar-theme.ts) | Scrollbar theme. |
|
|
670
|
+
| clickDistance | number? = 40 | The maximum scroll distance at which a click event is triggered. |
|
|
671
|
+
| waitForPreparation | boolean? = true | If true, it will wait until the list items are fully prepared before displaying them.. The default value is `true`. |
|
|
672
|
+
| scrollStartOffset | number? = 0 | Sets the scroll start offset value; Default value is "0". |
|
|
673
|
+
| scrollEndOffset | number? = 0 | Sets the scroll end offset value; Default value is "0". |
|
|
674
|
+
| snapScrollToBottom | boolean? = false | Determines whether the scroll will be anchored to the end of the list at startup.. Default value is "false". |
|
|
675
|
+
| snapToEndTransitionInstantOffset | number? = 0 | Sets the offset value; if the scroll area value is exceeded, the scroll animation will be disabled. Default value is "0". |
|
|
676
|
+
| scrollbarMinSize | number? = 80 | Minimum scrollbar size. |
|
|
620
677
|
|
|
621
678
|
<br/>
|
|
622
679
|
|
|
@@ -625,23 +682,22 @@ Outputs
|
|
|
625
682
|
| Event | Type | Description |
|
|
626
683
|
|---|---|---|
|
|
627
684
|
| onItemClick | [IRenderVirtualListItem](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/models/render-item.model.ts) \| undefined | Fires when an element is clicked. |
|
|
628
|
-
|
|
|
629
|
-
|
|
|
685
|
+
| onScroll | ([IScrollEvent](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/models/scroll-event.model.ts)) => void | Fires when the list has been scrolled. |
|
|
686
|
+
| onScrollEnd | ([IScrollEvent](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/models/scroll-event.model.ts)) => void | Fires when the list has completed scrolling. |
|
|
630
687
|
| onSelect | Array<[Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts)> \| [Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts) \| undefined | Fires when an elements are selected. |
|
|
631
688
|
| onCollapse | Array<[Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts)> \| [Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts) \| undefined | Fires when elements are collapsed. |
|
|
632
689
|
| onViewportChange | [ISize](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/size.ts) | Fires when the viewport size is changed. |
|
|
633
690
|
| onScrollReachStart | void | Fires when the scroll reaches the start. |
|
|
634
691
|
| onScrollReachEnd | void | Fires when the scroll reaches the end. |
|
|
635
692
|
|
|
636
|
-
|
|
637
693
|
<br/>
|
|
638
694
|
|
|
639
695
|
Methods
|
|
640
696
|
|
|
641
697
|
| Method | Type | Description |
|
|
642
698
|
|--|--|--|
|
|
643
|
-
| scrollTo | (id: [Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts),
|
|
644
|
-
| scrollToEnd | (
|
|
699
|
+
| scrollTo | (id: [Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts), cb?: () => void, options?: [IScrollOptions](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/models/scroll-options.model.ts)) | The method scrolls the list to the element with the given `id` and returns the value of the scrolled area. |
|
|
700
|
+
| scrollToEnd | (cb?: () => void, options?: [IScrollOptions](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/models/scroll-options.model.ts)) | Scrolls the scroll area to the last item in the collection. |
|
|
645
701
|
| getItemBounds | (id: [Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts), behavior?: ScrollBehavior) => void | Returns the bounds of an element with a given id |
|
|
646
702
|
| focus | [Id](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/id.ts), align: [FocusAlignment](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/types/focus-alignment.ts) = [FocusAlignments.NONE](https://github.com/DjonnyX/ng-virtual-list/blob/17.x/projects/ng-virtual-list/src/lib/enums/focus-alignments.ts) | Focus an list item by a given id. |
|
|
647
703
|
|
|
@@ -677,7 +733,7 @@ Try it out, star ⭐ the repo, and let us know what you’re building.
|
|
|
677
733
|
|
|
678
734
|
MIT License
|
|
679
735
|
|
|
680
|
-
Copyright (c)
|
|
736
|
+
Copyright (c) 2026 djonnyx (Evgenii Alexandrovich Grebennikov)
|
|
681
737
|
|
|
682
738
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
683
739
|
of this software and associated documentation files (the "Software"), to deal
|