source: trip-planner-front/node_modules/@angular/cdk/esm2015/overlay/position/connected-position-strategy.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 19.1 KB
Line 
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 */
8import { ConnectionPositionPair, } from './connected-position';
9import { FlexibleConnectedPositionStrategy } from './flexible-connected-position-strategy';
10/**
11 * A strategy for positioning overlays. Using this strategy, an overlay is given an
12 * implicit position relative to some origin element. The relative position is defined in terms of
13 * a point on the origin element that is connected to a point on the overlay element. For example,
14 * a basic dropdown is connecting the bottom-left corner of the origin to the top-left corner
15 * of the overlay.
16 * @deprecated Use `FlexibleConnectedPositionStrategy` instead.
17 * @breaking-change 8.0.0
18 */
19export class ConnectedPositionStrategy {
20 constructor(originPos, overlayPos, connectedTo, viewportRuler, document, platform, overlayContainer) {
21 /** Ordered list of preferred positions, from most to least desirable. */
22 this._preferredPositions = [];
23 // Since the `ConnectedPositionStrategy` is deprecated and we don't want to maintain
24 // the extra logic, we create an instance of the positioning strategy that has some
25 // defaults that make it behave as the old position strategy and to which we'll
26 // proxy all of the API calls.
27 this._positionStrategy = new FlexibleConnectedPositionStrategy(connectedTo, viewportRuler, document, platform, overlayContainer)
28 .withFlexibleDimensions(false)
29 .withPush(false)
30 .withViewportMargin(0);
31 this.withFallbackPosition(originPos, overlayPos);
32 this.onPositionChange = this._positionStrategy.positionChanges;
33 }
34 /** Ordered list of preferred positions, from most to least desirable. */
35 get positions() {
36 return this._preferredPositions;
37 }
38 /** Attach this position strategy to an overlay. */
39 attach(overlayRef) {
40 this._overlayRef = overlayRef;
41 this._positionStrategy.attach(overlayRef);
42 if (this._direction) {
43 overlayRef.setDirection(this._direction);
44 this._direction = null;
45 }
46 }
47 /** Disposes all resources used by the position strategy. */
48 dispose() {
49 this._positionStrategy.dispose();
50 }
51 /** @docs-private */
52 detach() {
53 this._positionStrategy.detach();
54 }
55 /**
56 * Updates the position of the overlay element, using whichever preferred position relative
57 * to the origin fits on-screen.
58 * @docs-private
59 */
60 apply() {
61 this._positionStrategy.apply();
62 }
63 /**
64 * Re-positions the overlay element with the trigger in its last calculated position,
65 * even if a position higher in the "preferred positions" list would now fit. This
66 * allows one to re-align the panel without changing the orientation of the panel.
67 */
68 recalculateLastPosition() {
69 this._positionStrategy.reapplyLastPosition();
70 }
71 /**
72 * Sets the list of Scrollable containers that host the origin element so that
73 * on reposition we can evaluate if it or the overlay has been clipped or outside view. Every
74 * Scrollable must be an ancestor element of the strategy's origin element.
75 */
76 withScrollableContainers(scrollables) {
77 this._positionStrategy.withScrollableContainers(scrollables);
78 }
79 /**
80 * Adds a new preferred fallback position.
81 * @param originPos
82 * @param overlayPos
83 */
84 withFallbackPosition(originPos, overlayPos, offsetX, offsetY) {
85 const position = new ConnectionPositionPair(originPos, overlayPos, offsetX, offsetY);
86 this._preferredPositions.push(position);
87 this._positionStrategy.withPositions(this._preferredPositions);
88 return this;
89 }
90 /**
91 * Sets the layout direction so the overlay's position can be adjusted to match.
92 * @param dir New layout direction.
93 */
94 withDirection(dir) {
95 // Since the direction might be declared before the strategy is attached,
96 // we save the value in a temporary property and we'll transfer it to the
97 // overlay ref on attachment.
98 if (this._overlayRef) {
99 this._overlayRef.setDirection(dir);
100 }
101 else {
102 this._direction = dir;
103 }
104 return this;
105 }
106 /**
107 * Sets an offset for the overlay's connection point on the x-axis
108 * @param offset New offset in the X axis.
109 */
110 withOffsetX(offset) {
111 this._positionStrategy.withDefaultOffsetX(offset);
112 return this;
113 }
114 /**
115 * Sets an offset for the overlay's connection point on the y-axis
116 * @param offset New offset in the Y axis.
117 */
118 withOffsetY(offset) {
119 this._positionStrategy.withDefaultOffsetY(offset);
120 return this;
121 }
122 /**
123 * Sets whether the overlay's position should be locked in after it is positioned
124 * initially. When an overlay is locked in, it won't attempt to reposition itself
125 * when the position is re-applied (e.g. when the user scrolls away).
126 * @param isLocked Whether the overlay should locked in.
127 */
128 withLockedPosition(isLocked) {
129 this._positionStrategy.withLockedPosition(isLocked);
130 return this;
131 }
132 /**
133 * Overwrites the current set of positions with an array of new ones.
134 * @param positions Position pairs to be set on the strategy.
135 */
136 withPositions(positions) {
137 this._preferredPositions = positions.slice();
138 this._positionStrategy.withPositions(this._preferredPositions);
139 return this;
140 }
141 /**
142 * Sets the origin element, relative to which to position the overlay.
143 * @param origin Reference to the new origin element.
144 */
145 setOrigin(origin) {
146 this._positionStrategy.setOrigin(origin);
147 return this;
148 }
149}
150//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29ubmVjdGVkLXBvc2l0aW9uLXN0cmF0ZWd5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2Nkay9vdmVybGF5L3Bvc2l0aW9uL2Nvbm5lY3RlZC1wb3NpdGlvbi1zdHJhdGVneS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFXSCxPQUFPLEVBRUwsc0JBQXNCLEdBR3ZCLE1BQU0sc0JBQXNCLENBQUM7QUFDOUIsT0FBTyxFQUFDLGlDQUFpQyxFQUFDLE1BQU0sd0NBQXdDLENBQUM7QUFHekY7Ozs7Ozs7O0dBUUc7QUFDSCxNQUFNLE9BQU8seUJBQXlCO0lBa0JwQyxZQUNJLFNBQW1DLEVBQUUsVUFBcUMsRUFDMUUsV0FBb0MsRUFBRSxhQUE0QixFQUFFLFFBQWtCLEVBQ3RGLFFBQWtCLEVBQUUsZ0JBQWtDO1FBVDFELHlFQUF5RTtRQUN6RSx3QkFBbUIsR0FBNkIsRUFBRSxDQUFDO1FBU2pELG9GQUFvRjtRQUNwRixtRkFBbUY7UUFDbkYsK0VBQStFO1FBQy9FLDhCQUE4QjtRQUM5QixJQUFJLEN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