ng-virtual-list 20.10.2 → 20.10.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.
- package/README.md +3 -3
- package/fesm2022/ng-virtual-list.mjs +107 -51
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/index.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -740,9 +740,9 @@ Properties
|
|
|
740
740
|
| 19.x | 19.10.0 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.10.0](https://www.npmjs.com/package/ng-virtual-list/v/19.10.0) |
|
|
741
741
|
| 18.x | 18.10.0 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.10.0](https://www.npmjs.com/package/ng-virtual-list/v/18.10.0) |
|
|
742
742
|
| 17.x | 17.10.0 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.10.0](https://www.npmjs.com/package/ng-virtual-list/v/17.10.0) |
|
|
743
|
-
| 16.x | 16.
|
|
744
|
-
| 15.x | 15.
|
|
745
|
-
| 14.x | 14.
|
|
743
|
+
| 16.x | 16.9.6 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.9.6](https://www.npmjs.com/package/ng-virtual-list/v/16.9.6) |
|
|
744
|
+
| 15.x | 15.9.6 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.9.6](https://www.npmjs.com/package/ng-virtual-list/v/15.9.6) |
|
|
745
|
+
| 14.x | 14.9.6 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.9.6](https://www.npmjs.com/package/ng-virtual-list/v/14.9.6) |
|
|
746
746
|
|
|
747
747
|
<br/>
|
|
748
748
|
|
|
@@ -3444,8 +3444,9 @@ class NgScrollView {
|
|
|
3444
3444
|
this._$scroll.next(userAction);
|
|
3445
3445
|
}
|
|
3446
3446
|
onDragStart() { }
|
|
3447
|
-
reset() {
|
|
3448
|
-
this.
|
|
3447
|
+
reset(offset = 0) {
|
|
3448
|
+
this.stopScrolling();
|
|
3449
|
+
this.move(this.isVertical(), offset);
|
|
3449
3450
|
}
|
|
3450
3451
|
ngOnDestroy() {
|
|
3451
3452
|
if (this._animator) {
|
|
@@ -3811,11 +3812,13 @@ class NgScrollerComponent extends NgScrollView {
|
|
|
3811
3812
|
this.updateScrollBar();
|
|
3812
3813
|
}
|
|
3813
3814
|
reset() {
|
|
3814
|
-
super.reset();
|
|
3815
|
+
super.reset(this.startOffset());
|
|
3816
|
+
this.totalSize = 0;
|
|
3815
3817
|
if (this.scrollBar) {
|
|
3816
3818
|
this.scrollBar.stopScrolling();
|
|
3817
3819
|
}
|
|
3818
|
-
this.
|
|
3820
|
+
this.refresh(true, true);
|
|
3821
|
+
this.prepared = false;
|
|
3819
3822
|
}
|
|
3820
3823
|
refresh(fireUpdate = false, updateScrollbar = true) {
|
|
3821
3824
|
this.scrollLimits();
|
|
@@ -3880,19 +3883,19 @@ class NgScrollerComponent extends NgScrollView {
|
|
|
3880
3883
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: NgScrollerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3881
3884
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.17", type: NgScrollerComponent, isStandalone: true, selector: "ng-scroller", inputs: { scrollbarEnabled: { classPropertyName: "scrollbarEnabled", publicName: "scrollbarEnabled", isSignal: true, isRequired: false, transformFunction: null }, scrollbarInteractive: { classPropertyName: "scrollbarInteractive", publicName: "scrollbarInteractive", 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 } }, providers: [
|
|
3882
3885
|
{ provide: SCROLL_VIEW_INVERSION, useValue: false },
|
|
3883
|
-
], viewQueries: [{ propertyName: "scrollBar", first: true, predicate: ["scrollBar"], descendants: true, read: NgScrollBarComponent }], usesInheritance: true, ngImport: i0, template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\"\r\n [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 @let prepared = preparedSignal();\r\n <ng-scroll-bar #scrollBar [direction]=\"direction()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"prepared\"\r\n [interactive]=\"scrollbarInteractive()\" [show]=\"scrollbarShow() && scrollbarEnabled() && prepared\"\r\n [startOffset]=\"startOffset()\" [endOffset]=\"endOffset()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollBehavior]=\"scrollBehavior()\" [scrollbarMinSize]=\"scrollbarMinSize()\"\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 0;transition:grid-template-rows .1s ease-out}.ngvl__container.horizontal.scrollable.enabled{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 0;transition:grid-template-columns .1s ease-out}.ngvl__container.vertical.scrollable.enabled{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%;opacity:0}.ngvl__list.prepared{opacity:1;overflow:hidden}
|
|
3886
|
+
], viewQueries: [{ propertyName: "scrollBar", first: true, predicate: ["scrollBar"], descendants: true, read: NgScrollBarComponent }], usesInheritance: true, ngImport: i0, template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\"\r\n [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 @let prepared = preparedSignal();\r\n <ng-scroll-bar #scrollBar [direction]=\"direction()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"prepared\"\r\n [interactive]=\"scrollbarInteractive()\" [show]=\"scrollbarShow() && scrollbarEnabled() && prepared\"\r\n [startOffset]=\"startOffset()\" [endOffset]=\"endOffset()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollBehavior]=\"scrollBehavior()\" [scrollbarMinSize]=\"scrollbarMinSize()\"\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 0;transition:grid-template-rows .1s ease-out}.ngvl__container.horizontal.scrollable.enabled{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 0;transition:grid-template-columns .1s ease-out}.ngvl__container.vertical.scrollable.enabled{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%;opacity:0}.ngvl__list.prepared{opacity:1;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", "thumbGradientPositions", "size", "theme", "startOffset", "endOffset", "scrollbarMinSize", "prepared", "interactive", "show"], outputs: ["onDrag"] }] });
|
|
3884
3887
|
}
|
|
3885
3888
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: NgScrollerComponent, decorators: [{
|
|
3886
3889
|
type: Component,
|
|
3887
3890
|
args: [{ selector: 'ng-scroller', imports: [CommonModule, CdkScrollable, LocaleSensitiveDirective, NgScrollBarComponent], providers: [
|
|
3888
3891
|
{ provide: SCROLL_VIEW_INVERSION, useValue: false },
|
|
3889
|
-
], schemas: [NO_ERRORS_SCHEMA], template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\"\r\n [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 @let prepared = preparedSignal();\r\n <ng-scroll-bar #scrollBar [direction]=\"direction()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"prepared\"\r\n [interactive]=\"scrollbarInteractive()\" [show]=\"scrollbarShow() && scrollbarEnabled() && prepared\"\r\n [startOffset]=\"startOffset()\" [endOffset]=\"endOffset()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollBehavior]=\"scrollBehavior()\" [scrollbarMinSize]=\"scrollbarMinSize()\"\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 0;transition:grid-template-rows .1s ease-out}.ngvl__container.horizontal.scrollable.enabled{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 0;transition:grid-template-columns .1s ease-out}.ngvl__container.vertical.scrollable.enabled{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%;opacity:0}.ngvl__list.prepared{opacity:1;overflow:hidden}
|
|
3892
|
+
], schemas: [NO_ERRORS_SCHEMA], template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\"\r\n [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 @let prepared = preparedSignal();\r\n <ng-scroll-bar #scrollBar [direction]=\"direction()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"prepared\"\r\n [interactive]=\"scrollbarInteractive()\" [show]=\"scrollbarShow() && scrollbarEnabled() && prepared\"\r\n [startOffset]=\"startOffset()\" [endOffset]=\"endOffset()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollBehavior]=\"scrollBehavior()\" [scrollbarMinSize]=\"scrollbarMinSize()\"\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 0;transition:grid-template-rows .1s ease-out}.ngvl__container.horizontal.scrollable.enabled{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 0;transition:grid-template-columns .1s ease-out}.ngvl__container.vertical.scrollable.enabled{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%;opacity:0}.ngvl__list.prepared{opacity:1;overflow:hidden}\n"] }]
|
|
3890
3893
|
}], ctorParameters: () => [], propDecorators: { scrollBar: [{
|
|
3891
3894
|
type: ViewChild,
|
|
3892
3895
|
args: ['scrollBar', { read: NgScrollBarComponent }]
|
|
3893
3896
|
}], scrollbarEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollbarEnabled", required: false }] }], scrollbarInteractive: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollbarInteractive", required: false }] }], focusedElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusedElement", required: false }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], classes: [{ type: i0.Input, args: [{ isSignal: true, alias: "classes", required: false }] }], startOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "startOffset", required: false }] }], endOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "endOffset", required: false }] }], scrollbarTheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollbarTheme", required: false }] }], scrollbarMinSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollbarMinSize", required: false }] }] } });
|
|
3894
3897
|
|
|
3895
|
-
const MIN_SCROLL_TO_START_PIXELS = 10, RANGE_DISPLAY_ITEMS_END_OFFSET = 20, ROLE_LIST = 'list', ROLE_LIST_BOX = 'listbox', ITEM_ID = 'item-id', ITEM_CONTAINER = 'ngvl-item__container', READY_TO_START = 'ready-to-start', WAIT_FOR_PREPARATION = 'wait-for-preparation'
|
|
3898
|
+
const MIN_SCROLL_TO_START_PIXELS = 10, RANGE_DISPLAY_ITEMS_END_OFFSET = 20, DEFAULT_INIT_ITERATIONS = 30, ROLE_LIST = 'list', ROLE_LIST_BOX = 'listbox', ITEM_ID = 'item-id', ITEM_CONTAINER = 'ngvl-item__container', READY_TO_START = 'ready-to-start', WAIT_FOR_PREPARATION = 'wait-for-preparation';
|
|
3896
3899
|
const validateScrollIteration = (value) => {
|
|
3897
3900
|
return Number.isNaN(value) || (value < 0) ? 0 : value > MAX_SCROLL_TO_ITERATIONS ? MAX_SCROLL_TO_ITERATIONS : value;
|
|
3898
3901
|
}, validateId = (id) => {
|
|
@@ -4010,6 +4013,8 @@ class NgVirtualListComponent {
|
|
|
4010
4013
|
* Fires when the scroll reaches the end.
|
|
4011
4014
|
*/
|
|
4012
4015
|
onScrollReachEnd = output();
|
|
4016
|
+
_$show = new BehaviorSubject$1(false);
|
|
4017
|
+
$show = this._$show.asObservable();
|
|
4013
4018
|
_scrollbarTheme = {
|
|
4014
4019
|
transform: (v) => {
|
|
4015
4020
|
const valid = validateObject(v);
|
|
@@ -4769,7 +4774,9 @@ class NgVirtualListComponent {
|
|
|
4769
4774
|
}
|
|
4770
4775
|
}
|
|
4771
4776
|
};
|
|
4777
|
+
_$updateIteration = new BehaviorSubject$1(0);
|
|
4772
4778
|
_onPreparedHandler = (v) => {
|
|
4779
|
+
this._$updateIteration.next(0);
|
|
4773
4780
|
this._$prepared.next(v);
|
|
4774
4781
|
};
|
|
4775
4782
|
_destroyRef = inject(DestroyRef);
|
|
@@ -4810,50 +4817,92 @@ class NgVirtualListComponent {
|
|
|
4810
4817
|
this._service.clickDistance = dist;
|
|
4811
4818
|
});
|
|
4812
4819
|
let prepared = false, readyToStart = false, isUserScrolling = false;
|
|
4813
|
-
const $updateComplete = this.$update.pipe(takeUntilDestroyed(),
|
|
4814
|
-
|
|
4815
|
-
|
|
4820
|
+
const $updateComplete = this.$update.pipe(takeUntilDestroyed(), switchMap$1(() => {
|
|
4821
|
+
this._$updateIteration.next(this._$updateIteration.getValue() + 1);
|
|
4822
|
+
const iterations = Math.min(DEFAULT_INIT_ITERATIONS, this.items().length || 1);
|
|
4823
|
+
if (this._$updateIteration.getValue() <= iterations) {
|
|
4824
|
+
const scroller = this._scrollerComponent();
|
|
4825
|
+
if (!!scroller) {
|
|
4826
|
+
const isVerrtical = this._isVertical, actualScrollSize = isVerrtical ? (scroller?.actualScrollHeight ?? 0) : (scroller?.actualScrollWidth ?? 0), params = {
|
|
4827
|
+
[isVerrtical ? TOP_PROP_NAME : LEFT_PROP_NAME]: actualScrollSize,
|
|
4828
|
+
blending: false, fireUpdate: true, userAction: false, behavior: BEHAVIOR_INSTANT,
|
|
4829
|
+
};
|
|
4830
|
+
scroller.stopScrolling();
|
|
4831
|
+
scroller.scrollTo(params);
|
|
4832
|
+
this._service.update();
|
|
4833
|
+
}
|
|
4834
|
+
return of(false);
|
|
4835
|
+
}
|
|
4836
|
+
return of(true);
|
|
4837
|
+
}), debounceTime(200), distinctUntilChanged()), $items = toObservable(this.items).pipe(map(i => !i ? [] : i)), $dynamicSize = toObservable(this.dynamicSize);
|
|
4838
|
+
const $snapScrollToBottom = toObservable(this.snapScrollToBottom), $waitForPreparation = toObservable(this.waitForPreparation);
|
|
4839
|
+
combineLatest([$dynamicSize, $snapScrollToBottom, $waitForPreparation]).pipe(takeUntilDestroyed(), switchMap$1(([dynamicSize, snapScrollToBottom, waitForPreparation]) => {
|
|
4840
|
+
if (!dynamicSize || !snapScrollToBottom || !waitForPreparation) {
|
|
4816
4841
|
prepared = readyToStart = true;
|
|
4817
4842
|
const scrollerComponent = this._scrollerComponent();
|
|
4818
4843
|
if (scrollerComponent) {
|
|
4819
4844
|
scrollerComponent.prepared = true;
|
|
4820
4845
|
}
|
|
4821
4846
|
this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: false });
|
|
4822
|
-
this._service.update(
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4847
|
+
this._service.update();
|
|
4848
|
+
this._$show.next(true);
|
|
4849
|
+
return of(false);
|
|
4850
|
+
}
|
|
4851
|
+
if (!!dynamicSize && !!snapScrollToBottom && !!waitForPreparation) {
|
|
4852
|
+
this._$updateIteration.next(0);
|
|
4853
|
+
return this.$prepared.pipe(takeUntilDestroyed(this._destroyRef), distinctUntilChanged(), switchMap$1(v => {
|
|
4854
|
+
if (!v) {
|
|
4855
|
+
this._$show.next(false);
|
|
4856
|
+
readyToStart = isUserScrolling = prepared = false;
|
|
4857
|
+
this.cacheClean();
|
|
4831
4858
|
const scrollerComponent = this._scrollerComponent();
|
|
4832
4859
|
if (scrollerComponent) {
|
|
4833
|
-
scrollerComponent.prepared =
|
|
4860
|
+
scrollerComponent.prepared = false;
|
|
4861
|
+
scrollerComponent.stopScrolling();
|
|
4834
4862
|
}
|
|
4835
|
-
this.classes.set({ prepared: v, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]:
|
|
4863
|
+
this.classes.set({ prepared: v, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]: false });
|
|
4864
|
+
this._$updateIteration.next(0);
|
|
4865
|
+
this._service.update(true);
|
|
4866
|
+
return of(false);
|
|
4836
4867
|
}
|
|
4837
|
-
this.
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4868
|
+
return of(true).pipe(takeUntilDestroyed(this._destroyRef), switchMap$1(v => {
|
|
4869
|
+
const waitForPreparation = this.waitForPreparation();
|
|
4870
|
+
if (waitForPreparation) {
|
|
4871
|
+
return $updateComplete.pipe(takeUntilDestroyed(this._destroyRef), filter$1(v => !!v), take(1), tap(() => {
|
|
4872
|
+
prepared = readyToStart = true;
|
|
4873
|
+
const waitForPreparation = this.waitForPreparation(), scrollerComponent = this._scrollerComponent();
|
|
4874
|
+
if (scrollerComponent) {
|
|
4875
|
+
scrollerComponent.prepared = true;
|
|
4876
|
+
scrollerComponent.stopScrolling();
|
|
4877
|
+
}
|
|
4878
|
+
this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: waitForPreparation });
|
|
4879
|
+
this._service.update(true);
|
|
4880
|
+
this._$show.next(true);
|
|
4881
|
+
}));
|
|
4882
|
+
}
|
|
4883
|
+
prepared = readyToStart = true;
|
|
4884
|
+
const scrollerComponent = this._scrollerComponent();
|
|
4885
|
+
if (scrollerComponent) {
|
|
4886
|
+
scrollerComponent.prepared = true;
|
|
4887
|
+
scrollerComponent.stopScrolling();
|
|
4888
|
+
}
|
|
4889
|
+
this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: waitForPreparation });
|
|
4890
|
+
this._service.update(true);
|
|
4891
|
+
this._$show.next(true);
|
|
4892
|
+
return of(false);
|
|
4893
|
+
}));
|
|
4894
|
+
}));
|
|
4895
|
+
}
|
|
4896
|
+
prepared = readyToStart = true;
|
|
4897
|
+
const scrollerComponent = this._scrollerComponent();
|
|
4898
|
+
if (scrollerComponent) {
|
|
4899
|
+
scrollerComponent.prepared = true;
|
|
4900
|
+
scrollerComponent.stopScrolling();
|
|
4901
|
+
}
|
|
4902
|
+
this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: false });
|
|
4903
|
+
this._service.update(true);
|
|
4904
|
+
this._$show.next(true);
|
|
4905
|
+
return of(false);
|
|
4857
4906
|
})).subscribe();
|
|
4858
4907
|
this._service.$focusedId.pipe(takeUntilDestroyed(), tap(v => {
|
|
4859
4908
|
this.focusedElement.set(v ?? undefined);
|
|
@@ -4861,7 +4910,7 @@ class NgVirtualListComponent {
|
|
|
4861
4910
|
toObservable(this._list).pipe(takeUntilDestroyed(), filter$1(v => !!v), tap(v => {
|
|
4862
4911
|
this._service.listElement = v.nativeElement;
|
|
4863
4912
|
})).subscribe();
|
|
4864
|
-
const $defaultItemValue = toObservable(this.defaultItemValue), $
|
|
4913
|
+
const $defaultItemValue = toObservable(this.defaultItemValue), $trackBy = toObservable(this.trackBy), $selectByClick = toObservable(this.selectByClick), $collapseByClick = toObservable(this.collapseByClick), $isScrollStart = toObservable(this._isScrollStart), $isScrollFinished = toObservable(this._isScrollFinished), $scrollStartOffset = toObservable(this.scrollStartOffset), $scrollEndOffset = toObservable(this.scrollEndOffset), $isVertical = toObservable(this.direction).pipe(map(v => this.getIsVertical(v || DEFAULT_DIRECTION)));
|
|
4865
4914
|
$snapScrollToBottom.pipe(takeUntilDestroyed(), tap(v => {
|
|
4866
4915
|
this._service.snapScrollToBottom = v;
|
|
4867
4916
|
})).subscribe();
|
|
@@ -4995,7 +5044,6 @@ class NgVirtualListComponent {
|
|
|
4995
5044
|
_$scrollToEndDuringUpdateCanceller.next(0);
|
|
4996
5045
|
})).subscribe();
|
|
4997
5046
|
const update = (params) => {
|
|
4998
|
-
this._$update.next();
|
|
4999
5047
|
const { snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion, } = params;
|
|
5000
5048
|
const scroller = this._scrollerComponent();
|
|
5001
5049
|
if (scroller) {
|
|
@@ -5038,7 +5086,7 @@ class NgVirtualListComponent {
|
|
|
5038
5086
|
this._isScrollFinished.set(scrollPosition >= roundedMaxPosition);
|
|
5039
5087
|
}
|
|
5040
5088
|
}
|
|
5041
|
-
actualScrollSize = (isVertical ? scroller.
|
|
5089
|
+
actualScrollSize = (isVertical ? scroller.actualScrollTop ?? 0 : scroller.actualScrollLeft ?? 0);
|
|
5042
5090
|
const delta = this._trackBox.delta, roundedActualScrollSize = Math.round(actualScrollSize), scrollPositionAfterUpdate = actualScrollSize + delta, roundedScrollPositionAfterUpdate = Math.round(scrollPositionAfterUpdate), roundedMaxPositionAfterUpdate = Math.round(totalSize - viewportSize);
|
|
5043
5091
|
if (this._isSnappingMethodAdvanced) {
|
|
5044
5092
|
this.updateRegularRenderer();
|
|
@@ -5056,7 +5104,7 @@ class NgVirtualListComponent {
|
|
|
5056
5104
|
if (roundedMaxPositionAfterUpdate > 0) {
|
|
5057
5105
|
const diff = roundedMaxPositionAfterUpdate - roundedScrollPositionAfterUpdate, snapToEndTransitionInstantOffset = this.snapToEndTransitionInstantOffset() || viewportSize, animated = prepared && readyToStart && diff >= 0 && diff <= snapToEndTransitionInstantOffset, params = {
|
|
5058
5106
|
[isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
|
|
5059
|
-
fireUpdate:
|
|
5107
|
+
fireUpdate: !(prepared && readyToStart), behavior: animated ? this.scrollBehavior() : BEHAVIOR_INSTANT,
|
|
5060
5108
|
blending: false, duration: this.animationParams().scrollToItem,
|
|
5061
5109
|
};
|
|
5062
5110
|
scroller?.scrollTo?.(params);
|
|
@@ -5068,11 +5116,16 @@ class NgVirtualListComponent {
|
|
|
5068
5116
|
this._isScrollFinished.set(true);
|
|
5069
5117
|
}
|
|
5070
5118
|
}
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5119
|
+
if (this._scrollSize() !== scrollPositionAfterUpdate) {
|
|
5120
|
+
const params = {
|
|
5121
|
+
[isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: prepared && readyToStart,
|
|
5122
|
+
fireUpdate: !(prepared && readyToStart), behavior: BEHAVIOR_INSTANT, duration: this.animationParams().scrollToItem,
|
|
5123
|
+
};
|
|
5124
|
+
scroller.scrollTo(params);
|
|
5125
|
+
}
|
|
5126
|
+
}
|
|
5127
|
+
if (!prepared && !readyToStart) {
|
|
5128
|
+
this._$update.next();
|
|
5076
5129
|
}
|
|
5077
5130
|
}
|
|
5078
5131
|
};
|
|
@@ -5212,6 +5265,9 @@ class NgVirtualListComponent {
|
|
|
5212
5265
|
})).subscribe();
|
|
5213
5266
|
const $scrollTo = this.$scrollTo;
|
|
5214
5267
|
combineLatest([$scroller, $trackBy, $scrollTo]).pipe(takeUntilDestroyed(), filter$1(([scroller]) => scroller !== undefined), map(([scroller, trackBy, event]) => ({ scroller: scroller, trackBy, event })), switchMap$1(({ scroller, trackBy, event }) => {
|
|
5268
|
+
if (!prepared || !readyToStart) {
|
|
5269
|
+
return of([false]);
|
|
5270
|
+
}
|
|
5215
5271
|
const scrollerComponent = this._scrollerComponent(), { id, iteration = 0, blending = false, isLastIteration = false, scrollCalled = false, cb, } = event;
|
|
5216
5272
|
if (scrollerComponent) {
|
|
5217
5273
|
const items = this._actualItems();
|
|
@@ -5280,7 +5336,7 @@ class NgVirtualListComponent {
|
|
|
5280
5336
|
return of([true, { id, scroller: scrollerComponent, cb }]);
|
|
5281
5337
|
}), takeUntilDestroyed(), filter$1(params => !!params), tap(([finished, params]) => {
|
|
5282
5338
|
if (!finished) {
|
|
5283
|
-
if (params) {
|
|
5339
|
+
if (!!params) {
|
|
5284
5340
|
this._$scrollTo.next(params);
|
|
5285
5341
|
}
|
|
5286
5342
|
return;
|