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