@angular/cdk 18.0.0-next.3 → 18.0.0-next.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/esm2022/drag-drop/drag-ref.mjs +7 -3
- package/esm2022/scrolling/virtual-scroll-viewport.mjs +24 -17
- package/esm2022/version.mjs +1 -1
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/drag-drop.mjs +6 -2
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +22 -15
- package/fesm2022/scrolling.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/scrolling/index.d.ts +2 -0
package/fesm2022/scrolling.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { coerceNumberProperty, coerceElement } from '@angular/cdk/coercion';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, forwardRef, Directive, Input, Injectable, Optional, Inject, inject, booleanAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, ViewChild, SkipSelf, ElementRef, NgModule } from '@angular/core';
|
|
3
|
+
import { InjectionToken, forwardRef, Directive, Input, Injectable, Optional, Inject, inject, Injector, afterNextRender, booleanAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, ViewChild, SkipSelf, ElementRef, NgModule } from '@angular/core';
|
|
4
4
|
import { Subject, of, Observable, fromEvent, animationFrameScheduler, asapScheduler, Subscription, isObservable } from 'rxjs';
|
|
5
5
|
import { distinctUntilChanged, auditTime, filter, takeUntil, startWith, pairwise, switchMap, shareReplay } from 'rxjs/operators';
|
|
6
6
|
import * as i1 from '@angular/cdk/platform';
|
|
@@ -760,6 +760,8 @@ class CdkVirtualScrollViewport extends CdkVirtualScrollable {
|
|
|
760
760
|
this._runAfterChangeDetection = [];
|
|
761
761
|
/** Subscription to changes in the viewport size. */
|
|
762
762
|
this._viewportChanges = Subscription.EMPTY;
|
|
763
|
+
this._injector = inject(Injector);
|
|
764
|
+
this._isDestroyed = false;
|
|
763
765
|
if (!_scrollStrategy && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
764
766
|
throw Error('Error: cdk-virtual-scroll-viewport requires the "itemSize" property to be set.');
|
|
765
767
|
}
|
|
@@ -811,6 +813,7 @@ class CdkVirtualScrollViewport extends CdkVirtualScrollable {
|
|
|
811
813
|
this._renderedRangeSubject.complete();
|
|
812
814
|
this._detachedSubject.complete();
|
|
813
815
|
this._viewportChanges.unsubscribe();
|
|
816
|
+
this._isDestroyed = true;
|
|
814
817
|
super.ngOnDestroy();
|
|
815
818
|
}
|
|
816
819
|
/** Attaches a `CdkVirtualScrollRepeater` to this viewport. */
|
|
@@ -1030,21 +1033,25 @@ class CdkVirtualScrollViewport extends CdkVirtualScrollable {
|
|
|
1030
1033
|
}
|
|
1031
1034
|
/** Run change detection. */
|
|
1032
1035
|
_doChangeDetection() {
|
|
1033
|
-
this.
|
|
1034
|
-
|
|
1035
|
-
// bypassSecurityTrustStyle is banned in Google. However the value is safe, it's composed of
|
|
1036
|
-
// string literals, a variable that can only be 'X' or 'Y', and user input that is run through
|
|
1037
|
-
// the `Number` function first to coerce it to a numeric value.
|
|
1038
|
-
this._contentWrapper.nativeElement.style.transform = this._renderedContentTransform;
|
|
1039
|
-
// Apply changes to Angular bindings. Note: We must call `markForCheck` to run change detection
|
|
1040
|
-
// from the root, since the repeated items are content projected in. Calling `detectChanges`
|
|
1041
|
-
// instead does not properly check the projected content.
|
|
1042
|
-
this.ngZone.run(() => this._changeDetectorRef.markForCheck());
|
|
1043
|
-
const runAfterChangeDetection = this._runAfterChangeDetection;
|
|
1044
|
-
this._runAfterChangeDetection = [];
|
|
1045
|
-
for (const fn of runAfterChangeDetection) {
|
|
1046
|
-
fn();
|
|
1036
|
+
if (this._isDestroyed) {
|
|
1037
|
+
return;
|
|
1047
1038
|
}
|
|
1039
|
+
this.ngZone.run(() => {
|
|
1040
|
+
this._changeDetectorRef.markForCheck();
|
|
1041
|
+
afterNextRender(() => {
|
|
1042
|
+
this._isChangeDetectionPending = false;
|
|
1043
|
+
// Apply the content transform. The transform can't be set via an Angular binding because
|
|
1044
|
+
// bypassSecurityTrustStyle is banned in Google. However the value is safe, it's composed of
|
|
1045
|
+
// string literals, a variable that can only be 'X' or 'Y', and user input that is run through
|
|
1046
|
+
// the `Number` function first to coerce it to a numeric value.
|
|
1047
|
+
this._contentWrapper.nativeElement.style.transform = this._renderedContentTransform;
|
|
1048
|
+
const runAfterChangeDetection = this._runAfterChangeDetection;
|
|
1049
|
+
this._runAfterChangeDetection = [];
|
|
1050
|
+
for (const fn of runAfterChangeDetection) {
|
|
1051
|
+
fn();
|
|
1052
|
+
}
|
|
1053
|
+
}, { injector: this._injector });
|
|
1054
|
+
});
|
|
1048
1055
|
}
|
|
1049
1056
|
/** Calculates the `style.width` and `style.height` for the spacer element. */
|
|
1050
1057
|
_calculateSpacerSize() {
|