/** * @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)); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: AutofillMonitor, deps: [{ token: i1.Platform }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: AutofillMonitor, providedIn: 'root' }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: AutofillMonitor, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: function () { return [{ type: i1.Platform }, { type: i0.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); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkAutofill, deps: [{ token: i0.ElementRef }, { token: AutofillMonitor }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: CdkAutofill, selector: "[cdkAutofill]", outputs: { cdkAutofill: "cdkAutofill" }, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkAutofill, decorators: [{ type: Directive, args: [{ selector: '[cdkAutofill]', }] }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: AutofillMonitor }]; }, propDecorators: { cdkAutofill: [{ type: Output }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJ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