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 | /** Horizontal dimension of a connection point on the perimeter of the origin or overlay element. */
|
---|
9 | import { Optional } from '@angular/core';
|
---|
10 | /** The points of the origin element and the overlay element to connect. */
|
---|
11 | export class ConnectionPositionPair {
|
---|
12 | constructor(origin, overlay,
|
---|
13 | /** Offset along the X axis. */
|
---|
14 | offsetX,
|
---|
15 | /** Offset along the Y axis. */
|
---|
16 | offsetY,
|
---|
17 | /** Class(es) to be applied to the panel while this position is active. */
|
---|
18 | panelClass) {
|
---|
19 | this.offsetX = offsetX;
|
---|
20 | this.offsetY = offsetY;
|
---|
21 | this.panelClass = panelClass;
|
---|
22 | this.originX = origin.originX;
|
---|
23 | this.originY = origin.originY;
|
---|
24 | this.overlayX = overlay.overlayX;
|
---|
25 | this.overlayY = overlay.overlayY;
|
---|
26 | }
|
---|
27 | }
|
---|
28 | /**
|
---|
29 | * Set of properties regarding the position of the origin and overlay relative to the viewport
|
---|
30 | * with respect to the containing Scrollable elements.
|
---|
31 | *
|
---|
32 | * The overlay and origin are clipped if any part of their bounding client rectangle exceeds the
|
---|
33 | * bounds of any one of the strategy's Scrollable's bounding client rectangle.
|
---|
34 | *
|
---|
35 | * The overlay and origin are outside view if there is no overlap between their bounding client
|
---|
36 | * rectangle and any one of the strategy's Scrollable's bounding client rectangle.
|
---|
37 | *
|
---|
38 | * ----------- -----------
|
---|
39 | * | outside | | clipped |
|
---|
40 | * | view | --------------------------
|
---|
41 | * | | | | | |
|
---|
42 | * ---------- | ----------- |
|
---|
43 | * -------------------------- | |
|
---|
44 | * | | | Scrollable |
|
---|
45 | * | | | |
|
---|
46 | * | | --------------------------
|
---|
47 | * | Scrollable |
|
---|
48 | * | |
|
---|
49 | * --------------------------
|
---|
50 | *
|
---|
51 | * @docs-private
|
---|
52 | */
|
---|
53 | export class ScrollingVisibility {
|
---|
54 | }
|
---|
55 | /** The change event emitted by the strategy when a fallback position is used. */
|
---|
56 | export class ConnectedOverlayPositionChange {
|
---|
57 | constructor(
|
---|
58 | /** The position used as a result of this change. */
|
---|
59 | connectionPair,
|
---|
60 | /** @docs-private */
|
---|
61 | scrollableViewProperties) {
|
---|
62 | this.connectionPair = connectionPair;
|
---|
63 | this.scrollableViewProperties = scrollableViewProperties;
|
---|
64 | }
|
---|
65 | }
|
---|
66 | ConnectedOverlayPositionChange.ctorParameters = () => [
|
---|
67 | { type: ConnectionPositionPair },
|
---|
68 | { type: ScrollingVisibility, decorators: [{ type: Optional }] }
|
---|
69 | ];
|
---|
70 | /**
|
---|
71 | * Validates whether a vertical position property matches the expected values.
|
---|
72 | * @param property Name of the property being validated.
|
---|
73 | * @param value Value of the property being validated.
|
---|
74 | * @docs-private
|
---|
75 | */
|
---|
76 | export function validateVerticalPosition(property, value) {
|
---|
77 | if (value !== 'top' && value !== 'bottom' && value !== 'center') {
|
---|
78 | throw Error(`ConnectedPosition: Invalid ${property} "${value}". ` +
|
---|
79 | `Expected "top", "bottom" or "center".`);
|
---|
80 | }
|
---|
81 | }
|
---|
82 | /**
|
---|
83 | * Validates whether a horizontal position property matches the expected values.
|
---|
84 | * @param property Name of the property being validated.
|
---|
85 | * @param value Value of the property being validated.
|
---|
86 | * @docs-private
|
---|
87 | */
|
---|
88 | export function validateHorizontalPosition(property, value) {
|
---|
89 | if (value !== 'start' && value !== 'end' && value !== 'center') {
|
---|
90 | throw Error(`ConnectedPosition: Invalid ${property} "${value}". ` +
|
---|
91 | `Expected "start", "end" or "center".`);
|
---|
92 | }
|
---|
93 | }
|
---|
94 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29ubmVjdGVkLXBvc2l0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4v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AgICAgICAgICAgIHwgY2xpcHBlZCB8XG4gKiAgICAgICB8ICB2aWV3ICAgfCAgICAgICAgICAgICAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cbiAqICAgICAgIHwgICAgICAgICB8ICAgICAgICAgICAgICB8ICAgICB8ICAgICAgICAgfCAgICAgICAgfFxuICogICAgICAgLS0tLS0tLS0tLSAgICAgICAgICAgICAgIHwgICAgIC0tLS0tLS0tLS0tICAgICAgICB8XG4gKiAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gICAgfCAgICAgICAgICAgICAgICAgICAgICAgIHxcbiAqICB8ICAgICAgICAgICAgICAgICAgICAgICAgfCAgICB8ICAgICAgU2Nyb2xsYWJsZSAgICAgICAgfFxuICogIHwgICAgICAgICAgICAgICAgICAgICAgICB8ICAgIHwgICAgICAgICAgICAgICAgICAgICAgICB8XG4gKiAgfCAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG4gKiAgfCAgICAgIFNjcm9sbGFibGUgICAgICAgIHxcbiAqICB8ICAgICAgICAgICAgICAgICAgICAgICAgfFxuICogIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG4gKlxuICogIEBkb2NzLXByaXZhdGVcbiAqL1xuZXhwb3J0IGNsYXNzIFNjcm9sbGluZ1Zpc2liaWxpdHkge1xuICBpc09yaWdpbkNsaXBwZWQ6IGJvb2xlYW47XG4gIGlzT3JpZ2luT3V0c2lkZVZpZXc6IGJvb2xlYW47XG4gIGlzT3ZlcmxheUNsaXBwZWQ6IGJvb2xlYW47XG4gIGlzT3ZlcmxheU91dHNpZGVWaWV3OiBib29sZWFuO1xufVxuXG4vKiogVGhlIGNoYW5nZSBldmVudCBlbWl0dGVkIGJ5IHRoZSBzdHJhdGVneSB3aGVuIGEgZmFsbGJhY2sgcG9zaXRpb24gaXMgdXNlZC4gKi9cbmV4cG9ydCBjbGFzcyBDb25u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