Skip to content

Commit 7037c3a

Browse files
authored
fix(overlay): resolve circular dependency (#19433)
Resolves a circular dependency between a couple of the classes in `cdk/overlay`.
1 parent a95da92 commit 7037c3a

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

goldens/ts-circular-deps.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
"src/cdk/drag-drop/drag-ref.ts",
2525
"src/cdk/drag-drop/drop-list-ref.ts"
2626
],
27-
[
28-
"src/cdk/overlay/keyboard/overlay-keyboard-dispatcher.ts",
29-
"src/cdk/overlay/overlay-ref.ts"
30-
],
3127
[
3228
"src/cdk/schematics/testing/index.ts",
3329
"src/cdk/schematics/testing/test-case-setup.ts"

src/cdk/overlay/keyboard/overlay-keyboard-dispatcher.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
Optional,
1616
SkipSelf,
1717
} from '@angular/core';
18-
import {OverlayRef} from '../overlay-ref';
18+
import {OverlayReference} from '../overlay-reference';
1919

2020

2121
/**
@@ -27,7 +27,7 @@ import {OverlayRef} from '../overlay-ref';
2727
export class OverlayKeyboardDispatcher implements OnDestroy {
2828

2929
/** Currently attached overlays in the order they were attached. */
30-
_attachedOverlays: OverlayRef[] = [];
30+
_attachedOverlays: OverlayReference[] = [];
3131

3232
private _document: Document;
3333
private _isAttached: boolean;
@@ -41,7 +41,7 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
4141
}
4242

4343
/** Add a new overlay to the list of attached overlay refs. */
44-
add(overlayRef: OverlayRef): void {
44+
add(overlayRef: OverlayReference): void {
4545
// Ensure that we don't get the same overlay multiple times.
4646
this.remove(overlayRef);
4747

@@ -55,7 +55,7 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
5555
}
5656

5757
/** Remove an overlay from the list of attached overlay refs. */
58-
remove(overlayRef: OverlayRef): void {
58+
remove(overlayRef: OverlayReference): void {
5959
const index = this._attachedOverlays.indexOf(overlayRef);
6060

6161
if (index > -1) {

src/cdk/overlay/overlay-reference.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import {Portal} from '@angular/cdk/portal';
1010
import {Direction, Directionality} from '@angular/cdk/bidi';
11+
import {Subject} from 'rxjs';
1112

1213
/**
1314
* Basic interface for an overlay. Used to avoid circular type references between
@@ -26,4 +27,5 @@ export interface OverlayReference {
2627
updatePosition: () => void;
2728
getDirection: () => Direction;
2829
setDirection: (dir: Direction | Directionality) => void;
30+
_keydownEvents: Subject<KeyboardEvent>;
2931
}

tools/public_api_guard/cdk/overlay.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ export declare class OverlayContainer implements OnDestroy {
236236
}
237237

238238
export declare class OverlayKeyboardDispatcher implements OnDestroy {
239-
_attachedOverlays: OverlayRef[];
239+
_attachedOverlays: OverlayReference[];
240240
constructor(document: any);
241-
add(overlayRef: OverlayRef): void;
241+
add(overlayRef: OverlayReference): void;
242242
ngOnDestroy(): void;
243-
remove(overlayRef: OverlayRef): void;
243+
remove(overlayRef: OverlayReference): void;
244244
static ɵfac: i0.ɵɵFactoryDef<OverlayKeyboardDispatcher, never>;
245245
static ɵprov: i0.ɵɵInjectableDef<OverlayKeyboardDispatcher>;
246246
}

0 commit comments

Comments
 (0)