ngx-input-autosize
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -67,4 +67,6 @@ (function (global, factory) { | ||
_this.autosizeComponent.autosizeValue = response; | ||
if (_this.autosizeProp) { | ||
_this.autosizeComponent.autosizeValue = response[_this.autosizeProp]; | ||
if (typeof response == 'object') { | ||
if (_this.autosizeProp && response) { | ||
_this.autosizeComponent.autosizeValue = response[_this.autosizeProp]; | ||
} | ||
} | ||
@@ -71,0 +73,0 @@ if (_this.element.nativeElement.placeholder) { |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/forms","@angular/common"],t):t((e.ng=e.ng||{},e.ng.inputautosize={}),e.core,e.forms,e.common)}(this,function(e,t,o,n){"use strict";var i=function(){return function(e){this.el=e}}();i.decorators=[{type:t.Component,args:[{selector:"div[autosize]",template:'<span style="white-space:pre;" #shadowElement>{{autosizeValue}}</span>',styles:[":host { display:block;position: fixed; visibility:hidden; top: -9999px; left: 0px;}"]}]}],i.ctorParameters=function(){return[{type:t.ElementRef}]},i.propDecorators={autosizeValue:[{type:t.Input,args:["autosizeValue"]}],shadowElement:[{type:t.ViewChild,args:["shadowElement"]}]};var r=function(){function e(e,t,o,n){this.resolver=e,this.element=t,this.vc=o,this.ngControl=n,this.supportedInputTypes=["text","search","tel","url","email","password","number"],this.cssProps=["fontSize","fontFamily","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent","boxSizing","borderLeftWidth","borderRightWidth","borderLeftStyle","borderRightStyle","paddingLeft","paddingRight","marginLeft","marginRight"],this.placeholder=""}return e.prototype.onInput=function(e){this.adjust()},e.prototype.ngOnInit=function(){var e=this,t=this.resolver.resolveComponentFactory(i);this.autosizeComponent=this.vc.createComponent(t).instance,this.placeholderAutoSizeComponent=this.vc.createComponent(t).instance;for(var o=0,n=this.cssProps;o<n.length;o++){var r=n[o];this.element.nativeElement.currentStyle?(this.autosizeComponent.shadowElement.nativeElement.style[r]=this.element.nativeElement.currentStyle[r],this.placeholderAutoSizeComponent.shadowElement.nativeElement.style[r]=this.element.nativeElement.currentStyle[r]):window.getComputedStyle&&(this.autosizeComponent.shadowElement.nativeElement.style[r]=getComputedStyle(this.element.nativeElement)[r],this.placeholderAutoSizeComponent.shadowElement.nativeElement.style[r]=getComputedStyle(this.element.nativeElement)[r])}this.ngControl.valueChanges&&this.ngControl.valueChanges.subscribe(function(t){e.autosizeComponent.autosizeValue=t,e.autosizeProp&&(e.autosizeComponent.autosizeValue=t[e.autosizeProp]),e.element.nativeElement.placeholder&&(e.placeholder=e.element.nativeElement.placeholder),e.placeholderAutoSizeComponent.autosizeValue=e.placeholder})},e.prototype.ngAfterContentChecked=function(){this.adjust()},e.prototype.ngAfterViewChecked=function(){this.adjust()},e.prototype.adjust=function(){this.placeholderAutoSizeComponent.el.nativeElement.offsetWidth>=this.autosizeComponent.el.nativeElement.offsetWidth&&!this.ngControl.value?this.element.nativeElement.style.width=this.placeholderAutoSizeComponent.el.nativeElement.offsetWidth+"px":this.element.nativeElement.style.width=this.autosizeComponent.el.nativeElement.offsetWidth+"px"},e}();r.decorators=[{type:t.Directive,args:[{selector:"input[autosize]"}]}],r.ctorParameters=function(){return[{type:t.ComponentFactoryResolver},{type:t.ElementRef},{type:t.ViewContainerRef},{type:o.NgControl}]},r.propDecorators={onInput:[{type:t.HostListener,args:["input",["$event.target"]]}],autosizeProp:[{type:t.Input,args:["autosizeProp"]}]};var s=function(){return function(){}}();s.decorators=[{type:t.NgModule,args:[{declarations:[r,i],imports:[n.CommonModule,o.FormsModule],exports:[r,i],entryComponents:[i]}]}],s.ctorParameters=function(){return[]},e.AutosizeComponent=i,e.AutosizeDirective=r,e.AutosizeInputModule=s,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/forms","@angular/common"],t):t((e.ng=e.ng||{},e.ng.inputautosize={}),e.core,e.forms,e.common)}(this,function(e,t,o,n){"use strict";var i=function(){return function(e){this.el=e}}();i.decorators=[{type:t.Component,args:[{selector:"div[autosize]",template:'<span style="white-space:pre;" #shadowElement>{{autosizeValue}}</span>',styles:[":host { display:block;position: fixed; visibility:hidden; top: -9999px; left: 0px;}"]}]}],i.ctorParameters=function(){return[{type:t.ElementRef}]},i.propDecorators={autosizeValue:[{type:t.Input,args:["autosizeValue"]}],shadowElement:[{type:t.ViewChild,args:["shadowElement"]}]};var r=function(){function e(e,t,o,n){this.resolver=e,this.element=t,this.vc=o,this.ngControl=n,this.supportedInputTypes=["text","search","tel","url","email","password","number"],this.cssProps=["fontSize","fontFamily","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent","boxSizing","borderLeftWidth","borderRightWidth","borderLeftStyle","borderRightStyle","paddingLeft","paddingRight","marginLeft","marginRight"],this.placeholder=""}return e.prototype.onInput=function(e){this.adjust()},e.prototype.ngOnInit=function(){var e=this,t=this.resolver.resolveComponentFactory(i);this.autosizeComponent=this.vc.createComponent(t).instance,this.placeholderAutoSizeComponent=this.vc.createComponent(t).instance;for(var o=0,n=this.cssProps;o<n.length;o++){var r=n[o];this.element.nativeElement.currentStyle?(this.autosizeComponent.shadowElement.nativeElement.style[r]=this.element.nativeElement.currentStyle[r],this.placeholderAutoSizeComponent.shadowElement.nativeElement.style[r]=this.element.nativeElement.currentStyle[r]):window.getComputedStyle&&(this.autosizeComponent.shadowElement.nativeElement.style[r]=getComputedStyle(this.element.nativeElement)[r],this.placeholderAutoSizeComponent.shadowElement.nativeElement.style[r]=getComputedStyle(this.element.nativeElement)[r])}this.ngControl.valueChanges&&this.ngControl.valueChanges.subscribe(function(t){e.autosizeComponent.autosizeValue=t,"object"==typeof t&&e.autosizeProp&&t&&(e.autosizeComponent.autosizeValue=t[e.autosizeProp]),e.element.nativeElement.placeholder&&(e.placeholder=e.element.nativeElement.placeholder),e.placeholderAutoSizeComponent.autosizeValue=e.placeholder})},e.prototype.ngAfterContentChecked=function(){this.adjust()},e.prototype.ngAfterViewChecked=function(){this.adjust()},e.prototype.adjust=function(){this.placeholderAutoSizeComponent.el.nativeElement.offsetWidth>=this.autosizeComponent.el.nativeElement.offsetWidth&&!this.ngControl.value?this.element.nativeElement.style.width=this.placeholderAutoSizeComponent.el.nativeElement.offsetWidth+"px":this.element.nativeElement.style.width=this.autosizeComponent.el.nativeElement.offsetWidth+"px"},e}();r.decorators=[{type:t.Directive,args:[{selector:"input[autosize]"}]}],r.ctorParameters=function(){return[{type:t.ComponentFactoryResolver},{type:t.ElementRef},{type:t.ViewContainerRef},{type:o.NgControl}]},r.propDecorators={onInput:[{type:t.HostListener,args:["input",["$event.target"]]}],autosizeProp:[{type:t.Input,args:["autosizeProp"]}]};var s=function(){return function(){}}();s.decorators=[{type:t.NgModule,args:[{declarations:[r,i],imports:[n.CommonModule,o.FormsModule],exports:[r,i],entryComponents:[i]}]}],s.ctorParameters=function(){return[]},e.AutosizeComponent=i,e.AutosizeDirective=r,e.AutosizeInputModule=s,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "ngx-input-autosize", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "A text input for Angular that resizes itself to the current content.", | ||
@@ -5,0 +5,0 @@ "main": "bundles/ngxinputautosize.umd.js", |
@@ -42,4 +42,6 @@ import { NgControl } from '@angular/forms'; | ||
_this.autosizeComponent.autosizeValue = response; | ||
if (_this.autosizeProp) { | ||
_this.autosizeComponent.autosizeValue = response[_this.autosizeProp]; | ||
if (typeof response == 'object') { | ||
if (_this.autosizeProp && response) { | ||
_this.autosizeComponent.autosizeValue = response[_this.autosizeProp]; | ||
} | ||
} | ||
@@ -46,0 +48,0 @@ if (_this.element.nativeElement.placeholder) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36776
315