source: trip-planner-front/node_modules/@angular/material/esm2015/bottom-sheet/bottom-sheet.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 24.4 KB
Line 
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 */
8import { Directionality } from '@angular/cdk/bidi';
9import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
10import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
11import { Injectable, Injector, Optional, SkipSelf, TemplateRef, InjectionToken, Inject, InjectFlags, } from '@angular/core';
12import { of as observableOf } from 'rxjs';
13import { MAT_BOTTOM_SHEET_DATA, MatBottomSheetConfig } from './bottom-sheet-config';
14import { MatBottomSheetContainer } from './bottom-sheet-container';
15import { MatBottomSheetModule } from './bottom-sheet-module';
16import { MatBottomSheetRef } from './bottom-sheet-ref';
17import * as i0 from "@angular/core";
18import * as i1 from "@angular/cdk/overlay";
19import * as i2 from "./bottom-sheet-module";
20/** Injection token that can be used to specify default bottom sheet options. */
21export const MAT_BOTTOM_SHEET_DEFAULT_OPTIONS = new InjectionToken('mat-bottom-sheet-default-options');
22/**
23 * Service to trigger Material Design bottom sheets.
24 */
25export class MatBottomSheet {
26 constructor(_overlay, _injector, _parentBottomSheet, _defaultOptions) {
27 this._overlay = _overlay;
28 this._injector = _injector;
29 this._parentBottomSheet = _parentBottomSheet;
30 this._defaultOptions = _defaultOptions;
31 this._bottomSheetRefAtThisLevel = null;
32 }
33 /** Reference to the currently opened bottom sheet. */
34 get _openedBottomSheetRef() {
35 const parent = this._parentBottomSheet;
36 return parent ? parent._openedBottomSheetRef : this._bottomSheetRefAtThisLevel;
37 }
38 set _openedBottomSheetRef(value) {
39 if (this._parentBottomSheet) {
40 this._parentBottomSheet._openedBottomSheetRef = value;
41 }
42 else {
43 this._bottomSheetRefAtThisLevel = value;
44 }
45 }
46 open(componentOrTemplateRef, config) {
47 const _config = _applyConfigDefaults(this._defaultOptions || new MatBottomSheetConfig(), config);
48 const overlayRef = this._createOverlay(_config);
49 const container = this._attachContainer(overlayRef, _config);
50 const ref = new MatBottomSheetRef(container, overlayRef);
51 if (componentOrTemplateRef instanceof TemplateRef) {
52 container.attachTemplatePortal(new TemplatePortal(componentOrTemplateRef, null, {
53 $implicit: _config.data,
54 bottomSheetRef: ref
55 }));
56 }
57 else {
58 const portal = new ComponentPortal(componentOrTemplateRef, undefined, this._createInjector(_config, ref));
59 const contentRef = container.attachComponentPortal(portal);
60 ref.instance = contentRef.instance;
61 }
62 // When the bottom sheet is dismissed, clear the reference to it.
63 ref.afterDismissed().subscribe(() => {
64 // Clear the bottom sheet ref if it hasn't already been replaced by a newer one.
65 if (this._openedBottomSheetRef == ref) {
66 this._openedBottomSheetRef = null;
67 }
68 });
69 if (this._openedBottomSheetRef) {
70 // If a bottom sheet is already in view, dismiss it and enter the
71 // new bottom sheet after exit animation is complete.
72 this._openedBottomSheetRef.afterDismissed().subscribe(() => ref.containerInstance.enter());
73 this._openedBottomSheetRef.dismiss();
74 }
75 else {
76 // If no bottom sheet is in view, enter the new bottom sheet.
77 ref.containerInstance.enter();
78 }
79 this._openedBottomSheetRef = ref;
80 return ref;
81 }
82 /**
83 * Dismisses the currently-visible bottom sheet.
84 * @param result Data to pass to the bottom sheet instance.
85 */
86 dismiss(result) {
87 if (this._openedBottomSheetRef) {
88 this._openedBottomSheetRef.dismiss(result);
89 }
90 }
91 ngOnDestroy() {
92 if (this._bottomSheetRefAtThisLevel) {
93 this._bottomSheetRefAtThisLevel.dismiss();
94 }
95 }
96 /**
97 * Attaches the bottom sheet container component to the overlay.
98 */
99 _attachContainer(overlayRef, config) {
100 const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
101 const injector = Injector.create({
102 parent: userInjector || this._injector,
103 providers: [{ provide: MatBottomSheetConfig, useValue: config }]
104 });
105 const containerPortal = new ComponentPortal(MatBottomSheetContainer, config.viewContainerRef, injector);
106 const containerRef = overlayRef.attach(containerPortal);
107 return containerRef.instance;
108 }
109 /**
110 * Creates a new overlay and places it in the correct location.
111 * @param config The user-specified bottom sheet config.
112 */
113 _createOverlay(config) {
114 const overlayConfig = new OverlayConfig({
115 direction: config.direction,
116 hasBackdrop: config.hasBackdrop,
117 disposeOnNavigation: config.closeOnNavigation,
118 maxWidth: '100%',
119 scrollStrategy: config.scrollStrategy || this._overlay.scrollStrategies.block(),
120 positionStrategy: this._overlay.position().global().centerHorizontally().bottom('0')
121 });
122 if (config.backdropClass) {
123 overlayConfig.backdropClass = config.backdropClass;
124 }
125 return this._overlay.create(overlayConfig);
126 }
127 /**
128 * Creates an injector to be used inside of a bottom sheet component.
129 * @param config Config that was used to create the bottom sheet.
130 * @param bottomSheetRef Reference to the bottom sheet.
131 */
132 _createInjector(config, bottomSheetRef) {
133 const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
134 const providers = [
135 { provide: MatBottomSheetRef, useValue: bottomSheetRef },
136 { provide: MAT_BOTTOM_SHEET_DATA, useValue: config.data }
137 ];
138 if (config.direction && (!userInjector ||
139 !userInjector.get(Directionality, null, InjectFlags.Optional))) {
140 providers.push({
141 provide: Directionality,
142 useValue: { value: config.direction, change: observableOf() }
143 });
144 }
145 return Injector.create({ parent: userInjector || this._injector, providers });
146 }
147}
148MatBottomSheet.ɵprov = i0.ɵɵdefineInjectable({ factory: function MatBottomSheet_Factory() { return new MatBottomSheet(i0.ɵɵinject(i1.Overlay), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(MatBottomSheet, 12), i0.ɵɵinject(MAT_BOTTOM_SHEET_DEFAULT_OPTIONS, 8)); }, token: MatBottomSheet, providedIn: i2.MatBottomSheetModule });
149MatBottomSheet.decorators = [
150 { type: Injectable, args: [{ providedIn: MatBottomSheetModule },] }
151];
152MatBottomSheet.ctorParameters = () => [
153 { type: Overlay },
154 { type: Injector },
155 { type: MatBottomSheet, decorators: [{ type: Optional }, { type: SkipSelf }] },
156 { type: MatBottomSheetConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_BOTTOM_SHEET_DEFAULT_OPTIONS,] }] }
157];
158/**
159 * Applies default options to the bottom sheet config.
160 * @param defaults Object containing the default values to which to fall back.
161 * @param config The configuration to which the defaults will be applied.
162 * @returns The new configuration object with defaults applied.
163 */
164function _applyConfigDefaults(defaults, config) {
165 return Object.assign(Object.assign({}, defaults), config);
166}
167//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm90dG9tLXNoZWV0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2JvdHRvbS1zaGVldC9ib3R0b20tc2hlZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLGNBQWMsRUFBQyxNQUFNLG1CQUFtQixDQUFDO0FBQ2pELE9BQU8sRUFBQyxPQUFPLEVBQUUsYUFBYSxFQUFhLE1BQU0sc0JBQXNCLENBQUM7QUFDeEUsT0FBTyxFQUFDLGVBQWUsRUFBaUIsY0FBYyxFQUFDLE1BQU0scUJBQXFCLENBQUM7QUFDbkYsT0FBTyxFQUVMLFVBQVUsRUFDVixRQUFRLEVBQ1IsUUFBUSxFQUNSLFFBQVEsRUFDUixXQUFXLEVBQ1gsY0FBYyxFQUNkLE1BQU0sRUFHTixXQUFXLEdBQ1osTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFDLEVBQUUsSUFBSSxZQUFZLEVBQUMsTUFBTSxNQUFNLENBQUM7QUFDeEMsT0FBTyxFQUFDLHFCQUFxQixFQUFFLG9CQUFvQixFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDbEYsT0FBTyxFQUFDLHVCQUF1QixFQUFDLE1BQU0sMEJBQTBCLENBQUM7QUFDakUsT0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YXRpb24gb2JqZWN0IHdpdGggZGVmYXVsdHMgYXBwbGllZC5cbiAqL1xuZnVuY3Rpb24gX2FwcGx5Q29uZmlnRGVmYXVsdHMoZGVmYXVsdHM6IE1hdEJvdHRvbVNoZWV0Q29uZmlnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnPzogTWF0Qm90dG9tU2hlZXRDb25maWcpOiBNYXRCb3R0b21TaGVldENvbmZpZyB7XG4gIHJldHVybiB7Li4uZGVmYXVsdHMsIC4uLmNvbmZpZ307XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.