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 { ViewportRuler } from '@angular/cdk/scrolling';
|
---|
10 | import { DOCUMENT } from '@angular/common';
|
---|
11 | import { Inject, Injectable } from '@angular/core';
|
---|
12 | import { OverlayContainer } from '../overlay-container';
|
---|
13 | import { ConnectedPositionStrategy } from './connected-position-strategy';
|
---|
14 | import { FlexibleConnectedPositionStrategy, } from './flexible-connected-position-strategy';
|
---|
15 | import { GlobalPositionStrategy } from './global-position-strategy';
|
---|
16 | import * as i0 from "@angular/core";
|
---|
17 | import * as i1 from "@angular/cdk/scrolling";
|
---|
18 | import * as i2 from "@angular/common";
|
---|
19 | import * as i3 from "@angular/cdk/platform";
|
---|
20 | import * as i4 from "../overlay-container";
|
---|
21 | /** Builder for overlay position strategy. */
|
---|
22 | export class OverlayPositionBuilder {
|
---|
23 | constructor(_viewportRuler, _document, _platform, _overlayContainer) {
|
---|
24 | this._viewportRuler = _viewportRuler;
|
---|
25 | this._document = _document;
|
---|
26 | this._platform = _platform;
|
---|
27 | this._overlayContainer = _overlayContainer;
|
---|
28 | }
|
---|
29 | /**
|
---|
30 | * Creates a global position strategy.
|
---|
31 | */
|
---|
32 | global() {
|
---|
33 | return new GlobalPositionStrategy();
|
---|
34 | }
|
---|
35 | /**
|
---|
36 | * Creates a relative position strategy.
|
---|
37 | * @param elementRef
|
---|
38 | * @param originPos
|
---|
39 | * @param overlayPos
|
---|
40 | * @deprecated Use `flexibleConnectedTo` instead.
|
---|
41 | * @breaking-change 8.0.0
|
---|
42 | */
|
---|
43 | connectedTo(elementRef, originPos, overlayPos) {
|
---|
44 | return new ConnectedPositionStrategy(originPos, overlayPos, elementRef, this._viewportRuler, this._document, this._platform, this._overlayContainer);
|
---|
45 | }
|
---|
46 | /**
|
---|
47 | * Creates a flexible position strategy.
|
---|
48 | * @param origin Origin relative to which to position the overlay.
|
---|
49 | */
|
---|
50 | flexibleConnectedTo(origin) {
|
---|
51 | return new FlexibleConnectedPositionStrategy(origin, this._viewportRuler, this._document, this._platform, this._overlayContainer);
|
---|
52 | }
|
---|
53 | }
|
---|
54 | OverlayPositionBuilder.ɵprov = i0.ɵɵdefineInjectable({ factory: function OverlayPositionBuilder_Factory() { return new OverlayPositionBuilder(i0.ɵɵinject(i1.ViewportRuler), i0.ɵɵinject(i2.DOCUMENT), i0.ɵɵinject(i3.Platform), i0.ɵɵinject(i4.OverlayContainer)); }, token: OverlayPositionBuilder, providedIn: "root" });
|
---|
55 | OverlayPositionBuilder.decorators = [
|
---|
56 | { type: Injectable, args: [{ providedIn: 'root' },] }
|
---|
57 | ];
|
---|
58 | OverlayPositionBuilder.ctorParameters = () => [
|
---|
59 | { type: ViewportRuler },
|
---|
60 | { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
---|
61 | { type: Platform },
|
---|
62 | { type: OverlayContainer }
|
---|
63 | ];
|
---|
64 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3ZlcmxheS1wb3NpdGlvbi1idWlsZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2Nkay9vdmVybGF5L3Bvc2l0aW9uL292ZXJsYXktcG9zaXRpb24tYnVpbGRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDL0MsT0FBTyxFQUFDLGFBQWEsRUFBQyxNQUFNLHdCQUF3QixDQUFDO0FBQ3JELE9BQU8sRUFBQyxRQUFRLEVBQUMsTUFBTSxpQkFBaUIsQ0FBQztBQUN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