|
@@ -3,7 +3,7 @@
|
|
|
* https://github.com/RobinHerbots/Inputmask
|
|
* https://github.com/RobinHerbots/Inputmask
|
|
|
* Copyright (c) 2010 - 2017 Robin Herbots
|
|
* Copyright (c) 2010 - 2017 Robin Herbots
|
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-* Version: 4.0.1-25
|
|
|
|
|
|
|
+* Version: 4.0.1-26
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
!function(modules) {
|
|
!function(modules) {
|
|
@@ -247,7 +247,7 @@
|
|
|
}(altMatch, altMatch2) || function(source, target) {
|
|
}(altMatch, altMatch2) || function(source, target) {
|
|
|
return null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1);
|
|
return null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1);
|
|
|
}(altMatch, altMatch2)) {
|
|
}(altMatch, altMatch2)) {
|
|
|
- altMatch.alternation == altMatch2.alternation && -1 === altMatch.locator[altMatch.alternation].toString().indexOf(altMatch2.locator[altMatch2.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na || altMatch.locator[altMatch.alternation].toString(),
|
|
|
|
|
|
|
+ altMatch.alternation === altMatch2.alternation && -1 === altMatch.locator[altMatch.alternation].toString().indexOf(altMatch2.locator[altMatch2.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na || altMatch.locator[altMatch.alternation].toString(),
|
|
|
-1 === altMatch.na.indexOf(altMatch.locator[altMatch.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na + "," + altMatch.locator[altMatch2.alternation].toString().split("")[0]),
|
|
-1 === altMatch.na.indexOf(altMatch.locator[altMatch.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na + "," + altMatch.locator[altMatch2.alternation].toString().split("")[0]),
|
|
|
dropMatch = !0, altMatch.locator[altMatch.alternation] = altMatch2.locator[altMatch2.alternation].toString().split("")[0] + "," + altMatch.locator[altMatch.alternation],
|
|
dropMatch = !0, altMatch.locator[altMatch.alternation] = altMatch2.locator[altMatch2.alternation].toString().split("")[0] + "," + altMatch.locator[altMatch.alternation],
|
|
|
malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
|
|
malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
|
|
@@ -855,7 +855,7 @@
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
input.inputmask.events[eventName] = input.inputmask.events[eventName] || [], input.inputmask.events[eventName].push(ev),
|
|
input.inputmask.events[eventName] = input.inputmask.events[eventName] || [], input.inputmask.events[eventName].push(ev),
|
|
|
- -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null != input.form && $(input.form).on(eventName, ev) : $(input).on(eventName, ev);
|
|
|
|
|
|
|
+ -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).on(eventName, ev) : $(input).on(eventName, ev);
|
|
|
},
|
|
},
|
|
|
off: function(input, event) {
|
|
off: function(input, event) {
|
|
|
if (input.inputmask && input.inputmask.events) {
|
|
if (input.inputmask && input.inputmask.events) {
|
|
@@ -864,7 +864,7 @@
|
|
|
$.each(events, function(eventName, evArr) {
|
|
$.each(events, function(eventName, evArr) {
|
|
|
for (;evArr.length > 0; ) {
|
|
for (;evArr.length > 0; ) {
|
|
|
var ev = evArr.pop();
|
|
var ev = evArr.pop();
|
|
|
- -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null != input.form && $(input.form).off(eventName, ev) : $(input).off(eventName, ev);
|
|
|
|
|
|
|
+ -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).off(eventName, ev) : $(input).off(eventName, ev);
|
|
|
}
|
|
}
|
|
|
delete input.inputmask.events[eventName];
|
|
delete input.inputmask.events[eventName];
|
|
|
});
|
|
});
|
|
@@ -1479,7 +1479,7 @@
|
|
|
function insertTestDefinition(mtoken, element, position) {
|
|
function insertTestDefinition(mtoken, element, position) {
|
|
|
position = position !== undefined ? position : mtoken.matches.length;
|
|
position = position !== undefined ? position : mtoken.matches.length;
|
|
|
var prevMatch = mtoken.matches[position - 1];
|
|
var prevMatch = mtoken.matches[position - 1];
|
|
|
- if (regexMask) 0 === element.indexOf("[") || escaped || "." === element ? mtoken.matches.splice(position++, 0, {
|
|
|
|
|
|
|
+ if (regexMask) 0 === element.indexOf("[") || escaped && /\\d|\\s|\\w]/i.test(element) || "." === element ? mtoken.matches.splice(position++, 0, {
|
|
|
fn: new RegExp(element, opts.casing ? "i" : ""),
|
|
fn: new RegExp(element, opts.casing ? "i" : ""),
|
|
|
cardinality: 1,
|
|
cardinality: 1,
|
|
|
optionality: mtoken.isOptional,
|
|
optionality: mtoken.isOptional,
|
|
@@ -1488,7 +1488,7 @@
|
|
|
def: element,
|
|
def: element,
|
|
|
placeholder: undefined,
|
|
placeholder: undefined,
|
|
|
nativeDef: element
|
|
nativeDef: element
|
|
|
- }) : $.each(element.split(""), function(ndx, lmnt) {
|
|
|
|
|
|
|
+ }) : (escaped && (element = element[element.length - 1]), $.each(element.split(""), function(ndx, lmnt) {
|
|
|
prevMatch = mtoken.matches[position - 1], mtoken.matches.splice(position++, 0, {
|
|
prevMatch = mtoken.matches[position - 1], mtoken.matches.splice(position++, 0, {
|
|
|
fn: null,
|
|
fn: null,
|
|
|
cardinality: 0,
|
|
cardinality: 0,
|
|
@@ -1499,7 +1499,7 @@
|
|
|
placeholder: opts.staticDefinitionSymbol !== undefined ? lmnt : undefined,
|
|
placeholder: opts.staticDefinitionSymbol !== undefined ? lmnt : undefined,
|
|
|
nativeDef: lmnt
|
|
nativeDef: lmnt
|
|
|
});
|
|
});
|
|
|
- }), escaped = !1; else {
|
|
|
|
|
|
|
+ })), escaped = !1; else {
|
|
|
var maskdef = (opts.definitions ? opts.definitions[element] : undefined) || Inputmask.prototype.definitions[element];
|
|
var maskdef = (opts.definitions ? opts.definitions[element] : undefined) || Inputmask.prototype.definitions[element];
|
|
|
if (maskdef && !escaped) {
|
|
if (maskdef && !escaped) {
|
|
|
for (var prevalidators = maskdef.prevalidator, prevalidatorsL = prevalidators ? prevalidators.length : 0, i = 1; i < maskdef.cardinality; i++) {
|
|
for (var prevalidators = maskdef.prevalidator, prevalidatorsL = prevalidators ? prevalidators.length : 0, i = 1; i < maskdef.cardinality; i++) {
|
|
@@ -1577,7 +1577,7 @@
|
|
|
}
|
|
}
|
|
|
var match, m, openingToken, currentOpeningToken, alternator, lastMatch, groupToken, tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g, regexTokenizer = /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g, escaped = !1, currentToken = new MaskToken(), openenings = [], maskTokens = [];
|
|
var match, m, openingToken, currentOpeningToken, alternator, lastMatch, groupToken, tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g, regexTokenizer = /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g, escaped = !1, currentToken = new MaskToken(), openenings = [], maskTokens = [];
|
|
|
for (regexMask && (opts.optionalmarker.start = undefined, opts.optionalmarker.end = undefined); match = regexMask ? regexTokenizer.exec(mask) : tokenizer.exec(mask); ) {
|
|
for (regexMask && (opts.optionalmarker.start = undefined, opts.optionalmarker.end = undefined); match = regexMask ? regexTokenizer.exec(mask) : tokenizer.exec(mask); ) {
|
|
|
- if (m = match[0], regexMask && !0 !== escaped) switch (m.charAt(0)) {
|
|
|
|
|
|
|
+ if (m = match[0], regexMask) switch (m.charAt(0)) {
|
|
|
case "?":
|
|
case "?":
|
|
|
m = "{0,1}";
|
|
m = "{0,1}";
|
|
|
break;
|
|
break;
|
|
@@ -2346,7 +2346,7 @@
|
|
|
unmaskAsNumber: !1,
|
|
unmaskAsNumber: !1,
|
|
|
inputmode: "numeric",
|
|
inputmode: "numeric",
|
|
|
preValidation: function(buffer, pos, c, isSelection, opts) {
|
|
preValidation: function(buffer, pos, c, isSelection, opts) {
|
|
|
- if ("-" === c || c == opts.negationSymbol.front) return !0 === opts.allowMinus && (opts.isNegative = opts.isNegative === undefined || !opts.isNegative,
|
|
|
|
|
|
|
+ if ("-" === c || c === opts.negationSymbol.front) return !0 === opts.allowMinus && (opts.isNegative = opts.isNegative === undefined || !opts.isNegative,
|
|
|
"" === buffer.join("") || {
|
|
"" === buffer.join("") || {
|
|
|
caret: pos,
|
|
caret: pos,
|
|
|
dopost: !0
|
|
dopost: !0
|
|
@@ -2361,12 +2361,12 @@
|
|
|
},
|
|
},
|
|
|
postValidation: function(buffer, currentResult, opts) {
|
|
postValidation: function(buffer, currentResult, opts) {
|
|
|
var suffix = opts.suffix.split(""), prefix = opts.prefix.split("");
|
|
var suffix = opts.suffix.split(""), prefix = opts.prefix.split("");
|
|
|
- if (currentResult.pos == undefined && currentResult.caret !== undefined && !0 !== currentResult.dopost) return currentResult;
|
|
|
|
|
- var caretPos = currentResult.caret != undefined ? currentResult.caret : currentResult.pos, maskedValue = buffer.slice();
|
|
|
|
|
|
|
+ if (currentResult.pos === undefined && currentResult.caret !== undefined && !0 !== currentResult.dopost) return currentResult;
|
|
|
|
|
+ var caretPos = currentResult.caret !== undefined ? currentResult.caret : currentResult.pos, maskedValue = buffer.slice();
|
|
|
opts.numericInput && (caretPos = maskedValue.length - caretPos - 1, maskedValue = maskedValue.reverse());
|
|
opts.numericInput && (caretPos = maskedValue.length - caretPos - 1, maskedValue = maskedValue.reverse());
|
|
|
var charAtPos = maskedValue[caretPos];
|
|
var charAtPos = maskedValue[caretPos];
|
|
|
if (charAtPos === opts.groupSeparator && (caretPos += 1, charAtPos = maskedValue[caretPos]),
|
|
if (charAtPos === opts.groupSeparator && (caretPos += 1, charAtPos = maskedValue[caretPos]),
|
|
|
- caretPos == maskedValue.length - opts.suffix.length - 1 && charAtPos === opts.radixPoint) return currentResult;
|
|
|
|
|
|
|
+ caretPos === maskedValue.length - opts.suffix.length - 1 && charAtPos === opts.radixPoint) return currentResult;
|
|
|
charAtPos !== undefined && charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back && (maskedValue[caretPos] = "?",
|
|
charAtPos !== undefined && charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back && (maskedValue[caretPos] = "?",
|
|
|
opts.prefix.length > 0 && caretPos >= (!1 === opts.isNegative ? 1 : 0) && caretPos < opts.prefix.length - 1 + (!1 === opts.isNegative ? 1 : 0) ? prefix[caretPos - (!1 === opts.isNegative ? 1 : 0)] = "?" : opts.suffix.length > 0 && caretPos >= maskedValue.length - opts.suffix.length - (!1 === opts.isNegative ? 1 : 0) && (suffix[caretPos - (maskedValue.length - opts.suffix.length - (!1 === opts.isNegative ? 1 : 0))] = "?")),
|
|
opts.prefix.length > 0 && caretPos >= (!1 === opts.isNegative ? 1 : 0) && caretPos < opts.prefix.length - 1 + (!1 === opts.isNegative ? 1 : 0) ? prefix[caretPos - (!1 === opts.isNegative ? 1 : 0)] = "?" : opts.suffix.length > 0 && caretPos >= maskedValue.length - opts.suffix.length - (!1 === opts.isNegative ? 1 : 0) && (suffix[caretPos - (maskedValue.length - opts.suffix.length - (!1 === opts.isNegative ? 1 : 0))] = "?")),
|
|
|
prefix = prefix.join(""), suffix = suffix.join("");
|
|
prefix = prefix.join(""), suffix = suffix.join("");
|
|
@@ -2375,7 +2375,7 @@
|
|
|
processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""),
|
|
processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""),
|
|
|
processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
|
|
processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
|
|
|
isNaN(opts.placeholder) && (processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.placeholder), "g"), "")),
|
|
isNaN(opts.placeholder) && (processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.placeholder), "g"), "")),
|
|
|
- processValue.length > 1 && 1 !== processValue.indexOf(opts.radixPoint) && ("0" == charAtPos && (processValue = processValue.replace(/^\?/g, "")),
|
|
|
|
|
|
|
+ processValue.length > 1 && 1 !== processValue.indexOf(opts.radixPoint) && ("0" === charAtPos && (processValue = processValue.replace(/^\?/g, "")),
|
|
|
processValue = processValue.replace(/^0/g, "")), processValue.charAt(0) === opts.radixPoint && "" !== opts.radixPoint && !0 !== opts.numericInput && (processValue = "0" + processValue),
|
|
processValue = processValue.replace(/^0/g, "")), processValue.charAt(0) === opts.radixPoint && "" !== opts.radixPoint && !0 !== opts.numericInput && (processValue = "0" + processValue),
|
|
|
"" !== processValue) {
|
|
"" !== processValue) {
|
|
|
if (processValue = processValue.split(""), (!opts.digitsOptional || opts.enforceDigitsOnBlur && "blur" === currentResult.event) && isFinite(opts.digits)) {
|
|
if (processValue = processValue.split(""), (!opts.digitsOptional || opts.enforceDigitsOnBlur && "blur" === currentResult.event) && isFinite(opts.digits)) {
|
|
@@ -2561,7 +2561,7 @@
|
|
|
var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
|
|
var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
|
|
|
if (dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
|
|
if (dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
|
|
|
initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""),
|
|
initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""),
|
|
|
- initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue = initialValue.replace(/,/g, "") : initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
|
|
|
|
|
|
+ initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue.replace(/,/g, "") : initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
|
|
0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))),
|
|
0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))),
|
|
|
"" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) {
|
|
"" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) {
|
|
|
var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0];
|
|
var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0];
|
|
@@ -2576,7 +2576,7 @@
|
|
|
},
|
|
},
|
|
|
canClearPosition: function(maskset, position, lvp, strict, opts) {
|
|
canClearPosition: function(maskset, position, lvp, strict, opts) {
|
|
|
var vp = maskset.validPositions[position], canClear = vp.input !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && !1 === opts.decimalProtect || vp.input === opts.radixPoint && maskset.validPositions[position + 1] && null === maskset.validPositions[position + 1].match.fn || isFinite(vp.input) || position === lvp || vp.input === opts.groupSeparator || vp.input === opts.negationSymbol.front || vp.input === opts.negationSymbol.back;
|
|
var vp = maskset.validPositions[position], canClear = vp.input !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && !1 === opts.decimalProtect || vp.input === opts.radixPoint && maskset.validPositions[position + 1] && null === maskset.validPositions[position + 1].match.fn || isFinite(vp.input) || position === lvp || vp.input === opts.groupSeparator || vp.input === opts.negationSymbol.front || vp.input === opts.negationSymbol.back;
|
|
|
- return !canClear || "+" != vp.match.nativeDef && "-" != vp.match.nativeDef || (opts.isNegative = !1),
|
|
|
|
|
|
|
+ return !canClear || "+" !== vp.match.nativeDef && "-" !== vp.match.nativeDef || (opts.isNegative = !1),
|
|
|
canClear;
|
|
canClear;
|
|
|
},
|
|
},
|
|
|
onKeyDown: function(e, buffer, caretPos, opts) {
|
|
onKeyDown: function(e, buffer, caretPos, opts) {
|