1 | import { NgModule, Directive, HostListener, Optional } from '@angular/core';
|
---|
2 | import { CommonModule } from '@angular/common';
|
---|
3 | import * as i0 from "@angular/core";
|
---|
4 | import * as i1 from "@angular/forms";
|
---|
5 | export class InputText {
|
---|
6 | constructor(el, ngModel, cd) {
|
---|
7 | this.el = el;
|
---|
8 | this.ngModel = ngModel;
|
---|
9 | this.cd = cd;
|
---|
10 | }
|
---|
11 | ngAfterViewInit() {
|
---|
12 | this.updateFilledState();
|
---|
13 | this.cd.detectChanges();
|
---|
14 | }
|
---|
15 | ngDoCheck() {
|
---|
16 | this.updateFilledState();
|
---|
17 | }
|
---|
18 | onInput(e) {
|
---|
19 | this.updateFilledState();
|
---|
20 | }
|
---|
21 | updateFilledState() {
|
---|
22 | this.filled = (this.el.nativeElement.value && this.el.nativeElement.value.length) ||
|
---|
23 | (this.ngModel && this.ngModel.model);
|
---|
24 | }
|
---|
25 | }
|
---|
26 | InputText.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputText, deps: [{ token: i0.ElementRef }, { token: i1.NgModel, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
---|
27 | InputText.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0", type: InputText, selector: "[pInputText]", host: { listeners: { "input": "onInput($event)" }, properties: { "class.p-filled": "filled" }, classAttribute: "p-inputtext p-component p-element" }, ngImport: i0 });
|
---|
28 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputText, decorators: [{
|
---|
29 | type: Directive,
|
---|
30 | args: [{
|
---|
31 | selector: '[pInputText]',
|
---|
32 | host: {
|
---|
33 | 'class': 'p-inputtext p-component p-element',
|
---|
34 | '[class.p-filled]': 'filled'
|
---|
35 | }
|
---|
36 | }]
|
---|
37 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.NgModel, decorators: [{
|
---|
38 | type: Optional
|
---|
39 | }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { onInput: [{
|
---|
40 | type: HostListener,
|
---|
41 | args: ['input', ['$event']]
|
---|
42 | }] } });
|
---|
43 | export class InputTextModule {
|
---|
44 | }
|
---|
45 | InputTextModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputTextModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
46 | InputTextModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputTextModule, declarations: [InputText], imports: [CommonModule], exports: [InputText] });
|
---|
47 | InputTextModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputTextModule, imports: [[CommonModule]] });
|
---|
48 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputTextModule, decorators: [{
|
---|
49 | type: NgModule,
|
---|
50 | args: [{
|
---|
51 | imports: [CommonModule],
|
---|
52 | exports: [InputText],
|
---|
53 | declarations: [InputText]
|
---|
54 | }]
|
---|
55 | }] });
|
---|
56 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXR0ZXh0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FwcC9jb21wb25lbnRzL2lucHV0dGV4dC9pbnB1dHRleHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFFBQVEsRUFBRSxTQUFTLEVBQWMsWUFBWSxFQUFXLFFBQVEsRUFBbUMsTUFBTSxlQUFlLENBQUM7QUFFakksT0FBTyxFQUFDLFlBQVksRUFBQyxNQUFNLGlCQUFpQixDQUFDOzs7QUFTN0MsTUFBTSxPQUFPLFNBQVM7SUFJbEIsWUFBbUIsRUFBYyx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