formtastic-jquery_inputmask 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bowerrc +3 -0
- data/bower.json +19 -0
- data/lib/formtastic/jquery_inputmask/engine.rb +1 -1
- data/lib/formtastic/jquery_inputmask/version.rb +1 -1
- data/vendor/inputmask/.bower.json +59 -0
- data/vendor/inputmask/bower.json +40 -0
- data/vendor/inputmask/dist/inputmask/bindings/inputmask.binding.js +21 -0
- data/vendor/inputmask/dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js +62 -0
- data/vendor/inputmask/dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js +13 -0
- data/vendor/inputmask/dist/inputmask/dependencyLibs/inputmask.dependencyLib.js +133 -0
- data/vendor/inputmask/dist/inputmask/global/document.js +11 -0
- data/vendor/inputmask/dist/inputmask/global/window.js +11 -0
- data/vendor/inputmask/dist/inputmask/inputmask.date.extensions.js +490 -0
- data/vendor/inputmask/dist/inputmask/inputmask.extensions.js +97 -0
- data/vendor/inputmask/dist/inputmask/inputmask.js +1643 -0
- data/vendor/inputmask/dist/inputmask/inputmask.numeric.extensions.js +347 -0
- data/vendor/inputmask/dist/inputmask/inputmask.phone.extensions.js +61 -0
- data/vendor/inputmask/dist/inputmask/inputmask.regex.extensions.js +115 -0
- data/vendor/inputmask/dist/inputmask/jquery.inputmask.js +62 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone-be.js +244 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone-nl.js +924 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone-ru.js +19240 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone-uk.js +1009 -0
- data/vendor/inputmask/dist/inputmask/phone-codes/phone.js +2111 -0
- data/vendor/inputmask/dist/jquery.inputmask.bundle.js +3085 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.date.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.min.js +10 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.numeric.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.phone.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/inputmask.regex.extensions.min.js +9 -0
- data/vendor/inputmask/dist/min/inputmask/jquery.inputmask.min.js +9 -0
- data/vendor/inputmask/dist/min/jquery.inputmask.bundle.min.js +11 -0
- data/vendor/jquery/.bower.json +25 -0
- data/vendor/jquery/AUTHORS.txt +301 -0
- data/vendor/jquery/LICENSE.txt +36 -0
- data/vendor/jquery/README.md +67 -0
- data/vendor/jquery/bower.json +14 -0
- data/vendor/jquery/dist/core.js +476 -0
- data/vendor/jquery/dist/jquery.js +10253 -0
- data/vendor/jquery/dist/jquery.min.js +4 -0
- data/vendor/jquery/dist/jquery.min.map +1 -0
- data/vendor/jquery/dist/jquery.slim.js +8160 -0
- data/vendor/jquery/dist/jquery.slim.min.js +4 -0
- data/vendor/jquery/dist/jquery.slim.min.map +1 -0
- data/vendor/jquery/external/sizzle/LICENSE.txt +36 -0
- data/vendor/jquery/external/sizzle/dist/sizzle.js +2272 -0
- data/vendor/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/vendor/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/vendor/jquery/src/.eslintrc.json +5 -0
- data/vendor/jquery/src/ajax.js +855 -0
- data/vendor/jquery/src/ajax/jsonp.js +102 -0
- data/vendor/jquery/src/ajax/load.js +76 -0
- data/vendor/jquery/src/ajax/parseXML.js +30 -0
- data/vendor/jquery/src/ajax/script.js +77 -0
- data/vendor/jquery/src/ajax/var/location.js +5 -0
- data/vendor/jquery/src/ajax/var/nonce.js +7 -0
- data/vendor/jquery/src/ajax/var/rquery.js +5 -0
- data/vendor/jquery/src/ajax/xhr.js +169 -0
- data/vendor/jquery/src/attributes.js +13 -0
- data/vendor/jquery/src/attributes/attr.js +141 -0
- data/vendor/jquery/src/attributes/classes.js +174 -0
- data/vendor/jquery/src/attributes/prop.js +143 -0
- data/vendor/jquery/src/attributes/support.js +33 -0
- data/vendor/jquery/src/attributes/val.js +190 -0
- data/vendor/jquery/src/callbacks.js +234 -0
- data/vendor/jquery/src/core.js +476 -0
- data/vendor/jquery/src/core/DOMEval.js +16 -0
- data/vendor/jquery/src/core/access.js +70 -0
- data/vendor/jquery/src/core/init.js +128 -0
- data/vendor/jquery/src/core/nodeName.js +13 -0
- data/vendor/jquery/src/core/parseHTML.js +65 -0
- data/vendor/jquery/src/core/ready-no-deferred.js +96 -0
- data/vendor/jquery/src/core/ready.js +86 -0
- data/vendor/jquery/src/core/readyException.js +13 -0
- data/vendor/jquery/src/core/stripAndCollapse.js +14 -0
- data/vendor/jquery/src/core/support.js +20 -0
- data/vendor/jquery/src/core/var/rsingleTag.js +6 -0
- data/vendor/jquery/src/css.js +438 -0
- data/vendor/jquery/src/css/addGetHookIf.js +26 -0
- data/vendor/jquery/src/css/adjustCSS.js +71 -0
- data/vendor/jquery/src/css/curCSS.js +65 -0
- data/vendor/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/vendor/jquery/src/css/showHide.js +105 -0
- data/vendor/jquery/src/css/support.js +89 -0
- data/vendor/jquery/src/css/var/cssExpand.js +5 -0
- data/vendor/jquery/src/css/var/getStyles.js +17 -0
- data/vendor/jquery/src/css/var/isHiddenWithinTree.js +34 -0
- data/vendor/jquery/src/css/var/rmargin.js +5 -0
- data/vendor/jquery/src/css/var/rnumnonpx.js +7 -0
- data/vendor/jquery/src/css/var/swap.js +26 -0
- data/vendor/jquery/src/data.js +179 -0
- data/vendor/jquery/src/data/Data.js +161 -0
- data/vendor/jquery/src/data/var/acceptData.js +19 -0
- data/vendor/jquery/src/data/var/dataPriv.js +7 -0
- data/vendor/jquery/src/data/var/dataUser.js +7 -0
- data/vendor/jquery/src/deferred.js +391 -0
- data/vendor/jquery/src/deferred/exceptionHook.js +21 -0
- data/vendor/jquery/src/deprecated.js +40 -0
- data/vendor/jquery/src/dimensions.js +56 -0
- data/vendor/jquery/src/effects.js +699 -0
- data/vendor/jquery/src/effects/Tween.js +123 -0
- data/vendor/jquery/src/effects/animatedSelector.js +15 -0
- data/vendor/jquery/src/event.js +746 -0
- data/vendor/jquery/src/event/ajax.js +22 -0
- data/vendor/jquery/src/event/alias.js +29 -0
- data/vendor/jquery/src/event/focusin.js +55 -0
- data/vendor/jquery/src/event/support.js +11 -0
- data/vendor/jquery/src/event/trigger.js +185 -0
- data/vendor/jquery/src/exports/amd.js +26 -0
- data/vendor/jquery/src/exports/global.js +34 -0
- data/vendor/jquery/src/jquery.js +41 -0
- data/vendor/jquery/src/manipulation.js +488 -0
- data/vendor/jquery/src/manipulation/_evalUrl.js +23 -0
- data/vendor/jquery/src/manipulation/buildFragment.js +104 -0
- data/vendor/jquery/src/manipulation/getAll.js +32 -0
- data/vendor/jquery/src/manipulation/setGlobalEval.js +22 -0
- data/vendor/jquery/src/manipulation/support.js +35 -0
- data/vendor/jquery/src/manipulation/var/rcheckableType.js +5 -0
- data/vendor/jquery/src/manipulation/var/rscriptType.js +5 -0
- data/vendor/jquery/src/manipulation/var/rtagName.js +5 -0
- data/vendor/jquery/src/manipulation/wrapMap.js +29 -0
- data/vendor/jquery/src/offset.js +229 -0
- data/vendor/jquery/src/queue.js +145 -0
- data/vendor/jquery/src/queue/delay.js +24 -0
- data/vendor/jquery/src/selector-native.js +237 -0
- data/vendor/jquery/src/selector-sizzle.js +19 -0
- data/vendor/jquery/src/selector.js +3 -0
- data/vendor/jquery/src/serialize.js +130 -0
- data/vendor/jquery/src/traversing.js +191 -0
- data/vendor/jquery/src/traversing/findFilter.js +106 -0
- data/vendor/jquery/src/traversing/var/dir.js +22 -0
- data/vendor/jquery/src/traversing/var/rneedsContext.js +8 -0
- data/vendor/jquery/src/traversing/var/siblings.js +17 -0
- data/vendor/jquery/src/var/ObjectFunctionString.js +7 -0
- data/vendor/jquery/src/var/arr.js +5 -0
- data/vendor/jquery/src/var/class2type.js +6 -0
- data/vendor/jquery/src/var/concat.js +7 -0
- data/vendor/jquery/src/var/document.js +5 -0
- data/vendor/jquery/src/var/documentElement.js +7 -0
- data/vendor/jquery/src/var/fnToString.js +7 -0
- data/vendor/jquery/src/var/getProto.js +5 -0
- data/vendor/jquery/src/var/hasOwn.js +7 -0
- data/vendor/jquery/src/var/indexOf.js +7 -0
- data/vendor/jquery/src/var/pnum.js +5 -0
- data/vendor/jquery/src/var/push.js +7 -0
- data/vendor/jquery/src/var/rcssNum.js +9 -0
- data/vendor/jquery/src/var/rnothtmlwhite.js +8 -0
- data/vendor/jquery/src/var/slice.js +7 -0
- data/vendor/jquery/src/var/support.js +6 -0
- data/vendor/jquery/src/var/toString.js +7 -0
- data/vendor/jquery/src/wrap.js +77 -0
- metadata +152 -3
- data/.gitmodules +0 -3
@@ -0,0 +1,347 @@
|
|
1
|
+
/*!
|
2
|
+
* inputmask.numeric.extensions.js
|
3
|
+
* https://github.com/RobinHerbots/Inputmask
|
4
|
+
* Copyright (c) 2010 - 2017 Robin Herbots
|
5
|
+
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
6
|
+
* Version: 3.3.9
|
7
|
+
*/
|
8
|
+
|
9
|
+
!function(factory) {
|
10
|
+
"function" == typeof define && define.amd ? define([ "./dependencyLibs/inputmask.dependencyLib", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./dependencyLibs/inputmask.dependencyLib"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
|
11
|
+
}(function($, Inputmask, undefined) {
|
12
|
+
function autoEscape(txt, opts) {
|
13
|
+
for (var escapedTxt = "", i = 0; i < txt.length; i++) Inputmask.prototype.definitions[txt.charAt(i)] || opts.definitions[txt.charAt(i)] || opts.optionalmarker.start === txt.charAt(i) || opts.optionalmarker.end === txt.charAt(i) || opts.quantifiermarker.start === txt.charAt(i) || opts.quantifiermarker.end === txt.charAt(i) || opts.groupmarker.start === txt.charAt(i) || opts.groupmarker.end === txt.charAt(i) || opts.alternatormarker === txt.charAt(i) ? escapedTxt += "\\" + txt.charAt(i) : escapedTxt += txt.charAt(i);
|
14
|
+
return escapedTxt;
|
15
|
+
}
|
16
|
+
return Inputmask.extendAliases({
|
17
|
+
numeric: {
|
18
|
+
mask: function(opts) {
|
19
|
+
if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat),
|
20
|
+
opts.repeat = 0, opts.groupSeparator === opts.radixPoint && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""),
|
21
|
+
" " === opts.groupSeparator && (opts.skipOptionalPartCharacter = undefined), opts.autoGroup = opts.autoGroup && "" !== opts.groupSeparator,
|
22
|
+
opts.autoGroup && ("string" == typeof opts.groupSize && isFinite(opts.groupSize) && (opts.groupSize = parseInt(opts.groupSize)),
|
23
|
+
isFinite(opts.integerDigits))) {
|
24
|
+
var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize;
|
25
|
+
opts.integerDigits = parseInt(opts.integerDigits) + (0 === mod ? seps - 1 : seps),
|
26
|
+
opts.integerDigits < 1 && (opts.integerDigits = "*");
|
27
|
+
}
|
28
|
+
opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)),
|
29
|
+
"radixFocus" === opts.positionCaretOnClick && "" === opts.placeholder && !1 === opts.integerOptional && (opts.positionCaretOnClick = "lvp"),
|
30
|
+
opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~",
|
31
|
+
!0 === opts.numericInput && (opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick,
|
32
|
+
opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts.decimalProtect = !1);
|
33
|
+
var mask = "[+]";
|
34
|
+
if (mask += autoEscape(opts.prefix, opts), !0 === opts.integerOptional ? mask += "~{1," + opts.integerDigits + "}" : mask += "~{" + opts.integerDigits + "}",
|
35
|
+
opts.digits !== undefined) {
|
36
|
+
opts.radixPointDefinitionSymbol = opts.decimalProtect ? ":" : opts.radixPoint;
|
37
|
+
var dq = opts.digits.toString().split(",");
|
38
|
+
isFinite(dq[0] && dq[1] && isFinite(dq[1])) ? mask += opts.radixPointDefinitionSymbol + ";{" + opts.digits + "}" : (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (opts.digitsOptional ? mask += "[" + opts.radixPointDefinitionSymbol + ";{1," + opts.digits + "}]" : mask += opts.radixPointDefinitionSymbol + ";{" + opts.digits + "}");
|
39
|
+
}
|
40
|
+
return mask += autoEscape(opts.suffix, opts), mask += "[-]", opts.greedy = !1, mask;
|
41
|
+
},
|
42
|
+
placeholder: "",
|
43
|
+
greedy: !1,
|
44
|
+
digits: "*",
|
45
|
+
digitsOptional: !0,
|
46
|
+
enforceDigitsOnBlur: !1,
|
47
|
+
radixPoint: ".",
|
48
|
+
positionCaretOnClick: "radixFocus",
|
49
|
+
groupSize: 3,
|
50
|
+
groupSeparator: "",
|
51
|
+
autoGroup: !1,
|
52
|
+
allowMinus: !0,
|
53
|
+
negationSymbol: {
|
54
|
+
front: "-",
|
55
|
+
back: ""
|
56
|
+
},
|
57
|
+
integerDigits: "+",
|
58
|
+
integerOptional: !0,
|
59
|
+
prefix: "",
|
60
|
+
suffix: "",
|
61
|
+
rightAlign: !0,
|
62
|
+
decimalProtect: !0,
|
63
|
+
min: null,
|
64
|
+
max: null,
|
65
|
+
step: 1,
|
66
|
+
insertMode: !0,
|
67
|
+
autoUnmask: !1,
|
68
|
+
unmaskAsNumber: !1,
|
69
|
+
inputmode: "numeric",
|
70
|
+
preValidation: function(buffer, pos, c, isSelection, opts) {
|
71
|
+
if ("-" === c || c === opts.negationSymbol.front) return !0 === opts.allowMinus && (opts.isNegative = opts.isNegative === undefined || !opts.isNegative,
|
72
|
+
"" === buffer.join("") || {
|
73
|
+
caret: pos,
|
74
|
+
dopost: !0
|
75
|
+
});
|
76
|
+
if (!1 === isSelection && c === opts.radixPoint && opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) {
|
77
|
+
var radixPos = $.inArray(opts.radixPoint, buffer);
|
78
|
+
if (-1 !== radixPos) return !0 === opts.numericInput ? pos === radixPos : {
|
79
|
+
caret: radixPos + 1
|
80
|
+
};
|
81
|
+
}
|
82
|
+
return !0;
|
83
|
+
},
|
84
|
+
postValidation: function(buffer, currentResult, opts) {
|
85
|
+
var suffix = opts.suffix.split(""), prefix = opts.prefix.split("");
|
86
|
+
if (currentResult.pos === undefined && currentResult.caret !== undefined && !0 !== currentResult.dopost) return currentResult;
|
87
|
+
var caretPos = currentResult.caret !== undefined ? currentResult.caret : currentResult.pos, maskedValue = buffer.slice();
|
88
|
+
opts.numericInput && (caretPos = maskedValue.length - caretPos - 1, maskedValue = maskedValue.reverse());
|
89
|
+
var charAtPos = maskedValue[caretPos];
|
90
|
+
if (charAtPos === opts.groupSeparator && (caretPos += 1, charAtPos = maskedValue[caretPos]),
|
91
|
+
caretPos === maskedValue.length - opts.suffix.length - 1 && charAtPos === opts.radixPoint) return currentResult;
|
92
|
+
charAtPos !== undefined && charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back && (maskedValue[caretPos] = "?",
|
93
|
+
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))] = "?")),
|
94
|
+
prefix = prefix.join(""), suffix = suffix.join("");
|
95
|
+
var processValue = maskedValue.join("").replace(prefix, "");
|
96
|
+
if (processValue = processValue.replace(suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
97
|
+
processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""),
|
98
|
+
processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
|
99
|
+
isNaN(opts.placeholder) && (processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.placeholder), "g"), "")),
|
100
|
+
processValue.length > 1 && 1 !== processValue.indexOf(opts.radixPoint) && ("0" === charAtPos && (processValue = processValue.replace(/^\?/g, "")),
|
101
|
+
processValue = processValue.replace(/^0/g, "")), processValue.charAt(0) === opts.radixPoint && "" !== opts.radixPoint && !0 !== opts.numericInput && (processValue = "0" + processValue),
|
102
|
+
"" !== processValue) {
|
103
|
+
if (processValue = processValue.split(""), (!opts.digitsOptional || opts.enforceDigitsOnBlur && "blur" === currentResult.event) && isFinite(opts.digits)) {
|
104
|
+
var radixPosition = $.inArray(opts.radixPoint, processValue), rpb = $.inArray(opts.radixPoint, maskedValue);
|
105
|
+
-1 === radixPosition && (processValue.push(opts.radixPoint), radixPosition = processValue.length - 1);
|
106
|
+
for (var i = 1; i <= opts.digits; i++) opts.digitsOptional && (!opts.enforceDigitsOnBlur || "blur" !== currentResult.event) || processValue[radixPosition + i] !== undefined && processValue[radixPosition + i] !== opts.placeholder.charAt(0) ? -1 !== rpb && maskedValue[rpb + i] !== undefined && (processValue[radixPosition + i] = processValue[radixPosition + i] || maskedValue[rpb + i]) : processValue[radixPosition + i] = currentResult.placeholder || opts.placeholder.charAt(0);
|
107
|
+
}
|
108
|
+
if (!0 !== opts.autoGroup || "" === opts.groupSeparator || charAtPos === opts.radixPoint && currentResult.pos === undefined && !currentResult.dopost) processValue = processValue.join(""); else {
|
109
|
+
var addRadix = processValue[processValue.length - 1] === opts.radixPoint && currentResult.c === opts.radixPoint;
|
110
|
+
processValue = Inputmask(function(buffer, opts) {
|
111
|
+
var postMask = "";
|
112
|
+
if (postMask += "(" + opts.groupSeparator + "*{" + opts.groupSize + "}){*}", "" !== opts.radixPoint) {
|
113
|
+
var radixSplit = buffer.join("").split(opts.radixPoint);
|
114
|
+
radixSplit[1] && (postMask += opts.radixPoint + "*{" + radixSplit[1].match(/^\d*\??\d*/)[0].length + "}");
|
115
|
+
}
|
116
|
+
return postMask;
|
117
|
+
}(processValue, opts), {
|
118
|
+
numericInput: !0,
|
119
|
+
jitMasking: !0,
|
120
|
+
definitions: {
|
121
|
+
"*": {
|
122
|
+
validator: "[0-9?]",
|
123
|
+
cardinality: 1
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}).format(processValue.join("")), addRadix && (processValue += opts.radixPoint),
|
127
|
+
processValue.charAt(0) === opts.groupSeparator && processValue.substr(1);
|
128
|
+
}
|
129
|
+
}
|
130
|
+
if (opts.isNegative && "blur" === currentResult.event && (opts.isNegative = "0" !== processValue),
|
131
|
+
processValue = prefix + processValue, processValue += suffix, opts.isNegative && (processValue = opts.negationSymbol.front + processValue,
|
132
|
+
processValue += opts.negationSymbol.back), processValue = processValue.split(""),
|
133
|
+
charAtPos !== undefined) if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) caretPos = $.inArray("?", processValue),
|
134
|
+
caretPos > -1 ? processValue[caretPos] = charAtPos : caretPos = currentResult.caret || 0; else if (charAtPos === opts.radixPoint || charAtPos === opts.negationSymbol.front || charAtPos === opts.negationSymbol.back) {
|
135
|
+
var newCaretPos = $.inArray(charAtPos, processValue);
|
136
|
+
-1 !== newCaretPos && (caretPos = newCaretPos);
|
137
|
+
}
|
138
|
+
opts.numericInput && (caretPos = processValue.length - caretPos - 1, processValue = processValue.reverse());
|
139
|
+
var rslt = {
|
140
|
+
caret: charAtPos === undefined || currentResult.pos !== undefined ? caretPos + (opts.numericInput ? -1 : 1) : caretPos,
|
141
|
+
buffer: processValue,
|
142
|
+
refreshFromBuffer: currentResult.dopost || buffer.join("") !== processValue.join("")
|
143
|
+
};
|
144
|
+
return rslt.refreshFromBuffer ? rslt : currentResult;
|
145
|
+
},
|
146
|
+
onBeforeWrite: function(e, buffer, caretPos, opts) {
|
147
|
+
if (e) switch (e.type) {
|
148
|
+
case "keydown":
|
149
|
+
return opts.postValidation(buffer, {
|
150
|
+
caret: caretPos,
|
151
|
+
dopost: !0
|
152
|
+
}, opts);
|
153
|
+
|
154
|
+
case "blur":
|
155
|
+
case "checkval":
|
156
|
+
var unmasked;
|
157
|
+
if (function(opts) {
|
158
|
+
opts.parseMinMaxOptions === undefined && (null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
159
|
+
"," === opts.radixPoint && (opts.min = opts.min.replace(opts.radixPoint, ".")),
|
160
|
+
opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN, isNaN(opts.min) && (opts.min = Number.MIN_VALUE)),
|
161
|
+
null !== opts.max && (opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
162
|
+
"," === opts.radixPoint && (opts.max = opts.max.replace(opts.radixPoint, ".")),
|
163
|
+
opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN, isNaN(opts.max) && (opts.max = Number.MAX_VALUE)),
|
164
|
+
opts.parseMinMaxOptions = "done");
|
165
|
+
}(opts), null !== opts.min || null !== opts.max) {
|
166
|
+
if (unmasked = opts.onUnMask(buffer.join(""), undefined, $.extend({}, opts, {
|
167
|
+
unmaskAsNumber: !0
|
168
|
+
})), null !== opts.min && unmasked < opts.min) return opts.isNegative = opts.min < 0,
|
169
|
+
opts.postValidation(opts.min.toString().replace(".", opts.radixPoint).split(""), {
|
170
|
+
caret: caretPos,
|
171
|
+
dopost: !0,
|
172
|
+
placeholder: "0"
|
173
|
+
}, opts);
|
174
|
+
if (null !== opts.max && unmasked > opts.max) return opts.isNegative = opts.max < 0,
|
175
|
+
opts.postValidation(opts.max.toString().replace(".", opts.radixPoint).split(""), {
|
176
|
+
caret: caretPos,
|
177
|
+
dopost: !0,
|
178
|
+
placeholder: "0"
|
179
|
+
}, opts);
|
180
|
+
}
|
181
|
+
return opts.postValidation(buffer, {
|
182
|
+
caret: caretPos,
|
183
|
+
placeholder: "0",
|
184
|
+
event: "blur"
|
185
|
+
}, opts);
|
186
|
+
|
187
|
+
case "_checkval":
|
188
|
+
return {
|
189
|
+
caret: caretPos
|
190
|
+
};
|
191
|
+
}
|
192
|
+
},
|
193
|
+
regex: {
|
194
|
+
integerPart: function(opts, emptyCheck) {
|
195
|
+
return emptyCheck ? new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?") : new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+");
|
196
|
+
},
|
197
|
+
integerNPart: function(opts) {
|
198
|
+
return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + Inputmask.escapeRegex(opts.placeholder.charAt(0)) + "]+");
|
199
|
+
}
|
200
|
+
},
|
201
|
+
definitions: {
|
202
|
+
"~": {
|
203
|
+
validator: function(chrs, maskset, pos, strict, opts, isSelection) {
|
204
|
+
var isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs);
|
205
|
+
if (!0 === isValid) {
|
206
|
+
if (!0 !== opts.numericInput && maskset.validPositions[pos] !== undefined && "~" === maskset.validPositions[pos].match.def && !isSelection) {
|
207
|
+
var processValue = maskset.buffer.join("");
|
208
|
+
processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""),
|
209
|
+
processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "");
|
210
|
+
var pvRadixSplit = processValue.split(opts.radixPoint);
|
211
|
+
pvRadixSplit.length > 1 && (pvRadixSplit[1] = pvRadixSplit[1].replace(/0/g, opts.placeholder.charAt(0))),
|
212
|
+
"0" === pvRadixSplit[0] && (pvRadixSplit[0] = pvRadixSplit[0].replace(/0/g, opts.placeholder.charAt(0))),
|
213
|
+
processValue = pvRadixSplit[0] + opts.radixPoint + pvRadixSplit[1] || "";
|
214
|
+
var bufferTemplate = maskset._buffer.join("");
|
215
|
+
for (processValue === opts.radixPoint && (processValue = bufferTemplate); null === processValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1);
|
216
|
+
processValue = processValue.replace(bufferTemplate, ""), processValue = processValue.split(""),
|
217
|
+
isValid = processValue[pos] === undefined ? {
|
218
|
+
pos: pos,
|
219
|
+
remove: pos
|
220
|
+
} : {
|
221
|
+
pos: pos
|
222
|
+
};
|
223
|
+
}
|
224
|
+
} else strict || chrs !== opts.radixPoint || maskset.validPositions[pos - 1] !== undefined || (maskset.buffer[pos] = "0",
|
225
|
+
isValid = {
|
226
|
+
pos: pos + 1
|
227
|
+
});
|
228
|
+
return isValid;
|
229
|
+
},
|
230
|
+
cardinality: 1
|
231
|
+
},
|
232
|
+
"+": {
|
233
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
234
|
+
return opts.allowMinus && ("-" === chrs || chrs === opts.negationSymbol.front);
|
235
|
+
},
|
236
|
+
cardinality: 1,
|
237
|
+
placeholder: ""
|
238
|
+
},
|
239
|
+
"-": {
|
240
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
241
|
+
return opts.allowMinus && chrs === opts.negationSymbol.back;
|
242
|
+
},
|
243
|
+
cardinality: 1,
|
244
|
+
placeholder: ""
|
245
|
+
},
|
246
|
+
":": {
|
247
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
248
|
+
var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + "]", isValid = new RegExp(radix).test(chrs);
|
249
|
+
return isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint && (isValid = {
|
250
|
+
caret: pos + 1
|
251
|
+
}), isValid;
|
252
|
+
},
|
253
|
+
cardinality: 1,
|
254
|
+
placeholder: function(opts) {
|
255
|
+
return opts.radixPoint;
|
256
|
+
}
|
257
|
+
}
|
258
|
+
},
|
259
|
+
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
260
|
+
if ("" === unmaskedValue && !0 === opts.nullable) return unmaskedValue;
|
261
|
+
var processValue = maskedValue.replace(opts.prefix, "");
|
262
|
+
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
263
|
+
"" !== opts.placeholder.charAt(0) && (processValue = processValue.replace(new RegExp(opts.placeholder.charAt(0), "g"), "0")),
|
264
|
+
opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")),
|
265
|
+
processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"),
|
266
|
+
processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
|
267
|
+
Number(processValue)) : processValue;
|
268
|
+
},
|
269
|
+
isComplete: function(buffer, opts) {
|
270
|
+
var maskedValue = buffer.join("");
|
271
|
+
if (buffer.slice().join("") !== maskedValue) return !1;
|
272
|
+
var processValue = maskedValue.replace(opts.prefix, "");
|
273
|
+
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
274
|
+
"," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
|
275
|
+
isFinite(processValue);
|
276
|
+
},
|
277
|
+
onBeforeMask: function(initialValue, opts) {
|
278
|
+
if (opts.isNegative = undefined, initialValue = initialValue.toString().charAt(initialValue.length - 1) === opts.radixPoint ? initialValue.toString().substr(0, initialValue.length - 1) : initialValue.toString(),
|
279
|
+
"" !== opts.radixPoint && isFinite(initialValue)) {
|
280
|
+
var vs = initialValue.split("."), groupSize = "" !== opts.groupSeparator ? parseInt(opts.groupSize) : 0;
|
281
|
+
2 === vs.length && (vs[0].length > groupSize || vs[1].length > groupSize || vs[0].length <= groupSize && vs[1].length < groupSize) && (initialValue = initialValue.replace(".", opts.radixPoint));
|
282
|
+
}
|
283
|
+
var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
|
284
|
+
if (dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
|
285
|
+
initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""),
|
286
|
+
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"), ""),
|
287
|
+
0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))),
|
288
|
+
"" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) {
|
289
|
+
var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0];
|
290
|
+
if (parseInt(opts.digits) < decPart.toString().length) {
|
291
|
+
var digitsFactor = Math.pow(10, parseInt(opts.digits));
|
292
|
+
initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), "."),
|
293
|
+
initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor,
|
294
|
+
initialValue = initialValue.toString().replace(".", opts.radixPoint);
|
295
|
+
}
|
296
|
+
}
|
297
|
+
return initialValue;
|
298
|
+
},
|
299
|
+
canClearPosition: function(maskset, position, lvp, strict, opts) {
|
300
|
+
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;
|
301
|
+
return !canClear || "+" !== vp.match.nativeDef && "-" !== vp.match.nativeDef || (opts.isNegative = !1),
|
302
|
+
canClear;
|
303
|
+
},
|
304
|
+
onKeyDown: function(e, buffer, caretPos, opts) {
|
305
|
+
var $input = $(this);
|
306
|
+
if (e.ctrlKey) switch (e.keyCode) {
|
307
|
+
case Inputmask.keyCode.UP:
|
308
|
+
$input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)), $input.trigger("setvalue");
|
309
|
+
break;
|
310
|
+
|
311
|
+
case Inputmask.keyCode.DOWN:
|
312
|
+
$input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)), $input.trigger("setvalue");
|
313
|
+
}
|
314
|
+
}
|
315
|
+
},
|
316
|
+
currency: {
|
317
|
+
prefix: "$ ",
|
318
|
+
groupSeparator: ",",
|
319
|
+
alias: "numeric",
|
320
|
+
placeholder: "0",
|
321
|
+
autoGroup: !0,
|
322
|
+
digits: 2,
|
323
|
+
digitsOptional: !1,
|
324
|
+
clearMaskOnLostFocus: !1
|
325
|
+
},
|
326
|
+
decimal: {
|
327
|
+
alias: "numeric"
|
328
|
+
},
|
329
|
+
integer: {
|
330
|
+
alias: "numeric",
|
331
|
+
digits: 0,
|
332
|
+
radixPoint: ""
|
333
|
+
},
|
334
|
+
percentage: {
|
335
|
+
alias: "numeric",
|
336
|
+
digits: 2,
|
337
|
+
digitsOptional: !0,
|
338
|
+
radixPoint: ".",
|
339
|
+
placeholder: "0",
|
340
|
+
autoGroup: !1,
|
341
|
+
min: 0,
|
342
|
+
max: 100,
|
343
|
+
suffix: " %",
|
344
|
+
allowMinus: !1
|
345
|
+
}
|
346
|
+
}), Inputmask;
|
347
|
+
});
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/*!
|
2
|
+
* inputmask.phone.extensions.js
|
3
|
+
* https://github.com/RobinHerbots/Inputmask
|
4
|
+
* Copyright (c) 2010 - 2017 Robin Herbots
|
5
|
+
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
6
|
+
* Version: 3.3.9
|
7
|
+
*/
|
8
|
+
|
9
|
+
!function(factory) {
|
10
|
+
"function" == typeof define && define.amd ? define([ "./dependencyLibs/inputmask.dependencyLib", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./dependencyLibs/inputmask.dependencyLib"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
|
11
|
+
}(function($, Inputmask) {
|
12
|
+
function maskSort(a, b) {
|
13
|
+
var maska = (a.mask || a).replace(/#/g, "9").replace(/\)/, "9").replace(/[+()#-]/g, ""), maskb = (b.mask || b).replace(/#/g, "9").replace(/\)/, "9").replace(/[+()#-]/g, ""), maskas = (a.mask || a).split("#")[0], maskbs = (b.mask || b).split("#")[0];
|
14
|
+
return 0 === maskbs.indexOf(maskas) ? -1 : 0 === maskas.indexOf(maskbs) ? 1 : maska.localeCompare(maskb);
|
15
|
+
}
|
16
|
+
var analyseMaskBase = Inputmask.prototype.analyseMask;
|
17
|
+
return Inputmask.prototype.analyseMask = function(mask, regexMask, opts) {
|
18
|
+
function reduceVariations(masks, previousVariation, previousmaskGroup) {
|
19
|
+
previousVariation = previousVariation || "", previousmaskGroup = previousmaskGroup || maskGroups,
|
20
|
+
"" !== previousVariation && (previousmaskGroup[previousVariation] = {});
|
21
|
+
for (var variation = "", maskGroup = previousmaskGroup[previousVariation] || previousmaskGroup, i = masks.length - 1; i >= 0; i--) mask = masks[i].mask || masks[i],
|
22
|
+
variation = mask.substr(0, 1), maskGroup[variation] = maskGroup[variation] || [],
|
23
|
+
maskGroup[variation].unshift(mask.substr(1)), masks.splice(i, 1);
|
24
|
+
for (var ndx in maskGroup) maskGroup[ndx].length > 500 && reduceVariations(maskGroup[ndx].slice(), ndx, maskGroup);
|
25
|
+
}
|
26
|
+
function rebuild(maskGroup) {
|
27
|
+
var mask = "", submasks = [];
|
28
|
+
for (var ndx in maskGroup) $.isArray(maskGroup[ndx]) ? 1 === maskGroup[ndx].length ? submasks.push(ndx + maskGroup[ndx]) : submasks.push(ndx + opts.groupmarker.start + maskGroup[ndx].join(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start) + opts.groupmarker.end) : submasks.push(ndx + rebuild(maskGroup[ndx]));
|
29
|
+
return 1 === submasks.length ? mask += submasks[0] : mask += opts.groupmarker.start + submasks.join(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start) + opts.groupmarker.end,
|
30
|
+
mask;
|
31
|
+
}
|
32
|
+
var maskGroups = {};
|
33
|
+
return opts.phoneCodes && (opts.phoneCodes && opts.phoneCodes.length > 1e3 && (mask = mask.substr(1, mask.length - 2),
|
34
|
+
reduceVariations(mask.split(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start)),
|
35
|
+
mask = rebuild(maskGroups)), mask = mask.replace(/9/g, "\\9")), analyseMaskBase.call(this, mask, regexMask, opts);
|
36
|
+
}, Inputmask.extendAliases({
|
37
|
+
abstractphone: {
|
38
|
+
groupmarker: {
|
39
|
+
start: "<",
|
40
|
+
end: ">"
|
41
|
+
},
|
42
|
+
countrycode: "",
|
43
|
+
phoneCodes: [],
|
44
|
+
mask: function(opts) {
|
45
|
+
return opts.definitions = {
|
46
|
+
"#": Inputmask.prototype.definitions[9]
|
47
|
+
}, opts.phoneCodes.sort(maskSort);
|
48
|
+
},
|
49
|
+
keepStatic: !0,
|
50
|
+
onBeforeMask: function(value, opts) {
|
51
|
+
var processedValue = value.replace(/^0{1,2}/, "").replace(/[\s]/g, "");
|
52
|
+
return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue),
|
53
|
+
processedValue;
|
54
|
+
},
|
55
|
+
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
56
|
+
return maskedValue.replace(/[()#-]/g, "");
|
57
|
+
},
|
58
|
+
inputmode: "tel"
|
59
|
+
}
|
60
|
+
}), Inputmask;
|
61
|
+
});
|
@@ -0,0 +1,115 @@
|
|
1
|
+
/*!
|
2
|
+
* inputmask.regex.extensions.js
|
3
|
+
* https://github.com/RobinHerbots/Inputmask
|
4
|
+
* Copyright (c) 2010 - 2017 Robin Herbots
|
5
|
+
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
6
|
+
* Version: 3.3.9
|
7
|
+
*/
|
8
|
+
|
9
|
+
!function(factory) {
|
10
|
+
"function" == typeof define && define.amd ? define([ "./dependencyLibs/inputmask.dependencyLib", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./dependencyLibs/inputmask.dependencyLib"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
|
11
|
+
}(function($, Inputmask) {
|
12
|
+
return Inputmask.extendAliases({
|
13
|
+
Regex: {
|
14
|
+
mask: "r",
|
15
|
+
greedy: !1,
|
16
|
+
repeat: "*",
|
17
|
+
regex: null,
|
18
|
+
regexTokens: null,
|
19
|
+
tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\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,
|
20
|
+
quantifierFilter: /[0-9]+[^,]/,
|
21
|
+
isComplete: function(buffer, opts) {
|
22
|
+
return new RegExp(opts.regex, opts.casing ? "i" : "").test(buffer.join(""));
|
23
|
+
},
|
24
|
+
definitions: {
|
25
|
+
r: {
|
26
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
27
|
+
function RegexToken(isGroup, isQuantifier) {
|
28
|
+
this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1,
|
29
|
+
this.quantifier = {
|
30
|
+
min: 1,
|
31
|
+
max: 1
|
32
|
+
}, this.repeaterPart = void 0;
|
33
|
+
}
|
34
|
+
function validateRegexToken(token, fromGroup) {
|
35
|
+
var isvalid = !1;
|
36
|
+
fromGroup && (regexPart += "(", openGroupCount++);
|
37
|
+
for (var mndx = 0; mndx < token.matches.length; mndx++) {
|
38
|
+
var matchToken = token.matches[mndx];
|
39
|
+
if (!0 === matchToken.isGroup) isvalid = validateRegexToken(matchToken, !0); else if (!0 === matchToken.isQuantifier) {
|
40
|
+
var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
|
41
|
+
if (isNaN(matchToken.quantifier.max)) {
|
42
|
+
for (;matchToken.repeaterPart && matchToken.repeaterPart !== regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
|
43
|
+
isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart),
|
44
|
+
regexPart = regexPartBak + matchToken.quantifier.max;
|
45
|
+
} else {
|
46
|
+
for (var i = 0, qm = matchToken.quantifier.max - 1; i < qm && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
|
47
|
+
regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
|
48
|
+
}
|
49
|
+
} else if (void 0 !== matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
|
50
|
+
var testExp;
|
51
|
+
if ("[" == matchToken.charAt(0)) {
|
52
|
+
testExp = regexPart, testExp += matchToken;
|
53
|
+
for (var j = 0; j < openGroupCount; j++) testExp += ")";
|
54
|
+
var exp = new RegExp("^(" + testExp + ")$", opts.casing ? "i" : "");
|
55
|
+
isvalid = exp.test(bufferStr);
|
56
|
+
} else for (var l = 0, tl = matchToken.length; l < tl; l++) if ("\\" !== matchToken.charAt(l)) {
|
57
|
+
testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
|
58
|
+
for (var j = 0; j < openGroupCount; j++) testExp += ")";
|
59
|
+
var exp = new RegExp("^(" + testExp + ")$", opts.casing ? "i" : "");
|
60
|
+
if (isvalid = exp.test(bufferStr)) break;
|
61
|
+
}
|
62
|
+
regexPart += matchToken;
|
63
|
+
}
|
64
|
+
if (isvalid) break;
|
65
|
+
}
|
66
|
+
return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
|
67
|
+
}
|
68
|
+
var bufferStr, groupToken, cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
|
69
|
+
null === opts.regexTokens && function() {
|
70
|
+
var match, m, currentToken = new RegexToken(), opengroups = [];
|
71
|
+
for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0],
|
72
|
+
m.charAt(0)) {
|
73
|
+
case "(":
|
74
|
+
opengroups.push(new RegexToken(!0));
|
75
|
+
break;
|
76
|
+
|
77
|
+
case ")":
|
78
|
+
groupToken = opengroups.pop(), opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
|
79
|
+
break;
|
80
|
+
|
81
|
+
case "{":
|
82
|
+
case "+":
|
83
|
+
case "*":
|
84
|
+
var quantifierToken = new RegexToken(!1, !0);
|
85
|
+
m = m.replace(/[{}]/g, "");
|
86
|
+
var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
|
87
|
+
if (quantifierToken.quantifier = {
|
88
|
+
min: mq0,
|
89
|
+
max: mq1
|
90
|
+
}, opengroups.length > 0) {
|
91
|
+
var matches = opengroups[opengroups.length - 1].matches;
|
92
|
+
match = matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), groupToken.matches.push(match),
|
93
|
+
match = groupToken), matches.push(match), matches.push(quantifierToken);
|
94
|
+
} else match = currentToken.matches.pop(), match.isGroup || (groupToken = new RegexToken(!0),
|
95
|
+
groupToken.matches.push(match), match = groupToken), currentToken.matches.push(match),
|
96
|
+
currentToken.matches.push(quantifierToken);
|
97
|
+
break;
|
98
|
+
|
99
|
+
default:
|
100
|
+
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(m) : currentToken.matches.push(m);
|
101
|
+
}
|
102
|
+
currentToken.matches.length > 0 && opts.regexTokens.push(currentToken);
|
103
|
+
}(), cbuffer.splice(pos, 0, chrs), bufferStr = cbuffer.join("");
|
104
|
+
for (var i = 0; i < opts.regexTokens.length; i++) {
|
105
|
+
var regexToken = opts.regexTokens[i];
|
106
|
+
if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
|
107
|
+
}
|
108
|
+
return isValid;
|
109
|
+
},
|
110
|
+
cardinality: 1
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}), Inputmask;
|
115
|
+
});
|