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 { Directionality } from '@angular/cdk/bidi';
|
---|
9 | import { BooleanInput } from '@angular/cdk/coercion';
|
---|
10 | import { AfterContentChecked, AfterContentInit, AfterViewInit, ChangeDetectorRef, ElementRef, InjectionToken, NgZone, QueryList, OnDestroy } from '@angular/core';
|
---|
11 | import { CanColor } from '@angular/material/core';
|
---|
12 | import { MatError } from './error';
|
---|
13 | import { MatFormFieldControl } from './form-field-control';
|
---|
14 | import { MatHint } from './hint';
|
---|
15 | import { MatLabel } from './label';
|
---|
16 | import { MatPlaceholder } from './placeholder';
|
---|
17 | import { MatPrefix } from './prefix';
|
---|
18 | import { MatSuffix } from './suffix';
|
---|
19 | import { Platform } from '@angular/cdk/platform';
|
---|
20 | import { NgControl } from '@angular/forms';
|
---|
21 | /**
|
---|
22 | * Boilerplate for applying mixins to MatFormField.
|
---|
23 | * @docs-private
|
---|
24 | */
|
---|
25 | import * as ɵngcc0 from '@angular/core';
|
---|
26 | declare const _MatFormFieldBase: import("@angular/material/core/common-behaviors/constructor").Constructor<CanColor> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanColor> & {
|
---|
27 | new (_elementRef: ElementRef): {
|
---|
28 | _elementRef: ElementRef;
|
---|
29 | };
|
---|
30 | };
|
---|
31 | /** Possible appearance styles for the form field. */
|
---|
32 | export declare type MatFormFieldAppearance = 'legacy' | 'standard' | 'fill' | 'outline';
|
---|
33 | /** Possible values for the "floatLabel" form-field input. */
|
---|
34 | export declare type FloatLabelType = 'always' | 'never' | 'auto';
|
---|
35 | /**
|
---|
36 | * Represents the default options for the form field that can be configured
|
---|
37 | * using the `MAT_FORM_FIELD_DEFAULT_OPTIONS` injection token.
|
---|
38 | */
|
---|
39 | export interface MatFormFieldDefaultOptions {
|
---|
40 | appearance?: MatFormFieldAppearance;
|
---|
41 | hideRequiredMarker?: boolean;
|
---|
42 | /**
|
---|
43 | * Whether the label for form-fields should by default float `always`,
|
---|
44 | * `never`, or `auto` (only when necessary).
|
---|
45 | */
|
---|
46 | floatLabel?: FloatLabelType;
|
---|
47 | }
|
---|
48 | /**
|
---|
49 | * Injection token that can be used to configure the
|
---|
50 | * default options for all form field within an app.
|
---|
51 | */
|
---|
52 | export declare const MAT_FORM_FIELD_DEFAULT_OPTIONS: InjectionToken<MatFormFieldDefaultOptions>;
|
---|
53 | /**
|
---|
54 | * Injection token that can be used to inject an instances of `MatFormField`. It serves
|
---|
55 | * as alternative token to the actual `MatFormField` class which would cause unnecessary
|
---|
56 | * retention of the `MatFormField` class and its component metadata.
|
---|
57 | */
|
---|
58 | export declare const MAT_FORM_FIELD: InjectionToken<MatFormField>;
|
---|
59 | /** Container for form controls that applies Material Design styling and behavior. */
|
---|
60 | export declare class MatFormField extends _MatFormFieldBase implements AfterContentInit, AfterContentChecked, AfterViewInit, OnDestroy, CanColor {
|
---|
61 | private _changeDetectorRef;
|
---|
62 | private _dir;
|
---|
63 | private _defaults;
|
---|
64 | private _platform;
|
---|
65 | private _ngZone;
|
---|
66 | /**
|
---|
67 | * Whether the outline gap needs to be calculated
|
---|
68 | * immediately on the next change detection run.
|
---|
69 | */
|
---|
70 | private _outlineGapCalculationNeededImmediately;
|
---|
71 | /** Whether the outline gap needs to be calculated next time the zone has stabilized. */
|
---|
72 | private _outlineGapCalculationNeededOnStable;
|
---|
73 | private readonly _destroyed;
|
---|
74 | /** The form-field appearance style. */
|
---|
75 | get appearance(): MatFormFieldAppearance;
|
---|
76 | set appearance(value: MatFormFieldAppearance);
|
---|
77 | _appearance: MatFormFieldAppearance;
|
---|
78 | /** Whether the required marker should be hidden. */
|
---|
79 | get hideRequiredMarker(): boolean;
|
---|
80 | set hideRequiredMarker(value: boolean);
|
---|
81 | private _hideRequiredMarker;
|
---|
82 | /** Override for the logic that disables the label animation in certain cases. */
|
---|
83 | private _showAlwaysAnimate;
|
---|
84 | /** Whether the floating label should always float or not. */
|
---|
85 | _shouldAlwaysFloat(): boolean;
|
---|
86 | /** Whether the label can float or not. */
|
---|
87 | _canLabelFloat(): boolean;
|
---|
88 | /** State of the mat-hint and mat-error animations. */
|
---|
89 | _subscriptAnimationState: string;
|
---|
90 | /** Text for the form field hint. */
|
---|
91 | get hintLabel(): string;
|
---|
92 | set hintLabel(value: string);
|
---|
93 | private _hintLabel;
|
---|
94 | readonly _hintLabelId: string;
|
---|
95 | readonly _labelId: string;
|
---|
96 | /**
|
---|
97 | * Whether the label should always float, never float or float as the user types.
|
---|
98 | *
|
---|
99 | * Note: only the legacy appearance supports the `never` option. `never` was originally added as a
|
---|
100 | * way to make the floating label emulate the behavior of a standard input placeholder. However
|
---|
101 | * the form field now supports both floating labels and placeholders. Therefore in the non-legacy
|
---|
102 | * appearances the `never` option has been disabled in favor of just using the placeholder.
|
---|
103 | */
|
---|
104 | get floatLabel(): FloatLabelType;
|
---|
105 | set floatLabel(value: FloatLabelType);
|
---|
106 | private _floatLabel;
|
---|
107 | /** Whether the Angular animations are enabled. */
|
---|
108 | _animationsEnabled: boolean;
|
---|
109 | /**
|
---|
110 | * @deprecated
|
---|
111 | * @breaking-change 8.0.0
|
---|
112 | */
|
---|
113 | underlineRef: ElementRef;
|
---|
114 | _connectionContainerRef: ElementRef;
|
---|
115 | _inputContainerRef: ElementRef;
|
---|
116 | private _label;
|
---|
117 | _controlNonStatic: MatFormFieldControl<any>;
|
---|
118 | _controlStatic: MatFormFieldControl<any>;
|
---|
119 | get _control(): MatFormFieldControl<any>;
|
---|
120 | set _control(value: MatFormFieldControl<any>);
|
---|
121 | private _explicitFormFieldControl;
|
---|
122 | _labelChildNonStatic: MatLabel;
|
---|
123 | _labelChildStatic: MatLabel;
|
---|
124 | _placeholderChild: MatPlaceholder;
|
---|
125 | _errorChildren: QueryList<MatError>;
|
---|
126 | _hintChildren: QueryList<MatHint>;
|
---|
127 | _prefixChildren: QueryList<MatPrefix>;
|
---|
128 | _suffixChildren: QueryList<MatSuffix>;
|
---|
129 | constructor(elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef,
|
---|
130 | /**
|
---|
131 | * @deprecated `_labelOptions` parameter no longer being used. To be removed.
|
---|
132 | * @breaking-change 12.0.0
|
---|
133 | */
|
---|
134 | _labelOptions: any, _dir: Directionality, _defaults: MatFormFieldDefaultOptions, _platform: Platform, _ngZone: NgZone, _animationMode: string);
|
---|
135 | /**
|
---|
136 | * Gets the id of the label element. If no label is present, returns `null`.
|
---|
137 | */
|
---|
138 | getLabelId(): string | null;
|
---|
139 | /**
|
---|
140 | * Gets an ElementRef for the element that a overlay attached to the form-field should be
|
---|
141 | * positioned relative to.
|
---|
142 | */
|
---|
143 | getConnectedOverlayOrigin(): ElementRef;
|
---|
144 | ngAfterContentInit(): void;
|
---|
145 | ngAfterContentChecked(): void;
|
---|
146 | ngAfterViewInit(): void;
|
---|
147 | ngOnDestroy(): void;
|
---|
148 | /** Determines whether a class from the NgControl should be forwarded to the host element. */
|
---|
149 | _shouldForward(prop: keyof NgControl): boolean;
|
---|
150 | _hasPlaceholder(): boolean;
|
---|
151 | _hasLabel(): boolean;
|
---|
152 | _shouldLabelFloat(): boolean;
|
---|
153 | _hideControlPlaceholder(): boolean;
|
---|
154 | _hasFloatingLabel(): boolean;
|
---|
155 | /** Determines whether to display hints or errors. */
|
---|
156 | _getDisplayedMessages(): 'error' | 'hint';
|
---|
157 | /** Animates the placeholder up and locks it in position. */
|
---|
158 | _animateAndLockLabel(): void;
|
---|
159 | /**
|
---|
160 | * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
|
---|
161 | * or child element with the `mat-placeholder` directive).
|
---|
162 | */
|
---|
163 | private _validatePlaceholders;
|
---|
164 | /** Does any extra processing that is required when handling the hints. */
|
---|
165 | private _processHints;
|
---|
166 | /**
|
---|
167 | * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
|
---|
168 | * attribute being considered as `align="start"`.
|
---|
169 | */
|
---|
170 | private _validateHints;
|
---|
171 | /** Gets the default float label state. */
|
---|
172 | private _getDefaultFloatLabelState;
|
---|
173 | /**
|
---|
174 | * Sets the list of element IDs that describe the child control. This allows the control to update
|
---|
175 | * its `aria-describedby` attribute accordingly.
|
---|
176 | */
|
---|
177 | private _syncDescribedByIds;
|
---|
178 | /** Throws an error if the form field's control is missing. */
|
---|
179 | protected _validateControlChild(): void;
|
---|
180 | /**
|
---|
181 | * Updates the width and position of the gap in the outline. Only relevant for the outline
|
---|
182 | * appearance.
|
---|
183 | */
|
---|
184 | updateOutlineGap(): void;
|
---|
185 | /** Gets the start end of the rect considering the current directionality. */
|
---|
186 | private _getStartEnd;
|
---|
187 | /** Checks whether the form field is attached to the DOM. */
|
---|
188 | private _isAttachedToDOM;
|
---|
189 | static ngAcceptInputType_hideRequiredMarker: BooleanInput;
|
---|
190 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatFormField, [null, null, null, { optional: true; }, { optional: true; }, null, null, { optional: true; }]>;
|
---|
191 | static ɵcmp: ɵngcc0.ɵɵComponentDeclaration<MatFormField, "mat-form-field", ["matFormField"], { "color": "color"; "floatLabel": "floatLabel"; "appearance": "appearance"; "hideRequiredMarker": "hideRequiredMarker"; "hintLabel": "hintLabel"; }, {}, ["_controlNonStatic", "_controlStatic", "_labelChildNonStatic", "_labelChildStatic", "_placeholderChild", "_errorChildren", "_hintChildren", "_prefixChildren", "_suffixChildren"], ["[matPrefix]", "*", "mat-placeholder", "mat-label", "[matSuffix]", "mat-error", "mat-hint:not([align='end'])", "mat-hint[align='end']"]>;
|
---|
192 | }
|
---|
193 | export {};
|
---|
194 |
|
---|
195 | //# sourceMappingURL=form-field.d.ts.map |
---|