UNPKG

@koalarx/ui

Version:

Koala UI is a modern and accessible component library designed to speed up interface development in Angular projects. With simple integration and clear documentation, you can easily build robust and visually appealing applications.

35 lines (31 loc) 4.32 kB
import * as i0 from '@angular/core'; import { viewChild, input, booleanAttribute, effect, Component } from '@angular/core'; import * as i1 from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms'; import { FieldErrors } from '@koalarx/ui/shared/components/field-errors'; import { InputFieldBase } from '@koalarx/ui/shared/components/input-field'; class Textarea extends InputFieldBase { textareaElement = viewChild('textareaElement'); rows = input(3); resizeble = input(false, { transform: booleanAttribute }); constructor() { super(); effect(() => { const textarea = this.textareaElement()?.nativeElement; if (textarea) { textarea.style.resize = this.resizeble() ? 'vertical' : 'none'; } }); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: Textarea, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: Textarea, isStandalone: true, selector: "kl-textarea", inputs: { rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, resizeble: { classPropertyName: "resizeble", publicName: "resizeble", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "textareaElement", first: true, predicate: ["textareaElement"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<label [attr.for]=\"fieldId\" class=\"floating-label textarea validator w-full rounded-sm\">\n @if (label(); as label) {\n <span>\n <ng-content select=\"[icon]\" />\n {{ label }} {{ isRequired() ? '*' : '' }}\n </span>\n }\n\n <textarea class=\"w-full h-full\" #textareaElement\n [id]=\"fieldId\"\n [formControl]=\"control()\"\n [required]=\"isRequired()\"\n [placeholder]=\"label()\n ? label() + (isRequired() ? '*' : '')\n : placeholder()\"\n [rows]=\"rows()\">\n </textarea>\n</label>\n\n<kl-field-errors [field]=\"control()\">\n <ng-container errors>\n <ng-content select=\"[errors]\" />\n </ng-container>\n</kl-field-errors>\n", dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: FieldErrors, selector: "kl-field-errors", inputs: ["field"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: Textarea, decorators: [{ type: Component, args: [{ selector: 'kl-textarea', imports: [ReactiveFormsModule, FieldErrors], template: "<label [attr.for]=\"fieldId\" class=\"floating-label textarea validator w-full rounded-sm\">\n @if (label(); as label) {\n <span>\n <ng-content select=\"[icon]\" />\n {{ label }} {{ isRequired() ? '*' : '' }}\n </span>\n }\n\n <textarea class=\"w-full h-full\" #textareaElement\n [id]=\"fieldId\"\n [formControl]=\"control()\"\n [required]=\"isRequired()\"\n [placeholder]=\"label()\n ? label() + (isRequired() ? '*' : '')\n : placeholder()\"\n [rows]=\"rows()\">\n </textarea>\n</label>\n\n<kl-field-errors [field]=\"control()\">\n <ng-container errors>\n <ng-content select=\"[errors]\" />\n </ng-container>\n</kl-field-errors>\n" }] }], ctorParameters: () => [] }); /** * Generated bundle index. Do not edit. */ export { Textarea }; //# sourceMappingURL=koalarx-ui-shared-components-input-field-textarea.mjs.map