input.d.ts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 { AutofillMonitor } from '@angular/cdk/text-field';
  10. import { DoCheck, ElementRef, NgZone, OnChanges, OnDestroy, OnInit } from '@angular/core';
  11. import { FormGroupDirective, NgControl, NgForm } from '@angular/forms';
  12. import { CanUpdateErrorState, CanUpdateErrorStateCtor, ErrorStateMatcher } from '@angular/material/core';
  13. import { MatFormFieldControl } from '@angular/material/form-field';
  14. import { Subject } from 'rxjs';
  15. /** @docs-private */
  16. declare class MatInputBase {
  17. _defaultErrorStateMatcher: ErrorStateMatcher;
  18. _parentForm: NgForm;
  19. _parentFormGroup: FormGroupDirective;
  20. /** @docs-private */
  21. ngControl: NgControl;
  22. constructor(_defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective,
  23. /** @docs-private */
  24. ngControl: NgControl);
  25. }
  26. declare const _MatInputMixinBase: CanUpdateErrorStateCtor & typeof MatInputBase;
  27. /** Directive that allows a native input to work inside a `MatFormField`. */
  28. export declare class MatInput extends _MatInputMixinBase implements MatFormFieldControl<any>, OnChanges, OnDestroy, OnInit, DoCheck, CanUpdateErrorState {
  29. protected _elementRef: ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
  30. protected _platform: Platform;
  31. /** @docs-private */
  32. ngControl: NgControl;
  33. private _autofillMonitor;
  34. protected _uid: string;
  35. protected _previousNativeValue: any;
  36. private _inputValueAccessor;
  37. /** The aria-describedby attribute on the input for improved a11y. */
  38. _ariaDescribedby: string;
  39. /** Whether the component is being rendered on the server. */
  40. _isServer: boolean;
  41. /** Whether the component is a native html select. */
  42. _isNativeSelect: boolean;
  43. /**
  44. * Implemented as part of MatFormFieldControl.
  45. * @docs-private
  46. */
  47. focused: boolean;
  48. /**
  49. * Implemented as part of MatFormFieldControl.
  50. * @docs-private
  51. */
  52. readonly stateChanges: Subject<void>;
  53. /**
  54. * Implemented as part of MatFormFieldControl.
  55. * @docs-private
  56. */
  57. controlType: string;
  58. /**
  59. * Implemented as part of MatFormFieldControl.
  60. * @docs-private
  61. */
  62. autofilled: boolean;
  63. /**
  64. * Implemented as part of MatFormFieldControl.
  65. * @docs-private
  66. */
  67. disabled: boolean;
  68. protected _disabled: boolean;
  69. /**
  70. * Implemented as part of MatFormFieldControl.
  71. * @docs-private
  72. */
  73. id: string;
  74. protected _id: string;
  75. /**
  76. * Implemented as part of MatFormFieldControl.
  77. * @docs-private
  78. */
  79. placeholder: string;
  80. /**
  81. * Implemented as part of MatFormFieldControl.
  82. * @docs-private
  83. */
  84. required: boolean;
  85. protected _required: boolean;
  86. /** Input type of the element. */
  87. type: string;
  88. protected _type: string;
  89. /** An object used to control when error messages are shown. */
  90. errorStateMatcher: ErrorStateMatcher;
  91. /**
  92. * Implemented as part of MatFormFieldControl.
  93. * @docs-private
  94. */
  95. value: string;
  96. /** Whether the element is readonly. */
  97. readonly: boolean;
  98. private _readonly;
  99. protected _neverEmptyInputTypes: string[];
  100. constructor(_elementRef: ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>, _platform: Platform,
  101. /** @docs-private */
  102. ngControl: NgControl, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _defaultErrorStateMatcher: ErrorStateMatcher, inputValueAccessor: any, _autofillMonitor: AutofillMonitor, ngZone: NgZone);
  103. ngOnInit(): void;
  104. ngOnChanges(): void;
  105. ngOnDestroy(): void;
  106. ngDoCheck(): void;
  107. /** Focuses the input. */
  108. focus(options?: FocusOptions): void;
  109. /** Callback for the cases where the focused state of the input changes. */
  110. _focusChanged(isFocused: boolean): void;
  111. _onInput(): void;
  112. /** Does some manual dirty checking on the native input `value` property. */
  113. protected _dirtyCheckNativeValue(): void;
  114. /** Make sure the input is a supported type. */
  115. protected _validateType(): void;
  116. /** Checks whether the input type is one of the types that are never empty. */
  117. protected _isNeverEmpty(): boolean;
  118. /** Checks whether the input is invalid based on the native validation. */
  119. protected _isBadInput(): boolean;
  120. /** Determines if the component host is a textarea. */
  121. protected _isTextarea(): boolean;
  122. /**
  123. * Implemented as part of MatFormFieldControl.
  124. * @docs-private
  125. */
  126. readonly empty: boolean;
  127. /**
  128. * Implemented as part of MatFormFieldControl.
  129. * @docs-private
  130. */
  131. readonly shouldLabelFloat: boolean;
  132. /**
  133. * Implemented as part of MatFormFieldControl.
  134. * @docs-private
  135. */
  136. setDescribedByIds(ids: string[]): void;
  137. /**
  138. * Implemented as part of MatFormFieldControl.
  139. * @docs-private
  140. */
  141. onContainerClick(): void;
  142. }
  143. export {};