@angular/material
Version:
Angular Material
52 lines (50 loc) • 10.7 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/text-field"),require("@angular/core"),require("@angular/cdk/coercion"),require("@angular/cdk/platform"),require("@angular/forms"),require("@angular/material/core"),require("@angular/material/form-field"),require("rxjs")):"function"==typeof define&&define.amd?define("@angular/material/input",["exports","@angular/cdk/text-field","@angular/core","@angular/cdk/coercion","@angular/cdk/platform","@angular/forms","@angular/material/core","@angular/material/form-field","rxjs"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.input={}),e.ng.cdk.textField,e.ng.core,e.ng.cdk.coercion,e.ng.cdk.platform,e.ng.forms,e.ng.material.core,e.ng.material.formField,e.rxjs)}(this,(function(e,t,r,n,o,i,a,s,u){"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.
***************************************************************************** */var l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function p(e,t){function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}
/**
* @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
*/
var c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"matAutosizeMinRows",{get:function(){return this.minRows},set:function(e){this.minRows=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"matAutosizeMaxRows",{get:function(){return this.maxRows},set:function(e){this.maxRows=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"matAutosize",{get:function(){return this.enabled},set:function(e){this.enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"matTextareaAutosize",{get:function(){return this.enabled},set:function(e){this.enabled=e},enumerable:!0,configurable:!0}),t.decorators=[{type:r.Directive,args:[{selector:"textarea[mat-autosize], textarea[matTextareaAutosize]",exportAs:"matTextareaAutosize",inputs:["cdkAutosizeMinRows","cdkAutosizeMaxRows"],host:{class:"cdk-textarea-autosize mat-autosize",rows:"1"}}]}],t.propDecorators={matAutosizeMinRows:[{type:r.Input}],matAutosizeMaxRows:[{type:r.Input}],matAutosize:[{type:r.Input,args:["mat-autosize"]}],matTextareaAutosize:[{type:r.Input}]},t}(t.CdkTextareaAutosize);
/**
* @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 d(e){return Error('Input type "'+e+"\" isn't supported by matInput.")}
/**
* @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
*/var f=new r.InjectionToken("MAT_INPUT_VALUE_ACCESSOR"),y=["button","checkbox","file","hidden","image","radio","range","reset","submit"],m=0,h=function(e){function l(t,r,n,i,a,s,l,p,c){var d=e.call(this,s,i,a,n)||this;d._elementRef=t,d._platform=r,d.ngControl=n,d._autofillMonitor=p,d._uid="mat-input-"+m++,d._isServer=!1,d._isNativeSelect=!1,d.focused=!1,d.stateChanges=new u.Subject,d.controlType="mat-input",d.autofilled=!1,d._disabled=!1,d._required=!1,d._type="text",d._readonly=!1,d._neverEmptyInputTypes=["date","datetime","datetime-local","month","time","week"].filter((function(e){return o.getSupportedInputTypes().has(e)}));var f=d._elementRef.nativeElement;return d._inputValueAccessor=l||f,d._previousNativeValue=d.value,d.id=d.id,r.IOS&&c.runOutsideAngular((function(){t.nativeElement.addEventListener("keyup",(function(e){var t=e.target;t.value||t.selectionStart||t.selectionEnd||(t.setSelectionRange(1,1),t.setSelectionRange(0,0))}))})),d._isServer=!d._platform.isBrowser,d._isNativeSelect="select"===f.nodeName.toLowerCase(),d._isNativeSelect&&(d.controlType=f.multiple?"mat-native-select-multiple":"mat-native-select"),d}return p(l,e),Object.defineProperty(l.prototype,"disabled",{get:function(){return this.ngControl&&null!==this.ngControl.disabled?this.ngControl.disabled:this._disabled},set:function(e){this._disabled=n.coerceBooleanProperty(e),this.focused&&(this.focused=!1,this.stateChanges.next())},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"id",{get:function(){return this._id},set:function(e){this._id=e||this._uid},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"required",{get:function(){return this._required},set:function(e){this._required=n.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"type",{get:function(){return this._type},set:function(e){this._type=e||"text",this._validateType(),!this._isTextarea()&&o.getSupportedInputTypes().has(this._type)&&(this._elementRef.nativeElement.type=this._type)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"value",{get:function(){return this._inputValueAccessor.value},set:function(e){e!==this.value&&(this._inputValueAccessor.value=e,this.stateChanges.next())},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"readonly",{get:function(){return this._readonly},set:function(e){this._readonly=n.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),l.prototype.ngOnInit=function(){var e=this;this._platform.isBrowser&&this._autofillMonitor.monitor(this._elementRef.nativeElement).subscribe((function(t){e.autofilled=t.isAutofilled,e.stateChanges.next()}))},l.prototype.ngOnChanges=function(){this.stateChanges.next()},l.prototype.ngOnDestroy=function(){this.stateChanges.complete(),this._platform.isBrowser&&this._autofillMonitor.stopMonitoring(this._elementRef.nativeElement)},l.prototype.ngDoCheck=function(){this.ngControl&&this.updateErrorState(),this._dirtyCheckNativeValue()},l.prototype.focus=function(e){this._elementRef.nativeElement.focus(e)},l.prototype._focusChanged=function(e){e===this.focused||this.readonly&&e||(this.focused=e,this.stateChanges.next())},l.prototype._onInput=function(){},l.prototype._isTextarea=function(){return"textarea"===this._elementRef.nativeElement.nodeName.toLowerCase()},l.prototype._dirtyCheckNativeValue=function(){var e=this._elementRef.nativeElement.value;this._previousNativeValue!==e&&(this._previousNativeValue=e,this.stateChanges.next())},l.prototype._validateType=function(){if(y.indexOf(this._type)>-1)throw d(this._type)},l.prototype._isNeverEmpty=function(){return this._neverEmptyInputTypes.indexOf(this._type)>-1},l.prototype._isBadInput=function(){var e=this._elementRef.nativeElement.validity;return e&&e.badInput},Object.defineProperty(l.prototype,"empty",{get:function(){return!(this._isNeverEmpty()||this._elementRef.nativeElement.value||this._isBadInput()||this.autofilled)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"shouldLabelFloat",{get:function(){if(this._isNativeSelect){var e=this._elementRef.nativeElement,t=e.options[0];return this.focused||e.multiple||!this.empty||!!(e.selectedIndex>-1&&t&&t.label)}return this.focused||!this.empty},enumerable:!0,configurable:!0}),l.prototype.setDescribedByIds=function(e){this._ariaDescribedby=e.join(" ")},l.prototype.onContainerClick=function(){this.focused||this.focus()},l.decorators=[{type:r.Directive,args:[{selector:"input[matInput], textarea[matInput], select[matNativeControl],\n input[matNativeControl], textarea[matNativeControl]",exportAs:"matInput",host:{class:"mat-input-element mat-form-field-autofill-control","[class.mat-input-server]":"_isServer","[attr.id]":"id","[attr.placeholder]":"placeholder","[disabled]":"disabled","[required]":"required","[attr.readonly]":"readonly && !_isNativeSelect || null","[attr.aria-describedby]":"_ariaDescribedby || null","[attr.aria-invalid]":"errorState","[attr.aria-required]":"required.toString()","(blur)":"_focusChanged(false)","(focus)":"_focusChanged(true)","(input)":"_onInput()"},providers:[{provide:s.MatFormFieldControl,useExisting:l}]}]}],l.ctorParameters=function(){return[{type:r.ElementRef},{type:o.Platform},{type:i.NgControl,decorators:[{type:r.Optional},{type:r.Self}]},{type:i.NgForm,decorators:[{type:r.Optional}]},{type:i.FormGroupDirective,decorators:[{type:r.Optional}]},{type:a.ErrorStateMatcher},{type:void 0,decorators:[{type:r.Optional},{type:r.Self},{type:r.Inject,args:[f]}]},{type:t.AutofillMonitor},{type:r.NgZone}]},l.propDecorators={disabled:[{type:r.Input}],id:[{type:r.Input}],placeholder:[{type:r.Input}],required:[{type:r.Input}],type:[{type:r.Input}],errorStateMatcher:[{type:r.Input}],value:[{type:r.Input}],readonly:[{type:r.Input}]},l}(a.mixinErrorState((function g(e,t,r,n){this._defaultErrorStateMatcher=e,this._parentForm=t,this._parentFormGroup=r,this.ngControl=n}))),_=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{declarations:[h,c],imports:[t.TextFieldModule,s.MatFormFieldModule],exports:[t.TextFieldModule,s.MatFormFieldModule,h,c],providers:[a.ErrorStateMatcher]}]}],e}();
/**
* @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
*/
/**
* @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
*/
e.MAT_INPUT_VALUE_ACCESSOR=f,e.MatInput=h,e.MatInputModule=_,e.MatTextareaAutosize=c,e.getMatInputUnsupportedTypeError=d,Object.defineProperty(e,"__esModule",{value:!0})}));