|
@@ -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.0-77
|
|
|
|
|
|
|
+* Version: 4.0.0-78
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
!function(factory) {
|
|
!function(factory) {
|
|
@@ -154,15 +154,29 @@
|
|
|
}
|
|
}
|
|
|
return targetAlternation !== undefined ? resolveNdxInitializer(pos, alternateNdx) : undefined;
|
|
return targetAlternation !== undefined ? resolveNdxInitializer(pos, alternateNdx) : undefined;
|
|
|
}
|
|
}
|
|
|
|
|
+ function isSubsetOf(source, target) {
|
|
|
|
|
+ if (opts.regex && null !== source.match.fn && null !== target.match.fn) {
|
|
|
|
|
+ var src = source.match.def.replace(/[\[\]]/g, "");
|
|
|
|
|
+ return -1 !== target.match.def.replace(/[\[\]]/g, "").indexOf(src);
|
|
|
|
|
+ }
|
|
|
|
|
+ return source.match.def === target.match.nativeDef;
|
|
|
|
|
+ }
|
|
|
function setMergeLocators(targetMatch, altMatch) {
|
|
function setMergeLocators(targetMatch, altMatch) {
|
|
|
- targetMatch.mloc = targetMatch.mloc || {};
|
|
|
|
|
- var locNdx = targetMatch.locator[targetMatch.alternation];
|
|
|
|
|
- if ("string" == typeof locNdx && (locNdx = locNdx.split(",")[0]), targetMatch.mloc[locNdx] === undefined && (targetMatch.mloc[locNdx] = targetMatch.locator.slice()),
|
|
|
|
|
- altMatch !== undefined) {
|
|
|
|
|
- for (var ndx in altMatch.mloc) "string" == typeof ndx && (ndx = ndx.split(",")[0]),
|
|
|
|
|
- targetMatch.mloc[ndx] === undefined && (targetMatch.mloc[ndx] = altMatch.mloc[ndx]);
|
|
|
|
|
- targetMatch.locator[targetMatch.alternation] = Object.keys(targetMatch.mloc).join(",");
|
|
|
|
|
|
|
+ if (altMatch === undefined || targetMatch.alternation === altMatch.alternation && -1 === targetMatch.locator[targetMatch.alternation].toString().indexOf(altMatch.locator[altMatch.alternation])) {
|
|
|
|
|
+ targetMatch.mloc = targetMatch.mloc || {};
|
|
|
|
|
+ var locNdx = targetMatch.locator[targetMatch.alternation];
|
|
|
|
|
+ if (locNdx !== undefined) {
|
|
|
|
|
+ if ("string" == typeof locNdx && (locNdx = locNdx.split(",")[0]), targetMatch.mloc[locNdx] === undefined && (targetMatch.mloc[locNdx] = targetMatch.locator.slice()),
|
|
|
|
|
+ altMatch !== undefined) {
|
|
|
|
|
+ for (var ndx in altMatch.mloc) "string" == typeof ndx && (ndx = ndx.split(",")[0]),
|
|
|
|
|
+ targetMatch.mloc[ndx] === undefined && (targetMatch.mloc[ndx] = altMatch.mloc[ndx]);
|
|
|
|
|
+ targetMatch.locator[targetMatch.alternation] = Object.keys(targetMatch.mloc).join(",");
|
|
|
|
|
+ }
|
|
|
|
|
+ return !0;
|
|
|
|
|
+ }
|
|
|
|
|
+ targetMatch.alternation = undefined;
|
|
|
}
|
|
}
|
|
|
|
|
+ return !1;
|
|
|
}
|
|
}
|
|
|
if (testPos > 1e4) throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask;
|
|
if (testPos > 1e4) throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask;
|
|
|
if (testPos === pos && match.matches === undefined) return matches.push({
|
|
if (testPos === pos && match.matches === undefined) return matches.push({
|
|
@@ -187,34 +201,32 @@
|
|
|
if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0; amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx);
|
|
if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0; amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx);
|
|
|
for (var ndx = 0; ndx < altIndexArr.length; ndx++) {
|
|
for (var ndx = 0; ndx < altIndexArr.length; ndx++) {
|
|
|
amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice(),
|
|
amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice(),
|
|
|
- match = handleMatch(alternateToken.matches[amndx] || maskToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) || match,
|
|
|
|
|
|
|
+ alternateToken.matches[amndx] && handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) ? match = !0 : maskToken.matches[amndx] && alternateToken !== maskToken.matches[amndx] && handleMatch(maskToken.matches[amndx], [ amndx ].concat(loopNdx.slice(1)), quantifierRecurse) && (match = !0),
|
|
|
maltMatches = matches.slice(), testPos = currentPos, matches = [];
|
|
maltMatches = matches.slice(), testPos = currentPos, matches = [];
|
|
|
for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
|
|
for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
|
|
|
var altMatch = maltMatches[ndx1], dropMatch = !1;
|
|
var altMatch = maltMatches[ndx1], dropMatch = !1;
|
|
|
altMatch.alternation = altMatch.alternation || loopNdxCnt, setMergeLocators(altMatch);
|
|
altMatch.alternation = altMatch.alternation || loopNdxCnt, setMergeLocators(altMatch);
|
|
|
for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
|
|
for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
|
|
|
var altMatch2 = malternateMatches[ndx2];
|
|
var altMatch2 = malternateMatches[ndx2];
|
|
|
- if ("string" != typeof altIndex || -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) {
|
|
|
|
|
- var ss;
|
|
|
|
|
- if (function(source, target) {
|
|
|
|
|
- return source.match.nativeDef === target.match.nativeDef || source.match.def === target.match.nativeDef || source.match.nativeDef === target.match.def;
|
|
|
|
|
- }(altMatch, altMatch2) || (ss = function(source, target) {
|
|
|
|
|
- return opts.regex !== undefined && null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1);
|
|
|
|
|
- }(altMatch, altMatch2))) {
|
|
|
|
|
- dropMatch = !0, altMatch.alternation === altMatch2.alternation && -1 === altMatch2.locator[altMatch2.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) && setMergeLocators(altMatch2, altMatch),
|
|
|
|
|
- altMatch.match.nativeDef === altMatch2.match.nativeDef || altMatch.match.nativeDef !== altMatch2.match.def && !ss || (dropMatch = !1);
|
|
|
|
|
|
|
+ if ("string" != typeof altIndex || altMatch.alternation !== undefined && -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) {
|
|
|
|
|
+ if (altMatch.match.nativeDef === altMatch2.match.nativeDef) {
|
|
|
|
|
+ dropMatch = !0, setMergeLocators(altMatch2, altMatch);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isSubsetOf(altMatch, altMatch2)) {
|
|
|
|
|
+ setMergeLocators(altMatch, altMatch2), dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- if (altMatch.match.def === altMatch2.match.def) {
|
|
|
|
|
- dropMatch = !1;
|
|
|
|
|
|
|
+ if (isSubsetOf(altMatch2, altMatch)) {
|
|
|
|
|
+ setMergeLocators(altMatch2, altMatch);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
if (function(source, target) {
|
|
if (function(source, target) {
|
|
|
return null === source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def, getMaskSet(), pos, !1, opts, !1);
|
|
return null === source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def, 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(),
|
|
|
|
|
|
|
+ setMergeLocators(altMatch, altMatch2) && (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, setMergeLocators(altMatch, altMatch2), malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
|
|
|
|
|
|
|
+ dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|