Skip to content

fix(overlay): resolve circular dependency #19433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions goldens/ts-circular-deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
"src/cdk/drag-drop/drag-ref.ts",
"src/cdk/drag-drop/drop-list-ref.ts"
],
[
"src/cdk/overlay/keyboard/overlay-keyboard-dispatcher.ts",
"src/cdk/overlay/overlay-ref.ts"
],
[
"src/cdk/schematics/testing/index.ts",
"src/cdk/schematics/testing/test-case-setup.ts"
Expand Down
8 changes: 4 additions & 4 deletions src/cdk/overlay/keyboard/overlay-keyboard-dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
Optional,
SkipSelf,
} from '@angular/core';
import {OverlayRef} from '../overlay-ref';
import {OverlayReference} from '../overlay-reference';


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

/** Currently attached overlays in the order they were attached. */
_attachedOverlays: OverlayRef[] = [];
_attachedOverlays: OverlayReference[] = [];

private _document: Document;
private _isAttached: boolean;
Expand All @@ -41,7 +41,7 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
}

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

Expand All @@ -55,7 +55,7 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
}

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

if (index > -1) {
Expand Down
2 changes: 2 additions & 0 deletions src/cdk/overlay/overlay-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import {Portal} from '@angular/cdk/portal';
import {Direction, Directionality} from '@angular/cdk/bidi';
import {Subject} from 'rxjs';

/**
* Basic interface for an overlay. Used to avoid circular type references between
Expand All @@ -26,4 +27,5 @@ export interface OverlayReference {
updatePosition: () => void;
getDirection: () => Direction;
setDirection: (dir: Direction | Directionality) => void;
_keydownEvents: Subject<KeyboardEvent>;
}
6 changes: 3 additions & 3 deletions tools/public_api_guard/cdk/overlay.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ export declare class OverlayContainer implements OnDestroy {
}

export declare class OverlayKeyboardDispatcher implements OnDestroy {
_attachedOverlays: OverlayRef[];
_attachedOverlays: OverlayReference[];
constructor(document: any);
add(overlayRef: OverlayRef): void;
add(overlayRef: OverlayReference): void;
ngOnDestroy(): void;
remove(overlayRef: OverlayRef): void;
remove(overlayRef: OverlayReference): void;
static ɵfac: i0.ɵɵFactoryDef<OverlayKeyboardDispatcher, never>;
static ɵprov: i0.ɵɵInjectableDef<OverlayKeyboardDispatcher>;
}
Expand Down