ng-virtual-list 19.9.3 → 19.9.5
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/fesm2022/ng-virtual-list.mjs +45 -61
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/components/list-item/ng-virtual-list-item.component.d.ts +0 -1
- package/lib/components/scroller/ng-scroller.component.d.ts +1 -0
- package/lib/models/index.d.ts +3 -1
- package/lib/utils/track-box.d.ts +0 -2
- package/package.json +1 -1
|
@@ -599,7 +599,6 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
599
599
|
config = signal({});
|
|
600
600
|
measures = signal(undefined);
|
|
601
601
|
focused = signal(false);
|
|
602
|
-
reseted = signal(false);
|
|
603
602
|
part = signal(PART_DEFAULT_ITEM);
|
|
604
603
|
maxClickDistance = signal(DEFAULT_CLICK_DISTANCE);
|
|
605
604
|
data = signal(undefined);
|
|
@@ -683,7 +682,10 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
683
682
|
})).subscribe();
|
|
684
683
|
this.classes = computed(() => {
|
|
685
684
|
const data = this.data(), focused = this.focused();
|
|
686
|
-
return {
|
|
685
|
+
return {
|
|
686
|
+
[CLASS_NAME_SNAPPED]: data?.config?.snapped ?? false, [CLASS_NAME_SNAPPED_OUT]: data?.config?.snappedOut ?? false,
|
|
687
|
+
[CLASS_NAME_FOCUS]: focused,
|
|
688
|
+
};
|
|
687
689
|
});
|
|
688
690
|
this.index = computed(() => {
|
|
689
691
|
return this.config()?.tabIndex ?? -1;
|
|
@@ -692,7 +694,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
692
694
|
const data = this.data(), measures = this.measures(), config = this.config();
|
|
693
695
|
return {
|
|
694
696
|
data: data?.data, prevData: data?.previouseData, nextData: data?.nextData, measures,
|
|
695
|
-
config, reseted:
|
|
697
|
+
config, reseted: false, index: data?.index ?? -1
|
|
696
698
|
};
|
|
697
699
|
});
|
|
698
700
|
const $data = toObservable(this.data), $focused = toObservable(this.focused);
|
|
@@ -874,7 +876,6 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
874
876
|
return { width: width > 0 ? width : 1, height: height > 0 ? height : 1, };
|
|
875
877
|
}
|
|
876
878
|
show() {
|
|
877
|
-
this.reseted.set(false);
|
|
878
879
|
const el = this._elementRef.nativeElement, styles = el.style;
|
|
879
880
|
styles.zIndex = this._data?.config?.zIndex ?? DEFAULT_ZINDEX;
|
|
880
881
|
if (this.regular) {
|
|
@@ -891,7 +892,6 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
891
892
|
}
|
|
892
893
|
}
|
|
893
894
|
hide() {
|
|
894
|
-
this.reseted.set(true);
|
|
895
895
|
const el = this._elementRef.nativeElement, styles = el.style;
|
|
896
896
|
styles.position = POSITION_ABSOLUTE;
|
|
897
897
|
styles.transform = `${TRANSLATE_3D$1}(${this._data?.config?.isVertical ? 0 : ZEROS_POSITION},${this._data?.config?.isVertical ? 0 : ZEROS_POSITION},0)`;
|
|
@@ -1902,7 +1902,7 @@ class TrackBox extends CacheMap {
|
|
|
1902
1902
|
* Calculates list metrics
|
|
1903
1903
|
*/
|
|
1904
1904
|
recalculateMetrics(options) {
|
|
1905
|
-
const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize,
|
|
1905
|
+
const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap, itemConfigMap, enabledBufferOptimization, previousTotalSize, crudDetected, deletedItemsMap } = options, roundedScrollSize = Math.round(scrollSize);
|
|
1906
1906
|
const trackBy = this._trackingPropertyName, bufferSize = Math.max(minBufferSize, this._bufferSize), { width, height } = bounds, sizeProperty = isVertical ? HEIGHT_PROP_NAME : WIDTH_PROP_NAME, size = isVertical ? height : width, totalLength = collection.length, typicalItemSize = itemSize, w = isVertical ? width : typicalItemSize, h = isVertical ? typicalItemSize : height, map = this._map, snapshot = this._snapshot, checkOverscrollItemsLimit = Math.ceil(typicalItemSize !== 0 ? size / typicalItemSize : 0), snippedPos = Math.floor(scrollSize) + this._scrollStartOffset, leftItemsWeights = [], isFromId = fromItemId !== undefined && (typeof fromItemId === 'number' && fromItemId > -1)
|
|
1907
1907
|
|| (typeof fromItemId === 'string' && fromItemId > '-1');
|
|
1908
1908
|
let leftItemsOffset = 0, rightItemsOffset = 0;
|
|
@@ -2173,7 +2173,6 @@ class TrackBox extends CacheMap {
|
|
|
2173
2173
|
totalSize,
|
|
2174
2174
|
typicalItemSize,
|
|
2175
2175
|
isFromItemIdFound,
|
|
2176
|
-
reversed: options.reversed,
|
|
2177
2176
|
isUpdating,
|
|
2178
2177
|
};
|
|
2179
2178
|
return metrics;
|
|
@@ -2191,7 +2190,7 @@ class TrackBox extends CacheMap {
|
|
|
2191
2190
|
this.bumpVersion();
|
|
2192
2191
|
}
|
|
2193
2192
|
generateDisplayCollection(items, itemConfigMap, metrics) {
|
|
2194
|
-
const { offsetY, offsetX, width, height, normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsOnDisplayLength, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize,
|
|
2193
|
+
const { offsetY, offsetX, width, height, normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsOnDisplayLength, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize, } = metrics, displayItems = [];
|
|
2195
2194
|
if (items.length) {
|
|
2196
2195
|
const trackBy = this._trackingPropertyName, actualSnippedPosition = snippedPos, isSnappingMethodAdvanced = this.isSnappingMethodAdvanced, boundsSize = isVertical ? height : width, actualEndSnippedPosition = scrollSize + boundsSize - this._scrollEndOffset, positionOffset = isVertical ? offsetY : offsetX;
|
|
2197
2196
|
let pos = startPosition, renderItems = renderItemsLength, stickyItem, nextSticky, stickyItemIndex = -1, stickyItemSize = 0, endStickyItem, nextEndSticky, endStickyItemIndex = -1, endStickyItemSize = 0, count = 1;
|
|
@@ -2307,7 +2306,7 @@ class TrackBox extends CacheMap {
|
|
|
2307
2306
|
if (iterations > totalLength || i >= totalLength) {
|
|
2308
2307
|
break;
|
|
2309
2308
|
}
|
|
2310
|
-
const collectionItem = items[
|
|
2309
|
+
const collectionItem = items[i];
|
|
2311
2310
|
if (!collectionItem) {
|
|
2312
2311
|
continue;
|
|
2313
2312
|
}
|
|
@@ -3486,7 +3485,6 @@ class NgScrollerComponent {
|
|
|
3486
3485
|
}
|
|
3487
3486
|
stopScrolling() {
|
|
3488
3487
|
cancelAnimationFrame(this._animationId);
|
|
3489
|
-
cancelAnimationFrame(this._animationId1);
|
|
3490
3488
|
}
|
|
3491
3489
|
move(isVertical, position, blending = false, userAction = false) {
|
|
3492
3490
|
this.scrollTo({ [isVertical ? TOP : LEFT]: position, behavior: INSTANT, blending, userAction });
|
|
@@ -3538,7 +3536,6 @@ class NgScrollerComponent {
|
|
|
3538
3536
|
prevPos = currentValue;
|
|
3539
3537
|
const scrollContent = this.scrollContent()?.nativeElement;
|
|
3540
3538
|
if (scrollContent) {
|
|
3541
|
-
cancelAnimationFrame(this._animationId1);
|
|
3542
3539
|
if (isVertical) {
|
|
3543
3540
|
this.y = currentValue;
|
|
3544
3541
|
scrollContent.style.transform = `translate3d(0, ${-currentValue}px, 0)`;
|
|
@@ -3570,7 +3567,7 @@ class NgScrollerComponent {
|
|
|
3570
3567
|
this._$updateScrollBar.next();
|
|
3571
3568
|
}
|
|
3572
3569
|
scrollTo(params) {
|
|
3573
|
-
const posX = params.x || params.left || 0, posY = params.y || params.top || 0, userAction = params.userAction ?? false, x = posX, y = posY, behavior = params.behavior ?? INSTANT, blending = params.blending ?? true, scrollContent = this.scrollContent()?.nativeElement, isVertical = this.direction() === ScrollerDirection.VERTICAL;
|
|
3570
|
+
const posX = params.x || params.left || 0, posY = params.y || params.top || 0, userAction = params.userAction ?? false, x = posX, y = posY, fireUpdate = params.fireUpdate ?? true, behavior = params.behavior ?? INSTANT, blending = params.blending ?? true, scrollContent = this.scrollContent()?.nativeElement, isVertical = this.direction() === ScrollerDirection.VERTICAL;
|
|
3574
3571
|
if (this._isMoving) {
|
|
3575
3572
|
if (isVertical) {
|
|
3576
3573
|
if (y < 0 || y > this.scrollHeight) {
|
|
@@ -3608,7 +3605,9 @@ class NgScrollerComponent {
|
|
|
3608
3605
|
if (this.cdkScrollable) {
|
|
3609
3606
|
this.cdkScrollable.getElementRef().nativeElement.dispatchEvent(SCROLL_EVENT);
|
|
3610
3607
|
}
|
|
3611
|
-
|
|
3608
|
+
if (fireUpdate) {
|
|
3609
|
+
this.fireScrollEvent(userAction);
|
|
3610
|
+
}
|
|
3612
3611
|
}
|
|
3613
3612
|
}
|
|
3614
3613
|
else {
|
|
@@ -3620,16 +3619,15 @@ class NgScrollerComponent {
|
|
|
3620
3619
|
if (this.cdkScrollable) {
|
|
3621
3620
|
this.cdkScrollable.getElementRef().nativeElement.dispatchEvent(SCROLL_EVENT);
|
|
3622
3621
|
}
|
|
3623
|
-
|
|
3622
|
+
if (fireUpdate) {
|
|
3623
|
+
this.fireScrollEvent(userAction);
|
|
3624
|
+
}
|
|
3624
3625
|
}
|
|
3625
3626
|
}
|
|
3626
3627
|
}
|
|
3627
3628
|
}
|
|
3628
3629
|
fireScrollEvent(userAction) {
|
|
3629
|
-
|
|
3630
|
-
this._animationId1 = requestAnimationFrame(() => {
|
|
3631
|
-
this._$scroll.next(userAction);
|
|
3632
|
-
});
|
|
3630
|
+
this._$scroll.next(userAction);
|
|
3633
3631
|
}
|
|
3634
3632
|
reset() {
|
|
3635
3633
|
if (this.scrollBar) {
|
|
@@ -3664,11 +3662,11 @@ class NgScrollerComponent {
|
|
|
3664
3662
|
}
|
|
3665
3663
|
}
|
|
3666
3664
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: NgScrollerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3667
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.19", type: NgScrollerComponent, isStandalone: true, selector: "ng-scroller", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, focusedElement: { classPropertyName: "focusedElement", publicName: "focusedElement", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null }, startOffset: { classPropertyName: "startOffset", publicName: "startOffset", isSignal: true, isRequired: false, transformFunction: null }, endOffset: { classPropertyName: "endOffset", publicName: "endOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollbarTheme: { classPropertyName: "scrollbarTheme", publicName: "scrollbarTheme", isSignal: true, isRequired: false, transformFunction: null }, scrollbarMinSize: { classPropertyName: "scrollbarMinSize", publicName: "scrollbarMinSize", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "scrollContent", first: true, predicate: ["scrollContent"], descendants: true, isSignal: true }, { propertyName: "scrollViewport", first: true, predicate: ["scrollViewport"], descendants: true, isSignal: true }, { propertyName: "cdkScrollable", first: true, predicate: ["scrollViewport"], descendants: true, read: CdkScrollable }, { propertyName: "scrollBar", first: true, predicate: ["scrollBar"], descendants: true, read: NgScrollBarComponent }], ngImport: i0, template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\" [ngClass]=\"containerClasses()\">\r\n <div #scrollViewport cdkScrollable part=\"scroller\" class=\"ngvl__scroller\">\r\n <div #scrollContent [attr.aria-orientation]=\"direction()\" [attr.aria-activedescendant]=\"focusedElement()\"\r\n tabindex=\"0\" part=\"list\" class=\"ngvl__list\" [ngClass]=\"actualClasses()\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n <ng-scroll-bar #scrollBar [isVertical]=\"isVertical()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\" [position]=\"thumbPosition()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"preparedSignal()\" [show]=\"thumbShow()\"\r\n (onDrag)=\"onScrollBarDragHandler($event)\"></ng-scroll-bar>\r\n</div>", styles: [":host{position:relative;overflow:hidden;-webkit-user-select:none;user-select:none}.ngvl__container{position:relative;overflow:hidden;display:grid;width:100%;height:100%;cursor:grab}.ngvl__container.grabbing{cursor:grabbing}.ngvl__container.horizontal{grid-template-rows:1fr auto}.ngvl__container.horizontal .ngvl__list{display:inline-flex}.ngvl__container.horizontal .ngvl__scroller{overflow:hidden}.ngvl__container.vertical{grid-template-columns:1fr auto}.ngvl__container.vertical .ngvl__scroller{overflow:hidden}.ngvl__scroller{display:block;position:relative;overflow:hidden;width:100%;height:100%}.ngvl__list{position:absolute;list-style:none;padding:0;margin:0;width:100%;height:100
|
|
3665
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.19", type: NgScrollerComponent, isStandalone: true, selector: "ng-scroller", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, focusedElement: { classPropertyName: "focusedElement", publicName: "focusedElement", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null }, startOffset: { classPropertyName: "startOffset", publicName: "startOffset", isSignal: true, isRequired: false, transformFunction: null }, endOffset: { classPropertyName: "endOffset", publicName: "endOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollbarTheme: { classPropertyName: "scrollbarTheme", publicName: "scrollbarTheme", isSignal: true, isRequired: false, transformFunction: null }, scrollbarMinSize: { classPropertyName: "scrollbarMinSize", publicName: "scrollbarMinSize", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "scrollContent", first: true, predicate: ["scrollContent"], descendants: true, isSignal: true }, { propertyName: "scrollViewport", first: true, predicate: ["scrollViewport"], descendants: true, isSignal: true }, { propertyName: "cdkScrollable", first: true, predicate: ["scrollViewport"], descendants: true, read: CdkScrollable }, { propertyName: "scrollBar", first: true, predicate: ["scrollBar"], descendants: true, read: NgScrollBarComponent }], ngImport: i0, template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\" [ngClass]=\"containerClasses()\">\r\n <div #scrollViewport cdkScrollable part=\"scroller\" class=\"ngvl__scroller\">\r\n <div #scrollContent [attr.aria-orientation]=\"direction()\" [attr.aria-activedescendant]=\"focusedElement()\"\r\n tabindex=\"0\" part=\"list\" class=\"ngvl__list\" [ngClass]=\"actualClasses()\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n <ng-scroll-bar #scrollBar [isVertical]=\"isVertical()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\" [position]=\"thumbPosition()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"preparedSignal()\" [show]=\"thumbShow()\"\r\n (onDrag)=\"onScrollBarDragHandler($event)\"></ng-scroll-bar>\r\n</div>", styles: [":host{position:relative;overflow:hidden;-webkit-user-select:none;user-select:none}.ngvl__container{position:relative;overflow:hidden;display:grid;width:100%;height:100%;cursor:grab}.ngvl__container.grabbing{cursor:grabbing}.ngvl__container.horizontal{grid-template-rows:1fr auto}.ngvl__container.horizontal .ngvl__list{display:inline-flex}.ngvl__container.horizontal .ngvl__scroller{overflow:hidden}.ngvl__container.vertical{grid-template-columns:1fr auto}.ngvl__container.vertical .ngvl__scroller{overflow:hidden}.ngvl__scroller{display:block;position:relative;overflow:hidden;width:100%;height:100%}.ngvl__list{position:absolute;list-style:none;padding:0;margin:0;width:100%;height:100%}.ngvl__list.prepared{overflow:hidden}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { kind: "directive", type: LocaleSensitiveDirective, selector: "[localeSensitive]", inputs: ["langTextDir", "listDir"] }, { kind: "component", type: NgScrollBarComponent, selector: "ng-scroll-bar", inputs: ["loading", "isVertical", "position", "thumbGradientPositions", "size", "theme", "prepared", "show"], outputs: ["onDrag"] }] });
|
|
3668
3666
|
}
|
|
3669
3667
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: NgScrollerComponent, decorators: [{
|
|
3670
3668
|
type: Component,
|
|
3671
|
-
args: [{ selector: 'ng-scroller', imports: [CommonModule, CdkScrollable, LocaleSensitiveDirective, NgScrollBarComponent], template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\" [ngClass]=\"containerClasses()\">\r\n <div #scrollViewport cdkScrollable part=\"scroller\" class=\"ngvl__scroller\">\r\n <div #scrollContent [attr.aria-orientation]=\"direction()\" [attr.aria-activedescendant]=\"focusedElement()\"\r\n tabindex=\"0\" part=\"list\" class=\"ngvl__list\" [ngClass]=\"actualClasses()\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n <ng-scroll-bar #scrollBar [isVertical]=\"isVertical()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\" [position]=\"thumbPosition()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"preparedSignal()\" [show]=\"thumbShow()\"\r\n (onDrag)=\"onScrollBarDragHandler($event)\"></ng-scroll-bar>\r\n</div>", styles: [":host{position:relative;overflow:hidden;-webkit-user-select:none;user-select:none}.ngvl__container{position:relative;overflow:hidden;display:grid;width:100%;height:100%;cursor:grab}.ngvl__container.grabbing{cursor:grabbing}.ngvl__container.horizontal{grid-template-rows:1fr auto}.ngvl__container.horizontal .ngvl__list{display:inline-flex}.ngvl__container.horizontal .ngvl__scroller{overflow:hidden}.ngvl__container.vertical{grid-template-columns:1fr auto}.ngvl__container.vertical .ngvl__scroller{overflow:hidden}.ngvl__scroller{display:block;position:relative;overflow:hidden;width:100%;height:100%}.ngvl__list{position:absolute;list-style:none;padding:0;margin:0;width:100%;height:100
|
|
3669
|
+
args: [{ selector: 'ng-scroller', imports: [CommonModule, CdkScrollable, LocaleSensitiveDirective, NgScrollBarComponent], template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\" [ngClass]=\"containerClasses()\">\r\n <div #scrollViewport cdkScrollable part=\"scroller\" class=\"ngvl__scroller\">\r\n <div #scrollContent [attr.aria-orientation]=\"direction()\" [attr.aria-activedescendant]=\"focusedElement()\"\r\n tabindex=\"0\" part=\"list\" class=\"ngvl__list\" [ngClass]=\"actualClasses()\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n <ng-scroll-bar #scrollBar [isVertical]=\"isVertical()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\" [position]=\"thumbPosition()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"preparedSignal()\" [show]=\"thumbShow()\"\r\n (onDrag)=\"onScrollBarDragHandler($event)\"></ng-scroll-bar>\r\n</div>", styles: [":host{position:relative;overflow:hidden;-webkit-user-select:none;user-select:none}.ngvl__container{position:relative;overflow:hidden;display:grid;width:100%;height:100%;cursor:grab}.ngvl__container.grabbing{cursor:grabbing}.ngvl__container.horizontal{grid-template-rows:1fr auto}.ngvl__container.horizontal .ngvl__list{display:inline-flex}.ngvl__container.horizontal .ngvl__scroller{overflow:hidden}.ngvl__container.vertical{grid-template-columns:1fr auto}.ngvl__container.vertical .ngvl__scroller{overflow:hidden}.ngvl__scroller{display:block;position:relative;overflow:hidden;width:100%;height:100%}.ngvl__list{position:absolute;list-style:none;padding:0;margin:0;width:100%;height:100%}.ngvl__list.prepared{overflow:hidden}\n"] }]
|
|
3672
3670
|
}], ctorParameters: () => [], propDecorators: { cdkScrollable: [{
|
|
3673
3671
|
type: ViewChild,
|
|
3674
3672
|
args: ['scrollViewport', { read: CdkScrollable }]
|
|
@@ -4517,27 +4515,27 @@ class NgVirtualListComponent {
|
|
|
4517
4515
|
});
|
|
4518
4516
|
let prepared = false, readyToStart = false, isUserScrolling = false;
|
|
4519
4517
|
this.$prepared.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(v => {
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4518
|
+
if (!v) {
|
|
4519
|
+
this.cacheClean();
|
|
4520
|
+
readyToStart = isUserScrolling = false;
|
|
4521
|
+
prepared = readyToStart = v;
|
|
4522
|
+
const waitForPreparation = this.waitForPreparation();
|
|
4523
|
+
if (waitForPreparation) {
|
|
4524
4524
|
const scrollerComponent = this._scrollerComponent();
|
|
4525
4525
|
if (scrollerComponent) {
|
|
4526
4526
|
scrollerComponent.prepared = v;
|
|
4527
4527
|
}
|
|
4528
4528
|
this.classes.set({ prepared: v, [WAIT_FOR_PREPARATION]: waitForPreparation });
|
|
4529
|
-
this.cacheClean();
|
|
4530
4529
|
}
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4530
|
+
else {
|
|
4531
|
+
const scrollerComponent = this._scrollerComponent();
|
|
4532
|
+
if (scrollerComponent) {
|
|
4533
|
+
scrollerComponent.prepared = true;
|
|
4534
|
+
}
|
|
4535
|
+
this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: waitForPreparation });
|
|
4537
4536
|
}
|
|
4538
|
-
this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: waitForPreparation });
|
|
4539
4537
|
}
|
|
4540
|
-
}), filter$1(v => !!v),
|
|
4538
|
+
}), filter$1(v => !!v), delay(0), takeUntilDestroyed(this._destroyRef), tap(v => {
|
|
4541
4539
|
prepared = v;
|
|
4542
4540
|
}), delay(0), takeUntilDestroyed(this._destroyRef), tap(v => {
|
|
4543
4541
|
const waitForPreparation = this.waitForPreparation(), scrollerComponent = this._scrollerComponent(), val = v || !waitForPreparation;
|
|
@@ -4696,14 +4694,12 @@ class NgVirtualListComponent {
|
|
|
4696
4694
|
const { width, height, x, y } = bounds, viewportSize = (isVertical ? height : width);
|
|
4697
4695
|
let scrollLength = Math.round(this._totalSize()) ?? 0, actualScrollLength = Math.round(scrollLength === 0 ? 0 : scrollLength > viewportSize ? scrollLength - viewportSize : scrollLength), roundedMaxPosition = Math.round(actualScrollLength), scrollPosition = Math.round(actualScrollSize);
|
|
4698
4696
|
const opts = {
|
|
4699
|
-
bounds: { width, height, x, y }, dynamicSize, isVertical, itemSize,
|
|
4697
|
+
bounds: { width, height, x, y }, dynamicSize, isVertical, itemSize,
|
|
4700
4698
|
bufferSize, maxBufferSize, scrollSize: actualScrollSize, snap, enabledBufferOptimization,
|
|
4701
4699
|
};
|
|
4702
|
-
if (snapScrollToBottom &&
|
|
4703
|
-
const { totalSize: calculatedTotalSize } = this._trackBox.getMetrics(items, itemConfigMap, { ...opts, reversed: true });
|
|
4704
|
-
totalSize = calculatedTotalSize;
|
|
4700
|
+
if (snapScrollToBottom && !prepared) {
|
|
4705
4701
|
actualScrollSize = (totalSize > viewportSize ? totalSize - viewportSize : 0);
|
|
4706
|
-
const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize1 } = this._trackBox.updateCollection(items, itemConfigMap, { ...opts,
|
|
4702
|
+
const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize1 } = this._trackBox.updateCollection(items, itemConfigMap, { ...opts, scrollSize: actualScrollSize });
|
|
4707
4703
|
displayItems = calculatedDisplayItems;
|
|
4708
4704
|
totalSize = calculatedTotalSize1;
|
|
4709
4705
|
scrollLength = Math.round(totalSize) ?? 0;
|
|
@@ -4750,6 +4746,7 @@ class NgVirtualListComponent {
|
|
|
4750
4746
|
if (roundedMaxPositionAfterUpdate > 0) {
|
|
4751
4747
|
const diff = roundedMaxPositionAfterUpdate - roundedScrollPositionAfterUpdate, snapToEndTransitionInstantOffset = this.snapToEndTransitionInstantOffset() || viewportSize, animated = prepared && readyToStart && diff >= 0 && diff <= snapToEndTransitionInstantOffset, params = {
|
|
4752
4748
|
[isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
|
|
4749
|
+
fireUpdate: false,
|
|
4753
4750
|
behavior: (animated ?
|
|
4754
4751
|
BEHAVIOR_SMOOTH : BEHAVIOR_INSTANT),
|
|
4755
4752
|
blending: true,
|
|
@@ -4759,8 +4756,8 @@ class NgVirtualListComponent {
|
|
|
4759
4756
|
}
|
|
4760
4757
|
else if (roundedActualScrollSize !== roundedScrollPositionAfterUpdate && scrollPositionAfterUpdate > 0) {
|
|
4761
4758
|
const params = {
|
|
4762
|
-
[isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate,
|
|
4763
|
-
behavior: BEHAVIOR_INSTANT,
|
|
4759
|
+
[isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: true,
|
|
4760
|
+
fireUpdate: false, behavior: BEHAVIOR_INSTANT,
|
|
4764
4761
|
};
|
|
4765
4762
|
scroller.scrollTo(params);
|
|
4766
4763
|
}
|
|
@@ -4769,25 +4766,10 @@ class NgVirtualListComponent {
|
|
|
4769
4766
|
combineLatest([$snapScrollToBottom, $bounds, $listBounds, $scrollEndOffset, $actualItems, $itemConfigMap, $scrollSize, $itemSize,
|
|
4770
4767
|
$bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion, this.$userScroll,
|
|
4771
4768
|
]).pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(([snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
}
|
|
4777
|
-
if (!prepared || !isResetedReachStart) {
|
|
4778
|
-
update({
|
|
4779
|
-
snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
|
|
4780
|
-
bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
|
|
4781
|
-
});
|
|
4782
|
-
}
|
|
4783
|
-
else {
|
|
4784
|
-
this._updateId = requestAnimationFrame((time) => {
|
|
4785
|
-
update({
|
|
4786
|
-
snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
|
|
4787
|
-
bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
|
|
4788
|
-
});
|
|
4789
|
-
});
|
|
4790
|
-
}
|
|
4769
|
+
update({
|
|
4770
|
+
snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
|
|
4771
|
+
bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
|
|
4772
|
+
});
|
|
4791
4773
|
})).subscribe();
|
|
4792
4774
|
const $scroller = toObservable(this._scroller).pipe(takeUntilDestroyed(), filter$1(v => !!v), map(v => v.nativeElement), take(1)), $scrollerScroll = toObservable(this._scrollerComponent).pipe(takeUntilDestroyed(), filter$1(v => !!v), take(1), switchMap$1(scroller => scroller.$scroll)), $scrollerScrollEnd = toObservable(this._scrollerComponent).pipe(takeUntilDestroyed(), filter$1(v => !!v), take(1), switchMap$1(scroller => scroller.$scrollEnd)), $list = toObservable(this._list).pipe(takeUntilDestroyed(), filter$1(v => !!v), map(v => v.nativeElement), take(1));
|
|
4793
4775
|
$scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), switchMap$1(scroller => {
|
|
@@ -4922,11 +4904,12 @@ class NgVirtualListComponent {
|
|
|
4922
4904
|
if (dynamicSize) {
|
|
4923
4905
|
const { width, height, x, y } = this._bounds() || { x: 0, y: 0, width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, itemConfigMap = this.itemConfigMap(), items = this._actualItems(), isVertical = this._isVertical, currentScollSize = (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft), delta = this._trackBox.delta, opts = {
|
|
4924
4906
|
bounds: { width, height, x, y }, collection: items, dynamicSize, isVertical: this._isVertical, itemSize,
|
|
4925
|
-
bufferSize: this.bufferSize(), maxBufferSize: this.maxBufferSize(),
|
|
4907
|
+
bufferSize: this.bufferSize(), maxBufferSize: this.maxBufferSize(),
|
|
4926
4908
|
scrollSize: (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft) + delta,
|
|
4927
4909
|
snap: this.snap(), fromItemId: id, enabledBufferOptimization: this.enabledBufferOptimization(),
|
|
4928
4910
|
}, scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, opts), params = {
|
|
4929
4911
|
[isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, behavior: BEHAVIOR_INSTANT,
|
|
4912
|
+
fireUpdate: false,
|
|
4930
4913
|
blending: true,
|
|
4931
4914
|
};
|
|
4932
4915
|
if (scrollSize === -1) {
|
|
@@ -4953,7 +4936,7 @@ class NgVirtualListComponent {
|
|
|
4953
4936
|
if ((!notChanged && iteration < MAX_SCROLL_TO_ITERATIONS) || iteration < MAX_SCROLL_TO_ITERATIONS) {
|
|
4954
4937
|
this._$scrollTo.next(params);
|
|
4955
4938
|
return of([false, {
|
|
4956
|
-
id,
|
|
4939
|
+
id, scroller: scrollerComponent, iteration: iteration + 1,
|
|
4957
4940
|
isLastIteration: notChanged, scrollCalled: true, cb
|
|
4958
4941
|
}]).pipe(delay(1));
|
|
4959
4942
|
}
|
|
@@ -5221,6 +5204,7 @@ class NgVirtualListComponent {
|
|
|
5221
5204
|
if (scrollerComponent) {
|
|
5222
5205
|
scrollerComponent.reset();
|
|
5223
5206
|
}
|
|
5207
|
+
this._$prepared.next(false);
|
|
5224
5208
|
}
|
|
5225
5209
|
stopSnappingScrollToEnd() {
|
|
5226
5210
|
const scroller = this._scrollerComponent();
|