index.d.ts 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import { _AbstractConstructor } from '@angular/material/core';
  2. import { AfterViewInit } from '@angular/core';
  3. import { AutofillMonitor } from '@angular/cdk/text-field';
  4. import { BooleanInput } from '@angular/cdk/coercion';
  5. import { CanUpdateErrorState } from '@angular/material/core';
  6. import { _Constructor } from '@angular/material/core';
  7. import { DoCheck } from '@angular/core';
  8. import { ElementRef } from '@angular/core';
  9. import { ErrorStateMatcher } from '@angular/material/core';
  10. import { FormGroupDirective } from '@angular/forms';
  11. import * as i0 from '@angular/core';
  12. import * as i2 from '@angular/material/core';
  13. import * as i3 from '@angular/material/form-field';
  14. import * as i4 from '@angular/cdk/text-field';
  15. import { InjectionToken } from '@angular/core';
  16. import { MatFormField } from '@angular/material/form-field';
  17. import { MatFormFieldControl } from '@angular/material/form-field';
  18. import { NgControl } from '@angular/forms';
  19. import { NgForm } from '@angular/forms';
  20. import { NgZone } from '@angular/core';
  21. import { OnChanges } from '@angular/core';
  22. import { OnDestroy } from '@angular/core';
  23. import { Platform } from '@angular/cdk/platform';
  24. import { Subject } from 'rxjs';
  25. /** @docs-private */
  26. export declare function getMatInputUnsupportedTypeError(type: string): Error;
  27. declare namespace i1 {
  28. export {
  29. MatInput
  30. }
  31. }
  32. /**
  33. * This token is used to inject the object whose value should be set into `MatInput`. If none is
  34. * provided, the native `HTMLInputElement` is used. Directives like `MatDatepickerInput` can provide
  35. * themselves for this token, in order to make `MatInput` delegate the getting and setting of the
  36. * value to them.
  37. */
  38. export declare const MAT_INPUT_VALUE_ACCESSOR: InjectionToken<{
  39. value: any;
  40. }>;
  41. export declare class MatInput extends _MatInputBase implements MatFormFieldControl<any>, OnChanges, OnDestroy, AfterViewInit, DoCheck, CanUpdateErrorState {
  42. protected _elementRef: ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
  43. protected _platform: Platform;
  44. private _autofillMonitor;
  45. protected _formField?: MatFormField | undefined;
  46. protected _uid: string;
  47. protected _previousNativeValue: any;
  48. private _inputValueAccessor;
  49. private _previousPlaceholder;
  50. /** Whether the component is being rendered on the server. */
  51. readonly _isServer: boolean;
  52. /** Whether the component is a native html select. */
  53. readonly _isNativeSelect: boolean;
  54. /** Whether the component is a textarea. */
  55. readonly _isTextarea: boolean;
  56. /** Whether the input is inside of a form field. */
  57. readonly _isInFormField: boolean;
  58. /**
  59. * Implemented as part of MatFormFieldControl.
  60. * @docs-private
  61. */
  62. focused: boolean;
  63. /**
  64. * Implemented as part of MatFormFieldControl.
  65. * @docs-private
  66. */
  67. readonly stateChanges: Subject<void>;
  68. /**
  69. * Implemented as part of MatFormFieldControl.
  70. * @docs-private
  71. */
  72. controlType: string;
  73. /**
  74. * Implemented as part of MatFormFieldControl.
  75. * @docs-private
  76. */
  77. autofilled: boolean;
  78. /**
  79. * Implemented as part of MatFormFieldControl.
  80. * @docs-private
  81. */
  82. get disabled(): boolean;
  83. set disabled(value: BooleanInput);
  84. protected _disabled: boolean;
  85. /**
  86. * Implemented as part of MatFormFieldControl.
  87. * @docs-private
  88. */
  89. get id(): string;
  90. set id(value: string);
  91. protected _id: string;
  92. /**
  93. * Implemented as part of MatFormFieldControl.
  94. * @docs-private
  95. */
  96. placeholder: string;
  97. /**
  98. * Name of the input.
  99. * @docs-private
  100. */
  101. name: string;
  102. /**
  103. * Implemented as part of MatFormFieldControl.
  104. * @docs-private
  105. */
  106. get required(): boolean;
  107. set required(value: BooleanInput);
  108. protected _required: boolean | undefined;
  109. /** Input type of the element. */
  110. get type(): string;
  111. set type(value: string);
  112. protected _type: string;
  113. /** An object used to control when error messages are shown. */
  114. errorStateMatcher: ErrorStateMatcher;
  115. /**
  116. * Implemented as part of MatFormFieldControl.
  117. * @docs-private
  118. */
  119. userAriaDescribedBy: string;
  120. /**
  121. * Implemented as part of MatFormFieldControl.
  122. * @docs-private
  123. */
  124. get value(): string;
  125. set value(value: any);
  126. /** Whether the element is readonly. */
  127. get readonly(): boolean;
  128. set readonly(value: BooleanInput);
  129. private _readonly;
  130. protected _neverEmptyInputTypes: string[];
  131. constructor(_elementRef: ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>, _platform: Platform, ngControl: NgControl, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _defaultErrorStateMatcher: ErrorStateMatcher, inputValueAccessor: any, _autofillMonitor: AutofillMonitor, ngZone: NgZone, _formField?: MatFormField | undefined);
  132. ngAfterViewInit(): void;
  133. ngOnChanges(): void;
  134. ngOnDestroy(): void;
  135. ngDoCheck(): void;
  136. /** Focuses the input. */
  137. focus(options?: FocusOptions): void;
  138. /** Callback for the cases where the focused state of the input changes. */
  139. _focusChanged(isFocused: boolean): void;
  140. _onInput(): void;
  141. /** Does some manual dirty checking on the native input `value` property. */
  142. protected _dirtyCheckNativeValue(): void;
  143. /** Does some manual dirty checking on the native input `placeholder` attribute. */
  144. private _dirtyCheckPlaceholder;
  145. /** Gets the current placeholder of the form field. */
  146. protected _getPlaceholder(): string | null;
  147. /** Make sure the input is a supported type. */
  148. protected _validateType(): void;
  149. /** Checks whether the input type is one of the types that are never empty. */
  150. protected _isNeverEmpty(): boolean;
  151. /** Checks whether the input is invalid based on the native validation. */
  152. protected _isBadInput(): boolean;
  153. /**
  154. * Implemented as part of MatFormFieldControl.
  155. * @docs-private
  156. */
  157. get empty(): boolean;
  158. /**
  159. * Implemented as part of MatFormFieldControl.
  160. * @docs-private
  161. */
  162. get shouldLabelFloat(): boolean;
  163. /**
  164. * Implemented as part of MatFormFieldControl.
  165. * @docs-private
  166. */
  167. setDescribedByIds(ids: string[]): void;
  168. /**
  169. * Implemented as part of MatFormFieldControl.
  170. * @docs-private
  171. */
  172. onContainerClick(): void;
  173. /** Whether the form control is a native select that is displayed inline. */
  174. _isInlineSelect(): boolean;
  175. private _iOSKeyupListener;
  176. static ɵfac: i0.ɵɵFactoryDeclaration<MatInput, [null, null, { optional: true; self: true; }, { optional: true; }, { optional: true; }, null, { optional: true; self: true; }, null, null, { optional: true; }]>;
  177. static ɵdir: i0.ɵɵDirectiveDeclaration<MatInput, "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", ["matInput"], { "disabled": { "alias": "disabled"; "required": false; }; "id": { "alias": "id"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "name": { "alias": "name"; "required": false; }; "required": { "alias": "required"; "required": false; }; "type": { "alias": "type"; "required": false; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "userAriaDescribedBy": { "alias": "aria-describedby"; "required": false; }; "value": { "alias": "value"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; }, {}, never, never, false, never>;
  178. }
  179. /** @docs-private */
  180. declare const _MatInputBase: _Constructor<CanUpdateErrorState> & _AbstractConstructor<CanUpdateErrorState> & {
  181. new (_defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl): {
  182. /**
  183. * Emits whenever the component state changes and should cause the parent
  184. * form field to update. Implemented as part of `MatFormFieldControl`.
  185. * @docs-private
  186. */
  187. readonly stateChanges: Subject<void>;
  188. _defaultErrorStateMatcher: ErrorStateMatcher;
  189. _parentForm: NgForm;
  190. _parentFormGroup: FormGroupDirective;
  191. /**
  192. * Form control bound to the component.
  193. * Implemented as part of `MatFormFieldControl`.
  194. * @docs-private
  195. */
  196. ngControl: NgControl;
  197. };
  198. };
  199. export declare class MatInputModule {
  200. static ɵfac: i0.ɵɵFactoryDeclaration<MatInputModule, never>;
  201. static ɵmod: i0.ɵɵNgModuleDeclaration<MatInputModule, [typeof i1.MatInput], [typeof i2.MatCommonModule, typeof i3.MatFormFieldModule], [typeof i1.MatInput, typeof i3.MatFormFieldModule, typeof i4.TextFieldModule, typeof i2.MatCommonModule]>;
  202. static ɵinj: i0.ɵɵInjectorDeclaration<MatInputModule>;
  203. }
  204. export { }