|
@@ -3,7 +3,7 @@
|
|
|
* https://github.com/RobinHerbots/Inputmask
|
|
* https://github.com/RobinHerbots/Inputmask
|
|
|
* Copyright (c) 2010 - 2018 Robin Herbots
|
|
* Copyright (c) 2010 - 2018 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-beta.24
|
|
|
|
|
|
|
+* Version: 4.0.1-beta.25
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
!function(factory) {
|
|
!function(factory) {
|
|
@@ -25,7 +25,7 @@
|
|
|
opts.integerDigits = parseInt(opts.integerDigits) + (0 === mod ? seps - 1 : seps),
|
|
opts.integerDigits = parseInt(opts.integerDigits) + (0 === mod ? seps - 1 : seps),
|
|
|
opts.integerDigits < 1 && (opts.integerDigits = "*");
|
|
opts.integerDigits < 1 && (opts.integerDigits = "*");
|
|
|
}
|
|
}
|
|
|
- opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)),
|
|
|
|
|
|
|
+ 1 < opts.placeholder.length && (opts.placeholder = opts.placeholder.charAt(0)),
|
|
|
"radixFocus" === opts.positionCaretOnClick && "" === opts.placeholder && !1 === opts.integerOptional && (opts.positionCaretOnClick = "lvp"),
|
|
"radixFocus" === opts.positionCaretOnClick && "" === opts.placeholder && !1 === opts.integerOptional && (opts.positionCaretOnClick = "lvp"),
|
|
|
opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~",
|
|
opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~",
|
|
|
!0 === opts.numericInput && (opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick,
|
|
!0 === opts.numericInput && (opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick,
|
|
@@ -34,7 +34,7 @@
|
|
|
if (mask += autoEscape(opts.prefix, opts), !0 === opts.integerOptional ? mask += "~{1," + opts.integerDigits + "}" : mask += "~{" + opts.integerDigits + "}",
|
|
if (mask += autoEscape(opts.prefix, opts), !0 === opts.integerOptional ? mask += "~{1," + opts.integerDigits + "}" : mask += "~{" + opts.integerDigits + "}",
|
|
|
opts.digits !== undefined) {
|
|
opts.digits !== undefined) {
|
|
|
var radixDef = opts.decimalProtect ? ":" : opts.radixPoint, dq = opts.digits.toString().split(",");
|
|
var radixDef = opts.decimalProtect ? ":" : opts.radixPoint, dq = opts.digits.toString().split(",");
|
|
|
- isFinite(dq[0]) && dq[1] && isFinite(dq[1]) ? mask += radixDef + ";{" + opts.digits + "}" : (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (opts.digitsOptional ? mask += "[" + radixDef + ";{1," + opts.digits + "}]" : mask += radixDef + ";{" + opts.digits + "}");
|
|
|
|
|
|
|
+ isFinite(dq[0]) && dq[1] && isFinite(dq[1]) ? mask += radixDef + ";{" + opts.digits + "}" : (isNaN(opts.digits) || 0 < parseInt(opts.digits)) && (opts.digitsOptional ? mask += "[" + radixDef + ";{1," + opts.digits + "}]" : mask += radixDef + ";{" + opts.digits + "}");
|
|
|
}
|
|
}
|
|
|
return mask += autoEscape(opts.suffix, opts), mask += "[-]", opts.greedy = !1, mask;
|
|
return mask += autoEscape(opts.suffix, opts), mask += "[-]", opts.greedy = !1, mask;
|
|
|
},
|
|
},
|
|
@@ -72,7 +72,7 @@
|
|
|
caret: maskset.validPositions[pos] ? pos : undefined,
|
|
caret: maskset.validPositions[pos] ? pos : undefined,
|
|
|
dopost: !0
|
|
dopost: !0
|
|
|
});
|
|
});
|
|
|
- if (!1 === isSelection && c === opts.radixPoint && opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) {
|
|
|
|
|
|
|
+ if (!1 === isSelection && c === opts.radixPoint && opts.digits !== undefined && (isNaN(opts.digits) || 0 < parseInt(opts.digits))) {
|
|
|
var radixPos = $.inArray(opts.radixPoint, buffer);
|
|
var radixPos = $.inArray(opts.radixPoint, buffer);
|
|
|
if (-1 !== radixPos && maskset.validPositions[radixPos] !== undefined) return !0 === opts.numericInput ? pos === radixPos : {
|
|
if (-1 !== radixPos && maskset.validPositions[radixPos] !== undefined) return !0 === opts.numericInput ? pos === radixPos : {
|
|
|
caret: radixPos + 1
|
|
caret: radixPos + 1
|
|
@@ -89,12 +89,12 @@
|
|
|
if (charAtPos === opts.groupSeparator && (charAtPos = maskedValue[caretPos += 1]),
|
|
if (charAtPos === opts.groupSeparator && (charAtPos = maskedValue[caretPos += 1]),
|
|
|
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))] = "?")),
|
|
|
|
|
|
|
+ 0 < opts.prefix.length && caretPos >= (!1 === opts.isNegative ? 1 : 0) && caretPos < opts.prefix.length - 1 + (!1 === opts.isNegative ? 1 : 0) ? prefix[caretPos - (!1 === opts.isNegative ? 1 : 0)] = "?" : 0 < opts.suffix.length && 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("");
|
|
|
var processValue = maskedValue.join("").replace(prefix, "");
|
|
var processValue = maskedValue.join("").replace(prefix, "");
|
|
|
if (processValue = (processValue = (processValue = (processValue = processValue.replace(suffix, "")).replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "")).replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), "")).replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
|
|
if (processValue = (processValue = (processValue = (processValue = processValue.replace(suffix, "")).replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "")).replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), "")).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, "")),
|
|
|
|
|
|
|
+ 1 < processValue.length && 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)) {
|
|
@@ -127,7 +127,7 @@
|
|
|
if (opts.isNegative && "blur" === currentResult.event && (opts.isNegative = "0" !== processValue),
|
|
if (opts.isNegative && "blur" === currentResult.event && (opts.isNegative = "0" !== processValue),
|
|
|
processValue = prefix + processValue, processValue += suffix, opts.isNegative && (processValue = opts.negationSymbol.front + processValue,
|
|
processValue = prefix + processValue, processValue += suffix, opts.isNegative && (processValue = opts.negationSymbol.front + processValue,
|
|
|
processValue += opts.negationSymbol.back), processValue = processValue.split(""),
|
|
processValue += opts.negationSymbol.back), processValue = processValue.split(""),
|
|
|
- charAtPos !== undefined) if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) (caretPos = $.inArray("?", processValue)) > -1 ? processValue[caretPos] = charAtPos : caretPos = currentResult.caret || 0; else if (charAtPos === opts.radixPoint || charAtPos === opts.negationSymbol.front || charAtPos === opts.negationSymbol.back) {
|
|
|
|
|
|
|
+ charAtPos !== undefined) if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) -1 < (caretPos = $.inArray("?", processValue)) ? processValue[caretPos] = charAtPos : caretPos = currentResult.caret || 0; else if (charAtPos === opts.radixPoint || charAtPos === opts.negationSymbol.front || charAtPos === opts.negationSymbol.back) {
|
|
|
var newCaretPos = $.inArray(charAtPos, processValue);
|
|
var newCaretPos = $.inArray(charAtPos, processValue);
|
|
|
-1 !== newCaretPos && (caretPos = newCaretPos);
|
|
-1 !== newCaretPos && (caretPos = newCaretPos);
|
|
|
}
|
|
}
|
|
@@ -212,7 +212,7 @@
|
|
|
if (!0 === (isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs))) {
|
|
if (!0 === (isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs))) {
|
|
|
if (!0 !== opts.numericInput && maskset.validPositions[pos] !== undefined && "~" === maskset.validPositions[pos].match.def && !isSelection) {
|
|
if (!0 !== opts.numericInput && maskset.validPositions[pos] !== undefined && "~" === maskset.validPositions[pos].match.def && !isSelection) {
|
|
|
var processValue = maskset.buffer.join(""), pvRadixSplit = (processValue = (processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), "")).replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "")).split(opts.radixPoint);
|
|
var processValue = maskset.buffer.join(""), pvRadixSplit = (processValue = (processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), "")).replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "")).split(opts.radixPoint);
|
|
|
- pvRadixSplit.length > 1 && (pvRadixSplit[1] = pvRadixSplit[1].replace(/0/g, opts.placeholder.charAt(0))),
|
|
|
|
|
|
|
+ 1 < pvRadixSplit.length && (pvRadixSplit[1] = pvRadixSplit[1].replace(/0/g, opts.placeholder.charAt(0))),
|
|
|
"0" === pvRadixSplit[0] && (pvRadixSplit[0] = pvRadixSplit[0].replace(/0/g, opts.placeholder.charAt(0))),
|
|
"0" === pvRadixSplit[0] && (pvRadixSplit[0] = pvRadixSplit[0].replace(/0/g, opts.placeholder.charAt(0))),
|
|
|
processValue = pvRadixSplit[0] + opts.radixPoint + pvRadixSplit[1] || "";
|
|
processValue = pvRadixSplit[0] + opts.radixPoint + pvRadixSplit[1] || "";
|
|
|
var bufferTemplate = maskset._buffer.join("");
|
|
var bufferTemplate = maskset._buffer.join("");
|