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 | */
|
---|
8 | import { Platform } from '@angular/cdk/platform';
|
---|
9 | import { ElementRef, EventEmitter, NgZone, OnDestroy, OnInit } from '@angular/core';
|
---|
10 | import { Observable } from 'rxjs';
|
---|
11 | /** An event that is emitted when the autofill state of an input changes. */
|
---|
12 | export declare type AutofillEvent = {
|
---|
13 | /** The element whose autofill state changes. */
|
---|
14 | target: Element;
|
---|
15 | /** Whether the element is currently autofilled. */
|
---|
16 | isAutofilled: boolean;
|
---|
17 | };
|
---|
18 | /**
|
---|
19 | * An injectable service that can be used to monitor the autofill state of an input.
|
---|
20 | * Based on the following blog post:
|
---|
21 | * https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7
|
---|
22 | */
|
---|
23 | export declare class AutofillMonitor implements OnDestroy {
|
---|
24 | private _platform;
|
---|
25 | private _ngZone;
|
---|
26 | private _monitoredElements;
|
---|
27 | constructor(_platform: Platform, _ngZone: NgZone);
|
---|
28 | /**
|
---|
29 | * Monitor for changes in the autofill state of the given input element.
|
---|
30 | * @param element The element to monitor.
|
---|
31 | * @return A stream of autofill state changes.
|
---|
32 | */
|
---|
33 | monitor(element: Element): Observable<AutofillEvent>;
|
---|
34 | /**
|
---|
35 | * Monitor for changes in the autofill state of the given input element.
|
---|
36 | * @param element The element to monitor.
|
---|
37 | * @return A stream of autofill state changes.
|
---|
38 | */
|
---|
39 | monitor(element: ElementRef<Element>): Observable<AutofillEvent>;
|
---|
40 | /**
|
---|
41 | * Stop monitoring the autofill state of the given input element.
|
---|
42 | * @param element The element to stop monitoring.
|
---|
43 | */
|
---|
44 | stopMonitoring(element: Element): void;
|
---|
45 | /**
|
---|
46 | * Stop monitoring the autofill state of the given input element.
|
---|
47 | * @param element The element to stop monitoring.
|
---|
48 | */
|
---|
49 | stopMonitoring(element: ElementRef<Element>): void;
|
---|
50 | ngOnDestroy(): void;
|
---|
51 | }
|
---|
52 | /** A directive that can be used to monitor the autofill state of an input. */
|
---|
53 | export declare class CdkAutofill implements OnDestroy, OnInit {
|
---|
54 | private _elementRef;
|
---|
55 | private _autofillMonitor;
|
---|
56 | /** Emits when the autofill state of the element changes. */
|
---|
57 | readonly cdkAutofill: EventEmitter<AutofillEvent>;
|
---|
58 | constructor(_elementRef: ElementRef<HTMLElement>, _autofillMonitor: AutofillMonitor);
|
---|
59 | ngOnInit(): void;
|
---|
60 | ngOnDestroy(): void;
|
---|
61 | }
|
---|