Skip to content

Commit

Permalink
fix: fixed textarea-item autoheight issues (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
sWhite01111 authored and fisherspy committed Sep 6, 2019
1 parent f2d1600 commit 5aa3149
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions components/textarea-item/textarea-item.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Component,
OnInit,
AfterViewInit,
Input,
Output,
EventEmitter,
Expand All @@ -26,7 +25,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
}
]
})
export class TextareaItemComponent implements OnInit, AfterContentChecked, ControlValueAccessor, AfterViewInit {
export class TextareaItemComponent implements OnInit, AfterContentChecked, ControlValueAccessor {
prefixCls: string = 'am-textarea';
wrapCls: object;
labelCls: object;
Expand Down Expand Up @@ -209,7 +208,7 @@ export class TextareaItemComponent implements OnInit, AfterContentChecked, Contr
this._el = element.nativeElement;
}

_onChange = (_: any) => {};
_onChange = (_: any) => { };

setCls() {
this.hasCount = this._count > 0 && this._rows > 1;
Expand Down Expand Up @@ -303,24 +302,16 @@ export class TextareaItemComponent implements OnInit, AfterContentChecked, Contr
this._onChange = fn;
}

registerOnTouched(fn: any): void {}
registerOnTouched(fn: any): void { }

ngOnInit() {
this.textRef.nativeElement.value = this._value;
this.setCls();
this.setCharacterLength();
this.textRef.nativeElement.value = this._value;
}

ngAfterViewInit() {
setTimeout(() => {
if (this._autoHeight) {
this.reAlignHeight();
}
}, 100);
}

ngAfterContentChecked() {
if (this._autoHeight && this._focus) {
if (this._autoHeight) {
this.reAlignHeight();
}
}
Expand Down

0 comments on commit 5aa3149

Please sign in to comment.