/** * @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 { Directionality } from '@angular/cdk/bidi'; import { DomPortalOutlet } from '@angular/cdk/portal'; import { DOCUMENT, Location } from '@angular/common'; import { ApplicationRef, ComponentFactoryResolver, Inject, Injectable, Injector, NgZone, } from '@angular/core'; import { OverlayKeyboardDispatcher } from './dispatchers/overlay-keyboard-dispatcher'; import { OverlayOutsideClickDispatcher } from './dispatchers/overlay-outside-click-dispatcher'; import { OverlayConfig } from './overlay-config'; import { OverlayContainer } from './overlay-container'; import { OverlayRef } from './overlay-ref'; import { OverlayPositionBuilder } from './position/overlay-position-builder'; import { ScrollStrategyOptions } from './scroll/index'; /** Next overlay unique ID. */ let nextUniqueId = 0; // Note that Overlay is *not* scoped to the app root because of the ComponentFactoryResolver // which needs to be different depending on where OverlayModule is imported. /** * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be * used as a low-level building block for other components. Dialogs, tooltips, menus, * selects, etc. can all be built using overlays. The service should primarily be used by authors * of re-usable components rather than developers building end-user applications. * * An overlay *is* a PortalOutlet, so any kind of Portal can be loaded into one. */ export class Overlay { constructor( /** Scrolling strategies that can be used when creating an overlay. */ scrollStrategies, _overlayContainer, _componentFactoryResolver, _positionBuilder, _keyboardDispatcher, _injector, _ngZone, _document, _directionality, _location, _outsideClickDispatcher) { this.scrollStrategies = scrollStrategies; this._overlayContainer = _overlayContainer; this._componentFactoryResolver = _componentFactoryResolver; this._positionBuilder = _positionBuilder; this._keyboardDispatcher = _keyboardDispatcher; this._injector = _injector; this._ngZone = _ngZone; this._document = _document; this._directionality = _directionality; this._location = _location; this._outsideClickDispatcher = _outsideClickDispatcher; } /** * Creates an overlay. * @param config Configuration applied to the overlay. * @returns Reference to the created overlay. */ create(config) { const host = this._createHostElement(); const pane = this._createPaneElement(host); const portalOutlet = this._createPortalOutlet(pane); const overlayConfig = new OverlayConfig(config); overlayConfig.direction = overlayConfig.direction || this._directionality.value; return new OverlayRef(portalOutlet, host, pane, overlayConfig, this._ngZone, this._keyboardDispatcher, this._document, this._location, this._outsideClickDispatcher); } /** * Gets a position builder that can be used, via fluent API, * to construct and configure a position strategy. * @returns An overlay position builder. */ position() { return this._positionBuilder; } /** * Creates the DOM element for an overlay and appends it to the overlay container. * @returns Newly-created pane element */ _createPaneElement(host) { const pane = this._document.createElement('div'); pane.id = `cdk-overlay-${nextUniqueId++}`; pane.classList.add('cdk-overlay-pane'); host.appendChild(pane); return pane; } /** * Creates the host element that wraps around an overlay * and can be used for advanced positioning. * @returns Newly-create host element. */ _createHostElement() { const host = this._document.createElement('div'); this._overlayContainer.getContainerElement().appendChild(host); return host; } /** * Create a DomPortalOutlet into which the overlay content can be loaded. * @param pane The DOM element to turn into a portal outlet. * @returns A portal outlet for the given DOM element. */ _createPortalOutlet(pane) { // We have to resolve the ApplicationRef later in order to allow people // to use overlay-based providers during app initialization. if (!this._appRef) { this._appRef = this._injector.get(ApplicationRef); } return new DomPortalOutlet(pane, this._componentFactoryResolver, this._appRef, this._injector, this._document); } } Overlay.decorators = [ { type: Injectable } ]; Overlay.ctorParameters = () => [ { type: ScrollStrategyOptions }, { type: OverlayContainer }, { type: ComponentFactoryResolver }, { type: OverlayPositionBuilder }, { type: OverlayKeyboardDispatcher }, { type: Injector }, { type: NgZone }, { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }, { type: Directionality }, { type: Location }, { type: OverlayOutsideClickDispatcher } ]; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3ZlcmxheS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGsvb3ZlcmxheS9vdmVybGF5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBQyxjQUFjLEVBQUMsTUFBTSxtQkFBbU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