ng-virtual-list 19.4.1-beta-7 → 19.4.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/fesm2022/ng-virtual-list.mjs +191 -192
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +9 -9
- package/lib/models/base-virtual-list-item-component.d.ts +0 -1
- package/lib/models/index.d.ts +1 -7
- package/lib/ng-virtual-list.component.d.ts +47 -52
- package/lib/utils/index.d.ts +3 -6
- package/lib/utils/trackBox.d.ts +2 -1
- package/lib/utils/tracker.d.ts +2 -1
- package/package.json +1 -1
- package/public-api.d.ts +0 -1
|
@@ -216,20 +216,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
216
216
|
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@let item = data();\r\n@let renderer = itemRenderer();\r\n\r\n@if (item) {\r\n <li #listItem part=\"item\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': item.config.snapped,\r\n 'snapped-out': item.config.snappedOut}\">\r\n @if (renderer) {\r\n <ng-container [ngTemplateOutlet]=\"renderer\"\r\n [ngTemplateOutletContext]=\"{data: item.data || {}, config: item.config}\" />\r\n }\r\n </li>\r\n}", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"] }]
|
|
217
217
|
}], ctorParameters: () => [] });
|
|
218
218
|
|
|
219
|
-
const HORIZONTAL_ALIASES = [Directions.HORIZONTAL, 'horizontal'], VERTICAL_ALIASES = [Directions.VERTICAL, 'vertical'];
|
|
220
|
-
/**
|
|
221
|
-
* Determines the axis membership of a virtual list
|
|
222
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/19.x/projects/ng-virtual-list/src/lib/utils/isDirection.ts
|
|
223
|
-
* @author Evgenii Grebennikov
|
|
224
|
-
* @email djonnyx@gmail.com
|
|
225
|
-
*/
|
|
226
|
-
const isDirection = (src, expected) => {
|
|
227
|
-
if (HORIZONTAL_ALIASES.includes(expected)) {
|
|
228
|
-
return HORIZONTAL_ALIASES.includes(src);
|
|
229
|
-
}
|
|
230
|
-
return VERTICAL_ALIASES.includes(src);
|
|
231
|
-
};
|
|
232
|
-
|
|
233
219
|
/**
|
|
234
220
|
* Simple debounce function.
|
|
235
221
|
* @link https://github.com/DjonnyX/ng-virtual-list/blob/19.x/projects/ng-virtual-list/src/lib/utils/debounce.ts
|
|
@@ -277,137 +263,44 @@ const toggleClassName = (el, className, removeClassName) => {
|
|
|
277
263
|
};
|
|
278
264
|
|
|
279
265
|
/**
|
|
280
|
-
*
|
|
281
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/19.x/projects/ng-virtual-list/src/lib/utils/
|
|
266
|
+
* Scroll event.
|
|
267
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/19.x/projects/ng-virtual-list/src/lib/utils/scrollEvent.ts
|
|
282
268
|
* @author Evgenii Grebennikov
|
|
283
269
|
* @email djonnyx@gmail.com
|
|
284
270
|
*/
|
|
285
|
-
class
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
get
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
this.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
this.
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
const idPropName = this._trackingPropertyName, untrackedItems = [...components], isDown = direction === 0 || direction === 1;
|
|
321
|
-
let isRegularSnapped = false;
|
|
322
|
-
for (let i = isDown ? 0 : items.length - 1, l = isDown ? items.length : 0; isDown ? i < l : i >= l; isDown ? i++ : i--) {
|
|
323
|
-
const item = items[i], itemTrackingProperty = item[idPropName];
|
|
324
|
-
if (this._trackMap) {
|
|
325
|
-
if (this._trackMap.hasOwnProperty(itemTrackingProperty)) {
|
|
326
|
-
const diId = this._trackMap[itemTrackingProperty], compIndex = this._displayObjectIndexMapById[diId], comp = components[compIndex];
|
|
327
|
-
const compId = comp?.instance?.id;
|
|
328
|
-
if (comp !== undefined && compId === diId) {
|
|
329
|
-
const indexByUntrackedItems = untrackedItems.findIndex(v => {
|
|
330
|
-
return v.instance.id === compId;
|
|
331
|
-
});
|
|
332
|
-
if (indexByUntrackedItems > -1) {
|
|
333
|
-
if (snapedComponent) {
|
|
334
|
-
if (item['config']['snapped'] || item['config']['snappedOut']) {
|
|
335
|
-
isRegularSnapped = true;
|
|
336
|
-
snapedComponent.instance.item = item;
|
|
337
|
-
snapedComponent.instance.show();
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
comp.instance.item = item;
|
|
341
|
-
if (snapedComponent) {
|
|
342
|
-
if (item['config']['snapped'] || item['config']['snappedOut']) {
|
|
343
|
-
comp.instance.hide();
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
comp.instance.show();
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
comp.instance.show();
|
|
351
|
-
}
|
|
352
|
-
untrackedItems.splice(indexByUntrackedItems, 1);
|
|
353
|
-
continue;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
delete this._trackMap[itemTrackingProperty];
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
if (untrackedItems.length > 0) {
|
|
360
|
-
const comp = untrackedItems.shift(), item = items[i];
|
|
361
|
-
if (comp) {
|
|
362
|
-
if (snapedComponent) {
|
|
363
|
-
if (item['config']['snapped'] || item['config']['snappedOut']) {
|
|
364
|
-
isRegularSnapped = true;
|
|
365
|
-
snapedComponent.instance.item = item;
|
|
366
|
-
snapedComponent.instance.show();
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
comp.instance.item = item;
|
|
370
|
-
if (snapedComponent) {
|
|
371
|
-
if (item['config']['snapped'] || item['config']['snappedOut']) {
|
|
372
|
-
comp.instance.hide();
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
comp.instance.show();
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
comp.instance.show();
|
|
380
|
-
}
|
|
381
|
-
if (this._trackMap) {
|
|
382
|
-
this._trackMap[itemTrackingProperty] = comp.instance.id;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
if (untrackedItems.length) {
|
|
388
|
-
for (let i = 0, l = untrackedItems.length; i < l; i++) {
|
|
389
|
-
const comp = untrackedItems[i];
|
|
390
|
-
comp.instance.hide();
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
if (!isRegularSnapped) {
|
|
394
|
-
if (snapedComponent) {
|
|
395
|
-
snapedComponent.instance.item = null;
|
|
396
|
-
snapedComponent.instance.hide();
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
untrackComponentByIdProperty(component) {
|
|
401
|
-
if (!component) {
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
const propertyIdName = this._trackingPropertyName;
|
|
405
|
-
if (this._trackMap && component[propertyIdName] !== undefined) {
|
|
406
|
-
delete this._trackMap[propertyIdName];
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
dispose() {
|
|
410
|
-
this._trackMap = null;
|
|
271
|
+
class ScrollEvent {
|
|
272
|
+
_direction = 1;
|
|
273
|
+
get direction() { return this._direction; }
|
|
274
|
+
_scrollSize = 0;
|
|
275
|
+
get scrollSize() { return this._scrollSize; }
|
|
276
|
+
_scrollWeight = 0;
|
|
277
|
+
get scrollWeight() { return this._scrollWeight; }
|
|
278
|
+
_isVertical = true;
|
|
279
|
+
get isVertical() { return this._isVertical; }
|
|
280
|
+
_listSize = 0;
|
|
281
|
+
get listSize() { return this._listSize; }
|
|
282
|
+
_size = 0;
|
|
283
|
+
get size() { return this._size; }
|
|
284
|
+
_isStart = true;
|
|
285
|
+
get isStart() { return this._isStart; }
|
|
286
|
+
_isEnd = false;
|
|
287
|
+
get isEnd() { return this._isEnd; }
|
|
288
|
+
_delta = 0;
|
|
289
|
+
get delta() { return this._delta; }
|
|
290
|
+
_scrollDelta = 0;
|
|
291
|
+
get scrollDelta() { return this._scrollDelta; }
|
|
292
|
+
constructor(params) {
|
|
293
|
+
const { direction, isVertical, container, list, delta, scrollDelta } = params;
|
|
294
|
+
this._direction = direction;
|
|
295
|
+
this._isVertical = isVertical;
|
|
296
|
+
this._scrollSize = isVertical ? container.scrollTop : container.scrollLeft;
|
|
297
|
+
this._scrollWeight = isVertical ? container.scrollHeight : container.scrollWidth;
|
|
298
|
+
this._listSize = isVertical ? list.offsetHeight : list.offsetWidth;
|
|
299
|
+
this._size = isVertical ? container.offsetHeight : container.offsetWidth;
|
|
300
|
+
this._isEnd = (this._scrollSize + this._size) === this._scrollWeight;
|
|
301
|
+
this._delta = delta;
|
|
302
|
+
this._scrollDelta = scrollDelta;
|
|
303
|
+
this._isStart = this._scrollSize === 0;
|
|
411
304
|
}
|
|
412
305
|
}
|
|
413
306
|
|
|
@@ -682,6 +575,141 @@ class CacheMap extends EventEmitter {
|
|
|
682
575
|
}
|
|
683
576
|
}
|
|
684
577
|
|
|
578
|
+
/**
|
|
579
|
+
* Tracks display items by property
|
|
580
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/19.x/projects/ng-virtual-list/src/lib/utils/tracker.ts
|
|
581
|
+
* @author Evgenii Grebennikov
|
|
582
|
+
* @email djonnyx@gmail.com
|
|
583
|
+
*/
|
|
584
|
+
class Tracker {
|
|
585
|
+
/**
|
|
586
|
+
* display objects dictionary of indexes by id
|
|
587
|
+
*/
|
|
588
|
+
_displayObjectIndexMapById = {};
|
|
589
|
+
set displayObjectIndexMapById(v) {
|
|
590
|
+
if (this._displayObjectIndexMapById === v) {
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
this._displayObjectIndexMapById = v;
|
|
594
|
+
}
|
|
595
|
+
get displayObjectIndexMapById() {
|
|
596
|
+
return this._displayObjectIndexMapById;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Dictionary displayItems propertyNameId by items propertyNameId
|
|
600
|
+
*/
|
|
601
|
+
_trackMap = {};
|
|
602
|
+
get trackMap() {
|
|
603
|
+
return this._trackMap;
|
|
604
|
+
}
|
|
605
|
+
_trackingPropertyName;
|
|
606
|
+
set trackingPropertyName(v) {
|
|
607
|
+
this._trackingPropertyName = v;
|
|
608
|
+
}
|
|
609
|
+
constructor(trackingPropertyName) {
|
|
610
|
+
this._trackingPropertyName = trackingPropertyName;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* tracking by propName
|
|
614
|
+
*/
|
|
615
|
+
track(items, components, snapedComponent, direction) {
|
|
616
|
+
if (!items) {
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const idPropName = this._trackingPropertyName, untrackedItems = [...components], isDown = direction === 0 || direction === 1;
|
|
620
|
+
let isRegularSnapped = false;
|
|
621
|
+
for (let i = isDown ? 0 : items.length - 1, l = isDown ? items.length : 0; isDown ? i < l : i >= l; isDown ? i++ : i--) {
|
|
622
|
+
const item = items[i], itemTrackingProperty = item[idPropName];
|
|
623
|
+
if (this._trackMap) {
|
|
624
|
+
if (this._trackMap.hasOwnProperty(itemTrackingProperty)) {
|
|
625
|
+
const diId = this._trackMap[itemTrackingProperty], compIndex = this._displayObjectIndexMapById[diId], comp = components[compIndex];
|
|
626
|
+
const compId = comp?.instance?.id;
|
|
627
|
+
if (comp !== undefined && compId === diId) {
|
|
628
|
+
const indexByUntrackedItems = untrackedItems.findIndex(v => {
|
|
629
|
+
return v.instance.id === compId;
|
|
630
|
+
});
|
|
631
|
+
if (indexByUntrackedItems > -1) {
|
|
632
|
+
if (snapedComponent) {
|
|
633
|
+
if (item['config']['snapped'] || item['config']['snappedOut']) {
|
|
634
|
+
isRegularSnapped = true;
|
|
635
|
+
snapedComponent.instance.item = item;
|
|
636
|
+
snapedComponent.instance.show();
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
comp.instance.item = item;
|
|
640
|
+
if (snapedComponent) {
|
|
641
|
+
if (item['config']['snapped'] || item['config']['snappedOut']) {
|
|
642
|
+
comp.instance.hide();
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
comp.instance.show();
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
comp.instance.show();
|
|
650
|
+
}
|
|
651
|
+
untrackedItems.splice(indexByUntrackedItems, 1);
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
delete this._trackMap[itemTrackingProperty];
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
if (untrackedItems.length > 0) {
|
|
659
|
+
const comp = untrackedItems.shift(), item = items[i];
|
|
660
|
+
if (comp) {
|
|
661
|
+
if (snapedComponent) {
|
|
662
|
+
if (item['config']['snapped'] || item['config']['snappedOut']) {
|
|
663
|
+
isRegularSnapped = true;
|
|
664
|
+
snapedComponent.instance.item = item;
|
|
665
|
+
snapedComponent.instance.show();
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
comp.instance.item = item;
|
|
669
|
+
if (snapedComponent) {
|
|
670
|
+
if (item['config']['snapped'] || item['config']['snappedOut']) {
|
|
671
|
+
comp.instance.hide();
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
comp.instance.show();
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
comp.instance.show();
|
|
679
|
+
}
|
|
680
|
+
if (this._trackMap) {
|
|
681
|
+
this._trackMap[itemTrackingProperty] = comp.instance.id;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
if (untrackedItems.length) {
|
|
687
|
+
for (let i = 0, l = untrackedItems.length; i < l; i++) {
|
|
688
|
+
const comp = untrackedItems[i];
|
|
689
|
+
comp.instance.hide();
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
if (!isRegularSnapped) {
|
|
693
|
+
if (snapedComponent) {
|
|
694
|
+
snapedComponent.instance.item = null;
|
|
695
|
+
snapedComponent.instance.hide();
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
untrackComponentByIdProperty(component) {
|
|
700
|
+
if (!component) {
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
const propertyIdName = this._trackingPropertyName;
|
|
704
|
+
if (this._trackMap && component[propertyIdName] !== undefined) {
|
|
705
|
+
delete this._trackMap[propertyIdName];
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
dispose() {
|
|
709
|
+
this._trackMap = null;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
685
713
|
const DEFAULT_EXTRA = {
|
|
686
714
|
extremumThreshold: 2,
|
|
687
715
|
bufferSize: 10,
|
|
@@ -1309,6 +1337,9 @@ class TrackBox extends CacheMap {
|
|
|
1309
1337
|
if (snap) {
|
|
1310
1338
|
const startIndex = itemsFromStartToScrollEnd + itemsOnDisplayLength - 1;
|
|
1311
1339
|
for (let i = Math.min(startIndex, totalLength > 0 ? totalLength - 1 : 0), l = totalLength; i < l; i++) {
|
|
1340
|
+
if (!items[i]) {
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1312
1343
|
const id = items[i].id, sticky = stickyMap[id], size = dynamicSize
|
|
1313
1344
|
? this.get(id)?.[sizeProperty] || typicalItemSize
|
|
1314
1345
|
: typicalItemSize;
|
|
@@ -1343,6 +1374,9 @@ class TrackBox extends CacheMap {
|
|
|
1343
1374
|
if (i >= totalLength) {
|
|
1344
1375
|
break;
|
|
1345
1376
|
}
|
|
1377
|
+
if (!items[i]) {
|
|
1378
|
+
continue;
|
|
1379
|
+
}
|
|
1346
1380
|
const id = items[i].id, size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
|
|
1347
1381
|
if (id !== stickyItem?.id && id !== endStickyItem?.id) {
|
|
1348
1382
|
const snapped = snap && (stickyMap[id] === 1 && pos <= scrollSize || stickyMap[id] === 2 && pos >= scrollSize + boundsSize - size), measures = {
|
|
@@ -1461,48 +1495,6 @@ class TrackBox extends CacheMap {
|
|
|
1461
1495
|
}
|
|
1462
1496
|
}
|
|
1463
1497
|
|
|
1464
|
-
/**
|
|
1465
|
-
* Scroll event.
|
|
1466
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/19.x/projects/ng-virtual-list/src/lib/utils/scrollEvent.ts
|
|
1467
|
-
* @author Evgenii Grebennikov
|
|
1468
|
-
* @email djonnyx@gmail.com
|
|
1469
|
-
*/
|
|
1470
|
-
class ScrollEvent {
|
|
1471
|
-
_direction = 1;
|
|
1472
|
-
get direction() { return this._direction; }
|
|
1473
|
-
_scrollSize = 0;
|
|
1474
|
-
get scrollSize() { return this._scrollSize; }
|
|
1475
|
-
_scrollWeight = 0;
|
|
1476
|
-
get scrollWeight() { return this._scrollWeight; }
|
|
1477
|
-
_isVertical = true;
|
|
1478
|
-
get isVertical() { return this._isVertical; }
|
|
1479
|
-
_listSize = 0;
|
|
1480
|
-
get listSize() { return this._listSize; }
|
|
1481
|
-
_size = 0;
|
|
1482
|
-
get size() { return this._size; }
|
|
1483
|
-
_isStart = true;
|
|
1484
|
-
get isStart() { return this._isStart; }
|
|
1485
|
-
_isEnd = false;
|
|
1486
|
-
get isEnd() { return this._isEnd; }
|
|
1487
|
-
_delta = 0;
|
|
1488
|
-
get delta() { return this._delta; }
|
|
1489
|
-
_scrollDelta = 0;
|
|
1490
|
-
get scrollDelta() { return this._scrollDelta; }
|
|
1491
|
-
constructor(params) {
|
|
1492
|
-
const { direction, isVertical, container, list, delta, scrollDelta } = params;
|
|
1493
|
-
this._direction = direction;
|
|
1494
|
-
this._isVertical = isVertical;
|
|
1495
|
-
this._scrollSize = isVertical ? container.scrollTop : container.scrollLeft;
|
|
1496
|
-
this._scrollWeight = isVertical ? container.scrollHeight : container.scrollWidth;
|
|
1497
|
-
this._listSize = isVertical ? list.offsetHeight : list.offsetWidth;
|
|
1498
|
-
this._size = isVertical ? container.offsetHeight : container.offsetWidth;
|
|
1499
|
-
this._isEnd = (this._scrollSize + this._size) === this._scrollWeight;
|
|
1500
|
-
this._delta = delta;
|
|
1501
|
-
this._scrollDelta = scrollDelta;
|
|
1502
|
-
this._isStart = this._scrollSize === 0;
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
1498
|
const ADVANCED_PATTERNS = [SnappingMethods.ADVANCED, 'advanced'], DEFAULT_PATTERN = [SnappingMethods.NORMAL, 'normal'];
|
|
1507
1499
|
const isSnappingMethodAdvenced = (method) => {
|
|
1508
1500
|
return ADVANCED_PATTERNS.includes(method);
|
|
@@ -1514,6 +1506,20 @@ const isSnappingMethodDefault = (method) => {
|
|
|
1514
1506
|
const IS_FIREFOX = navigator.userAgent.toLowerCase().includes('firefox');
|
|
1515
1507
|
const FIREFOX_SCROLLBAR_OVERLAP_SIZE = 12;
|
|
1516
1508
|
|
|
1509
|
+
const HORIZONTAL_ALIASES = [Directions.HORIZONTAL, 'horizontal'], VERTICAL_ALIASES = [Directions.VERTICAL, 'vertical'];
|
|
1510
|
+
/**
|
|
1511
|
+
* Determines the axis membership of a virtual list
|
|
1512
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/19.x/projects/ng-virtual-list/src/lib/utils/isDirection.ts
|
|
1513
|
+
* @author Evgenii Grebennikov
|
|
1514
|
+
* @email djonnyx@gmail.com
|
|
1515
|
+
*/
|
|
1516
|
+
const isDirection = (src, expected) => {
|
|
1517
|
+
if (HORIZONTAL_ALIASES.includes(expected)) {
|
|
1518
|
+
return HORIZONTAL_ALIASES.includes(src);
|
|
1519
|
+
}
|
|
1520
|
+
return VERTICAL_ALIASES.includes(src);
|
|
1521
|
+
};
|
|
1522
|
+
|
|
1517
1523
|
/**
|
|
1518
1524
|
* Virtual list component.
|
|
1519
1525
|
* Maximum performance for extremely large lists.
|
|
@@ -1640,7 +1646,6 @@ class NgVirtualListComponent {
|
|
|
1640
1646
|
_snapedDisplayComponent;
|
|
1641
1647
|
_bounds = signal(null);
|
|
1642
1648
|
_scrollSize = signal(0);
|
|
1643
|
-
_scrollHeight = signal(0);
|
|
1644
1649
|
_resizeObserver = null;
|
|
1645
1650
|
_resizeSnappedComponentHandler = () => {
|
|
1646
1651
|
const list = this._list(), container = this._container(), snappedComponent = this._snapedDisplayComponent?.instance;
|
|
@@ -1727,10 +1732,6 @@ class NgVirtualListComponent {
|
|
|
1727
1732
|
this._initialized = signal(false);
|
|
1728
1733
|
this.$initialized = toObservable(this._initialized);
|
|
1729
1734
|
this._trackBox.displayComponents = this._displayComponents;
|
|
1730
|
-
this.initialize();
|
|
1731
|
-
this.setupRenderer();
|
|
1732
|
-
}
|
|
1733
|
-
initialize() {
|
|
1734
1735
|
const $trackBy = toObservable(this.trackBy);
|
|
1735
1736
|
$trackBy.pipe(takeUntilDestroyed(), tap(v => {
|
|
1736
1737
|
this._trackBox.trackingPropertyName = v;
|
|
@@ -1776,8 +1777,6 @@ class NgVirtualListComponent {
|
|
|
1776
1777
|
}
|
|
1777
1778
|
return of(displayItems);
|
|
1778
1779
|
})).subscribe();
|
|
1779
|
-
}
|
|
1780
|
-
setupRenderer() {
|
|
1781
1780
|
const $itemRenderer = toObservable(this.itemRenderer);
|
|
1782
1781
|
$itemRenderer.pipe(takeUntilDestroyed(), distinctUntilChanged(), filter(v => !!v), tap(v => {
|
|
1783
1782
|
this._itemRenderer.set(v);
|
|
@@ -2052,5 +2051,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2052
2051
|
* Generated bundle index. Do not edit.
|
|
2053
2052
|
*/
|
|
2054
2053
|
|
|
2055
|
-
export {
|
|
2054
|
+
export { Directions, NgVirtualListComponent, NgVirtualListItemComponent, SnappingMethods };
|
|
2056
2055
|
//# sourceMappingURL=ng-virtual-list.mjs.map
|