@yyasinaslan/easyform
Version:
Angular Easy Form
22 lines • 8.89 kB
JavaScript
import { Component } from '@angular/core';
import { EasyFormControl } from "../../easy-form-control";
import { ReactiveFormsModule } from "@angular/forms";
import { ObservePipe } from "../../pipes/observe";
import { BindEventsDirective } from "../../directives/bind-events.directive";
import { EfErrorsComponent } from "../../components/ef-errors/ef-errors.component";
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
export class EfTextComponent extends EasyFormControl {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: EfTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: EfTextComponent, isStandalone: true, selector: "ef-text", usesInheritance: true, ngImport: i0, template: "@if (hasInitialized()) {\r\n @if (schema()?.label) {\r\n <label class=\"ef-form-label\" [for]=\"easyFormControl().id\">{{ schema()?.label | observe }}</label>\r\n }\r\n <input bindEvents [id]=\"easyFormControl().id\"\r\n [type]=\"props()['type'] ?? 'text'\"\r\n [formControl]=\"control()!\"\r\n [placeholder]=\"props()['placeholder'] ?? ''\"\r\n class=\"ef-input-text\">\r\n <ef-errors [control]=\"control()!\" [formField]=\"schema()!\"/>\r\n}\r\n", styles: [":host{display:block}:host-context(.show-errors-submitted .ng-submitted,.show-errors-always,.show-errors-touched .ng-touched,.show-errors-dirty .ng-dirty) .ef-input-text.ng-invalid{border-color:hsl(var(--ef-invalid-color, 0 100% 50%))}:host-context(.show-errors-submitted .ng-submitted,.show-errors-always,.show-errors-touched .ng-touched,.show-errors-dirty .ng-dirty) .ef-input-text.ng-invalid:focus{outline-color:hsla(var(--ef-invalid-color, 0 100% 50%)/.5)}:host-context(.show-errors-submitted .ng-submitted,.show-errors-always,.show-errors-touched .ng-touched,.show-errors-dirty .ng-dirty) .ef-input-text.ng-valid{border-color:hsl(var(--ef-valid-color, 120 100% 42%))}:host-context(.show-errors-submitted .ng-submitted,.show-errors-always,.show-errors-touched .ng-touched,.show-errors-dirty .ng-dirty) .ef-input-text.ng-valid:focus{outline-color:hsla(var(--ef-valid-color, 120 100% 42%)/.5)}.ef-form-label{display:block}.ef-input-text{width:100%;padding:var(--ef-input-padding, .5em);background:hsl(var(--ef-input-bg, 0 100% 100%));border:1px solid hsl(var(--ef-input-border-color, 0 0% 90%));border-radius:var(--ef-input-border-radius, 5px);outline:3px solid transparent;outline-offset:2px;transition:outline .2s ease-in-out}.ef-input-text:active{outline-color:hsla(var(--ef-valid-color, 120 100% 42%)/.5)}.ef-input-text:disabled{opacity:.3;cursor:default}.ef-input-text:focus{outline-color:hsla(var(--ef-input-border-color, 0 0% 90%)/.5)}\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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: ObservePipe, name: "observe" }, { kind: "component", type: EfErrorsComponent, selector: "ef-errors", inputs: ["form", "path", "control", "formField"] }, { kind: "directive", type: BindEventsDirective, selector: "input[bindEvents], textarea[bindEvents], select[bindEvents]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: EfTextComponent, decorators: [{
type: Component,
args: [{ selector: 'ef-text', standalone: true, imports: [
ReactiveFormsModule,
ObservePipe,
EfErrorsComponent,
BindEventsDirective
], template: "@if (hasInitialized()) {\r\n @if (schema()?.label) {\r\n <label class=\"ef-form-label\" [for]=\"easyFormControl().id\">{{ schema()?.label | observe }}</label>\r\n }\r\n <input bindEvents [id]=\"easyFormControl().id\"\r\n [type]=\"props()['type'] ?? 'text'\"\r\n [formControl]=\"control()!\"\r\n [placeholder]=\"props()['placeholder'] ?? ''\"\r\n class=\"ef-input-text\">\r\n <ef-errors [control]=\"control()!\" [formField]=\"schema()!\"/>\r\n}\r\n", styles: [":host{display:block}:host-context(.show-errors-submitted .ng-submitted,.show-errors-always,.show-errors-touched .ng-touched,.show-errors-dirty .ng-dirty) .ef-input-text.ng-invalid{border-color:hsl(var(--ef-invalid-color, 0 100% 50%))}:host-context(.show-errors-submitted .ng-submitted,.show-errors-always,.show-errors-touched .ng-touched,.show-errors-dirty .ng-dirty) .ef-input-text.ng-invalid:focus{outline-color:hsla(var(--ef-invalid-color, 0 100% 50%)/.5)}:host-context(.show-errors-submitted .ng-submitted,.show-errors-always,.show-errors-touched .ng-touched,.show-errors-dirty .ng-dirty) .ef-input-text.ng-valid{border-color:hsl(var(--ef-valid-color, 120 100% 42%))}:host-context(.show-errors-submitted .ng-submitted,.show-errors-always,.show-errors-touched .ng-touched,.show-errors-dirty .ng-dirty) .ef-input-text.ng-valid:focus{outline-color:hsla(var(--ef-valid-color, 120 100% 42%)/.5)}.ef-form-label{display:block}.ef-input-text{width:100%;padding:var(--ef-input-padding, .5em);background:hsl(var(--ef-input-bg, 0 100% 100%));border:1px solid hsl(var(--ef-input-border-color, 0 0% 90%));border-radius:var(--ef-input-border-radius, 5px);outline:3px solid transparent;outline-offset:2px;transition:outline .2s ease-in-out}.ef-input-text:active{outline-color:hsla(var(--ef-valid-color, 120 100% 42%)/.5)}.ef-input-text:disabled{opacity:.3;cursor:default}.ef-input-text:focus{outline-color:hsla(var(--ef-input-border-color, 0 0% 90%)/.5)}\n"] }]
}] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWYtdGV4dC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy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