|
|
@@ -3,7 +3,7 @@
|
|
|
* https://github.com/RobinHerbots/Inputmask
|
|
|
* Copyright (c) 2010 - 2018 Robin Herbots
|
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-* Version: 4.0.0-beta.33
|
|
|
+* Version: 4.0.0-beta.34
|
|
|
*/
|
|
|
|
|
|
!function(modules) {
|
|
|
@@ -115,14 +115,14 @@
|
|
|
function maskScope(actionObj, maskset, opts) {
|
|
|
maskset = maskset || this.maskset, opts = opts || this.opts;
|
|
|
var undoValue, $el, maxLength, colorMask, inputmask = this, el = this.el, isRTL = this.isRTL, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !1, trackCaret = !1;
|
|
|
- function getMaskTemplate(baseOnInput, minimalPos, includeMode) {
|
|
|
+ function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit) {
|
|
|
minimalPos = minimalPos || 0;
|
|
|
var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0, lvp = getLastValidPosition();
|
|
|
do {
|
|
|
if (!0 === baseOnInput && getMaskSet().validPositions[pos]) test = (testPos = getMaskSet().validPositions[pos]).match,
|
|
|
ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder(pos, test)); else {
|
|
|
test = (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1)).match, ndxIntlzr = testPos.locator.slice();
|
|
|
- var jitMasking = !1 !== opts.jitMasking ? opts.jitMasking : test.jit;
|
|
|
+ var jitMasking = !0 !== noJit && (!1 !== opts.jitMasking ? opts.jitMasking : test.jit);
|
|
|
(!1 === jitMasking || jitMasking === undefined || pos < lvp || "number" == typeof jitMasking && isFinite(jitMasking) && jitMasking > pos) && maskTemplate.push(!1 === includeMode ? test.nativeDef : getPlaceholder(pos, test));
|
|
|
}
|
|
|
"auto" === opts.keepStatic && test.newBlockMarker && null !== test.fn && (opts.keepStatic = pos - 1),
|
|
|
@@ -837,7 +837,7 @@
|
|
|
var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, !0), lastPosition = seekNext(lvclickPosition);
|
|
|
if (clickPosition < lastPosition) caret(input, isMask(clickPosition, !0) || isMask(clickPosition - 1, !0) ? clickPosition : seekNext(clickPosition)); else {
|
|
|
var lvp = getMaskSet().validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : undefined, lvp), placeholder = getPlaceholder(lastPosition, tt.match);
|
|
|
- if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask(lastPosition, !0) && tt.match.def === placeholder) {
|
|
|
+ if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask(lastPosition, opts.keepStatic) && tt.match.def === placeholder) {
|
|
|
var newPos = seekNext(lastPosition);
|
|
|
(clickPosition >= newPos || clickPosition === lastPosition) && (lastPosition = newPos);
|
|
|
}
|
|
|
@@ -968,7 +968,7 @@
|
|
|
}
|
|
|
}
|
|
|
function determineLastRequiredPosition(returnDefinition) {
|
|
|
- var pos, testPos, buffer = getBuffer(), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = lvTest !== undefined ? lvTest.locator.slice() : undefined;
|
|
|
+ var pos, testPos, buffer = getMaskTemplate(!0, getLastValidPosition(), !0, !0), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = lvTest !== undefined ? lvTest.locator.slice() : undefined;
|
|
|
for (pos = lvp + 1; pos < buffer.length; pos++) ndxIntlzr = (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1)).locator.slice(),
|
|
|
positions[pos] = $.extend(!0, {}, testPos);
|
|
|
var lvTestAlt = lvTest && lvTest.alternation !== undefined ? lvTest.locator[lvTest.alternation] : undefined;
|
|
|
@@ -1825,16 +1825,12 @@
|
|
|
casing: "upper"
|
|
|
}
|
|
|
}), Inputmask.extendAliases({
|
|
|
+ cssunit: {
|
|
|
+ regex: "[+-]?[0-9]+.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)"
|
|
|
+ },
|
|
|
url: {
|
|
|
- definitions: {
|
|
|
- i: {
|
|
|
- validator: "."
|
|
|
- }
|
|
|
- },
|
|
|
- mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",
|
|
|
- insertMode: !1,
|
|
|
- autoUnmask: !1,
|
|
|
- inputmode: "url"
|
|
|
+ regex: "(https?|ftp)//.*",
|
|
|
+ autoUnmask: !1
|
|
|
},
|
|
|
ip: {
|
|
|
mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
|
|
|
@@ -2082,8 +2078,19 @@
|
|
|
definitions: {
|
|
|
"~": {
|
|
|
validator: function(chrs, maskset, pos, strict, opts, isSelection) {
|
|
|
- var isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs);
|
|
|
- if (!0 === isValid) {
|
|
|
+ var isValid;
|
|
|
+ if ("k" === chrs || "m" === chrs) {
|
|
|
+ isValid = {
|
|
|
+ insert: [],
|
|
|
+ c: 0
|
|
|
+ };
|
|
|
+ for (var i = 0, l = "k" === chrs ? 2 : 5; i < l; i++) isValid.insert.push({
|
|
|
+ pos: pos + i,
|
|
|
+ c: 0
|
|
|
+ });
|
|
|
+ return isValid.pos = pos + l, isValid;
|
|
|
+ }
|
|
|
+ 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) {
|
|
|
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))),
|
|
|
@@ -2148,8 +2155,8 @@
|
|
|
isComplete: function(buffer, opts) {
|
|
|
var maskedValue = buffer.join("");
|
|
|
if (buffer.slice().join("") !== maskedValue) return !1;
|
|
|
- var processValue = maskedValue.replace(opts.prefix, "");
|
|
|
- return processValue = (processValue = processValue.replace(opts.suffix, "")).replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator) + "([0-9]{3})", "g"), "$1"),
|
|
|
+ var processValue = maskedValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-");
|
|
|
+ return processValue = (processValue = (processValue = (processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "")).replace(opts.prefix, "")).replace(opts.suffix, "")).replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator) + "([0-9]{3})", "g"), "$1"),
|
|
|
"," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
|
|
|
isFinite(processValue);
|
|
|
},
|