@angular/cdk 14.1.0 → 14.1.1
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/drag-drop/index.d.ts +2 -2
- package/esm2020/dialog/dialog.mjs +2 -2
- package/esm2020/drag-drop/directives/drag.mjs +1 -1
- package/esm2020/drag-drop/drag-ref.mjs +2 -2
- package/esm2020/overlay/overlay-ref.mjs +19 -1
- package/esm2020/version.mjs +1 -1
- package/fesm2015/cdk.mjs +1 -1
- package/fesm2015/cdk.mjs.map +1 -1
- package/fesm2015/dialog.mjs +1 -1
- package/fesm2015/dialog.mjs.map +1 -1
- package/fesm2015/drag-drop.mjs +1 -1
- package/fesm2015/drag-drop.mjs.map +1 -1
- package/fesm2015/overlay.mjs +18 -0
- package/fesm2015/overlay.mjs.map +1 -1
- package/fesm2020/cdk.mjs +1 -1
- package/fesm2020/cdk.mjs.map +1 -1
- package/fesm2020/dialog.mjs +1 -1
- package/fesm2020/dialog.mjs.map +1 -1
- package/fesm2020/drag-drop.mjs +1 -1
- package/fesm2020/drag-drop.mjs.map +1 -1
- package/fesm2020/overlay.mjs +18 -0
- package/fesm2020/overlay.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/schematics/update-tool/component-resource-collector.js +10 -3
- package/schematics/update-tool/component-resource-collector.mjs +10 -3
package/fesm2020/overlay.mjs
CHANGED
|
@@ -909,6 +909,24 @@ class OverlayRef {
|
|
|
909
909
|
this._locationChanges = this._location.subscribe(() => this.dispose());
|
|
910
910
|
}
|
|
911
911
|
this._outsideClickDispatcher.add(this);
|
|
912
|
+
// TODO(crisbeto): the null check is here, because the portal outlet returns `any`.
|
|
913
|
+
// We should be guaranteed for the result to be `ComponentRef | EmbeddedViewRef`, but
|
|
914
|
+
// `instanceof EmbeddedViewRef` doesn't appear to work at the moment.
|
|
915
|
+
if (typeof attachResult?.onDestroy === 'function') {
|
|
916
|
+
// In most cases we control the portal and we know when it is being detached so that
|
|
917
|
+
// we can finish the disposal process. The exception is if the user passes in a custom
|
|
918
|
+
// `ViewContainerRef` that isn't destroyed through the overlay API. Note that we use
|
|
919
|
+
// `detach` here instead of `dispose`, because we don't know if the user intends to
|
|
920
|
+
// reattach the overlay at a later point. It also has the advantage of waiting for animations.
|
|
921
|
+
attachResult.onDestroy(() => {
|
|
922
|
+
if (this.hasAttached()) {
|
|
923
|
+
// We have to delay the `detach` call, because detaching immediately prevents
|
|
924
|
+
// other destroy hooks from running. This is likely a framework bug similar to
|
|
925
|
+
// https://github.com/angular/angular/issues/46119
|
|
926
|
+
this._ngZone.runOutsideAngular(() => Promise.resolve().then(() => this.detach()));
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
}
|
|
912
930
|
return attachResult;
|
|
913
931
|
}
|
|
914
932
|
/**
|