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.
@@ -605,7 +605,7 @@ class Tracker {
605
605
  /**
606
606
  * Dictionary displayItems propertyNameId by items propertyNameId
607
607
  */
608
- _trackMap = {};
608
+ _trackMap = new CMap();
609
609
  get trackMap() {
610
610
  return this._trackMap;
611
611
  }
@@ -623,13 +623,13 @@ class Tracker {
623
623
  if (!items) {
624
624
  return;
625
625
  }
626
- const idPropName = this._trackingPropertyName, untrackedItems = [...components], isDown = direction === 0 || direction === 1;
626
+ const idPropName = this._trackingPropertyName, untrackedItems = [...components], newTrackItems = [], isDown = direction === 0 || direction === 1;
627
627
  let isRegularSnapped = false;
628
628
  for (let i = isDown ? 0 : items.length - 1, l = isDown ? items.length : 0; isDown ? i < l : i >= l; isDown ? i++ : i--) {
629
629
  const item = items[i], itemTrackingProperty = item[idPropName];
630
630
  if (this._trackMap) {
631
- if (this._trackMap.hasOwnProperty(itemTrackingProperty)) {
632
- const diId = this._trackMap[itemTrackingProperty], compIndex = this._displayObjectIndexMapById[diId], comp = components[compIndex];
631
+ if (this._trackMap.has(itemTrackingProperty)) {
632
+ const diId = this._trackMap.get(itemTrackingProperty), compIndex = this._displayObjectIndexMapById[diId], comp = components[compIndex];
633
633
  const compId = comp?.instance?.id;
634
634
  if (comp !== undefined && compId === diId) {
635
635
  const indexByUntrackedItems = untrackedItems.findIndex(v => {
@@ -659,9 +659,15 @@ class Tracker {
659
659
  continue;
660
660
  }
661
661
  }
662
- delete this._trackMap[itemTrackingProperty];
662
+ this._trackMap.delete(itemTrackingProperty);
663
663
  }
664
664
  }
665
+ if (untrackedItems.length > 0) {
666
+ newTrackItems.push(item);
667
+ }
668
+ }
669
+ for (let i = 0, l = newTrackItems.length; i < l; i++) {
670
+ const item = newTrackItems[i], itemTrackingProperty = item[idPropName];
665
671
  if (untrackedItems.length > 0) {
666
672
  const comp = untrackedItems.shift(), item = items[i];
667
673
  if (comp) {
@@ -685,7 +691,7 @@ class Tracker {
685
691
  comp.instance.show();
686
692
  }
687
693
  if (this._trackMap) {
688
- this._trackMap[itemTrackingProperty] = comp.instance.id;
694
+ this._trackMap.set(itemTrackingProperty, comp.instance.id);
689
695
  }
690
696
  }
691
697
  }
@@ -709,11 +715,13 @@ class Tracker {
709
715
  }
710
716
  const propertyIdName = this._trackingPropertyName;
711
717
  if (this._trackMap && component[propertyIdName] !== undefined) {
712
- delete this._trackMap[propertyIdName];
718
+ this._trackMap.delete(propertyIdName);
713
719
  }
714
720
  }
715
721
  dispose() {
716
- this._trackMap = null;
722
+ if (this._trackMap) {
723
+ this._trackMap.clear();
724
+ }
717
725
  }
718
726
  }
719
727