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 { Observable } from 'rxjs';
|
---|
9 | import { NgControl } from '@angular/forms';
|
---|
10 | /** An interface which allows a control to work inside of a `MatFormField`. */
|
---|
11 | export declare abstract class MatFormFieldControl<T> {
|
---|
12 | /** The value of the control. */
|
---|
13 | value: T | null;
|
---|
14 | /**
|
---|
15 | * Stream that emits whenever the state of the control changes such that the parent `MatFormField`
|
---|
16 | * needs to run change detection.
|
---|
17 | */
|
---|
18 | readonly stateChanges: Observable<void>;
|
---|
19 | /** The element ID for this control. */
|
---|
20 | readonly id: string;
|
---|
21 | /** The placeholder for this control. */
|
---|
22 | readonly placeholder: string;
|
---|
23 | /** Gets the NgControl for this control. */
|
---|
24 | readonly ngControl: NgControl | null;
|
---|
25 | /** Whether the control is focused. */
|
---|
26 | readonly focused: boolean;
|
---|
27 | /** Whether the control is empty. */
|
---|
28 | readonly empty: boolean;
|
---|
29 | /** Whether the `MatFormField` label should try to float. */
|
---|
30 | readonly shouldLabelFloat: boolean;
|
---|
31 | /** Whether the control is required. */
|
---|
32 | readonly required: boolean;
|
---|
33 | /** Whether the control is disabled. */
|
---|
34 | readonly disabled: boolean;
|
---|
35 | /** Whether the control is in an error state. */
|
---|
36 | readonly errorState: boolean;
|
---|
37 | /**
|
---|
38 | * An optional name for the control type that can be used to distinguish `mat-form-field` elements
|
---|
39 | * based on their control type. The form field will add a class,
|
---|
40 | * `mat-form-field-type-{{controlType}}` to its root element.
|
---|
41 | */
|
---|
42 | readonly controlType?: string;
|
---|
43 | /**
|
---|
44 | * Whether the input is currently in an autofilled state. If property is not present on the
|
---|
45 | * control it is assumed to be false.
|
---|
46 | */
|
---|
47 | readonly autofilled?: boolean;
|
---|
48 | /**
|
---|
49 | * Value of `aria-describedby` that should be merged with the described-by ids
|
---|
50 | * which are set by the form-field.
|
---|
51 | */
|
---|
52 | readonly userAriaDescribedBy?: string;
|
---|
53 | /** Sets the list of element IDs that currently describe this control. */
|
---|
54 | abstract setDescribedByIds(ids: string[]): void;
|
---|
55 | /** Handles a click on the control's container. */
|
---|
56 | abstract onContainerClick(event: MouseEvent): void;
|
---|
57 | }
|
---|