@angular/material
Version:
Angular Material
848 lines (829 loc) • 33.5 kB
JavaScript
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/platform'), require('@angular/common'), require('@angular/core'), require('@angular/material/form-field'), require('rxjs/observable/fromEvent'), require('rxjs/operators/auditTime'), require('rxjs/operators/takeUntil'), require('rxjs/Subject'), require('@angular/cdk/coercion'), require('@angular/forms'), require('@angular/material/core')) :
typeof define === 'function' && define.amd ? define(['exports', '@angular/cdk/platform', '@angular/common', '@angular/core', '@angular/material/form-field', 'rxjs/observable/fromEvent', 'rxjs/operators/auditTime', 'rxjs/operators/takeUntil', 'rxjs/Subject', '@angular/cdk/coercion', '@angular/forms', '@angular/material/core'], factory) :
(factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.input = global.ng.material.input || {}),global.ng.cdk.platform,global.ng.common,global.ng.core,global.ng.material.formField,global.Rx.Observable,global.Rx.operators,global.Rx.operators,global.Rx,global.ng.cdk.coercion,global.ng.forms,global.ng.material.core));
}(this, (function (exports,_angular_cdk_platform,_angular_common,_angular_core,_angular_material_formField,rxjs_observable_fromEvent,rxjs_operators_auditTime,rxjs_operators_takeUntil,rxjs_Subject,_angular_cdk_coercion,_angular_forms,_angular_material_core) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Directive to automatically resize a textarea to fit its content.
*/
var MatTextareaAutosize = /** @class */ (function () {
function MatTextareaAutosize(_elementRef, _platform, _ngZone) {
this._elementRef = _elementRef;
this._platform = _platform;
this._ngZone = _ngZone;
this._destroyed = new rxjs_Subject.Subject();
}
Object.defineProperty(MatTextareaAutosize.prototype, "minRows", {
get: /**
* @return {?}
*/
function () { return this._minRows; },
set: /**
* Minimum amount of rows in the textarea.
* @param {?} value
* @return {?}
*/
function (value) {
this._minRows = value;
this._setMinHeight();
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatTextareaAutosize.prototype, "maxRows", {
get: /**
* Maximum amount of rows in the textarea.
* @return {?}
*/
function () { return this._maxRows; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._maxRows = value;
this._setMaxHeight();
},
enumerable: true,
configurable: true
});
// TODO(crisbeto): make the `_ngZone` a required param in the next major version.
/** Sets the minimum height of the textarea as determined by minRows. */
/**
* Sets the minimum height of the textarea as determined by minRows.
* @return {?}
*/
MatTextareaAutosize.prototype._setMinHeight = /**
* Sets the minimum height of the textarea as determined by minRows.
* @return {?}
*/
function () {
var /** @type {?} */ minHeight = this.minRows && this._cachedLineHeight ?
this.minRows * this._cachedLineHeight + "px" : null;
if (minHeight) {
this._setTextareaStyle('minHeight', minHeight);
}
};
/** Sets the maximum height of the textarea as determined by maxRows. */
/**
* Sets the maximum height of the textarea as determined by maxRows.
* @return {?}
*/
MatTextareaAutosize.prototype._setMaxHeight = /**
* Sets the maximum height of the textarea as determined by maxRows.
* @return {?}
*/
function () {
var /** @type {?} */ maxHeight = this.maxRows && this._cachedLineHeight ?
this.maxRows * this._cachedLineHeight + "px" : null;
if (maxHeight) {
this._setTextareaStyle('maxHeight', maxHeight);
}
};
/**
* @return {?}
*/
MatTextareaAutosize.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
var _this = this;
if (this._platform.isBrowser) {
this.resizeToFitContent();
if (this._ngZone) {
this._ngZone.runOutsideAngular(function () {
rxjs_observable_fromEvent.fromEvent(window, 'resize')
.pipe(rxjs_operators_auditTime.auditTime(16), rxjs_operators_takeUntil.takeUntil(_this._destroyed))
.subscribe(function () { return _this.resizeToFitContent(true); });
});
}
}
};
/**
* @return {?}
*/
MatTextareaAutosize.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this._destroyed.next();
this._destroyed.complete();
};
/**
* Sets a style property on the textarea element.
* @param {?} property
* @param {?} value
* @return {?}
*/
MatTextareaAutosize.prototype._setTextareaStyle = /**
* Sets a style property on the textarea element.
* @param {?} property
* @param {?} value
* @return {?}
*/
function (property, value) {
var /** @type {?} */ textarea = /** @type {?} */ (this._elementRef.nativeElement);
textarea.style[property] = value;
};
/**
* Cache the height of a single-row textarea if it has not already been cached.
*
* We need to know how large a single "row" of a textarea is in order to apply minRows and
* maxRows. For the initial version, we will assume that the height of a single line in the
* textarea does not ever change.
* @return {?}
*/
MatTextareaAutosize.prototype._cacheTextareaLineHeight = /**
* Cache the height of a single-row textarea if it has not already been cached.
*
* We need to know how large a single "row" of a textarea is in order to apply minRows and
* maxRows. For the initial version, we will assume that the height of a single line in the
* textarea does not ever change.
* @return {?}
*/
function () {
if (this._cachedLineHeight) {
return;
}
var /** @type {?} */ textarea = /** @type {?} */ (this._elementRef.nativeElement);
// Use a clone element because we have to override some styles.
var /** @type {?} */ textareaClone = /** @type {?} */ (textarea.cloneNode(false));
textareaClone.rows = 1;
// Use `position: absolute` so that this doesn't cause a browser layout and use
// `visibility: hidden` so that nothing is rendered. Clear any other styles that
// would affect the height.
textareaClone.style.position = 'absolute';
textareaClone.style.visibility = 'hidden';
textareaClone.style.border = 'none';
textareaClone.style.padding = '0';
textareaClone.style.height = '';
textareaClone.style.minHeight = '';
textareaClone.style.maxHeight = '';
// In Firefox it happens that textarea elements are always bigger than the specified amount
// of rows. This is because Firefox tries to add extra space for the horizontal scrollbar.
// As a workaround that removes the extra space for the scrollbar, we can just set overflow
// to hidden. This ensures that there is no invalid calculation of the line height.
// See Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=33654
textareaClone.style.overflow = 'hidden'; /** @type {?} */
((textarea.parentNode)).appendChild(textareaClone);
this._cachedLineHeight = textareaClone.clientHeight; /** @type {?} */
((textarea.parentNode)).removeChild(textareaClone);
// Min and max heights have to be re-calculated if the cached line height changes
this._setMinHeight();
this._setMaxHeight();
};
/**
* @return {?}
*/
MatTextareaAutosize.prototype.ngDoCheck = /**
* @return {?}
*/
function () {
if (this._platform.isBrowser) {
this.resizeToFitContent();
}
};
/**
* Resize the textarea to fit its content.
* @param force Whether to force a height recalculation. By default the height will be
* recalculated only if the value changed since the last call.
*/
/**
* Resize the textarea to fit its content.
* @param {?=} force Whether to force a height recalculation. By default the height will be
* recalculated only if the value changed since the last call.
* @return {?}
*/
MatTextareaAutosize.prototype.resizeToFitContent = /**
* Resize the textarea to fit its content.
* @param {?=} force Whether to force a height recalculation. By default the height will be
* recalculated only if the value changed since the last call.
* @return {?}
*/
function (force) {
if (force === void 0) { force = false; }
this._cacheTextareaLineHeight();
// If we haven't determined the line-height yet, we know we're still hidden and there's no point
// in checking the height of the textarea.
if (!this._cachedLineHeight) {
return;
}
var /** @type {?} */ textarea = /** @type {?} */ (this._elementRef.nativeElement);
var /** @type {?} */ value = textarea.value;
// Only resize of the value changed since these calculations can be expensive.
if (value === this._previousValue && !force) {
return;
}
var /** @type {?} */ placeholderText = textarea.placeholder;
// Reset the textarea height to auto in order to shrink back to its default size.
// Also temporarily force overflow:hidden, so scroll bars do not interfere with calculations.
// Long placeholders that are wider than the textarea width may lead to a bigger scrollHeight
// value. To ensure that the scrollHeight is not bigger than the content, the placeholders
// need to be removed temporarily.
textarea.style.height = 'auto';
textarea.style.overflow = 'hidden';
textarea.placeholder = '';
// Use the scrollHeight to know how large the textarea *would* be if fit its entire value.
textarea.style.height = textarea.scrollHeight + "px";
textarea.style.overflow = '';
textarea.placeholder = placeholderText;
this._previousValue = value;
};
MatTextareaAutosize.decorators = [
{ type: _angular_core.Directive, args: [{
selector: "textarea[mat-autosize], textarea[matTextareaAutosize]",
exportAs: 'matTextareaAutosize',
host: {
'class': 'mat-autosize',
// Textarea elements that have the directive applied should have a single row by default.
// Browsers normally show two rows by default and therefore this limits the minRows binding.
'rows': '1',
},
},] },
];
/** @nocollapse */
MatTextareaAutosize.ctorParameters = function () { return [
{ type: _angular_core.ElementRef, },
{ type: _angular_cdk_platform.Platform, },
{ type: _angular_core.NgZone, },
]; };
MatTextareaAutosize.propDecorators = {
"minRows": [{ type: _angular_core.Input, args: ['matAutosizeMinRows',] },],
"maxRows": [{ type: _angular_core.Input, args: ['matAutosizeMaxRows',] },],
};
return MatTextareaAutosize;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* \@docs-private
* @param {?} type
* @return {?}
*/
function getMatInputUnsupportedTypeError(type) {
return Error("Input type \"" + type + "\" isn't supported by matInput.");
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* This token is used to inject the object whose value should be set into `MatInput`. If none is
* provided, the native `HTMLInputElement` is used. Directives like `MatDatepickerInput` can provide
* themselves for this token, in order to make `MatInput` delegate the getting and setting of the
* value to them.
*/
var MAT_INPUT_VALUE_ACCESSOR = new _angular_core.InjectionToken('MAT_INPUT_VALUE_ACCESSOR');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
// Invalid input type. Using one of these will throw an MatInputUnsupportedTypeError.
var MAT_INPUT_INVALID_TYPES = [
'button',
'checkbox',
'file',
'hidden',
'image',
'radio',
'range',
'reset',
'submit'
];
var nextUniqueId = 0;
/**
* \@docs-private
*/
var MatInputBase = /** @class */ (function () {
function MatInputBase(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) {
this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
this._parentForm = _parentForm;
this._parentFormGroup = _parentFormGroup;
this.ngControl = ngControl;
}
return MatInputBase;
}());
var _MatInputMixinBase = _angular_material_core.mixinErrorState(MatInputBase);
/**
* Directive that allows a native input to work inside a `MatFormField`.
*/
var MatInput = /** @class */ (function (_super) {
__extends(MatInput, _super);
function MatInput(_elementRef, _platform, /** @docs-private */
ngControl, _parentForm, _parentFormGroup, _defaultErrorStateMatcher, inputValueAccessor) {
var _this = _super.call(this, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this;
_this._elementRef = _elementRef;
_this._platform = _platform;
_this.ngControl = ngControl;
_this._uid = "mat-input-" + nextUniqueId++;
/**
* Whether the component is being rendered on the server.
*/
_this._isServer = false;
/**
* Implemented as part of MatFormFieldControl.
* \@docs-private
*/
_this.focused = false;
/**
* Implemented as part of MatFormFieldControl.
* \@docs-private
*/
_this.stateChanges = new rxjs_Subject.Subject();
/**
* Implemented as part of MatFormFieldControl.
* \@docs-private
*/
_this.controlType = 'mat-input';
_this._disabled = false;
/**
* Implemented as part of MatFormFieldControl.
* \@docs-private
*/
_this.placeholder = '';
_this._required = false;
_this._type = 'text';
_this._readonly = false;
_this._neverEmptyInputTypes = [
'date',
'datetime',
'datetime-local',
'month',
'time',
'week'
].filter(function (t) { return _angular_cdk_platform.getSupportedInputTypes().has(t); });
// If no input value accessor was explicitly specified, use the element as the input value
// accessor.
// If no input value accessor was explicitly specified, use the element as the input value
// accessor.
_this._inputValueAccessor = inputValueAccessor || _this._elementRef.nativeElement;
_this._previousNativeValue = _this.value;
// Force setter to be called in case id was not specified.
// Force setter to be called in case id was not specified.
_this.id = _this.id;
// On some versions of iOS the caret gets stuck in the wrong place when holding down the delete
// key. In order to get around this we need to "jiggle" the caret loose. Since this bug only
// exists on iOS, we only bother to install the listener on iOS.
if (_platform.IOS) {
_elementRef.nativeElement.addEventListener('keyup', function (event) {
var /** @type {?} */ el = /** @type {?} */ (event.target);
if (!el.value && !el.selectionStart && !el.selectionEnd) {
// Note: Just setting `0, 0` doesn't fix the issue. Setting `1, 1` fixes it for the first
// time that you type text and then hold delete. Toggling to `1, 1` and then back to
// `0, 0` seems to completely fix it.
el.setSelectionRange(1, 1);
el.setSelectionRange(0, 0);
}
});
}
_this._isServer = !_this._platform.isBrowser;
return _this;
}
Object.defineProperty(MatInput.prototype, "disabled", {
get: /**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @return {?}
*/
function () {
if (this.ngControl && this.ngControl.disabled !== null) {
return this.ngControl.disabled;
}
return this._disabled;
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._disabled = _angular_cdk_coercion.coerceBooleanProperty(value);
// Browsers may not fire the blur event if the input is disabled too quickly.
// Reset from here to ensure that the element doesn't become stuck.
if (this.focused) {
this.focused = false;
this.stateChanges.next();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatInput.prototype, "id", {
get: /**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @return {?}
*/
function () { return this._id; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) { this._id = value || this._uid; },
enumerable: true,
configurable: true
});
Object.defineProperty(MatInput.prototype, "required", {
get: /**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @return {?}
*/
function () { return this._required; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) { this._required = _angular_cdk_coercion.coerceBooleanProperty(value); },
enumerable: true,
configurable: true
});
Object.defineProperty(MatInput.prototype, "type", {
get: /**
* Input type of the element.
* @return {?}
*/
function () { return this._type; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._type = value || 'text';
this._validateType();
// When using Angular inputs, developers are no longer able to set the properties on the native
// input element. To ensure that bindings for `type` work, we need to sync the setter
// with the native property. Textarea elements don't support the type property or attribute.
if (!this._isTextarea() && _angular_cdk_platform.getSupportedInputTypes().has(this._type)) {
this._elementRef.nativeElement.type = this._type;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatInput.prototype, "value", {
get: /**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @return {?}
*/
function () { return this._inputValueAccessor.value; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
if (value !== this.value) {
this._inputValueAccessor.value = value;
this.stateChanges.next();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatInput.prototype, "readonly", {
get: /**
* Whether the element is readonly.
* @return {?}
*/
function () { return this._readonly; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) { this._readonly = _angular_cdk_coercion.coerceBooleanProperty(value); },
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
MatInput.prototype.ngOnChanges = /**
* @return {?}
*/
function () {
this.stateChanges.next();
};
/**
* @return {?}
*/
MatInput.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.stateChanges.complete();
};
/**
* @return {?}
*/
MatInput.prototype.ngDoCheck = /**
* @return {?}
*/
function () {
if (this.ngControl) {
// We need to re-evaluate this on every change detection cycle, because there are some
// error triggers that we can't subscribe to (e.g. parent form submissions). This means
// that whatever logic is in here has to be super lean or we risk destroying the performance.
this.updateErrorState();
}
// We need to dirty-check the native element's value, because there are some cases where
// we won't be notified when it changes (e.g. the consumer isn't using forms or they're
// updating the value using `emitEvent: false`).
this._dirtyCheckNativeValue();
};
/** Focuses the input. */
/**
* Focuses the input.
* @return {?}
*/
MatInput.prototype.focus = /**
* Focuses the input.
* @return {?}
*/
function () { this._elementRef.nativeElement.focus(); };
/** Callback for the cases where the focused state of the input changes. */
/**
* Callback for the cases where the focused state of the input changes.
* @param {?} isFocused
* @return {?}
*/
MatInput.prototype._focusChanged = /**
* Callback for the cases where the focused state of the input changes.
* @param {?} isFocused
* @return {?}
*/
function (isFocused) {
if (isFocused !== this.focused && !this.readonly) {
this.focused = isFocused;
this.stateChanges.next();
}
};
/**
* @return {?}
*/
MatInput.prototype._onInput = /**
* @return {?}
*/
function () {
// This is a noop function and is used to let Angular know whenever the value changes.
// Angular will run a new change detection each time the `input` event has been dispatched.
// It's necessary that Angular recognizes the value change, because when floatingLabel
// is set to false and Angular forms aren't used, the placeholder won't recognize the
// value changes and will not disappear.
// Listening to the input event wouldn't be necessary when the input is using the
// FormsModule or ReactiveFormsModule, because Angular forms also listens to input events.
};
/** Does some manual dirty checking on the native input `value` property. */
/**
* Does some manual dirty checking on the native input `value` property.
* @return {?}
*/
MatInput.prototype._dirtyCheckNativeValue = /**
* Does some manual dirty checking on the native input `value` property.
* @return {?}
*/
function () {
var /** @type {?} */ newValue = this.value;
if (this._previousNativeValue !== newValue) {
this._previousNativeValue = newValue;
this.stateChanges.next();
}
};
/** Make sure the input is a supported type. */
/**
* Make sure the input is a supported type.
* @return {?}
*/
MatInput.prototype._validateType = /**
* Make sure the input is a supported type.
* @return {?}
*/
function () {
if (MAT_INPUT_INVALID_TYPES.indexOf(this._type) > -1) {
throw getMatInputUnsupportedTypeError(this._type);
}
};
/** Checks whether the input type is one of the types that are never empty. */
/**
* Checks whether the input type is one of the types that are never empty.
* @return {?}
*/
MatInput.prototype._isNeverEmpty = /**
* Checks whether the input type is one of the types that are never empty.
* @return {?}
*/
function () {
return this._neverEmptyInputTypes.indexOf(this._type) > -1;
};
/** Checks whether the input is invalid based on the native validation. */
/**
* Checks whether the input is invalid based on the native validation.
* @return {?}
*/
MatInput.prototype._isBadInput = /**
* Checks whether the input is invalid based on the native validation.
* @return {?}
*/
function () {
// The `validity` property won't be present on platform-server.
var /** @type {?} */ validity = (/** @type {?} */ (this._elementRef.nativeElement)).validity;
return validity && validity.badInput;
};
/** Determines if the component host is a textarea. If not recognizable it returns false. */
/**
* Determines if the component host is a textarea. If not recognizable it returns false.
* @return {?}
*/
MatInput.prototype._isTextarea = /**
* Determines if the component host is a textarea. If not recognizable it returns false.
* @return {?}
*/
function () {
var /** @type {?} */ nativeElement = this._elementRef.nativeElement;
// In Universal, we don't have access to `nodeName`, but the same can be achieved with `name`.
// Note that this shouldn't be necessary once Angular switches to an API that resembles the
// DOM closer.
var /** @type {?} */ nodeName = this._platform.isBrowser ? nativeElement.nodeName : nativeElement.name;
return nodeName ? nodeName.toLowerCase() === 'textarea' : false;
};
Object.defineProperty(MatInput.prototype, "empty", {
/**
* Implemented as part of MatFormFieldControl.
* @docs-private
*/
get: /**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @return {?}
*/
function () {
return !this._isNeverEmpty() && !this._elementRef.nativeElement.value && !this._isBadInput();
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatInput.prototype, "shouldLabelFloat", {
/**
* Implemented as part of MatFormFieldControl.
* @docs-private
*/
get: /**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @return {?}
*/
function () { return this.focused || !this.empty; },
enumerable: true,
configurable: true
});
/**
* Implemented as part of MatFormFieldControl.
* @docs-private
*/
/**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @param {?} ids
* @return {?}
*/
MatInput.prototype.setDescribedByIds = /**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @param {?} ids
* @return {?}
*/
function (ids) { this._ariaDescribedby = ids.join(' '); };
/**
* Implemented as part of MatFormFieldControl.
* @docs-private
*/
/**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @return {?}
*/
MatInput.prototype.onContainerClick = /**
* Implemented as part of MatFormFieldControl.
* \@docs-private
* @return {?}
*/
function () { this.focus(); };
MatInput.decorators = [
{ type: _angular_core.Directive, args: [{
selector: "input[matInput], textarea[matInput]",
exportAs: 'matInput',
host: {
'class': 'mat-input-element mat-form-field-autofill-control',
'[class.mat-input-server]': '_isServer',
// Native input properties that are overwritten by Angular inputs need to be synced with
// the native input element. Otherwise property bindings for those don't work.
'[attr.id]': 'id',
'[placeholder]': 'placeholder',
'[disabled]': 'disabled',
'[required]': 'required',
'[readonly]': 'readonly',
'[attr.aria-describedby]': '_ariaDescribedby || null',
'[attr.aria-invalid]': 'errorState',
'[attr.aria-required]': 'required.toString()',
'(blur)': '_focusChanged(false)',
'(focus)': '_focusChanged(true)',
'(input)': '_onInput()',
},
providers: [{ provide: _angular_material_formField.MatFormFieldControl, useExisting: MatInput }],
},] },
];
/** @nocollapse */
MatInput.ctorParameters = function () { return [
{ type: _angular_core.ElementRef, },
{ type: _angular_cdk_platform.Platform, },
{ type: _angular_forms.NgControl, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Self },] },
{ type: _angular_forms.NgForm, decorators: [{ type: _angular_core.Optional },] },
{ type: _angular_forms.FormGroupDirective, decorators: [{ type: _angular_core.Optional },] },
{ type: _angular_material_core.ErrorStateMatcher, },
{ type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Self }, { type: _angular_core.Inject, args: [MAT_INPUT_VALUE_ACCESSOR,] },] },
]; };
MatInput.propDecorators = {
"disabled": [{ type: _angular_core.Input },],
"id": [{ type: _angular_core.Input },],
"placeholder": [{ type: _angular_core.Input },],
"required": [{ type: _angular_core.Input },],
"type": [{ type: _angular_core.Input },],
"errorStateMatcher": [{ type: _angular_core.Input },],
"value": [{ type: _angular_core.Input },],
"readonly": [{ type: _angular_core.Input },],
};
return MatInput;
}(_MatInputMixinBase));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MatInputModule = /** @class */ (function () {
function MatInputModule() {
}
MatInputModule.decorators = [
{ type: _angular_core.NgModule, args: [{
declarations: [
MatInput,
MatTextareaAutosize,
],
imports: [
_angular_common.CommonModule,
_angular_material_formField.MatFormFieldModule,
_angular_cdk_platform.PlatformModule,
],
exports: [
_angular_material_formField.MatFormFieldModule,
MatInput,
MatTextareaAutosize,
],
providers: [_angular_material_core.ErrorStateMatcher],
},] },
];
/** @nocollapse */
MatInputModule.ctorParameters = function () { return []; };
return MatInputModule;
}());
exports.MatInputModule = MatInputModule;
exports.MatTextareaAutosize = MatTextareaAutosize;
exports.MatInputBase = MatInputBase;
exports._MatInputMixinBase = _MatInputMixinBase;
exports.MatInput = MatInput;
exports.getMatInputUnsupportedTypeError = getMatInputUnsupportedTypeError;
exports.MAT_INPUT_VALUE_ACCESSOR = MAT_INPUT_VALUE_ACCESSOR;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=material-input.umd.js.map