ng-virtual-list 19.7.1 → 19.7.2
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 +16 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ export class AppComponent {
|
|
|
109
109
|
Template:
|
|
110
110
|
```html
|
|
111
111
|
<ng-virtual-list class="list" direction="horizontal" [items]="horizontalGroupItems" [itemRenderer]="horizontalGroupItemRenderer"
|
|
112
|
-
[bufferSize]="50" [
|
|
112
|
+
[bufferSize]="50" [itemConfigMap]="horizontalGroupItemConfigMap" [itemSize]="54" [snap]="true" (onItemClick)="onItemClick($event)"></ng-virtual-list>
|
|
113
113
|
|
|
114
114
|
<ng-template #horizontalGroupItemRenderer let-data="data">
|
|
115
115
|
@if (data) {
|
|
@@ -131,7 +131,7 @@ Template:
|
|
|
131
131
|
|
|
132
132
|
Component:
|
|
133
133
|
```ts
|
|
134
|
-
import { NgVirtualListComponent, IVirtualListCollection,
|
|
134
|
+
import { NgVirtualListComponent, IVirtualListCollection, IVirtualListItemConfigMap, IRenderVirtualListItem } from 'ng-virtual-list';
|
|
135
135
|
|
|
136
136
|
const GROUP_NAMES = ['A', 'B', 'C', 'D', 'E'];
|
|
137
137
|
|
|
@@ -145,12 +145,12 @@ interface ICollectionItem {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
const HORIZONTAL_GROUP_ITEMS: IVirtualListCollection<ICollectionItem> = [],
|
|
148
|
-
|
|
148
|
+
HORIZONTAL_GROUP_ITEM_CONFIG_MAP: IVirtualListItemConfigMap = {};
|
|
149
149
|
|
|
150
150
|
for (let i = 0, l = 1000000; i < l; i++) {
|
|
151
151
|
const id = i + 1, type = Math.random() > .895 ? 'group-header' : 'item';
|
|
152
152
|
HORIZONTAL_GROUP_ITEMS.push({ id, type, name: type === 'group-header' ? getGroupName() : `${i}` });
|
|
153
|
-
|
|
153
|
+
HORIZONTAL_GROUP_ITEM_CONFIG_MAP[id] = type === 'group-header' ? 1 : 0;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
@Component({
|
|
@@ -161,7 +161,7 @@ for (let i = 0, l = 1000000; i < l; i++) {
|
|
|
161
161
|
})
|
|
162
162
|
export class AppComponent {
|
|
163
163
|
horizontalGroupItems = HORIZONTAL_GROUP_ITEMS;
|
|
164
|
-
|
|
164
|
+
horizontalGroupItemConfigMap = HORIZONTAL_GROUP_ITEM_CONFIG_MAP;
|
|
165
165
|
|
|
166
166
|
onItemClick(item: IRenderVirtualListItem<ICollectionItem> | undefined) {
|
|
167
167
|
if (item) {
|
|
@@ -219,7 +219,7 @@ export class AppComponent {
|
|
|
219
219
|
Template:
|
|
220
220
|
```html
|
|
221
221
|
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="50" [itemRenderer]="groupItemRenderer"
|
|
222
|
-
[
|
|
222
|
+
[itemConfigMap]="groupItemConfigMap" [itemSize]="40" [snap]="false"></ng-virtual-list>
|
|
223
223
|
|
|
224
224
|
<ng-template #groupItemRenderer let-data="data">
|
|
225
225
|
@if (data) {
|
|
@@ -246,7 +246,7 @@ Template:
|
|
|
246
246
|
Template (with snapping):
|
|
247
247
|
```html
|
|
248
248
|
<ng-virtual-list class="list simple" [items]="groupItems" [bufferSize]="50" [itemRenderer]="groupItemRenderer"
|
|
249
|
-
[
|
|
249
|
+
[itemConfigMap]="groupItemConfigMap" [itemSize]="40" [snap]="true"></ng-virtual-list>
|
|
250
250
|
|
|
251
251
|
<ng-template #groupItemRenderer let-data="data">
|
|
252
252
|
@if (data) {
|
|
@@ -268,10 +268,10 @@ Template (with snapping):
|
|
|
268
268
|
|
|
269
269
|
Component:
|
|
270
270
|
```ts
|
|
271
|
-
import { NgVirtualListComponent, IVirtualListCollection,
|
|
271
|
+
import { NgVirtualListComponent, IVirtualListCollection, IVirtualListItemConfigMap } from 'ng-virtual-list';
|
|
272
272
|
|
|
273
273
|
const GROUP_ITEMS: IVirtualListCollection = [],
|
|
274
|
-
|
|
274
|
+
GROUP_ITEM_CONFIG_MAP: IVirtualListItemConfigMap = {};
|
|
275
275
|
|
|
276
276
|
let groupIndex = 0;
|
|
277
277
|
for (let i = 0, l = 10000000; i < l; i++) {
|
|
@@ -280,7 +280,7 @@ for (let i = 0, l = 10000000; i < l; i++) {
|
|
|
280
280
|
groupIndex++;
|
|
281
281
|
}
|
|
282
282
|
GROUP_ITEMS.push({ id, type, name: type === 'group-header' ? `Group ${groupIndex}` : `Item: ${i}` });
|
|
283
|
-
|
|
283
|
+
GROUP_ITEM_CONFIG_MAP[id] = type === 'group-header' ? 1 : 0;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
@Component({
|
|
@@ -291,7 +291,7 @@ for (let i = 0, l = 10000000; i < l; i++) {
|
|
|
291
291
|
})
|
|
292
292
|
export class AppComponent {
|
|
293
293
|
groupItems = GROUP_ITEMS;
|
|
294
|
-
|
|
294
|
+
groupItemConfigMap = GROUP_ITEM_CONFIG_MAP;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
```
|
|
@@ -365,7 +365,7 @@ Virtual list with height-adjustable elements.
|
|
|
365
365
|
Template
|
|
366
366
|
```html
|
|
367
367
|
<ng-virtual-list #dynamicList class="list" [items]="groupDynamicItems" [itemRenderer]="groupItemRenderer" [bufferSize]="10"
|
|
368
|
-
[
|
|
368
|
+
[itemConfigMap]="groupDynamicItemConfigMap" [dynamicSize]="true" [snap]="true"></ng-virtual-list>
|
|
369
369
|
|
|
370
370
|
<ng-template #groupItemRenderer let-data="data">
|
|
371
371
|
@if (data) {
|
|
@@ -413,7 +413,7 @@ const generateText = () => {
|
|
|
413
413
|
};
|
|
414
414
|
|
|
415
415
|
const GROUP_DYNAMIC_ITEMS: IVirtualListCollection = [],
|
|
416
|
-
|
|
416
|
+
GROUP_DYNAMIC_ITEM_CONFIG_MAP: IVirtualListItemConfigMap = {};
|
|
417
417
|
|
|
418
418
|
let groupDynamicIndex = 0;
|
|
419
419
|
for (let i = 0, l = 100000; i < l; i++) {
|
|
@@ -422,7 +422,7 @@ for (let i = 0, l = 100000; i < l; i++) {
|
|
|
422
422
|
groupDynamicIndex++;
|
|
423
423
|
}
|
|
424
424
|
GROUP_DYNAMIC_ITEMS.push({ id, type, name: type === 'group-header' ? `Group ${groupDynamicIndex}` : `${id}. ${generateText()}` });
|
|
425
|
-
|
|
425
|
+
GROUP_DYNAMIC_ITEM_CONFIG_MAP[id] = type === 'group-header' ? 1 : 0;
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
@Component({
|
|
@@ -433,7 +433,7 @@ for (let i = 0, l = 100000; i < l; i++) {
|
|
|
433
433
|
})
|
|
434
434
|
export class AppComponent {
|
|
435
435
|
groupDynamicItems = GROUP_DYNAMIC_ITEMS;
|
|
436
|
-
|
|
436
|
+
groupDynamicItemConfigMap = GROUP_DYNAMIC_ITEM_CONFIG_MAP;
|
|
437
437
|
}
|
|
438
438
|
```
|
|
439
439
|
|
|
@@ -536,7 +536,7 @@ Inputs
|
|
|
536
536
|
| maxBufferSize | number? = 100 | Maximum number of elements outside the scope of visibility. Default value is 100. If maxBufferSize is set to be greater than bufferSize, then adaptive buffer mode is enabled. The greater the scroll size, the more elements are allocated for rendering. |
|
|
537
537
|
| itemRenderer | TemplateRef | Rendering element template. |
|
|
538
538
|
| methodForSelecting | [MethodForSelecting](https://github.com/DjonnyX/ng-virtual-list/blob/19.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. |
|
|
539
|
-
|
|
|
539
|
+
| 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`. |
|
|
540
540
|
| snap | boolean? = false | Determines whether elements will snap. Default value is "false". |
|
|
541
541
|
| snappingMethod | [SnappingMethod? = 'normal'](https://github.com/DjonnyX/ng-virtual-list/blob/19.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. |
|
|
542
542
|
| direction | [Direction? = 'vertical'](https://github.com/DjonnyX/ng-virtual-list/blob/19.x/projects/ng-virtual-list/src/lib/enums/direction.ts) | Determines the direction in which elements are placed. Default value is "vertical". |
|