[6a3a178] | 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 | import { Platform } from '@angular/cdk/platform';
|
---|
| 9 | import { CdkScrollable, ViewportRuler } from '@angular/cdk/scrolling';
|
---|
| 10 | import { ElementRef } from '@angular/core';
|
---|
| 11 | import { Observable } from 'rxjs';
|
---|
| 12 | import { OverlayContainer } from '../overlay-container';
|
---|
| 13 | import { OverlayReference } from '../overlay-reference';
|
---|
| 14 | import { ConnectedOverlayPositionChange, ConnectionPositionPair, OriginConnectionPosition, OverlayConnectionPosition } from './connected-position';
|
---|
| 15 | import { FlexibleConnectedPositionStrategy } from './flexible-connected-position-strategy';
|
---|
| 16 | import { PositionStrategy } from './position-strategy';
|
---|
| 17 | /**
|
---|
| 18 | * A strategy for positioning overlays. Using this strategy, an overlay is given an
|
---|
| 19 | * implicit position relative to some origin element. The relative position is defined in terms of
|
---|
| 20 | * a point on the origin element that is connected to a point on the overlay element. For example,
|
---|
| 21 | * a basic dropdown is connecting the bottom-left corner of the origin to the top-left corner
|
---|
| 22 | * of the overlay.
|
---|
| 23 | * @deprecated Use `FlexibleConnectedPositionStrategy` instead.
|
---|
| 24 | * @breaking-change 8.0.0
|
---|
| 25 | */
|
---|
| 26 | export declare class ConnectedPositionStrategy implements PositionStrategy {
|
---|
| 27 | /**
|
---|
| 28 | * Reference to the underlying position strategy to which all the API calls are proxied.
|
---|
| 29 | * @docs-private
|
---|
| 30 | */
|
---|
| 31 | _positionStrategy: FlexibleConnectedPositionStrategy;
|
---|
| 32 | /** The overlay to which this strategy is attached. */
|
---|
| 33 | private _overlayRef;
|
---|
| 34 | private _direction;
|
---|
| 35 | /** Ordered list of preferred positions, from most to least desirable. */
|
---|
| 36 | _preferredPositions: ConnectionPositionPair[];
|
---|
| 37 | /** Emits an event when the connection point changes. */
|
---|
| 38 | readonly onPositionChange: Observable<ConnectedOverlayPositionChange>;
|
---|
| 39 | constructor(originPos: OriginConnectionPosition, overlayPos: OverlayConnectionPosition, connectedTo: ElementRef<HTMLElement>, viewportRuler: ViewportRuler, document: Document, platform: Platform, overlayContainer: OverlayContainer);
|
---|
| 40 | /** Ordered list of preferred positions, from most to least desirable. */
|
---|
| 41 | get positions(): ConnectionPositionPair[];
|
---|
| 42 | /** Attach this position strategy to an overlay. */
|
---|
| 43 | attach(overlayRef: OverlayReference): void;
|
---|
| 44 | /** Disposes all resources used by the position strategy. */
|
---|
| 45 | dispose(): void;
|
---|
| 46 | /** @docs-private */
|
---|
| 47 | detach(): void;
|
---|
| 48 | /**
|
---|
| 49 | * Updates the position of the overlay element, using whichever preferred position relative
|
---|
| 50 | * to the origin fits on-screen.
|
---|
| 51 | * @docs-private
|
---|
| 52 | */
|
---|
| 53 | apply(): void;
|
---|
| 54 | /**
|
---|
| 55 | * Re-positions the overlay element with the trigger in its last calculated position,
|
---|
| 56 | * even if a position higher in the "preferred positions" list would now fit. This
|
---|
| 57 | * allows one to re-align the panel without changing the orientation of the panel.
|
---|
| 58 | */
|
---|
| 59 | recalculateLastPosition(): void;
|
---|
| 60 | /**
|
---|
| 61 | * Sets the list of Scrollable containers that host the origin element so that
|
---|
| 62 | * on reposition we can evaluate if it or the overlay has been clipped or outside view. Every
|
---|
| 63 | * Scrollable must be an ancestor element of the strategy's origin element.
|
---|
| 64 | */
|
---|
| 65 | withScrollableContainers(scrollables: CdkScrollable[]): void;
|
---|
| 66 | /**
|
---|
| 67 | * Adds a new preferred fallback position.
|
---|
| 68 | * @param originPos
|
---|
| 69 | * @param overlayPos
|
---|
| 70 | */
|
---|
| 71 | withFallbackPosition(originPos: OriginConnectionPosition, overlayPos: OverlayConnectionPosition, offsetX?: number, offsetY?: number): this;
|
---|
| 72 | /**
|
---|
| 73 | * Sets the layout direction so the overlay's position can be adjusted to match.
|
---|
| 74 | * @param dir New layout direction.
|
---|
| 75 | */
|
---|
| 76 | withDirection(dir: 'ltr' | 'rtl'): this;
|
---|
| 77 | /**
|
---|
| 78 | * Sets an offset for the overlay's connection point on the x-axis
|
---|
| 79 | * @param offset New offset in the X axis.
|
---|
| 80 | */
|
---|
| 81 | withOffsetX(offset: number): this;
|
---|
| 82 | /**
|
---|
| 83 | * Sets an offset for the overlay's connection point on the y-axis
|
---|
| 84 | * @param offset New offset in the Y axis.
|
---|
| 85 | */
|
---|
| 86 | withOffsetY(offset: number): this;
|
---|
| 87 | /**
|
---|
| 88 | * Sets whether the overlay's position should be locked in after it is positioned
|
---|
| 89 | * initially. When an overlay is locked in, it won't attempt to reposition itself
|
---|
| 90 | * when the position is re-applied (e.g. when the user scrolls away).
|
---|
| 91 | * @param isLocked Whether the overlay should locked in.
|
---|
| 92 | */
|
---|
| 93 | withLockedPosition(isLocked: boolean): this;
|
---|
| 94 | /**
|
---|
| 95 | * Overwrites the current set of positions with an array of new ones.
|
---|
| 96 | * @param positions Position pairs to be set on the strategy.
|
---|
| 97 | */
|
---|
| 98 | withPositions(positions: ConnectionPositionPair[]): this;
|
---|
| 99 | /**
|
---|
| 100 | * Sets the origin element, relative to which to position the overlay.
|
---|
| 101 | * @param origin Reference to the new origin element.
|
---|
| 102 | */
|
---|
| 103 | setOrigin(origin: ElementRef): this;
|
---|
| 104 | }
|
---|