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 { ElementRef } from '@angular/core';
|
---|
9 | import { ConnectedOverlayPositionChange, validateHorizontalPosition, validateVerticalPosition, } from './connected-position';
|
---|
10 | import { Subscription, Subject } from 'rxjs';
|
---|
11 | import { isElementScrolledOutsideView, isElementClippedByScrolling } from './scroll-clip';
|
---|
12 | import { coerceCssPixelValue, coerceArray } from '@angular/cdk/coercion';
|
---|
13 | // TODO: refactor clipping detection into a separate thing (part of scrolling module)
|
---|
14 | // TODO: doesn't handle both flexible width and height when it has to scroll along both axis.
|
---|
15 | /** Class to be added to the overlay bounding box. */
|
---|
16 | const boundingBoxClass = 'cdk-overlay-connected-position-bounding-box';
|
---|
17 | /** Regex used to split a string on its CSS units. */
|
---|
18 | const cssUnitPattern = /([A-Za-z%]+)$/;
|
---|
19 | /**
|
---|
20 | * A strategy for positioning overlays. Using this strategy, an overlay is given an
|
---|
21 | * implicit position relative some origin element. The relative position is defined in terms of
|
---|
22 | * a point on the origin element that is connected to a point on the overlay element. For example,
|
---|
23 | * a basic dropdown is connecting the bottom-left corner of the origin to the top-left corner
|
---|
24 | * of the overlay.
|
---|
25 | */
|
---|
26 | export class FlexibleConnectedPositionStrategy {
|
---|
27 | constructor(connectedTo, _viewportRuler, _document, _platform, _overlayContainer) {
|
---|
28 | this._viewportRuler = _viewportRuler;
|
---|
29 | this._document = _document;
|
---|
30 | this._platform = _platform;
|
---|
31 | this._overlayContainer = _overlayContainer;
|
---|
32 | /** Last size used for the bounding box. Used to avoid resizing the overlay after open. */
|
---|
33 | this._lastBoundingBoxSize = { width: 0, height: 0 };
|
---|
34 | /** Whether the overlay was pushed in a previous positioning. */
|
---|
35 | this._isPushed = false;
|
---|
36 | /** Whether the overlay can be pushed on-screen on the initial open. */
|
---|
37 | this._canPush = true;
|
---|
38 | /** Whether the overlay can grow via flexible width/height after the initial open. */
|
---|
39 | this._growAfterOpen = false;
|
---|
40 | /** Whether the overlay's width and height can be constrained to fit within the viewport. */
|
---|
41 | this._hasFlexibleDimensions = true;
|
---|
42 | /** Whether the overlay position is locked. */
|
---|
43 | this._positionLocked = false;
|
---|
44 | /** Amount of space that must be maintained between the overlay and the edge of the viewport. */
|
---|
45 | this._viewportMargin = 0;
|
---|
46 | /** The Scrollable containers used to check scrollable view properties on position change. */
|
---|
47 | this._scrollables = [];
|
---|
48 | /** Ordered list of preferred positions, from most to least desirable. */
|
---|
49 | this._preferredPositions = [];
|
---|
50 | /** Subject that emits whenever the position changes. */
|
---|
51 | this._positionChanges = new Subject();
|
---|
52 | /** Subscription to viewport size changes. */
|
---|
53 | this._resizeSubscription = Subscription.EMPTY;
|
---|
54 | /** Default offset for the overlay along the x axis. */
|
---|
55 | this._offsetX = 0;
|
---|
56 | /** Default offset for the overlay along the y axis. */
|
---|
57 | this._offsetY = 0;
|
---|
58 | /** Keeps track of the CSS classes that the position strategy has applied on the overlay panel. */
|
---|
59 | this._appliedPanelClasses = [];
|
---|
60 | /** Observable sequence of position changes. */
|
---|
61 | this.positionChanges = this._positionChanges;
|
---|
62 | this.setOrigin(connectedTo);
|
---|
63 | }
|
---|
64 | /** Ordered list of preferred positions, from most to least desirable. */
|
---|
65 | get positions() {
|
---|
66 | return this._preferredPositions;
|
---|
67 | }
|
---|
68 | /** Attaches this position strategy to an overlay. */
|
---|
69 | attach(overlayRef) {
|
---|
70 | if (this._overlayRef && overlayRef !== this._overlayRef &&
|
---|
71 | (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
---|
72 | throw Error('This position strategy is already attached to an overlay');
|
---|
73 | }
|
---|
74 | this._validatePositions();
|
---|
75 | overlayRef.hostElement.classList.add(boundingBoxClass);
|
---|
76 | this._overlayRef = overlayRef;
|
---|
77 | this._boundingBox = overlayRef.hostElement;
|
---|
78 | this._pane = overlayRef.overlayElement;
|
---|
79 | this._isDisposed = false;
|
---|
80 | this._isInitialRender = true;
|
---|
81 | this._lastPosition = null;
|
---|
82 | this._resizeSubscription.unsubscribe();
|
---|
83 | this._resizeSubscription = this._viewportRuler.change().subscribe(() => {
|
---|
84 | // When the window is resized, we want to trigger the next reposition as if it
|
---|
85 | // was an initial render, in order for the strategy to pick a new optimal position,
|
---|
86 | // otherwise position locking will cause it to stay at the old one.
|
---|
87 | this._isInitialRender = true;
|
---|
88 | this.apply();
|
---|
89 | });
|
---|
90 | }
|
---|
91 | /**
|
---|
92 | * Updates the position of the overlay element, using whichever preferred position relative
|
---|
93 | * to the origin best fits on-screen.
|
---|
94 | *
|
---|
95 | * The selection of a position goes as follows:
|
---|
96 | * - If any positions fit completely within the viewport as-is,
|
---|
97 | * choose the first position that does so.
|
---|
98 | * - If flexible dimensions are enabled and at least one satifies the given minimum width/height,
|
---|
99 | * choose the position with the greatest available size modified by the positions' weight.
|
---|
100 | * - If pushing is enabled, take the position that went off-screen the least and push it
|
---|
101 | * on-screen.
|
---|
102 | * - If none of the previous criteria were met, use the position that goes off-screen the least.
|
---|
103 | * @docs-private
|
---|
104 | */
|
---|
105 | apply() {
|
---|
106 | // We shouldn't do anything if the strategy was disposed or we're on the server.
|
---|
107 | if (this._isDisposed || !this._platform.isBrowser) {
|
---|
108 | return;
|
---|
109 | }
|
---|
110 | // If the position has been applied already (e.g. when the overlay was opened) and the
|
---|
111 | // consumer opted into locking in the position, re-use the old position, in order to
|
---|
112 | // prevent the overlay from jumping around.
|
---|
113 | if (!this._isInitialRender && this._positionLocked && this._lastPosition) {
|
---|
114 | this.reapplyLastPosition();
|
---|
115 | return;
|
---|
116 | }
|
---|
117 | this._clearPanelClasses();
|
---|
118 | this._resetOverlayElementStyles();
|
---|
119 | this._resetBoundingBoxStyles();
|
---|
120 | // We need the bounding rects for the origin and the overlay to determine how to position
|
---|
121 | // the overlay relative to the origin.
|
---|
122 | // We use the viewport rect to determine whether a position would go off-screen.
|
---|
123 | this._viewportRect = this._getNarrowedViewportRect();
|
---|
124 | this._originRect = this._getOriginRect();
|
---|
125 | this._overlayRect = this._pane.getBoundingClientRect();
|
---|
126 | const originRect = this._originRect;
|
---|
127 | const overlayRect = this._overlayRect;
|
---|
128 | const viewportRect = this._viewportRect;
|
---|
129 | // Positions where the overlay will fit with flexible dimensions.
|
---|
130 | const flexibleFits = [];
|
---|
131 | // Fallback if none of the preferred positions fit within the viewport.
|
---|
132 | let fallback;
|
---|
133 | // Go through each of the preferred positions looking for a good fit.
|
---|
134 | // If a good fit is found, it will be applied immediately.
|
---|
135 | for (let pos of this._preferredPositions) {
|
---|
136 | // Get the exact (x, y) coordinate for the point-of-origin on the origin element.
|
---|
137 | let originPoint = this._getOriginPoint(originRect, pos);
|
---|
138 | // From that point-of-origin, get the exact (x, y) coordinate for the top-left corner of the
|
---|
139 | // overlay in this position. We use the top-left corner for calculations and later translate
|
---|
140 | // this into an appropriate (top, left, bottom, right) style.
|
---|
141 | let overlayPoint = this._getOverlayPoint(originPoint, overlayRect, pos);
|
---|
142 | // Calculate how well the overlay would fit into the viewport with this point.
|
---|
143 | let overlayFit = this._getOverlayFit(overlayPoint, overlayRect, viewportRect, pos);
|
---|
144 | // If the overlay, without any further work, fits into the viewport, use this position.
|
---|
145 | if (overlayFit.isCompletelyWithinViewport) {
|
---|
146 | this._isPushed = false;
|
---|
147 | this._applyPosition(pos, originPoint);
|
---|
148 | return;
|
---|
149 | }
|
---|
150 | // If the overlay has flexible dimensions, we can use this position
|
---|
151 | // so long as there's enough space for the minimum dimensions.
|
---|
152 | if (this._canFitWithFlexibleDimensions(overlayFit, overlayPoint, viewportRect)) {
|
---|
153 | // Save positions where the overlay will fit with flexible dimensions. We will use these
|
---|
154 | // if none of the positions fit *without* flexible dimensions.
|
---|
155 | flexibleFits.push({
|
---|
156 | position: pos,
|
---|
157 | origin: originPoint,
|
---|
158 | overlayRect,
|
---|
159 | boundingBoxRect: this._calculateBoundingBoxRect(originPoint, pos)
|
---|
160 | });
|
---|
161 | continue;
|
---|
162 | }
|
---|
163 | // If the current preferred position does not fit on the screen, remember the position
|
---|
164 | // if it has more visible area on-screen than we've seen and move onto the next preferred
|
---|
165 | // position.
|
---|
166 | if (!fallback || fallback.overlayFit.visibleArea < overlayFit.visibleArea) {
|
---|
167 | fallback = { overlayFit, overlayPoint, originPoint, position: pos, overlayRect };
|
---|
168 | }
|
---|
169 | }
|
---|
170 | // If there are any positions where the overlay would fit with flexible dimensions, choose the
|
---|
171 | // one that has the greatest area available modified by the position's weight
|
---|
172 | if (flexibleFits.length) {
|
---|
173 | let bestFit = null;
|
---|
174 | let bestScore = -1;
|
---|
175 | for (const fit of flexibleFits) {
|
---|
176 | const score = fit.boundingBoxRect.width * fit.boundingBoxRect.height * (fit.position.weight || 1);
|
---|
177 | if (score > bestScore) {
|
---|
178 | bestScore = score;
|
---|
179 | bestFit = fit;
|
---|
180 | }
|
---|
181 | }
|
---|
182 | this._isPushed = false;
|
---|
183 | this._applyPosition(bestFit.position, bestFit.origin);
|
---|
184 | return;
|
---|
185 | }
|
---|
186 | // When none of the preferred positions fit within the viewport, take the position
|
---|
187 | // that went off-screen the least and attempt to push it on-screen.
|
---|
188 | if (this._canPush) {
|
---|
189 | // TODO(jelbourn): after pushing, the opening "direction" of the overlay might not make sense.
|
---|
190 | this._isPushed = true;
|
---|
191 | this._applyPosition(fallback.position, fallback.originPoint);
|
---|
192 | return;
|
---|
193 | }
|
---|
194 | // All options for getting the overlay within the viewport have been exhausted, so go with the
|
---|
195 | // position that went off-screen the least.
|
---|
196 | this._applyPosition(fallback.position, fallback.originPoint);
|
---|
197 | }
|
---|
198 | detach() {
|
---|
199 | this._clearPanelClasses();
|
---|
200 | this._lastPosition = null;
|
---|
201 | this._previousPushAmount = null;
|
---|
202 | this._resizeSubscription.unsubscribe();
|
---|
203 | }
|
---|
204 | /** Cleanup after the element gets destroyed. */
|
---|
205 | dispose() {
|
---|
206 | if (this._isDisposed) {
|
---|
207 | return;
|
---|
208 | }
|
---|
209 | // We can't use `_resetBoundingBoxStyles` here, because it resets
|
---|
210 | // some properties to zero, rather than removing them.
|
---|
211 | if (this._boundingBox) {
|
---|
212 | extendStyles(this._boundingBox.style, {
|
---|
213 | top: '',
|
---|
214 | left: '',
|
---|
215 | right: '',
|
---|
216 | bottom: '',
|
---|
217 | height: '',
|
---|
218 | width: '',
|
---|
219 | alignItems: '',
|
---|
220 | justifyContent: '',
|
---|
221 | });
|
---|
222 | }
|
---|
223 | if (this._pane) {
|
---|
224 | this._resetOverlayElementStyles();
|
---|
225 | }
|
---|
226 | if (this._overlayRef) {
|
---|
227 | this._overlayRef.hostElement.classList.remove(boundingBoxClass);
|
---|
228 | }
|
---|
229 | this.detach();
|
---|
230 | this._positionChanges.complete();
|
---|
231 | this._overlayRef = this._boundingBox = null;
|
---|
232 | this._isDisposed = true;
|
---|
233 | }
|
---|
234 | /**
|
---|
235 | * This re-aligns the overlay element with the trigger in its last calculated position,
|
---|
236 | * even if a position higher in the "preferred positions" list would now fit. This
|
---|
237 | * allows one to re-align the panel without changing the orientation of the panel.
|
---|
238 | */
|
---|
239 | reapplyLastPosition() {
|
---|
240 | if (!this._isDisposed && (!this._platform || this._platform.isBrowser)) {
|
---|
241 | this._originRect = this._getOriginRect();
|
---|
242 | this._overlayRect = this._pane.getBoundingClientRect();
|
---|
243 | this._viewportRect = this._getNarrowedViewportRect();
|
---|
244 | const lastPosition = this._lastPosition || this._preferredPositions[0];
|
---|
245 | const originPoint = this._getOriginPoint(this._originRect, lastPosition);
|
---|
246 | this._applyPosition(lastPosition, originPoint);
|
---|
247 | }
|
---|
248 | }
|
---|
249 | /**
|
---|
250 | * Sets the list of Scrollable containers that host the origin element so that
|
---|
251 | * on reposition we can evaluate if it or the overlay has been clipped or outside view. Every
|
---|
252 | * Scrollable must be an ancestor element of the strategy's origin element.
|
---|
253 | */
|
---|
254 | withScrollableContainers(scrollables) {
|
---|
255 | this._scrollables = scrollables;
|
---|
256 | return this;
|
---|
257 | }
|
---|
258 | /**
|
---|
259 | * Adds new preferred positions.
|
---|
260 | * @param positions List of positions options for this overlay.
|
---|
261 | */
|
---|
262 | withPositions(positions) {
|
---|
263 | this._preferredPositions = positions;
|
---|
264 | // If the last calculated position object isn't part of the positions anymore, clear
|
---|
265 | // it in order to avoid it being picked up if the consumer tries to re-apply.
|
---|
266 | if (positions.indexOf(this._lastPosition) === -1) {
|
---|
267 | this._lastPosition = null;
|
---|
268 | }
|
---|
269 | this._validatePositions();
|
---|
270 | return this;
|
---|
271 | }
|
---|
272 | /**
|
---|
273 | * Sets a minimum distance the overlay may be positioned to the edge of the viewport.
|
---|
274 | * @param margin Required margin between the overlay and the viewport edge in pixels.
|
---|
275 | */
|
---|
276 | withViewportMargin(margin) {
|
---|
277 | this._viewportMargin = margin;
|
---|
278 | return this;
|
---|
279 | }
|
---|
280 | /** Sets whether the overlay's width and height can be constrained to fit within the viewport. */
|
---|
281 | withFlexibleDimensions(flexibleDimensions = true) {
|
---|
282 | this._hasFlexibleDimensions = flexibleDimensions;
|
---|
283 | return this;
|
---|
284 | }
|
---|
285 | /** Sets whether the overlay can grow after the initial open via flexible width/height. */
|
---|
286 | withGrowAfterOpen(growAfterOpen = true) {
|
---|
287 | this._growAfterOpen = growAfterOpen;
|
---|
288 | return this;
|
---|
289 | }
|
---|
290 | /** Sets whether the overlay can be pushed on-screen if none of the provided positions fit. */
|
---|
291 | withPush(canPush = true) {
|
---|
292 | this._canPush = canPush;
|
---|
293 | return this;
|
---|
294 | }
|
---|
295 | /**
|
---|
296 | * Sets whether the overlay's position should be locked in after it is positioned
|
---|
297 | * initially. When an overlay is locked in, it won't attempt to reposition itself
|
---|
298 | * when the position is re-applied (e.g. when the user scrolls away).
|
---|
299 | * @param isLocked Whether the overlay should locked in.
|
---|
300 | */
|
---|
301 | withLockedPosition(isLocked = true) {
|
---|
302 | this._positionLocked = isLocked;
|
---|
303 | return this;
|
---|
304 | }
|
---|
305 | /**
|
---|
306 | * Sets the origin, relative to which to position the overlay.
|
---|
307 | * Using an element origin is useful for building components that need to be positioned
|
---|
308 | * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
|
---|
309 | * used for cases like contextual menus which open relative to the user's pointer.
|
---|
310 | * @param origin Reference to the new origin.
|
---|
311 | */
|
---|
312 | setOrigin(origin) {
|
---|
313 | this._origin = origin;
|
---|
314 | return this;
|
---|
315 | }
|
---|
316 | /**
|
---|
317 | * Sets the default offset for the overlay's connection point on the x-axis.
|
---|
318 | * @param offset New offset in the X axis.
|
---|
319 | */
|
---|
320 | withDefaultOffsetX(offset) {
|
---|
321 | this._offsetX = offset;
|
---|
322 | return this;
|
---|
323 | }
|
---|
324 | /**
|
---|
325 | * Sets the default offset for the overlay's connection point on the y-axis.
|
---|
326 | * @param offset New offset in the Y axis.
|
---|
327 | */
|
---|
328 | withDefaultOffsetY(offset) {
|
---|
329 | this._offsetY = offset;
|
---|
330 | return this;
|
---|
331 | }
|
---|
332 | /**
|
---|
333 | * Configures that the position strategy should set a `transform-origin` on some elements
|
---|
334 | * inside the overlay, depending on the current position that is being applied. This is
|
---|
335 | * useful for the cases where the origin of an animation can change depending on the
|
---|
336 | * alignment of the overlay.
|
---|
337 | * @param selector CSS selector that will be used to find the target
|
---|
338 | * elements onto which to set the transform origin.
|
---|
339 | */
|
---|
340 | withTransformOriginOn(selector) {
|
---|
341 | this._transformOriginSelector = selector;
|
---|
342 | return this;
|
---|
343 | }
|
---|
344 | /**
|
---|
345 | * Gets the (x, y) coordinate of a connection point on the origin based on a relative position.
|
---|
346 | */
|
---|
347 | _getOriginPoint(originRect, pos) {
|
---|
348 | let x;
|
---|
349 | if (pos.originX == 'center') {
|
---|
350 | // Note: when centering we should always use the `left`
|
---|
351 | // offset, otherwise the position will be wrong in RTL.
|
---|
352 | x = originRect.left + (originRect.width / 2);
|
---|
353 | }
|
---|
354 | else {
|
---|
355 | const startX = this._isRtl() ? originRect.right : originRect.left;
|
---|
356 | const endX = this._isRtl() ? originRect.left : originRect.right;
|
---|
357 | x = pos.originX == 'start' ? startX : endX;
|
---|
358 | }
|
---|
359 | let y;
|
---|
360 | if (pos.originY == 'center') {
|
---|
361 | y = originRect.top + (originRect.height / 2);
|
---|
362 | }
|
---|
363 | else {
|
---|
364 | y = pos.originY == 'top' ? originRect.top : originRect.bottom;
|
---|
365 | }
|
---|
366 | return { x, y };
|
---|
367 | }
|
---|
368 | /**
|
---|
369 | * Gets the (x, y) coordinate of the top-left corner of the overlay given a given position and
|
---|
370 | * origin point to which the overlay should be connected.
|
---|
371 | */
|
---|
372 | _getOverlayPoint(originPoint, overlayRect, pos) {
|
---|
373 | // Calculate the (overlayStartX, overlayStartY), the start of the
|
---|
374 | // potential overlay position relative to the origin point.
|
---|
375 | let overlayStartX;
|
---|
376 | if (pos.overlayX == 'center') {
|
---|
377 | overlayStartX = -overlayRect.width / 2;
|
---|
378 | }
|
---|
379 | else if (pos.overlayX === 'start') {
|
---|
380 | overlayStartX = this._isRtl() ? -overlayRect.width : 0;
|
---|
381 | }
|
---|
382 | else {
|
---|
383 | overlayStartX = this._isRtl() ? 0 : -overlayRect.width;
|
---|
384 | }
|
---|
385 | let overlayStartY;
|
---|
386 | if (pos.overlayY == 'center') {
|
---|
387 | overlayStartY = -overlayRect.height / 2;
|
---|
388 | }
|
---|
389 | else {
|
---|
390 | overlayStartY = pos.overlayY == 'top' ? 0 : -overlayRect.height;
|
---|
391 | }
|
---|
392 | // The (x, y) coordinates of the overlay.
|
---|
393 | return {
|
---|
394 | x: originPoint.x + overlayStartX,
|
---|
395 | y: originPoint.y + overlayStartY,
|
---|
396 | };
|
---|
397 | }
|
---|
398 | /** Gets how well an overlay at the given point will fit within the viewport. */
|
---|
399 | _getOverlayFit(point, rawOverlayRect, viewport, position) {
|
---|
400 | // Round the overlay rect when comparing against the
|
---|
401 | // viewport, because the viewport is always rounded.
|
---|
402 | const overlay = getRoundedBoundingClientRect(rawOverlayRect);
|
---|
403 | let { x, y } = point;
|
---|
404 | let offsetX = this._getOffset(position, 'x');
|
---|
405 | let offsetY = this._getOffset(position, 'y');
|
---|
406 | // Account for the offsets since they could push the overlay out of the viewport.
|
---|
407 | if (offsetX) {
|
---|
408 | x += offsetX;
|
---|
409 | }
|
---|
410 | if (offsetY) {
|
---|
411 | y += offsetY;
|
---|
412 | }
|
---|
413 | // How much the overlay would overflow at this position, on each side.
|
---|
414 | let leftOverflow = 0 - x;
|
---|
415 | let rightOverflow = (x + overlay.width) - viewport.width;
|
---|
416 | let topOverflow = 0 - y;
|
---|
417 | let bottomOverflow = (y + overlay.height) - viewport.height;
|
---|
418 | // Visible parts of the element on each axis.
|
---|
419 | let visibleWidth = this._subtractOverflows(overlay.width, leftOverflow, rightOverflow);
|
---|
420 | let visibleHeight = this._subtractOverflows(overlay.height, topOverflow, bottomOverflow);
|
---|
421 | let visibleArea = visibleWidth * visibleHeight;
|
---|
422 | return {
|
---|
423 | visibleArea,
|
---|
424 | isCompletelyWithinViewport: (overlay.width * overlay.height) === visibleArea,
|
---|
425 | fitsInViewportVertically: visibleHeight === overlay.height,
|
---|
426 | fitsInViewportHorizontally: visibleWidth == overlay.width,
|
---|
427 | };
|
---|
428 | }
|
---|
429 | /**
|
---|
430 | * Whether the overlay can fit within the viewport when it may resize either its width or height.
|
---|
431 | * @param fit How well the overlay fits in the viewport at some position.
|
---|
432 | * @param point The (x, y) coordinates of the overlat at some position.
|
---|
433 | * @param viewport The geometry of the viewport.
|
---|
434 | */
|
---|
435 | _canFitWithFlexibleDimensions(fit, point, viewport) {
|
---|
436 | if (this._hasFlexibleDimensions) {
|
---|
437 | const availableHeight = viewport.bottom - point.y;
|
---|
438 | const availableWidth = viewport.right - point.x;
|
---|
439 | const minHeight = getPixelValue(this._overlayRef.getConfig().minHeight);
|
---|
440 | const minWidth = getPixelValue(this._overlayRef.getConfig().minWidth);
|
---|
441 | const verticalFit = fit.fitsInViewportVertically ||
|
---|
442 | (minHeight != null && minHeight <= availableHeight);
|
---|
443 | const horizontalFit = fit.fitsInViewportHorizontally ||
|
---|
444 | (minWidth != null && minWidth <= availableWidth);
|
---|
445 | return verticalFit && horizontalFit;
|
---|
446 | }
|
---|
447 | return false;
|
---|
448 | }
|
---|
449 | /**
|
---|
450 | * Gets the point at which the overlay can be "pushed" on-screen. If the overlay is larger than
|
---|
451 | * the viewport, the top-left corner will be pushed on-screen (with overflow occuring on the
|
---|
452 | * right and bottom).
|
---|
453 | *
|
---|
454 | * @param start Starting point from which the overlay is pushed.
|
---|
455 | * @param overlay Dimensions of the overlay.
|
---|
456 | * @param scrollPosition Current viewport scroll position.
|
---|
457 | * @returns The point at which to position the overlay after pushing. This is effectively a new
|
---|
458 | * originPoint.
|
---|
459 | */
|
---|
460 | _pushOverlayOnScreen(start, rawOverlayRect, scrollPosition) {
|
---|
461 | // If the position is locked and we've pushed the overlay already, reuse the previous push
|
---|
462 | // amount, rather than pushing it again. If we were to continue pushing, the element would
|
---|
463 | // remain in the viewport, which goes against the expectations when position locking is enabled.
|
---|
464 | if (this._previousPushAmount && this._positionLocked) {
|
---|
465 | return {
|
---|
466 | x: start.x + this._previousPushAmount.x,
|
---|
467 | y: start.y + this._previousPushAmount.y
|
---|
468 | };
|
---|
469 | }
|
---|
470 | // Round the overlay rect when comparing against the
|
---|
471 | // viewport, because the viewport is always rounded.
|
---|
472 | const overlay = getRoundedBoundingClientRect(rawOverlayRect);
|
---|
473 | const viewport = this._viewportRect;
|
---|
474 | // Determine how much the overlay goes outside the viewport on each
|
---|
475 | // side, which we'll use to decide which direction to push it.
|
---|
476 | const overflowRight = Math.max(start.x + overlay.width - viewport.width, 0);
|
---|
477 | const overflowBottom = Math.max(start.y + overlay.height - viewport.height, 0);
|
---|
478 | const overflowTop = Math.max(viewport.top - scrollPosition.top - start.y, 0);
|
---|
479 | const overflowLeft = Math.max(viewport.left - scrollPosition.left - start.x, 0);
|
---|
480 | // Amount by which to push the overlay in each axis such that it remains on-screen.
|
---|
481 | let pushX = 0;
|
---|
482 | let pushY = 0;
|
---|
483 | // If the overlay fits completely within the bounds of the viewport, push it from whichever
|
---|
484 | // direction is goes off-screen. Otherwise, push the top-left corner such that its in the
|
---|
485 | // viewport and allow for the trailing end of the overlay to go out of bounds.
|
---|
486 | if (overlay.width <= viewport.width) {
|
---|
487 | pushX = overflowLeft || -overflowRight;
|
---|
488 | }
|
---|
489 | else {
|
---|
490 | pushX = start.x < this._viewportMargin ? (viewport.left - scrollPosition.left) - start.x : 0;
|
---|
491 | }
|
---|
492 | if (overlay.height <= viewport.height) {
|
---|
493 | pushY = overflowTop || -overflowBottom;
|
---|
494 | }
|
---|
495 | else {
|
---|
496 | pushY = start.y < this._viewportMargin ? (viewport.top - scrollPosition.top) - start.y : 0;
|
---|
497 | }
|
---|
498 | this._previousPushAmount = { x: pushX, y: pushY };
|
---|
499 | return {
|
---|
500 | x: start.x + pushX,
|
---|
501 | y: start.y + pushY,
|
---|
502 | };
|
---|
503 | }
|
---|
504 | /**
|
---|
505 | * Applies a computed position to the overlay and emits a position change.
|
---|
506 | * @param position The position preference
|
---|
507 | * @param originPoint The point on the origin element where the overlay is connected.
|
---|
508 | */
|
---|
509 | _applyPosition(position, originPoint) {
|
---|
510 | this._setTransformOrigin(position);
|
---|
511 | this._setOverlayElementStyles(originPoint, position);
|
---|
512 | this._setBoundingBoxStyles(originPoint, position);
|
---|
513 | if (position.panelClass) {
|
---|
514 | this._addPanelClasses(position.panelClass);
|
---|
515 | }
|
---|
516 | // Save the last connected position in case the position needs to be re-calculated.
|
---|
517 | this._lastPosition = position;
|
---|
518 | // Notify that the position has been changed along with its change properties.
|
---|
519 | // We only emit if we've got any subscriptions, because the scroll visibility
|
---|
520 | // calculcations can be somewhat expensive.
|
---|
521 | if (this._positionChanges.observers.length) {
|
---|
522 | const scrollableViewProperties = this._getScrollVisibility();
|
---|
523 | const changeEvent = new ConnectedOverlayPositionChange(position, scrollableViewProperties);
|
---|
524 | this._positionChanges.next(changeEvent);
|
---|
525 | }
|
---|
526 | this._isInitialRender = false;
|
---|
527 | }
|
---|
528 | /** Sets the transform origin based on the configured selector and the passed-in position. */
|
---|
529 | _setTransformOrigin(position) {
|
---|
530 | if (!this._transformOriginSelector) {
|
---|
531 | return;
|
---|
532 | }
|
---|
533 | const elements = this._boundingBox.querySelectorAll(this._transformOriginSelector);
|
---|
534 | let xOrigin;
|
---|
535 | let yOrigin = position.overlayY;
|
---|
536 | if (position.overlayX === 'center') {
|
---|
537 | xOrigin = 'center';
|
---|
538 | }
|
---|
539 | else if (this._isRtl()) {
|
---|
540 | xOrigin = position.overlayX === 'start' ? 'right' : 'left';
|
---|
541 | }
|
---|
542 | else {
|
---|
543 | xOrigin = position.overlayX === 'start' ? 'left' : 'right';
|
---|
544 | }
|
---|
545 | for (let i = 0; i < elements.length; i++) {
|
---|
546 | elements[i].style.transformOrigin = `${xOrigin} ${yOrigin}`;
|
---|
547 | }
|
---|
548 | }
|
---|
549 | /**
|
---|
550 | * Gets the position and size of the overlay's sizing container.
|
---|
551 | *
|
---|
552 | * This method does no measuring and applies no styles so that we can cheaply compute the
|
---|
553 | * bounds for all positions and choose the best fit based on these results.
|
---|
554 | */
|
---|
555 | _calculateBoundingBoxRect(origin, position) {
|
---|
556 | const viewport = this._viewportRect;
|
---|
557 | const isRtl = this._isRtl();
|
---|
558 | let height, top, bottom;
|
---|
559 | if (position.overlayY === 'top') {
|
---|
560 | // Overlay is opening "downward" and thus is bound by the bottom viewport edge.
|
---|
561 | top = origin.y;
|
---|
562 | height = viewport.height - top + this._viewportMargin;
|
---|
563 | }
|
---|
564 | else if (position.overlayY === 'bottom') {
|
---|
565 | // Overlay is opening "upward" and thus is bound by the top viewport edge. We need to add
|
---|
566 | // the viewport margin back in, because the viewport rect is narrowed down to remove the
|
---|
567 | // margin, whereas the `origin` position is calculated based on its `ClientRect`.
|
---|
568 | bottom = viewport.height - origin.y + this._viewportMargin * 2;
|
---|
569 | height = viewport.height - bottom + this._viewportMargin;
|
---|
570 | }
|
---|
571 | else {
|
---|
572 | // If neither top nor bottom, it means that the overlay is vertically centered on the
|
---|
573 | // origin point. Note that we want the position relative to the viewport, rather than
|
---|
574 | // the page, which is why we don't use something like `viewport.bottom - origin.y` and
|
---|
575 | // `origin.y - viewport.top`.
|
---|
576 | const smallestDistanceToViewportEdge = Math.min(viewport.bottom - origin.y + viewport.top, origin.y);
|
---|
577 | const previousHeight = this._lastBoundingBoxSize.height;
|
---|
578 | height = smallestDistanceToViewportEdge * 2;
|
---|
579 | top = origin.y - smallestDistanceToViewportEdge;
|
---|
580 | if (height > previousHeight && !this._isInitialRender && !this._growAfterOpen) {
|
---|
581 | top = origin.y - (previousHeight / 2);
|
---|
582 | }
|
---|
583 | }
|
---|
584 | // The overlay is opening 'right-ward' (the content flows to the right).
|
---|
585 | const isBoundedByRightViewportEdge = (position.overlayX === 'start' && !isRtl) ||
|
---|
586 | (position.overlayX === 'end' && isRtl);
|
---|
587 | // The overlay is opening 'left-ward' (the content flows to the left).
|
---|
588 | const isBoundedByLeftViewportEdge = (position.overlayX === 'end' && !isRtl) ||
|
---|
589 | (position.overlayX === 'start' && isRtl);
|
---|
590 | let width, left, right;
|
---|
591 | if (isBoundedByLeftViewportEdge) {
|
---|
592 | right = viewport.width - origin.x + this._viewportMargin;
|
---|
593 | width = origin.x - this._viewportMargin;
|
---|
594 | }
|
---|
595 | else if (isBoundedByRightViewportEdge) {
|
---|
596 | left = origin.x;
|
---|
597 | width = viewport.right - origin.x;
|
---|
598 | }
|
---|
599 | else {
|
---|
600 | // If neither start nor end, it means that the overlay is horizontally centered on the
|
---|
601 | // origin point. Note that we want the position relative to the viewport, rather than
|
---|
602 | // the page, which is why we don't use something like `viewport.right - origin.x` and
|
---|
603 | // `origin.x - viewport.left`.
|
---|
604 | const smallestDistanceToViewportEdge = Math.min(viewport.right - origin.x + viewport.left, origin.x);
|
---|
605 | const previousWidth = this._lastBoundingBoxSize.width;
|
---|
606 | width = smallestDistanceToViewportEdge * 2;
|
---|
607 | left = origin.x - smallestDistanceToViewportEdge;
|
---|
608 | if (width > previousWidth && !this._isInitialRender && !this._growAfterOpen) {
|
---|
609 | left = origin.x - (previousWidth / 2);
|
---|
610 | }
|
---|
611 | }
|
---|
612 | return { top: top, left: left, bottom: bottom, right: right, width, height };
|
---|
613 | }
|
---|
614 | /**
|
---|
615 | * Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the
|
---|
616 | * origin's connection point and stetches to the bounds of the viewport.
|
---|
617 | *
|
---|
618 | * @param origin The point on the origin element where the overlay is connected.
|
---|
619 | * @param position The position preference
|
---|
620 | */
|
---|
621 | _setBoundingBoxStyles(origin, position) {
|
---|
622 | const boundingBoxRect = this._calculateBoundingBoxRect(origin, position);
|
---|
623 | // It's weird if the overlay *grows* while scrolling, so we take the last size into account
|
---|
624 | // when applying a new size.
|
---|
625 | if (!this._isInitialRender && !this._growAfterOpen) {
|
---|
626 | boundingBoxRect.height = Math.min(boundingBoxRect.height, this._lastBoundingBoxSize.height);
|
---|
627 | boundingBoxRect.width = Math.min(boundingBoxRect.width, this._lastBoundingBoxSize.width);
|
---|
628 | }
|
---|
629 | const styles = {};
|
---|
630 | if (this._hasExactPosition()) {
|
---|
631 | styles.top = styles.left = '0';
|
---|
632 | styles.bottom = styles.right = styles.maxHeight = styles.maxWidth = '';
|
---|
633 | styles.width = styles.height = '100%';
|
---|
634 | }
|
---|
635 | else {
|
---|
636 | const maxHeight = this._overlayRef.getConfig().maxHeight;
|
---|
637 | const maxWidth = this._overlayRef.getConfig().maxWidth;
|
---|
638 | styles.height = coerceCssPixelValue(boundingBoxRect.height);
|
---|
639 | styles.top = coerceCssPixelValue(boundingBoxRect.top);
|
---|
640 | styles.bottom = coerceCssPixelValue(boundingBoxRect.bottom);
|
---|
641 | styles.width = coerceCssPixelValue(boundingBoxRect.width);
|
---|
642 | styles.left = coerceCssPixelValue(boundingBoxRect.left);
|
---|
643 | styles.right = coerceCssPixelValue(boundingBoxRect.right);
|
---|
644 | // Push the pane content towards the proper direction.
|
---|
645 | if (position.overlayX === 'center') {
|
---|
646 | styles.alignItems = 'center';
|
---|
647 | }
|
---|
648 | else {
|
---|
649 | styles.alignItems = position.overlayX === 'end' ? 'flex-end' : 'flex-start';
|
---|
650 | }
|
---|
651 | if (position.overlayY === 'center') {
|
---|
652 | styles.justifyContent = 'center';
|
---|
653 | }
|
---|
654 | else {
|
---|
655 | styles.justifyContent = position.overlayY === 'bottom' ? 'flex-end' : 'flex-start';
|
---|
656 | }
|
---|
657 | if (maxHeight) {
|
---|
658 | styles.maxHeight = coerceCssPixelValue(maxHeight);
|
---|
659 | }
|
---|
660 | if (maxWidth) {
|
---|
661 | styles.maxWidth = coerceCssPixelValue(maxWidth);
|
---|
662 | }
|
---|
663 | }
|
---|
664 | this._lastBoundingBoxSize = boundingBoxRect;
|
---|
665 | extendStyles(this._boundingBox.style, styles);
|
---|
666 | }
|
---|
667 | /** Resets the styles for the bounding box so that a new positioning can be computed. */
|
---|
668 | _resetBoundingBoxStyles() {
|
---|
669 | extendStyles(this._boundingBox.style, {
|
---|
670 | top: '0',
|
---|
671 | left: '0',
|
---|
672 | right: '0',
|
---|
673 | bottom: '0',
|
---|
674 | height: '',
|
---|
675 | width: '',
|
---|
676 | alignItems: '',
|
---|
677 | justifyContent: '',
|
---|
678 | });
|
---|
679 | }
|
---|
680 | /** Resets the styles for the overlay pane so that a new positioning can be computed. */
|
---|
681 | _resetOverlayElementStyles() {
|
---|
682 | extendStyles(this._pane.style, {
|
---|
683 | top: '',
|
---|
684 | left: '',
|
---|
685 | bottom: '',
|
---|
686 | right: '',
|
---|
687 | position: '',
|
---|
688 | transform: '',
|
---|
689 | });
|
---|
690 | }
|
---|
691 | /** Sets positioning styles to the overlay element. */
|
---|
692 | _setOverlayElementStyles(originPoint, position) {
|
---|
693 | const styles = {};
|
---|
694 | const hasExactPosition = this._hasExactPosition();
|
---|
695 | const hasFlexibleDimensions = this._hasFlexibleDimensions;
|
---|
696 | const config = this._overlayRef.getConfig();
|
---|
697 | if (hasExactPosition) {
|
---|
698 | const scrollPosition = this._viewportRuler.getViewportScrollPosition();
|
---|
699 | extendStyles(styles, this._getExactOverlayY(position, originPoint, scrollPosition));
|
---|
700 | extendStyles(styles, this._getExactOverlayX(position, originPoint, scrollPosition));
|
---|
701 | }
|
---|
702 | else {
|
---|
703 | styles.position = 'static';
|
---|
704 | }
|
---|
705 | // Use a transform to apply the offsets. We do this because the `center` positions rely on
|
---|
706 | // being in the normal flex flow and setting a `top` / `left` at all will completely throw
|
---|
707 | // off the position. We also can't use margins, because they won't have an effect in some
|
---|
708 | // cases where the element doesn't have anything to "push off of". Finally, this works
|
---|
709 | // better both with flexible and non-flexible positioning.
|
---|
710 | let transformString = '';
|
---|
711 | let offsetX = this._getOffset(position, 'x');
|
---|
712 | let offsetY = this._getOffset(position, 'y');
|
---|
713 | if (offsetX) {
|
---|
714 | transformString += `translateX(${offsetX}px) `;
|
---|
715 | }
|
---|
716 | if (offsetY) {
|
---|
717 | transformString += `translateY(${offsetY}px)`;
|
---|
718 | }
|
---|
719 | styles.transform = transformString.trim();
|
---|
720 | // If a maxWidth or maxHeight is specified on the overlay, we remove them. We do this because
|
---|
721 | // we need these values to both be set to "100%" for the automatic flexible sizing to work.
|
---|
722 | // The maxHeight and maxWidth are set on the boundingBox in order to enforce the constraint.
|
---|
723 | // Note that this doesn't apply when we have an exact position, in which case we do want to
|
---|
724 | // apply them because they'll be cleared from the bounding box.
|
---|
725 | if (config.maxHeight) {
|
---|
726 | if (hasExactPosition) {
|
---|
727 | styles.maxHeight = coerceCssPixelValue(config.maxHeight);
|
---|
728 | }
|
---|
729 | else if (hasFlexibleDimensions) {
|
---|
730 | styles.maxHeight = '';
|
---|
731 | }
|
---|
732 | }
|
---|
733 | if (config.maxWidth) {
|
---|
734 | if (hasExactPosition) {
|
---|
735 | styles.maxWidth = coerceCssPixelValue(config.maxWidth);
|
---|
736 | }
|
---|
737 | else if (hasFlexibleDimensions) {
|
---|
738 | styles.maxWidth = '';
|
---|
739 | }
|
---|
740 | }
|
---|
741 | extendStyles(this._pane.style, styles);
|
---|
742 | }
|
---|
743 | /** Gets the exact top/bottom for the overlay when not using flexible sizing or when pushing. */
|
---|
744 | _getExactOverlayY(position, originPoint, scrollPosition) {
|
---|
745 | // Reset any existing styles. This is necessary in case the
|
---|
746 | // preferred position has changed since the last `apply`.
|
---|
747 | let styles = { top: '', bottom: '' };
|
---|
748 | let overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);
|
---|
749 | if (this._isPushed) {
|
---|
750 | overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);
|
---|
751 | }
|
---|
752 | let virtualKeyboardOffset = this._overlayContainer.getContainerElement().getBoundingClientRect().top;
|
---|
753 | // Normally this would be zero, however when the overlay is attached to an input (e.g. in an
|
---|
754 | // autocomplete), mobile browsers will shift everything in order to put the input in the middle
|
---|
755 | // of the screen and to make space for the virtual keyboard. We need to account for this offset,
|
---|
756 | // otherwise our positioning will be thrown off.
|
---|
757 | overlayPoint.y -= virtualKeyboardOffset;
|
---|
758 | // We want to set either `top` or `bottom` based on whether the overlay wants to appear
|
---|
759 | // above or below the origin and the direction in which the element will expand.
|
---|
760 | if (position.overlayY === 'bottom') {
|
---|
761 | // When using `bottom`, we adjust the y position such that it is the distance
|
---|
762 | // from the bottom of the viewport rather than the top.
|
---|
763 | const documentHeight = this._document.documentElement.clientHeight;
|
---|
764 | styles.bottom = `${documentHeight - (overlayPoint.y + this._overlayRect.height)}px`;
|
---|
765 | }
|
---|
766 | else {
|
---|
767 | styles.top = coerceCssPixelValue(overlayPoint.y);
|
---|
768 | }
|
---|
769 | return styles;
|
---|
770 | }
|
---|
771 | /** Gets the exact left/right for the overlay when not using flexible sizing or when pushing. */
|
---|
772 | _getExactOverlayX(position, originPoint, scrollPosition) {
|
---|
773 | // Reset any existing styles. This is necessary in case the preferred position has
|
---|
774 | // changed since the last `apply`.
|
---|
775 | let styles = { left: '', right: '' };
|
---|
776 | let overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);
|
---|
777 | if (this._isPushed) {
|
---|
778 | overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);
|
---|
779 | }
|
---|
780 | // We want to set either `left` or `right` based on whether the overlay wants to appear "before"
|
---|
781 | // or "after" the origin, which determines the direction in which the element will expand.
|
---|
782 | // For the horizontal axis, the meaning of "before" and "after" change based on whether the
|
---|
783 | // page is in RTL or LTR.
|
---|
784 | let horizontalStyleProperty;
|
---|
785 | if (this._isRtl()) {
|
---|
786 | horizontalStyleProperty = position.overlayX === 'end' ? 'left' : 'right';
|
---|
787 | }
|
---|
788 | else {
|
---|
789 | horizontalStyleProperty = position.overlayX === 'end' ? 'right' : 'left';
|
---|
790 | }
|
---|
791 | // When we're setting `right`, we adjust the x position such that it is the distance
|
---|
792 | // from the right edge of the viewport rather than the left edge.
|
---|
793 | if (horizontalStyleProperty === 'right') {
|
---|
794 | const documentWidth = this._document.documentElement.clientWidth;
|
---|
795 | styles.right = `${documentWidth - (overlayPoint.x + this._overlayRect.width)}px`;
|
---|
796 | }
|
---|
797 | else {
|
---|
798 | styles.left = coerceCssPixelValue(overlayPoint.x);
|
---|
799 | }
|
---|
800 | return styles;
|
---|
801 | }
|
---|
802 | /**
|
---|
803 | * Gets the view properties of the trigger and overlay, including whether they are clipped
|
---|
804 | * or completely outside the view of any of the strategy's scrollables.
|
---|
805 | */
|
---|
806 | _getScrollVisibility() {
|
---|
807 | // Note: needs fresh rects since the position could've changed.
|
---|
808 | const originBounds = this._getOriginRect();
|
---|
809 | const overlayBounds = this._pane.getBoundingClientRect();
|
---|
810 | // TODO(jelbourn): instead of needing all of the client rects for these scrolling containers
|
---|
811 | // every time, we should be able to use the scrollTop of the containers if the size of those
|
---|
812 | // containers hasn't changed.
|
---|
813 | const scrollContainerBounds = this._scrollables.map(scrollable => {
|
---|
814 | return scrollable.getElementRef().nativeElement.getBoundingClientRect();
|
---|
815 | });
|
---|
816 | return {
|
---|
817 | isOriginClipped: isElementClippedByScrolling(originBounds, scrollContainerBounds),
|
---|
818 | isOriginOutsideView: isElementScrolledOutsideView(originBounds, scrollContainerBounds),
|
---|
819 | isOverlayClipped: isElementClippedByScrolling(overlayBounds, scrollContainerBounds),
|
---|
820 | isOverlayOutsideView: isElementScrolledOutsideView(overlayBounds, scrollContainerBounds),
|
---|
821 | };
|
---|
822 | }
|
---|
823 | /** Subtracts the amount that an element is overflowing on an axis from its length. */
|
---|
824 | _subtractOverflows(length, ...overflows) {
|
---|
825 | return overflows.reduce((currentValue, currentOverflow) => {
|
---|
826 | return currentValue - Math.max(currentOverflow, 0);
|
---|
827 | }, length);
|
---|
828 | }
|
---|
829 | /** Narrows the given viewport rect by the current _viewportMargin. */
|
---|
830 | _getNarrowedViewportRect() {
|
---|
831 | // We recalculate the viewport rect here ourselves, rather than using the ViewportRuler,
|
---|
832 | // because we want to use the `clientWidth` and `clientHeight` as the base. The difference
|
---|
833 | // being that the client properties don't include the scrollbar, as opposed to `innerWidth`
|
---|
834 | // and `innerHeight` that do. This is necessary, because the overlay container uses
|
---|
835 | // 100% `width` and `height` which don't include the scrollbar either.
|
---|
836 | const width = this._document.documentElement.clientWidth;
|
---|
837 | const height = this._document.documentElement.clientHeight;
|
---|
838 | const scrollPosition = this._viewportRuler.getViewportScrollPosition();
|
---|
839 | return {
|
---|
840 | top: scrollPosition.top + this._viewportMargin,
|
---|
841 | left: scrollPosition.left + this._viewportMargin,
|
---|
842 | right: scrollPosition.left + width - this._viewportMargin,
|
---|
843 | bottom: scrollPosition.top + height - this._viewportMargin,
|
---|
844 | width: width - (2 * this._viewportMargin),
|
---|
845 | height: height - (2 * this._viewportMargin),
|
---|
846 | };
|
---|
847 | }
|
---|
848 | /** Whether the we're dealing with an RTL context */
|
---|
849 | _isRtl() {
|
---|
850 | return this._overlayRef.getDirection() === 'rtl';
|
---|
851 | }
|
---|
852 | /** Determines whether the overlay uses exact or flexible positioning. */
|
---|
853 | _hasExactPosition() {
|
---|
854 | return !this._hasFlexibleDimensions || this._isPushed;
|
---|
855 | }
|
---|
856 | /** Retrieves the offset of a position along the x or y axis. */
|
---|
857 | _getOffset(position, axis) {
|
---|
858 | if (axis === 'x') {
|
---|
859 | // We don't do something like `position['offset' + axis]` in
|
---|
860 | // order to avoid breking minifiers that rename properties.
|
---|
861 | return position.offsetX == null ? this._offsetX : position.offsetX;
|
---|
862 | }
|
---|
863 | return position.offsetY == null ? this._offsetY : position.offsetY;
|
---|
864 | }
|
---|
865 | /** Validates that the current position match the expected values. */
|
---|
866 | _validatePositions() {
|
---|
867 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
---|
868 | if (!this._preferredPositions.length) {
|
---|
869 | throw Error('FlexibleConnectedPositionStrategy: At least one position is required.');
|
---|
870 | }
|
---|
871 | // TODO(crisbeto): remove these once Angular's template type
|
---|
872 | // checking is advanced enough to catch these cases.
|
---|
873 | this._preferredPositions.forEach(pair => {
|
---|
874 | validateHorizontalPosition('originX', pair.originX);
|
---|
875 | validateVerticalPosition('originY', pair.originY);
|
---|
876 | validateHorizontalPosition('overlayX', pair.overlayX);
|
---|
877 | validateVerticalPosition('overlayY', pair.overlayY);
|
---|
878 | });
|
---|
879 | }
|
---|
880 | }
|
---|
881 | /** Adds a single CSS class or an array of classes on the overlay panel. */
|
---|
882 | _addPanelClasses(cssClasses) {
|
---|
883 | if (this._pane) {
|
---|
884 | coerceArray(cssClasses).forEach(cssClass => {
|
---|
885 | if (cssClass !== '' && this._appliedPanelClasses.indexOf(cssClass) === -1) {
|
---|
886 | this._appliedPanelClasses.push(cssClass);
|
---|
887 | this._pane.classList.add(cssClass);
|
---|
888 | }
|
---|
889 | });
|
---|
890 | }
|
---|
891 | }
|
---|
892 | /** Clears the classes that the position strategy has applied from the overlay panel. */
|
---|
893 | _clearPanelClasses() {
|
---|
894 | if (this._pane) {
|
---|
895 | this._appliedPanelClasses.forEach(cssClass => {
|
---|
896 | this._pane.classList.remove(cssClass);
|
---|
897 | });
|
---|
898 | this._appliedPanelClasses = [];
|
---|
899 | }
|
---|
900 | }
|
---|
901 | /** Returns the ClientRect of the current origin. */
|
---|
902 | _getOriginRect() {
|
---|
903 | const origin = this._origin;
|
---|
904 | if (origin instanceof ElementRef) {
|
---|
905 | return origin.nativeElement.getBoundingClientRect();
|
---|
906 | }
|
---|
907 | // Check for Element so SVG elements are also supported.
|
---|
908 | if (origin instanceof Element) {
|
---|
909 | return origin.getBoundingClientRect();
|
---|
910 | }
|
---|
911 | const width = origin.width || 0;
|
---|
912 | const height = origin.height || 0;
|
---|
913 | // If the origin is a point, return a client rect as if it was a 0x0 element at the point.
|
---|
914 | return {
|
---|
915 | top: origin.y,
|
---|
916 | bottom: origin.y + height,
|
---|
917 | left: origin.x,
|
---|
918 | right: origin.x + width,
|
---|
919 | height,
|
---|
920 | width
|
---|
921 | };
|
---|
922 | }
|
---|
923 | }
|
---|
924 | /** Shallow-extends a stylesheet object with another stylesheet object. */
|
---|
925 | function extendStyles(destination, source) {
|
---|
926 | for (let key in source) {
|
---|
927 | if (source.hasOwnProperty(key)) {
|
---|
928 | destination[key] = source[key];
|
---|
929 | }
|
---|
930 | }
|
---|
931 | return destination;
|
---|
932 | }
|
---|
933 | /**
|
---|
934 | * Extracts the pixel value as a number from a value, if it's a number
|
---|
935 | * or a CSS pixel string (e.g. `1337px`). Otherwise returns null.
|
---|
936 | */
|
---|
937 | function getPixelValue(input) {
|
---|
938 | if (typeof input !== 'number' && input != null) {
|
---|
939 | const [value, units] = input.split(cssUnitPattern);
|
---|
940 | return (!units || units === 'px') ? parseFloat(value) : null;
|
---|
941 | }
|
---|
942 | return input || null;
|
---|
943 | }
|
---|
944 | /**
|
---|
945 | * Gets a version of an element's bounding `ClientRect` where all the values are rounded down to
|
---|
946 | * the nearest pixel. This allows us to account for the cases where there may be sub-pixel
|
---|
947 | * deviations in the `ClientRect` returned by the browser (e.g. when zoomed in with a percentage
|
---|
948 | * size, see #21350).
|
---|
949 | */
|
---|
950 | function getRoundedBoundingClientRect(clientRect) {
|
---|
951 | return {
|
---|
952 | top: Math.floor(clientRect.top),
|
---|
953 | right: Math.floor(clientRect.right),
|
---|
954 | bottom: Math.floor(clientRect.bottom),
|
---|
955 | left: Math.floor(clientRect.left),
|
---|
956 | width: Math.floor(clientRect.width),
|
---|
957 | height: Math.floor(clientRect.height)
|
---|
958 | };
|
---|
959 | }
|
---|
960 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmxleGlibGUtY29ubmVjdGVkLXBvc2l0aW9uLXN0cmF0ZWd5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2Nkay9vdmVybGF5L3Bvc2l0aW9uL2ZsZXhpYmxlLWNvbm5lY3RlZC1wb3NpdGlvbi1zdHJhdGVneS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFHSCxPQUFPLEVBQUMsVUFBVSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBRXpDLE9BQU8sRUFDTCw4QkFBOEIsRUFHOUIsMEJBQTBCLEVBQzFCLHdCQUF3QixHQUN6QixNQUFNLHNCQUFzQixDQUFDO0FBQzlCLE9BQU8sRUFBYSxZQUFZLEVBQUUsT0FBTyxFQUFDLE1BQU0sTUFBTSxDQUFDO0FBRXZELE9BQU8sRUFBQyw0QkFBNEIsRUFBRSwyQkFBMkIsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUN4RixPQUFPLEVBQUMsbUJBQW1CLEVBQUUsV0FBVyxFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFJdkUscUZBQXFGO0FBQ3JGLDZGQUE2RjtBQUU3RixxREFBcUQ7QUFDckQsTUFBTSxnQkFBZ0IsR0FBRyw2Q0FBNkMsQ0FBQztBQUV2RSxxREFBcUQ7QUFDckQsTUFBTSxjQUFjLEdBQUcsZUFBZSxDQUFDO0F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