@progress/kendo-angular-inputs
Advanced tools
Comparing version 0.18.4 to 0.18.5
@@ -55,2 +55,3 @@ import { OnChanges, AfterViewInit, ElementRef } from '@angular/core'; | ||
private innerMask; | ||
private isDel; | ||
private tokens; | ||
@@ -168,5 +169,5 @@ private emptyMask; | ||
private maskInput(value); | ||
private maskChar(start, value, isBack); | ||
private validateChar(start, char, isBack?, findFirstValid?); | ||
private maskChar(start, value, isDeleting, findFirstValid?); | ||
private validateChar(start, char, isDeleting?, findFirstValid?); | ||
private caret(start?, end?); | ||
} |
@@ -60,2 +60,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
this.innerMask = ''; | ||
this.isDel = false; | ||
this.promptChar = '_'; | ||
@@ -158,3 +159,3 @@ this.ngTouched = noop; | ||
if (event.keyCode === Keys.delete) { | ||
event.preventDefault(); | ||
this.isDel = true; | ||
} | ||
@@ -179,3 +180,3 @@ else if (event.keyCode === 13) { | ||
var char = clipboardText_1[_i]; | ||
start = this.maskChar(start, char, false); | ||
start = this.maskChar(start, char, false, true); | ||
if (start < oldStart) { | ||
@@ -191,2 +192,3 @@ start = oldStart; | ||
} | ||
this.caret(start, start); | ||
}; | ||
@@ -341,3 +343,2 @@ Object.defineProperty(MaskedTextBoxComponent.prototype, "widgetClass", { | ||
this.updateInputValue(); | ||
this.isPasted = false; | ||
} | ||
@@ -348,2 +349,4 @@ else { | ||
} | ||
this.isPasted = false; | ||
this.isDel = false; | ||
this.restoreCaret(); | ||
@@ -357,9 +360,10 @@ }; | ||
var char = undefined; | ||
var isBack = false; | ||
this.clearRange(lastCaret); | ||
if (newValue.length === oldValue.length - 1) { | ||
isBack = true; | ||
caretPos = this.find(caretPos, true); | ||
this.caret(caretPos); | ||
if (!newValue.length) { | ||
return; | ||
} | ||
if (newValue.length === oldValue.length - 1 && lastCaret[0] === lastCaret[1]) { | ||
this.maskChar(caretPos, this.promptChar, true); | ||
this.caret(this.isDel ? caretPos + 1 : caretPos); | ||
return; | ||
} | ||
@@ -369,10 +373,8 @@ else { | ||
} | ||
if (this.validateChar(caretPos, char, false, true).char !== undefined) { | ||
this.maskChar(caretPos, char, false); | ||
if (char && this.validateChar(caretPos, char, false, true).char !== undefined) { | ||
var latestPosition = this.maskChar(caretPos, char, false, true); | ||
this.caret(latestPosition, latestPosition); | ||
return; | ||
} | ||
if (!isBack) { | ||
this.innerValue = oldValue; | ||
} | ||
this.caret(caretPos); | ||
this.caret(lastCaret[0], lastCaret[0]); | ||
}; | ||
@@ -487,3 +489,3 @@ MaskedTextBoxComponent.prototype.validationPattern = function () { | ||
var char = value_1[_i]; | ||
start = this.maskChar(start, char, false); | ||
start = this.maskChar(start, char, false, true); | ||
if (start < oldStart) { | ||
@@ -497,3 +499,3 @@ start = oldStart; | ||
}; | ||
MaskedTextBoxComponent.prototype.maskChar = function (start, value, isBack) { | ||
MaskedTextBoxComponent.prototype.maskChar = function (start, value, isDeleting, findFirstValid) { | ||
var current = this.innerValue || this.emptyMask; | ||
@@ -503,3 +505,3 @@ var currentArray = current.split(""); | ||
var vToken; | ||
vToken = this.validateChar(start, chr, isBack, true); | ||
vToken = this.validateChar(start, chr, isDeleting, findFirstValid); | ||
chr = vToken.char; | ||
@@ -513,9 +515,6 @@ start = vToken.position; | ||
start++; | ||
if (this.focused && !isBack) { | ||
this.caret(start); | ||
} | ||
return this.find(start); | ||
}; | ||
MaskedTextBoxComponent.prototype.validateChar = function (start, char, isBack, findFirstValid) { | ||
if (isBack === void 0) { isBack = false; } | ||
MaskedTextBoxComponent.prototype.validateChar = function (start, char, isDeleting, findFirstValid) { | ||
if (isDeleting === void 0) { isDeleting = false; } | ||
if (findFirstValid === void 0) { findFirstValid = false; } | ||
@@ -529,3 +528,3 @@ if (start >= this.tokens.length) { | ||
if (regex && regex.test) { | ||
valid = regex.test(char) ? char : (isBack ? this.promptChar : undefined); | ||
valid = regex.test(char) ? char : (isDeleting ? this.promptChar : undefined); | ||
} | ||
@@ -537,3 +536,3 @@ else { | ||
if (findFirstValid && token.char === undefined) { | ||
token = this.validateChar(this.find(start), char, isBack, false); | ||
token = this.validateChar(this.find(start), char, isDeleting, false); | ||
} | ||
@@ -540,0 +539,0 @@ return token; |
@@ -55,2 +55,3 @@ import { OnChanges, AfterViewInit, ElementRef } from '@angular/core'; | ||
private innerMask; | ||
private isDel; | ||
private tokens; | ||
@@ -168,5 +169,5 @@ private emptyMask; | ||
private maskInput(value); | ||
private maskChar(start, value, isBack); | ||
private validateChar(start, char, isBack?, findFirstValid?); | ||
private maskChar(start, value, isDeleting, findFirstValid?); | ||
private validateChar(start, char, isDeleting?, findFirstValid?); | ||
private caret(start?, end?); | ||
} |
@@ -61,2 +61,3 @@ "use strict"; | ||
this.innerMask = ''; | ||
this.isDel = false; | ||
this.promptChar = '_'; | ||
@@ -159,3 +160,3 @@ this.ngTouched = noop; | ||
if (event.keyCode === enums_1.Keys.delete) { | ||
event.preventDefault(); | ||
this.isDel = true; | ||
} | ||
@@ -180,3 +181,3 @@ else if (event.keyCode === 13) { | ||
var char = clipboardText_1[_i]; | ||
start = this.maskChar(start, char, false); | ||
start = this.maskChar(start, char, false, true); | ||
if (start < oldStart) { | ||
@@ -192,2 +193,3 @@ start = oldStart; | ||
} | ||
this.caret(start, start); | ||
}; | ||
@@ -342,3 +344,2 @@ Object.defineProperty(MaskedTextBoxComponent.prototype, "widgetClass", { | ||
this.updateInputValue(); | ||
this.isPasted = false; | ||
} | ||
@@ -349,2 +350,4 @@ else { | ||
} | ||
this.isPasted = false; | ||
this.isDel = false; | ||
this.restoreCaret(); | ||
@@ -358,9 +361,10 @@ }; | ||
var char = undefined; | ||
var isBack = false; | ||
this.clearRange(lastCaret); | ||
if (newValue.length === oldValue.length - 1) { | ||
isBack = true; | ||
caretPos = this.find(caretPos, true); | ||
this.caret(caretPos); | ||
if (!newValue.length) { | ||
return; | ||
} | ||
if (newValue.length === oldValue.length - 1 && lastCaret[0] === lastCaret[1]) { | ||
this.maskChar(caretPos, this.promptChar, true); | ||
this.caret(this.isDel ? caretPos + 1 : caretPos); | ||
return; | ||
} | ||
@@ -370,10 +374,8 @@ else { | ||
} | ||
if (this.validateChar(caretPos, char, false, true).char !== undefined) { | ||
this.maskChar(caretPos, char, false); | ||
if (char && this.validateChar(caretPos, char, false, true).char !== undefined) { | ||
var latestPosition = this.maskChar(caretPos, char, false, true); | ||
this.caret(latestPosition, latestPosition); | ||
return; | ||
} | ||
if (!isBack) { | ||
this.innerValue = oldValue; | ||
} | ||
this.caret(caretPos); | ||
this.caret(lastCaret[0], lastCaret[0]); | ||
}; | ||
@@ -488,3 +490,3 @@ MaskedTextBoxComponent.prototype.validationPattern = function () { | ||
var char = value_1[_i]; | ||
start = this.maskChar(start, char, false); | ||
start = this.maskChar(start, char, false, true); | ||
if (start < oldStart) { | ||
@@ -498,3 +500,3 @@ start = oldStart; | ||
}; | ||
MaskedTextBoxComponent.prototype.maskChar = function (start, value, isBack) { | ||
MaskedTextBoxComponent.prototype.maskChar = function (start, value, isDeleting, findFirstValid) { | ||
var current = this.innerValue || this.emptyMask; | ||
@@ -504,3 +506,3 @@ var currentArray = current.split(""); | ||
var vToken; | ||
vToken = this.validateChar(start, chr, isBack, true); | ||
vToken = this.validateChar(start, chr, isDeleting, findFirstValid); | ||
chr = vToken.char; | ||
@@ -514,9 +516,6 @@ start = vToken.position; | ||
start++; | ||
if (this.focused && !isBack) { | ||
this.caret(start); | ||
} | ||
return this.find(start); | ||
}; | ||
MaskedTextBoxComponent.prototype.validateChar = function (start, char, isBack, findFirstValid) { | ||
if (isBack === void 0) { isBack = false; } | ||
MaskedTextBoxComponent.prototype.validateChar = function (start, char, isDeleting, findFirstValid) { | ||
if (isDeleting === void 0) { isDeleting = false; } | ||
if (findFirstValid === void 0) { findFirstValid = false; } | ||
@@ -530,3 +529,3 @@ if (start >= this.tokens.length) { | ||
if (regex && regex.test) { | ||
valid = regex.test(char) ? char : (isBack ? this.promptChar : undefined); | ||
valid = regex.test(char) ? char : (isDeleting ? this.promptChar : undefined); | ||
} | ||
@@ -538,3 +537,3 @@ else { | ||
if (findFirstValid && token.char === undefined) { | ||
token = this.validateChar(this.find(start), char, isBack, false); | ||
token = this.validateChar(this.find(start), char, isDeleting, false); | ||
} | ||
@@ -541,0 +540,0 @@ return token; |
{ | ||
"name": "@progress/kendo-angular-inputs", | ||
"description": "Inputs Package for Angular 2", | ||
"version": "0.18.4", | ||
"version": "0.18.5", | ||
"publishConfig": { | ||
@@ -6,0 +6,0 @@ "registry": "https://registry.npm.telerik.com" |
Sorry, the diff of this file is too big to display
444025