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 { Directionality } from '@angular/cdk/bidi';
|
---|
9 | import { DomPortalOutlet } from '@angular/cdk/portal';
|
---|
10 | import { DOCUMENT, Location } from '@angular/common';
|
---|
11 | import { ApplicationRef, ComponentFactoryResolver, Inject, Injectable, Injector, NgZone, } from '@angular/core';
|
---|
12 | import { OverlayKeyboardDispatcher } from './dispatchers/overlay-keyboard-dispatcher';
|
---|
13 | import { OverlayOutsideClickDispatcher } from './dispatchers/overlay-outside-click-dispatcher';
|
---|
14 | import { OverlayConfig } from './overlay-config';
|
---|
15 | import { OverlayContainer } from './overlay-container';
|
---|
16 | import { OverlayRef } from './overlay-ref';
|
---|
17 | import { OverlayPositionBuilder } from './position/overlay-position-builder';
|
---|
18 | import { ScrollStrategyOptions } from './scroll/index';
|
---|
19 | /** Next overlay unique ID. */
|
---|
20 | let nextUniqueId = 0;
|
---|
21 | // Note that Overlay is *not* scoped to the app root because of the ComponentFactoryResolver
|
---|
22 | // which needs to be different depending on where OverlayModule is imported.
|
---|
23 | /**
|
---|
24 | * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
|
---|
25 | * used as a low-level building block for other components. Dialogs, tooltips, menus,
|
---|
26 | * selects, etc. can all be built using overlays. The service should primarily be used by authors
|
---|
27 | * of re-usable components rather than developers building end-user applications.
|
---|
28 | *
|
---|
29 | * An overlay *is* a PortalOutlet, so any kind of Portal can be loaded into one.
|
---|
30 | */
|
---|
31 | export class Overlay {
|
---|
32 | constructor(
|
---|
33 | /** Scrolling strategies that can be used when creating an overlay. */
|
---|
34 | scrollStrategies, _overlayContainer, _componentFactoryResolver, _positionBuilder, _keyboardDispatcher, _injector, _ngZone, _document, _directionality, _location, _outsideClickDispatcher) {
|
---|
35 | this.scrollStrategies = scrollStrategies;
|
---|
36 | this._overlayContainer = _overlayContainer;
|
---|
37 | this._componentFactoryResolver = _componentFactoryResolver;
|
---|
38 | this._positionBuilder = _positionBuilder;
|
---|
39 | this._keyboardDispatcher = _keyboardDispatcher;
|
---|
40 | this._injector = _injector;
|
---|
41 | this._ngZone = _ngZone;
|
---|
42 | this._document = _document;
|
---|
43 | this._directionality = _directionality;
|
---|
44 | this._location = _location;
|
---|
45 | this._outsideClickDispatcher = _outsideClickDispatcher;
|
---|
46 | }
|
---|
47 | /**
|
---|
48 | * Creates an overlay.
|
---|
49 | * @param config Configuration applied to the overlay.
|
---|
50 | * @returns Reference to the created overlay.
|
---|
51 | */
|
---|
52 | create(config) {
|
---|
53 | const host = this._createHostElement();
|
---|
54 | const pane = this._createPaneElement(host);
|
---|
55 | const portalOutlet = this._createPortalOutlet(pane);
|
---|
56 | const overlayConfig = new OverlayConfig(config);
|
---|
57 | overlayConfig.direction = overlayConfig.direction || this._directionality.value;
|
---|
58 | return new OverlayRef(portalOutlet, host, pane, overlayConfig, this._ngZone, this._keyboardDispatcher, this._document, this._location, this._outsideClickDispatcher);
|
---|
59 | }
|
---|
60 | /**
|
---|
61 | * Gets a position builder that can be used, via fluent API,
|
---|
62 | * to construct and configure a position strategy.
|
---|
63 | * @returns An overlay position builder.
|
---|
64 | */
|
---|
65 | position() {
|
---|
66 | return this._positionBuilder;
|
---|
67 | }
|
---|
68 | /**
|
---|
69 | * Creates the DOM element for an overlay and appends it to the overlay container.
|
---|
70 | * @returns Newly-created pane element
|
---|
71 | */
|
---|
72 | _createPaneElement(host) {
|
---|
73 | const pane = this._document.createElement('div');
|
---|
74 | pane.id = `cdk-overlay-${nextUniqueId++}`;
|
---|
75 | pane.classList.add('cdk-overlay-pane');
|
---|
76 | host.appendChild(pane);
|
---|
77 | return pane;
|
---|
78 | }
|
---|
79 | /**
|
---|
80 | * Creates the host element that wraps around an overlay
|
---|
81 | * and can be used for advanced positioning.
|
---|
82 | * @returns Newly-create host element.
|
---|
83 | */
|
---|
84 | _createHostElement() {
|
---|
85 | const host = this._document.createElement('div');
|
---|
86 | this._overlayContainer.getContainerElement().appendChild(host);
|
---|
87 | return host;
|
---|
88 | }
|
---|
89 | /**
|
---|
90 | * Create a DomPortalOutlet into which the overlay content can be loaded.
|
---|
91 | * @param pane The DOM element to turn into a portal outlet.
|
---|
92 | * @returns A portal outlet for the given DOM element.
|
---|
93 | */
|
---|
94 | _createPortalOutlet(pane) {
|
---|
95 | // We have to resolve the ApplicationRef later in order to allow people
|
---|
96 | // to use overlay-based providers during app initialization.
|
---|
97 | if (!this._appRef) {
|
---|
98 | this._appRef = this._injector.get(ApplicationRef);
|
---|
99 | }
|
---|
100 | return new DomPortalOutlet(pane, this._componentFactoryResolver, this._appRef, this._injector, this._document);
|
---|
101 | }
|
---|
102 | }
|
---|
103 | Overlay.decorators = [
|
---|
104 | { type: Injectable }
|
---|
105 | ];
|
---|
106 | Overlay.ctorParameters = () => [
|
---|
107 | { type: ScrollStrategyOptions },
|
---|
108 | { type: OverlayContainer },
|
---|
109 | { type: ComponentFactoryResolver },
|
---|
110 | { type: OverlayPositionBuilder },
|
---|
111 | { type: OverlayKeyboardDispatcher },
|
---|
112 | { type: Injector },
|
---|
113 | { type: NgZone },
|
---|
114 | { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
---|
115 | { type: Directionality },
|
---|
116 | { type: Location },
|
---|
117 | { type: OverlayOutsideClickDispatcher }
|
---|
118 | ];
|
---|
119 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3ZlcmxheS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGsvb3ZlcmxheS9vdmVybGF5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBQyxjQUFjLEVBQUMsTUFBTSxtQkF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