source: trip-planner-front/node_modules/@angular/cdk/esm2015/overlay/dispatchers/overlay-outside-click-dispatcher.js@ 6a80231

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

initial commit

  • Property mode set to 100644
File size: 13.9 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 { DOCUMENT } from '@angular/common';
9import { Inject, Injectable } from '@angular/core';
10import { Platform, _getEventTarget } from '@angular/cdk/platform';
11import { BaseOverlayDispatcher } from './base-overlay-dispatcher';
12import * as i0 from "@angular/core";
13import * as i1 from "@angular/common";
14import * as i2 from "@angular/cdk/platform";
15/**
16 * Service for dispatching mouse click events that land on the body to appropriate overlay ref,
17 * if any. It maintains a list of attached overlays to determine best suited overlay based
18 * on event target and order of overlay opens.
19 */
20export class OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
21 constructor(document, _platform) {
22 super(document);
23 this._platform = _platform;
24 this._cursorStyleIsSet = false;
25 /** Click event listener that will be attached to the body propagate phase. */
26 this._clickListener = (event) => {
27 const target = _getEventTarget(event);
28 // We copy the array because the original may be modified asynchronously if the
29 // outsidePointerEvents listener decides to detach overlays resulting in index errors inside
30 // the for loop.
31 const overlays = this._attachedOverlays.slice();
32 // Dispatch the mouse event to the top overlay which has subscribers to its mouse events.
33 // We want to target all overlays for which the click could be considered as outside click.
34 // As soon as we reach an overlay for which the click is not outside click we break off
35 // the loop.
36 for (let i = overlays.length - 1; i > -1; i--) {
37 const overlayRef = overlays[i];
38 if (overlayRef._outsidePointerEvents.observers.length < 1 || !overlayRef.hasAttached()) {
39 continue;
40 }
41 // If it's a click inside the overlay, just break - we should do nothing
42 // If it's an outside click dispatch the mouse event, and proceed with the next overlay
43 if (overlayRef.overlayElement.contains(target)) {
44 break;
45 }
46 overlayRef._outsidePointerEvents.next(event);
47 }
48 };
49 }
50 /** Add a new overlay to the list of attached overlay refs. */
51 add(overlayRef) {
52 super.add(overlayRef);
53 // Safari on iOS does not generate click events for non-interactive
54 // elements. However, we want to receive a click for any element outside
55 // the overlay. We can force a "clickable" state by setting
56 // `cursor: pointer` on the document body. See:
57 // https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event#Safari_Mobile
58 // https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
59 if (!this._isAttached) {
60 const body = this._document.body;
61 body.addEventListener('click', this._clickListener, true);
62 body.addEventListener('auxclick', this._clickListener, true);
63 body.addEventListener('contextmenu', this._clickListener, true);
64 // click event is not fired on iOS. To make element "clickable" we are
65 // setting the cursor to pointer
66 if (this._platform.IOS && !this._cursorStyleIsSet) {
67 this._cursorOriginalValue = body.style.cursor;
68 body.style.cursor = 'pointer';
69 this._cursorStyleIsSet = true;
70 }
71 this._isAttached = true;
72 }
73 }
74 /** Detaches the global keyboard event listener. */
75 detach() {
76 if (this._isAttached) {
77 const body = this._document.body;
78 body.removeEventListener('click', this._clickListener, true);
79 body.removeEventListener('auxclick', this._clickListener, true);
80 body.removeEventListener('contextmenu', this._clickListener, true);
81 if (this._platform.IOS && this._cursorStyleIsSet) {
82 body.style.cursor = this._cursorOriginalValue;
83 this._cursorStyleIsSet = false;
84 }
85 this._isAttached = false;
86 }
87 }
88}
89OverlayOutsideClickDispatcher.ɵprov = i0.ɵɵdefineInjectable({ factory: function OverlayOutsideClickDispatcher_Factory() { return new OverlayOutsideClickDispatcher(i0.ɵɵinject(i1.DOCUMENT), i0.ɵɵinject(i2.Platform)); }, token: OverlayOutsideClickDispatcher, providedIn: "root" });
90OverlayOutsideClickDispatcher.decorators = [
91 { type: Injectable, args: [{ providedIn: 'root' },] }
92];
93OverlayOutsideClickDispatcher.ctorParameters = () => [
94 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
95 { type: Platform }
96];
97//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWx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S0tKSB7XG4gICAgICBjb25zdCBvdmVybGF5UmVmID0gb3ZlcmxheXNbaV07XG4gICAgICBpZiAob3ZlcmxheVJlZi5fb3V0c2lkZVBvaW50ZXJFdmVudHMub2JzZXJ2ZXJzLmxlbmd0aCA8IDEgfHwgIW92ZXJsYXlSZWYuaGFzQXR0YWNoZWQoKSkge1xuICAgICAgICBjb250aW51ZTtcbiAgICAgIH1cblxuICAgICAgLy8gSWYgaXQncyBhIGNsaWNrIGluc2lkZSB0aGUgb3ZlcmxheSwganVzdCBicmVhayAtIHdlIHNob3VsZCBkbyBub3RoaW5nXG4gICAgICAvLyBJZiBpdCdzIGFuIG91dHNpZGUgY2xpY2sgZGlzcGF0Y2ggdGhlIG1vdXNlIGV2ZW50LCBhbmQgcHJvY2VlZCB3aXRoIHRoZSBuZXh0IG92ZXJsYXlcbiAgICAgIGlmIChvdmVybGF5UmVmLm92ZXJsYXlFbGVtZW50LmNvbnRhaW5zKHRhcmdldCBhcyBOb2RlKSkge1xuICAgICAgICBicmVhaztcbiAgICAgIH1cblxuICAgICAgb3ZlcmxheVJlZi5fb3V0c2lkZVBvaW50ZXJFdmVudHMubmV4dChldmVudCk7XG4gICAgfVxuICB9XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.