inputmask.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. "use strict";
  2. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5. 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;
  6. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7. };
  8. var __metadata = (this && this.__metadata) || function (k, v) {
  9. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10. };
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. /*
  13. Port of jQuery MaskedInput by DigitalBush as a Native Angular2 Component in Typescript without jQuery
  14. https://github.com/digitalBush/jquery.maskedinput/
  15. Copyright (c) 2007-2014 Josh Bush (digitalbush.com)
  16. Permission is hereby granted, free of charge, to any person
  17. obtaining a copy of this software and associated documentation
  18. files (the "Software"), to deal in the Software without
  19. restriction, including without limitation the rights to use,
  20. copy, modify, merge, publish, distribute, sublicense, and/or sell
  21. copies of the Software, and to permit persons to whom the
  22. Software is furnished to do so, subject to the following
  23. conditions:
  24. The above copyright notice and this permission notice shall be
  25. included in all copies or substantial portions of the Software.
  26. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  27. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  28. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  29. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  30. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  31. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  32. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  33. OTHER DEALINGS IN THE SOFTWARE.
  34. */
  35. var core_1 = require("@angular/core");
  36. var common_1 = require("@angular/common");
  37. var domhandler_1 = require("../dom/domhandler");
  38. var inputtext_1 = require("../inputtext/inputtext");
  39. var forms_1 = require("@angular/forms");
  40. exports.INPUTMASK_VALUE_ACCESSOR = {
  41. provide: forms_1.NG_VALUE_ACCESSOR,
  42. useExisting: core_1.forwardRef(function () { return InputMask; }),
  43. multi: true
  44. };
  45. var InputMask = /** @class */ (function () {
  46. function InputMask(el) {
  47. this.el = el;
  48. this.type = 'text';
  49. this.slotChar = '_';
  50. this.autoClear = true;
  51. this.characterPattern = '[A-Za-z]';
  52. this.onComplete = new core_1.EventEmitter();
  53. this.onFocus = new core_1.EventEmitter();
  54. this.onBlur = new core_1.EventEmitter();
  55. this.onInput = new core_1.EventEmitter();
  56. this.onModelChange = function () { };
  57. this.onModelTouched = function () { };
  58. }
  59. InputMask.prototype.ngOnInit = function () {
  60. var ua = domhandler_1.DomHandler.getUserAgent();
  61. this.androidChrome = /chrome/i.test(ua) && /android/i.test(ua);
  62. this.initMask();
  63. };
  64. Object.defineProperty(InputMask.prototype, "mask", {
  65. get: function () {
  66. return this._mask;
  67. },
  68. set: function (val) {
  69. this._mask = val;
  70. this.initMask();
  71. this.writeValue('');
  72. this.onModelChange(this.value);
  73. },
  74. enumerable: true,
  75. configurable: true
  76. });
  77. InputMask.prototype.initMask = function () {
  78. this.tests = [];
  79. this.partialPosition = this.mask.length;
  80. this.len = this.mask.length;
  81. this.firstNonMaskPos = null;
  82. this.defs = {
  83. '9': '[0-9]',
  84. 'a': this.characterPattern,
  85. '*': this.characterPattern + "|[0-9]"
  86. };
  87. var maskTokens = this.mask.split('');
  88. for (var i = 0; i < maskTokens.length; i++) {
  89. var c = maskTokens[i];
  90. if (c == '?') {
  91. this.len--;
  92. this.partialPosition = i;
  93. }
  94. else if (this.defs[c]) {
  95. this.tests.push(new RegExp(this.defs[c]));
  96. if (this.firstNonMaskPos === null) {
  97. this.firstNonMaskPos = this.tests.length - 1;
  98. }
  99. if (i < this.partialPosition) {
  100. this.lastRequiredNonMaskPos = this.tests.length - 1;
  101. }
  102. }
  103. else {
  104. this.tests.push(null);
  105. }
  106. }
  107. this.buffer = [];
  108. for (var i = 0; i < maskTokens.length; i++) {
  109. var c = maskTokens[i];
  110. if (c != '?') {
  111. if (this.defs[c])
  112. this.buffer.push(this.getPlaceholder(i));
  113. else
  114. this.buffer.push(c);
  115. }
  116. }
  117. this.defaultBuffer = this.buffer.join('');
  118. };
  119. InputMask.prototype.writeValue = function (value) {
  120. this.value = value;
  121. if (this.inputViewChild && this.inputViewChild.nativeElement) {
  122. if (this.value == undefined || this.value == null)
  123. this.inputViewChild.nativeElement.value = '';
  124. else
  125. this.inputViewChild.nativeElement.value = this.value;
  126. this.checkVal();
  127. this.focusText = this.inputViewChild.nativeElement.value;
  128. this.updateFilledState();
  129. }
  130. };
  131. InputMask.prototype.registerOnChange = function (fn) {
  132. this.onModelChange = fn;
  133. };
  134. InputMask.prototype.registerOnTouched = function (fn) {
  135. this.onModelTouched = fn;
  136. };
  137. InputMask.prototype.setDisabledState = function (val) {
  138. this.disabled = val;
  139. };
  140. InputMask.prototype.caret = function (first, last) {
  141. var range, begin, end;
  142. if (!this.inputViewChild.nativeElement.offsetParent || this.inputViewChild.nativeElement !== document.activeElement) {
  143. return;
  144. }
  145. if (typeof first == 'number') {
  146. begin = first;
  147. end = (typeof last === 'number') ? last : begin;
  148. if (this.inputViewChild.nativeElement.setSelectionRange) {
  149. this.inputViewChild.nativeElement.setSelectionRange(begin, end);
  150. }
  151. else if (this.inputViewChild.nativeElement['createTextRange']) {
  152. range = this.inputViewChild.nativeElement['createTextRange']();
  153. range.collapse(true);
  154. range.moveEnd('character', end);
  155. range.moveStart('character', begin);
  156. range.select();
  157. }
  158. }
  159. else {
  160. if (this.inputViewChild.nativeElement.setSelectionRange) {
  161. begin = this.inputViewChild.nativeElement.selectionStart;
  162. end = this.inputViewChild.nativeElement.selectionEnd;
  163. }
  164. else if (document['selection'] && document['selection'].createRange) {
  165. range = document['selection'].createRange();
  166. begin = 0 - range.duplicate().moveStart('character', -100000);
  167. end = begin + range.text.length;
  168. }
  169. return { begin: begin, end: end };
  170. }
  171. };
  172. InputMask.prototype.isCompleted = function () {
  173. var completed;
  174. for (var i = this.firstNonMaskPos; i <= this.lastRequiredNonMaskPos; i++) {
  175. if (this.tests[i] && this.buffer[i] === this.getPlaceholder(i)) {
  176. return false;
  177. }
  178. }
  179. return true;
  180. };
  181. InputMask.prototype.getPlaceholder = function (i) {
  182. if (i < this.slotChar.length) {
  183. return this.slotChar.charAt(i);
  184. }
  185. return this.slotChar.charAt(0);
  186. };
  187. InputMask.prototype.seekNext = function (pos) {
  188. while (++pos < this.len && !this.tests[pos])
  189. ;
  190. return pos;
  191. };
  192. InputMask.prototype.seekPrev = function (pos) {
  193. while (--pos >= 0 && !this.tests[pos])
  194. ;
  195. return pos;
  196. };
  197. InputMask.prototype.shiftL = function (begin, end) {
  198. var i, j;
  199. if (begin < 0) {
  200. return;
  201. }
  202. for (i = begin, j = this.seekNext(end); i < this.len; i++) {
  203. if (this.tests[i]) {
  204. if (j < this.len && this.tests[i].test(this.buffer[j])) {
  205. this.buffer[i] = this.buffer[j];
  206. this.buffer[j] = this.getPlaceholder(j);
  207. }
  208. else {
  209. break;
  210. }
  211. j = this.seekNext(j);
  212. }
  213. }
  214. this.writeBuffer();
  215. this.caret(Math.max(this.firstNonMaskPos, begin));
  216. };
  217. InputMask.prototype.shiftR = function (pos) {
  218. var i, c, j, t;
  219. for (i = pos, c = this.getPlaceholder(pos); i < this.len; i++) {
  220. if (this.tests[i]) {
  221. j = this.seekNext(i);
  222. t = this.buffer[i];
  223. this.buffer[i] = c;
  224. if (j < this.len && this.tests[j].test(t)) {
  225. c = t;
  226. }
  227. else {
  228. break;
  229. }
  230. }
  231. }
  232. };
  233. InputMask.prototype.handleAndroidInput = function (e) {
  234. var _this = this;
  235. var curVal = this.inputViewChild.nativeElement.value;
  236. var pos = this.caret();
  237. if (this.oldVal && this.oldVal.length && this.oldVal.length > curVal.length) {
  238. // a deletion or backspace happened
  239. this.checkVal(true);
  240. while (pos.begin > 0 && !this.tests[pos.begin - 1])
  241. pos.begin--;
  242. if (pos.begin === 0) {
  243. while (pos.begin < this.firstNonMaskPos && !this.tests[pos.begin])
  244. pos.begin++;
  245. }
  246. setTimeout(function () {
  247. _this.caret(pos.begin, pos.begin);
  248. _this.updateModel(e);
  249. if (_this.isCompleted()) {
  250. _this.onComplete.emit();
  251. }
  252. }, 0);
  253. }
  254. else {
  255. this.checkVal(true);
  256. while (pos.begin < this.len && !this.tests[pos.begin])
  257. pos.begin++;
  258. setTimeout(function () {
  259. _this.caret(pos.begin, pos.begin);
  260. _this.updateModel(e);
  261. if (_this.isCompleted()) {
  262. _this.onComplete.emit();
  263. }
  264. }, 0);
  265. }
  266. };
  267. InputMask.prototype.onInputBlur = function (e) {
  268. this.focused = false;
  269. this.onModelTouched();
  270. this.checkVal();
  271. this.updateFilledState();
  272. this.onBlur.emit(e);
  273. if (this.inputViewChild.nativeElement.value != this.focusText || this.inputViewChild.nativeElement.value != this.value) {
  274. this.updateModel(e);
  275. var event_1 = document.createEvent('HTMLEvents');
  276. event_1.initEvent('change', true, false);
  277. this.inputViewChild.nativeElement.dispatchEvent(event_1);
  278. }
  279. };
  280. InputMask.prototype.onKeyDown = function (e) {
  281. if (this.readonly) {
  282. return;
  283. }
  284. var k = e.which || e.keyCode, pos, begin, end;
  285. var iPhone = /iphone/i.test(domhandler_1.DomHandler.getUserAgent());
  286. this.oldVal = this.inputViewChild.nativeElement.value;
  287. //backspace, delete, and escape get special treatment
  288. if (k === 8 || k === 46 || (iPhone && k === 127)) {
  289. pos = this.caret();
  290. begin = pos.begin;
  291. end = pos.end;
  292. if (end - begin === 0) {
  293. begin = k !== 46 ? this.seekPrev(begin) : (end = this.seekNext(begin - 1));
  294. end = k === 46 ? this.seekNext(end) : end;
  295. }
  296. this.clearBuffer(begin, end);
  297. this.shiftL(begin, end - 1);
  298. this.updateModel(e);
  299. e.preventDefault();
  300. }
  301. else if (k === 13) { // enter
  302. this.onInputBlur(e);
  303. this.updateModel(e);
  304. }
  305. else if (k === 27) { // escape
  306. this.inputViewChild.nativeElement.value = this.focusText;
  307. this.caret(0, this.checkVal());
  308. this.updateModel(e);
  309. e.preventDefault();
  310. }
  311. };
  312. InputMask.prototype.onKeyPress = function (e) {
  313. var _this = this;
  314. if (this.readonly) {
  315. return;
  316. }
  317. var k = e.which || e.keyCode, pos = this.caret(), p, c, next, completed;
  318. if (e.ctrlKey || e.altKey || e.metaKey || k < 32 || (k > 34 && k < 41)) { //Ignore
  319. return;
  320. }
  321. else if (k && k !== 13) {
  322. if (pos.end - pos.begin !== 0) {
  323. this.clearBuffer(pos.begin, pos.end);
  324. this.shiftL(pos.begin, pos.end - 1);
  325. }
  326. p = this.seekNext(pos.begin - 1);
  327. if (p < this.len) {
  328. c = String.fromCharCode(k);
  329. if (this.tests[p].test(c)) {
  330. this.shiftR(p);
  331. this.buffer[p] = c;
  332. this.writeBuffer();
  333. next = this.seekNext(p);
  334. if (/android/i.test(domhandler_1.DomHandler.getUserAgent())) {
  335. //Path for CSP Violation on FireFox OS 1.1
  336. var proxy = function () {
  337. _this.caret(next);
  338. };
  339. setTimeout(proxy, 0);
  340. }
  341. else {
  342. this.caret(next);
  343. }
  344. if (pos.begin <= this.lastRequiredNonMaskPos) {
  345. completed = this.isCompleted();
  346. }
  347. }
  348. }
  349. e.preventDefault();
  350. }
  351. this.updateModel(e);
  352. this.updateFilledState();
  353. if (completed) {
  354. this.onComplete.emit();
  355. }
  356. };
  357. InputMask.prototype.clearBuffer = function (start, end) {
  358. var i;
  359. for (i = start; i < end && i < this.len; i++) {
  360. if (this.tests[i]) {
  361. this.buffer[i] = this.getPlaceholder(i);
  362. }
  363. }
  364. };
  365. InputMask.prototype.writeBuffer = function () {
  366. this.inputViewChild.nativeElement.value = this.buffer.join('');
  367. };
  368. InputMask.prototype.checkVal = function (allow) {
  369. //try to place characters where they belong
  370. var test = this.inputViewChild.nativeElement.value, lastMatch = -1, i, c, pos;
  371. for (i = 0, pos = 0; i < this.len; i++) {
  372. if (this.tests[i]) {
  373. this.buffer[i] = this.getPlaceholder(i);
  374. while (pos++ < test.length) {
  375. c = test.charAt(pos - 1);
  376. if (this.tests[i].test(c)) {
  377. this.buffer[i] = c;
  378. lastMatch = i;
  379. break;
  380. }
  381. }
  382. if (pos > test.length) {
  383. this.clearBuffer(i + 1, this.len);
  384. break;
  385. }
  386. }
  387. else {
  388. if (this.buffer[i] === test.charAt(pos)) {
  389. pos++;
  390. }
  391. if (i < this.partialPosition) {
  392. lastMatch = i;
  393. }
  394. }
  395. }
  396. if (allow) {
  397. this.writeBuffer();
  398. }
  399. else if (lastMatch + 1 < this.partialPosition) {
  400. if (this.autoClear || this.buffer.join('') === this.defaultBuffer) {
  401. // Invalid value. Remove it and replace it with the
  402. // mask, which is the default behavior.
  403. if (this.inputViewChild.nativeElement.value)
  404. this.inputViewChild.nativeElement.value = '';
  405. this.clearBuffer(0, this.len);
  406. }
  407. else {
  408. // Invalid value, but we opt to show the value to the
  409. // user and allow them to correct their mistake.
  410. this.writeBuffer();
  411. }
  412. }
  413. else {
  414. this.writeBuffer();
  415. this.inputViewChild.nativeElement.value = this.inputViewChild.nativeElement.value.substring(0, lastMatch + 1);
  416. }
  417. return (this.partialPosition ? i : this.firstNonMaskPos);
  418. };
  419. InputMask.prototype.onInputFocus = function (event) {
  420. var _this = this;
  421. if (this.readonly) {
  422. return;
  423. }
  424. this.focused = true;
  425. clearTimeout(this.caretTimeoutId);
  426. var pos;
  427. this.focusText = this.inputViewChild.nativeElement.value;
  428. pos = this.checkVal();
  429. this.caretTimeoutId = setTimeout(function () {
  430. if (_this.inputViewChild.nativeElement !== document.activeElement) {
  431. return;
  432. }
  433. _this.writeBuffer();
  434. if (pos == _this.mask.replace("?", "").length) {
  435. _this.caret(0, pos);
  436. }
  437. else {
  438. _this.caret(pos);
  439. }
  440. }, 10);
  441. this.onFocus.emit(event);
  442. };
  443. InputMask.prototype.onInputChange = function (event) {
  444. if (this.androidChrome)
  445. this.handleAndroidInput(event);
  446. else
  447. this.handleInputChange(event);
  448. this.onInput.emit(event);
  449. };
  450. InputMask.prototype.handleInputChange = function (event) {
  451. var _this = this;
  452. if (this.readonly) {
  453. return;
  454. }
  455. setTimeout(function () {
  456. var pos = _this.checkVal(true);
  457. _this.caret(pos);
  458. _this.updateModel(event);
  459. if (_this.isCompleted()) {
  460. _this.onComplete.emit();
  461. }
  462. }, 0);
  463. };
  464. InputMask.prototype.getUnmaskedValue = function () {
  465. var unmaskedBuffer = [];
  466. for (var i = 0; i < this.buffer.length; i++) {
  467. var c = this.buffer[i];
  468. if (this.tests[i] && c != this.getPlaceholder(i)) {
  469. unmaskedBuffer.push(c);
  470. }
  471. }
  472. return unmaskedBuffer.join('');
  473. };
  474. InputMask.prototype.updateModel = function (e) {
  475. var updatedValue = this.unmask ? this.getUnmaskedValue() : e.target.value;
  476. if (updatedValue !== null || updatedValue !== undefined) {
  477. this.value = updatedValue;
  478. this.onModelChange(this.value);
  479. }
  480. };
  481. InputMask.prototype.updateFilledState = function () {
  482. this.filled = this.inputViewChild.nativeElement && this.inputViewChild.nativeElement.value != '';
  483. };
  484. InputMask.prototype.focus = function () {
  485. this.inputViewChild.nativeElement.focus();
  486. };
  487. InputMask.prototype.ngOnDestroy = function () {
  488. };
  489. __decorate([
  490. core_1.Input(),
  491. __metadata("design:type", String)
  492. ], InputMask.prototype, "type", void 0);
  493. __decorate([
  494. core_1.Input(),
  495. __metadata("design:type", String)
  496. ], InputMask.prototype, "slotChar", void 0);
  497. __decorate([
  498. core_1.Input(),
  499. __metadata("design:type", Boolean)
  500. ], InputMask.prototype, "autoClear", void 0);
  501. __decorate([
  502. core_1.Input(),
  503. __metadata("design:type", Object)
  504. ], InputMask.prototype, "style", void 0);
  505. __decorate([
  506. core_1.Input(),
  507. __metadata("design:type", String)
  508. ], InputMask.prototype, "inputId", void 0);
  509. __decorate([
  510. core_1.Input(),
  511. __metadata("design:type", String)
  512. ], InputMask.prototype, "styleClass", void 0);
  513. __decorate([
  514. core_1.Input(),
  515. __metadata("design:type", String)
  516. ], InputMask.prototype, "placeholder", void 0);
  517. __decorate([
  518. core_1.Input(),
  519. __metadata("design:type", Number)
  520. ], InputMask.prototype, "size", void 0);
  521. __decorate([
  522. core_1.Input(),
  523. __metadata("design:type", Number)
  524. ], InputMask.prototype, "maxlength", void 0);
  525. __decorate([
  526. core_1.Input(),
  527. __metadata("design:type", String)
  528. ], InputMask.prototype, "tabindex", void 0);
  529. __decorate([
  530. core_1.Input(),
  531. __metadata("design:type", String)
  532. ], InputMask.prototype, "title", void 0);
  533. __decorate([
  534. core_1.Input(),
  535. __metadata("design:type", String)
  536. ], InputMask.prototype, "ariaLabel", void 0);
  537. __decorate([
  538. core_1.Input(),
  539. __metadata("design:type", Boolean)
  540. ], InputMask.prototype, "ariaRequired", void 0);
  541. __decorate([
  542. core_1.Input(),
  543. __metadata("design:type", Boolean)
  544. ], InputMask.prototype, "disabled", void 0);
  545. __decorate([
  546. core_1.Input(),
  547. __metadata("design:type", Boolean)
  548. ], InputMask.prototype, "readonly", void 0);
  549. __decorate([
  550. core_1.Input(),
  551. __metadata("design:type", Boolean)
  552. ], InputMask.prototype, "unmask", void 0);
  553. __decorate([
  554. core_1.Input(),
  555. __metadata("design:type", String)
  556. ], InputMask.prototype, "name", void 0);
  557. __decorate([
  558. core_1.Input(),
  559. __metadata("design:type", Boolean)
  560. ], InputMask.prototype, "required", void 0);
  561. __decorate([
  562. core_1.Input(),
  563. __metadata("design:type", String)
  564. ], InputMask.prototype, "characterPattern", void 0);
  565. __decorate([
  566. core_1.Input(),
  567. __metadata("design:type", Boolean)
  568. ], InputMask.prototype, "autoFocus", void 0);
  569. __decorate([
  570. core_1.Input(),
  571. __metadata("design:type", String)
  572. ], InputMask.prototype, "autocomplete", void 0);
  573. __decorate([
  574. core_1.ViewChild('input', { static: true }),
  575. __metadata("design:type", core_1.ElementRef)
  576. ], InputMask.prototype, "inputViewChild", void 0);
  577. __decorate([
  578. core_1.Output(),
  579. __metadata("design:type", core_1.EventEmitter)
  580. ], InputMask.prototype, "onComplete", void 0);
  581. __decorate([
  582. core_1.Output(),
  583. __metadata("design:type", core_1.EventEmitter)
  584. ], InputMask.prototype, "onFocus", void 0);
  585. __decorate([
  586. core_1.Output(),
  587. __metadata("design:type", core_1.EventEmitter)
  588. ], InputMask.prototype, "onBlur", void 0);
  589. __decorate([
  590. core_1.Output(),
  591. __metadata("design:type", core_1.EventEmitter)
  592. ], InputMask.prototype, "onInput", void 0);
  593. __decorate([
  594. core_1.Input(),
  595. __metadata("design:type", String),
  596. __metadata("design:paramtypes", [String])
  597. ], InputMask.prototype, "mask", null);
  598. InputMask = __decorate([
  599. core_1.Component({
  600. selector: 'p-inputMask',
  601. template: "<input #input pInputText [attr.id]=\"inputId\" [attr.type]=\"type\" [attr.name]=\"name\" [ngStyle]=\"style\" [ngClass]=\"styleClass\" [attr.placeholder]=\"placeholder\" [attr.title]=\"title\"\n [attr.size]=\"size\" [attr.autocomplete]=\"autocomplete\" [attr.maxlength]=\"maxlength\" [attr.tabindex]=\"tabindex\" [attr.aria-label]=\"ariaLabel\" [attr.aria-required]=\"ariaRequired\" [disabled]=\"disabled\" [readonly]=\"readonly\" [attr.required]=\"required\"\n (focus)=\"onInputFocus($event)\" (blur)=\"onInputBlur($event)\" (keydown)=\"onKeyDown($event)\" (keypress)=\"onKeyPress($event)\" [attr.autofocus]=\"autoFocus\"\n (input)=\"onInputChange($event)\" (paste)=\"handleInputChange($event)\">",
  602. host: {
  603. '[class.ui-inputwrapper-filled]': 'filled',
  604. '[class.ui-inputwrapper-focus]': 'focus'
  605. },
  606. providers: [exports.INPUTMASK_VALUE_ACCESSOR]
  607. }),
  608. __metadata("design:paramtypes", [core_1.ElementRef])
  609. ], InputMask);
  610. return InputMask;
  611. }());
  612. exports.InputMask = InputMask;
  613. var InputMaskModule = /** @class */ (function () {
  614. function InputMaskModule() {
  615. }
  616. InputMaskModule = __decorate([
  617. core_1.NgModule({
  618. imports: [common_1.CommonModule, inputtext_1.InputTextModule],
  619. exports: [InputMask],
  620. declarations: [InputMask]
  621. })
  622. ], InputMaskModule);
  623. return InputMaskModule;
  624. }());
  625. exports.InputMaskModule = InputMaskModule;
  626. //# sourceMappingURL=inputmask.js.map