/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Platform } from '@angular/cdk/platform'; import { ViewportRuler } from '@angular/cdk/scrolling'; import { DOCUMENT } from '@angular/common'; import { Inject, Injectable } from '@angular/core'; import { OverlayContainer } from '../overlay-container'; import { ConnectedPositionStrategy } from './connected-position-strategy'; import { FlexibleConnectedPositionStrategy, } from './flexible-connected-position-strategy'; import { GlobalPositionStrategy } from './global-position-strategy'; import * as i0 from "@angular/core"; import * as i1 from "@angular/cdk/scrolling"; import * as i2 from "@angular/common"; import * as i3 from "@angular/cdk/platform"; import * as i4 from "../overlay-container"; /** Builder for overlay position strategy. */ export class OverlayPositionBuilder { constructor(_viewportRuler, _document, _platform, _overlayContainer) { this._viewportRuler = _viewportRuler; this._document = _document; this._platform = _platform; this._overlayContainer = _overlayContainer; } /** * Creates a global position strategy. */ global() { return new GlobalPositionStrategy(); } /** * Creates a relative position strategy. * @param elementRef * @param originPos * @param overlayPos * @deprecated Use `flexibleConnectedTo` instead. * @breaking-change 8.0.0 */ connectedTo(elementRef, originPos, overlayPos) { return new ConnectedPositionStrategy(originPos, overlayPos, elementRef, this._viewportRuler, this._document, this._platform, this._overlayContainer); } /** * Creates a flexible position strategy. * @param origin Origin relative to which to position the overlay. */ flexibleConnectedTo(origin) { return new FlexibleConnectedPositionStrategy(origin, this._viewportRuler, this._document, this._platform, this._overlayContainer); } } 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" }); OverlayPositionBuilder.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; OverlayPositionBuilder.ctorParameters = () => [ { type: ViewportRuler }, { type: undefined, decorators: [{ type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