ng-virtual-list 18.4.2 → 18.4.3

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.
@@ -601,7 +601,7 @@ class Tracker {
601
601
  /**
602
602
  * Dictionary displayItems propertyNameId by items propertyNameId
603
603
  */
604
- _trackMap = {};
604
+ _trackMap = new CMap();
605
605
  get trackMap() {
606
606
  return this._trackMap;
607
607
  }
@@ -619,13 +619,13 @@ class Tracker {
619
619
  if (!items) {
620
620
  return;
621
621
  }
622
- const idPropName = this._trackingPropertyName, untrackedItems = [...components], isDown = direction === 0 || direction === 1;
622
+ const idPropName = this._trackingPropertyName, untrackedItems = [...components], newTrackItems = [], isDown = direction === 0 || direction === 1;
623
623
  let isRegularSnapped = false;
624
624
  for (let i = isDown ? 0 : items.length - 1, l = isDown ? items.length : 0; isDown ? i < l : i >= l; isDown ? i++ : i--) {
625
625
  const item = items[i], itemTrackingProperty = item[idPropName];
626
626
  if (this._trackMap) {
627
- if (this._trackMap.hasOwnProperty(itemTrackingProperty)) {
628
- const diId = this._trackMap[itemTrackingProperty], compIndex = this._displayObjectIndexMapById[diId], comp = components[compIndex];
627
+ if (this._trackMap.has(itemTrackingProperty)) {
628
+ const diId = this._trackMap.get(itemTrackingProperty), compIndex = this._displayObjectIndexMapById[diId], comp = components[compIndex];
629
629
  const compId = comp?.instance?.id;
630
630
  if (comp !== undefined && compId === diId) {
631
631
  const indexByUntrackedItems = untrackedItems.findIndex(v => {
@@ -655,9 +655,15 @@ class Tracker {
655
655
  continue;
656
656
  }
657
657
  }
658
- delete this._trackMap[itemTrackingProperty];
658
+ this._trackMap.delete(itemTrackingProperty);
659
659
  }
660
660
  }
661
+ if (untrackedItems.length > 0) {
662
+ newTrackItems.push(item);
663
+ }
664
+ }
665
+ for (let i = 0, l = newTrackItems.length; i < l; i++) {
666
+ const item = newTrackItems[i], itemTrackingProperty = item[idPropName];
661
667
  if (untrackedItems.length > 0) {
662
668
  const comp = untrackedItems.shift(), item = items[i];
663
669
  if (comp) {
@@ -681,7 +687,7 @@ class Tracker {
681
687
  comp.instance.show();
682
688
  }
683
689
  if (this._trackMap) {
684
- this._trackMap[itemTrackingProperty] = comp.instance.id;
690
+ this._trackMap.set(itemTrackingProperty, comp.instance.id);
685
691
  }
686
692
  }
687
693
  }
@@ -705,11 +711,13 @@ class Tracker {
705
711
  }
706
712
  const propertyIdName = this._trackingPropertyName;
707
713
  if (this._trackMap && component[propertyIdName] !== undefined) {
708
- delete this._trackMap[propertyIdName];
714
+ this._trackMap.delete(propertyIdName);
709
715
  }
710
716
  }
711
717
  dispose() {
712
- this._trackMap = null;
718
+ if (this._trackMap) {
719
+ this._trackMap.clear();
720
+ }
713
721
  }
714
722
  }
715
723