UNPKG

3.47 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/common')) :
3 typeof define === 'function' && define.amd ? define('primeng/inputtext', ['exports', '@angular/core', '@angular/forms', '@angular/common'], factory) :
4 (global = global || self, factory((global.primeng = global.primeng || {}, global.primeng.inputtext = {}), global.ng.core, global.ng.forms, global.ng.common));
5}(this, (function (exports, core, forms, common) { 'use strict';
6
7 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
8 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11 return c > 3 && r && Object.defineProperty(target, key, r), r;
12 };
13 var __param = (this && this.__param) || function (paramIndex, decorator) {
14 return function (target, key) { decorator(target, key, paramIndex); }
15 };
16 var InputText = /** @class */ (function () {
17 function InputText(el, ngModel) {
18 this.el = el;
19 this.ngModel = ngModel;
20 }
21 InputText.prototype.ngDoCheck = function () {
22 this.updateFilledState();
23 };
24 //To trigger change detection to manage ui-state-filled for material labels when there is no value binding
25 InputText.prototype.onInput = function (e) {
26 this.updateFilledState();
27 };
28 InputText.prototype.updateFilledState = function () {
29 this.filled = (this.el.nativeElement.value && this.el.nativeElement.value.length) ||
30 (this.ngModel && this.ngModel.model);
31 };
32 InputText.ctorParameters = function () { return [
33 { type: core.ElementRef },
34 { type: forms.NgModel, decorators: [{ type: core.Optional }] }
35 ]; };
36 __decorate([
37 core.HostListener('input', ['$event'])
38 ], InputText.prototype, "onInput", null);
39 InputText = __decorate([
40 core.Directive({
41 selector: '[pInputText]',
42 host: {
43 '[class.ui-inputtext]': 'true',
44 '[class.ui-corner-all]': 'true',
45 '[class.ui-state-default]': 'true',
46 '[class.ui-widget]': 'true',
47 '[class.ui-state-filled]': 'filled'
48 }
49 }),
50 __param(1, core.Optional())
51 ], InputText);
52 return InputText;
53 }());
54 var InputTextModule = /** @class */ (function () {
55 function InputTextModule() {
56 }
57 InputTextModule = __decorate([
58 core.NgModule({
59 imports: [common.CommonModule],
60 exports: [InputText],
61 declarations: [InputText]
62 })
63 ], InputTextModule);
64 return InputTextModule;
65 }());
66
67 exports.InputText = InputText;
68 exports.InputTextModule = InputTextModule;
69
70 Object.defineProperty(exports, '__esModule', { value: true });
71
72})));
73//# sourceMappingURL=primeng-inputtext.umd.js.map