File tree Expand file tree Collapse file tree 7 files changed +44
-17
lines changed Expand file tree Collapse file tree 7 files changed +44
-17
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+
9
+ import { Portal } from '@angular/cdk/portal' ;
10
+
11
+ /**
12
+ * Basic interface for an overlay. Used to avoid circular type references between
13
+ * `OverlayRef`, `PositionStrategy` and `ScrollStrategy`, and `OverlayConfig`.
14
+ * @docs -private
15
+ */
16
+ export interface OverlayRefBase {
17
+ attach : ( portal : Portal < any > ) => any ;
18
+ detach : ( ) => any ;
19
+ dispose : ( ) => void ;
20
+ overlayElement : HTMLElement ;
21
+ getConfig : ( ) => any ;
22
+ hasAttached : ( ) => boolean ;
23
+ updateSize : ( config : any ) => void ;
24
+ updatePosition : ( ) => void ;
25
+ }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import {Subscription} from 'rxjs/Subscription';
23
23
import { Observable } from 'rxjs/Observable' ;
24
24
import { CdkScrollable } from '@angular/cdk/scrolling' ;
25
25
import { isElementScrolledOutsideView , isElementClippedByScrolling } from './scroll-clip' ;
26
- import { OverlayRef } from '../overlay-ref' ;
26
+ import { OverlayRefBase } from '../overlay-ref-base ' ;
27
27
28
28
29
29
@@ -35,6 +35,9 @@ import {OverlayRef} from '../overlay-ref';
35
35
* of the overlay.
36
36
*/
37
37
export class ConnectedPositionStrategy implements PositionStrategy {
38
+ /** The overlay to which this strategy is attached. */
39
+ private _overlayRef : OverlayRefBase ;
40
+
38
41
/** Layout direction of the position strategy. */
39
42
private _dir = 'ltr' ;
40
43
@@ -96,7 +99,8 @@ export class ConnectedPositionStrategy implements PositionStrategy {
96
99
}
97
100
98
101
/** Attach this position strategy to an overlay. */
99
- attach ( overlayRef : OverlayRef ) : void {
102
+ attach ( overlayRef : OverlayRefBase ) : void {
103
+ this . _overlayRef = overlayRef ;
100
104
this . _pane = overlayRef . overlayElement ;
101
105
this . _resizeSubscription . unsubscribe ( ) ;
102
106
this . _resizeSubscription = this . _viewportRuler . change ( ) . subscribe ( ( ) => this . apply ( ) ) ;
Original file line number Diff line number Diff line change 7
7
*/
8
8
9
9
import { PositionStrategy } from './position-strategy' ;
10
- import { OverlayRef } from '../overlay-ref' ;
10
+ import { OverlayRefBase } from '../overlay-ref-base ' ;
11
11
12
12
13
13
/**
@@ -18,7 +18,7 @@ import {OverlayRef} from '../overlay-ref';
18
18
*/
19
19
export class GlobalPositionStrategy implements PositionStrategy {
20
20
/** The overlay to which this strategy is attached. */
21
- private _overlayRef : OverlayRef ;
21
+ private _overlayRef : OverlayRefBase ;
22
22
23
23
private _cssPosition = 'static' ;
24
24
private _topOffset = '' ;
@@ -35,7 +35,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
35
35
36
36
constructor ( private _document : any ) { }
37
37
38
- attach ( overlayRef : OverlayRef ) : void {
38
+ attach ( overlayRef : OverlayRefBase ) : void {
39
39
const config = overlayRef . getConfig ( ) ;
40
40
41
41
this . _overlayRef = overlayRef ;
Original file line number Diff line number Diff line change 6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
- import { OverlayRef } from '../overlay-ref' ;
10
-
9
+ import { OverlayRefBase } from '../overlay-ref-base' ;
11
10
12
11
/** Strategy for setting the position on an overlay. */
13
12
export interface PositionStrategy {
14
-
15
13
/** Attaches this position strategy to an overlay. */
16
- attach ( overlay : OverlayRef ) : void ;
14
+ attach ( overlayRef : OverlayRefBase ) : void ;
17
15
18
16
/** Updates the position of the overlay element. */
19
17
apply ( ) : void ;
Original file line number Diff line number Diff line change 7
7
*/
8
8
import { NgZone } from '@angular/core' ;
9
9
import { ScrollStrategy , getMatScrollStrategyAlreadyAttachedError } from './scroll-strategy' ;
10
- import { OverlayRef } from '../overlay-ref' ;
10
+ import { OverlayRefBase } from '../overlay-ref-base ' ;
11
11
import { Subscription } from 'rxjs/Subscription' ;
12
12
import { ScrollDispatcher , ViewportRuler } from '@angular/cdk/scrolling' ;
13
13
@@ -24,7 +24,7 @@ export interface CloseScrollStrategyConfig {
24
24
*/
25
25
export class CloseScrollStrategy implements ScrollStrategy {
26
26
private _scrollSubscription : Subscription | null = null ;
27
- private _overlayRef : OverlayRef ;
27
+ private _overlayRef : OverlayRefBase ;
28
28
private _initialScrollPosition : number ;
29
29
30
30
constructor (
@@ -34,7 +34,7 @@ export class CloseScrollStrategy implements ScrollStrategy {
34
34
private _config ?: CloseScrollStrategyConfig ) { }
35
35
36
36
/** Attaches this scroll strategy to an overlay. */
37
- attach ( overlayRef : OverlayRef ) {
37
+ attach ( overlayRef : OverlayRefBase ) {
38
38
if ( this . _overlayRef ) {
39
39
throw getMatScrollStrategyAlreadyAttachedError ( ) ;
40
40
}
Original file line number Diff line number Diff line change 9
9
import { NgZone } from '@angular/core' ;
10
10
import { Subscription } from 'rxjs/Subscription' ;
11
11
import { ScrollStrategy , getMatScrollStrategyAlreadyAttachedError } from './scroll-strategy' ;
12
- import { OverlayRef } from '../overlay-ref' ;
12
+ import { OverlayRefBase } from '../overlay-ref-base ' ;
13
13
import { ScrollDispatcher , ViewportRuler } from '@angular/cdk/scrolling' ;
14
14
import { isElementScrolledOutsideView } from '../position/scroll-clip' ;
15
15
@@ -29,7 +29,7 @@ export interface RepositionScrollStrategyConfig {
29
29
*/
30
30
export class RepositionScrollStrategy implements ScrollStrategy {
31
31
private _scrollSubscription : Subscription | null = null ;
32
- private _overlayRef : OverlayRef ;
32
+ private _overlayRef : OverlayRefBase ;
33
33
34
34
constructor (
35
35
private _scrollDispatcher : ScrollDispatcher ,
@@ -38,7 +38,7 @@ export class RepositionScrollStrategy implements ScrollStrategy {
38
38
private _config ?: RepositionScrollStrategyConfig ) { }
39
39
40
40
/** Attaches this scroll strategy to an overlay. */
41
- attach ( overlayRef : OverlayRef ) {
41
+ attach ( overlayRef : OverlayRefBase ) {
42
42
if ( this . _overlayRef ) {
43
43
throw getMatScrollStrategyAlreadyAttachedError ( ) ;
44
44
}
Original file line number Diff line number Diff line change 6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
- import { OverlayRef } from '../overlay-ref' ;
9
+ import { OverlayRefBase } from '../overlay-ref-base ' ;
10
10
11
11
/**
12
12
* Describes a strategy that will be used by an overlay to handle scroll events while it is open.
@@ -19,7 +19,7 @@ export interface ScrollStrategy {
19
19
disable : ( ) => void ;
20
20
21
21
/** Attaches this `ScrollStrategy` to an overlay. */
22
- attach : ( overlayRef : OverlayRef ) => void ;
22
+ attach : ( overlayRef : OverlayRefBase ) => void ;
23
23
}
24
24
25
25
/**
You can’t perform that action at this time.
0 commit comments