source: trip-planner-front/node_modules/@angular/material/esm2015/snack-bar/snack-bar.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: 35.8 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 { LiveAnnouncer } from '@angular/cdk/a11y';
9import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
10import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
11import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
12import { Inject, Injectable, InjectionToken, Injector, Optional, SkipSelf, TemplateRef, } from '@angular/core';
13import { takeUntil } from 'rxjs/operators';
14import { SimpleSnackBar } from './simple-snack-bar';
15import { MAT_SNACK_BAR_DATA, MatSnackBarConfig } from './snack-bar-config';
16import { MatSnackBarContainer } from './snack-bar-container';
17import { MatSnackBarModule } from './snack-bar-module';
18import { MatSnackBarRef } from './snack-bar-ref';
19import * as i0 from "@angular/core";
20import * as i1 from "@angular/cdk/overlay";
21import * as i2 from "@angular/cdk/a11y";
22import * as i3 from "@angular/cdk/layout";
23import * as i4 from "./snack-bar-module";
24/** Injection token that can be used to specify default snack bar. */
25export const MAT_SNACK_BAR_DEFAULT_OPTIONS = new InjectionToken('mat-snack-bar-default-options', {
26 providedIn: 'root',
27 factory: MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY,
28});
29/** @docs-private */
30export function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY() {
31 return new MatSnackBarConfig();
32}
33/**
34 * Service to dispatch Material Design snack bar messages.
35 */
36export class MatSnackBar {
37 constructor(_overlay, _live, _injector, _breakpointObserver, _parentSnackBar, _defaultConfig) {
38 this._overlay = _overlay;
39 this._live = _live;
40 this._injector = _injector;
41 this._breakpointObserver = _breakpointObserver;
42 this._parentSnackBar = _parentSnackBar;
43 this._defaultConfig = _defaultConfig;
44 /**
45 * Reference to the current snack bar in the view *at this level* (in the Angular injector tree).
46 * If there is a parent snack-bar service, all operations should delegate to that parent
47 * via `_openedSnackBarRef`.
48 */
49 this._snackBarRefAtThisLevel = null;
50 /** The component that should be rendered as the snack bar's simple component. */
51 this.simpleSnackBarComponent = SimpleSnackBar;
52 /** The container component that attaches the provided template or component. */
53 this.snackBarContainerComponent = MatSnackBarContainer;
54 /** The CSS class to apply for handset mode. */
55 this.handsetCssClass = 'mat-snack-bar-handset';
56 }
57 /** Reference to the currently opened snackbar at *any* level. */
58 get _openedSnackBarRef() {
59 const parent = this._parentSnackBar;
60 return parent ? parent._openedSnackBarRef : this._snackBarRefAtThisLevel;
61 }
62 set _openedSnackBarRef(value) {
63 if (this._parentSnackBar) {
64 this._parentSnackBar._openedSnackBarRef = value;
65 }
66 else {
67 this._snackBarRefAtThisLevel = value;
68 }
69 }
70 /**
71 * Creates and dispatches a snack bar with a custom component for the content, removing any
72 * currently opened snack bars.
73 *
74 * @param component Component to be instantiated.
75 * @param config Extra configuration for the snack bar.
76 */
77 openFromComponent(component, config) {
78 return this._attach(component, config);
79 }
80 /**
81 * Creates and dispatches a snack bar with a custom template for the content, removing any
82 * currently opened snack bars.
83 *
84 * @param template Template to be instantiated.
85 * @param config Extra configuration for the snack bar.
86 */
87 openFromTemplate(template, config) {
88 return this._attach(template, config);
89 }
90 /**
91 * Opens a snackbar with a message and an optional action.
92 * @param message The message to show in the snackbar.
93 * @param action The label for the snackbar action.
94 * @param config Additional configuration options for the snackbar.
95 */
96 open(message, action = '', config) {
97 const _config = Object.assign(Object.assign({}, this._defaultConfig), config);
98 // Since the user doesn't have access to the component, we can
99 // override the data to pass in our own message and action.
100 _config.data = { message, action };
101 // Since the snack bar has `role="alert"`, we don't
102 // want to announce the same message twice.
103 if (_config.announcementMessage === message) {
104 _config.announcementMessage = undefined;
105 }
106 return this.openFromComponent(this.simpleSnackBarComponent, _config);
107 }
108 /**
109 * Dismisses the currently-visible snack bar.
110 */
111 dismiss() {
112 if (this._openedSnackBarRef) {
113 this._openedSnackBarRef.dismiss();
114 }
115 }
116 ngOnDestroy() {
117 // Only dismiss the snack bar at the current level on destroy.
118 if (this._snackBarRefAtThisLevel) {
119 this._snackBarRefAtThisLevel.dismiss();
120 }
121 }
122 /**
123 * Attaches the snack bar container component to the overlay.
124 */
125 _attachSnackBarContainer(overlayRef, config) {
126 const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
127 const injector = Injector.create({
128 parent: userInjector || this._injector,
129 providers: [{ provide: MatSnackBarConfig, useValue: config }]
130 });
131 const containerPortal = new ComponentPortal(this.snackBarContainerComponent, config.viewContainerRef, injector);
132 const containerRef = overlayRef.attach(containerPortal);
133 containerRef.instance.snackBarConfig = config;
134 return containerRef.instance;
135 }
136 /**
137 * Places a new component or a template as the content of the snack bar container.
138 */
139 _attach(content, userConfig) {
140 const config = Object.assign(Object.assign(Object.assign({}, new MatSnackBarConfig()), this._defaultConfig), userConfig);
141 const overlayRef = this._createOverlay(config);
142 const container = this._attachSnackBarContainer(overlayRef, config);
143 const snackBarRef = new MatSnackBarRef(container, overlayRef);
144 if (content instanceof TemplateRef) {
145 const portal = new TemplatePortal(content, null, {
146 $implicit: config.data,
147 snackBarRef
148 });
149 snackBarRef.instance = container.attachTemplatePortal(portal);
150 }
151 else {
152 const injector = this._createInjector(config, snackBarRef);
153 const portal = new ComponentPortal(content, undefined, injector);
154 const contentRef = container.attachComponentPortal(portal);
155 // We can't pass this via the injector, because the injector is created earlier.
156 snackBarRef.instance = contentRef.instance;
157 }
158 // Subscribe to the breakpoint observer and attach the mat-snack-bar-handset class as
159 // appropriate. This class is applied to the overlay element because the overlay must expand to
160 // fill the width of the screen for full width snackbars.
161 this._breakpointObserver.observe(Breakpoints.HandsetPortrait).pipe(takeUntil(overlayRef.detachments())).subscribe(state => {
162 const classList = overlayRef.overlayElement.classList;
163 state.matches ? classList.add(this.handsetCssClass) : classList.remove(this.handsetCssClass);
164 });
165 if (config.announcementMessage) {
166 // Wait until the snack bar contents have been announced then deliver this message.
167 container._onAnnounce.subscribe(() => {
168 this._live.announce(config.announcementMessage, config.politeness);
169 });
170 }
171 this._animateSnackBar(snackBarRef, config);
172 this._openedSnackBarRef = snackBarRef;
173 return this._openedSnackBarRef;
174 }
175 /** Animates the old snack bar out and the new one in. */
176 _animateSnackBar(snackBarRef, config) {
177 // When the snackbar is dismissed, clear the reference to it.
178 snackBarRef.afterDismissed().subscribe(() => {
179 // Clear the snackbar ref if it hasn't already been replaced by a newer snackbar.
180 if (this._openedSnackBarRef == snackBarRef) {
181 this._openedSnackBarRef = null;
182 }
183 if (config.announcementMessage) {
184 this._live.clear();
185 }
186 });
187 if (this._openedSnackBarRef) {
188 // If a snack bar is already in view, dismiss it and enter the
189 // new snack bar after exit animation is complete.
190 this._openedSnackBarRef.afterDismissed().subscribe(() => {
191 snackBarRef.containerInstance.enter();
192 });
193 this._openedSnackBarRef.dismiss();
194 }
195 else {
196 // If no snack bar is in view, enter the new snack bar.
197 snackBarRef.containerInstance.enter();
198 }
199 // If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
200 if (config.duration && config.duration > 0) {
201 snackBarRef.afterOpened().subscribe(() => snackBarRef._dismissAfter(config.duration));
202 }
203 }
204 /**
205 * Creates a new overlay and places it in the correct location.
206 * @param config The user-specified snack bar config.
207 */
208 _createOverlay(config) {
209 const overlayConfig = new OverlayConfig();
210 overlayConfig.direction = config.direction;
211 let positionStrategy = this._overlay.position().global();
212 // Set horizontal position.
213 const isRtl = config.direction === 'rtl';
214 const isLeft = (config.horizontalPosition === 'left' ||
215 (config.horizontalPosition === 'start' && !isRtl) ||
216 (config.horizontalPosition === 'end' && isRtl));
217 const isRight = !isLeft && config.horizontalPosition !== 'center';
218 if (isLeft) {
219 positionStrategy.left('0');
220 }
221 else if (isRight) {
222 positionStrategy.right('0');
223 }
224 else {
225 positionStrategy.centerHorizontally();
226 }
227 // Set horizontal position.
228 if (config.verticalPosition === 'top') {
229 positionStrategy.top('0');
230 }
231 else {
232 positionStrategy.bottom('0');
233 }
234 overlayConfig.positionStrategy = positionStrategy;
235 return this._overlay.create(overlayConfig);
236 }
237 /**
238 * Creates an injector to be used inside of a snack bar component.
239 * @param config Config that was used to create the snack bar.
240 * @param snackBarRef Reference to the snack bar.
241 */
242 _createInjector(config, snackBarRef) {
243 const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
244 return Injector.create({
245 parent: userInjector || this._injector,
246 providers: [
247 { provide: MatSnackBarRef, useValue: snackBarRef },
248 { provide: MAT_SNACK_BAR_DATA, useValue: config.data }
249 ]
250 });
251 }
252}
253MatSnackBar.ɵprov = i0.ɵɵdefineInjectable({ factory: function MatSnackBar_Factory() { return new MatSnackBar(i0.ɵɵinject(i1.Overlay), i0.ɵɵinject(i2.LiveAnnouncer), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(i3.BreakpointObserver), i0.ɵɵinject(MatSnackBar, 12), i0.ɵɵinject(MAT_SNACK_BAR_DEFAULT_OPTIONS)); }, token: MatSnackBar, providedIn: i4.MatSnackBarModule });
254MatSnackBar.decorators = [
255 { type: Injectable, args: [{ providedIn: MatSnackBarModule },] }
256];
257MatSnackBar.ctorParameters = () => [
258 { type: Overlay },
259 { type: LiveAnnouncer },
260 { type: Injector },
261 { type: BreakpointObserver },
262 { type: MatSnackBar, decorators: [{ type: Optional }, { type: SkipSelf }] },
263 { type: MatSnackBarConfig, decorators: [{ type: Inject, args: [MAT_SNACK_BAR_DEFAULT_OPTIONS,] }] }
264];
265//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic25hY2stYmFyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3NuYWNrLWJhci9zbmFjay1iYXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT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mVkU25hY2tCYXJSZWYpIHtcbiAgICAgIHRoaXMuX29wZW5lZFNuYWNrQmFyUmVmLmRpc21pc3MoKTtcbiAgICB9XG4gIH1cblxuICBuZ09uRGVzdHJveSgpIHtcbiAgICAvLyBPbmx5IGRpc21pc3MgdGhlIHNuYWNrIGJhciBhdCB0aGUgY3VycmVudCBsZXZlbCBvbiBkZXN0cm95LlxuICAgIGlmICh0aGlzLl9zbmFja0JhclJlZkF0VGhpc0xldmVsKSB7XG4gICAgICB0aGlzLl9zbmFja0JhclJlZkF0VGhpc0xldmVsLmRpc21pc3MoKTtcbiAgICB9XG4gIH1cblxuICAvKipcbiAgICogQXR0YWNoZXMgdGhlIHNuYWNrIGJhciBjb250YWluZXIgY29tcG9uZW50IHRvIHRoZSBvdmVybGF5LlxuICAgKi9cbiAgcHJpdmF0ZSBfYXR0YWNoU25hY2tCYXJDb250YWluZXIob3ZlcmxheVJlZjogT3ZlcmxheVJlZixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWc6IE1hdFNuYWNrQmFyQ29uZmlnKTogX1NuYWNrQmFyQ29udGFpbmVyIHtcblxuICAgIGNvbnN0IHVzZXJJbmplY3RvciA9IGNvbmZpZyAmJiBjb25maWcudmlld0NvbnRhaW5lclJlZiAmJiBjb25maWcudmlld0NvbnRhaW5lclJlZi5pbmplY3RvcjtcbiAgICBjb25zdCBpbmplY3RvciA9IEluamVjdG9yLmNyZWF0ZSh7XG4gICAgICBwYXJlbnQ6IHVzZXJJbmplY3RvciB8fCB0aGlzLl9pbmplY3RvcixcbiAgICAgIHByb3ZpZGVyczogW3twcm92aWRlOiBNYXRTbmFja0JhckNvbmZpZywgdXNlVmFsdWU6IGNvbmZpZ31dXG4gICAgfSk7XG5cbiAgICBjb25zdCBjb250YWluZXJQb3J0YWwgPVxuICAgICAgICBuZXcgQ29tcG9uZW50UG9ydGFsKHRoaXMuc25hY2tCYXJDb250YWluZXJDb21wb25lbnQsIGNvbmZpZy52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jb21wb25lbnQuXG4gICAqIEBwYXJhbSBjb25maWcgQ29uZmlnIHRoYXQgd2FzIHVzZWQgdG8gY3JlYXRlIHRoZSBzbmFjayBiYXIuXG4gICAqIEBwYXJhbSBzbmFja0JhclJlZiBSZWZlcmVuY2UgdG8gdGhlIHNuYWNrIGJhci5cbiAgICovXG4gIHByaXZhdGUgX2NyZWF0ZUluamVjdG9yPFQ+KGNvbmZpZzogTWF0U25hY2tCYXJDb25maWcsIHNuYWNrQmFyUmVmOiBNYXRTbmFja0JhclJlZjxUPik6IEluamVjdG9yIHtcbiAgICBjb25zdCB1c2VySW5qZWN0b3IgPSBjb25maWcgJiYgY29uZmlnLnZpZXdDb250YWluZXJSZWYgJiYgY29uZmlnLnZpZXdDb250YWluZXJSZWYuaW5qZWN0b3I7XG5cbiAgICByZXR1cm4gSW5qZWN0b3IuY3JlYXRlKHtcbiAgICAgIHBhcmVudDogdXNlckluamVjdG9yIHx8IHRoaXMuX2luamVjdG9yLFxuICAgICAgcHJvdmlkZXJzOiBbXG4gICAgICAgIHtwcm92aWRlOiBNYXRTbmFja0JhclJlZiwgdXNlVmFsdWU6IHNuYWNrQmFyUmVmfSxcbiAgICAgICAge3Byb3ZpZGU6IE1BVF9TTkFDS19CQVJfREFUQSwgdXNlVmFsdWU6IGNvbmZpZy5kYXRhfVxuICAgICAgXVxuICAgIH0pO1xuICB9XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.