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,3085 @@
|
|
1
|
+
/*!
|
2
|
+
* jquery.inputmask.bundle.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(modules) {
|
10
|
+
function __webpack_require__(moduleId) {
|
11
|
+
if (installedModules[moduleId]) return installedModules[moduleId].exports;
|
12
|
+
var module = installedModules[moduleId] = {
|
13
|
+
i: moduleId,
|
14
|
+
l: !1,
|
15
|
+
exports: {}
|
16
|
+
};
|
17
|
+
return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
|
18
|
+
module.l = !0, module.exports;
|
19
|
+
}
|
20
|
+
var installedModules = {};
|
21
|
+
__webpack_require__.m = modules, __webpack_require__.c = installedModules, __webpack_require__.i = function(value) {
|
22
|
+
return value;
|
23
|
+
}, __webpack_require__.d = function(exports, name, getter) {
|
24
|
+
__webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
|
25
|
+
configurable: !1,
|
26
|
+
enumerable: !0,
|
27
|
+
get: getter
|
28
|
+
});
|
29
|
+
}, __webpack_require__.n = function(module) {
|
30
|
+
var getter = module && module.__esModule ? function() {
|
31
|
+
return module.default;
|
32
|
+
} : function() {
|
33
|
+
return module;
|
34
|
+
};
|
35
|
+
return __webpack_require__.d(getter, "a", getter), getter;
|
36
|
+
}, __webpack_require__.o = function(object, property) {
|
37
|
+
return Object.prototype.hasOwnProperty.call(object, property);
|
38
|
+
}, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 10);
|
39
|
+
}([ function(module, exports, __webpack_require__) {
|
40
|
+
"use strict";
|
41
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
42
|
+
"function" == typeof Symbol && Symbol.iterator;
|
43
|
+
!function(factory) {
|
44
|
+
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2) ], __WEBPACK_AMD_DEFINE_FACTORY__ = factory,
|
45
|
+
void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
46
|
+
}(function($) {
|
47
|
+
return $;
|
48
|
+
});
|
49
|
+
}, function(module, exports, __webpack_require__) {
|
50
|
+
"use strict";
|
51
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
|
52
|
+
return typeof obj;
|
53
|
+
} : function(obj) {
|
54
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
55
|
+
};
|
56
|
+
!function(factory) {
|
57
|
+
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(12), __webpack_require__(11) ],
|
58
|
+
__WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
59
|
+
}(function($, window, document, undefined) {
|
60
|
+
function Inputmask(alias, options, internal) {
|
61
|
+
if (!(this instanceof Inputmask)) return new Inputmask(alias, options, internal);
|
62
|
+
this.el = undefined, this.events = {}, this.maskset = undefined, this.refreshValue = !1,
|
63
|
+
!0 !== internal && ($.isPlainObject(alias) ? options = alias : (options = options || {},
|
64
|
+
options.alias = alias), this.opts = $.extend(!0, {}, this.defaults, options), this.noMasksCache = options && options.definitions !== undefined,
|
65
|
+
this.userOptions = options || {}, this.isRTL = this.opts.numericInput, resolveAlias(this.opts.alias, options, this.opts));
|
66
|
+
}
|
67
|
+
function resolveAlias(aliasStr, options, opts) {
|
68
|
+
var aliasDefinition = Inputmask.prototype.aliases[aliasStr];
|
69
|
+
return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, undefined, opts),
|
70
|
+
$.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : (null === opts.mask && (opts.mask = aliasStr),
|
71
|
+
!1);
|
72
|
+
}
|
73
|
+
function generateMaskSet(opts, nocache) {
|
74
|
+
function generateMask(mask, metadata, opts) {
|
75
|
+
var regexMask = !1;
|
76
|
+
if (null !== mask && "" !== mask || (regexMask = null !== opts.regex, regexMask ? (mask = opts.regex,
|
77
|
+
mask = mask.replace(/^(\^)(.*)(\$)$/, "$2")) : (regexMask = !0, mask = ".*")), 1 === mask.length && !1 === opts.greedy && 0 !== opts.repeat && (opts.placeholder = ""),
|
78
|
+
opts.repeat > 0 || "*" === opts.repeat || "+" === opts.repeat) {
|
79
|
+
var repeatStart = "*" === opts.repeat ? 0 : "+" === opts.repeat ? 1 : opts.repeat;
|
80
|
+
mask = opts.groupmarker.start + mask + opts.groupmarker.end + opts.quantifiermarker.start + repeatStart + "," + opts.repeat + opts.quantifiermarker.end;
|
81
|
+
}
|
82
|
+
var masksetDefinition, maskdefKey = regexMask ? "regex_" + opts.regex : opts.numericInput ? mask.split("").reverse().join("") : mask;
|
83
|
+
return Inputmask.prototype.masksCache[maskdefKey] === undefined || !0 === nocache ? (masksetDefinition = {
|
84
|
+
mask: mask,
|
85
|
+
maskToken: Inputmask.prototype.analyseMask(mask, regexMask, opts),
|
86
|
+
validPositions: {},
|
87
|
+
_buffer: undefined,
|
88
|
+
buffer: undefined,
|
89
|
+
tests: {},
|
90
|
+
metadata: metadata,
|
91
|
+
maskLength: undefined
|
92
|
+
}, !0 !== nocache && (Inputmask.prototype.masksCache[maskdefKey] = masksetDefinition,
|
93
|
+
masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]))) : masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]),
|
94
|
+
masksetDefinition;
|
95
|
+
}
|
96
|
+
if ($.isFunction(opts.mask) && (opts.mask = opts.mask(opts)), $.isArray(opts.mask)) {
|
97
|
+
if (opts.mask.length > 1) {
|
98
|
+
opts.keepStatic = null === opts.keepStatic || opts.keepStatic;
|
99
|
+
var altMask = opts.groupmarker.start;
|
100
|
+
return $.each(opts.numericInput ? opts.mask.reverse() : opts.mask, function(ndx, msk) {
|
101
|
+
altMask.length > 1 && (altMask += opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start),
|
102
|
+
msk.mask === undefined || $.isFunction(msk.mask) ? altMask += msk : altMask += msk.mask;
|
103
|
+
}), altMask += opts.groupmarker.end, generateMask(altMask, opts.mask, opts);
|
104
|
+
}
|
105
|
+
opts.mask = opts.mask.pop();
|
106
|
+
}
|
107
|
+
return opts.mask && opts.mask.mask !== undefined && !$.isFunction(opts.mask.mask) ? generateMask(opts.mask.mask, opts.mask, opts) : generateMask(opts.mask, opts.mask, opts);
|
108
|
+
}
|
109
|
+
function maskScope(actionObj, maskset, opts) {
|
110
|
+
function getMaskTemplate(baseOnInput, minimalPos, includeMode) {
|
111
|
+
minimalPos = minimalPos || 0;
|
112
|
+
var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0, lvp = getLastValidPosition();
|
113
|
+
do {
|
114
|
+
!0 === baseOnInput && getMaskSet().validPositions[pos] ? (testPos = getMaskSet().validPositions[pos],
|
115
|
+
test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder(pos, test))) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
116
|
+
test = testPos.match, ndxIntlzr = testPos.locator.slice(), (!1 === opts.jitMasking || pos < lvp || "number" == typeof opts.jitMasking && isFinite(opts.jitMasking) && opts.jitMasking > pos) && maskTemplate.push(!1 === includeMode ? test.nativeDef : getPlaceholder(pos, test))),
|
117
|
+
pos++;
|
118
|
+
} while ((maxLength === undefined || pos < maxLength) && (null !== test.fn || "" !== test.def) || minimalPos > pos);
|
119
|
+
return "" === maskTemplate[maskTemplate.length - 1] && maskTemplate.pop(), getMaskSet().maskLength = pos + 1,
|
120
|
+
maskTemplate;
|
121
|
+
}
|
122
|
+
function getMaskSet() {
|
123
|
+
return maskset;
|
124
|
+
}
|
125
|
+
function resetMaskSet(soft) {
|
126
|
+
var maskset = getMaskSet();
|
127
|
+
maskset.buffer = undefined, !0 !== soft && (maskset.validPositions = {}, maskset.p = 0);
|
128
|
+
}
|
129
|
+
function getLastValidPosition(closestTo, strict, validPositions) {
|
130
|
+
var before = -1, after = -1, valids = validPositions || getMaskSet().validPositions;
|
131
|
+
closestTo === undefined && (closestTo = -1);
|
132
|
+
for (var posNdx in valids) {
|
133
|
+
var psNdx = parseInt(posNdx);
|
134
|
+
valids[psNdx] && (strict || !0 !== valids[psNdx].generatedInput) && (psNdx <= closestTo && (before = psNdx),
|
135
|
+
psNdx >= closestTo && (after = psNdx));
|
136
|
+
}
|
137
|
+
return -1 !== before && closestTo - before > 1 || after < closestTo ? before : after;
|
138
|
+
}
|
139
|
+
function stripValidPositions(start, end, nocheck, strict) {
|
140
|
+
var i, startPos = start, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), needsValidation = !1;
|
141
|
+
for (getMaskSet().p = start, i = end - 1; i >= startPos; i--) getMaskSet().validPositions[i] !== undefined && (!0 !== nocheck && (!getMaskSet().validPositions[i].match.optionality && function(pos) {
|
142
|
+
var posMatch = getMaskSet().validPositions[pos];
|
143
|
+
if (posMatch !== undefined && null === posMatch.match.fn) {
|
144
|
+
var prevMatch = getMaskSet().validPositions[pos - 1], nextMatch = getMaskSet().validPositions[pos + 1];
|
145
|
+
return prevMatch !== undefined && nextMatch !== undefined;
|
146
|
+
}
|
147
|
+
return !1;
|
148
|
+
}(i) || !1 === opts.canClearPosition(getMaskSet(), i, getLastValidPosition(), strict, opts)) || delete getMaskSet().validPositions[i]);
|
149
|
+
for (resetMaskSet(!0), i = startPos + 1; i <= getLastValidPosition(); ) {
|
150
|
+
for (;getMaskSet().validPositions[startPos] !== undefined; ) startPos++;
|
151
|
+
if (i < startPos && (i = startPos + 1), getMaskSet().validPositions[i] === undefined && isMask(i)) i++; else {
|
152
|
+
var t = getTestTemplate(i);
|
153
|
+
!1 === needsValidation && positionsClone[startPos] && positionsClone[startPos].match.def === t.match.def ? (getMaskSet().validPositions[startPos] = $.extend(!0, {}, positionsClone[startPos]),
|
154
|
+
getMaskSet().validPositions[startPos].input = t.input, delete getMaskSet().validPositions[i],
|
155
|
+
i++) : positionCanMatchDefinition(startPos, t.match.def) ? !1 !== isValid(startPos, t.input || getPlaceholder(i), !0) && (delete getMaskSet().validPositions[i],
|
156
|
+
i++, needsValidation = !0) : isMask(i) || (i++, startPos--), startPos++;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
resetMaskSet(!0);
|
160
|
+
}
|
161
|
+
function determineTestTemplate(tests, guessNextBest) {
|
162
|
+
for (var testPos, testPositions = tests, lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = lvTest.alternation !== undefined ? lvTest.locator[lvTest.alternation].toString().split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx],
|
163
|
+
!(testPos.match && (opts.greedy && !0 !== testPos.match.optionalQuantifier || (!1 === testPos.match.optionality || !1 === testPos.match.newBlockMarker) && !0 !== testPos.match.optionalQuantifier) && (lvTest.alternation === undefined || lvTest.alternation !== testPos.alternation || testPos.locator[lvTest.alternation] !== undefined && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr))) || !0 === guessNextBest && (null !== testPos.match.fn || /[0-9a-bA-Z]/.test(testPos.match.def))); ndx++) ;
|
164
|
+
return testPos;
|
165
|
+
}
|
166
|
+
function getTestTemplate(pos, ndxIntlzr, tstPs) {
|
167
|
+
return getMaskSet().validPositions[pos] || determineTestTemplate(getTests(pos, ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, tstPs));
|
168
|
+
}
|
169
|
+
function getTest(pos) {
|
170
|
+
return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos] : getTests(pos)[0];
|
171
|
+
}
|
172
|
+
function positionCanMatchDefinition(pos, def) {
|
173
|
+
for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) {
|
174
|
+
valid = !0;
|
175
|
+
break;
|
176
|
+
}
|
177
|
+
return valid;
|
178
|
+
}
|
179
|
+
function getTests(pos, ndxIntlzr, tstPs) {
|
180
|
+
function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
|
181
|
+
function handleMatch(match, loopNdx, quantifierRecurse) {
|
182
|
+
function isFirstMatch(latestMatch, tokenGroup) {
|
183
|
+
var firstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches);
|
184
|
+
return firstMatch || $.each(tokenGroup.matches, function(ndx, match) {
|
185
|
+
if (!0 === match.isQuantifier && (firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]))) return !1;
|
186
|
+
}), firstMatch;
|
187
|
+
}
|
188
|
+
function resolveNdxInitializer(pos, alternateNdx, targetAlternation) {
|
189
|
+
var bestMatch, indexPos;
|
190
|
+
if (getMaskSet().validPositions[pos - 1] && targetAlternation && getMaskSet().tests[pos]) for (var vpAlternation = getMaskSet().validPositions[pos - 1].locator, tpAlternation = getMaskSet().tests[pos][0].locator, i = 0; i < targetAlternation; i++) if (vpAlternation[i] !== tpAlternation[i]) return vpAlternation.slice(targetAlternation + 1);
|
191
|
+
return (getMaskSet().tests[pos] || getMaskSet().validPositions[pos]) && $.each(getMaskSet().tests[pos] || [ getMaskSet().validPositions[pos] ], function(ndx, lmnt) {
|
192
|
+
var alternation = targetAlternation !== undefined ? targetAlternation : lmnt.alternation, ndxPos = lmnt.locator[alternation] !== undefined ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1;
|
193
|
+
(indexPos === undefined || ndxPos < indexPos) && -1 !== ndxPos && (bestMatch = lmnt,
|
194
|
+
indexPos = ndxPos);
|
195
|
+
}), bestMatch ? bestMatch.locator.slice((targetAlternation !== undefined ? targetAlternation : bestMatch.alternation) + 1) : targetAlternation !== undefined ? resolveNdxInitializer(pos, alternateNdx) : undefined;
|
196
|
+
}
|
197
|
+
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;
|
198
|
+
if (testPos === pos && match.matches === undefined) return matches.push({
|
199
|
+
match: match,
|
200
|
+
locator: loopNdx.reverse(),
|
201
|
+
cd: cacheDependency
|
202
|
+
}), !0;
|
203
|
+
if (match.matches !== undefined) {
|
204
|
+
if (match.isGroup && quantifierRecurse !== match) {
|
205
|
+
if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx)) return !0;
|
206
|
+
} else if (match.isOptional) {
|
207
|
+
var optionalToken = match;
|
208
|
+
if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) {
|
209
|
+
if (latestMatch = matches[matches.length - 1].match, !isFirstMatch(latestMatch, optionalToken)) return !0;
|
210
|
+
insertStop = !0, testPos = pos;
|
211
|
+
}
|
212
|
+
} else if (match.isAlternator) {
|
213
|
+
var maltMatches, alternateToken = match, malternateMatches = [], currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1;
|
214
|
+
if (-1 === altIndex || "string" == typeof altIndex) {
|
215
|
+
var amndx, currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = [];
|
216
|
+
if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0; amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx);
|
217
|
+
for (var ndx = 0; ndx < altIndexArr.length; ndx++) {
|
218
|
+
if (amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice(),
|
219
|
+
!0 !== (match = handleMatch(alternateToken.matches[amndx] || maskToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) || match) && match !== undefined && altIndexArr[altIndexArr.length - 1] < alternateToken.matches.length) {
|
220
|
+
var ntndx = $.inArray(match, maskToken.matches) + 1;
|
221
|
+
maskToken.matches.length > ntndx && (match = handleMatch(maskToken.matches[ntndx], [ ntndx ].concat(loopNdx.slice(1, loopNdx.length)), quantifierRecurse)) && (altIndexArr.push(ntndx.toString()),
|
222
|
+
$.each(matches, function(ndx, lmnt) {
|
223
|
+
lmnt.alternation = loopNdx.length - 1;
|
224
|
+
}));
|
225
|
+
}
|
226
|
+
maltMatches = matches.slice(), testPos = currentPos, matches = [];
|
227
|
+
for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
|
228
|
+
var altMatch = maltMatches[ndx1], dropMatch = !1;
|
229
|
+
altMatch.alternation = altMatch.alternation || loopNdxCnt;
|
230
|
+
for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
|
231
|
+
var altMatch2 = malternateMatches[ndx2];
|
232
|
+
if ("string" != typeof altIndex || -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) {
|
233
|
+
if (function(source, target) {
|
234
|
+
return source.match.nativeDef === target.match.nativeDef || source.match.def === target.match.nativeDef || source.match.nativeDef === target.match.def;
|
235
|
+
}(altMatch, altMatch2)) {
|
236
|
+
dropMatch = !0, altMatch.alternation === altMatch2.alternation && -1 === altMatch2.locator[altMatch2.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) && (altMatch2.locator[altMatch2.alternation] = altMatch2.locator[altMatch2.alternation] + "," + altMatch.locator[altMatch.alternation],
|
237
|
+
altMatch2.alternation = altMatch.alternation), altMatch.match.nativeDef === altMatch2.match.def && (altMatch.locator[altMatch.alternation] = altMatch2.locator[altMatch2.alternation],
|
238
|
+
malternateMatches.splice(malternateMatches.indexOf(altMatch2), 1, altMatch));
|
239
|
+
break;
|
240
|
+
}
|
241
|
+
if (altMatch.match.def === altMatch2.match.def) {
|
242
|
+
dropMatch = !1;
|
243
|
+
break;
|
244
|
+
}
|
245
|
+
if (function(source, target) {
|
246
|
+
return null === source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def, getMaskSet(), pos, !1, opts, !1);
|
247
|
+
}(altMatch, altMatch2) || function(source, target) {
|
248
|
+
return null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1);
|
249
|
+
}(altMatch, altMatch2)) {
|
250
|
+
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(),
|
251
|
+
-1 === altMatch.na.indexOf(altMatch.locator[altMatch.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na + "," + altMatch.locator[altMatch2.alternation].toString().split("")[0]),
|
252
|
+
dropMatch = !0, altMatch.locator[altMatch.alternation] = altMatch2.locator[altMatch2.alternation].toString().split("")[0] + "," + altMatch.locator[altMatch.alternation],
|
253
|
+
malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
|
254
|
+
break;
|
255
|
+
}
|
256
|
+
}
|
257
|
+
}
|
258
|
+
dropMatch || malternateMatches.push(altMatch);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
"string" == typeof altIndex && (malternateMatches = $.map(malternateMatches, function(lmnt, ndx) {
|
262
|
+
if (isFinite(ndx)) {
|
263
|
+
var alternation = lmnt.alternation, altLocArr = lmnt.locator[alternation].toString().split(",");
|
264
|
+
lmnt.locator[alternation] = undefined, lmnt.alternation = undefined;
|
265
|
+
for (var alndx = 0; alndx < altLocArr.length; alndx++) -1 !== $.inArray(altLocArr[alndx], altIndexArr) && (lmnt.locator[alternation] !== undefined ? (lmnt.locator[alternation] += ",",
|
266
|
+
lmnt.locator[alternation] += altLocArr[alndx]) : lmnt.locator[alternation] = parseInt(altLocArr[alndx]),
|
267
|
+
lmnt.alternation = alternation);
|
268
|
+
if (lmnt.locator[alternation] !== undefined) return lmnt;
|
269
|
+
}
|
270
|
+
})), matches = currentMatches.concat(malternateMatches), testPos = pos, insertStop = matches.length > 0,
|
271
|
+
match = malternateMatches.length > 0, ndxInitializer = ndxInitializerClone.slice();
|
272
|
+
} else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse);
|
273
|
+
if (match) return !0;
|
274
|
+
} else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) for (var qt = match, qndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && testPos <= pos; qndx++) {
|
275
|
+
var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
|
276
|
+
if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup)) {
|
277
|
+
if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1,
|
278
|
+
isFirstMatch(latestMatch, tokenGroup)) {
|
279
|
+
if (qndx > qt.quantifier.min - 1) {
|
280
|
+
insertStop = !0, testPos = pos;
|
281
|
+
break;
|
282
|
+
}
|
283
|
+
return !0;
|
284
|
+
}
|
285
|
+
return !0;
|
286
|
+
}
|
287
|
+
} else if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) return !0;
|
288
|
+
} else testPos++;
|
289
|
+
}
|
290
|
+
for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (!0 !== maskToken.matches[tndx].isQuantifier) {
|
291
|
+
var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
|
292
|
+
if (match && testPos === pos) return match;
|
293
|
+
if (testPos > pos) break;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
function filterTests(tests) {
|
297
|
+
if (opts.keepStatic && pos > 0 && tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0) && !0 !== tests[0].match.optionality && !0 !== tests[0].match.optionalQuantifier && null === tests[0].match.fn && !/[0-9a-bA-Z]/.test(tests[0].match.def)) {
|
298
|
+
if (getMaskSet().validPositions[pos - 1] === undefined) return [ determineTestTemplate(tests) ];
|
299
|
+
if (getMaskSet().validPositions[pos - 1].alternation === tests[0].alternation) return [ determineTestTemplate(tests) ];
|
300
|
+
if (getMaskSet().validPositions[pos - 1]) return [ determineTestTemplate(tests) ];
|
301
|
+
}
|
302
|
+
return tests;
|
303
|
+
}
|
304
|
+
var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = !1, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
|
305
|
+
if (pos > -1) {
|
306
|
+
if (ndxIntlzr === undefined) {
|
307
|
+
for (var test, previousPos = pos - 1; (test = getMaskSet().validPositions[previousPos] || getMaskSet().tests[previousPos]) === undefined && previousPos > -1; ) previousPos--;
|
308
|
+
test !== undefined && previousPos > -1 && (ndxInitializer = function(tests) {
|
309
|
+
var locator = [];
|
310
|
+
return $.isArray(tests) || (tests = [ tests ]), tests.length > 0 && (tests[0].alternation === undefined ? (locator = determineTestTemplate(tests.slice()).locator.slice(),
|
311
|
+
0 === locator.length && (locator = tests[0].locator.slice())) : $.each(tests, function(ndx, tst) {
|
312
|
+
if ("" !== tst.def) if (0 === locator.length) locator = tst.locator.slice(); else for (var i = 0; i < locator.length; i++) tst.locator[i] && -1 === locator[i].toString().indexOf(tst.locator[i]) && (locator[i] += "," + tst.locator[i]);
|
313
|
+
})), locator;
|
314
|
+
}(test), cacheDependency = ndxInitializer.join(""), testPos = previousPos);
|
315
|
+
}
|
316
|
+
if (getMaskSet().tests[pos] && getMaskSet().tests[pos][0].cd === cacheDependency) return filterTests(getMaskSet().tests[pos]);
|
317
|
+
for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) {
|
318
|
+
if (resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]) && testPos === pos || testPos > pos) break;
|
319
|
+
}
|
320
|
+
}
|
321
|
+
return (0 === matches.length || insertStop) && matches.push({
|
322
|
+
match: {
|
323
|
+
fn: null,
|
324
|
+
cardinality: 0,
|
325
|
+
optionality: !0,
|
326
|
+
casing: null,
|
327
|
+
def: "",
|
328
|
+
placeholder: ""
|
329
|
+
},
|
330
|
+
locator: [],
|
331
|
+
cd: cacheDependency
|
332
|
+
}), ndxIntlzr !== undefined && getMaskSet().tests[pos] ? filterTests($.extend(!0, [], matches)) : (getMaskSet().tests[pos] = $.extend(!0, [], matches),
|
333
|
+
filterTests(getMaskSet().tests[pos]));
|
334
|
+
}
|
335
|
+
function getBufferTemplate() {
|
336
|
+
return getMaskSet()._buffer === undefined && (getMaskSet()._buffer = getMaskTemplate(!1, 1),
|
337
|
+
getMaskSet().buffer === undefined && (getMaskSet().buffer = getMaskSet()._buffer.slice())),
|
338
|
+
getMaskSet()._buffer;
|
339
|
+
}
|
340
|
+
function getBuffer(noCache) {
|
341
|
+
return getMaskSet().buffer !== undefined && !0 !== noCache || (getMaskSet().buffer = getMaskTemplate(!0, getLastValidPosition(), !0)),
|
342
|
+
getMaskSet().buffer;
|
343
|
+
}
|
344
|
+
function refreshFromBuffer(start, end, buffer) {
|
345
|
+
var i, p;
|
346
|
+
if (!0 === start) resetMaskSet(), start = 0, end = buffer.length; else for (i = start; i < end; i++) delete getMaskSet().validPositions[i];
|
347
|
+
for (p = start, i = start; i < end; i++) if (resetMaskSet(!0), buffer[i] !== opts.skipOptionalPartCharacter) {
|
348
|
+
var valResult = isValid(p, buffer[i], !0, !0);
|
349
|
+
!1 !== valResult && (resetMaskSet(!0), p = valResult.caret !== undefined ? valResult.caret : valResult.pos + 1);
|
350
|
+
}
|
351
|
+
}
|
352
|
+
function casing(elem, test, pos) {
|
353
|
+
switch (opts.casing || test.casing) {
|
354
|
+
case "upper":
|
355
|
+
elem = elem.toUpperCase();
|
356
|
+
break;
|
357
|
+
|
358
|
+
case "lower":
|
359
|
+
elem = elem.toLowerCase();
|
360
|
+
break;
|
361
|
+
|
362
|
+
case "title":
|
363
|
+
var posBefore = getMaskSet().validPositions[pos - 1];
|
364
|
+
elem = 0 === pos || posBefore && posBefore.input === String.fromCharCode(Inputmask.keyCode.SPACE) ? elem.toUpperCase() : elem.toLowerCase();
|
365
|
+
break;
|
366
|
+
|
367
|
+
default:
|
368
|
+
if ($.isFunction(opts.casing)) {
|
369
|
+
var args = Array.prototype.slice.call(arguments);
|
370
|
+
args.push(getMaskSet().validPositions), elem = opts.casing.apply(this, args);
|
371
|
+
}
|
372
|
+
}
|
373
|
+
return elem;
|
374
|
+
}
|
375
|
+
function checkAlternationMatch(altArr1, altArr2, na) {
|
376
|
+
for (var naNdx, altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, naArr = na !== undefined ? na.split(",") : [], i = 0; i < naArr.length; i++) -1 !== (naNdx = altArr1.indexOf(naArr[i])) && altArr1.splice(naNdx, 1);
|
377
|
+
for (var alndx = 0; alndx < altArr1.length; alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) {
|
378
|
+
isMatch = !0;
|
379
|
+
break;
|
380
|
+
}
|
381
|
+
return isMatch;
|
382
|
+
}
|
383
|
+
function isValid(pos, c, strict, fromSetValid, fromAlternate, validateOnly) {
|
384
|
+
function isSelection(posObj) {
|
385
|
+
var selection = isRTL ? posObj.begin - posObj.end > 1 || posObj.begin - posObj.end == 1 : posObj.end - posObj.begin > 1 || posObj.end - posObj.begin == 1;
|
386
|
+
return selection && 0 === posObj.begin && posObj.end === getMaskSet().maskLength ? "full" : selection;
|
387
|
+
}
|
388
|
+
function _isValid(position, c, strict) {
|
389
|
+
var rslt = !1;
|
390
|
+
return $.each(getTests(position), function(ndx, tst) {
|
391
|
+
for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = test.cardinality; i > loopend; i--) chrs += getBufferElement(position - (i - 1));
|
392
|
+
if (c && (chrs += c), getBuffer(!0), !1 !== (rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts, isSelection(pos)) : (c === test.def || c === opts.skipOptionalPartCharacter) && "" !== test.def && {
|
393
|
+
c: getPlaceholder(position, test, !0) || test.def,
|
394
|
+
pos: position
|
395
|
+
})) {
|
396
|
+
var elem = rslt.c !== undefined ? rslt.c : c;
|
397
|
+
elem = elem === opts.skipOptionalPartCharacter && null === test.fn ? getPlaceholder(position, test, !0) || test.def : elem;
|
398
|
+
var validatedPos = position, possibleModifiedBuffer = getBuffer();
|
399
|
+
if (rslt.remove !== undefined && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]),
|
400
|
+
$.each(rslt.remove.sort(function(a, b) {
|
401
|
+
return b - a;
|
402
|
+
}), function(ndx, lmnt) {
|
403
|
+
stripValidPositions(lmnt, lmnt + 1, !0);
|
404
|
+
})), rslt.insert !== undefined && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]),
|
405
|
+
$.each(rslt.insert.sort(function(a, b) {
|
406
|
+
return a - b;
|
407
|
+
}), function(ndx, lmnt) {
|
408
|
+
isValid(lmnt.pos, lmnt.c, !0, fromSetValid);
|
409
|
+
})), rslt.refreshFromBuffer) {
|
410
|
+
var refresh = rslt.refreshFromBuffer;
|
411
|
+
if (refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, possibleModifiedBuffer),
|
412
|
+
rslt.pos === undefined && rslt.c === undefined) return rslt.pos = getLastValidPosition(),
|
413
|
+
!1;
|
414
|
+
if ((validatedPos = rslt.pos !== undefined ? rslt.pos : position) !== position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0, fromSetValid)),
|
415
|
+
!1;
|
416
|
+
} else if (!0 !== rslt && rslt.pos !== undefined && rslt.pos !== position && (validatedPos = rslt.pos,
|
417
|
+
refreshFromBuffer(position, validatedPos, getBuffer().slice()), validatedPos !== position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
|
418
|
+
!1;
|
419
|
+
return (!0 === rslt || rslt.pos !== undefined || rslt.c !== undefined) && (ndx > 0 && resetMaskSet(!0),
|
420
|
+
setValidPosition(validatedPos, $.extend({}, tst, {
|
421
|
+
input: casing(elem, test, validatedPos)
|
422
|
+
}), fromSetValid, isSelection(pos)) || (rslt = !1), !1);
|
423
|
+
}
|
424
|
+
}), rslt;
|
425
|
+
}
|
426
|
+
function setValidPosition(pos, validTest, fromSetValid, isSelection) {
|
427
|
+
if (isSelection || opts.insertMode && getMaskSet().validPositions[pos] !== undefined && fromSetValid === undefined) {
|
428
|
+
var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition(undefined, !0);
|
429
|
+
for (i = pos; i <= lvp; i++) delete getMaskSet().validPositions[i];
|
430
|
+
getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
|
431
|
+
var j, valid = !0, vps = getMaskSet().validPositions, needsValidation = !1, initialLength = getMaskSet().maskLength;
|
432
|
+
for (i = j = pos; i <= lvp; i++) {
|
433
|
+
var t = positionsClone[i];
|
434
|
+
if (t !== undefined) for (var posMatch = j; posMatch < getMaskSet().maskLength && (null === t.match.fn && vps[i] && (!0 === vps[i].match.optionalQuantifier || !0 === vps[i].match.optionality) || null != t.match.fn); ) {
|
435
|
+
if (posMatch++, !1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]),
|
436
|
+
getMaskSet().validPositions[posMatch].input = t.input, fillMissingNonMask(posMatch),
|
437
|
+
j = posMatch, valid = !0; else if (positionCanMatchDefinition(posMatch, t.match.def)) {
|
438
|
+
var result = isValid(posMatch, t.input, !0, !0);
|
439
|
+
valid = !1 !== result, j = result.caret || result.insert ? getLastValidPosition() : posMatch,
|
440
|
+
needsValidation = !0;
|
441
|
+
} else if (!(valid = !0 === t.generatedInput) && posMatch >= getMaskSet().maskLength - 1) break;
|
442
|
+
if (getMaskSet().maskLength < initialLength && (getMaskSet().maskLength = initialLength),
|
443
|
+
valid) break;
|
444
|
+
}
|
445
|
+
if (!valid) break;
|
446
|
+
}
|
447
|
+
if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone),
|
448
|
+
resetMaskSet(!0), !1;
|
449
|
+
} else getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
|
450
|
+
return resetMaskSet(!0), !0;
|
451
|
+
}
|
452
|
+
function fillMissingNonMask(maskPos) {
|
453
|
+
for (var pndx = maskPos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ;
|
454
|
+
var testTemplate, testsFromPos;
|
455
|
+
for (pndx++; pndx < maskPos; pndx++) getMaskSet().validPositions[pndx] === undefined && (!1 === opts.jitMasking || opts.jitMasking > pndx) && (testsFromPos = getTests(pndx, getTestTemplate(pndx - 1).locator, pndx - 1).slice(),
|
456
|
+
"" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop(), (testTemplate = determineTestTemplate(testsFromPos)) && (testTemplate.match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, !0) || $.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, !1, opts)) && !1 !== (result = _isValid(pndx, getPlaceholder(pndx, testTemplate.match, !0) || (null == testTemplate.match.fn ? testTemplate.match.def : "" !== getPlaceholder(pndx) ? getPlaceholder(pndx) : getBuffer()[pndx]), !0)) && (getMaskSet().validPositions[result.pos || pndx].generatedInput = !0));
|
457
|
+
}
|
458
|
+
strict = !0 === strict;
|
459
|
+
var maskPos = pos;
|
460
|
+
pos.begin !== undefined && (maskPos = isRTL && !isSelection(pos) ? pos.end : pos.begin);
|
461
|
+
var result = !0, positionsClone = $.extend(!0, {}, getMaskSet().validPositions);
|
462
|
+
if ($.isFunction(opts.preValidation) && !strict && !0 !== fromSetValid && !0 !== validateOnly && (result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts)),
|
463
|
+
!0 === result) {
|
464
|
+
if (fillMissingNonMask(maskPos), isSelection(pos) && (handleRemove(undefined, Inputmask.keyCode.DELETE, pos, !0, !0),
|
465
|
+
maskPos = getMaskSet().p), maskPos < getMaskSet().maskLength && (maxLength === undefined || maskPos < maxLength) && (result = _isValid(maskPos, c, strict),
|
466
|
+
(!strict || !0 === fromSetValid) && !1 === result && !0 !== validateOnly)) {
|
467
|
+
var currentPosValid = getMaskSet().validPositions[maskPos];
|
468
|
+
if (!currentPosValid || null !== currentPosValid.match.fn || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) {
|
469
|
+
if ((opts.insertMode || getMaskSet().validPositions[seekNext(maskPos)] === undefined) && !isMask(maskPos, !0)) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) if (!1 !== (result = _isValid(nPos, c, strict))) {
|
470
|
+
!function(originalPos, newPos) {
|
471
|
+
var vp = getMaskSet().validPositions[newPos];
|
472
|
+
if (vp) for (var targetLocator = vp.locator, tll = targetLocator.length, ps = originalPos; ps < newPos; ps++) if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, !0)) {
|
473
|
+
var tests = getTests(ps).slice(), bestMatch = determineTestTemplate(tests, !0), equality = -1;
|
474
|
+
"" === tests[tests.length - 1].match.def && tests.pop(), $.each(tests, function(ndx, tst) {
|
475
|
+
for (var i = 0; i < tll; i++) {
|
476
|
+
if (tst.locator[i] === undefined || !checkAlternationMatch(tst.locator[i].toString().split(","), targetLocator[i].toString().split(","), tst.na)) {
|
477
|
+
var targetAI = targetLocator[i], bestMatchAI = bestMatch.locator[i], tstAI = tst.locator[i];
|
478
|
+
targetAI - bestMatchAI > Math.abs(targetAI - tstAI) && (bestMatch = tst);
|
479
|
+
break;
|
480
|
+
}
|
481
|
+
equality < i && (equality = i, bestMatch = tst);
|
482
|
+
}
|
483
|
+
}), bestMatch = $.extend({}, bestMatch, {
|
484
|
+
input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def
|
485
|
+
}), bestMatch.generatedInput = !0, setValidPosition(ps, bestMatch, !0), getMaskSet().validPositions[newPos] = undefined,
|
486
|
+
_isValid(newPos, vp.input, !0);
|
487
|
+
}
|
488
|
+
}(maskPos, result.pos !== undefined ? result.pos : nPos), maskPos = nPos;
|
489
|
+
break;
|
490
|
+
}
|
491
|
+
} else result = {
|
492
|
+
caret: seekNext(maskPos)
|
493
|
+
};
|
494
|
+
}
|
495
|
+
!1 === result && opts.keepStatic && !strict && !0 !== fromAlternate && (result = function(pos, c, strict) {
|
496
|
+
var lastAlt, alternation, altPos, prevAltPos, i, validPos, altNdxs, decisionPos, validPsClone = $.extend(!0, {}, getMaskSet().validPositions), isValidRslt = !1, lAltPos = getLastValidPosition();
|
497
|
+
for (prevAltPos = getMaskSet().validPositions[lAltPos]; lAltPos >= 0; lAltPos--) if ((altPos = getMaskSet().validPositions[lAltPos]) && altPos.alternation !== undefined) {
|
498
|
+
if (lastAlt = lAltPos, alternation = getMaskSet().validPositions[lastAlt].alternation,
|
499
|
+
prevAltPos.locator[altPos.alternation] !== altPos.locator[altPos.alternation]) break;
|
500
|
+
prevAltPos = altPos;
|
501
|
+
}
|
502
|
+
if (alternation !== undefined) {
|
503
|
+
decisionPos = parseInt(lastAlt);
|
504
|
+
var decisionTaker = prevAltPos.locator[prevAltPos.alternation || alternation] !== undefined ? prevAltPos.locator[prevAltPos.alternation || alternation] : altNdxs[0];
|
505
|
+
decisionTaker.length > 0 && (decisionTaker = decisionTaker.split(",")[0]);
|
506
|
+
var possibilityPos = getMaskSet().validPositions[decisionPos], prevPos = getMaskSet().validPositions[decisionPos - 1];
|
507
|
+
$.each(getTests(decisionPos, prevPos ? prevPos.locator : undefined, decisionPos - 1), function(ndx, test) {
|
508
|
+
altNdxs = test.locator[alternation] ? test.locator[alternation].toString().split(",") : [];
|
509
|
+
for (var mndx = 0; mndx < altNdxs.length; mndx++) {
|
510
|
+
var validInputs = [], staticInputsBeforePos = 0, staticInputsBeforePosAlternate = 0, verifyValidInput = !1;
|
511
|
+
if (decisionTaker < altNdxs[mndx] && (test.na === undefined || -1 === $.inArray(altNdxs[mndx], test.na.split(",")) || -1 === $.inArray(decisionTaker.toString(), altNdxs))) {
|
512
|
+
getMaskSet().validPositions[decisionPos] = $.extend(!0, {}, test);
|
513
|
+
var possibilities = getMaskSet().validPositions[decisionPos].locator;
|
514
|
+
for (getMaskSet().validPositions[decisionPos].locator[alternation] = parseInt(altNdxs[mndx]),
|
515
|
+
null == test.match.fn ? (possibilityPos.input !== test.match.def && (verifyValidInput = !0,
|
516
|
+
!0 !== possibilityPos.generatedInput && validInputs.push(possibilityPos.input)),
|
517
|
+
staticInputsBeforePosAlternate++, getMaskSet().validPositions[decisionPos].generatedInput = !/[0-9a-bA-Z]/.test(test.match.def),
|
518
|
+
getMaskSet().validPositions[decisionPos].input = test.match.def) : getMaskSet().validPositions[decisionPos].input = possibilityPos.input,
|
519
|
+
i = decisionPos + 1; i < getLastValidPosition(undefined, !0) + 1; i++) validPos = getMaskSet().validPositions[i],
|
520
|
+
validPos && !0 !== validPos.generatedInput && /[0-9a-bA-Z]/.test(validPos.input) ? validInputs.push(validPos.input) : i < pos && staticInputsBeforePos++,
|
521
|
+
delete getMaskSet().validPositions[i];
|
522
|
+
for (verifyValidInput && validInputs[0] === test.match.def && validInputs.shift(),
|
523
|
+
resetMaskSet(!0), isValidRslt = !0; validInputs.length > 0; ) {
|
524
|
+
var input = validInputs.shift();
|
525
|
+
if (input !== opts.skipOptionalPartCharacter && !(isValidRslt = isValid(getLastValidPosition(undefined, !0) + 1, input, !1, fromSetValid, !0))) break;
|
526
|
+
}
|
527
|
+
if (isValidRslt) {
|
528
|
+
getMaskSet().validPositions[decisionPos].locator = possibilities;
|
529
|
+
var targetLvp = getLastValidPosition(pos) + 1;
|
530
|
+
for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) ((validPos = getMaskSet().validPositions[i]) === undefined || null == validPos.match.fn) && i < pos + (staticInputsBeforePosAlternate - staticInputsBeforePos) && staticInputsBeforePosAlternate++;
|
531
|
+
pos += staticInputsBeforePosAlternate - staticInputsBeforePos, isValidRslt = isValid(pos > targetLvp ? targetLvp : pos, c, strict, fromSetValid, !0);
|
532
|
+
}
|
533
|
+
if (isValidRslt) return !1;
|
534
|
+
resetMaskSet(), getMaskSet().validPositions = $.extend(!0, {}, validPsClone);
|
535
|
+
}
|
536
|
+
}
|
537
|
+
});
|
538
|
+
}
|
539
|
+
return isValidRslt;
|
540
|
+
}(maskPos, c, strict)), !0 === result && (result = {
|
541
|
+
pos: maskPos
|
542
|
+
});
|
543
|
+
}
|
544
|
+
if ($.isFunction(opts.postValidation) && !1 !== result && !strict && !0 !== fromSetValid && !0 !== validateOnly) {
|
545
|
+
var postResult = opts.postValidation(getBuffer(!0), result, opts);
|
546
|
+
if (postResult.refreshFromBuffer && postResult.buffer) {
|
547
|
+
var refresh = postResult.refreshFromBuffer;
|
548
|
+
refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, postResult.buffer);
|
549
|
+
}
|
550
|
+
result = !0 === postResult ? result : postResult;
|
551
|
+
}
|
552
|
+
return result && result.pos === undefined && (result.pos = maskPos), !1 !== result && !0 !== validateOnly || (resetMaskSet(!0),
|
553
|
+
getMaskSet().validPositions = $.extend(!0, {}, positionsClone)), result;
|
554
|
+
}
|
555
|
+
function isMask(pos, strict) {
|
556
|
+
var test = getTestTemplate(pos).match;
|
557
|
+
if ("" === test.def && (test = getTest(pos).match), null != test.fn) return test.fn;
|
558
|
+
if (!0 !== strict && pos > -1) {
|
559
|
+
var tests = getTests(pos);
|
560
|
+
return tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0);
|
561
|
+
}
|
562
|
+
return !1;
|
563
|
+
}
|
564
|
+
function seekNext(pos, newBlock) {
|
565
|
+
var maskL = getMaskSet().maskLength;
|
566
|
+
if (pos >= maskL) return maskL;
|
567
|
+
var position = pos;
|
568
|
+
for (getTests(maskL + 1).length > 1 && (getMaskTemplate(!0, maskL + 1, !0), maskL = getMaskSet().maskLength); ++position < maskL && (!0 === newBlock && (!0 !== getTest(position).match.newBlockMarker || !isMask(position)) || !0 !== newBlock && !isMask(position)); ) ;
|
569
|
+
return position;
|
570
|
+
}
|
571
|
+
function seekPrevious(pos, newBlock) {
|
572
|
+
var tests, position = pos;
|
573
|
+
if (position <= 0) return 0;
|
574
|
+
for (;--position > 0 && (!0 === newBlock && !0 !== getTest(position).match.newBlockMarker || !0 !== newBlock && !isMask(position) && (tests = getTests(position),
|
575
|
+
tests.length < 2 || 2 === tests.length && "" === tests[1].match.def)); ) ;
|
576
|
+
return position;
|
577
|
+
}
|
578
|
+
function getBufferElement(position) {
|
579
|
+
return getMaskSet().validPositions[position] === undefined ? getPlaceholder(position) : getMaskSet().validPositions[position].input;
|
580
|
+
}
|
581
|
+
function writeBuffer(input, buffer, caretPos, event, triggerInputEvent) {
|
582
|
+
if (event && $.isFunction(opts.onBeforeWrite)) {
|
583
|
+
var result = opts.onBeforeWrite.call(inputmask, event, buffer, caretPos, opts);
|
584
|
+
if (result) {
|
585
|
+
if (result.refreshFromBuffer) {
|
586
|
+
var refresh = result.refreshFromBuffer;
|
587
|
+
refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, result.buffer || buffer),
|
588
|
+
buffer = getBuffer(!0);
|
589
|
+
}
|
590
|
+
caretPos !== undefined && (caretPos = result.caret !== undefined ? result.caret : caretPos);
|
591
|
+
}
|
592
|
+
}
|
593
|
+
input !== undefined && (input.inputmask._valueSet(buffer.join("")), caretPos === undefined || event !== undefined && "blur" === event.type ? renderColorMask(input, caretPos, 0 === buffer.length) : android && event && "input" === event.type ? setTimeout(function() {
|
594
|
+
caret(input, caretPos);
|
595
|
+
}, 0) : caret(input, caretPos), !0 === triggerInputEvent && (skipInputEvent = !0,
|
596
|
+
$(input).trigger("input")));
|
597
|
+
}
|
598
|
+
function getPlaceholder(pos, test, returnPL) {
|
599
|
+
if (test = test || getTest(pos).match, test.placeholder !== undefined || !0 === returnPL) return $.isFunction(test.placeholder) ? test.placeholder(opts) : test.placeholder;
|
600
|
+
if (null === test.fn) {
|
601
|
+
if (pos > -1 && getMaskSet().validPositions[pos] === undefined) {
|
602
|
+
var prevTest, tests = getTests(pos), staticAlternations = [];
|
603
|
+
if (tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0)) for (var i = 0; i < tests.length; i++) if (!0 !== tests[i].match.optionality && !0 !== tests[i].match.optionalQuantifier && (null === tests[i].match.fn || prevTest === undefined || !1 !== tests[i].match.fn.test(prevTest.match.def, getMaskSet(), pos, !0, opts)) && (staticAlternations.push(tests[i]),
|
604
|
+
null === tests[i].match.fn && (prevTest = tests[i]), staticAlternations.length > 1 && /[0-9a-bA-Z]/.test(staticAlternations[0].match.def))) return opts.placeholder.charAt(pos % opts.placeholder.length);
|
605
|
+
}
|
606
|
+
return test.def;
|
607
|
+
}
|
608
|
+
return opts.placeholder.charAt(pos % opts.placeholder.length);
|
609
|
+
}
|
610
|
+
function checkVal(input, writeOut, strict, nptvl, initiatingEvent) {
|
611
|
+
function isTemplateMatch(ndx, charCodes) {
|
612
|
+
return -1 !== getBufferTemplate().slice(ndx, seekNext(ndx)).join("").indexOf(charCodes) && !isMask(ndx) && getTest(ndx).match.nativeDef === charCodes.charAt(charCodes.length - 1);
|
613
|
+
}
|
614
|
+
var inputValue = nptvl.slice(), charCodes = "", initialNdx = -1, result = undefined;
|
615
|
+
if (resetMaskSet(), strict || !0 === opts.autoUnmask) initialNdx = seekNext(initialNdx); else {
|
616
|
+
var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
|
617
|
+
matches && matches.length > 0 && (inputValue.splice(0, matches.length * staticInput.length),
|
618
|
+
initialNdx = seekNext(initialNdx));
|
619
|
+
}
|
620
|
+
if (-1 === initialNdx ? (getMaskSet().p = seekNext(initialNdx), initialNdx = 0) : getMaskSet().p = initialNdx,
|
621
|
+
$.each(inputValue, function(ndx, charCode) {
|
622
|
+
if (charCode !== undefined) if (getMaskSet().validPositions[ndx] === undefined && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, undefined, undefined, !0)) getMaskSet().p++; else {
|
623
|
+
var keypress = new $.Event("_checkval");
|
624
|
+
keypress.which = charCode.charCodeAt(0), charCodes += charCode;
|
625
|
+
var lvp = getLastValidPosition(undefined, !0), lvTest = getMaskSet().validPositions[lvp], nextTest = getTestTemplate(lvp + 1, lvTest ? lvTest.locator.slice() : undefined, lvp);
|
626
|
+
if (!isTemplateMatch(initialNdx, charCodes) || strict || opts.autoUnmask) {
|
627
|
+
var pos = strict ? ndx : null == nextTest.match.fn && nextTest.match.optionality && lvp + 1 < getMaskSet().p ? lvp + 1 : getMaskSet().p;
|
628
|
+
result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, pos),
|
629
|
+
initialNdx = pos + 1, charCodes = "";
|
630
|
+
} else result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, !0, lvp + 1);
|
631
|
+
if (!1 !== result && !strict && $.isFunction(opts.onBeforeWrite)) {
|
632
|
+
var origResult = result;
|
633
|
+
if (result = opts.onBeforeWrite.call(inputmask, keypress, getBuffer(), result.forwardPosition, opts),
|
634
|
+
(result = $.extend(origResult, result)) && result.refreshFromBuffer) {
|
635
|
+
var refresh = result.refreshFromBuffer;
|
636
|
+
refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, result.buffer),
|
637
|
+
resetMaskSet(!0), result.caret && (getMaskSet().p = result.caret, result.forwardPosition = result.caret);
|
638
|
+
}
|
639
|
+
}
|
640
|
+
}
|
641
|
+
}), writeOut) {
|
642
|
+
var caretPos = undefined;
|
643
|
+
document.activeElement === input && result && (caretPos = opts.numericInput ? seekPrevious(result.forwardPosition) : result.forwardPosition),
|
644
|
+
writeBuffer(input, getBuffer(), caretPos, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type);
|
645
|
+
}
|
646
|
+
}
|
647
|
+
function unmaskedvalue(input) {
|
648
|
+
if (input) {
|
649
|
+
if (input.inputmask === undefined) return input.value;
|
650
|
+
input.inputmask && input.inputmask.refreshValue && EventHandlers.setValueEvent.call(input);
|
651
|
+
}
|
652
|
+
var umValue = [], vps = getMaskSet().validPositions;
|
653
|
+
for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
|
654
|
+
var unmaskedValue = 0 === umValue.length ? "" : (isRTL ? umValue.reverse() : umValue).join("");
|
655
|
+
if ($.isFunction(opts.onUnMask)) {
|
656
|
+
var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
|
657
|
+
unmaskedValue = opts.onUnMask.call(inputmask, bufferValue, unmaskedValue, opts);
|
658
|
+
}
|
659
|
+
return unmaskedValue;
|
660
|
+
}
|
661
|
+
function caret(input, begin, end, notranslate) {
|
662
|
+
function translatePosition(pos) {
|
663
|
+
if (!0 !== notranslate && isRTL && "number" == typeof pos && (!opts.greedy || "" !== opts.placeholder)) {
|
664
|
+
pos = getBuffer().join("").length - pos;
|
665
|
+
}
|
666
|
+
return pos;
|
667
|
+
}
|
668
|
+
var range;
|
669
|
+
if (begin === undefined) return input.setSelectionRange ? (begin = input.selectionStart,
|
670
|
+
end = input.selectionEnd) : window.getSelection ? (range = window.getSelection().getRangeAt(0),
|
671
|
+
range.commonAncestorContainer.parentNode !== input && range.commonAncestorContainer !== input || (begin = range.startOffset,
|
672
|
+
end = range.endOffset)) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
|
673
|
+
begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length),
|
674
|
+
end = begin + range.text.length), {
|
675
|
+
begin: translatePosition(begin),
|
676
|
+
end: translatePosition(end)
|
677
|
+
};
|
678
|
+
if (begin.begin !== undefined && (end = begin.end, begin = begin.begin), "number" == typeof begin) {
|
679
|
+
begin = translatePosition(begin), end = translatePosition(end), end = "number" == typeof end ? end : begin;
|
680
|
+
var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end;
|
681
|
+
if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, mobile || !1 !== opts.insertMode || begin !== end || end++,
|
682
|
+
input.setSelectionRange) input.selectionStart = begin, input.selectionEnd = end; else if (window.getSelection) {
|
683
|
+
if (range = document.createRange(), input.firstChild === undefined || null === input.firstChild) {
|
684
|
+
var textNode = document.createTextNode("");
|
685
|
+
input.appendChild(textNode);
|
686
|
+
}
|
687
|
+
range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length),
|
688
|
+
range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length),
|
689
|
+
range.collapse(!0);
|
690
|
+
var sel = window.getSelection();
|
691
|
+
sel.removeAllRanges(), sel.addRange(range);
|
692
|
+
} else input.createTextRange && (range = input.createTextRange(), range.collapse(!0),
|
693
|
+
range.moveEnd("character", end), range.moveStart("character", begin), range.select());
|
694
|
+
renderColorMask(input, {
|
695
|
+
begin: begin,
|
696
|
+
end: end
|
697
|
+
});
|
698
|
+
}
|
699
|
+
}
|
700
|
+
function determineLastRequiredPosition(returnDefinition) {
|
701
|
+
var pos, testPos, buffer = getBuffer(), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = lvTest !== undefined ? lvTest.locator.slice() : undefined;
|
702
|
+
for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
703
|
+
ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos);
|
704
|
+
var lvTestAlt = lvTest && lvTest.alternation !== undefined ? lvTest.locator[lvTest.alternation] : undefined;
|
705
|
+
for (pos = bl - 1; pos > lvp && (testPos = positions[pos], (testPos.match.optionality || testPos.match.optionalQuantifier && testPos.match.newBlockMarker || lvTestAlt && (lvTestAlt !== positions[pos].locator[lvTest.alternation] && null != testPos.match.fn || null === testPos.match.fn && testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAlt.toString().split(",")) && "" !== getTests(pos)[0].def)) && buffer[pos] === getPlaceholder(pos, testPos.match)); pos--) bl--;
|
706
|
+
return returnDefinition ? {
|
707
|
+
l: bl,
|
708
|
+
def: positions[bl] ? positions[bl].match : undefined
|
709
|
+
} : bl;
|
710
|
+
}
|
711
|
+
function clearOptionalTail(buffer) {
|
712
|
+
for (var validPos, rl = determineLastRequiredPosition(), bl = buffer.length, lv = getMaskSet().validPositions[getLastValidPosition()]; rl < bl && !isMask(rl, !0) && (validPos = lv !== undefined ? getTestTemplate(rl, lv.locator.slice(""), lv) : getTest(rl)) && !0 !== validPos.match.optionality && (!0 !== validPos.match.optionalQuantifier && !0 !== validPos.match.newBlockMarker || rl + 1 === bl && "" === (lv !== undefined ? getTestTemplate(rl + 1, lv.locator.slice(""), lv) : getTest(rl + 1)).match.def); ) rl++;
|
713
|
+
for (;(validPos = getMaskSet().validPositions[rl - 1]) && validPos && validPos.match.optionality && validPos.input === opts.skipOptionalPartCharacter; ) rl--;
|
714
|
+
return buffer.splice(rl), buffer;
|
715
|
+
}
|
716
|
+
function isComplete(buffer) {
|
717
|
+
if ($.isFunction(opts.isComplete)) return opts.isComplete(buffer, opts);
|
718
|
+
if ("*" === opts.repeat) return undefined;
|
719
|
+
var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l);
|
720
|
+
if (lrp.def === undefined || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) {
|
721
|
+
complete = !0;
|
722
|
+
for (var i = 0; i <= aml; i++) {
|
723
|
+
var test = getTestTemplate(i).match;
|
724
|
+
if (null !== test.fn && getMaskSet().validPositions[i] === undefined && !0 !== test.optionality && !0 !== test.optionalQuantifier || null === test.fn && buffer[i] !== getPlaceholder(i, test)) {
|
725
|
+
complete = !1;
|
726
|
+
break;
|
727
|
+
}
|
728
|
+
}
|
729
|
+
}
|
730
|
+
return complete;
|
731
|
+
}
|
732
|
+
function handleRemove(input, k, pos, strict, fromIsValid) {
|
733
|
+
if ((opts.numericInput || isRTL) && (k === Inputmask.keyCode.BACKSPACE ? k = Inputmask.keyCode.DELETE : k === Inputmask.keyCode.DELETE && (k = Inputmask.keyCode.BACKSPACE),
|
734
|
+
isRTL)) {
|
735
|
+
var pend = pos.end;
|
736
|
+
pos.end = pos.begin, pos.begin = pend;
|
737
|
+
}
|
738
|
+
k === Inputmask.keyCode.BACKSPACE && (pos.end - pos.begin < 1 || !1 === opts.insertMode) ? (pos.begin = seekPrevious(pos.begin),
|
739
|
+
getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end, !0) && getMaskSet().validPositions[pos.end] && getMaskSet().validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1,
|
740
|
+
getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.end++),
|
741
|
+
stripValidPositions(pos.begin, pos.end, !1, strict), !0 !== strict && function() {
|
742
|
+
if (opts.keepStatic) {
|
743
|
+
for (var validInputs = [], lastAlt = getLastValidPosition(-1, !0), positionsClone = $.extend(!0, {}, getMaskSet().validPositions), prevAltPos = getMaskSet().validPositions[lastAlt]; lastAlt >= 0; lastAlt--) {
|
744
|
+
var altPos = getMaskSet().validPositions[lastAlt];
|
745
|
+
if (altPos) {
|
746
|
+
if (!0 !== altPos.generatedInput && /[0-9a-bA-Z]/.test(altPos.input) && validInputs.push(altPos.input),
|
747
|
+
delete getMaskSet().validPositions[lastAlt], altPos.alternation !== undefined && altPos.locator[altPos.alternation] !== prevAltPos.locator[altPos.alternation]) break;
|
748
|
+
prevAltPos = altPos;
|
749
|
+
}
|
750
|
+
}
|
751
|
+
if (lastAlt > -1) for (getMaskSet().p = seekNext(getLastValidPosition(-1, !0)); validInputs.length > 0; ) {
|
752
|
+
var keypress = new $.Event("keypress");
|
753
|
+
keypress.which = validInputs.pop().charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !1, !1, getMaskSet().p);
|
754
|
+
} else getMaskSet().validPositions = $.extend(!0, {}, positionsClone);
|
755
|
+
}
|
756
|
+
}();
|
757
|
+
var lvp = getLastValidPosition(pos.begin, !0);
|
758
|
+
if (lvp < pos.begin) getMaskSet().p = seekNext(lvp); else if (!0 !== strict && (getMaskSet().p = pos.begin,
|
759
|
+
!0 !== fromIsValid)) for (;getMaskSet().p < lvp && getMaskSet().validPositions[getMaskSet().p] === undefined; ) getMaskSet().p++;
|
760
|
+
}
|
761
|
+
function initializeColorMask(input) {
|
762
|
+
function findCaretPos(clientx) {
|
763
|
+
var caretPos, e = document.createElement("span");
|
764
|
+
for (var style in computedStyle) isNaN(style) && -1 !== style.indexOf("font") && (e.style[style] = computedStyle[style]);
|
765
|
+
e.style.textTransform = computedStyle.textTransform, e.style.letterSpacing = computedStyle.letterSpacing,
|
766
|
+
e.style.position = "absolute", e.style.height = "auto", e.style.width = "auto",
|
767
|
+
e.style.visibility = "hidden", e.style.whiteSpace = "nowrap", document.body.appendChild(e);
|
768
|
+
var itl, inputText = input.inputmask._valueGet(), previousWidth = 0;
|
769
|
+
for (caretPos = 0, itl = inputText.length; caretPos <= itl; caretPos++) {
|
770
|
+
if (e.innerHTML += inputText.charAt(caretPos) || "_", e.offsetWidth >= clientx) {
|
771
|
+
var offset1 = clientx - previousWidth, offset2 = e.offsetWidth - clientx;
|
772
|
+
e.innerHTML = inputText.charAt(caretPos), offset1 -= e.offsetWidth / 3, caretPos = offset1 < offset2 ? caretPos - 1 : caretPos;
|
773
|
+
break;
|
774
|
+
}
|
775
|
+
previousWidth = e.offsetWidth;
|
776
|
+
}
|
777
|
+
return document.body.removeChild(e), caretPos;
|
778
|
+
}
|
779
|
+
var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null), template = document.createElement("div");
|
780
|
+
template.style.width = computedStyle.width, template.style.textAlign = computedStyle.textAlign,
|
781
|
+
colorMask = document.createElement("div"), colorMask.className = "im-colormask",
|
782
|
+
input.parentNode.insertBefore(colorMask, input), input.parentNode.removeChild(input),
|
783
|
+
colorMask.appendChild(template), colorMask.appendChild(input), input.style.left = template.offsetLeft + "px",
|
784
|
+
$(input).on("click", function(e) {
|
785
|
+
return caret(input, findCaretPos(e.clientX)), EventHandlers.clickEvent.call(input, [ e ]);
|
786
|
+
}), $(input).on("keydown", function(e) {
|
787
|
+
e.shiftKey || !1 === opts.insertMode || setTimeout(function() {
|
788
|
+
renderColorMask(input);
|
789
|
+
}, 0);
|
790
|
+
});
|
791
|
+
}
|
792
|
+
function renderColorMask(input, caretPos, clear) {
|
793
|
+
function handleStatic() {
|
794
|
+
isStatic || null !== test.fn && testPos.input !== undefined ? isStatic && (null !== test.fn && testPos.input !== undefined || "" === test.def) && (isStatic = !1,
|
795
|
+
maskTemplate += "</span>") : (isStatic = !0, maskTemplate += "<span class='im-static'>");
|
796
|
+
}
|
797
|
+
function handleCaret(force) {
|
798
|
+
!0 !== force && pos !== caretPos.begin || document.activeElement !== input || (maskTemplate += "<span class='im-caret' style='border-right-width: 1px;border-right-style: solid;'></span>");
|
799
|
+
}
|
800
|
+
var test, testPos, ndxIntlzr, maskTemplate = "", isStatic = !1, pos = 0;
|
801
|
+
if (colorMask !== undefined) {
|
802
|
+
var buffer = getBuffer();
|
803
|
+
if (caretPos === undefined ? caretPos = caret(input) : caretPos.begin === undefined && (caretPos = {
|
804
|
+
begin: caretPos,
|
805
|
+
end: caretPos
|
806
|
+
}), !0 !== clear) {
|
807
|
+
var lvp = getLastValidPosition();
|
808
|
+
do {
|
809
|
+
handleCaret(), getMaskSet().validPositions[pos] ? (testPos = getMaskSet().validPositions[pos],
|
810
|
+
test = testPos.match, ndxIntlzr = testPos.locator.slice(), handleStatic(), maskTemplate += buffer[pos]) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
811
|
+
test = testPos.match, ndxIntlzr = testPos.locator.slice(), (!1 === opts.jitMasking || pos < lvp || "number" == typeof opts.jitMasking && isFinite(opts.jitMasking) && opts.jitMasking > pos) && (handleStatic(),
|
812
|
+
maskTemplate += getPlaceholder(pos, test))), pos++;
|
813
|
+
} while ((maxLength === undefined || pos < maxLength) && (null !== test.fn || "" !== test.def) || lvp > pos || isStatic);
|
814
|
+
-1 === maskTemplate.indexOf("im-caret") && handleCaret(!0), isStatic && handleStatic();
|
815
|
+
}
|
816
|
+
var template = colorMask.getElementsByTagName("div")[0];
|
817
|
+
template.innerHTML = maskTemplate, input.inputmask.positionColorMask(input, template);
|
818
|
+
}
|
819
|
+
}
|
820
|
+
maskset = maskset || this.maskset, opts = opts || this.opts;
|
821
|
+
var undoValue, $el, maxLength, colorMask, inputmask = this, el = this.el, isRTL = this.isRTL, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !1, EventRuler = {
|
822
|
+
on: function(input, eventName, eventHandler) {
|
823
|
+
var ev = function(e) {
|
824
|
+
if (this.inputmask === undefined && "FORM" !== this.nodeName) {
|
825
|
+
var imOpts = $.data(this, "_inputmask_opts");
|
826
|
+
imOpts ? new Inputmask(imOpts).mask(this) : EventRuler.off(this);
|
827
|
+
} else {
|
828
|
+
if ("setvalue" === e.type || "FORM" === this.nodeName || !(this.disabled || this.readOnly && !("keydown" === e.type && e.ctrlKey && 67 === e.keyCode || !1 === opts.tabThrough && e.keyCode === Inputmask.keyCode.TAB))) {
|
829
|
+
switch (e.type) {
|
830
|
+
case "input":
|
831
|
+
if (!0 === skipInputEvent) return skipInputEvent = !1, e.preventDefault();
|
832
|
+
break;
|
833
|
+
|
834
|
+
case "keydown":
|
835
|
+
skipKeyPressEvent = !1, skipInputEvent = !1;
|
836
|
+
break;
|
837
|
+
|
838
|
+
case "keypress":
|
839
|
+
if (!0 === skipKeyPressEvent) return e.preventDefault();
|
840
|
+
skipKeyPressEvent = !0;
|
841
|
+
break;
|
842
|
+
|
843
|
+
case "click":
|
844
|
+
if (iemobile || iphone) {
|
845
|
+
var that = this, args = arguments;
|
846
|
+
return setTimeout(function() {
|
847
|
+
eventHandler.apply(that, args);
|
848
|
+
}, 0), !1;
|
849
|
+
}
|
850
|
+
}
|
851
|
+
var returnVal = eventHandler.apply(this, arguments);
|
852
|
+
return !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal;
|
853
|
+
}
|
854
|
+
e.preventDefault();
|
855
|
+
}
|
856
|
+
};
|
857
|
+
input.inputmask.events[eventName] = input.inputmask.events[eventName] || [], input.inputmask.events[eventName].push(ev),
|
858
|
+
-1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).on(eventName, ev) : $(input).on(eventName, ev);
|
859
|
+
},
|
860
|
+
off: function(input, event) {
|
861
|
+
if (input.inputmask && input.inputmask.events) {
|
862
|
+
var events;
|
863
|
+
event ? (events = [], events[event] = input.inputmask.events[event]) : events = input.inputmask.events,
|
864
|
+
$.each(events, function(eventName, evArr) {
|
865
|
+
for (;evArr.length > 0; ) {
|
866
|
+
var ev = evArr.pop();
|
867
|
+
-1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).off(eventName, ev) : $(input).off(eventName, ev);
|
868
|
+
}
|
869
|
+
delete input.inputmask.events[eventName];
|
870
|
+
});
|
871
|
+
}
|
872
|
+
}
|
873
|
+
}, EventHandlers = {
|
874
|
+
keydownEvent: function(e) {
|
875
|
+
var input = this, $input = $(input), k = e.keyCode, pos = caret(input);
|
876
|
+
if (k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && k === Inputmask.keyCode.BACKSPACE_SAFARI || e.ctrlKey && k === Inputmask.keyCode.X && !function(eventName) {
|
877
|
+
var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el;
|
878
|
+
return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]),
|
879
|
+
el = null, isSupported;
|
880
|
+
}("cut")) e.preventDefault(), handleRemove(input, k, pos), writeBuffer(input, getBuffer(!0), getMaskSet().p, e, input.inputmask._valueGet() !== getBuffer().join("")),
|
881
|
+
input.inputmask._valueGet() === getBufferTemplate().join("") ? $input.trigger("cleared") : !0 === isComplete(getBuffer()) && $input.trigger("complete"); else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) {
|
882
|
+
e.preventDefault();
|
883
|
+
var caretPos = seekNext(getLastValidPosition());
|
884
|
+
opts.insertMode || caretPos !== getMaskSet().maskLength || e.shiftKey || caretPos--,
|
885
|
+
caret(input, e.shiftKey ? pos.begin : caretPos, caretPos, !0);
|
886
|
+
} else k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP ? (e.preventDefault(),
|
887
|
+
caret(input, 0, e.shiftKey ? pos.begin : 0, !0)) : (opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE || 90 === k && e.ctrlKey) && !0 !== e.altKey ? (checkVal(input, !0, !1, undoValue.split("")),
|
888
|
+
$input.trigger("click")) : k !== Inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? !0 === opts.tabThrough && k === Inputmask.keyCode.TAB ? (!0 === e.shiftKey ? (null === getTest(pos.begin).match.fn && (pos.begin = seekNext(pos.begin)),
|
889
|
+
pos.end = seekPrevious(pos.begin, !0), pos.begin = seekPrevious(pos.end, !0)) : (pos.begin = seekNext(pos.begin, !0),
|
890
|
+
pos.end = seekNext(pos.begin, !0), pos.end < getMaskSet().maskLength && pos.end--),
|
891
|
+
pos.begin < getMaskSet().maskLength && (e.preventDefault(), caret(input, pos.begin, pos.end))) : e.shiftKey || !1 === opts.insertMode && (k === Inputmask.keyCode.RIGHT ? setTimeout(function() {
|
892
|
+
var caretPos = caret(input);
|
893
|
+
caret(input, caretPos.begin);
|
894
|
+
}, 0) : k === Inputmask.keyCode.LEFT && setTimeout(function() {
|
895
|
+
var caretPos = caret(input);
|
896
|
+
caret(input, isRTL ? caretPos.begin + 1 : caretPos.begin - 1);
|
897
|
+
}, 0)) : (opts.insertMode = !opts.insertMode, caret(input, opts.insertMode || pos.begin !== getMaskSet().maskLength ? pos.begin : pos.begin - 1));
|
898
|
+
opts.onKeyDown.call(this, e, getBuffer(), caret(input).begin, opts), ignorable = -1 !== $.inArray(k, opts.ignorables);
|
899
|
+
},
|
900
|
+
keypressEvent: function(e, checkval, writeOut, strict, ndx) {
|
901
|
+
var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode;
|
902
|
+
if (!(!0 === checkval || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""),
|
903
|
+
setTimeout(function() {
|
904
|
+
$input.trigger("change");
|
905
|
+
}, 0)), !0;
|
906
|
+
if (k) {
|
907
|
+
46 === k && !1 === e.shiftKey && "" !== opts.radixPoint && (k = opts.radixPoint.charCodeAt(0));
|
908
|
+
var forwardPosition, pos = checkval ? {
|
909
|
+
begin: ndx,
|
910
|
+
end: ndx
|
911
|
+
} : caret(input), c = String.fromCharCode(k);
|
912
|
+
getMaskSet().writeOutBuffer = !0;
|
913
|
+
var valResult = isValid(pos, c, strict);
|
914
|
+
if (!1 !== valResult && (resetMaskSet(!0), forwardPosition = valResult.caret !== undefined ? valResult.caret : checkval ? valResult.pos + 1 : seekNext(valResult.pos),
|
915
|
+
getMaskSet().p = forwardPosition), !1 !== writeOut && (setTimeout(function() {
|
916
|
+
opts.onKeyValidation.call(input, k, valResult, opts);
|
917
|
+
}, 0), getMaskSet().writeOutBuffer && !1 !== valResult)) {
|
918
|
+
var buffer = getBuffer();
|
919
|
+
writeBuffer(input, buffer, opts.numericInput && valResult.caret === undefined ? seekPrevious(forwardPosition) : forwardPosition, e, !0 !== checkval),
|
920
|
+
!0 !== checkval && setTimeout(function() {
|
921
|
+
!0 === isComplete(buffer) && $input.trigger("complete");
|
922
|
+
}, 0);
|
923
|
+
}
|
924
|
+
if (e.preventDefault(), checkval) return !1 !== valResult && (valResult.forwardPosition = forwardPosition),
|
925
|
+
valResult;
|
926
|
+
}
|
927
|
+
},
|
928
|
+
pasteEvent: function(e) {
|
929
|
+
var tempValue, input = this, ev = e.originalEvent || e, $input = $(input), inputValue = input.inputmask._valueGet(!0), caretPos = caret(input);
|
930
|
+
isRTL && (tempValue = caretPos.end, caretPos.end = caretPos.begin, caretPos.begin = tempValue);
|
931
|
+
var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
|
932
|
+
if (valueBeforeCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""),
|
933
|
+
valueAfterCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(caretPos.end).join("") && (valueAfterCaret = ""),
|
934
|
+
isRTL && (tempValue = valueBeforeCaret, valueBeforeCaret = valueAfterCaret, valueAfterCaret = tempValue),
|
935
|
+
window.clipboardData && window.clipboardData.getData) inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret; else {
|
936
|
+
if (!ev.clipboardData || !ev.clipboardData.getData) return !0;
|
937
|
+
inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret;
|
938
|
+
}
|
939
|
+
var pasteValue = inputValue;
|
940
|
+
if ($.isFunction(opts.onBeforePaste)) {
|
941
|
+
if (!1 === (pasteValue = opts.onBeforePaste.call(inputmask, inputValue, opts))) return e.preventDefault();
|
942
|
+
pasteValue || (pasteValue = inputValue);
|
943
|
+
}
|
944
|
+
return checkVal(input, !1, !1, isRTL ? pasteValue.split("").reverse() : pasteValue.toString().split("")),
|
945
|
+
writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join("")),
|
946
|
+
!0 === isComplete(getBuffer()) && $input.trigger("complete"), e.preventDefault();
|
947
|
+
},
|
948
|
+
inputFallBackEvent: function(e) {
|
949
|
+
var input = this, inputValue = input.inputmask._valueGet();
|
950
|
+
if (getBuffer().join("") !== inputValue) {
|
951
|
+
var caretPos = caret(input);
|
952
|
+
if (!1 === function(input, inputValue, caretPos) {
|
953
|
+
if ("." === inputValue.charAt(caretPos.begin - 1) && "" !== opts.radixPoint && (inputValue = inputValue.split(""),
|
954
|
+
inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0), inputValue = inputValue.join("")),
|
955
|
+
inputValue.charAt(caretPos.begin - 1) === opts.radixPoint && inputValue.length > getBuffer().length) {
|
956
|
+
var keypress = new $.Event("keypress");
|
957
|
+
return keypress.which = opts.radixPoint.charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !0, !1, caretPos.begin - 1),
|
958
|
+
!1;
|
959
|
+
}
|
960
|
+
}(input, inputValue, caretPos)) return !1;
|
961
|
+
if (inputValue = inputValue.replace(new RegExp("(" + Inputmask.escapeRegex(getBufferTemplate().join("")) + ")*"), ""),
|
962
|
+
!1 === function(input, inputValue, caretPos) {
|
963
|
+
if (iemobile) {
|
964
|
+
var inputChar = inputValue.replace(getBuffer().join(""), "");
|
965
|
+
if (1 === inputChar.length) {
|
966
|
+
var keypress = new $.Event("keypress");
|
967
|
+
return keypress.which = inputChar.charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !0, !1, getMaskSet().validPositions[caretPos.begin - 1] ? caretPos.begin : caretPos.begin - 1),
|
968
|
+
!1;
|
969
|
+
}
|
970
|
+
}
|
971
|
+
}(input, inputValue, caretPos)) return !1;
|
972
|
+
caretPos.begin > inputValue.length && (caret(input, inputValue.length), caretPos = caret(input));
|
973
|
+
var buffer = getBuffer().join(""), frontPart = inputValue.substr(0, caretPos.begin), backPart = inputValue.substr(caretPos.begin), frontBufferPart = buffer.substr(0, caretPos.begin), backBufferPart = buffer.substr(caretPos.begin), selection = caretPos, entries = "", isEntry = !1;
|
974
|
+
if (frontPart !== frontBufferPart) {
|
975
|
+
selection.begin = 0;
|
976
|
+
for (var fpl = (isEntry = frontPart.length >= frontBufferPart.length) ? frontPart.length : frontBufferPart.length, i = 0; frontPart.charAt(i) === frontBufferPart.charAt(i) && i < fpl; i++) selection.begin++;
|
977
|
+
isEntry && (entries += frontPart.slice(selection.begin, selection.end));
|
978
|
+
}
|
979
|
+
backPart !== backBufferPart && (backPart.length > backBufferPart.length ? isEntry && (selection.end = selection.begin) : backPart.length < backBufferPart.length ? selection.end += backBufferPart.length - backPart.length : backPart.charAt(0) !== backBufferPart.charAt(0) && selection.end++),
|
980
|
+
writeBuffer(input, getBuffer(), selection), entries.length > 0 ? $.each(entries.split(""), function(ndx, entry) {
|
981
|
+
var keypress = new $.Event("keypress");
|
982
|
+
keypress.which = entry.charCodeAt(0), ignorable = !1, EventHandlers.keypressEvent.call(input, keypress);
|
983
|
+
}) : (selection.begin === selection.end - 1 && caret(input, seekPrevious(selection.begin + 1), selection.end),
|
984
|
+
e.keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, e)),
|
985
|
+
e.preventDefault();
|
986
|
+
}
|
987
|
+
},
|
988
|
+
setValueEvent: function(e) {
|
989
|
+
this.inputmask.refreshValue = !1;
|
990
|
+
var input = this, value = input.inputmask._valueGet(!0);
|
991
|
+
$.isFunction(opts.onBeforeMask) && (value = opts.onBeforeMask.call(inputmask, value, opts) || value),
|
992
|
+
value = value.split(""), checkVal(input, !0, !1, isRTL ? value.reverse() : value),
|
993
|
+
undoValue = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && input.inputmask._valueSet("");
|
994
|
+
},
|
995
|
+
focusEvent: function(e) {
|
996
|
+
var input = this, nptValue = input.inputmask._valueGet();
|
997
|
+
opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" === nptValue) && (input.inputmask._valueGet() !== getBuffer().join("") ? writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : !1 === mouseEnter && caret(input, seekNext(getLastValidPosition()))),
|
998
|
+
!0 === opts.positionCaretOnTab && !1 === mouseEnter && "" !== nptValue && (writeBuffer(input, getBuffer(), caret(input)),
|
999
|
+
EventHandlers.clickEvent.apply(input, [ e, !0 ])), undoValue = getBuffer().join("");
|
1000
|
+
},
|
1001
|
+
mouseleaveEvent: function(e) {
|
1002
|
+
var input = this;
|
1003
|
+
if (mouseEnter = !1, opts.clearMaskOnLostFocus && document.activeElement !== input) {
|
1004
|
+
var buffer = getBuffer().slice(), nptValue = input.inputmask._valueGet();
|
1005
|
+
nptValue !== input.getAttribute("placeholder") && "" !== nptValue && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer),
|
1006
|
+
writeBuffer(input, buffer));
|
1007
|
+
}
|
1008
|
+
},
|
1009
|
+
clickEvent: function(e, tabbed) {
|
1010
|
+
function doRadixFocus(clickPos) {
|
1011
|
+
if ("" !== opts.radixPoint) {
|
1012
|
+
var vps = getMaskSet().validPositions;
|
1013
|
+
if (vps[clickPos] === undefined || vps[clickPos].input === getPlaceholder(clickPos)) {
|
1014
|
+
if (clickPos < seekNext(-1)) return !0;
|
1015
|
+
var radixPos = $.inArray(opts.radixPoint, getBuffer());
|
1016
|
+
if (-1 !== radixPos) {
|
1017
|
+
for (var vp in vps) if (radixPos < vp && vps[vp].input !== getPlaceholder(vp)) return !1;
|
1018
|
+
return !0;
|
1019
|
+
}
|
1020
|
+
}
|
1021
|
+
}
|
1022
|
+
return !1;
|
1023
|
+
}
|
1024
|
+
var input = this;
|
1025
|
+
setTimeout(function() {
|
1026
|
+
if (document.activeElement === input) {
|
1027
|
+
var selectedCaret = caret(input);
|
1028
|
+
if (tabbed && (isRTL ? selectedCaret.end = selectedCaret.begin : selectedCaret.begin = selectedCaret.end),
|
1029
|
+
selectedCaret.begin === selectedCaret.end) switch (opts.positionCaretOnClick) {
|
1030
|
+
case "none":
|
1031
|
+
break;
|
1032
|
+
|
1033
|
+
case "radixFocus":
|
1034
|
+
if (doRadixFocus(selectedCaret.begin)) {
|
1035
|
+
var radixPos = getBuffer().join("").indexOf(opts.radixPoint);
|
1036
|
+
caret(input, opts.numericInput ? seekNext(radixPos) : radixPos);
|
1037
|
+
break;
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
default:
|
1041
|
+
var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, !0), lastPosition = seekNext(lvclickPosition);
|
1042
|
+
if (clickPosition < lastPosition) caret(input, isMask(clickPosition, !0) || isMask(clickPosition - 1, !0) ? clickPosition : seekNext(clickPosition)); else {
|
1043
|
+
var lvp = getMaskSet().validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : undefined, lvp), placeholder = getPlaceholder(lastPosition, tt.match);
|
1044
|
+
if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask(lastPosition, !0) && tt.match.def === placeholder) {
|
1045
|
+
var newPos = seekNext(lastPosition);
|
1046
|
+
(clickPosition >= newPos || clickPosition === lastPosition) && (lastPosition = newPos);
|
1047
|
+
}
|
1048
|
+
caret(input, lastPosition);
|
1049
|
+
}
|
1050
|
+
}
|
1051
|
+
}
|
1052
|
+
}, 0);
|
1053
|
+
},
|
1054
|
+
dblclickEvent: function(e) {
|
1055
|
+
var input = this;
|
1056
|
+
setTimeout(function() {
|
1057
|
+
caret(input, 0, seekNext(getLastValidPosition()));
|
1058
|
+
}, 0);
|
1059
|
+
},
|
1060
|
+
cutEvent: function(e) {
|
1061
|
+
var input = this, $input = $(input), pos = caret(input), ev = e.originalEvent || e, clipboardData = window.clipboardData || ev.clipboardData, clipData = isRTL ? getBuffer().slice(pos.end, pos.begin) : getBuffer().slice(pos.begin, pos.end);
|
1062
|
+
clipboardData.setData("text", isRTL ? clipData.reverse().join("") : clipData.join("")),
|
1063
|
+
document.execCommand && document.execCommand("copy"), handleRemove(input, Inputmask.keyCode.DELETE, pos),
|
1064
|
+
writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")),
|
1065
|
+
input.inputmask._valueGet() === getBufferTemplate().join("") && $input.trigger("cleared");
|
1066
|
+
},
|
1067
|
+
blurEvent: function(e) {
|
1068
|
+
var $input = $(this), input = this;
|
1069
|
+
if (input.inputmask) {
|
1070
|
+
var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice();
|
1071
|
+
"" !== nptValue && (opts.clearMaskOnLostFocus && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)),
|
1072
|
+
!1 === isComplete(buffer) && (setTimeout(function() {
|
1073
|
+
$input.trigger("incomplete");
|
1074
|
+
}, 0), opts.clearIncomplete && (resetMaskSet(), buffer = opts.clearMaskOnLostFocus ? [] : getBufferTemplate().slice())),
|
1075
|
+
writeBuffer(input, buffer, undefined, e)), undoValue !== getBuffer().join("") && (undoValue = buffer.join(""),
|
1076
|
+
$input.trigger("change"));
|
1077
|
+
}
|
1078
|
+
},
|
1079
|
+
mouseenterEvent: function(e) {
|
1080
|
+
var input = this;
|
1081
|
+
mouseEnter = !0, document.activeElement !== input && opts.showMaskOnHover && input.inputmask._valueGet() !== getBuffer().join("") && writeBuffer(input, getBuffer());
|
1082
|
+
},
|
1083
|
+
submitEvent: function(e) {
|
1084
|
+
undoValue !== getBuffer().join("") && $el.trigger("change"), opts.clearMaskOnLostFocus && -1 === getLastValidPosition() && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("") && el.inputmask._valueSet(""),
|
1085
|
+
opts.removeMaskOnSubmit && (el.inputmask._valueSet(el.inputmask.unmaskedvalue(), !0),
|
1086
|
+
setTimeout(function() {
|
1087
|
+
writeBuffer(el, getBuffer());
|
1088
|
+
}, 0));
|
1089
|
+
},
|
1090
|
+
resetEvent: function(e) {
|
1091
|
+
el.inputmask.refreshValue = !0, setTimeout(function() {
|
1092
|
+
$el.trigger("setvalue");
|
1093
|
+
}, 0);
|
1094
|
+
}
|
1095
|
+
};
|
1096
|
+
Inputmask.prototype.positionColorMask = function(input, template) {
|
1097
|
+
input.style.left = template.offsetLeft + "px";
|
1098
|
+
};
|
1099
|
+
var valueBuffer;
|
1100
|
+
if (actionObj !== undefined) switch (actionObj.action) {
|
1101
|
+
case "isComplete":
|
1102
|
+
return el = actionObj.el, isComplete(getBuffer());
|
1103
|
+
|
1104
|
+
case "unmaskedvalue":
|
1105
|
+
return el !== undefined && actionObj.value === undefined || (valueBuffer = actionObj.value,
|
1106
|
+
valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, valueBuffer, opts) || valueBuffer : valueBuffer).split(""),
|
1107
|
+
checkVal(undefined, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(inputmask, undefined, getBuffer(), 0, opts)),
|
1108
|
+
unmaskedvalue(el);
|
1109
|
+
|
1110
|
+
case "mask":
|
1111
|
+
!function(elem) {
|
1112
|
+
EventRuler.off(elem);
|
1113
|
+
var isSupported = function(input, opts) {
|
1114
|
+
var elementType = input.getAttribute("type"), isSupported = "INPUT" === input.tagName && -1 !== $.inArray(elementType, opts.supportsInputType) || input.isContentEditable || "TEXTAREA" === input.tagName;
|
1115
|
+
if (!isSupported) if ("INPUT" === input.tagName) {
|
1116
|
+
var el = document.createElement("input");
|
1117
|
+
el.setAttribute("type", elementType), isSupported = "text" === el.type, el = null;
|
1118
|
+
} else isSupported = "partial";
|
1119
|
+
return !1 !== isSupported ? function(npt) {
|
1120
|
+
function getter() {
|
1121
|
+
return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : -1 !== getLastValidPosition() || !0 !== opts.nullable ? document.activeElement === this && opts.clearMaskOnLostFocus ? (isRTL ? clearOptionalTail(getBuffer().slice()).reverse() : clearOptionalTail(getBuffer().slice())).join("") : valueGet.call(this) : "" : valueGet.call(this);
|
1122
|
+
}
|
1123
|
+
function setter(value) {
|
1124
|
+
valueSet.call(this, value), this.inputmask && $(this).trigger("setvalue");
|
1125
|
+
}
|
1126
|
+
var valueGet, valueSet;
|
1127
|
+
if (!npt.inputmask.__valueGet) {
|
1128
|
+
if (!0 !== opts.noValuePatching) {
|
1129
|
+
if (Object.getOwnPropertyDescriptor) {
|
1130
|
+
"function" != typeof Object.getPrototypeOf && (Object.getPrototypeOf = "object" === _typeof("test".__proto__) ? function(object) {
|
1131
|
+
return object.__proto__;
|
1132
|
+
} : function(object) {
|
1133
|
+
return object.constructor.prototype;
|
1134
|
+
});
|
1135
|
+
var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : undefined;
|
1136
|
+
valueProperty && valueProperty.get && valueProperty.set ? (valueGet = valueProperty.get,
|
1137
|
+
valueSet = valueProperty.set, Object.defineProperty(npt, "value", {
|
1138
|
+
get: getter,
|
1139
|
+
set: setter,
|
1140
|
+
configurable: !0
|
1141
|
+
})) : "INPUT" !== npt.tagName && (valueGet = function() {
|
1142
|
+
return this.textContent;
|
1143
|
+
}, valueSet = function(value) {
|
1144
|
+
this.textContent = value;
|
1145
|
+
}, Object.defineProperty(npt, "value", {
|
1146
|
+
get: getter,
|
1147
|
+
set: setter,
|
1148
|
+
configurable: !0
|
1149
|
+
}));
|
1150
|
+
} else document.__lookupGetter__ && npt.__lookupGetter__("value") && (valueGet = npt.__lookupGetter__("value"),
|
1151
|
+
valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter),
|
1152
|
+
npt.__defineSetter__("value", setter));
|
1153
|
+
npt.inputmask.__valueGet = valueGet, npt.inputmask.__valueSet = valueSet;
|
1154
|
+
}
|
1155
|
+
npt.inputmask._valueGet = function(overruleRTL) {
|
1156
|
+
return isRTL && !0 !== overruleRTL ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el);
|
1157
|
+
}, npt.inputmask._valueSet = function(value, overruleRTL) {
|
1158
|
+
valueSet.call(this.el, null === value || value === undefined ? "" : !0 !== overruleRTL && isRTL ? value.split("").reverse().join("") : value);
|
1159
|
+
}, valueGet === undefined && (valueGet = function() {
|
1160
|
+
return this.value;
|
1161
|
+
}, valueSet = function(value) {
|
1162
|
+
this.value = value;
|
1163
|
+
}, function(type) {
|
1164
|
+
if ($.valHooks && ($.valHooks[type] === undefined || !0 !== $.valHooks[type].inputmaskpatch)) {
|
1165
|
+
var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) {
|
1166
|
+
return elem.value;
|
1167
|
+
}, valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) {
|
1168
|
+
return elem.value = value, elem;
|
1169
|
+
};
|
1170
|
+
$.valHooks[type] = {
|
1171
|
+
get: function(elem) {
|
1172
|
+
if (elem.inputmask) {
|
1173
|
+
if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue();
|
1174
|
+
var result = valhookGet(elem);
|
1175
|
+
return -1 !== getLastValidPosition(undefined, undefined, elem.inputmask.maskset.validPositions) || !0 !== opts.nullable ? result : "";
|
1176
|
+
}
|
1177
|
+
return valhookGet(elem);
|
1178
|
+
},
|
1179
|
+
set: function(elem, value) {
|
1180
|
+
var result, $elem = $(elem);
|
1181
|
+
return result = valhookSet(elem, value), elem.inputmask && $elem.trigger("setvalue"),
|
1182
|
+
result;
|
1183
|
+
},
|
1184
|
+
inputmaskpatch: !0
|
1185
|
+
};
|
1186
|
+
}
|
1187
|
+
}(npt.type), function(npt) {
|
1188
|
+
EventRuler.on(npt, "mouseenter", function(event) {
|
1189
|
+
var $input = $(this);
|
1190
|
+
this.inputmask._valueGet() !== getBuffer().join("") && $input.trigger("setvalue");
|
1191
|
+
});
|
1192
|
+
}(npt));
|
1193
|
+
}
|
1194
|
+
}(input) : input.inputmask = undefined, isSupported;
|
1195
|
+
}(elem, opts);
|
1196
|
+
if (!1 !== isSupported && (el = elem, $el = $(el), maxLength = el !== undefined ? el.maxLength : undefined,
|
1197
|
+
-1 === maxLength && (maxLength = undefined), !0 === opts.colorMask && initializeColorMask(el),
|
1198
|
+
android && (el.hasOwnProperty("inputmode") && (el.inputmode = opts.inputmode, el.setAttribute("inputmode", opts.inputmode)),
|
1199
|
+
"rtfm" === opts.androidHack && (!0 !== opts.colorMask && initializeColorMask(el),
|
1200
|
+
el.type = "password")), !0 === isSupported && (EventRuler.on(el, "submit", EventHandlers.submitEvent),
|
1201
|
+
EventRuler.on(el, "reset", EventHandlers.resetEvent), EventRuler.on(el, "mouseenter", EventHandlers.mouseenterEvent),
|
1202
|
+
EventRuler.on(el, "blur", EventHandlers.blurEvent), EventRuler.on(el, "focus", EventHandlers.focusEvent),
|
1203
|
+
EventRuler.on(el, "mouseleave", EventHandlers.mouseleaveEvent), !0 !== opts.colorMask && EventRuler.on(el, "click", EventHandlers.clickEvent),
|
1204
|
+
EventRuler.on(el, "dblclick", EventHandlers.dblclickEvent), EventRuler.on(el, "paste", EventHandlers.pasteEvent),
|
1205
|
+
EventRuler.on(el, "dragdrop", EventHandlers.pasteEvent), EventRuler.on(el, "drop", EventHandlers.pasteEvent),
|
1206
|
+
EventRuler.on(el, "cut", EventHandlers.cutEvent), EventRuler.on(el, "complete", opts.oncomplete),
|
1207
|
+
EventRuler.on(el, "incomplete", opts.onincomplete), EventRuler.on(el, "cleared", opts.oncleared),
|
1208
|
+
android || !0 === opts.inputEventOnly ? el.removeAttribute("maxLength") : (EventRuler.on(el, "keydown", EventHandlers.keydownEvent),
|
1209
|
+
EventRuler.on(el, "keypress", EventHandlers.keypressEvent)), EventRuler.on(el, "compositionstart", $.noop),
|
1210
|
+
EventRuler.on(el, "compositionupdate", $.noop), EventRuler.on(el, "compositionend", $.noop),
|
1211
|
+
EventRuler.on(el, "keyup", $.noop), EventRuler.on(el, "input", EventHandlers.inputFallBackEvent),
|
1212
|
+
EventRuler.on(el, "beforeinput", $.noop)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent),
|
1213
|
+
undoValue = getBufferTemplate().join(""), "" !== el.inputmask._valueGet(!0) || !1 === opts.clearMaskOnLostFocus || document.activeElement === el)) {
|
1214
|
+
var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, el.inputmask._valueGet(!0), opts) || el.inputmask._valueGet(!0) : el.inputmask._valueGet(!0);
|
1215
|
+
"" !== initialValue && checkVal(el, !0, !1, isRTL ? initialValue.split("").reverse() : initialValue.split(""));
|
1216
|
+
var buffer = getBuffer().slice();
|
1217
|
+
undoValue = buffer.join(""), !1 === isComplete(buffer) && opts.clearIncomplete && resetMaskSet(),
|
1218
|
+
opts.clearMaskOnLostFocus && document.activeElement !== el && (-1 === getLastValidPosition() ? buffer = [] : clearOptionalTail(buffer)),
|
1219
|
+
writeBuffer(el, buffer), document.activeElement === el && caret(el, seekNext(getLastValidPosition()));
|
1220
|
+
}
|
1221
|
+
}(el);
|
1222
|
+
break;
|
1223
|
+
|
1224
|
+
case "format":
|
1225
|
+
return valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value : actionObj.value).split(""),
|
1226
|
+
checkVal(undefined, !0, !1, isRTL ? valueBuffer.reverse() : valueBuffer), actionObj.metadata ? {
|
1227
|
+
value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
|
1228
|
+
metadata: maskScope.call(this, {
|
1229
|
+
action: "getmetadata"
|
1230
|
+
}, maskset, opts)
|
1231
|
+
} : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
|
1232
|
+
|
1233
|
+
case "isValid":
|
1234
|
+
actionObj.value ? (valueBuffer = actionObj.value.split(""), checkVal(undefined, !0, !0, isRTL ? valueBuffer.reverse() : valueBuffer)) : actionObj.value = getBuffer().join("");
|
1235
|
+
for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
|
1236
|
+
return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === getBuffer().join("");
|
1237
|
+
|
1238
|
+
case "getemptymask":
|
1239
|
+
return getBufferTemplate().join("");
|
1240
|
+
|
1241
|
+
case "remove":
|
1242
|
+
if (el && el.inputmask) {
|
1243
|
+
$el = $(el), el.inputmask._valueSet(opts.autoUnmask ? unmaskedvalue(el) : el.inputmask._valueGet(!0)),
|
1244
|
+
EventRuler.off(el);
|
1245
|
+
Object.getOwnPropertyDescriptor && Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value") && el.inputmask.__valueGet && Object.defineProperty(el, "value", {
|
1246
|
+
get: el.inputmask.__valueGet,
|
1247
|
+
set: el.inputmask.__valueSet,
|
1248
|
+
configurable: !0
|
1249
|
+
}) : document.__lookupGetter__ && el.__lookupGetter__("value") && el.inputmask.__valueGet && (el.__defineGetter__("value", el.inputmask.__valueGet),
|
1250
|
+
el.__defineSetter__("value", el.inputmask.__valueSet)), el.inputmask = undefined;
|
1251
|
+
}
|
1252
|
+
return el;
|
1253
|
+
|
1254
|
+
case "getmetadata":
|
1255
|
+
if ($.isArray(maskset.metadata)) {
|
1256
|
+
var maskTarget = getMaskTemplate(!0, 0, !1).join("");
|
1257
|
+
return $.each(maskset.metadata, function(ndx, mtdt) {
|
1258
|
+
if (mtdt.mask === maskTarget) return maskTarget = mtdt, !1;
|
1259
|
+
}), maskTarget;
|
1260
|
+
}
|
1261
|
+
return maskset.metadata;
|
1262
|
+
}
|
1263
|
+
}
|
1264
|
+
var ua = navigator.userAgent, mobile = /mobile/i.test(ua), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile, android = /android/i.test(ua) && !iemobile;
|
1265
|
+
return Inputmask.prototype = {
|
1266
|
+
dataAttribute: "data-inputmask",
|
1267
|
+
defaults: {
|
1268
|
+
placeholder: "_",
|
1269
|
+
optionalmarker: {
|
1270
|
+
start: "[",
|
1271
|
+
end: "]"
|
1272
|
+
},
|
1273
|
+
quantifiermarker: {
|
1274
|
+
start: "{",
|
1275
|
+
end: "}"
|
1276
|
+
},
|
1277
|
+
groupmarker: {
|
1278
|
+
start: "(",
|
1279
|
+
end: ")"
|
1280
|
+
},
|
1281
|
+
alternatormarker: "|",
|
1282
|
+
escapeChar: "\\",
|
1283
|
+
mask: null,
|
1284
|
+
regex: null,
|
1285
|
+
oncomplete: $.noop,
|
1286
|
+
onincomplete: $.noop,
|
1287
|
+
oncleared: $.noop,
|
1288
|
+
repeat: 0,
|
1289
|
+
greedy: !0,
|
1290
|
+
autoUnmask: !1,
|
1291
|
+
removeMaskOnSubmit: !1,
|
1292
|
+
clearMaskOnLostFocus: !0,
|
1293
|
+
insertMode: !0,
|
1294
|
+
clearIncomplete: !1,
|
1295
|
+
alias: null,
|
1296
|
+
onKeyDown: $.noop,
|
1297
|
+
onBeforeMask: null,
|
1298
|
+
onBeforePaste: function(pastedValue, opts) {
|
1299
|
+
return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(this, pastedValue, opts) : pastedValue;
|
1300
|
+
},
|
1301
|
+
onBeforeWrite: null,
|
1302
|
+
onUnMask: null,
|
1303
|
+
showMaskOnFocus: !0,
|
1304
|
+
showMaskOnHover: !0,
|
1305
|
+
onKeyValidation: $.noop,
|
1306
|
+
skipOptionalPartCharacter: " ",
|
1307
|
+
numericInput: !1,
|
1308
|
+
rightAlign: !1,
|
1309
|
+
undoOnEscape: !0,
|
1310
|
+
radixPoint: "",
|
1311
|
+
radixPointDefinitionSymbol: undefined,
|
1312
|
+
groupSeparator: "",
|
1313
|
+
keepStatic: null,
|
1314
|
+
positionCaretOnTab: !0,
|
1315
|
+
tabThrough: !1,
|
1316
|
+
supportsInputType: [ "text", "tel", "password" ],
|
1317
|
+
ignorables: [ 8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 0, 229 ],
|
1318
|
+
isComplete: null,
|
1319
|
+
canClearPosition: $.noop,
|
1320
|
+
preValidation: null,
|
1321
|
+
postValidation: null,
|
1322
|
+
staticDefinitionSymbol: undefined,
|
1323
|
+
jitMasking: !1,
|
1324
|
+
nullable: !0,
|
1325
|
+
inputEventOnly: !1,
|
1326
|
+
noValuePatching: !1,
|
1327
|
+
positionCaretOnClick: "lvp",
|
1328
|
+
casing: null,
|
1329
|
+
inputmode: "verbatim",
|
1330
|
+
colorMask: !1,
|
1331
|
+
androidHack: !1,
|
1332
|
+
importDataAttributes: !0
|
1333
|
+
},
|
1334
|
+
definitions: {
|
1335
|
+
"9": {
|
1336
|
+
validator: "[0-9\uff11-\uff19]",
|
1337
|
+
cardinality: 1,
|
1338
|
+
definitionSymbol: "*"
|
1339
|
+
},
|
1340
|
+
a: {
|
1341
|
+
validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
|
1342
|
+
cardinality: 1,
|
1343
|
+
definitionSymbol: "*"
|
1344
|
+
},
|
1345
|
+
"*": {
|
1346
|
+
validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
|
1347
|
+
cardinality: 1
|
1348
|
+
}
|
1349
|
+
},
|
1350
|
+
aliases: {},
|
1351
|
+
masksCache: {},
|
1352
|
+
mask: function(elems) {
|
1353
|
+
function importAttributeOptions(npt, opts, userOptions, dataAttribute) {
|
1354
|
+
if (!0 === opts.importDataAttributes) {
|
1355
|
+
var option, dataoptions, optionData, p, importOption = function(option, optionData) {
|
1356
|
+
null !== (optionData = optionData !== undefined ? optionData : npt.getAttribute(dataAttribute + "-" + option)) && ("string" == typeof optionData && (0 === option.indexOf("on") ? optionData = window[optionData] : "false" === optionData ? optionData = !1 : "true" === optionData && (optionData = !0)),
|
1357
|
+
userOptions[option] = optionData);
|
1358
|
+
}, attrOptions = npt.getAttribute(dataAttribute);
|
1359
|
+
if (attrOptions && "" !== attrOptions && (attrOptions = attrOptions.replace(new RegExp("'", "g"), '"'),
|
1360
|
+
dataoptions = JSON.parse("{" + attrOptions + "}")), dataoptions) {
|
1361
|
+
optionData = undefined;
|
1362
|
+
for (p in dataoptions) if ("alias" === p.toLowerCase()) {
|
1363
|
+
optionData = dataoptions[p];
|
1364
|
+
break;
|
1365
|
+
}
|
1366
|
+
}
|
1367
|
+
importOption("alias", optionData), userOptions.alias && resolveAlias(userOptions.alias, userOptions, opts);
|
1368
|
+
for (option in opts) {
|
1369
|
+
if (dataoptions) {
|
1370
|
+
optionData = undefined;
|
1371
|
+
for (p in dataoptions) if (p.toLowerCase() === option.toLowerCase()) {
|
1372
|
+
optionData = dataoptions[p];
|
1373
|
+
break;
|
1374
|
+
}
|
1375
|
+
}
|
1376
|
+
importOption(option, optionData);
|
1377
|
+
}
|
1378
|
+
}
|
1379
|
+
return $.extend(!0, opts, userOptions), ("rtl" === npt.dir || opts.rightAlign) && (npt.style.textAlign = "right"),
|
1380
|
+
("rtl" === npt.dir || opts.numericInput) && (npt.dir = "ltr", npt.removeAttribute("dir"),
|
1381
|
+
opts.isRTL = !0), opts;
|
1382
|
+
}
|
1383
|
+
var that = this;
|
1384
|
+
return "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)),
|
1385
|
+
elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) {
|
1386
|
+
var scopedOpts = $.extend(!0, {}, that.opts);
|
1387
|
+
importAttributeOptions(el, scopedOpts, $.extend(!0, {}, that.userOptions), that.dataAttribute);
|
1388
|
+
var maskset = generateMaskSet(scopedOpts, that.noMasksCache);
|
1389
|
+
maskset !== undefined && (el.inputmask !== undefined && (el.inputmask.opts.autoUnmask = !0,
|
1390
|
+
el.inputmask.remove()), el.inputmask = new Inputmask(undefined, undefined, !0),
|
1391
|
+
el.inputmask.opts = scopedOpts, el.inputmask.noMasksCache = that.noMasksCache, el.inputmask.userOptions = $.extend(!0, {}, that.userOptions),
|
1392
|
+
el.inputmask.isRTL = scopedOpts.isRTL || scopedOpts.numericInput, el.inputmask.el = el,
|
1393
|
+
el.inputmask.maskset = maskset, $.data(el, "_inputmask_opts", scopedOpts), maskScope.call(el.inputmask, {
|
1394
|
+
action: "mask"
|
1395
|
+
}));
|
1396
|
+
}), elems && elems[0] ? elems[0].inputmask || this : this;
|
1397
|
+
},
|
1398
|
+
option: function(options, noremask) {
|
1399
|
+
return "string" == typeof options ? this.opts[options] : "object" === (void 0 === options ? "undefined" : _typeof(options)) ? ($.extend(this.userOptions, options),
|
1400
|
+
this.el && !0 !== noremask && this.mask(this.el), this) : void 0;
|
1401
|
+
},
|
1402
|
+
unmaskedvalue: function(value) {
|
1403
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
1404
|
+
maskScope.call(this, {
|
1405
|
+
action: "unmaskedvalue",
|
1406
|
+
value: value
|
1407
|
+
});
|
1408
|
+
},
|
1409
|
+
remove: function() {
|
1410
|
+
return maskScope.call(this, {
|
1411
|
+
action: "remove"
|
1412
|
+
});
|
1413
|
+
},
|
1414
|
+
getemptymask: function() {
|
1415
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
1416
|
+
maskScope.call(this, {
|
1417
|
+
action: "getemptymask"
|
1418
|
+
});
|
1419
|
+
},
|
1420
|
+
hasMaskedValue: function() {
|
1421
|
+
return !this.opts.autoUnmask;
|
1422
|
+
},
|
1423
|
+
isComplete: function() {
|
1424
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
1425
|
+
maskScope.call(this, {
|
1426
|
+
action: "isComplete"
|
1427
|
+
});
|
1428
|
+
},
|
1429
|
+
getmetadata: function() {
|
1430
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
1431
|
+
maskScope.call(this, {
|
1432
|
+
action: "getmetadata"
|
1433
|
+
});
|
1434
|
+
},
|
1435
|
+
isValid: function(value) {
|
1436
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
1437
|
+
maskScope.call(this, {
|
1438
|
+
action: "isValid",
|
1439
|
+
value: value
|
1440
|
+
});
|
1441
|
+
},
|
1442
|
+
format: function(value, metadata) {
|
1443
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
1444
|
+
maskScope.call(this, {
|
1445
|
+
action: "format",
|
1446
|
+
value: value,
|
1447
|
+
metadata: metadata
|
1448
|
+
});
|
1449
|
+
},
|
1450
|
+
analyseMask: function(mask, regexMask, opts) {
|
1451
|
+
function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
|
1452
|
+
this.matches = [], this.openGroup = isGroup || !1, this.alternatorGroup = !1, this.isGroup = isGroup || !1,
|
1453
|
+
this.isOptional = isOptional || !1, this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1,
|
1454
|
+
this.quantifier = {
|
1455
|
+
min: 1,
|
1456
|
+
max: 1
|
1457
|
+
};
|
1458
|
+
}
|
1459
|
+
function insertTestDefinition(mtoken, element, position) {
|
1460
|
+
position = position !== undefined ? position : mtoken.matches.length;
|
1461
|
+
var prevMatch = mtoken.matches[position - 1];
|
1462
|
+
if (regexMask) 0 === element.indexOf("[") || escaped && /\\d|\\s|\\w]/i.test(element) || "." === element ? mtoken.matches.splice(position++, 0, {
|
1463
|
+
fn: new RegExp(element, opts.casing ? "i" : ""),
|
1464
|
+
cardinality: 1,
|
1465
|
+
optionality: mtoken.isOptional,
|
1466
|
+
newBlockMarker: prevMatch === undefined || prevMatch.def !== element,
|
1467
|
+
casing: null,
|
1468
|
+
def: element,
|
1469
|
+
placeholder: undefined,
|
1470
|
+
nativeDef: element
|
1471
|
+
}) : (escaped && (element = element[element.length - 1]), $.each(element.split(""), function(ndx, lmnt) {
|
1472
|
+
prevMatch = mtoken.matches[position - 1], mtoken.matches.splice(position++, 0, {
|
1473
|
+
fn: null,
|
1474
|
+
cardinality: 0,
|
1475
|
+
optionality: mtoken.isOptional,
|
1476
|
+
newBlockMarker: prevMatch === undefined || prevMatch.def !== lmnt && null !== prevMatch.fn,
|
1477
|
+
casing: null,
|
1478
|
+
def: opts.staticDefinitionSymbol || lmnt,
|
1479
|
+
placeholder: opts.staticDefinitionSymbol !== undefined ? lmnt : undefined,
|
1480
|
+
nativeDef: lmnt
|
1481
|
+
});
|
1482
|
+
})), escaped = !1; else {
|
1483
|
+
var maskdef = (opts.definitions ? opts.definitions[element] : undefined) || Inputmask.prototype.definitions[element];
|
1484
|
+
if (maskdef && !escaped) {
|
1485
|
+
for (var prevalidators = maskdef.prevalidator, prevalidatorsL = prevalidators ? prevalidators.length : 0, i = 1; i < maskdef.cardinality; i++) {
|
1486
|
+
var prevalidator = prevalidatorsL >= i ? prevalidators[i - 1] : [], validator = prevalidator.validator, cardinality = prevalidator.cardinality;
|
1487
|
+
mtoken.matches.splice(position++, 0, {
|
1488
|
+
fn: validator ? "string" == typeof validator ? new RegExp(validator, opts.casing ? "i" : "") : new function() {
|
1489
|
+
this.test = validator;
|
1490
|
+
}() : new RegExp("."),
|
1491
|
+
cardinality: cardinality || 1,
|
1492
|
+
optionality: mtoken.isOptional,
|
1493
|
+
newBlockMarker: prevMatch === undefined || prevMatch.def !== (maskdef.definitionSymbol || element),
|
1494
|
+
casing: maskdef.casing,
|
1495
|
+
def: maskdef.definitionSymbol || element,
|
1496
|
+
placeholder: maskdef.placeholder,
|
1497
|
+
nativeDef: element
|
1498
|
+
}), prevMatch = mtoken.matches[position - 1];
|
1499
|
+
}
|
1500
|
+
mtoken.matches.splice(position++, 0, {
|
1501
|
+
fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator, opts.casing ? "i" : "") : new function() {
|
1502
|
+
this.test = maskdef.validator;
|
1503
|
+
}() : new RegExp("."),
|
1504
|
+
cardinality: maskdef.cardinality,
|
1505
|
+
optionality: mtoken.isOptional,
|
1506
|
+
newBlockMarker: prevMatch === undefined || prevMatch.def !== (maskdef.definitionSymbol || element),
|
1507
|
+
casing: maskdef.casing,
|
1508
|
+
def: maskdef.definitionSymbol || element,
|
1509
|
+
placeholder: maskdef.placeholder,
|
1510
|
+
nativeDef: element
|
1511
|
+
});
|
1512
|
+
} else mtoken.matches.splice(position++, 0, {
|
1513
|
+
fn: null,
|
1514
|
+
cardinality: 0,
|
1515
|
+
optionality: mtoken.isOptional,
|
1516
|
+
newBlockMarker: prevMatch === undefined || prevMatch.def !== element && null !== prevMatch.fn,
|
1517
|
+
casing: null,
|
1518
|
+
def: opts.staticDefinitionSymbol || element,
|
1519
|
+
placeholder: opts.staticDefinitionSymbol !== undefined ? element : undefined,
|
1520
|
+
nativeDef: element
|
1521
|
+
}), escaped = !1;
|
1522
|
+
}
|
1523
|
+
}
|
1524
|
+
function verifyGroupMarker(maskToken) {
|
1525
|
+
maskToken && maskToken.matches && $.each(maskToken.matches, function(ndx, token) {
|
1526
|
+
var nextToken = maskToken.matches[ndx + 1];
|
1527
|
+
(nextToken === undefined || nextToken.matches === undefined || !1 === nextToken.isQuantifier) && token && token.isGroup && (token.isGroup = !1,
|
1528
|
+
regexMask || (insertTestDefinition(token, opts.groupmarker.start, 0), !0 !== token.openGroup && insertTestDefinition(token, opts.groupmarker.end))),
|
1529
|
+
verifyGroupMarker(token);
|
1530
|
+
});
|
1531
|
+
}
|
1532
|
+
function defaultCase() {
|
1533
|
+
if (openenings.length > 0) {
|
1534
|
+
if (currentOpeningToken = openenings[openenings.length - 1], insertTestDefinition(currentOpeningToken, m),
|
1535
|
+
currentOpeningToken.isAlternator) {
|
1536
|
+
alternator = openenings.pop();
|
1537
|
+
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
|
1538
|
+
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1539
|
+
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
1540
|
+
}
|
1541
|
+
} else insertTestDefinition(currentToken, m);
|
1542
|
+
}
|
1543
|
+
function reverseTokens(maskToken) {
|
1544
|
+
maskToken.matches = maskToken.matches.reverse();
|
1545
|
+
for (var match in maskToken.matches) if (maskToken.matches.hasOwnProperty(match)) {
|
1546
|
+
var intMatch = parseInt(match);
|
1547
|
+
if (maskToken.matches[match].isQuantifier && maskToken.matches[intMatch + 1] && maskToken.matches[intMatch + 1].isGroup) {
|
1548
|
+
var qt = maskToken.matches[match];
|
1549
|
+
maskToken.matches.splice(match, 1), maskToken.matches.splice(intMatch + 1, 0, qt);
|
1550
|
+
}
|
1551
|
+
maskToken.matches[match].matches !== undefined ? maskToken.matches[match] = reverseTokens(maskToken.matches[match]) : maskToken.matches[match] = function(st) {
|
1552
|
+
return st === opts.optionalmarker.start ? st = opts.optionalmarker.end : st === opts.optionalmarker.end ? st = opts.optionalmarker.start : st === opts.groupmarker.start ? st = opts.groupmarker.end : st === opts.groupmarker.end && (st = opts.groupmarker.start),
|
1553
|
+
st;
|
1554
|
+
}(maskToken.matches[match]);
|
1555
|
+
}
|
1556
|
+
return maskToken;
|
1557
|
+
}
|
1558
|
+
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 = [];
|
1559
|
+
for (regexMask && (opts.optionalmarker.start = undefined, opts.optionalmarker.end = undefined); match = regexMask ? regexTokenizer.exec(mask) : tokenizer.exec(mask); ) {
|
1560
|
+
if (m = match[0], regexMask) switch (m.charAt(0)) {
|
1561
|
+
case "?":
|
1562
|
+
m = "{0,1}";
|
1563
|
+
break;
|
1564
|
+
|
1565
|
+
case "+":
|
1566
|
+
case "*":
|
1567
|
+
m = "{" + m + "}";
|
1568
|
+
}
|
1569
|
+
if (escaped) defaultCase(); else switch (m.charAt(0)) {
|
1570
|
+
case opts.escapeChar:
|
1571
|
+
escaped = !0, regexMask && defaultCase();
|
1572
|
+
break;
|
1573
|
+
|
1574
|
+
case opts.optionalmarker.end:
|
1575
|
+
case opts.groupmarker.end:
|
1576
|
+
if (openingToken = openenings.pop(), openingToken.openGroup = !1, openingToken !== undefined) if (openenings.length > 0) {
|
1577
|
+
if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken),
|
1578
|
+
currentOpeningToken.isAlternator) {
|
1579
|
+
alternator = openenings.pop();
|
1580
|
+
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1,
|
1581
|
+
alternator.matches[mndx].alternatorGroup = !1;
|
1582
|
+
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1583
|
+
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
1584
|
+
}
|
1585
|
+
} else currentToken.matches.push(openingToken); else defaultCase();
|
1586
|
+
break;
|
1587
|
+
|
1588
|
+
case opts.optionalmarker.start:
|
1589
|
+
openenings.push(new MaskToken(!1, !0));
|
1590
|
+
break;
|
1591
|
+
|
1592
|
+
case opts.groupmarker.start:
|
1593
|
+
openenings.push(new MaskToken(!0));
|
1594
|
+
break;
|
1595
|
+
|
1596
|
+
case opts.quantifiermarker.start:
|
1597
|
+
var quantifier = new MaskToken(!1, !1, !0);
|
1598
|
+
m = m.replace(/[{}]/g, "");
|
1599
|
+
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]);
|
1600
|
+
if ("*" !== mq1 && "+" !== mq1 || (mq0 = "*" === mq1 ? 0 : 1), quantifier.quantifier = {
|
1601
|
+
min: mq0,
|
1602
|
+
max: mq1
|
1603
|
+
}, openenings.length > 0) {
|
1604
|
+
var matches = openenings[openenings.length - 1].matches;
|
1605
|
+
match = matches.pop(), match.isGroup || (groupToken = new MaskToken(!0), groupToken.matches.push(match),
|
1606
|
+
match = groupToken), matches.push(match), matches.push(quantifier);
|
1607
|
+
} else match = currentToken.matches.pop(), match.isGroup || (regexMask && null === match.fn && "." === match.def && (match.fn = new RegExp(match.def, opts.casing ? "i" : "")),
|
1608
|
+
groupToken = new MaskToken(!0), groupToken.matches.push(match), match = groupToken),
|
1609
|
+
currentToken.matches.push(match), currentToken.matches.push(quantifier);
|
1610
|
+
break;
|
1611
|
+
|
1612
|
+
case opts.alternatormarker:
|
1613
|
+
if (openenings.length > 0) {
|
1614
|
+
currentOpeningToken = openenings[openenings.length - 1];
|
1615
|
+
var subToken = currentOpeningToken.matches[currentOpeningToken.matches.length - 1];
|
1616
|
+
lastMatch = currentOpeningToken.openGroup && (subToken.matches === undefined || !1 === subToken.isGroup && !1 === subToken.isAlternator) ? openenings.pop() : currentOpeningToken.matches.pop();
|
1617
|
+
} else lastMatch = currentToken.matches.pop();
|
1618
|
+
if (lastMatch.isAlternator) openenings.push(lastMatch); else if (lastMatch.alternatorGroup ? (alternator = openenings.pop(),
|
1619
|
+
lastMatch.alternatorGroup = !1) : alternator = new MaskToken(!1, !1, !1, !0), alternator.matches.push(lastMatch),
|
1620
|
+
openenings.push(alternator), lastMatch.openGroup) {
|
1621
|
+
lastMatch.openGroup = !1;
|
1622
|
+
var alternatorGroup = new MaskToken(!0);
|
1623
|
+
alternatorGroup.alternatorGroup = !0, openenings.push(alternatorGroup);
|
1624
|
+
}
|
1625
|
+
break;
|
1626
|
+
|
1627
|
+
default:
|
1628
|
+
defaultCase();
|
1629
|
+
}
|
1630
|
+
}
|
1631
|
+
for (;openenings.length > 0; ) openingToken = openenings.pop(), currentToken.matches.push(openingToken);
|
1632
|
+
return currentToken.matches.length > 0 && (verifyGroupMarker(currentToken), maskTokens.push(currentToken)),
|
1633
|
+
(opts.numericInput || opts.isRTL) && reverseTokens(maskTokens[0]), maskTokens;
|
1634
|
+
}
|
1635
|
+
}, Inputmask.extendDefaults = function(options) {
|
1636
|
+
$.extend(!0, Inputmask.prototype.defaults, options);
|
1637
|
+
}, Inputmask.extendDefinitions = function(definition) {
|
1638
|
+
$.extend(!0, Inputmask.prototype.definitions, definition);
|
1639
|
+
}, Inputmask.extendAliases = function(alias) {
|
1640
|
+
$.extend(!0, Inputmask.prototype.aliases, alias);
|
1641
|
+
}, Inputmask.format = function(value, options, metadata) {
|
1642
|
+
return Inputmask(options).format(value, metadata);
|
1643
|
+
}, Inputmask.unmask = function(value, options) {
|
1644
|
+
return Inputmask(options).unmaskedvalue(value);
|
1645
|
+
}, Inputmask.isValid = function(value, options) {
|
1646
|
+
return Inputmask(options).isValid(value);
|
1647
|
+
}, Inputmask.remove = function(elems) {
|
1648
|
+
$.each(elems, function(ndx, el) {
|
1649
|
+
el.inputmask && el.inputmask.remove();
|
1650
|
+
});
|
1651
|
+
}, Inputmask.escapeRegex = function(str) {
|
1652
|
+
var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
|
1653
|
+
return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
|
1654
|
+
}, Inputmask.keyCode = {
|
1655
|
+
ALT: 18,
|
1656
|
+
BACKSPACE: 8,
|
1657
|
+
BACKSPACE_SAFARI: 127,
|
1658
|
+
CAPS_LOCK: 20,
|
1659
|
+
COMMA: 188,
|
1660
|
+
COMMAND: 91,
|
1661
|
+
COMMAND_LEFT: 91,
|
1662
|
+
COMMAND_RIGHT: 93,
|
1663
|
+
CONTROL: 17,
|
1664
|
+
DELETE: 46,
|
1665
|
+
DOWN: 40,
|
1666
|
+
END: 35,
|
1667
|
+
ENTER: 13,
|
1668
|
+
ESCAPE: 27,
|
1669
|
+
HOME: 36,
|
1670
|
+
INSERT: 45,
|
1671
|
+
LEFT: 37,
|
1672
|
+
MENU: 93,
|
1673
|
+
NUMPAD_ADD: 107,
|
1674
|
+
NUMPAD_DECIMAL: 110,
|
1675
|
+
NUMPAD_DIVIDE: 111,
|
1676
|
+
NUMPAD_ENTER: 108,
|
1677
|
+
NUMPAD_MULTIPLY: 106,
|
1678
|
+
NUMPAD_SUBTRACT: 109,
|
1679
|
+
PAGE_DOWN: 34,
|
1680
|
+
PAGE_UP: 33,
|
1681
|
+
PERIOD: 190,
|
1682
|
+
RIGHT: 39,
|
1683
|
+
SHIFT: 16,
|
1684
|
+
SPACE: 32,
|
1685
|
+
TAB: 9,
|
1686
|
+
UP: 38,
|
1687
|
+
WINDOWS: 91,
|
1688
|
+
X: 88
|
1689
|
+
}, Inputmask;
|
1690
|
+
});
|
1691
|
+
}, function(module, exports) {
|
1692
|
+
module.exports = jQuery;
|
1693
|
+
}, function(module, exports, __webpack_require__) {
|
1694
|
+
"use strict";
|
1695
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
1696
|
+
"function" == typeof Symbol && Symbol.iterator;
|
1697
|
+
!function(factory) {
|
1698
|
+
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ],
|
1699
|
+
__WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
1700
|
+
}(function($, Inputmask) {
|
1701
|
+
function isLeapYear(year) {
|
1702
|
+
return isNaN(year) || 29 === new Date(year, 2, 0).getDate();
|
1703
|
+
}
|
1704
|
+
return Inputmask.extendAliases({
|
1705
|
+
"dd/mm/yyyy": {
|
1706
|
+
mask: "1/2/y",
|
1707
|
+
placeholder: "dd/mm/yyyy",
|
1708
|
+
regex: {
|
1709
|
+
val1pre: new RegExp("[0-3]"),
|
1710
|
+
val1: new RegExp("0[1-9]|[12][0-9]|3[01]"),
|
1711
|
+
val2pre: function(separator) {
|
1712
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
1713
|
+
return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])");
|
1714
|
+
},
|
1715
|
+
val2: function(separator) {
|
1716
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
1717
|
+
return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))");
|
1718
|
+
}
|
1719
|
+
},
|
1720
|
+
leapday: "29/02/",
|
1721
|
+
separator: "/",
|
1722
|
+
yearrange: {
|
1723
|
+
minyear: 1900,
|
1724
|
+
maxyear: 2099
|
1725
|
+
},
|
1726
|
+
isInYearRange: function(chrs, minyear, maxyear) {
|
1727
|
+
if (isNaN(chrs)) return !1;
|
1728
|
+
var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))), enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length)));
|
1729
|
+
return !isNaN(enteredyear) && (minyear <= enteredyear && enteredyear <= maxyear) || !isNaN(enteredyear2) && (minyear <= enteredyear2 && enteredyear2 <= maxyear);
|
1730
|
+
},
|
1731
|
+
determinebaseyear: function(minyear, maxyear, hint) {
|
1732
|
+
var currentyear = new Date().getFullYear();
|
1733
|
+
if (minyear > currentyear) return minyear;
|
1734
|
+
if (maxyear < currentyear) {
|
1735
|
+
for (var maxYearPrefix = maxyear.toString().slice(0, 2), maxYearPostfix = maxyear.toString().slice(2, 4); maxyear < maxYearPrefix + hint; ) maxYearPrefix--;
|
1736
|
+
var maxxYear = maxYearPrefix + maxYearPostfix;
|
1737
|
+
return minyear > maxxYear ? minyear : maxxYear;
|
1738
|
+
}
|
1739
|
+
if (minyear <= currentyear && currentyear <= maxyear) {
|
1740
|
+
for (var currentYearPrefix = currentyear.toString().slice(0, 2); maxyear < currentYearPrefix + hint; ) currentYearPrefix--;
|
1741
|
+
var currentYearAndHint = currentYearPrefix + hint;
|
1742
|
+
return currentYearAndHint < minyear ? minyear : currentYearAndHint;
|
1743
|
+
}
|
1744
|
+
return currentyear;
|
1745
|
+
},
|
1746
|
+
onKeyDown: function(e, buffer, caretPos, opts) {
|
1747
|
+
var $input = $(this);
|
1748
|
+
if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
|
1749
|
+
var today = new Date();
|
1750
|
+
$input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString()),
|
1751
|
+
$input.trigger("setvalue");
|
1752
|
+
}
|
1753
|
+
},
|
1754
|
+
getFrontValue: function(mask, buffer, opts) {
|
1755
|
+
for (var start = 0, length = 0, i = 0; i < mask.length && "2" !== mask.charAt(i); i++) {
|
1756
|
+
var definition = opts.definitions[mask.charAt(i)];
|
1757
|
+
definition ? (start += length, length = definition.cardinality) : length++;
|
1758
|
+
}
|
1759
|
+
return buffer.join("").substr(start, length);
|
1760
|
+
},
|
1761
|
+
postValidation: function(buffer, currentResult, opts) {
|
1762
|
+
var dayMonthValue, year, bufferStr = buffer.join("");
|
1763
|
+
return 0 === opts.mask.indexOf("y") ? (year = bufferStr.substr(0, 4), dayMonthValue = bufferStr.substring(4, 10)) : (year = bufferStr.substring(6, 10),
|
1764
|
+
dayMonthValue = bufferStr.substr(0, 6)), currentResult && (dayMonthValue !== opts.leapday || isLeapYear(year));
|
1765
|
+
},
|
1766
|
+
definitions: {
|
1767
|
+
"1": {
|
1768
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
1769
|
+
if ("3" == chrs.charAt(0)) {
|
1770
|
+
if (new RegExp("[2-9]").test(chrs.charAt(1))) return chrs = "30", maskset.buffer[pos] = "0",
|
1771
|
+
pos++, {
|
1772
|
+
pos: pos
|
1773
|
+
};
|
1774
|
+
}
|
1775
|
+
var isValid = opts.regex.val1.test(chrs);
|
1776
|
+
return strict || isValid || chrs.charAt(1) !== opts.separator && -1 === "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0",
|
1777
|
+
{
|
1778
|
+
refreshFromBuffer: {
|
1779
|
+
start: pos - 1,
|
1780
|
+
end: pos
|
1781
|
+
},
|
1782
|
+
pos: pos,
|
1783
|
+
c: chrs.charAt(0)
|
1784
|
+
});
|
1785
|
+
},
|
1786
|
+
cardinality: 2,
|
1787
|
+
prevalidator: [ {
|
1788
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
1789
|
+
var pchrs = chrs;
|
1790
|
+
isNaN(maskset.buffer[pos + 1]) || (pchrs += maskset.buffer[pos + 1]);
|
1791
|
+
var isValid = 1 === pchrs.length ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs);
|
1792
|
+
if (!strict && !isValid) {
|
1793
|
+
if (isValid = opts.regex.val1.test(chrs + "0")) return maskset.buffer[pos] = chrs,
|
1794
|
+
maskset.buffer[++pos] = "0", {
|
1795
|
+
pos: pos,
|
1796
|
+
c: "0"
|
1797
|
+
};
|
1798
|
+
if (isValid = opts.regex.val1.test("0" + chrs)) return maskset.buffer[pos] = "0",
|
1799
|
+
pos++, {
|
1800
|
+
pos: pos
|
1801
|
+
};
|
1802
|
+
}
|
1803
|
+
return isValid;
|
1804
|
+
},
|
1805
|
+
cardinality: 1
|
1806
|
+
} ]
|
1807
|
+
},
|
1808
|
+
"2": {
|
1809
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
1810
|
+
var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
|
1811
|
+
if (-1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator),
|
1812
|
+
"1" == chrs.charAt(0)) {
|
1813
|
+
if (new RegExp("[3-9]").test(chrs.charAt(1))) return chrs = "10", maskset.buffer[pos] = "0",
|
1814
|
+
pos++, {
|
1815
|
+
pos: pos
|
1816
|
+
};
|
1817
|
+
}
|
1818
|
+
var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
|
1819
|
+
return strict || isValid || chrs.charAt(1) !== opts.separator && -1 === "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0",
|
1820
|
+
{
|
1821
|
+
refreshFromBuffer: {
|
1822
|
+
start: pos - 1,
|
1823
|
+
end: pos
|
1824
|
+
},
|
1825
|
+
pos: pos,
|
1826
|
+
c: chrs.charAt(0)
|
1827
|
+
});
|
1828
|
+
},
|
1829
|
+
cardinality: 2,
|
1830
|
+
prevalidator: [ {
|
1831
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
1832
|
+
isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
|
1833
|
+
var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
|
1834
|
+
-1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
|
1835
|
+
var isValid = 1 === chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
|
1836
|
+
return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
1837
|
+
pos++, {
|
1838
|
+
pos: pos
|
1839
|
+
});
|
1840
|
+
},
|
1841
|
+
cardinality: 1
|
1842
|
+
} ]
|
1843
|
+
},
|
1844
|
+
y: {
|
1845
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
1846
|
+
return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
1847
|
+
},
|
1848
|
+
cardinality: 4,
|
1849
|
+
prevalidator: [ {
|
1850
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
1851
|
+
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
1852
|
+
if (!strict && !isValid) {
|
1853
|
+
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1);
|
1854
|
+
if (isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
1855
|
+
{
|
1856
|
+
pos: pos
|
1857
|
+
};
|
1858
|
+
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2),
|
1859
|
+
isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
1860
|
+
maskset.buffer[pos++] = yearPrefix.charAt(1), {
|
1861
|
+
pos: pos
|
1862
|
+
};
|
1863
|
+
}
|
1864
|
+
return isValid;
|
1865
|
+
},
|
1866
|
+
cardinality: 1
|
1867
|
+
}, {
|
1868
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
1869
|
+
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
1870
|
+
if (!strict && !isValid) {
|
1871
|
+
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
|
1872
|
+
if (isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(1),
|
1873
|
+
{
|
1874
|
+
pos: pos
|
1875
|
+
};
|
1876
|
+
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2),
|
1877
|
+
isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos - 1] = yearPrefix.charAt(0),
|
1878
|
+
maskset.buffer[pos++] = yearPrefix.charAt(1), maskset.buffer[pos++] = chrs.charAt(0),
|
1879
|
+
{
|
1880
|
+
refreshFromBuffer: {
|
1881
|
+
start: pos - 3,
|
1882
|
+
end: pos
|
1883
|
+
},
|
1884
|
+
pos: pos
|
1885
|
+
};
|
1886
|
+
}
|
1887
|
+
return isValid;
|
1888
|
+
},
|
1889
|
+
cardinality: 2
|
1890
|
+
}, {
|
1891
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
1892
|
+
return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
1893
|
+
},
|
1894
|
+
cardinality: 3
|
1895
|
+
} ]
|
1896
|
+
}
|
1897
|
+
},
|
1898
|
+
insertMode: !1,
|
1899
|
+
autoUnmask: !1
|
1900
|
+
},
|
1901
|
+
"mm/dd/yyyy": {
|
1902
|
+
placeholder: "mm/dd/yyyy",
|
1903
|
+
alias: "dd/mm/yyyy",
|
1904
|
+
regex: {
|
1905
|
+
val2pre: function(separator) {
|
1906
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
1907
|
+
return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
|
1908
|
+
},
|
1909
|
+
val2: function(separator) {
|
1910
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
1911
|
+
return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
|
1912
|
+
},
|
1913
|
+
val1pre: new RegExp("[01]"),
|
1914
|
+
val1: new RegExp("0[1-9]|1[012]")
|
1915
|
+
},
|
1916
|
+
leapday: "02/29/",
|
1917
|
+
onKeyDown: function(e, buffer, caretPos, opts) {
|
1918
|
+
var $input = $(this);
|
1919
|
+
if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
|
1920
|
+
var today = new Date();
|
1921
|
+
$input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()),
|
1922
|
+
$input.trigger("setvalue");
|
1923
|
+
}
|
1924
|
+
}
|
1925
|
+
},
|
1926
|
+
"yyyy/mm/dd": {
|
1927
|
+
mask: "y/1/2",
|
1928
|
+
placeholder: "yyyy/mm/dd",
|
1929
|
+
alias: "mm/dd/yyyy",
|
1930
|
+
leapday: "/02/29",
|
1931
|
+
onKeyDown: function(e, buffer, caretPos, opts) {
|
1932
|
+
var $input = $(this);
|
1933
|
+
if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
|
1934
|
+
var today = new Date();
|
1935
|
+
$input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString()),
|
1936
|
+
$input.trigger("setvalue");
|
1937
|
+
}
|
1938
|
+
}
|
1939
|
+
},
|
1940
|
+
"dd.mm.yyyy": {
|
1941
|
+
mask: "1.2.y",
|
1942
|
+
placeholder: "dd.mm.yyyy",
|
1943
|
+
leapday: "29.02.",
|
1944
|
+
separator: ".",
|
1945
|
+
alias: "dd/mm/yyyy"
|
1946
|
+
},
|
1947
|
+
"dd-mm-yyyy": {
|
1948
|
+
mask: "1-2-y",
|
1949
|
+
placeholder: "dd-mm-yyyy",
|
1950
|
+
leapday: "29-02-",
|
1951
|
+
separator: "-",
|
1952
|
+
alias: "dd/mm/yyyy"
|
1953
|
+
},
|
1954
|
+
"mm.dd.yyyy": {
|
1955
|
+
mask: "1.2.y",
|
1956
|
+
placeholder: "mm.dd.yyyy",
|
1957
|
+
leapday: "02.29.",
|
1958
|
+
separator: ".",
|
1959
|
+
alias: "mm/dd/yyyy"
|
1960
|
+
},
|
1961
|
+
"mm-dd-yyyy": {
|
1962
|
+
mask: "1-2-y",
|
1963
|
+
placeholder: "mm-dd-yyyy",
|
1964
|
+
leapday: "02-29-",
|
1965
|
+
separator: "-",
|
1966
|
+
alias: "mm/dd/yyyy"
|
1967
|
+
},
|
1968
|
+
"yyyy.mm.dd": {
|
1969
|
+
mask: "y.1.2",
|
1970
|
+
placeholder: "yyyy.mm.dd",
|
1971
|
+
leapday: ".02.29",
|
1972
|
+
separator: ".",
|
1973
|
+
alias: "yyyy/mm/dd"
|
1974
|
+
},
|
1975
|
+
"yyyy-mm-dd": {
|
1976
|
+
mask: "y-1-2",
|
1977
|
+
placeholder: "yyyy-mm-dd",
|
1978
|
+
leapday: "-02-29",
|
1979
|
+
separator: "-",
|
1980
|
+
alias: "yyyy/mm/dd"
|
1981
|
+
},
|
1982
|
+
datetime: {
|
1983
|
+
mask: "1/2/y h:s",
|
1984
|
+
placeholder: "dd/mm/yyyy hh:mm",
|
1985
|
+
alias: "dd/mm/yyyy",
|
1986
|
+
regex: {
|
1987
|
+
hrspre: new RegExp("[012]"),
|
1988
|
+
hrs24: new RegExp("2[0-4]|1[3-9]"),
|
1989
|
+
hrs: new RegExp("[01][0-9]|2[0-4]"),
|
1990
|
+
ampm: new RegExp("^[a|p|A|P][m|M]"),
|
1991
|
+
mspre: new RegExp("[0-5]"),
|
1992
|
+
ms: new RegExp("[0-5][0-9]")
|
1993
|
+
},
|
1994
|
+
timeseparator: ":",
|
1995
|
+
hourFormat: "24",
|
1996
|
+
definitions: {
|
1997
|
+
h: {
|
1998
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
1999
|
+
if ("24" === opts.hourFormat && 24 === parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0",
|
2000
|
+
maskset.buffer[pos] = "0", {
|
2001
|
+
refreshFromBuffer: {
|
2002
|
+
start: pos - 1,
|
2003
|
+
end: pos
|
2004
|
+
},
|
2005
|
+
c: "0"
|
2006
|
+
};
|
2007
|
+
var isValid = opts.regex.hrs.test(chrs);
|
2008
|
+
if (!strict && !isValid && (chrs.charAt(1) === opts.timeseparator || -1 !== "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
|
2009
|
+
maskset.buffer[pos] = chrs.charAt(0), pos++, {
|
2010
|
+
refreshFromBuffer: {
|
2011
|
+
start: pos - 2,
|
2012
|
+
end: pos
|
2013
|
+
},
|
2014
|
+
pos: pos,
|
2015
|
+
c: opts.timeseparator
|
2016
|
+
};
|
2017
|
+
if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
|
2018
|
+
var tmp = parseInt(chrs, 10);
|
2019
|
+
return 24 === tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p",
|
2020
|
+
maskset.buffer[pos + 6] = "m"), tmp -= 12, tmp < 10 ? (maskset.buffer[pos] = tmp.toString(),
|
2021
|
+
maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1),
|
2022
|
+
maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {
|
2023
|
+
refreshFromBuffer: {
|
2024
|
+
start: pos - 1,
|
2025
|
+
end: pos + 6
|
2026
|
+
},
|
2027
|
+
c: maskset.buffer[pos]
|
2028
|
+
};
|
2029
|
+
}
|
2030
|
+
return isValid;
|
2031
|
+
},
|
2032
|
+
cardinality: 2,
|
2033
|
+
prevalidator: [ {
|
2034
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
2035
|
+
var isValid = opts.regex.hrspre.test(chrs);
|
2036
|
+
return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
2037
|
+
pos++, {
|
2038
|
+
pos: pos
|
2039
|
+
});
|
2040
|
+
},
|
2041
|
+
cardinality: 1
|
2042
|
+
} ]
|
2043
|
+
},
|
2044
|
+
s: {
|
2045
|
+
validator: "[0-5][0-9]",
|
2046
|
+
cardinality: 2,
|
2047
|
+
prevalidator: [ {
|
2048
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
2049
|
+
var isValid = opts.regex.mspre.test(chrs);
|
2050
|
+
return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
2051
|
+
pos++, {
|
2052
|
+
pos: pos
|
2053
|
+
});
|
2054
|
+
},
|
2055
|
+
cardinality: 1
|
2056
|
+
} ]
|
2057
|
+
},
|
2058
|
+
t: {
|
2059
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
2060
|
+
return opts.regex.ampm.test(chrs + "m");
|
2061
|
+
},
|
2062
|
+
casing: "lower",
|
2063
|
+
cardinality: 1
|
2064
|
+
}
|
2065
|
+
},
|
2066
|
+
insertMode: !1,
|
2067
|
+
autoUnmask: !1
|
2068
|
+
},
|
2069
|
+
datetime12: {
|
2070
|
+
mask: "1/2/y h:s t\\m",
|
2071
|
+
placeholder: "dd/mm/yyyy hh:mm xm",
|
2072
|
+
alias: "datetime",
|
2073
|
+
hourFormat: "12"
|
2074
|
+
},
|
2075
|
+
"mm/dd/yyyy hh:mm xm": {
|
2076
|
+
mask: "1/2/y h:s t\\m",
|
2077
|
+
placeholder: "mm/dd/yyyy hh:mm xm",
|
2078
|
+
alias: "datetime12",
|
2079
|
+
regex: {
|
2080
|
+
val2pre: function(separator) {
|
2081
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
2082
|
+
return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
|
2083
|
+
},
|
2084
|
+
val2: function(separator) {
|
2085
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
2086
|
+
return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
|
2087
|
+
},
|
2088
|
+
val1pre: new RegExp("[01]"),
|
2089
|
+
val1: new RegExp("0[1-9]|1[012]")
|
2090
|
+
},
|
2091
|
+
leapday: "02/29/",
|
2092
|
+
onKeyDown: function(e, buffer, caretPos, opts) {
|
2093
|
+
var $input = $(this);
|
2094
|
+
if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
|
2095
|
+
var today = new Date();
|
2096
|
+
$input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()),
|
2097
|
+
$input.trigger("setvalue");
|
2098
|
+
}
|
2099
|
+
}
|
2100
|
+
},
|
2101
|
+
"hh:mm t": {
|
2102
|
+
mask: "h:s t\\m",
|
2103
|
+
placeholder: "hh:mm xm",
|
2104
|
+
alias: "datetime",
|
2105
|
+
hourFormat: "12"
|
2106
|
+
},
|
2107
|
+
"h:s t": {
|
2108
|
+
mask: "h:s t\\m",
|
2109
|
+
placeholder: "hh:mm xm",
|
2110
|
+
alias: "datetime",
|
2111
|
+
hourFormat: "12"
|
2112
|
+
},
|
2113
|
+
"hh:mm:ss": {
|
2114
|
+
mask: "h:s:s",
|
2115
|
+
placeholder: "hh:mm:ss",
|
2116
|
+
alias: "datetime",
|
2117
|
+
autoUnmask: !1
|
2118
|
+
},
|
2119
|
+
"hh:mm": {
|
2120
|
+
mask: "h:s",
|
2121
|
+
placeholder: "hh:mm",
|
2122
|
+
alias: "datetime",
|
2123
|
+
autoUnmask: !1
|
2124
|
+
},
|
2125
|
+
date: {
|
2126
|
+
alias: "dd/mm/yyyy"
|
2127
|
+
},
|
2128
|
+
"mm/yyyy": {
|
2129
|
+
mask: "1/y",
|
2130
|
+
placeholder: "mm/yyyy",
|
2131
|
+
leapday: "donotuse",
|
2132
|
+
separator: "/",
|
2133
|
+
alias: "mm/dd/yyyy"
|
2134
|
+
},
|
2135
|
+
shamsi: {
|
2136
|
+
regex: {
|
2137
|
+
val2pre: function(separator) {
|
2138
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
2139
|
+
return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "[0-3])");
|
2140
|
+
},
|
2141
|
+
val2: function(separator) {
|
2142
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
2143
|
+
return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[1-9]|1[012])" + escapedSeparator + "30)|((0[1-6])" + escapedSeparator + "31)");
|
2144
|
+
},
|
2145
|
+
val1pre: new RegExp("[01]"),
|
2146
|
+
val1: new RegExp("0[1-9]|1[012]")
|
2147
|
+
},
|
2148
|
+
yearrange: {
|
2149
|
+
minyear: 1300,
|
2150
|
+
maxyear: 1499
|
2151
|
+
},
|
2152
|
+
mask: "y/1/2",
|
2153
|
+
leapday: "/12/30",
|
2154
|
+
placeholder: "yyyy/mm/dd",
|
2155
|
+
alias: "mm/dd/yyyy",
|
2156
|
+
clearIncomplete: !0
|
2157
|
+
},
|
2158
|
+
"yyyy-mm-dd hh:mm:ss": {
|
2159
|
+
mask: "y-1-2 h:s:s",
|
2160
|
+
placeholder: "yyyy-mm-dd hh:mm:ss",
|
2161
|
+
alias: "datetime",
|
2162
|
+
separator: "-",
|
2163
|
+
leapday: "-02-29",
|
2164
|
+
regex: {
|
2165
|
+
val2pre: function(separator) {
|
2166
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
2167
|
+
return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
|
2168
|
+
},
|
2169
|
+
val2: function(separator) {
|
2170
|
+
var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
|
2171
|
+
return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
|
2172
|
+
},
|
2173
|
+
val1pre: new RegExp("[01]"),
|
2174
|
+
val1: new RegExp("0[1-9]|1[012]")
|
2175
|
+
},
|
2176
|
+
onKeyDown: function(e, buffer, caretPos, opts) {}
|
2177
|
+
}
|
2178
|
+
}), Inputmask;
|
2179
|
+
});
|
2180
|
+
}, function(module, exports, __webpack_require__) {
|
2181
|
+
"use strict";
|
2182
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
2183
|
+
"function" == typeof Symbol && Symbol.iterator;
|
2184
|
+
!function(factory) {
|
2185
|
+
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ],
|
2186
|
+
__WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
2187
|
+
}(function($, Inputmask) {
|
2188
|
+
return Inputmask.extendDefinitions({
|
2189
|
+
A: {
|
2190
|
+
validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
|
2191
|
+
cardinality: 1,
|
2192
|
+
casing: "upper"
|
2193
|
+
},
|
2194
|
+
"&": {
|
2195
|
+
validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
|
2196
|
+
cardinality: 1,
|
2197
|
+
casing: "upper"
|
2198
|
+
},
|
2199
|
+
"#": {
|
2200
|
+
validator: "[0-9A-Fa-f]",
|
2201
|
+
cardinality: 1,
|
2202
|
+
casing: "upper"
|
2203
|
+
}
|
2204
|
+
}), Inputmask.extendAliases({
|
2205
|
+
url: {
|
2206
|
+
definitions: {
|
2207
|
+
i: {
|
2208
|
+
validator: ".",
|
2209
|
+
cardinality: 1
|
2210
|
+
}
|
2211
|
+
},
|
2212
|
+
mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",
|
2213
|
+
insertMode: !1,
|
2214
|
+
autoUnmask: !1,
|
2215
|
+
inputmode: "url"
|
2216
|
+
},
|
2217
|
+
ip: {
|
2218
|
+
mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
|
2219
|
+
definitions: {
|
2220
|
+
i: {
|
2221
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
2222
|
+
return pos - 1 > -1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
|
2223
|
+
chrs = pos - 2 > -1 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
|
2224
|
+
new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
|
2225
|
+
},
|
2226
|
+
cardinality: 1
|
2227
|
+
}
|
2228
|
+
},
|
2229
|
+
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
2230
|
+
return maskedValue;
|
2231
|
+
},
|
2232
|
+
inputmode: "numeric"
|
2233
|
+
},
|
2234
|
+
email: {
|
2235
|
+
mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
|
2236
|
+
greedy: !1,
|
2237
|
+
onBeforePaste: function(pastedValue, opts) {
|
2238
|
+
return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
|
2239
|
+
},
|
2240
|
+
definitions: {
|
2241
|
+
"*": {
|
2242
|
+
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
|
2243
|
+
cardinality: 1,
|
2244
|
+
casing: "lower"
|
2245
|
+
},
|
2246
|
+
"-": {
|
2247
|
+
validator: "[0-9A-Za-z-]",
|
2248
|
+
cardinality: 1,
|
2249
|
+
casing: "lower"
|
2250
|
+
}
|
2251
|
+
},
|
2252
|
+
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
2253
|
+
return maskedValue;
|
2254
|
+
},
|
2255
|
+
inputmode: "email"
|
2256
|
+
},
|
2257
|
+
mac: {
|
2258
|
+
mask: "##:##:##:##:##:##"
|
2259
|
+
},
|
2260
|
+
vin: {
|
2261
|
+
mask: "V{13}9{4}",
|
2262
|
+
definitions: {
|
2263
|
+
V: {
|
2264
|
+
validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
|
2265
|
+
cardinality: 1,
|
2266
|
+
casing: "upper"
|
2267
|
+
}
|
2268
|
+
},
|
2269
|
+
clearIncomplete: !0,
|
2270
|
+
autoUnmask: !0
|
2271
|
+
}
|
2272
|
+
}), Inputmask;
|
2273
|
+
});
|
2274
|
+
}, function(module, exports, __webpack_require__) {
|
2275
|
+
"use strict";
|
2276
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
2277
|
+
"function" == typeof Symbol && Symbol.iterator;
|
2278
|
+
!function(factory) {
|
2279
|
+
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ],
|
2280
|
+
__WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
2281
|
+
}(function($, Inputmask, undefined) {
|
2282
|
+
function autoEscape(txt, opts) {
|
2283
|
+
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);
|
2284
|
+
return escapedTxt;
|
2285
|
+
}
|
2286
|
+
return Inputmask.extendAliases({
|
2287
|
+
numeric: {
|
2288
|
+
mask: function(opts) {
|
2289
|
+
if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat),
|
2290
|
+
opts.repeat = 0, opts.groupSeparator === opts.radixPoint && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""),
|
2291
|
+
" " === opts.groupSeparator && (opts.skipOptionalPartCharacter = undefined), opts.autoGroup = opts.autoGroup && "" !== opts.groupSeparator,
|
2292
|
+
opts.autoGroup && ("string" == typeof opts.groupSize && isFinite(opts.groupSize) && (opts.groupSize = parseInt(opts.groupSize)),
|
2293
|
+
isFinite(opts.integerDigits))) {
|
2294
|
+
var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize;
|
2295
|
+
opts.integerDigits = parseInt(opts.integerDigits) + (0 === mod ? seps - 1 : seps),
|
2296
|
+
opts.integerDigits < 1 && (opts.integerDigits = "*");
|
2297
|
+
}
|
2298
|
+
opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)),
|
2299
|
+
"radixFocus" === opts.positionCaretOnClick && "" === opts.placeholder && !1 === opts.integerOptional && (opts.positionCaretOnClick = "lvp"),
|
2300
|
+
opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~",
|
2301
|
+
!0 === opts.numericInput && (opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick,
|
2302
|
+
opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts.decimalProtect = !1);
|
2303
|
+
var mask = "[+]";
|
2304
|
+
if (mask += autoEscape(opts.prefix, opts), !0 === opts.integerOptional ? mask += "~{1," + opts.integerDigits + "}" : mask += "~{" + opts.integerDigits + "}",
|
2305
|
+
opts.digits !== undefined) {
|
2306
|
+
opts.radixPointDefinitionSymbol = opts.decimalProtect ? ":" : opts.radixPoint;
|
2307
|
+
var dq = opts.digits.toString().split(",");
|
2308
|
+
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 + "}");
|
2309
|
+
}
|
2310
|
+
return mask += autoEscape(opts.suffix, opts), mask += "[-]", opts.greedy = !1, mask;
|
2311
|
+
},
|
2312
|
+
placeholder: "",
|
2313
|
+
greedy: !1,
|
2314
|
+
digits: "*",
|
2315
|
+
digitsOptional: !0,
|
2316
|
+
enforceDigitsOnBlur: !1,
|
2317
|
+
radixPoint: ".",
|
2318
|
+
positionCaretOnClick: "radixFocus",
|
2319
|
+
groupSize: 3,
|
2320
|
+
groupSeparator: "",
|
2321
|
+
autoGroup: !1,
|
2322
|
+
allowMinus: !0,
|
2323
|
+
negationSymbol: {
|
2324
|
+
front: "-",
|
2325
|
+
back: ""
|
2326
|
+
},
|
2327
|
+
integerDigits: "+",
|
2328
|
+
integerOptional: !0,
|
2329
|
+
prefix: "",
|
2330
|
+
suffix: "",
|
2331
|
+
rightAlign: !0,
|
2332
|
+
decimalProtect: !0,
|
2333
|
+
min: null,
|
2334
|
+
max: null,
|
2335
|
+
step: 1,
|
2336
|
+
insertMode: !0,
|
2337
|
+
autoUnmask: !1,
|
2338
|
+
unmaskAsNumber: !1,
|
2339
|
+
inputmode: "numeric",
|
2340
|
+
preValidation: function(buffer, pos, c, isSelection, opts) {
|
2341
|
+
if ("-" === c || c === opts.negationSymbol.front) return !0 === opts.allowMinus && (opts.isNegative = opts.isNegative === undefined || !opts.isNegative,
|
2342
|
+
"" === buffer.join("") || {
|
2343
|
+
caret: pos,
|
2344
|
+
dopost: !0
|
2345
|
+
});
|
2346
|
+
if (!1 === isSelection && c === opts.radixPoint && opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) {
|
2347
|
+
var radixPos = $.inArray(opts.radixPoint, buffer);
|
2348
|
+
if (-1 !== radixPos) return !0 === opts.numericInput ? pos === radixPos : {
|
2349
|
+
caret: radixPos + 1
|
2350
|
+
};
|
2351
|
+
}
|
2352
|
+
return !0;
|
2353
|
+
},
|
2354
|
+
postValidation: function(buffer, currentResult, opts) {
|
2355
|
+
var suffix = opts.suffix.split(""), prefix = opts.prefix.split("");
|
2356
|
+
if (currentResult.pos === undefined && currentResult.caret !== undefined && !0 !== currentResult.dopost) return currentResult;
|
2357
|
+
var caretPos = currentResult.caret !== undefined ? currentResult.caret : currentResult.pos, maskedValue = buffer.slice();
|
2358
|
+
opts.numericInput && (caretPos = maskedValue.length - caretPos - 1, maskedValue = maskedValue.reverse());
|
2359
|
+
var charAtPos = maskedValue[caretPos];
|
2360
|
+
if (charAtPos === opts.groupSeparator && (caretPos += 1, charAtPos = maskedValue[caretPos]),
|
2361
|
+
caretPos === maskedValue.length - opts.suffix.length - 1 && charAtPos === opts.radixPoint) return currentResult;
|
2362
|
+
charAtPos !== undefined && charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back && (maskedValue[caretPos] = "?",
|
2363
|
+
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))] = "?")),
|
2364
|
+
prefix = prefix.join(""), suffix = suffix.join("");
|
2365
|
+
var processValue = maskedValue.join("").replace(prefix, "");
|
2366
|
+
if (processValue = processValue.replace(suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
2367
|
+
processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""),
|
2368
|
+
processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
|
2369
|
+
isNaN(opts.placeholder) && (processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.placeholder), "g"), "")),
|
2370
|
+
processValue.length > 1 && 1 !== processValue.indexOf(opts.radixPoint) && ("0" === charAtPos && (processValue = processValue.replace(/^\?/g, "")),
|
2371
|
+
processValue = processValue.replace(/^0/g, "")), processValue.charAt(0) === opts.radixPoint && "" !== opts.radixPoint && !0 !== opts.numericInput && (processValue = "0" + processValue),
|
2372
|
+
"" !== processValue) {
|
2373
|
+
if (processValue = processValue.split(""), (!opts.digitsOptional || opts.enforceDigitsOnBlur && "blur" === currentResult.event) && isFinite(opts.digits)) {
|
2374
|
+
var radixPosition = $.inArray(opts.radixPoint, processValue), rpb = $.inArray(opts.radixPoint, maskedValue);
|
2375
|
+
-1 === radixPosition && (processValue.push(opts.radixPoint), radixPosition = processValue.length - 1);
|
2376
|
+
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);
|
2377
|
+
}
|
2378
|
+
if (!0 !== opts.autoGroup || "" === opts.groupSeparator || charAtPos === opts.radixPoint && currentResult.pos === undefined && !currentResult.dopost) processValue = processValue.join(""); else {
|
2379
|
+
var addRadix = processValue[processValue.length - 1] === opts.radixPoint && currentResult.c === opts.radixPoint;
|
2380
|
+
processValue = Inputmask(function(buffer, opts) {
|
2381
|
+
var postMask = "";
|
2382
|
+
if (postMask += "(" + opts.groupSeparator + "*{" + opts.groupSize + "}){*}", "" !== opts.radixPoint) {
|
2383
|
+
var radixSplit = buffer.join("").split(opts.radixPoint);
|
2384
|
+
radixSplit[1] && (postMask += opts.radixPoint + "*{" + radixSplit[1].match(/^\d*\??\d*/)[0].length + "}");
|
2385
|
+
}
|
2386
|
+
return postMask;
|
2387
|
+
}(processValue, opts), {
|
2388
|
+
numericInput: !0,
|
2389
|
+
jitMasking: !0,
|
2390
|
+
definitions: {
|
2391
|
+
"*": {
|
2392
|
+
validator: "[0-9?]",
|
2393
|
+
cardinality: 1
|
2394
|
+
}
|
2395
|
+
}
|
2396
|
+
}).format(processValue.join("")), addRadix && (processValue += opts.radixPoint),
|
2397
|
+
processValue.charAt(0) === opts.groupSeparator && processValue.substr(1);
|
2398
|
+
}
|
2399
|
+
}
|
2400
|
+
if (opts.isNegative && "blur" === currentResult.event && (opts.isNegative = "0" !== processValue),
|
2401
|
+
processValue = prefix + processValue, processValue += suffix, opts.isNegative && (processValue = opts.negationSymbol.front + processValue,
|
2402
|
+
processValue += opts.negationSymbol.back), processValue = processValue.split(""),
|
2403
|
+
charAtPos !== undefined) if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) caretPos = $.inArray("?", processValue),
|
2404
|
+
caretPos > -1 ? processValue[caretPos] = charAtPos : caretPos = currentResult.caret || 0; else if (charAtPos === opts.radixPoint || charAtPos === opts.negationSymbol.front || charAtPos === opts.negationSymbol.back) {
|
2405
|
+
var newCaretPos = $.inArray(charAtPos, processValue);
|
2406
|
+
-1 !== newCaretPos && (caretPos = newCaretPos);
|
2407
|
+
}
|
2408
|
+
opts.numericInput && (caretPos = processValue.length - caretPos - 1, processValue = processValue.reverse());
|
2409
|
+
var rslt = {
|
2410
|
+
caret: charAtPos === undefined || currentResult.pos !== undefined ? caretPos + (opts.numericInput ? -1 : 1) : caretPos,
|
2411
|
+
buffer: processValue,
|
2412
|
+
refreshFromBuffer: currentResult.dopost || buffer.join("") !== processValue.join("")
|
2413
|
+
};
|
2414
|
+
return rslt.refreshFromBuffer ? rslt : currentResult;
|
2415
|
+
},
|
2416
|
+
onBeforeWrite: function(e, buffer, caretPos, opts) {
|
2417
|
+
if (e) switch (e.type) {
|
2418
|
+
case "keydown":
|
2419
|
+
return opts.postValidation(buffer, {
|
2420
|
+
caret: caretPos,
|
2421
|
+
dopost: !0
|
2422
|
+
}, opts);
|
2423
|
+
|
2424
|
+
case "blur":
|
2425
|
+
case "checkval":
|
2426
|
+
var unmasked;
|
2427
|
+
if (function(opts) {
|
2428
|
+
opts.parseMinMaxOptions === undefined && (null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
2429
|
+
"," === opts.radixPoint && (opts.min = opts.min.replace(opts.radixPoint, ".")),
|
2430
|
+
opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN, isNaN(opts.min) && (opts.min = Number.MIN_VALUE)),
|
2431
|
+
null !== opts.max && (opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
2432
|
+
"," === opts.radixPoint && (opts.max = opts.max.replace(opts.radixPoint, ".")),
|
2433
|
+
opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN, isNaN(opts.max) && (opts.max = Number.MAX_VALUE)),
|
2434
|
+
opts.parseMinMaxOptions = "done");
|
2435
|
+
}(opts), null !== opts.min || null !== opts.max) {
|
2436
|
+
if (unmasked = opts.onUnMask(buffer.join(""), undefined, $.extend({}, opts, {
|
2437
|
+
unmaskAsNumber: !0
|
2438
|
+
})), null !== opts.min && unmasked < opts.min) return opts.isNegative = opts.min < 0,
|
2439
|
+
opts.postValidation(opts.min.toString().replace(".", opts.radixPoint).split(""), {
|
2440
|
+
caret: caretPos,
|
2441
|
+
dopost: !0,
|
2442
|
+
placeholder: "0"
|
2443
|
+
}, opts);
|
2444
|
+
if (null !== opts.max && unmasked > opts.max) return opts.isNegative = opts.max < 0,
|
2445
|
+
opts.postValidation(opts.max.toString().replace(".", opts.radixPoint).split(""), {
|
2446
|
+
caret: caretPos,
|
2447
|
+
dopost: !0,
|
2448
|
+
placeholder: "0"
|
2449
|
+
}, opts);
|
2450
|
+
}
|
2451
|
+
return opts.postValidation(buffer, {
|
2452
|
+
caret: caretPos,
|
2453
|
+
placeholder: "0",
|
2454
|
+
event: "blur"
|
2455
|
+
}, opts);
|
2456
|
+
|
2457
|
+
case "_checkval":
|
2458
|
+
return {
|
2459
|
+
caret: caretPos
|
2460
|
+
};
|
2461
|
+
}
|
2462
|
+
},
|
2463
|
+
regex: {
|
2464
|
+
integerPart: function(opts, emptyCheck) {
|
2465
|
+
return emptyCheck ? new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?") : new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+");
|
2466
|
+
},
|
2467
|
+
integerNPart: function(opts) {
|
2468
|
+
return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + Inputmask.escapeRegex(opts.placeholder.charAt(0)) + "]+");
|
2469
|
+
}
|
2470
|
+
},
|
2471
|
+
definitions: {
|
2472
|
+
"~": {
|
2473
|
+
validator: function(chrs, maskset, pos, strict, opts, isSelection) {
|
2474
|
+
var isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs);
|
2475
|
+
if (!0 === isValid) {
|
2476
|
+
if (!0 !== opts.numericInput && maskset.validPositions[pos] !== undefined && "~" === maskset.validPositions[pos].match.def && !isSelection) {
|
2477
|
+
var processValue = maskset.buffer.join("");
|
2478
|
+
processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""),
|
2479
|
+
processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "");
|
2480
|
+
var pvRadixSplit = processValue.split(opts.radixPoint);
|
2481
|
+
pvRadixSplit.length > 1 && (pvRadixSplit[1] = pvRadixSplit[1].replace(/0/g, opts.placeholder.charAt(0))),
|
2482
|
+
"0" === pvRadixSplit[0] && (pvRadixSplit[0] = pvRadixSplit[0].replace(/0/g, opts.placeholder.charAt(0))),
|
2483
|
+
processValue = pvRadixSplit[0] + opts.radixPoint + pvRadixSplit[1] || "";
|
2484
|
+
var bufferTemplate = maskset._buffer.join("");
|
2485
|
+
for (processValue === opts.radixPoint && (processValue = bufferTemplate); null === processValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1);
|
2486
|
+
processValue = processValue.replace(bufferTemplate, ""), processValue = processValue.split(""),
|
2487
|
+
isValid = processValue[pos] === undefined ? {
|
2488
|
+
pos: pos,
|
2489
|
+
remove: pos
|
2490
|
+
} : {
|
2491
|
+
pos: pos
|
2492
|
+
};
|
2493
|
+
}
|
2494
|
+
} else strict || chrs !== opts.radixPoint || maskset.validPositions[pos - 1] !== undefined || (maskset.buffer[pos] = "0",
|
2495
|
+
isValid = {
|
2496
|
+
pos: pos + 1
|
2497
|
+
});
|
2498
|
+
return isValid;
|
2499
|
+
},
|
2500
|
+
cardinality: 1
|
2501
|
+
},
|
2502
|
+
"+": {
|
2503
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
2504
|
+
return opts.allowMinus && ("-" === chrs || chrs === opts.negationSymbol.front);
|
2505
|
+
},
|
2506
|
+
cardinality: 1,
|
2507
|
+
placeholder: ""
|
2508
|
+
},
|
2509
|
+
"-": {
|
2510
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
2511
|
+
return opts.allowMinus && chrs === opts.negationSymbol.back;
|
2512
|
+
},
|
2513
|
+
cardinality: 1,
|
2514
|
+
placeholder: ""
|
2515
|
+
},
|
2516
|
+
":": {
|
2517
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
2518
|
+
var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + "]", isValid = new RegExp(radix).test(chrs);
|
2519
|
+
return isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint && (isValid = {
|
2520
|
+
caret: pos + 1
|
2521
|
+
}), isValid;
|
2522
|
+
},
|
2523
|
+
cardinality: 1,
|
2524
|
+
placeholder: function(opts) {
|
2525
|
+
return opts.radixPoint;
|
2526
|
+
}
|
2527
|
+
}
|
2528
|
+
},
|
2529
|
+
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
2530
|
+
if ("" === unmaskedValue && !0 === opts.nullable) return unmaskedValue;
|
2531
|
+
var processValue = maskedValue.replace(opts.prefix, "");
|
2532
|
+
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
2533
|
+
"" !== opts.placeholder.charAt(0) && (processValue = processValue.replace(new RegExp(opts.placeholder.charAt(0), "g"), "0")),
|
2534
|
+
opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")),
|
2535
|
+
processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"),
|
2536
|
+
processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
|
2537
|
+
Number(processValue)) : processValue;
|
2538
|
+
},
|
2539
|
+
isComplete: function(buffer, opts) {
|
2540
|
+
var maskedValue = buffer.join("");
|
2541
|
+
if (buffer.slice().join("") !== maskedValue) return !1;
|
2542
|
+
var processValue = maskedValue.replace(opts.prefix, "");
|
2543
|
+
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
2544
|
+
"," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
|
2545
|
+
isFinite(processValue);
|
2546
|
+
},
|
2547
|
+
onBeforeMask: function(initialValue, opts) {
|
2548
|
+
if (opts.isNegative = undefined, initialValue = initialValue.toString().charAt(initialValue.length - 1) === opts.radixPoint ? initialValue.toString().substr(0, initialValue.length - 1) : initialValue.toString(),
|
2549
|
+
"" !== opts.radixPoint && isFinite(initialValue)) {
|
2550
|
+
var vs = initialValue.split("."), groupSize = "" !== opts.groupSeparator ? parseInt(opts.groupSize) : 0;
|
2551
|
+
2 === vs.length && (vs[0].length > groupSize || vs[1].length > groupSize || vs[0].length <= groupSize && vs[1].length < groupSize) && (initialValue = initialValue.replace(".", opts.radixPoint));
|
2552
|
+
}
|
2553
|
+
var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
|
2554
|
+
if (dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
|
2555
|
+
initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""),
|
2556
|
+
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"), ""),
|
2557
|
+
0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))),
|
2558
|
+
"" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) {
|
2559
|
+
var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0];
|
2560
|
+
if (parseInt(opts.digits) < decPart.toString().length) {
|
2561
|
+
var digitsFactor = Math.pow(10, parseInt(opts.digits));
|
2562
|
+
initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), "."),
|
2563
|
+
initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor,
|
2564
|
+
initialValue = initialValue.toString().replace(".", opts.radixPoint);
|
2565
|
+
}
|
2566
|
+
}
|
2567
|
+
return initialValue;
|
2568
|
+
},
|
2569
|
+
canClearPosition: function(maskset, position, lvp, strict, opts) {
|
2570
|
+
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;
|
2571
|
+
return !canClear || "+" !== vp.match.nativeDef && "-" !== vp.match.nativeDef || (opts.isNegative = !1),
|
2572
|
+
canClear;
|
2573
|
+
},
|
2574
|
+
onKeyDown: function(e, buffer, caretPos, opts) {
|
2575
|
+
var $input = $(this);
|
2576
|
+
if (e.ctrlKey) switch (e.keyCode) {
|
2577
|
+
case Inputmask.keyCode.UP:
|
2578
|
+
$input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)), $input.trigger("setvalue");
|
2579
|
+
break;
|
2580
|
+
|
2581
|
+
case Inputmask.keyCode.DOWN:
|
2582
|
+
$input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)), $input.trigger("setvalue");
|
2583
|
+
}
|
2584
|
+
}
|
2585
|
+
},
|
2586
|
+
currency: {
|
2587
|
+
prefix: "$ ",
|
2588
|
+
groupSeparator: ",",
|
2589
|
+
alias: "numeric",
|
2590
|
+
placeholder: "0",
|
2591
|
+
autoGroup: !0,
|
2592
|
+
digits: 2,
|
2593
|
+
digitsOptional: !1,
|
2594
|
+
clearMaskOnLostFocus: !1
|
2595
|
+
},
|
2596
|
+
decimal: {
|
2597
|
+
alias: "numeric"
|
2598
|
+
},
|
2599
|
+
integer: {
|
2600
|
+
alias: "numeric",
|
2601
|
+
digits: 0,
|
2602
|
+
radixPoint: ""
|
2603
|
+
},
|
2604
|
+
percentage: {
|
2605
|
+
alias: "numeric",
|
2606
|
+
digits: 2,
|
2607
|
+
digitsOptional: !0,
|
2608
|
+
radixPoint: ".",
|
2609
|
+
placeholder: "0",
|
2610
|
+
autoGroup: !1,
|
2611
|
+
min: 0,
|
2612
|
+
max: 100,
|
2613
|
+
suffix: " %",
|
2614
|
+
allowMinus: !1
|
2615
|
+
}
|
2616
|
+
}), Inputmask;
|
2617
|
+
});
|
2618
|
+
}, function(module, exports, __webpack_require__) {
|
2619
|
+
"use strict";
|
2620
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
2621
|
+
"function" == typeof Symbol && Symbol.iterator;
|
2622
|
+
!function(factory) {
|
2623
|
+
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ],
|
2624
|
+
__WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
2625
|
+
}(function($, Inputmask) {
|
2626
|
+
function maskSort(a, b) {
|
2627
|
+
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];
|
2628
|
+
return 0 === maskbs.indexOf(maskas) ? -1 : 0 === maskas.indexOf(maskbs) ? 1 : maska.localeCompare(maskb);
|
2629
|
+
}
|
2630
|
+
var analyseMaskBase = Inputmask.prototype.analyseMask;
|
2631
|
+
return Inputmask.prototype.analyseMask = function(mask, regexMask, opts) {
|
2632
|
+
function reduceVariations(masks, previousVariation, previousmaskGroup) {
|
2633
|
+
previousVariation = previousVariation || "", previousmaskGroup = previousmaskGroup || maskGroups,
|
2634
|
+
"" !== previousVariation && (previousmaskGroup[previousVariation] = {});
|
2635
|
+
for (var variation = "", maskGroup = previousmaskGroup[previousVariation] || previousmaskGroup, i = masks.length - 1; i >= 0; i--) mask = masks[i].mask || masks[i],
|
2636
|
+
variation = mask.substr(0, 1), maskGroup[variation] = maskGroup[variation] || [],
|
2637
|
+
maskGroup[variation].unshift(mask.substr(1)), masks.splice(i, 1);
|
2638
|
+
for (var ndx in maskGroup) maskGroup[ndx].length > 500 && reduceVariations(maskGroup[ndx].slice(), ndx, maskGroup);
|
2639
|
+
}
|
2640
|
+
function rebuild(maskGroup) {
|
2641
|
+
var mask = "", submasks = [];
|
2642
|
+
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]));
|
2643
|
+
return 1 === submasks.length ? mask += submasks[0] : mask += opts.groupmarker.start + submasks.join(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start) + opts.groupmarker.end,
|
2644
|
+
mask;
|
2645
|
+
}
|
2646
|
+
var maskGroups = {};
|
2647
|
+
return opts.phoneCodes && (opts.phoneCodes && opts.phoneCodes.length > 1e3 && (mask = mask.substr(1, mask.length - 2),
|
2648
|
+
reduceVariations(mask.split(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start)),
|
2649
|
+
mask = rebuild(maskGroups)), mask = mask.replace(/9/g, "\\9")), analyseMaskBase.call(this, mask, regexMask, opts);
|
2650
|
+
}, Inputmask.extendAliases({
|
2651
|
+
abstractphone: {
|
2652
|
+
groupmarker: {
|
2653
|
+
start: "<",
|
2654
|
+
end: ">"
|
2655
|
+
},
|
2656
|
+
countrycode: "",
|
2657
|
+
phoneCodes: [],
|
2658
|
+
mask: function(opts) {
|
2659
|
+
return opts.definitions = {
|
2660
|
+
"#": Inputmask.prototype.definitions[9]
|
2661
|
+
}, opts.phoneCodes.sort(maskSort);
|
2662
|
+
},
|
2663
|
+
keepStatic: !0,
|
2664
|
+
onBeforeMask: function(value, opts) {
|
2665
|
+
var processedValue = value.replace(/^0{1,2}/, "").replace(/[\s]/g, "");
|
2666
|
+
return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue),
|
2667
|
+
processedValue;
|
2668
|
+
},
|
2669
|
+
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
2670
|
+
return maskedValue.replace(/[()#-]/g, "");
|
2671
|
+
},
|
2672
|
+
inputmode: "tel"
|
2673
|
+
}
|
2674
|
+
}), Inputmask;
|
2675
|
+
});
|
2676
|
+
}, function(module, exports, __webpack_require__) {
|
2677
|
+
"use strict";
|
2678
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
2679
|
+
"function" == typeof Symbol && Symbol.iterator;
|
2680
|
+
!function(factory) {
|
2681
|
+
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ],
|
2682
|
+
__WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
2683
|
+
}(function($, Inputmask) {
|
2684
|
+
return Inputmask.extendAliases({
|
2685
|
+
Regex: {
|
2686
|
+
mask: "r",
|
2687
|
+
greedy: !1,
|
2688
|
+
repeat: "*",
|
2689
|
+
regex: null,
|
2690
|
+
regexTokens: null,
|
2691
|
+
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,
|
2692
|
+
quantifierFilter: /[0-9]+[^,]/,
|
2693
|
+
isComplete: function(buffer, opts) {
|
2694
|
+
return new RegExp(opts.regex, opts.casing ? "i" : "").test(buffer.join(""));
|
2695
|
+
},
|
2696
|
+
definitions: {
|
2697
|
+
r: {
|
2698
|
+
validator: function(chrs, maskset, pos, strict, opts) {
|
2699
|
+
function RegexToken(isGroup, isQuantifier) {
|
2700
|
+
this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1,
|
2701
|
+
this.quantifier = {
|
2702
|
+
min: 1,
|
2703
|
+
max: 1
|
2704
|
+
}, this.repeaterPart = void 0;
|
2705
|
+
}
|
2706
|
+
function validateRegexToken(token, fromGroup) {
|
2707
|
+
var isvalid = !1;
|
2708
|
+
fromGroup && (regexPart += "(", openGroupCount++);
|
2709
|
+
for (var mndx = 0; mndx < token.matches.length; mndx++) {
|
2710
|
+
var matchToken = token.matches[mndx];
|
2711
|
+
if (!0 === matchToken.isGroup) isvalid = validateRegexToken(matchToken, !0); else if (!0 === matchToken.isQuantifier) {
|
2712
|
+
var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
|
2713
|
+
if (isNaN(matchToken.quantifier.max)) {
|
2714
|
+
for (;matchToken.repeaterPart && matchToken.repeaterPart !== regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
|
2715
|
+
isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart),
|
2716
|
+
regexPart = regexPartBak + matchToken.quantifier.max;
|
2717
|
+
} else {
|
2718
|
+
for (var i = 0, qm = matchToken.quantifier.max - 1; i < qm && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
|
2719
|
+
regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
|
2720
|
+
}
|
2721
|
+
} else if (void 0 !== matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
|
2722
|
+
var testExp;
|
2723
|
+
if ("[" == matchToken.charAt(0)) {
|
2724
|
+
testExp = regexPart, testExp += matchToken;
|
2725
|
+
for (var j = 0; j < openGroupCount; j++) testExp += ")";
|
2726
|
+
var exp = new RegExp("^(" + testExp + ")$", opts.casing ? "i" : "");
|
2727
|
+
isvalid = exp.test(bufferStr);
|
2728
|
+
} else for (var l = 0, tl = matchToken.length; l < tl; l++) if ("\\" !== matchToken.charAt(l)) {
|
2729
|
+
testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
|
2730
|
+
for (var j = 0; j < openGroupCount; j++) testExp += ")";
|
2731
|
+
var exp = new RegExp("^(" + testExp + ")$", opts.casing ? "i" : "");
|
2732
|
+
if (isvalid = exp.test(bufferStr)) break;
|
2733
|
+
}
|
2734
|
+
regexPart += matchToken;
|
2735
|
+
}
|
2736
|
+
if (isvalid) break;
|
2737
|
+
}
|
2738
|
+
return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
|
2739
|
+
}
|
2740
|
+
var bufferStr, groupToken, cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
|
2741
|
+
null === opts.regexTokens && function() {
|
2742
|
+
var match, m, currentToken = new RegexToken(), opengroups = [];
|
2743
|
+
for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0],
|
2744
|
+
m.charAt(0)) {
|
2745
|
+
case "(":
|
2746
|
+
opengroups.push(new RegexToken(!0));
|
2747
|
+
break;
|
2748
|
+
|
2749
|
+
case ")":
|
2750
|
+
groupToken = opengroups.pop(), opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
|
2751
|
+
break;
|
2752
|
+
|
2753
|
+
case "{":
|
2754
|
+
case "+":
|
2755
|
+
case "*":
|
2756
|
+
var quantifierToken = new RegexToken(!1, !0);
|
2757
|
+
m = m.replace(/[{}]/g, "");
|
2758
|
+
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]);
|
2759
|
+
if (quantifierToken.quantifier = {
|
2760
|
+
min: mq0,
|
2761
|
+
max: mq1
|
2762
|
+
}, opengroups.length > 0) {
|
2763
|
+
var matches = opengroups[opengroups.length - 1].matches;
|
2764
|
+
match = matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), groupToken.matches.push(match),
|
2765
|
+
match = groupToken), matches.push(match), matches.push(quantifierToken);
|
2766
|
+
} else match = currentToken.matches.pop(), match.isGroup || (groupToken = new RegexToken(!0),
|
2767
|
+
groupToken.matches.push(match), match = groupToken), currentToken.matches.push(match),
|
2768
|
+
currentToken.matches.push(quantifierToken);
|
2769
|
+
break;
|
2770
|
+
|
2771
|
+
default:
|
2772
|
+
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(m) : currentToken.matches.push(m);
|
2773
|
+
}
|
2774
|
+
currentToken.matches.length > 0 && opts.regexTokens.push(currentToken);
|
2775
|
+
}(), cbuffer.splice(pos, 0, chrs), bufferStr = cbuffer.join("");
|
2776
|
+
for (var i = 0; i < opts.regexTokens.length; i++) {
|
2777
|
+
var regexToken = opts.regexTokens[i];
|
2778
|
+
if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
|
2779
|
+
}
|
2780
|
+
return isValid;
|
2781
|
+
},
|
2782
|
+
cardinality: 1
|
2783
|
+
}
|
2784
|
+
}
|
2785
|
+
}
|
2786
|
+
}), Inputmask;
|
2787
|
+
});
|
2788
|
+
}, function(module, exports, __webpack_require__) {
|
2789
|
+
"use strict";
|
2790
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
|
2791
|
+
return typeof obj;
|
2792
|
+
} : function(obj) {
|
2793
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
2794
|
+
};
|
2795
|
+
!function(factory) {
|
2796
|
+
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2), __webpack_require__(1) ],
|
2797
|
+
__WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
2798
|
+
}(function($, Inputmask) {
|
2799
|
+
return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) {
|
2800
|
+
var nptmask, input = this[0];
|
2801
|
+
if (void 0 === options && (options = {}), "string" == typeof fn) switch (fn) {
|
2802
|
+
case "unmaskedvalue":
|
2803
|
+
return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
|
2804
|
+
|
2805
|
+
case "remove":
|
2806
|
+
return this.each(function() {
|
2807
|
+
this.inputmask && this.inputmask.remove();
|
2808
|
+
});
|
2809
|
+
|
2810
|
+
case "getemptymask":
|
2811
|
+
return input && input.inputmask ? input.inputmask.getemptymask() : "";
|
2812
|
+
|
2813
|
+
case "hasMaskedValue":
|
2814
|
+
return !(!input || !input.inputmask) && input.inputmask.hasMaskedValue();
|
2815
|
+
|
2816
|
+
case "isComplete":
|
2817
|
+
return !input || !input.inputmask || input.inputmask.isComplete();
|
2818
|
+
|
2819
|
+
case "getmetadata":
|
2820
|
+
return input && input.inputmask ? input.inputmask.getmetadata() : void 0;
|
2821
|
+
|
2822
|
+
case "setvalue":
|
2823
|
+
$(input).val(options), input && void 0 === input.inputmask && $(input).triggerHandler("setvalue");
|
2824
|
+
break;
|
2825
|
+
|
2826
|
+
case "option":
|
2827
|
+
if ("string" != typeof options) return this.each(function() {
|
2828
|
+
if (void 0 !== this.inputmask) return this.inputmask.option(options);
|
2829
|
+
});
|
2830
|
+
if (input && void 0 !== input.inputmask) return input.inputmask.option(options);
|
2831
|
+
break;
|
2832
|
+
|
2833
|
+
default:
|
2834
|
+
return options.alias = fn, nptmask = new Inputmask(options), this.each(function() {
|
2835
|
+
nptmask.mask(this);
|
2836
|
+
});
|
2837
|
+
} else {
|
2838
|
+
if ("object" == (void 0 === fn ? "undefined" : _typeof(fn))) return nptmask = new Inputmask(fn),
|
2839
|
+
void 0 === fn.mask && void 0 === fn.alias ? this.each(function() {
|
2840
|
+
if (void 0 !== this.inputmask) return this.inputmask.option(fn);
|
2841
|
+
nptmask.mask(this);
|
2842
|
+
}) : this.each(function() {
|
2843
|
+
nptmask.mask(this);
|
2844
|
+
});
|
2845
|
+
if (void 0 === fn) return this.each(function() {
|
2846
|
+
nptmask = new Inputmask(options), nptmask.mask(this);
|
2847
|
+
});
|
2848
|
+
}
|
2849
|
+
}), $.fn.inputmask;
|
2850
|
+
});
|
2851
|
+
}, function(module, exports, __webpack_require__) {
|
2852
|
+
var content = __webpack_require__(13);
|
2853
|
+
"string" == typeof content && (content = [ [ module.i, content, "" ] ]);
|
2854
|
+
__webpack_require__(15)(content, {});
|
2855
|
+
content.locals && (module.exports = content.locals);
|
2856
|
+
}, function(module, exports, __webpack_require__) {
|
2857
|
+
"use strict";
|
2858
|
+
function _interopRequireDefault(obj) {
|
2859
|
+
return obj && obj.__esModule ? obj : {
|
2860
|
+
default: obj
|
2861
|
+
};
|
2862
|
+
}
|
2863
|
+
__webpack_require__(9), __webpack_require__(3), __webpack_require__(4), __webpack_require__(5),
|
2864
|
+
__webpack_require__(6), __webpack_require__(7);
|
2865
|
+
var _inputmask = __webpack_require__(1), _inputmask2 = _interopRequireDefault(_inputmask), _inputmask3 = __webpack_require__(0), _inputmask4 = _interopRequireDefault(_inputmask3), _jquery = __webpack_require__(2), _jquery2 = _interopRequireDefault(_jquery);
|
2866
|
+
_inputmask4.default === _jquery2.default && __webpack_require__(8), window.Inputmask = _inputmask2.default;
|
2867
|
+
}, function(module, exports, __webpack_require__) {
|
2868
|
+
"use strict";
|
2869
|
+
var __WEBPACK_AMD_DEFINE_RESULT__;
|
2870
|
+
"function" == typeof Symbol && Symbol.iterator;
|
2871
|
+
void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
2872
|
+
return document;
|
2873
|
+
}.call(exports, __webpack_require__, exports, module)) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
2874
|
+
}, function(module, exports, __webpack_require__) {
|
2875
|
+
"use strict";
|
2876
|
+
var __WEBPACK_AMD_DEFINE_RESULT__;
|
2877
|
+
"function" == typeof Symbol && Symbol.iterator;
|
2878
|
+
void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
2879
|
+
return window;
|
2880
|
+
}.call(exports, __webpack_require__, exports, module)) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
2881
|
+
}, function(module, exports, __webpack_require__) {
|
2882
|
+
exports = module.exports = __webpack_require__(14)(void 0), exports.push([ module.i, ".im-caret {\r\n\t-webkit-animation: 1s blink step-end infinite;\r\n\tanimation: 1s blink step-end infinite;\r\n}\r\n\r\n@keyframes blink {\r\n\tfrom, to {\r\n\t\tborder-right-color: black;\r\n\t}\r\n\t50% {\r\n\t\tborder-right-color: transparent;\r\n\t}\r\n}\r\n\r\n@-webkit-keyframes blink {\r\n\tfrom, to {\r\n\t\tborder-right-color: black;\r\n\t}\r\n\t50% {\r\n\t\tborder-right-color: transparent;\r\n\t}\r\n}\r\n\r\n.im-static {\r\n\tcolor: grey;\r\n}\r\n", "" ]);
|
2883
|
+
}, function(module, exports) {
|
2884
|
+
function cssWithMappingToString(item, useSourceMap) {
|
2885
|
+
var content = item[1] || "", cssMapping = item[3];
|
2886
|
+
if (!cssMapping) return content;
|
2887
|
+
if (useSourceMap && "function" == typeof btoa) {
|
2888
|
+
var sourceMapping = toComment(cssMapping);
|
2889
|
+
return [ content ].concat(cssMapping.sources.map(function(source) {
|
2890
|
+
return "/*# sourceURL=" + cssMapping.sourceRoot + source + " */";
|
2891
|
+
})).concat([ sourceMapping ]).join("\n");
|
2892
|
+
}
|
2893
|
+
return [ content ].join("\n");
|
2894
|
+
}
|
2895
|
+
function toComment(sourceMap) {
|
2896
|
+
return "/*# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
|
2897
|
+
}
|
2898
|
+
module.exports = function(useSourceMap) {
|
2899
|
+
var list = [];
|
2900
|
+
return list.toString = function() {
|
2901
|
+
return this.map(function(item) {
|
2902
|
+
var content = cssWithMappingToString(item, useSourceMap);
|
2903
|
+
return item[2] ? "@media " + item[2] + "{" + content + "}" : content;
|
2904
|
+
}).join("");
|
2905
|
+
}, list.i = function(modules, mediaQuery) {
|
2906
|
+
"string" == typeof modules && (modules = [ [ null, modules, "" ] ]);
|
2907
|
+
for (var alreadyImportedModules = {}, i = 0; i < this.length; i++) {
|
2908
|
+
var id = this[i][0];
|
2909
|
+
"number" == typeof id && (alreadyImportedModules[id] = !0);
|
2910
|
+
}
|
2911
|
+
for (i = 0; i < modules.length; i++) {
|
2912
|
+
var item = modules[i];
|
2913
|
+
"number" == typeof item[0] && alreadyImportedModules[item[0]] || (mediaQuery && !item[2] ? item[2] = mediaQuery : mediaQuery && (item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"),
|
2914
|
+
list.push(item));
|
2915
|
+
}
|
2916
|
+
}, list;
|
2917
|
+
};
|
2918
|
+
}, function(module, exports, __webpack_require__) {
|
2919
|
+
function addStylesToDom(styles, options) {
|
2920
|
+
for (var i = 0; i < styles.length; i++) {
|
2921
|
+
var item = styles[i], domStyle = stylesInDom[item.id];
|
2922
|
+
if (domStyle) {
|
2923
|
+
domStyle.refs++;
|
2924
|
+
for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](item.parts[j]);
|
2925
|
+
for (;j < item.parts.length; j++) domStyle.parts.push(addStyle(item.parts[j], options));
|
2926
|
+
} else {
|
2927
|
+
for (var parts = [], j = 0; j < item.parts.length; j++) parts.push(addStyle(item.parts[j], options));
|
2928
|
+
stylesInDom[item.id] = {
|
2929
|
+
id: item.id,
|
2930
|
+
refs: 1,
|
2931
|
+
parts: parts
|
2932
|
+
};
|
2933
|
+
}
|
2934
|
+
}
|
2935
|
+
}
|
2936
|
+
function listToStyles(list) {
|
2937
|
+
for (var styles = [], newStyles = {}, i = 0; i < list.length; i++) {
|
2938
|
+
var item = list[i], id = item[0], css = item[1], media = item[2], sourceMap = item[3], part = {
|
2939
|
+
css: css,
|
2940
|
+
media: media,
|
2941
|
+
sourceMap: sourceMap
|
2942
|
+
};
|
2943
|
+
newStyles[id] ? newStyles[id].parts.push(part) : styles.push(newStyles[id] = {
|
2944
|
+
id: id,
|
2945
|
+
parts: [ part ]
|
2946
|
+
});
|
2947
|
+
}
|
2948
|
+
return styles;
|
2949
|
+
}
|
2950
|
+
function insertStyleElement(options, styleElement) {
|
2951
|
+
var styleTarget = getElement(options.insertInto);
|
2952
|
+
if (!styleTarget) throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
|
2953
|
+
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
|
2954
|
+
if ("top" === options.insertAt) lastStyleElementInsertedAtTop ? lastStyleElementInsertedAtTop.nextSibling ? styleTarget.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling) : styleTarget.appendChild(styleElement) : styleTarget.insertBefore(styleElement, styleTarget.firstChild),
|
2955
|
+
styleElementsInsertedAtTop.push(styleElement); else {
|
2956
|
+
if ("bottom" !== options.insertAt) throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
|
2957
|
+
styleTarget.appendChild(styleElement);
|
2958
|
+
}
|
2959
|
+
}
|
2960
|
+
function removeStyleElement(styleElement) {
|
2961
|
+
styleElement.parentNode.removeChild(styleElement);
|
2962
|
+
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
|
2963
|
+
idx >= 0 && styleElementsInsertedAtTop.splice(idx, 1);
|
2964
|
+
}
|
2965
|
+
function createStyleElement(options) {
|
2966
|
+
var styleElement = document.createElement("style");
|
2967
|
+
return options.attrs.type = "text/css", attachTagAttrs(styleElement, options.attrs),
|
2968
|
+
insertStyleElement(options, styleElement), styleElement;
|
2969
|
+
}
|
2970
|
+
function createLinkElement(options) {
|
2971
|
+
var linkElement = document.createElement("link");
|
2972
|
+
return options.attrs.type = "text/css", options.attrs.rel = "stylesheet", attachTagAttrs(linkElement, options.attrs),
|
2973
|
+
insertStyleElement(options, linkElement), linkElement;
|
2974
|
+
}
|
2975
|
+
function attachTagAttrs(element, attrs) {
|
2976
|
+
Object.keys(attrs).forEach(function(key) {
|
2977
|
+
element.setAttribute(key, attrs[key]);
|
2978
|
+
});
|
2979
|
+
}
|
2980
|
+
function addStyle(obj, options) {
|
2981
|
+
var styleElement, update, remove;
|
2982
|
+
if (options.singleton) {
|
2983
|
+
var styleIndex = singletonCounter++;
|
2984
|
+
styleElement = singletonElement || (singletonElement = createStyleElement(options)),
|
2985
|
+
update = applyToSingletonTag.bind(null, styleElement, styleIndex, !1), remove = applyToSingletonTag.bind(null, styleElement, styleIndex, !0);
|
2986
|
+
} else obj.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (styleElement = createLinkElement(options),
|
2987
|
+
update = updateLink.bind(null, styleElement, options), remove = function() {
|
2988
|
+
removeStyleElement(styleElement), styleElement.href && URL.revokeObjectURL(styleElement.href);
|
2989
|
+
}) : (styleElement = createStyleElement(options), update = applyToTag.bind(null, styleElement),
|
2990
|
+
remove = function() {
|
2991
|
+
removeStyleElement(styleElement);
|
2992
|
+
});
|
2993
|
+
return update(obj), function(newObj) {
|
2994
|
+
if (newObj) {
|
2995
|
+
if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) return;
|
2996
|
+
update(obj = newObj);
|
2997
|
+
} else remove();
|
2998
|
+
};
|
2999
|
+
}
|
3000
|
+
function applyToSingletonTag(styleElement, index, remove, obj) {
|
3001
|
+
var css = remove ? "" : obj.css;
|
3002
|
+
if (styleElement.styleSheet) styleElement.styleSheet.cssText = replaceText(index, css); else {
|
3003
|
+
var cssNode = document.createTextNode(css), childNodes = styleElement.childNodes;
|
3004
|
+
childNodes[index] && styleElement.removeChild(childNodes[index]), childNodes.length ? styleElement.insertBefore(cssNode, childNodes[index]) : styleElement.appendChild(cssNode);
|
3005
|
+
}
|
3006
|
+
}
|
3007
|
+
function applyToTag(styleElement, obj) {
|
3008
|
+
var css = obj.css, media = obj.media;
|
3009
|
+
if (media && styleElement.setAttribute("media", media), styleElement.styleSheet) styleElement.styleSheet.cssText = css; else {
|
3010
|
+
for (;styleElement.firstChild; ) styleElement.removeChild(styleElement.firstChild);
|
3011
|
+
styleElement.appendChild(document.createTextNode(css));
|
3012
|
+
}
|
3013
|
+
}
|
3014
|
+
function updateLink(linkElement, options, obj) {
|
3015
|
+
var css = obj.css, sourceMap = obj.sourceMap, autoFixUrls = void 0 === options.convertToAbsoluteUrls && sourceMap;
|
3016
|
+
(options.convertToAbsoluteUrls || autoFixUrls) && (css = fixUrls(css)), sourceMap && (css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */");
|
3017
|
+
var blob = new Blob([ css ], {
|
3018
|
+
type: "text/css"
|
3019
|
+
}), oldSrc = linkElement.href;
|
3020
|
+
linkElement.href = URL.createObjectURL(blob), oldSrc && URL.revokeObjectURL(oldSrc);
|
3021
|
+
}
|
3022
|
+
var stylesInDom = {}, isOldIE = function(fn) {
|
3023
|
+
var memo;
|
3024
|
+
return function() {
|
3025
|
+
return void 0 === memo && (memo = fn.apply(this, arguments)), memo;
|
3026
|
+
};
|
3027
|
+
}(function() {
|
3028
|
+
return window && document && document.all && !window.atob;
|
3029
|
+
}), getElement = function(fn) {
|
3030
|
+
var memo = {};
|
3031
|
+
return function(selector) {
|
3032
|
+
return void 0 === memo[selector] && (memo[selector] = fn.call(this, selector)),
|
3033
|
+
memo[selector];
|
3034
|
+
};
|
3035
|
+
}(function(styleTarget) {
|
3036
|
+
return document.querySelector(styleTarget);
|
3037
|
+
}), singletonElement = null, singletonCounter = 0, styleElementsInsertedAtTop = [], fixUrls = __webpack_require__(16);
|
3038
|
+
module.exports = function(list, options) {
|
3039
|
+
if ("undefined" != typeof DEBUG && DEBUG && "object" != typeof document) throw new Error("The style-loader cannot be used in a non-browser environment");
|
3040
|
+
options = options || {}, options.attrs = "object" == typeof options.attrs ? options.attrs : {},
|
3041
|
+
void 0 === options.singleton && (options.singleton = isOldIE()), void 0 === options.insertInto && (options.insertInto = "head"),
|
3042
|
+
void 0 === options.insertAt && (options.insertAt = "bottom");
|
3043
|
+
var styles = listToStyles(list);
|
3044
|
+
return addStylesToDom(styles, options), function(newList) {
|
3045
|
+
for (var mayRemove = [], i = 0; i < styles.length; i++) {
|
3046
|
+
var item = styles[i], domStyle = stylesInDom[item.id];
|
3047
|
+
domStyle.refs--, mayRemove.push(domStyle);
|
3048
|
+
}
|
3049
|
+
if (newList) {
|
3050
|
+
addStylesToDom(listToStyles(newList), options);
|
3051
|
+
}
|
3052
|
+
for (var i = 0; i < mayRemove.length; i++) {
|
3053
|
+
var domStyle = mayRemove[i];
|
3054
|
+
if (0 === domStyle.refs) {
|
3055
|
+
for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
|
3056
|
+
delete stylesInDom[domStyle.id];
|
3057
|
+
}
|
3058
|
+
}
|
3059
|
+
};
|
3060
|
+
};
|
3061
|
+
var replaceText = function() {
|
3062
|
+
var textStore = [];
|
3063
|
+
return function(index, replacement) {
|
3064
|
+
return textStore[index] = replacement, textStore.filter(Boolean).join("\n");
|
3065
|
+
};
|
3066
|
+
}();
|
3067
|
+
}, function(module, exports) {
|
3068
|
+
module.exports = function(css) {
|
3069
|
+
var location = "undefined" != typeof window && window.location;
|
3070
|
+
if (!location) throw new Error("fixUrls requires window.location");
|
3071
|
+
if (!css || "string" != typeof css) return css;
|
3072
|
+
var baseUrl = location.protocol + "//" + location.host, currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
|
3073
|
+
return css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
|
3074
|
+
var unquotedOrigUrl = origUrl.trim().replace(/^"(.*)"$/, function(o, $1) {
|
3075
|
+
return $1;
|
3076
|
+
}).replace(/^'(.*)'$/, function(o, $1) {
|
3077
|
+
return $1;
|
3078
|
+
});
|
3079
|
+
if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) return fullMatch;
|
3080
|
+
var newUrl;
|
3081
|
+
return newUrl = 0 === unquotedOrigUrl.indexOf("//") ? unquotedOrigUrl : 0 === unquotedOrigUrl.indexOf("/") ? baseUrl + unquotedOrigUrl : currentDir + unquotedOrigUrl.replace(/^\.\//, ""),
|
3082
|
+
"url(" + JSON.stringify(newUrl) + ")";
|
3083
|
+
});
|
3084
|
+
};
|
3085
|
+
} ]);
|