ng-virtual-list 20.7.12 → 20.7.14
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 +36 -16
- package/fesm2022/ng-virtual-list.mjs +231 -54
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/index.d.ts +214 -127
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ items = Array.from({ length: 100000 }, (_, i) => ({ id: i, name: `Item #${i}` })
|
|
|
115
115
|
|
|
116
116
|
Template:
|
|
117
117
|
```html
|
|
118
|
-
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalItems" [bufferSize]="
|
|
118
|
+
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalItems" [bufferSize]="5" [maxBufferSize]="20"
|
|
119
119
|
[itemRenderer]="horizontalItemRenderer" [itemSize]="64" [methodForSelecting]="'select'"
|
|
120
120
|
[selectedIds]="2" (onSelect)="onSelect($event)" (onItemClick)="onItemClick($event)"></ng-virtual-list>
|
|
121
121
|
|
|
@@ -166,8 +166,8 @@ export class AppComponent {
|
|
|
166
166
|
Template:
|
|
167
167
|
```html
|
|
168
168
|
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalGroupItems" [itemRenderer]="horizontalGroupItemRenderer"
|
|
169
|
-
[bufferSize]="
|
|
170
|
-
[selectedIds]="[3,2]" (onSelect)="onSelect($event)" (onItemClick)="onItemClick($event)"></ng-virtual-list>
|
|
169
|
+
[bufferSize]="5" [maxBufferSize]="20" [itemConfigMap]="horizontalGroupItemConfigMap" [itemSize]="54" [snap]="true"
|
|
170
|
+
methodForSelecting="multi-select" [selectedIds]="[3,2]" (onSelect)="onSelect($event)" (onItemClick)="onItemClick($event)"></ng-virtual-list>
|
|
171
171
|
|
|
172
172
|
<ng-template #horizontalGroupItemRenderer let-data="data" let-config="config">
|
|
173
173
|
@if (data) {
|
|
@@ -239,7 +239,7 @@ export class AppComponent {
|
|
|
239
239
|
|
|
240
240
|
Template:
|
|
241
241
|
```html
|
|
242
|
-
<ng-virtual-list class="list simple" [items]="items" [bufferSize]="
|
|
242
|
+
<ng-virtual-list class="list simple" [items]="items" [bufferSize]="5" [maxBufferSize]="20" [itemRenderer]="itemRenderer"
|
|
243
243
|
[itemSize]="40"></ng-virtual-list>
|
|
244
244
|
|
|
245
245
|
<ng-template #itemRenderer let-data="data">
|
|
@@ -280,7 +280,7 @@ export class AppComponent {
|
|
|
280
280
|
|
|
281
281
|
Template:
|
|
282
282
|
```html
|
|
283
|
-
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="
|
|
283
|
+
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="5" [maxBufferSize]="20" [itemRenderer]="groupItemRenderer"
|
|
284
284
|
[itemConfigMap]="groupItemConfigMap" [itemSize]="40" [snap]="false"></ng-virtual-list>
|
|
285
285
|
|
|
286
286
|
<ng-template #groupItemRenderer let-data="data">
|
|
@@ -307,7 +307,7 @@ Template:
|
|
|
307
307
|
|
|
308
308
|
Template (with snapping):
|
|
309
309
|
```html
|
|
310
|
-
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="
|
|
310
|
+
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="5" [maxBufferSize]="20" [itemRenderer]="groupItemRenderer"
|
|
311
311
|
[itemConfigMap]="groupItemConfigMap" [itemSize]="40" [snap]="true"></ng-virtual-list>
|
|
312
312
|
|
|
313
313
|
<ng-template #groupItemRenderer let-data="data">
|
|
@@ -372,7 +372,7 @@ Template
|
|
|
372
372
|
<button class="scroll-to__button" (click)="onButtonScrollToIdClickHandler($event)">Scroll</button>
|
|
373
373
|
</div>
|
|
374
374
|
|
|
375
|
-
<ng-virtual-list #virtualList class="list" [items]="items" [itemRenderer]="itemRenderer" [bufferSize]="
|
|
375
|
+
<ng-virtual-list #virtualList class="list" [items]="items" [itemRenderer]="itemRenderer" [bufferSize]="5" [maxBufferSize]="20"
|
|
376
376
|
[itemSize]="40"></ng-virtual-list>
|
|
377
377
|
|
|
378
378
|
<ng-template #itemRenderer let-data="data">
|
|
@@ -426,7 +426,7 @@ Virtual list with height-adjustable elements.
|
|
|
426
426
|
|
|
427
427
|
Template
|
|
428
428
|
```html
|
|
429
|
-
<ng-virtual-list #dynamicList class="list" [items]="groupDynamicItems" [itemRenderer]="groupItemRenderer" [bufferSize]="
|
|
429
|
+
<ng-virtual-list #dynamicList class="list" [items]="groupDynamicItems" [itemRenderer]="groupItemRenderer" [bufferSize]="5" [maxBufferSize]="20"
|
|
430
430
|
[itemConfigMap]="groupDynamicItemConfigMap" [dynamicSize]="true" [snap]="true"></ng-virtual-list>
|
|
431
431
|
|
|
432
432
|
<ng-template #groupItemRenderer let-data="data">
|
|
@@ -565,7 +565,7 @@ List items are encapsulated in shadowDOM, so to override default styles you need
|
|
|
565
565
|
Selecting even elements:
|
|
566
566
|
|
|
567
567
|
```html
|
|
568
|
-
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalItems" [bufferSize]="5"
|
|
568
|
+
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalItems" [bufferSize]="5" [maxBufferSize]="20"
|
|
569
569
|
[itemRenderer]="horizontalItemRenderer" [itemSize]="54"></ng-virtual-list>
|
|
570
570
|
|
|
571
571
|
<ng-template #horizontalItemRenderer let-data="data" let-config="config">
|
|
@@ -589,7 +589,7 @@ Selecting even elements:
|
|
|
589
589
|
|
|
590
590
|
## 📚 API
|
|
591
591
|
|
|
592
|
-
[NgVirtualListComponent](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/ng-virtual-list.component.ts)
|
|
592
|
+
### [NgVirtualListComponent](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/ng-virtual-list.component.ts)
|
|
593
593
|
|
|
594
594
|
Inputs
|
|
595
595
|
|
|
@@ -604,6 +604,7 @@ Inputs
|
|
|
604
604
|
| methodForSelecting | [MethodForSelecting](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/enums/method-for-selecting.ts) | Method for selecting list items. Default value is 'none'. 'select' - List items are selected one by one. 'multi-select' - Multiple selection of list items. 'none' - List items are not selectable. |
|
|
605
605
|
| itemConfigMap | [IVirtualListItemConfigMap?](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/models/item-config-map.model.ts) | Sets `sticky` position and `selectable` for the list item element. If `sticky` position is greater than `0`, then `sticky` position is applied. If the `sticky` value is greater than `0`, then the `sticky` position mode is enabled for the element. `1` - position start, `2` - position end. Default value is `0`. `selectable` determines whether an element can be selected or not. Default value is `true`. |
|
|
606
606
|
| collapseByClick | boolean? = true | If `false`, the element is collapsed using the config.collapse method passed to the template; if `true`, the element is collapsed by clicking on it. The default value is `true`. |
|
|
607
|
+
| collectionMode | [CollectionMode? = 'normal'](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/enums/collection-mode.ts) | Determines the action modes for collection elements. Default value is `normal`. |
|
|
607
608
|
| 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`. |
|
|
608
609
|
| snap | boolean? = false | Determines whether elements will snap. Default value is "false". |
|
|
609
610
|
| snappingMethod | [SnappingMethod? = 'normal'](https://github.com/DjonnyX/ng-virtual-list/blob/20.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. |
|
|
@@ -639,6 +640,25 @@ Methods
|
|
|
639
640
|
| scrollTo | (id: [Id](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/types/id.ts), behavior: ScrollBehavior = 'auto') => number | The method scrolls the list to the element with the given id and returns the value of the scrolled area. Behavior accepts the values "auto", "instant" and "smooth". |
|
|
640
641
|
| scrollToEnd | (behavior?: ScrollBehavior) => void | Scrolls the scroll area to the desired element with the specified ID. |
|
|
641
642
|
| getItemBounds | (id: [Id](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/types/id.ts), behavior?: ScrollBehavior) => void | Returns the bounds of an element with a given id |
|
|
643
|
+
| focus | [Id](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/types/id.ts), align: [FocusAlignment](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/types/focus-alignment.ts) = [FocusAlignments.NONE](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/enums/focus-alignments.ts) | Focus an list item by a given id. |
|
|
644
|
+
|
|
645
|
+
<br/>
|
|
646
|
+
|
|
647
|
+
### Template API
|
|
648
|
+
|
|
649
|
+
```html
|
|
650
|
+
<ng-template #itemRenderer let-data="data" let-config="config" let-measures="measures">
|
|
651
|
+
<!-- content -->
|
|
652
|
+
</ng-template>
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
Properties
|
|
656
|
+
|
|
657
|
+
| Property | Type | Description |
|
|
658
|
+
|--|--|--|
|
|
659
|
+
| data | {\[id: [Id](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/types/id.ts) \], [otherProps: string]: any;} | Collection item data. |
|
|
660
|
+
| config | [IDisplayObjectConfig](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/models/display-object-config.model.ts) | Display object configuration. A set of `select`, `collapse`, and `focus` methods are also provided. |
|
|
661
|
+
| measures | [IDisplayObjectMeasures](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/models/display-object-measures.model.ts) \| undefined | Display object metrics. |
|
|
642
662
|
|
|
643
663
|
<br/>
|
|
644
664
|
|
|
@@ -646,12 +666,12 @@ Methods
|
|
|
646
666
|
|
|
647
667
|
| Angular version | ng-virtual-list version | git | npm |
|
|
648
668
|
|--|--|--|--|
|
|
649
|
-
| 19.x | 19.7.
|
|
650
|
-
| 18.x | 18.7.
|
|
651
|
-
| 17.x | 17.7.
|
|
652
|
-
| 16.x | 16.7.
|
|
653
|
-
| 15.x | 15.7.
|
|
654
|
-
| 14.x | 14.7.
|
|
669
|
+
| 19.x | 19.7.23 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.7.23](https://www.npmjs.com/package/ng-virtual-list/v/19.7.23) |
|
|
670
|
+
| 18.x | 18.7.14 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.7.14](https://www.npmjs.com/package/ng-virtual-list/v/18.7.14) |
|
|
671
|
+
| 17.x | 17.7.15 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.7.15](https://www.npmjs.com/package/ng-virtual-list/v/17.7.15) |
|
|
672
|
+
| 16.x | 16.7.13 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.7.13](https://www.npmjs.com/package/ng-virtual-list/v/16.7.13) |
|
|
673
|
+
| 15.x | 15.7.13 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.7.13](https://www.npmjs.com/package/ng-virtual-list/v/15.7.13) |
|
|
674
|
+
| 14.x | 14.7.14 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.7.14](https://www.npmjs.com/package/ng-virtual-list/v/14.7.14) |
|
|
655
675
|
|
|
656
676
|
<br/>
|
|
657
677
|
|