ng-virtual-list 14.4.0 → 14.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/README.md +35 -2
- package/esm2020/lib/components/ng-virtual-list-item.component.mjs +2 -2
- package/esm2020/lib/models/base-virtual-list-item-component.mjs +1 -1
- package/esm2020/lib/models/index.mjs +2 -3
- package/esm2020/lib/ng-virtual-list.component.mjs +8 -10
- package/esm2020/lib/utils/index.mjs +2 -6
- package/esm2020/lib/utils/trackBox.mjs +15 -4
- package/esm2020/lib/utils/tracker.mjs +1 -1
- package/fesm2015/ng-virtual-list.mjs +202 -194
- package/fesm2015/ng-virtual-list.mjs.map +1 -1
- package/fesm2020/ng-virtual-list.mjs +201 -193
- package/fesm2020/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +7 -7
- package/lib/models/base-virtual-list-item-component.d.ts +0 -1
- package/lib/models/index.d.ts +1 -4
- package/lib/ng-virtual-list.component.d.ts +61 -64
- package/lib/utils/index.d.ts +3 -6
- package/lib/utils/trackBox.d.ts +4 -1
- package/lib/utils/tracker.d.ts +11 -4
- package/package.json +1 -1
|
@@ -217,20 +217,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
217
217
|
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"data\">\r\n <li #listItem part=\"item\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, config: data.config}\"></ng-container>\r\n </ng-container>\r\n </li>\r\n</ng-container>", 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"] }]
|
|
218
218
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; } });
|
|
219
219
|
|
|
220
|
-
const HORIZONTAL_ALIASES = [Directions.HORIZONTAL, 'horizontal'], VERTICAL_ALIASES = [Directions.VERTICAL, 'vertical'];
|
|
221
|
-
/**
|
|
222
|
-
* Determines the axis membership of a virtual list
|
|
223
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/isDirection.ts
|
|
224
|
-
* @author Evgenii Grebennikov
|
|
225
|
-
* @email djonnyx@gmail.com
|
|
226
|
-
*/
|
|
227
|
-
const isDirection = (src, expected) => {
|
|
228
|
-
if (HORIZONTAL_ALIASES.includes(expected)) {
|
|
229
|
-
return HORIZONTAL_ALIASES.includes(src);
|
|
230
|
-
}
|
|
231
|
-
return VERTICAL_ALIASES.includes(src);
|
|
232
|
-
};
|
|
233
|
-
|
|
234
220
|
/**
|
|
235
221
|
* Simple debounce function.
|
|
236
222
|
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/debounce.ts
|
|
@@ -278,137 +264,45 @@ const toggleClassName = (el, className, removeClassName) => {
|
|
|
278
264
|
};
|
|
279
265
|
|
|
280
266
|
/**
|
|
281
|
-
*
|
|
282
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/
|
|
267
|
+
* Scroll event.
|
|
268
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/scrollEvent.ts
|
|
283
269
|
* @author Evgenii Grebennikov
|
|
284
270
|
* @email djonnyx@gmail.com
|
|
285
271
|
*/
|
|
286
|
-
class
|
|
287
|
-
constructor(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
this.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
this.
|
|
296
|
-
this.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
this.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
set trackingPropertyName(v) {
|
|
311
|
-
this._trackingPropertyName = v;
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* tracking by propName
|
|
315
|
-
*/
|
|
316
|
-
track(items, components, snapedComponent, direction) {
|
|
317
|
-
if (!items) {
|
|
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;
|
|
272
|
+
class ScrollEvent {
|
|
273
|
+
constructor(params) {
|
|
274
|
+
this._direction = 1;
|
|
275
|
+
this._scrollSize = 0;
|
|
276
|
+
this._scrollWeight = 0;
|
|
277
|
+
this._isVertical = true;
|
|
278
|
+
this._listSize = 0;
|
|
279
|
+
this._size = 0;
|
|
280
|
+
this._isStart = true;
|
|
281
|
+
this._isEnd = false;
|
|
282
|
+
this._delta = 0;
|
|
283
|
+
this._scrollDelta = 0;
|
|
284
|
+
const { direction, isVertical, container, list, delta, scrollDelta } = params;
|
|
285
|
+
this._direction = direction;
|
|
286
|
+
this._isVertical = isVertical;
|
|
287
|
+
this._scrollSize = isVertical ? container.scrollTop : container.scrollLeft;
|
|
288
|
+
this._scrollWeight = isVertical ? container.scrollHeight : container.scrollWidth;
|
|
289
|
+
this._listSize = isVertical ? list.offsetHeight : list.offsetWidth;
|
|
290
|
+
this._size = isVertical ? container.offsetHeight : container.offsetWidth;
|
|
291
|
+
this._isEnd = (this._scrollSize + this._size) === this._scrollWeight;
|
|
292
|
+
this._delta = delta;
|
|
293
|
+
this._scrollDelta = scrollDelta;
|
|
294
|
+
this._isStart = this._scrollSize === 0;
|
|
411
295
|
}
|
|
296
|
+
get direction() { return this._direction; }
|
|
297
|
+
get scrollSize() { return this._scrollSize; }
|
|
298
|
+
get scrollWeight() { return this._scrollWeight; }
|
|
299
|
+
get isVertical() { return this._isVertical; }
|
|
300
|
+
get listSize() { return this._listSize; }
|
|
301
|
+
get size() { return this._size; }
|
|
302
|
+
get isStart() { return this._isStart; }
|
|
303
|
+
get isEnd() { return this._isEnd; }
|
|
304
|
+
get delta() { return this._delta; }
|
|
305
|
+
get scrollDelta() { return this._scrollDelta; }
|
|
412
306
|
}
|
|
413
307
|
|
|
414
308
|
/**
|
|
@@ -682,6 +576,140 @@ class CacheMap extends EventEmitter {
|
|
|
682
576
|
}
|
|
683
577
|
}
|
|
684
578
|
|
|
579
|
+
/**
|
|
580
|
+
* Tracks display items by property
|
|
581
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/tracker.ts
|
|
582
|
+
* @author Evgenii Grebennikov
|
|
583
|
+
* @email djonnyx@gmail.com
|
|
584
|
+
*/
|
|
585
|
+
class Tracker {
|
|
586
|
+
constructor(trackingPropertyName) {
|
|
587
|
+
/**
|
|
588
|
+
* display objects dictionary of indexes by id
|
|
589
|
+
*/
|
|
590
|
+
this._displayObjectIndexMapById = {};
|
|
591
|
+
/**
|
|
592
|
+
* Dictionary displayItems propertyNameId by items propertyNameId
|
|
593
|
+
*/
|
|
594
|
+
this._trackMap = {};
|
|
595
|
+
this._trackingPropertyName = trackingPropertyName;
|
|
596
|
+
}
|
|
597
|
+
set displayObjectIndexMapById(v) {
|
|
598
|
+
if (this._displayObjectIndexMapById === v) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
this._displayObjectIndexMapById = v;
|
|
602
|
+
}
|
|
603
|
+
get displayObjectIndexMapById() {
|
|
604
|
+
return this._displayObjectIndexMapById;
|
|
605
|
+
}
|
|
606
|
+
get trackMap() {
|
|
607
|
+
return this._trackMap;
|
|
608
|
+
}
|
|
609
|
+
set trackingPropertyName(v) {
|
|
610
|
+
this._trackingPropertyName = v;
|
|
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,
|
|
@@ -728,6 +756,7 @@ class TrackBox extends CacheMap {
|
|
|
728
756
|
constructor(trackingPropertyName) {
|
|
729
757
|
super();
|
|
730
758
|
this._isSnappingMethodAdvanced = false;
|
|
759
|
+
this._trackingPropertyName = TRACK_BY_PROPERTY_NAME;
|
|
731
760
|
this._deletedItemsMap = {};
|
|
732
761
|
this._crudDetected = false;
|
|
733
762
|
this._previousTotalSize = 0;
|
|
@@ -741,7 +770,8 @@ class TrackBox extends CacheMap {
|
|
|
741
770
|
this._maxBufferSize = this._defaultBufferSize;
|
|
742
771
|
this._resetBufferSizeTimeout = DEFAULT_RESET_BUFFER_SIZE_TIMEOUT;
|
|
743
772
|
this._previousScrollSize = 0;
|
|
744
|
-
this.
|
|
773
|
+
this._trackingPropertyName = trackingPropertyName;
|
|
774
|
+
this.initialize();
|
|
745
775
|
}
|
|
746
776
|
set items(v) {
|
|
747
777
|
if (this._items === v) {
|
|
@@ -771,7 +801,10 @@ class TrackBox extends CacheMap {
|
|
|
771
801
|
* Set the trackBy property
|
|
772
802
|
*/
|
|
773
803
|
set trackingPropertyName(v) {
|
|
774
|
-
this._tracker.trackingPropertyName = v;
|
|
804
|
+
this._trackingPropertyName = this._tracker.trackingPropertyName = v;
|
|
805
|
+
}
|
|
806
|
+
initialize() {
|
|
807
|
+
this._tracker = new Tracker(this._trackingPropertyName);
|
|
775
808
|
}
|
|
776
809
|
set(id, bounds) {
|
|
777
810
|
if (this._map.has(id)) {
|
|
@@ -1298,6 +1331,9 @@ class TrackBox extends CacheMap {
|
|
|
1298
1331
|
if (snap) {
|
|
1299
1332
|
const startIndex = itemsFromStartToScrollEnd + itemsOnDisplayLength - 1;
|
|
1300
1333
|
for (let i = Math.min(startIndex, totalLength > 0 ? totalLength - 1 : 0), l = totalLength; i < l; i++) {
|
|
1334
|
+
if (!items[i]) {
|
|
1335
|
+
continue;
|
|
1336
|
+
}
|
|
1301
1337
|
const id = items[i].id, sticky = stickyMap[id], size = dynamicSize
|
|
1302
1338
|
? this.get(id)?.[sizeProperty] || typicalItemSize
|
|
1303
1339
|
: typicalItemSize;
|
|
@@ -1332,6 +1368,9 @@ class TrackBox extends CacheMap {
|
|
|
1332
1368
|
if (i >= totalLength) {
|
|
1333
1369
|
break;
|
|
1334
1370
|
}
|
|
1371
|
+
if (!items[i]) {
|
|
1372
|
+
continue;
|
|
1373
|
+
}
|
|
1335
1374
|
const id = items[i].id, size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
|
|
1336
1375
|
if (id !== stickyItem?.id && id !== endStickyItem?.id) {
|
|
1337
1376
|
const snapped = snap && (stickyMap[id] === 1 && pos <= scrollSize || stickyMap[id] === 2 && pos >= scrollSize + boundsSize - size), measures = {
|
|
@@ -1450,48 +1489,6 @@ class TrackBox extends CacheMap {
|
|
|
1450
1489
|
}
|
|
1451
1490
|
}
|
|
1452
1491
|
|
|
1453
|
-
/**
|
|
1454
|
-
* Scroll event.
|
|
1455
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/scrollEvent.ts
|
|
1456
|
-
* @author Evgenii Grebennikov
|
|
1457
|
-
* @email djonnyx@gmail.com
|
|
1458
|
-
*/
|
|
1459
|
-
class ScrollEvent {
|
|
1460
|
-
constructor(params) {
|
|
1461
|
-
this._direction = 1;
|
|
1462
|
-
this._scrollSize = 0;
|
|
1463
|
-
this._scrollWeight = 0;
|
|
1464
|
-
this._isVertical = true;
|
|
1465
|
-
this._listSize = 0;
|
|
1466
|
-
this._size = 0;
|
|
1467
|
-
this._isStart = true;
|
|
1468
|
-
this._isEnd = false;
|
|
1469
|
-
this._delta = 0;
|
|
1470
|
-
this._scrollDelta = 0;
|
|
1471
|
-
const { direction, isVertical, container, list, delta, scrollDelta } = params;
|
|
1472
|
-
this._direction = direction;
|
|
1473
|
-
this._isVertical = isVertical;
|
|
1474
|
-
this._scrollSize = isVertical ? container.scrollTop : container.scrollLeft;
|
|
1475
|
-
this._scrollWeight = isVertical ? container.scrollHeight : container.scrollWidth;
|
|
1476
|
-
this._listSize = isVertical ? list.offsetHeight : list.offsetWidth;
|
|
1477
|
-
this._size = isVertical ? container.offsetHeight : container.offsetWidth;
|
|
1478
|
-
this._isEnd = (this._scrollSize + this._size) === this._scrollWeight;
|
|
1479
|
-
this._delta = delta;
|
|
1480
|
-
this._scrollDelta = scrollDelta;
|
|
1481
|
-
this._isStart = this._scrollSize === 0;
|
|
1482
|
-
}
|
|
1483
|
-
get direction() { return this._direction; }
|
|
1484
|
-
get scrollSize() { return this._scrollSize; }
|
|
1485
|
-
get scrollWeight() { return this._scrollWeight; }
|
|
1486
|
-
get isVertical() { return this._isVertical; }
|
|
1487
|
-
get listSize() { return this._listSize; }
|
|
1488
|
-
get size() { return this._size; }
|
|
1489
|
-
get isStart() { return this._isStart; }
|
|
1490
|
-
get isEnd() { return this._isEnd; }
|
|
1491
|
-
get delta() { return this._delta; }
|
|
1492
|
-
get scrollDelta() { return this._scrollDelta; }
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
1492
|
/**
|
|
1496
1493
|
* Base disposable component
|
|
1497
1494
|
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/disposableComponent.ts
|
|
@@ -1529,6 +1526,20 @@ const isSnappingMethodDefault = (method) => {
|
|
|
1529
1526
|
const IS_FIREFOX = navigator.userAgent.toLowerCase().includes('firefox');
|
|
1530
1527
|
const FIREFOX_SCROLLBAR_OVERLAP_SIZE = 12;
|
|
1531
1528
|
|
|
1529
|
+
const HORIZONTAL_ALIASES = [Directions.HORIZONTAL, 'horizontal'], VERTICAL_ALIASES = [Directions.VERTICAL, 'vertical'];
|
|
1530
|
+
/**
|
|
1531
|
+
* Determines the axis membership of a virtual list
|
|
1532
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/isDirection.ts
|
|
1533
|
+
* @author Evgenii Grebennikov
|
|
1534
|
+
* @email djonnyx@gmail.com
|
|
1535
|
+
*/
|
|
1536
|
+
const isDirection = (src, expected) => {
|
|
1537
|
+
if (HORIZONTAL_ALIASES.includes(expected)) {
|
|
1538
|
+
return HORIZONTAL_ALIASES.includes(src);
|
|
1539
|
+
}
|
|
1540
|
+
return VERTICAL_ALIASES.includes(src);
|
|
1541
|
+
};
|
|
1542
|
+
|
|
1532
1543
|
/**
|
|
1533
1544
|
* Virtual list component.
|
|
1534
1545
|
* Maximum performance for extremely large lists.
|
|
@@ -1750,7 +1761,10 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1750
1761
|
}
|
|
1751
1762
|
return of(displayItems);
|
|
1752
1763
|
})).subscribe();
|
|
1753
|
-
this
|
|
1764
|
+
const $itemRenderer = this.$itemRenderer;
|
|
1765
|
+
$itemRenderer.pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), filter(v => !!v), tap(v => {
|
|
1766
|
+
this._$renderer.next(v);
|
|
1767
|
+
})).subscribe();
|
|
1754
1768
|
}
|
|
1755
1769
|
/**
|
|
1756
1770
|
* Readonly. Returns the unique identifier of the component.
|
|
@@ -1917,12 +1931,6 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1917
1931
|
get snappingMethod() { return this._$snappingMethod.getValue(); }
|
|
1918
1932
|
get isSnappingMethodAdvanced() { return this._isSnappingMethodAdvanced; }
|
|
1919
1933
|
get $cacheVersion() { return this._$cacheVersion.asObservable(); }
|
|
1920
|
-
setupRenderer() {
|
|
1921
|
-
const $itemRenderer = this.$itemRenderer;
|
|
1922
|
-
$itemRenderer.pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), filter(v => !!v), tap(v => {
|
|
1923
|
-
this._$renderer.next(v);
|
|
1924
|
-
})).subscribe();
|
|
1925
|
-
}
|
|
1926
1934
|
/** @internal */
|
|
1927
1935
|
ngOnInit() {
|
|
1928
1936
|
this.onInit();
|
|
@@ -2217,5 +2225,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2217
2225
|
* Generated bundle index. Do not edit.
|
|
2218
2226
|
*/
|
|
2219
2227
|
|
|
2220
|
-
export {
|
|
2228
|
+
export { Directions, NgVirtualListComponent, NgVirtualListItemComponent, NgVirtualListModule, SnappingMethods };
|
|
2221
2229
|
//# sourceMappingURL=ng-virtual-list.mjs.map
|