UNPKG

@kronscht/former

Version:

Former is an Angular library that provides a declarative way to generate complex forms based on primeng components

523 lines (511 loc) 89 kB
import * as i0 from '@angular/core'; import { inject, Injectable, Component, Input, ViewChild, Directive, ChangeDetectorRef, EventEmitter, ContentChildren, Output, NgModule } from '@angular/core'; import * as i1$1 from '@angular/forms'; import { FormBuilder, FormControl, Validators, ReactiveFormsModule } from '@angular/forms'; import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i2 from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core'; import * as i2$3 from 'primeng/autocomplete'; import { AutoCompleteModule } from 'primeng/autocomplete'; import * as i2$7 from 'primeng/button'; import { ButtonModule } from 'primeng/button'; import * as i13 from 'primeng/card'; import { CardModule } from 'primeng/card'; import * as i2$4 from 'primeng/checkbox'; import { CheckboxModule } from 'primeng/checkbox'; import * as i2$5 from 'primeng/inputnumber'; import { InputNumberModule } from 'primeng/inputnumber'; import * as i3$1 from 'primeng/inputtext'; import { InputTextModule } from 'primeng/inputtext'; import * as i4 from 'primeng/keyfilter'; import { KeyFilterModule } from 'primeng/keyfilter'; import { MessageModule } from 'primeng/message'; import * as i2$1 from 'primeng/datepicker'; import { DatePickerModule } from 'primeng/datepicker'; import * as i3 from 'primeng/floatlabel'; import { FloatLabelModule } from 'primeng/floatlabel'; import * as i2$2 from 'primeng/select'; import { SelectModule } from 'primeng/select'; import * as i6 from 'primeng/inputgroup'; import { InputGroupModule } from 'primeng/inputgroup'; import * as i7 from 'primeng/inputgroupaddon'; import { InputGroupAddonModule } from 'primeng/inputgroupaddon'; import { DomSanitizer } from '@angular/platform-browser'; import { HttpClient } from '@angular/common/http'; import { BehaviorSubject } from 'rxjs'; import * as i2$6 from 'primeng/textarea'; import { TextareaModule } from 'primeng/textarea'; /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class FormerService { constructor() { this.fb = inject(FormBuilder); } generateForm(formDefinition) { const formGroup = this.fb.group({}); this.addControlRecursive(formGroup, formDefinition.elements); return formGroup; } addControlRecursive(formGroup, elements) { for (const key of Object.keys(elements)) { const element = elements[key]; switch (element.type) { case "group" /* ElementType.GroupElement */: { const nestedGroup = this.fb.group({}); this.addControlRecursive(nestedGroup, element.elements); formGroup.addControl(key, nestedGroup); break; } case "gridColumn" /* ElementType.GridColumnElement */: case "gridLayout" /* ElementType.GridLayoutElement */: case "card" /* ElementType.CardElement */: this.addControlRecursive(formGroup, element.elements); break; case "template" /* ElementType.TemplateElement */: break; default: formGroup.addControl(key, new FormControl(undefined, this.addValidators(element))); } } } addValidators(element) { const validators = []; if (element.validators) { for (const validator of element.validators) { switch (validator.validationType) { case "min" /* ValidationType.Min */: validators.push(Validators.max(validator.min)); break; case "max" /* ValidationType.Max */: validators.push(Validators.max(validator.max)); break; case "required" /* ValidationType.Required */: validators.push(Validators.required); break; case "email" /* ValidationType.Email */: validators.push(Validators.email); break; case "minlength" /* ValidationType.MinLength */: validators.push(Validators.minLength(validator.minLength)); break; case "maxlength" /* ValidationType.MaxLength */: validators.push(Validators.maxLength(validator.maxLength)); break; case "pattern" /* ValidationType.Pattern */: validators.push(Validators.pattern(validator.pattern)); break; default: break; } } } return validators; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: FormerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: FormerService, providedIn: 'root' }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: FormerService, decorators: [{ type: Injectable, args: [{ providedIn: 'root', }] }] }); class BaseElementComponent { constructor() { this.parentKey = ''; } get key() { return this.element.key; } get field() { return this.element.value; } get control() { return this.formGroup.get(this.key); } ngOnInit() { if (this.control && this.field) { if (this.field.disabled) { this.control.disable(); } else { this.control.enable(); } } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BaseElementComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: BaseElementComponent, isStandalone: false, selector: "lib-base-element-component", inputs: { parentKey: "parentKey", element: "element", formGroup: "formGroup" }, ngImport: i0, template: '<div>do not use directly</div>', isInline: true }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BaseElementComponent, decorators: [{ type: Component, args: [{ selector: 'lib-base-element-component', template: '<div>do not use directly</div>', standalone: false, }] }], propDecorators: { parentKey: [{ type: Input }], element: [{ type: Input }], formGroup: [{ type: Input }] } }); /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class ValidationErrorComponent { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: ValidationErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: ValidationErrorComponent, isStandalone: false, selector: "lib-validation-error", inputs: { control: "control", field: "field", key: "key" }, ngImport: i0, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div *ngIf=\"control?.invalid\">\n <div *ngFor=\"let validator of field?.validators\">\n <small *ngIf=\"control?.hasError(validator.validationType)\" [id]=\"key + '-message'\" class=\"p-error\">{{ validator.messageKey | translate: validator.messageArgs }}</small>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: ValidationErrorComponent, decorators: [{ type: Component, args: [{ selector: 'lib-validation-error', standalone: false, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div *ngIf=\"control?.invalid\">\n <div *ngFor=\"let validator of field?.validators\">\n <small *ngIf=\"control?.hasError(validator.validationType)\" [id]=\"key + '-message'\" class=\"p-error\">{{ validator.messageKey | translate: validator.messageArgs }}</small>\n </div>\n</div>\n" }] }], propDecorators: { control: [{ type: Input }], field: [{ type: Input }], key: [{ type: Input }] } }); /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class CalendarElementComponent extends BaseElementComponent { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CalendarElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: CalendarElementComponent, isStandalone: false, selector: "lib-calendar-element", usesInheritance: true, ngImport: i0, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <p-datePicker [id]=\"key\" [name]=\"key\" [formControlName]=\"key\" [dateFormat]=\"element.value.dateFormat\" [styleClass]=\"element.value.styleClass\" [panelStyle]=\"{ minWidth: 'initial' }\"></p-datePicker>\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n", styles: [".p-datepicker-calendar-container{background-color:red}\n"], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$1.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "size", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "component", type: ValidationErrorComponent, selector: "lib-validation-error", inputs: ["control", "field", "key"] }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CalendarElementComponent, decorators: [{ type: Component, args: [{ selector: 'lib-calendar-element', standalone: false, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <p-datePicker [id]=\"key\" [name]=\"key\" [formControlName]=\"key\" [dateFormat]=\"element.value.dateFormat\" [styleClass]=\"element.value.styleClass\" [panelStyle]=\"{ minWidth: 'initial' }\"></p-datePicker>\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n", styles: [".p-datepicker-calendar-container{background-color:red}\n"] }] }] }); /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class DropdownElementComponent extends BaseElementComponent { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DropdownElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: DropdownElementComponent, isStandalone: false, selector: "lib-dropdown-element", usesInheritance: true, ngImport: i0, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <p-select [formControlName]=\"key\" [options]=\"element.value.options | async\" [showClear]=\"true\" optionLabel=\"{{ element.value.optionLabel || 'name' }}\" optionValue=\"{{ element.value.optionValue || 'code' }}\" [styleClass]=\"'w-full'\"> </p-select>\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$2.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "component", type: ValidationErrorComponent, selector: "lib-validation-error", inputs: ["control", "field", "key"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DropdownElementComponent, decorators: [{ type: Component, args: [{ selector: 'lib-dropdown-element', standalone: false, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <p-select [formControlName]=\"key\" [options]=\"element.value.options | async\" [showClear]=\"true\" optionLabel=\"{{ element.value.optionLabel || 'name' }}\" optionValue=\"{{ element.value.optionValue || 'code' }}\" [styleClass]=\"'w-full'\"> </p-select>\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n" }] }] }); /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class InputGroupElementComponent extends BaseElementComponent { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: InputGroupElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: InputGroupElementComponent, isStandalone: false, selector: "lib-input-group-element", usesInheritance: true, ngImport: i0, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <p-inputgroup [class]=\"field.wrapperClass\">\n <p-inputgroup-addon *ngIf=\"field.icon\">{{ field.icon }}</p-inputgroup-addon>\n <p-floatlabel [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <input pInputText [id]=\"key\" [name]=\"key\" [formControlName]=\"key\" [pKeyFilter]=\"field.keyFilter\" />\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <p-inputgroup-addon *ngIf=\"field.unit\">{{ field.unit }}</p-inputgroup-addon>\n </p-inputgroup>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "directive", type: i4.KeyFilter, selector: "[pKeyFilter]", inputs: ["pValidateOnly", "pKeyFilter"], outputs: ["ngModelChange"] }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "component", type: i6.InputGroup, selector: "p-inputgroup, p-inputGroup, p-input-group", inputs: ["style", "styleClass"] }, { kind: "component", type: i7.InputGroupAddon, selector: "p-inputgroup-addon, p-inputGroupAddon", inputs: ["style", "styleClass"] }, { kind: "component", type: ValidationErrorComponent, selector: "lib-validation-error", inputs: ["control", "field", "key"] }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: InputGroupElementComponent, decorators: [{ type: Component, args: [{ selector: 'lib-input-group-element', standalone: false, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <p-inputgroup [class]=\"field.wrapperClass\">\n <p-inputgroup-addon *ngIf=\"field.icon\">{{ field.icon }}</p-inputgroup-addon>\n <p-floatlabel [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <input pInputText [id]=\"key\" [name]=\"key\" [formControlName]=\"key\" [pKeyFilter]=\"field.keyFilter\" />\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <p-inputgroup-addon *ngIf=\"field.unit\">{{ field.unit }}</p-inputgroup-addon>\n </p-inputgroup>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n" }] }] }); /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class TextElementComponent extends BaseElementComponent { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TextElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: TextElementComponent, isStandalone: false, selector: "lib-text-element", usesInheritance: true, ngImport: i0, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <div>\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <input pInputText [id]=\"key\" [name]=\"key\" [class]=\"field.cssClass\" [formControlName]=\"key\" />\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "component", type: ValidationErrorComponent, selector: "lib-validation-error", inputs: ["control", "field", "key"] }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TextElementComponent, decorators: [{ type: Component, args: [{ selector: 'lib-text-element', standalone: false, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <div>\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <input pInputText [id]=\"key\" [name]=\"key\" [class]=\"field.cssClass\" [formControlName]=\"key\" />\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n </div>\n</div>\n" }] }] }); /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ function isRemoteFilterProvider(value) { return 'remote' in value; } function isLocalFilterProvider(value) { return 'local' in value; } /** * Checks, if the suggestion are remote suggestion, i.e. loaded by a specific REST endpoint */ function isRemoteSuggestions(value) { return 'remote' in value; } /** * Checks, if the suggestions are static suggestions, i.e. an array of plain strings or complex objects * @param value */ function isStaticSuggestions(value) { return 'static' in value; } /** * Checks, if the suggestions are observable suggestions, i.e. suggestions provided by an observable as an array of plain strings or complex objects * @param value */ function isObservableSuggestions(value) { return 'observable' in value; } /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class AutocompleteElementComponent extends BaseElementComponent { constructor() { super(...arguments); this.http = inject(HttpClient); // This is the internal list of all available suggestions. this.internalSuggestions = []; // Filtered suggestions this.filteredSuggestions$ = new BehaviorSubject([]); this.defaultFilter = (query, data) => { const result = data.filter(d => d.toLowerCase().includes(query.toLowerCase())); return result; }; this.defaultComplexFilter = (query, field, data) => { return data.filter(d => d[field].toLowerCase().includes(query.toLowerCase())); }; } /** * Static suggestion can be a list of strings or a list of complex objects. * @param suggestions * @param query * @param field */ handleStaticSuggestions(suggestions, query, field, filter) { const data = suggestions.static; let filtered = []; if (this.isArrayOfStrings(data)) { filtered = this.defaultFilter(query, this.internalSuggestions); // filtered = this.filterWithFallback(filter, this.defaultFilter); } else { if (field) { filtered = this.defaultComplexFilter(query, field, this.internalSuggestions); } else { throw new Error('Need to provide a field to filter a complex data structure'); } } return filtered; } // filterWithFallback(filter?: FilterProvider, defaultFilter: FilterProvider) { // let result = defaultFilter; // if (filter) { // result = filter; // } // return result; // } // filterReworked(event: AutoCompleteCompleteEvent) { // const query = event.query; // const suggestions: Suggestions = this.field.suggestions; // const filter = this.field.filter; // const filterField = this.field.field; // // if (isStaticSuggestions(suggestions)) { // this.filteredSuggestions$.next(this.handleStaticSuggestions(suggestions, query, filterField, filter)); // } else if (isObservableSuggestions(suggestions)) { // } else if (isRemoteSuggestions(suggestions)) { // } else { // console.warn('Provided suggestion type is not supported', suggestions); // } // } filter(event) { let filtered = []; const query = event.query; const suggestions = this.field.suggestions; const filter = this.field.filter; if (filter) { if (isLocalFilterProvider(filter)) { filtered = filter.local(event, this.internalSuggestions, this.field.field); } else { const evaluated = eval(filter.remote); filtered = evaluated(event, this.internalSuggestions, this.field.field); } this.filteredSuggestions$.next(filtered); } else { if (isStaticSuggestions(suggestions)) { filtered = this.handleStaticSuggestions(suggestions, query, this.field.field); this.filteredSuggestions$.next(filtered); } else if (isObservableSuggestions(this.field.suggestions)) { if (!this.isArrayOfStrings(this.internalSuggestions)) { if (!this.field.field) { throw new Error('You have to provide a custom filter function or a field to filter on complex suggestions.'); } for (const suggestion of this.internalSuggestions) { if (suggestion[this.field.field].toLowerCase().includes(query.toLowerCase())) { filtered.push(suggestion); } } } else { for (const suggestion of this.internalSuggestions) { if (suggestion.toLowerCase().includes(query.toLowerCase())) { filtered.push(suggestion); } } } this.filteredSuggestions$.next(filtered); } else if (isRemoteSuggestions(this.field.suggestions)) { this.http.get(this.field.suggestions.remote + '?name=' + query).subscribe(data => this.filteredSuggestions$.next(data)); } else { console.error('Suggestion type unknown'); } } } getAvailableFields(data) { if (data && data.length > 1) { return Object.getOwnPropertyNames(data[0]); } else { return ''; } } checkSuggestionsIncludesField(field) { return this.internalSuggestions && this.internalSuggestions.every(i => Object.prototype.hasOwnProperty.call(i, field)); } ngOnInit() { super.ngOnInit(); this.validateParameters(); if (isRemoteSuggestions(this.element.value.suggestions)) { this.http.get(this.element.value.suggestions.remote).subscribe(data => (this.internalSuggestions = data)); } if (isStaticSuggestions(this.element.value.suggestions)) { this.internalSuggestions = this.element.value.suggestions.static; console.log('static'); } if (isObservableSuggestions(this.element.value.suggestions)) { // TODO: destroy this.element.value.suggestions.observable.subscribe(data => (this.internalSuggestions = data)); console.log('observable'); } // if (isObservable(this.element.value.suggestions)) { // (this.field.suggestions as Observable<any>)?.subscribe((data: any) => (this.internalSuggestions = data)); // } else { // this.internalSuggestions = this.element.value.suggestions as any[]; // } // this.field.suggestions.subscribe((data: any) => (this.suggestions = data)); } ngAfterViewInit() { if (this.field.options) { Object.keys(this.field.options).forEach(option => { // if (this.elementRef?.hasOwnProperty(option)) { if (Object.prototype.hasOwnProperty.call(this.elementRef, option)) { this.elementRef[option] = this.field.options[option]; } }); } } isArrayOfStrings(value) { return Array.isArray(value) && value.every(item => typeof item === 'string'); } validateParameters() { if (this.element.value.suggestions) { if (isStaticSuggestions(this.element.value.suggestions)) { if (!this.element.value.field && !this.isArrayOfStrings(this.element.value.suggestions.static)) { throw new Error('You have to provide a field to filter on complex static suggestions.'); } } // if (isObservableSuggestions(this.element.value.suggestions)) { // if (!this.element.value.field && !this.isArrayOfStrings(this.element.value.suggestions.observable)) { // throw new Error('You have to provide a field to filter on complex static suggestions.'); // } // } } // if (!isObservable(this.element.value.suggestions)) { // if (this.element.value.suggestions && !this.element.value.field && !this.isArrayOfStrings(this.element.value.suggestions)) { // throw new Error('You have to provide a field to filter on complex static suggestions.'); // } // } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: AutocompleteElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: AutocompleteElementComponent, isStandalone: false, selector: "lib-autocomplete-element", viewQueries: [{ propertyName: "elementRef", first: true, predicate: ["autoCompleteElement"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <p-autoComplete\n #autoCompleteElement\n [formControlName]=\"key\"\n [suggestions]=\"(filteredSuggestions$ | async) || []\"\n [optionLabel]=\"field.field\"\n (completeMethod)=\"filter($event)\"\n [style]=\"{ width: field.width ?? '100%' }\"\n [inputStyle]=\"{ width: '100%' }\"\n [inputId]=\"key\"></p-autoComplete>\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$3.AutoComplete, selector: "p-autoComplete, p-autocomplete, p-auto-complete", inputs: ["minLength", "delay", "style", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "disabled", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "maxlength", "name", "required", "size", "appendTo", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "field", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "itemSize", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "typeahead", "variant", "fluid"], outputs: ["completeMethod", "onSelect", "onUnselect", "onFocus", "onBlur", "onDropdownClick", "onClear", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "component", type: ValidationErrorComponent, selector: "lib-validation-error", inputs: ["control", "field", "key"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: AutocompleteElementComponent, decorators: [{ type: Component, args: [{ selector: 'lib-autocomplete-element', standalone: false, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <p-autoComplete\n #autoCompleteElement\n [formControlName]=\"key\"\n [suggestions]=\"(filteredSuggestions$ | async) || []\"\n [optionLabel]=\"field.field\"\n (completeMethod)=\"filter($event)\"\n [style]=\"{ width: field.width ?? '100%' }\"\n [inputStyle]=\"{ width: '100%' }\"\n [inputId]=\"key\"></p-autoComplete>\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n" }] }], propDecorators: { elementRef: [{ type: ViewChild, args: ['autoCompleteElement'] }] } }); /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class CheckboxElementComponent extends BaseElementComponent { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CheckboxElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: CheckboxElementComponent, isStandalone: false, selector: "lib-checkbox-element", usesInheritance: true, ngImport: i0, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\" [class]=\"field.wrapperClass\">\n <p-checkbox [formControlName]=\"key\" [value]=\"field.value\" [id]=\"key\"></p-checkbox>\n <label for=\"{{ key }}\">{{ field.title }}</label>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$4.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "component", type: ValidationErrorComponent, selector: "lib-validation-error", inputs: ["control", "field", "key"] }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CheckboxElementComponent, decorators: [{ type: Component, args: [{ selector: 'lib-checkbox-element', standalone: false, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\" [class]=\"field.wrapperClass\">\n <p-checkbox [formControlName]=\"key\" [value]=\"field.value\" [id]=\"key\"></p-checkbox>\n <label for=\"{{ key }}\">{{ field.title }}</label>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n</div>\n" }] }] }); /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class NumberElementComponent extends BaseElementComponent { get mode() { if (this.field && this.field.mode) { return this.field.mode; } else { return "decimal" /* NumberMode.Decimal */; } } get currency() { if (this.field && this.field.currency) { return this.field.currency; } else { return 'EUR'; } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: NumberElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: NumberElementComponent, isStandalone: false, selector: "lib-number-element", usesInheritance: true, ngImport: i0, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <div>\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <p-inputNumber [id]=\"key\" [name]=\"key\" [mode]=\"mode\" [currency]=\"currency\" [locale]=\"field.locale\" [minFractionDigits]=\"field.minFractionDigits\" [maxFractionDigits]=\"field.maxFractionDigits\" [class]=\"field.cssClass\" [formControlName]=\"key\" />\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$5.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "component", type: ValidationErrorComponent, selector: "lib-validation-error", inputs: ["control", "field", "key"] }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: NumberElementComponent, decorators: [{ type: Component, args: [{ selector: 'lib-number-element', standalone: false, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <div>\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <p-inputNumber [id]=\"key\" [name]=\"key\" [mode]=\"mode\" [currency]=\"currency\" [locale]=\"field.locale\" [minFractionDigits]=\"field.minFractionDigits\" [maxFractionDigits]=\"field.maxFractionDigits\" [class]=\"field.cssClass\" [formControlName]=\"key\" />\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n </div>\n</div>\n" }] }] }); /* * Apache-2.0 Licence * Copyright (c) 2023 Tobias Kronschnabl * * Please see LICENCE for complete licence text. */ class TextAreaElementComponent extends BaseElementComponent { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TextAreaElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: TextAreaElementComponent, isStandalone: false, selector: "lib-text-area-element", usesInheritance: true, ngImport: i0, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <div>\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <textarea pTextarea [id]=\"key\" [name]=\"key\" [rows]=\"field.rows\" [cols]=\"field.cols\" [class]=\"field.cssClass\" [formControlName]=\"key\" [autoResize]=\"false\"></textarea>\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"field\"></lib-validation-error>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2$6.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "component", type: ValidationErrorComponent, selector: "lib-validation-error", inputs: ["control", "field", "key"] }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TextAreaElementComponent, decorators: [{ type: Component, args: [{ selector: 'lib-text-area-element', standalone: false, template: "<!--\n ~ Apache-2.0 Licence\n ~ Copyright (c) 2023 Tobias Kronschnabl\n ~\n ~ Please see LICENCE for complete licence text.\n -->\n<div [formGroup]=\"formGroup\">\n <div>\n <p-floatlabel [class]=\"field.wrapperClass\" [variant]=\"field.floatLabel ? field.floatLabel : 'over'\">\n <textarea pTextarea [id]=\"key\" [name]=\"key\" [rows]=\"field.rows\" [cols]=\"field.cols\" [class]=\"field.cssClass\" [formControlName]=\"key\" [autoResize]=\"false\"></textarea>\n <label [for]=\"key\">{{ element.value.title }}</label>\n </p-floatlabel>\n <lib-validation-error [control]=\"control\" [key]=\"key\" [field]=\"fi