@angular/cdk 12.2.0-rc.0 → 12.2.0
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/bundles/cdk-drag-drop.umd.js +51 -38
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +29 -8
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/drag-drop/directives/drag.d.ts +2 -0
- package/drag-drop/index.metadata.json +1 -1
- package/esm2015/drag-drop/directives/drag.js +50 -39
- package/esm2015/overlay/overlay-reference.js +1 -1
- package/esm2015/text-field/autosize.js +29 -9
- package/esm2015/version.js +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +49 -38
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/text-field.js +28 -8
- package/fesm2015/text-field.js.map +1 -1
- package/overlay/overlay-reference.d.ts +9 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/text-field/autosize.d.ts +3 -2
- package/text-field/index.metadata.json +1 -1
|
@@ -3610,43 +3610,22 @@
|
|
|
3610
3610
|
};
|
|
3611
3611
|
CdkDrag.prototype.ngAfterViewInit = function () {
|
|
3612
3612
|
var _this = this;
|
|
3613
|
-
//
|
|
3614
|
-
//
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
_this.
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
.
|
|
3627
|
-
.map(function (handle) { return handle.element; });
|
|
3628
|
-
// Usually handles are only allowed to be a descendant of the drag element, but if
|
|
3629
|
-
// the consumer defined a different drag root, we should allow the drag element
|
|
3630
|
-
// itself to be a handle too.
|
|
3631
|
-
if (_this._selfHandle && _this.rootElementSelector) {
|
|
3632
|
-
childHandleElements.push(_this.element);
|
|
3613
|
+
// Normally this isn't in the zone, but it can cause major performance regressions for apps
|
|
3614
|
+
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
3615
|
+
this._ngZone.runOutsideAngular(function () {
|
|
3616
|
+
// We need to wait for the zone to stabilize, in order for the reference
|
|
3617
|
+
// element to be in the proper place in the DOM. This is mostly relevant
|
|
3618
|
+
// for draggable elements inside portals since they get stamped out in
|
|
3619
|
+
// their original DOM position and then they get transferred to the portal.
|
|
3620
|
+
_this._ngZone.onStable
|
|
3621
|
+
.pipe(operators.take(1), operators.takeUntil(_this._destroyed))
|
|
3622
|
+
.subscribe(function () {
|
|
3623
|
+
_this._updateRootElement();
|
|
3624
|
+
_this._setupHandlesListener();
|
|
3625
|
+
if (_this.freeDragPosition) {
|
|
3626
|
+
_this._dragRef.setFreeDragPosition(_this.freeDragPosition);
|
|
3633
3627
|
}
|
|
3634
|
-
_this._dragRef.withHandles(childHandleElements);
|
|
3635
|
-
}),
|
|
3636
|
-
// Listen if the state of any of the handles changes.
|
|
3637
|
-
operators.switchMap(function (handles) {
|
|
3638
|
-
return rxjs.merge.apply(void 0, __spreadArray([], __read(handles.map(function (item) {
|
|
3639
|
-
return item._stateChanges.pipe(operators.startWith(item));
|
|
3640
|
-
}))));
|
|
3641
|
-
}), operators.takeUntil(_this._destroyed)).subscribe(function (handleInstance) {
|
|
3642
|
-
// Enabled/disable the handle that changed in the DragRef.
|
|
3643
|
-
var dragRef = _this._dragRef;
|
|
3644
|
-
var handle = handleInstance.element.nativeElement;
|
|
3645
|
-
handleInstance.disabled ? dragRef.disableHandle(handle) : dragRef.enableHandle(handle);
|
|
3646
3628
|
});
|
|
3647
|
-
if (_this.freeDragPosition) {
|
|
3648
|
-
_this._dragRef.setFreeDragPosition(_this.freeDragPosition);
|
|
3649
|
-
}
|
|
3650
3629
|
});
|
|
3651
3630
|
};
|
|
3652
3631
|
CdkDrag.prototype.ngOnChanges = function (changes) {
|
|
@@ -3663,6 +3642,7 @@
|
|
|
3663
3642
|
}
|
|
3664
3643
|
};
|
|
3665
3644
|
CdkDrag.prototype.ngOnDestroy = function () {
|
|
3645
|
+
var _this = this;
|
|
3666
3646
|
if (this.dropContainer) {
|
|
3667
3647
|
this.dropContainer.removeItem(this);
|
|
3668
3648
|
}
|
|
@@ -3670,9 +3650,12 @@
|
|
|
3670
3650
|
if (index > -1) {
|
|
3671
3651
|
CdkDrag._dragInstances.splice(index, 1);
|
|
3672
3652
|
}
|
|
3673
|
-
|
|
3674
|
-
this.
|
|
3675
|
-
|
|
3653
|
+
// Unnecessary in most cases, but used to avoid extra change detections with `zone-paths-rxjs`.
|
|
3654
|
+
this._ngZone.runOutsideAngular(function () {
|
|
3655
|
+
_this._destroyed.next();
|
|
3656
|
+
_this._destroyed.complete();
|
|
3657
|
+
_this._dragRef.dispose();
|
|
3658
|
+
});
|
|
3676
3659
|
};
|
|
3677
3660
|
/** Syncs the root element with the `DragRef`. */
|
|
3678
3661
|
CdkDrag.prototype._updateRootElement = function () {
|
|
@@ -3829,6 +3812,36 @@
|
|
|
3829
3812
|
this.previewContainer = previewContainer;
|
|
3830
3813
|
}
|
|
3831
3814
|
};
|
|
3815
|
+
/** Sets up the listener that syncs the handles with the drag ref. */
|
|
3816
|
+
CdkDrag.prototype._setupHandlesListener = function () {
|
|
3817
|
+
var _this = this;
|
|
3818
|
+
// Listen for any newly-added handles.
|
|
3819
|
+
this._handles.changes.pipe(operators.startWith(this._handles),
|
|
3820
|
+
// Sync the new handles with the DragRef.
|
|
3821
|
+
operators.tap(function (handles) {
|
|
3822
|
+
var childHandleElements = handles
|
|
3823
|
+
.filter(function (handle) { return handle._parentDrag === _this; })
|
|
3824
|
+
.map(function (handle) { return handle.element; });
|
|
3825
|
+
// Usually handles are only allowed to be a descendant of the drag element, but if
|
|
3826
|
+
// the consumer defined a different drag root, we should allow the drag element
|
|
3827
|
+
// itself to be a handle too.
|
|
3828
|
+
if (_this._selfHandle && _this.rootElementSelector) {
|
|
3829
|
+
childHandleElements.push(_this.element);
|
|
3830
|
+
}
|
|
3831
|
+
_this._dragRef.withHandles(childHandleElements);
|
|
3832
|
+
}),
|
|
3833
|
+
// Listen if the state of any of the handles changes.
|
|
3834
|
+
operators.switchMap(function (handles) {
|
|
3835
|
+
return rxjs.merge.apply(void 0, __spreadArray([], __read(handles.map(function (item) {
|
|
3836
|
+
return item._stateChanges.pipe(operators.startWith(item));
|
|
3837
|
+
}))));
|
|
3838
|
+
}), operators.takeUntil(this._destroyed)).subscribe(function (handleInstance) {
|
|
3839
|
+
// Enabled/disable the handle that changed in the DragRef.
|
|
3840
|
+
var dragRef = _this._dragRef;
|
|
3841
|
+
var handle = handleInstance.element.nativeElement;
|
|
3842
|
+
handleInstance.disabled ? dragRef.disableHandle(handle) : dragRef.enableHandle(handle);
|
|
3843
|
+
});
|
|
3844
|
+
};
|
|
3832
3845
|
return CdkDrag;
|
|
3833
3846
|
}());
|
|
3834
3847
|
CdkDrag._dragInstances = [];
|