ng-virtual-list 14.4.2 → 14.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/README.md +1 -1
- package/esm2020/lib/utils/tracker.mjs +18 -9
- package/esm2022/lib/components/ng-virtual-list-item.component.mjs +132 -0
- package/esm2022/lib/const/index.mjs +44 -0
- package/esm2022/lib/enums/direction.mjs +2 -0
- package/esm2022/lib/enums/directions.mjs +18 -0
- package/esm2022/lib/enums/index.mjs +4 -0
- package/esm2022/lib/enums/snapping-method.mjs +2 -0
- package/esm2022/lib/enums/snapping-methods.mjs +18 -0
- package/esm2022/lib/models/base-virtual-list-item-component.mjs +9 -0
- package/esm2022/lib/models/collection.model.mjs +3 -0
- package/esm2022/lib/models/component.model.mjs +2 -0
- package/esm2022/lib/models/index.mjs +2 -0
- package/esm2022/lib/models/item.model.mjs +2 -0
- package/esm2022/lib/models/render-collection.model.mjs +3 -0
- package/esm2022/lib/models/render-item-config.model.mjs +2 -0
- package/esm2022/lib/models/render-item.model.mjs +3 -0
- package/esm2022/lib/models/scroll-direction.model.mjs +2 -0
- package/esm2022/lib/models/scroll-event.model.mjs +2 -0
- package/esm2022/lib/models/sticky-map.model.mjs +2 -0
- package/esm2022/lib/ng-virtual-list.component.mjs +535 -0
- package/esm2022/lib/ng-virtual-list.module.mjs +20 -0
- package/esm2022/lib/types/id.mjs +2 -0
- package/esm2022/lib/types/index.mjs +2 -0
- package/esm2022/lib/types/rect.mjs +2 -0
- package/esm2022/lib/types/size.mjs +2 -0
- package/esm2022/lib/utils/browser.mjs +3 -0
- package/esm2022/lib/utils/buffer-interpolation.mjs +27 -0
- package/esm2022/lib/utils/cacheMap.mjs +168 -0
- package/esm2022/lib/utils/debounce.mjs +31 -0
- package/esm2022/lib/utils/eventEmitter.mjs +105 -0
- package/esm2022/lib/utils/index.mjs +5 -0
- package/esm2022/lib/utils/isDirection.mjs +15 -0
- package/esm2022/lib/utils/scrollEvent.mjs +42 -0
- package/esm2022/lib/utils/snapping-method.mjs +9 -0
- package/esm2022/lib/utils/toggleClassName.mjs +15 -0
- package/esm2022/lib/utils/trackBox.mjs +762 -0
- package/esm2022/lib/utils/tracker.mjs +135 -0
- package/esm2022/ng-virtual-list.mjs +5 -0
- package/esm2022/public-api.mjs +11 -0
- 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 +2055 -0
- package/fesm2022/ng-virtual-list.mjs.map +1 -0
- package/lib/utils/tracker.d.ts +3 -7
- package/package.json +1 -1
|
@@ -591,7 +591,7 @@ class Tracker {
|
|
|
591
591
|
/**
|
|
592
592
|
* Dictionary displayItems propertyNameId by items propertyNameId
|
|
593
593
|
*/
|
|
594
|
-
this._trackMap =
|
|
594
|
+
this._trackMap = new CMap();
|
|
595
595
|
this._trackingPropertyName = trackingPropertyName;
|
|
596
596
|
}
|
|
597
597
|
set displayObjectIndexMapById(v) {
|
|
@@ -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
|
|