UNPKG

fabric8-planner

Version:
34 lines 1.32 kB
import { Directive, ElementRef, HostListener, Input } from '@angular/core'; var AutosizeDirective = /** @class */ (function () { function AutosizeDirective(element) { this.element = element; this.init_height = 0; } AutosizeDirective.prototype.onInput = function (textArea) { this.adjust(); }; AutosizeDirective.prototype.ngAfterContentChecked = function () { this.adjust(); }; AutosizeDirective.prototype.adjust = function () { this.element.nativeElement.style.overflow = 'hidden'; this.element.nativeElement.style.height = this.init_height ? this.init_height + 'px' : 'auto'; this.element.nativeElement.style.height = this.element.nativeElement.scrollHeight + 'px'; }; AutosizeDirective.decorators = [ { type: Directive, args: [{ selector: 'textarea[autosize]' },] }, ]; /** @nocollapse */ AutosizeDirective.ctorParameters = function () { return [ { type: ElementRef, }, ]; }; AutosizeDirective.propDecorators = { 'init_height': [{ type: Input },], 'onInput': [{ type: HostListener, args: ['input', ['$event.target'],] },], }; return AutosizeDirective; }()); export { AutosizeDirective }; //# sourceMappingURL=autosize.directive.js.map