source: trip-planner-front/node_modules/@angular/cdk/esm2015/text-field/autofill.js@ eed0bf8

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

initial commit

  • Property mode set to 100644
File size: 15.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 { Platform, normalizePassiveListenerOptions } from '@angular/cdk/platform';
9import { Directive, ElementRef, EventEmitter, Injectable, NgZone, Output, } from '@angular/core';
10import { coerceElement } from '@angular/cdk/coercion';
11import { EMPTY, Subject } from 'rxjs';
12import * as i0 from "@angular/core";
13import * as i1 from "@angular/cdk/platform";
14/** Options to pass to the animationstart listener. */
15const listenerOptions = normalizePassiveListenerOptions({ passive: true });
16/**
17 * An injectable service that can be used to monitor the autofill state of an input.
18 * Based on the following blog post:
19 * https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7
20 */
21export class AutofillMonitor {
22 constructor(_platform, _ngZone) {
23 this._platform = _platform;
24 this._ngZone = _ngZone;
25 this._monitoredElements = new Map();
26 }
27 monitor(elementOrRef) {
28 if (!this._platform.isBrowser) {
29 return EMPTY;
30 }
31 const element = coerceElement(elementOrRef);
32 const info = this._monitoredElements.get(element);
33 if (info) {
34 return info.subject;
35 }
36 const result = new Subject();
37 const cssClass = 'cdk-text-field-autofilled';
38 const listener = ((event) => {
39 // Animation events fire on initial element render, we check for the presence of the autofill
40 // CSS class to make sure this is a real change in state, not just the initial render before
41 // we fire off events.
42 if (event.animationName === 'cdk-text-field-autofill-start' &&
43 !element.classList.contains(cssClass)) {
44 element.classList.add(cssClass);
45 this._ngZone.run(() => result.next({ target: event.target, isAutofilled: true }));
46 }
47 else if (event.animationName === 'cdk-text-field-autofill-end' &&
48 element.classList.contains(cssClass)) {
49 element.classList.remove(cssClass);
50 this._ngZone.run(() => result.next({ target: event.target, isAutofilled: false }));
51 }
52 });
53 this._ngZone.runOutsideAngular(() => {
54 element.addEventListener('animationstart', listener, listenerOptions);
55 element.classList.add('cdk-text-field-autofill-monitored');
56 });
57 this._monitoredElements.set(element, {
58 subject: result,
59 unlisten: () => {
60 element.removeEventListener('animationstart', listener, listenerOptions);
61 }
62 });
63 return result;
64 }
65 stopMonitoring(elementOrRef) {
66 const element = coerceElement(elementOrRef);
67 const info = this._monitoredElements.get(element);
68 if (info) {
69 info.unlisten();
70 info.subject.complete();
71 element.classList.remove('cdk-text-field-autofill-monitored');
72 element.classList.remove('cdk-text-field-autofilled');
73 this._monitoredElements.delete(element);
74 }
75 }
76 ngOnDestroy() {
77 this._monitoredElements.forEach((_info, element) => this.stopMonitoring(element));
78 }
79}
80AutofillMonitor.ɵprov = i0.ɵɵdefineInjectable({ factory: function AutofillMonitor_Factory() { return new AutofillMonitor(i0.ɵɵinject(i1.Platform), i0.ɵɵinject(i0.NgZone)); }, token: AutofillMonitor, providedIn: "root" });
81AutofillMonitor.decorators = [
82 { type: Injectable, args: [{ providedIn: 'root' },] }
83];
84AutofillMonitor.ctorParameters = () => [
85 { type: Platform },
86 { type: NgZone }
87];
88/** A directive that can be used to monitor the autofill state of an input. */
89export class CdkAutofill {
90 constructor(_elementRef, _autofillMonitor) {
91 this._elementRef = _elementRef;
92 this._autofillMonitor = _autofillMonitor;
93 /** Emits when the autofill state of the element changes. */
94 this.cdkAutofill = new EventEmitter();
95 }
96 ngOnInit() {
97 this._autofillMonitor
98 .monitor(this._elementRef)
99 .subscribe(event => this.cdkAutofill.emit(event));
100 }
101 ngOnDestroy() {
102 this._autofillMonitor.stopMonitoring(this._elementRef);
103 }
104}
105CdkAutofill.decorators = [
106 { type: Directive, args: [{
107 selector: '[cdkAutofill]',
108 },] }
109];
110CdkAutofill.ctorParameters = () => [
111 { type: ElementRef },
112 { type: AutofillMonitor }
113];
114CdkAutofill.propDecorators = {
115 cdkAutofill: [{ type: Output }]
116};
117//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjoz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