/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Platform, normalizePassiveListenerOptions } from '@angular/cdk/platform'; import { Directive, ElementRef, EventEmitter, Injectable, NgZone, Output, } from '@angular/core'; import { coerceElement } from '@angular/cdk/coercion'; import { EMPTY, Subject } from 'rxjs'; import * as i0 from "@angular/core"; import * as i1 from "@angular/cdk/platform"; /** Options to pass to the animationstart listener. */ const listenerOptions = normalizePassiveListenerOptions({ passive: true }); /** * An injectable service that can be used to monitor the autofill state of an input. * Based on the following blog post: * https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7 */ export class AutofillMonitor { constructor(_platform, _ngZone) { this._platform = _platform; this._ngZone = _ngZone; this._monitoredElements = new Map(); } monitor(elementOrRef) { if (!this._platform.isBrowser) { return EMPTY; } const element = coerceElement(elementOrRef); const info = this._monitoredElements.get(element); if (info) { return info.subject; } const result = new Subject(); const cssClass = 'cdk-text-field-autofilled'; const listener = ((event) => { // Animation events fire on initial element render, we check for the presence of the autofill // CSS class to make sure this is a real change in state, not just the initial render before // we fire off events. if (event.animationName === 'cdk-text-field-autofill-start' && !element.classList.contains(cssClass)) { element.classList.add(cssClass); this._ngZone.run(() => result.next({ target: event.target, isAutofilled: true })); } else if (event.animationName === 'cdk-text-field-autofill-end' && element.classList.contains(cssClass)) { element.classList.remove(cssClass); this._ngZone.run(() => result.next({ target: event.target, isAutofilled: false })); } }); this._ngZone.runOutsideAngular(() => { element.addEventListener('animationstart', listener, listenerOptions); element.classList.add('cdk-text-field-autofill-monitored'); }); this._monitoredElements.set(element, { subject: result, unlisten: () => { element.removeEventListener('animationstart', listener, listenerOptions); } }); return result; } stopMonitoring(elementOrRef) { const element = coerceElement(elementOrRef); const info = this._monitoredElements.get(element); if (info) { info.unlisten(); info.subject.complete(); element.classList.remove('cdk-text-field-autofill-monitored'); element.classList.remove('cdk-text-field-autofilled'); this._monitoredElements.delete(element); } } ngOnDestroy() { this._monitoredElements.forEach((_info, element) => this.stopMonitoring(element)); } } AutofillMonitor.ɵprov = i0.ɵɵdefineInjectable({ factory: function AutofillMonitor_Factory() { return new AutofillMonitor(i0.ɵɵinject(i1.Platform), i0.ɵɵinject(i0.NgZone)); }, token: AutofillMonitor, providedIn: "root" }); AutofillMonitor.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; AutofillMonitor.ctorParameters = () => [ { type: Platform }, { type: NgZone } ]; /** A directive that can be used to monitor the autofill state of an input. */ export class CdkAutofill { constructor(_elementRef, _autofillMonitor) { this._elementRef = _elementRef; this._autofillMonitor = _autofillMonitor; /** Emits when the autofill state of the element changes. */ this.cdkAutofill = new EventEmitter(); } ngOnInit() { this._autofillMonitor .monitor(this._elementRef) .subscribe(event => this.cdkAutofill.emit(event)); } ngOnDestroy() { this._autofillMonitor.stopMonitoring(this._elementRef); } } CdkAutofill.decorators = [ { type: Directive, args: [{ selector: '[cdkAutofill]', },] } ]; CdkAutofill.ctorParameters = () => [ { type: ElementRef }, { type: AutofillMonitor } ]; CdkAutofill.propDecorators = { cdkAutofill: [{ type: Output }] }; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b2ZpbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL3RleHQtZmllbGQvYXV0b2ZpbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFFBQVEsRUFBRSwrQkFBK0IsRUFBQyxNQUFNLHVCQUF1QixDQUFDO0FBQ2hGLE9BQU8sRUFDTCxTQUFTLEVBQ1QsVUFBVSxFQUNWLFlBQVksRUFDWixVQUFVLEVBQ1YsTUFBTSxFQUdOLE1BQU0sR0FDUCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUMsYUFBYSxFQUFDLE1B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