blob: bb76247266f4d9bf8996985f52c4df82b83022a2 [file] [log] [blame]
{"version":3,"file":"material-input.umd.min.js","sources":["../../node_modules/tslib/tslib.es6.js","../../src/material/input/input-errors.ts","../../src/material/input/autosize.ts","../../src/material/input/input-value-accessor.ts","../../src/material/input/input.ts","../../src/material/input/input-module.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** @docs-private */\nexport function getMatInputUnsupportedTypeError(type: string): Error {\n return Error(`Input type \"${type}\" isn't supported by matInput.`);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {CdkTextareaAutosize} from '@angular/cdk/text-field';\nimport {Directive, Input} from '@angular/core';\n\n/**\n * Directive to automatically resize a textarea to fit its content.\n * @deprecated Use `cdkTextareaAutosize` from `@angular/cdk/text-field` instead.\n * @breaking-change 8.0.0\n */\n@Directive({\n selector: 'textarea[mat-autosize], textarea[matTextareaAutosize]',\n exportAs: 'matTextareaAutosize',\n inputs: ['cdkAutosizeMinRows', 'cdkAutosizeMaxRows'],\n host: {\n 'class': 'cdk-textarea-autosize mat-autosize',\n // Textarea elements that have the directive applied should have a single row by default.\n // Browsers normally show two rows by default and therefore this limits the minRows binding.\n 'rows': '1',\n '(input)': '_noopInputHandler()',\n },\n})\nexport class MatTextareaAutosize extends CdkTextareaAutosize {\n @Input()\n get matAutosizeMinRows(): number { return this.minRows; }\n set matAutosizeMinRows(value: number) { this.minRows = value; }\n\n @Input()\n get matAutosizeMaxRows(): number { return this.maxRows; }\n set matAutosizeMaxRows(value: number) { this.maxRows = value; }\n\n @Input('mat-autosize')\n get matAutosize(): boolean { return this.enabled; }\n set matAutosize(value: boolean) { this.enabled = value; }\n\n @Input()\n get matTextareaAutosize(): boolean { return this.enabled; }\n set matTextareaAutosize(value: boolean) { this.enabled = value; }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {InjectionToken} from '@angular/core';\n\n\n/**\n * This token is used to inject the object whose value should be set into `MatInput`. If none is\n * provided, the native `HTMLInputElement` is used. Directives like `MatDatepickerInput` can provide\n * themselves for this token, in order to make `MatInput` delegate the getting and setting of the\n * value to them.\n */\nexport const MAT_INPUT_VALUE_ACCESSOR =\n new InjectionToken<{value: any}>('MAT_INPUT_VALUE_ACCESSOR');\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {getSupportedInputTypes, Platform} from '@angular/cdk/platform';\nimport {AutofillMonitor} from '@angular/cdk/text-field';\nimport {\n Directive,\n DoCheck,\n ElementRef,\n Inject,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n OnInit,\n Optional,\n Self,\n} from '@angular/core';\nimport {FormGroupDirective, NgControl, NgForm} from '@angular/forms';\nimport {\n CanUpdateErrorState,\n CanUpdateErrorStateCtor,\n ErrorStateMatcher,\n mixinErrorState,\n} from '@angular/material/core';\nimport {MatFormFieldControl} from '@angular/material/form-field';\nimport {Subject} from 'rxjs';\nimport {getMatInputUnsupportedTypeError} from './input-errors';\nimport {MAT_INPUT_VALUE_ACCESSOR} from './input-value-accessor';\n\n\n// Invalid input type. Using one of these will throw an MatInputUnsupportedTypeError.\nconst MAT_INPUT_INVALID_TYPES = [\n 'button',\n 'checkbox',\n 'file',\n 'hidden',\n 'image',\n 'radio',\n 'range',\n 'reset',\n 'submit'\n];\n\nlet nextUniqueId = 0;\n\n// Boilerplate for applying mixins to MatInput.\n/** @docs-private */\nclass MatInputBase {\n constructor(public _defaultErrorStateMatcher: ErrorStateMatcher,\n public _parentForm: NgForm,\n public _parentFormGroup: FormGroupDirective,\n /** @docs-private */\n public ngControl: NgControl) {}\n}\nconst _MatInputMixinBase: CanUpdateErrorStateCtor & typeof MatInputBase =\n mixinErrorState(MatInputBase);\n\n/** Directive that allows a native input to work inside a `MatFormField`. */\n@Directive({\n selector: `input[matInput], textarea[matInput], select[matNativeControl],\n input[matNativeControl], textarea[matNativeControl]`,\n exportAs: 'matInput',\n host: {\n /**\n * @breaking-change 8.0.0 remove .mat-form-field-autofill-control in favor of AutofillMonitor.\n */\n 'class': 'mat-input-element mat-form-field-autofill-control',\n '[class.mat-input-server]': '_isServer',\n // Native input properties that are overwritten by Angular inputs need to be synced with\n // the native input element. Otherwise property bindings for those don't work.\n '[attr.id]': 'id',\n '[attr.placeholder]': 'placeholder',\n '[disabled]': 'disabled',\n '[required]': 'required',\n '[attr.readonly]': 'readonly && !_isNativeSelect || null',\n '[attr.aria-describedby]': '_ariaDescribedby || null',\n '[attr.aria-invalid]': 'errorState',\n '[attr.aria-required]': 'required.toString()',\n '(blur)': '_focusChanged(false)',\n '(focus)': '_focusChanged(true)',\n '(input)': '_onInput()',\n },\n providers: [{provide: MatFormFieldControl, useExisting: MatInput}],\n})\nexport class MatInput extends _MatInputMixinBase implements MatFormFieldControl<any>, OnChanges,\n OnDestroy, OnInit, DoCheck, CanUpdateErrorState {\n protected _uid = `mat-input-${nextUniqueId++}`;\n protected _previousNativeValue: any;\n private _inputValueAccessor: {value: any};\n /** The aria-describedby attribute on the input for improved a11y. */\n _ariaDescribedby: string;\n\n /** Whether the component is being rendered on the server. */\n _isServer = false;\n\n /** Whether the component is a native html select. */\n _isNativeSelect = false;\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n focused: boolean = false;\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n controlType: string = 'mat-input';\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n autofilled = false;\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n @Input()\n get disabled(): boolean {\n if (this.ngControl && this.ngControl.disabled !== null) {\n return this.ngControl.disabled;\n }\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n\n // Browsers may not fire the blur event if the input is disabled too quickly.\n // Reset from here to ensure that the element doesn't become stuck.\n if (this.focused) {\n this.focused = false;\n this.stateChanges.next();\n }\n }\n protected _disabled = false;\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n @Input()\n get id(): string { return this._id; }\n set id(value: string) { this._id = value || this._uid; }\n protected _id: string;\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n @Input() placeholder: string;\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n @Input()\n get required(): boolean { return this._required; }\n set required(value: boolean) { this._required = coerceBooleanProperty(value); }\n protected _required = false;\n\n /** Input type of the element. */\n @Input()\n get type(): string { return this._type; }\n set type(value: string) {\n this._type = value || 'text';\n this._validateType();\n\n // When using Angular inputs, developers are no longer able to set the properties on the native\n // input element. To ensure that bindings for `type` work, we need to sync the setter\n // with the native property. Textarea elements don't support the type property or attribute.\n if (!this._isTextarea() && getSupportedInputTypes().has(this._type)) {\n (this._elementRef.nativeElement as HTMLInputElement).type = this._type;\n }\n }\n protected _type = 'text';\n\n /** An object used to control when error messages are shown. */\n @Input() errorStateMatcher: ErrorStateMatcher;\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n @Input()\n get value(): string { return this._inputValueAccessor.value; }\n set value(value: string) {\n if (value !== this.value) {\n this._inputValueAccessor.value = value;\n this.stateChanges.next();\n }\n }\n\n /** Whether the element is readonly. */\n @Input()\n get readonly(): boolean { return this._readonly; }\n set readonly(value: boolean) { this._readonly = coerceBooleanProperty(value); }\n private _readonly = false;\n\n protected _neverEmptyInputTypes = [\n 'date',\n 'datetime',\n 'datetime-local',\n 'month',\n 'time',\n 'week'\n ].filter(t => getSupportedInputTypes().has(t));\n\n constructor(\n protected _elementRef: ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>,\n protected _platform: Platform,\n /** @docs-private */\n @Optional() @Self() public ngControl: NgControl,\n @Optional() _parentForm: NgForm,\n @Optional() _parentFormGroup: FormGroupDirective,\n _defaultErrorStateMatcher: ErrorStateMatcher,\n @Optional() @Self() @Inject(MAT_INPUT_VALUE_ACCESSOR) inputValueAccessor: any,\n private _autofillMonitor: AutofillMonitor,\n ngZone: NgZone) {\n\n super(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl);\n\n const element = this._elementRef.nativeElement;\n\n // If no input value accessor was explicitly specified, use the element as the input value\n // accessor.\n this._inputValueAccessor = inputValueAccessor || element;\n\n this._previousNativeValue = this.value;\n\n // Force setter to be called in case id was not specified.\n this.id = this.id;\n\n // On some versions of iOS the caret gets stuck in the wrong place when holding down the delete\n // key. In order to get around this we need to \"jiggle\" the caret loose. Since this bug only\n // exists on iOS, we only bother to install the listener on iOS.\n if (_platform.IOS) {\n ngZone.runOutsideAngular(() => {\n _elementRef.nativeElement.addEventListener('keyup', (event: Event) => {\n let el = event.target as HTMLInputElement;\n if (!el.value && !el.selectionStart && !el.selectionEnd) {\n // Note: Just setting `0, 0` doesn't fix the issue. Setting\n // `1, 1` fixes it for the first time that you type text and\n // then hold delete. Toggling to `1, 1` and then back to\n // `0, 0` seems to completely fix it.\n el.setSelectionRange(1, 1);\n el.setSelectionRange(0, 0);\n }\n });\n });\n }\n\n this._isServer = !this._platform.isBrowser;\n this._isNativeSelect = element.nodeName.toLowerCase() === 'select';\n\n if (this._isNativeSelect) {\n this.controlType = (element as HTMLSelectElement).multiple ? 'mat-native-select-multiple' :\n 'mat-native-select';\n }\n }\n\n ngOnInit() {\n if (this._platform.isBrowser) {\n this._autofillMonitor.monitor(this._elementRef.nativeElement).subscribe(event => {\n this.autofilled = event.isAutofilled;\n this.stateChanges.next();\n });\n }\n }\n\n ngOnChanges() {\n this.stateChanges.next();\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n\n if (this._platform.isBrowser) {\n this._autofillMonitor.stopMonitoring(this._elementRef.nativeElement);\n }\n }\n\n ngDoCheck() {\n if (this.ngControl) {\n // We need to re-evaluate this on every change detection cycle, because there are some\n // error triggers that we can't subscribe to (e.g. parent form submissions). This means\n // that whatever logic is in here has to be super lean or we risk destroying the performance.\n this.updateErrorState();\n }\n\n // We need to dirty-check the native element's value, because there are some cases where\n // we won't be notified when it changes (e.g. the consumer isn't using forms or they're\n // updating the value using `emitEvent: false`).\n this._dirtyCheckNativeValue();\n }\n\n /** Focuses the input. */\n focus(): void {\n this._elementRef.nativeElement.focus();\n }\n\n /** Callback for the cases where the focused state of the input changes. */\n _focusChanged(isFocused: boolean) {\n if (isFocused !== this.focused && (!this.readonly || !isFocused)) {\n this.focused = isFocused;\n this.stateChanges.next();\n }\n }\n\n _onInput() {\n // This is a noop function and is used to let Angular know whenever the value changes.\n // Angular will run a new change detection each time the `input` event has been dispatched.\n // It's necessary that Angular recognizes the value change, because when floatingLabel\n // is set to false and Angular forms aren't used, the placeholder won't recognize the\n // value changes and will not disappear.\n // Listening to the input event wouldn't be necessary when the input is using the\n // FormsModule or ReactiveFormsModule, because Angular forms also listens to input events.\n }\n\n /** Does some manual dirty checking on the native input `value` property. */\n protected _dirtyCheckNativeValue() {\n const newValue = this._elementRef.nativeElement.value;\n\n if (this._previousNativeValue !== newValue) {\n this._previousNativeValue = newValue;\n this.stateChanges.next();\n }\n }\n\n /** Make sure the input is a supported type. */\n protected _validateType() {\n if (MAT_INPUT_INVALID_TYPES.indexOf(this._type) > -1) {\n throw getMatInputUnsupportedTypeError(this._type);\n }\n }\n\n /** Checks whether the input type is one of the types that are never empty. */\n protected _isNeverEmpty() {\n return this._neverEmptyInputTypes.indexOf(this._type) > -1;\n }\n\n /** Checks whether the input is invalid based on the native validation. */\n protected _isBadInput() {\n // The `validity` property won't be present on platform-server.\n let validity = (this._elementRef.nativeElement as HTMLInputElement).validity;\n return validity && validity.badInput;\n }\n\n /** Determines if the component host is a textarea. */\n protected _isTextarea() {\n return this._elementRef.nativeElement.nodeName.toLowerCase() === 'textarea';\n }\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n get empty(): boolean {\n return !this._isNeverEmpty() && !this._elementRef.nativeElement.value && !this._isBadInput() &&\n !this.autofilled;\n }\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n get shouldLabelFloat(): boolean {\n if (this._isNativeSelect) {\n // For a single-selection `<select>`, the label should float when the selected option has\n // a non-empty display value. For a `<select multiple>`, the label *always* floats to avoid\n // overlapping the label with the options.\n const selectElement = this._elementRef.nativeElement as HTMLSelectElement;\n const firstOption: HTMLOptionElement | undefined = selectElement.options[0];\n\n // On most browsers the `selectedIndex` will always be 0, however on IE and Edge it'll be\n // -1 if the `value` is set to something, that isn't in the list of options, at a later point.\n return this.focused || selectElement.multiple || !this.empty ||\n !!(selectElement.selectedIndex > -1 && firstOption && firstOption.label);\n } else {\n return this.focused || !this.empty;\n }\n }\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n /**\n * Implemented as part of MatFormFieldControl.\n * @docs-private\n */\n onContainerClick() {\n // Do not re-focus the input element if the element is already focused. Otherwise it can happen\n // that someone clicks on a time input and the cursor resets to the \"hours\" field while the\n // \"minutes\" field was actually clicked. See: https://github.com/angular/components/issues/12849\n if (!this.focused) {\n this.focus();\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {TextFieldModule} from '@angular/cdk/text-field';\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {ErrorStateMatcher} from '@angular/material/core';\nimport {MatFormFieldModule} from '@angular/material/form-field';\nimport {MatTextareaAutosize} from './autosize';\nimport {MatInput} from './input';\n\n\n@NgModule({\n declarations: [MatInput, MatTextareaAutosize],\n imports: [\n CommonModule,\n TextFieldModule,\n MatFormFieldModule,\n ],\n exports: [\n TextFieldModule,\n // We re-export the `MatFormFieldModule` since `MatInput` will almost always\n // be used together with `MatFormField`.\n MatFormFieldModule,\n MatInput,\n MatTextareaAutosize,\n ],\n providers: [ErrorStateMatcher],\n})\nexport class MatInputModule {}\n"],"names":["__extends","d","b","__","this","constructor","extendStatics","prototype","Object","create","getMatInputUnsupportedTypeError","type","Error","setPrototypeOf","__proto__","Array","p","hasOwnProperty","MatTextareaAutosize","_super","tslib_1.__extends","defineProperty","minRows","value","maxRows","enabled","Directive","args","selector","exportAs","inputs","host","class","rows","(input)","matAutosizeMinRows","Input","matAutosizeMaxRows","matAutosize","matTextareaAutosize","CdkTextareaAutosize","MAT_INPUT_VALUE_ACCESSOR","InjectionToken","MAT_INPUT_INVALID_TYPES","nextUniqueId","MatInputBase","_defaultErrorStateMatcher","_parentForm","_parentFormGroup","ngControl","_MatInputMixinBase","mixinErrorState","MatInput","_elementRef","_platform","inputValueAccessor","_autofillMonitor","ngZone","_this","call","_uid","_isServer","_isNativeSelect","focused","stateChanges","Subject","controlType","autofilled","_disabled","_required","_type","_readonly","_neverEmptyInputTypes","filter","t","getSupportedInputTypes","has","element","nativeElement","_inputValueAccessor","_previousNativeValue","id","IOS","runOutsideAngular","addEventListener","event","el","selectionStart","selectionEnd","setSelectionRange","isBrowser","nodeName","toLowerCase","multiple","disabled","coerceBooleanProperty","next","_id","_validateType","_isTextarea","ngOnInit","monitor","subscribe","isAutofilled","ngOnChanges","ngOnDestroy","complete","stopMonitoring","ngDoCheck","updateErrorState","_dirtyCheckNativeValue","focus","_focusChanged","isFocused","readonly","_onInput","newValue","indexOf","_isNeverEmpty","_isBadInput","validity","badInput","selectElement","firstOption","options","empty","selectedIndex","label","setDescribedByIds","ids","_ariaDescribedby","join","onContainerClick","[class.mat-input-server]","[attr.id]","[attr.placeholder]","[disabled]","[required]","[attr.readonly]","[attr.aria-describedby]","[attr.aria-invalid]","[attr.aria-required]","(blur)","(focus)","providers","provide","MatFormFieldControl","useExisting","ElementRef","Platform","NgControl","decorators","Optional","Self","NgForm","FormGroupDirective","ErrorStateMatcher","undefined","Inject","AutofillMonitor","NgZone","placeholder","required","errorStateMatcher","MatInputModule","NgModule","declarations","imports","CommonModule","TextFieldModule","MatFormFieldModule","exports"],"mappings":";;;;;;;k3BAuBA,SAAgBA,GAAUC,EAAGC,GAEzB,QAASC,KAAOC,KAAKC,YAAcJ,EADnCK,EAAcL,EAAGC,GAEjBD,EAAEM,UAAkB,OAANL,EAAaM,OAAOC,OAAOP,IAAMC,EAAGI,UAAYL,EAAEK,UAAW,GAAIJ,ICjBnF,QAAgBO,GAAgCC,GAC9C,MAAOC,OAAM,eAAeD,EAA9B,mCDMA,GAAIL,GAAgB,SAASL,EAAGC,GAI5B,OAHAI,EAAgBE,OAAOK,iBAChBC,uBAA2BC,QAAS,SAAUd,EAAGC,GAAKD,EAAEa,UAAYZ,IACvE,SAAUD,EAAGC,GAAK,IAAK,GAAIc,KAAKd,GAAOA,EAAEe,eAAeD,KAAIf,EAAEe,GAAKd,EAAEc,MACpDf,EAAGC,IEJ5BgB,EAAA,SAAAC,GAAA,QAAAD,oDA4BA,MAhByCE,GAAzCF,EAAAC,GACEX,OAAFa,eACMH,EADNX,UAAA,0BAAE,WACmC,MAAOH,MAAKkB,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