@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/fesm2015/overlay.mjs
CHANGED
|
@@ -570,6 +570,24 @@ class OverlayRef {
|
|
|
570
570
|
this._locationChanges = this._location.subscribe(() => this.dispose());
|
|
571
571
|
}
|
|
572
572
|
this._outsideClickDispatcher.add(this);
|
|
573
|
+
// TODO(crisbeto): the null check is here, because the portal outlet returns `any`.
|
|
574
|
+
// We should be guaranteed for the result to be `ComponentRef | EmbeddedViewRef`, but
|
|
575
|
+
// `instanceof EmbeddedViewRef` doesn't appear to work at the moment.
|
|
576
|
+
if (typeof (attachResult === null || attachResult === void 0 ? void 0 : attachResult.onDestroy) === 'function') {
|
|
577
|
+
// In most cases we control the portal and we know when it is being detached so that
|
|
578
|
+
// we can finish the disposal process. The exception is if the user passes in a custom
|
|
579
|
+
// `ViewContainerRef` that isn't destroyed through the overlay API. Note that we use
|
|
580
|
+
// `detach` here instead of `dispose`, because we don't know if the user intends to
|
|
581
|
+
// reattach the overlay at a later point. It also has the advantage of waiting for animations.
|
|
582
|
+
attachResult.onDestroy(() => {
|
|
583
|
+
if (this.hasAttached()) {
|
|
584
|
+
// We have to delay the `detach` call, because detaching immediately prevents
|
|
585
|
+
// other destroy hooks from running. This is likely a framework bug similar to
|
|
586
|
+
// https://github.com/angular/angular/issues/46119
|
|
587
|
+
this._ngZone.runOutsideAngular(() => Promise.resolve().then(() => this.detach()));
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
}
|
|
573
591
|
return attachResult;
|
|
574
592
|
}
|
|
575
593
|
/**
|