@angular/material
Version:
Angular Material
37 lines • 9.65 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),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"),require("@angular/common")):"function"==typeof define&&define.amd?define("@angular/material/input",["exports","tslib","@angular/cdk/text-field","@angular/core","@angular/cdk/coercion","@angular/cdk/platform","@angular/forms","@angular/material/core","@angular/material/form-field","rxjs","@angular/common"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.input={}),e.tslib,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,e.ng.common)}(this,(function(e,t,r,n,i,o,a,s,u,l,p){"use strict";
/**
* @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 r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),Object.defineProperty(r.prototype,"matAutosizeMinRows",{get:function(){return this.minRows},set:function(e){this.minRows=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"matAutosizeMaxRows",{get:function(){return this.maxRows},set:function(e){this.maxRows=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"matAutosize",{get:function(){return this.enabled},set:function(e){this.enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"matTextareaAutosize",{get:function(){return this.enabled},set:function(e){this.enabled=e},enumerable:!0,configurable:!0}),r.decorators=[{type:n.Directive,args:[{selector:"textarea[mat-autosize], textarea[matTextareaAutosize]",exportAs:"matTextareaAutosize",inputs:["cdkAutosizeMinRows","cdkAutosizeMaxRows"],host:{class:"cdk-textarea-autosize mat-autosize",rows:"1"}}]}],r.propDecorators={matAutosizeMinRows:[{type:n.Input}],matAutosizeMaxRows:[{type:n.Input}],matAutosize:[{type:n.Input,args:["mat-autosize"]}],matTextareaAutosize:[{type:n.Input}]},r}(r.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 n.InjectionToken("MAT_INPUT_VALUE_ACCESSOR"),m=["button","checkbox","file","hidden","image","radio","range","reset","submit"],y=0,h=function(e){function p(t,r,n,i,a,s,u,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-"+y++,d._isServer=!1,d._isNativeSelect=!1,d.focused=!1,d.stateChanges=new l.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=u||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 t.__extends(p,e),Object.defineProperty(p.prototype,"disabled",{get:function(){return this.ngControl&&null!==this.ngControl.disabled?this.ngControl.disabled:this._disabled},set:function(e){this._disabled=i.coerceBooleanProperty(e),this.focused&&(this.focused=!1,this.stateChanges.next())},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"id",{get:function(){return this._id},set:function(e){this._id=e||this._uid},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"required",{get:function(){return this._required},set:function(e){this._required=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(p.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(p.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(p.prototype,"readonly",{get:function(){return this._readonly},set:function(e){this._readonly=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),p.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()}))},p.prototype.ngOnChanges=function(){this.stateChanges.next()},p.prototype.ngOnDestroy=function(){this.stateChanges.complete(),this._platform.isBrowser&&this._autofillMonitor.stopMonitoring(this._elementRef.nativeElement)},p.prototype.ngDoCheck=function(){this.ngControl&&this.updateErrorState(),this._dirtyCheckNativeValue()},p.prototype.focus=function(e){this._elementRef.nativeElement.focus(e)},p.prototype._focusChanged=function(e){e===this.focused||this.readonly&&e||(this.focused=e,this.stateChanges.next())},p.prototype._onInput=function(){},p.prototype._isTextarea=function(){return"textarea"===this._elementRef.nativeElement.nodeName.toLowerCase()},p.prototype._dirtyCheckNativeValue=function(){var e=this._elementRef.nativeElement.value;this._previousNativeValue!==e&&(this._previousNativeValue=e,this.stateChanges.next())},p.prototype._validateType=function(){if(m.indexOf(this._type)>-1)throw d(this._type)},p.prototype._isNeverEmpty=function(){return this._neverEmptyInputTypes.indexOf(this._type)>-1},p.prototype._isBadInput=function(){var e=this._elementRef.nativeElement.validity;return e&&e.badInput},Object.defineProperty(p.prototype,"empty",{get:function(){return!(this._isNeverEmpty()||this._elementRef.nativeElement.value||this._isBadInput()||this.autofilled)},enumerable:!0,configurable:!0}),Object.defineProperty(p.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}),p.prototype.setDescribedByIds=function(e){this._ariaDescribedby=e.join(" ")},p.prototype.onContainerClick=function(){this.focused||this.focus()},p.decorators=[{type:n.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:u.MatFormFieldControl,useExisting:p}]}]}],p.ctorParameters=function(){return[{type:n.ElementRef},{type:o.Platform},{type:a.NgControl,decorators:[{type:n.Optional},{type:n.Self}]},{type:a.NgForm,decorators:[{type:n.Optional}]},{type:a.FormGroupDirective,decorators:[{type:n.Optional}]},{type:s.ErrorStateMatcher},{type:void 0,decorators:[{type:n.Optional},{type:n.Self},{type:n.Inject,args:[f]}]},{type:r.AutofillMonitor},{type:n.NgZone}]},p.propDecorators={disabled:[{type:n.Input}],id:[{type:n.Input}],placeholder:[{type:n.Input}],required:[{type:n.Input}],type:[{type:n.Input}],errorStateMatcher:[{type:n.Input}],value:[{type:n.Input}],readonly:[{type:n.Input}]},p}(s.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:n.NgModule,args:[{declarations:[h,c],imports:[p.CommonModule,r.TextFieldModule,u.MatFormFieldModule],exports:[r.TextFieldModule,u.MatFormFieldModule,h,c],providers:[s.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})}));