UNPKG

1.48 kBJavaScriptView Raw
1import { Directive, ElementRef, Optional, HostListener, NgModule } from '@angular/core';
2import { NgModel } from '@angular/forms';
3import { CommonModule } from '@angular/common';
4
5class InputText {
6 constructor(el, ngModel) {
7 this.el = el;
8 this.ngModel = ngModel;
9 }
10 ngDoCheck() {
11 this.updateFilledState();
12 }
13 onInput(e) {
14 this.updateFilledState();
15 }
16 updateFilledState() {
17 this.filled = (this.el.nativeElement.value && this.el.nativeElement.value.length) ||
18 (this.ngModel && this.ngModel.model);
19 }
20}
21InputText.decorators = [
22 { type: Directive, args: [{
23 selector: '[pInputText]',
24 host: {
25 '[class.p-inputtext]': 'true',
26 '[class.p-component]': 'true',
27 '[class.p-filled]': 'filled'
28 }
29 },] }
30];
31InputText.ctorParameters = () => [
32 { type: ElementRef },
33 { type: NgModel, decorators: [{ type: Optional }] }
34];
35InputText.propDecorators = {
36 onInput: [{ type: HostListener, args: ['input', ['$event'],] }]
37};
38class InputTextModule {
39}
40InputTextModule.decorators = [
41 { type: NgModule, args: [{
42 imports: [CommonModule],
43 exports: [InputText],
44 declarations: [InputText]
45 },] }
46];
47
48/**
49 * Generated bundle index. Do not edit.
50 */
51
52export { InputText, InputTextModule };
53//# sourceMappingURL=primeng-inputtext.js.map