ng-virtual-list 16.4.3 → 16.4.4
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/esm2020/lib/utils/tracker.mjs +18 -9
- package/esm2022/lib/utils/tracker.mjs +18 -9
- package/fesm2015/ng-virtual-list.mjs +16 -8
- package/fesm2015/ng-virtual-list.mjs.map +1 -1
- package/fesm2020/ng-virtual-list.mjs +16 -8
- package/fesm2020/ng-virtual-list.mjs.map +1 -1
- package/fesm2022/ng-virtual-list.mjs +16 -8
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/utils/tracker.d.ts +3 -7
- package/package.json +1 -1
|
@@ -606,7 +606,7 @@ class Tracker {
|
|
|
606
606
|
/**
|
|
607
607
|
* Dictionary displayItems propertyNameId by items propertyNameId
|
|
608
608
|
*/
|
|
609
|
-
this._trackMap =
|
|
609
|
+
this._trackMap = new CMap();
|
|
610
610
|
this._trackingPropertyName = trackingPropertyName;
|
|
611
611
|
}
|
|
612
612
|
/**
|
|
@@ -616,13 +616,13 @@ class Tracker {
|
|
|
616
616
|
if (!items) {
|
|
617
617
|
return;
|
|
618
618
|
}
|
|
619
|
-
const idPropName = this._trackingPropertyName, untrackedItems = [...components], isDown = direction === 0 || direction === 1;
|
|
619
|
+
const idPropName = this._trackingPropertyName, untrackedItems = [...components], newTrackItems = [], isDown = direction === 0 || direction === 1;
|
|
620
620
|
let isRegularSnapped = false;
|
|
621
621
|
for (let i = isDown ? 0 : items.length - 1, l = isDown ? items.length : 0; isDown ? i < l : i >= l; isDown ? i++ : i--) {
|
|
622
622
|
const item = items[i], itemTrackingProperty = item[idPropName];
|
|
623
623
|
if (this._trackMap) {
|
|
624
|
-
if (this._trackMap.
|
|
625
|
-
const diId = this._trackMap
|
|
624
|
+
if (this._trackMap.has(itemTrackingProperty)) {
|
|
625
|
+
const diId = this._trackMap.get(itemTrackingProperty), compIndex = this._displayObjectIndexMapById[diId], comp = components[compIndex];
|
|
626
626
|
const compId = comp?.instance?.id;
|
|
627
627
|
if (comp !== undefined && compId === diId) {
|
|
628
628
|
const indexByUntrackedItems = untrackedItems.findIndex(v => {
|
|
@@ -652,9 +652,15 @@ class Tracker {
|
|
|
652
652
|
continue;
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
|
-
|
|
655
|
+
this._trackMap.delete(itemTrackingProperty);
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
+
if (untrackedItems.length > 0) {
|
|
659
|
+
newTrackItems.push(item);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
for (let i = 0, l = newTrackItems.length; i < l; i++) {
|
|
663
|
+
const item = newTrackItems[i], itemTrackingProperty = item[idPropName];
|
|
658
664
|
if (untrackedItems.length > 0) {
|
|
659
665
|
const comp = untrackedItems.shift(), item = items[i];
|
|
660
666
|
if (comp) {
|
|
@@ -678,7 +684,7 @@ class Tracker {
|
|
|
678
684
|
comp.instance.show();
|
|
679
685
|
}
|
|
680
686
|
if (this._trackMap) {
|
|
681
|
-
this._trackMap
|
|
687
|
+
this._trackMap.set(itemTrackingProperty, comp.instance.id);
|
|
682
688
|
}
|
|
683
689
|
}
|
|
684
690
|
}
|
|
@@ -702,11 +708,13 @@ class Tracker {
|
|
|
702
708
|
}
|
|
703
709
|
const propertyIdName = this._trackingPropertyName;
|
|
704
710
|
if (this._trackMap && component[propertyIdName] !== undefined) {
|
|
705
|
-
|
|
711
|
+
this._trackMap.delete(propertyIdName);
|
|
706
712
|
}
|
|
707
713
|
}
|
|
708
714
|
dispose() {
|
|
709
|
-
this._trackMap
|
|
715
|
+
if (this._trackMap) {
|
|
716
|
+
this._trackMap.clear();
|
|
717
|
+
}
|
|
710
718
|
}
|
|
711
719
|
}
|
|
712
720
|
|