inputmask_rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/inputmask_rails.gemspec +18 -0
- data/lib/inputmask_rails.rb +5 -0
- data/lib/inputmask_rails/engine.rb +4 -0
- data/lib/inputmask_rails/version.rb +3 -0
- data/vendor/assets/javascripts/inputmask.js +2466 -0
- metadata +54 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4bbdc2a8bbe177bf52141b1cdf64770437407470
|
4
|
+
data.tar.gz: d5bd026155c0439779015aee57430e253a78f629
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9b7fa264f3b25f367143f025a774aef439e1c61c93b9c3ef656b922c425aeb033e7acc3fbfaaa4680715b40364ddde46cc27e859b9ea54ae6a85dc6ca192cf20
|
7
|
+
data.tar.gz: 9475fafbd54b0e9356b5efa5e15d411d4d33f97bb28d17904b2d8fc6f3a26fdff9ce1aaafc3fe95b1098d70f0fd51ef73ad32c9bfceb3dc8119f247f12d6e0fe
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# InputmaskRails
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
gem 'inputmask_rails'
|
8
|
+
|
9
|
+
And then execute:
|
10
|
+
|
11
|
+
$ bundle
|
12
|
+
|
13
|
+
Add the following to your `app/assets/javascripts/application.js`:
|
14
|
+
|
15
|
+
//= require inputmask
|
16
|
+
|
17
|
+
## Plugin Documentation
|
18
|
+
This uses the vanilla lib.
|
19
|
+
Current version: 5.0.0-beta.184
|
20
|
+
|
21
|
+
https://github.com/RobinHerbots/Inputmask
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "inputmask_rails/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "inputmask_rails"
|
7
|
+
s.version = InputmaskRails::VERSION
|
8
|
+
s.authors = ["Edgar Ji"]
|
9
|
+
s.email = ["zorro.ej@gmail.com"]
|
10
|
+
s.homepage = "http://github.com/ej2015/inputmask_rails"
|
11
|
+
s.summary = %q{Integrate the InputMask plugin into the Rails asset pipeline}
|
12
|
+
s.description = %q{An inputmask helps the user with the input by ensuring a predefined format. This can be usefull for dates, numerics, phone numbers...}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
end
|
@@ -0,0 +1,2466 @@
|
|
1
|
+
/*!
|
2
|
+
* dist/inputmask
|
3
|
+
* https://github.com/RobinHerbots/Inputmask
|
4
|
+
* Copyright (c) 2010 - 2019 Robin Herbots
|
5
|
+
* Licensed under the MIT license
|
6
|
+
* Version: 5.0.0-beta.184
|
7
|
+
*/
|
8
|
+
!function webpackUniversalModuleDefinition(root, factory) {
|
9
|
+
if ("object" == typeof exports && "object" == typeof module) module.exports = factory(); else if ("function" == typeof define && define.amd) define([], factory); else {
|
10
|
+
var a = factory();
|
11
|
+
for (var i in a) ("object" == typeof exports ? exports : root)[i] = a[i];
|
12
|
+
}
|
13
|
+
}(window, function() {
|
14
|
+
return modules = [ function(module, exports, __webpack_require__) {
|
15
|
+
__webpack_require__(1), __webpack_require__(7), __webpack_require__(8), module.exports = __webpack_require__(2);
|
16
|
+
}, function(module, exports, __webpack_require__) {
|
17
|
+
var Inputmask = __webpack_require__(2);
|
18
|
+
Inputmask.extendDefinitions({
|
19
|
+
A: {
|
20
|
+
validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
|
21
|
+
casing: "upper"
|
22
|
+
},
|
23
|
+
"&": {
|
24
|
+
validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
|
25
|
+
casing: "upper"
|
26
|
+
},
|
27
|
+
"#": {
|
28
|
+
validator: "[0-9A-Fa-f]",
|
29
|
+
casing: "upper"
|
30
|
+
}
|
31
|
+
}), Inputmask.extendAliases({
|
32
|
+
cssunit: {
|
33
|
+
regex: "[+-]?[0-9]+\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)"
|
34
|
+
},
|
35
|
+
url: {
|
36
|
+
regex: "(https?|ftp)//.*",
|
37
|
+
autoUnmask: !1
|
38
|
+
},
|
39
|
+
ip: {
|
40
|
+
mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
|
41
|
+
definitions: {
|
42
|
+
i: {
|
43
|
+
validator: function validator(chrs, maskset, pos, strict, opts) {
|
44
|
+
return chrs = -1 < pos - 1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
|
45
|
+
-1 < pos - 2 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : "00" + chrs,
|
46
|
+
new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
},
|
50
|
+
onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
|
51
|
+
return maskedValue;
|
52
|
+
},
|
53
|
+
inputmode: "numeric"
|
54
|
+
},
|
55
|
+
email: {
|
56
|
+
mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
|
57
|
+
greedy: !1,
|
58
|
+
casing: "lower",
|
59
|
+
onBeforePaste: function onBeforePaste(pastedValue, opts) {
|
60
|
+
return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
|
61
|
+
},
|
62
|
+
definitions: {
|
63
|
+
"*": {
|
64
|
+
validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5!#$%&'*+/=?^_`{|}~-]"
|
65
|
+
},
|
66
|
+
"-": {
|
67
|
+
validator: "[0-9A-Za-z-]"
|
68
|
+
}
|
69
|
+
},
|
70
|
+
onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
|
71
|
+
return maskedValue;
|
72
|
+
},
|
73
|
+
inputmode: "email"
|
74
|
+
},
|
75
|
+
mac: {
|
76
|
+
mask: "##:##:##:##:##:##"
|
77
|
+
},
|
78
|
+
vin: {
|
79
|
+
mask: "V{13}9{4}",
|
80
|
+
definitions: {
|
81
|
+
V: {
|
82
|
+
validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
|
83
|
+
casing: "upper"
|
84
|
+
}
|
85
|
+
},
|
86
|
+
clearIncomplete: !0,
|
87
|
+
autoUnmask: !0
|
88
|
+
}
|
89
|
+
}), module.exports = Inputmask;
|
90
|
+
}, function(module, exports, __webpack_require__) {
|
91
|
+
function _typeof(obj) {
|
92
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
|
93
|
+
return typeof obj;
|
94
|
+
} : function _typeof(obj) {
|
95
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
96
|
+
}, _typeof(obj);
|
97
|
+
}
|
98
|
+
var $ = __webpack_require__(3), window = __webpack_require__(4), document = window.document, generateMaskSet = __webpack_require__(5).generateMaskSet, analyseMask = __webpack_require__(5).analyseMask, maskScope = __webpack_require__(6);
|
99
|
+
function Inputmask(alias, options, internal) {
|
100
|
+
if (!(this instanceof Inputmask)) return new Inputmask(alias, options, internal);
|
101
|
+
this.el = void 0, this.events = {}, this.maskset = void 0, this.refreshValue = !1,
|
102
|
+
!0 !== internal && ($.isPlainObject(alias) ? options = alias : (options = options || {},
|
103
|
+
alias && (options.alias = alias)), this.opts = $.extend(!0, {}, this.defaults, options),
|
104
|
+
this.noMasksCache = options && void 0 !== options.definitions, this.userOptions = options || {},
|
105
|
+
resolveAlias(this.opts.alias, options, this.opts), this.isRTL = this.opts.numericInput);
|
106
|
+
}
|
107
|
+
function resolveAlias(aliasStr, options, opts) {
|
108
|
+
var aliasDefinition = Inputmask.prototype.aliases[aliasStr];
|
109
|
+
return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, void 0, opts),
|
110
|
+
$.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : (null === opts.mask && (opts.mask = aliasStr),
|
111
|
+
!1);
|
112
|
+
}
|
113
|
+
function importAttributeOptions(npt, opts, userOptions, dataAttribute) {
|
114
|
+
function importOption(option, optionData) {
|
115
|
+
optionData = void 0 !== optionData ? optionData : npt.getAttribute(dataAttribute + "-" + option),
|
116
|
+
null !== optionData && ("string" == typeof optionData && (0 === option.indexOf("on") ? optionData = window[optionData] : "false" === optionData ? optionData = !1 : "true" === optionData && (optionData = !0)),
|
117
|
+
userOptions[option] = optionData);
|
118
|
+
}
|
119
|
+
if (!0 === opts.importDataAttributes) {
|
120
|
+
var attrOptions = npt.getAttribute(dataAttribute), option, dataoptions, optionData, p;
|
121
|
+
if (attrOptions && "" !== attrOptions && (attrOptions = attrOptions.replace(/'/g, '"'),
|
122
|
+
dataoptions = JSON.parse("{" + attrOptions + "}")), dataoptions) for (p in optionData = void 0,
|
123
|
+
dataoptions) if ("alias" === p.toLowerCase()) {
|
124
|
+
optionData = dataoptions[p];
|
125
|
+
break;
|
126
|
+
}
|
127
|
+
for (option in importOption("alias", optionData), userOptions.alias && resolveAlias(userOptions.alias, userOptions, opts),
|
128
|
+
opts) {
|
129
|
+
if (dataoptions) for (p in optionData = void 0, dataoptions) if (p.toLowerCase() === option.toLowerCase()) {
|
130
|
+
optionData = dataoptions[p];
|
131
|
+
break;
|
132
|
+
}
|
133
|
+
importOption(option, optionData);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
return $.extend(!0, opts, userOptions), ("rtl" === npt.dir || opts.rightAlign) && (npt.style.textAlign = "right"),
|
137
|
+
("rtl" === npt.dir || opts.numericInput) && (npt.dir = "ltr", npt.removeAttribute("dir"),
|
138
|
+
opts.isRTL = !0), Object.keys(userOptions).length;
|
139
|
+
}
|
140
|
+
Inputmask.prototype = {
|
141
|
+
dataAttribute: "data-inputmask",
|
142
|
+
defaults: {
|
143
|
+
placeholder: "_",
|
144
|
+
optionalmarker: [ "[", "]" ],
|
145
|
+
quantifiermarker: [ "{", "}" ],
|
146
|
+
groupmarker: [ "(", ")" ],
|
147
|
+
alternatormarker: "|",
|
148
|
+
escapeChar: "\\",
|
149
|
+
mask: null,
|
150
|
+
regex: null,
|
151
|
+
oncomplete: $.noop,
|
152
|
+
onincomplete: $.noop,
|
153
|
+
oncleared: $.noop,
|
154
|
+
repeat: 0,
|
155
|
+
greedy: !1,
|
156
|
+
autoUnmask: !1,
|
157
|
+
removeMaskOnSubmit: !1,
|
158
|
+
clearMaskOnLostFocus: !0,
|
159
|
+
insertMode: !0,
|
160
|
+
clearIncomplete: !1,
|
161
|
+
alias: null,
|
162
|
+
onKeyDown: $.noop,
|
163
|
+
onBeforeMask: null,
|
164
|
+
onBeforePaste: function onBeforePaste(pastedValue, opts) {
|
165
|
+
return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(this, pastedValue, opts) : pastedValue;
|
166
|
+
},
|
167
|
+
onBeforeWrite: null,
|
168
|
+
onUnMask: null,
|
169
|
+
showMaskOnFocus: !0,
|
170
|
+
showMaskOnHover: !0,
|
171
|
+
onKeyValidation: $.noop,
|
172
|
+
skipOptionalPartCharacter: " ",
|
173
|
+
numericInput: !1,
|
174
|
+
rightAlign: !1,
|
175
|
+
undoOnEscape: !0,
|
176
|
+
radixPoint: "",
|
177
|
+
_radixDance: !1,
|
178
|
+
groupSeparator: "",
|
179
|
+
keepStatic: null,
|
180
|
+
positionCaretOnTab: !0,
|
181
|
+
tabThrough: !1,
|
182
|
+
supportsInputType: [ "text", "tel", "url", "password", "search" ],
|
183
|
+
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 ],
|
184
|
+
isComplete: null,
|
185
|
+
preValidation: null,
|
186
|
+
postValidation: null,
|
187
|
+
staticDefinitionSymbol: void 0,
|
188
|
+
jitMasking: !1,
|
189
|
+
nullable: !0,
|
190
|
+
inputEventOnly: !1,
|
191
|
+
noValuePatching: !1,
|
192
|
+
positionCaretOnClick: "lvp",
|
193
|
+
casing: null,
|
194
|
+
inputmode: "verbatim",
|
195
|
+
colorMask: !1,
|
196
|
+
disablePredictiveText: !1,
|
197
|
+
importDataAttributes: !0,
|
198
|
+
shiftPositions: !0
|
199
|
+
},
|
200
|
+
definitions: {
|
201
|
+
9: {
|
202
|
+
validator: "[0-9\uff11-\uff19]",
|
203
|
+
definitionSymbol: "*"
|
204
|
+
},
|
205
|
+
a: {
|
206
|
+
validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
|
207
|
+
definitionSymbol: "*"
|
208
|
+
},
|
209
|
+
"*": {
|
210
|
+
validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]"
|
211
|
+
}
|
212
|
+
},
|
213
|
+
aliases: {},
|
214
|
+
masksCache: {},
|
215
|
+
mask: function mask(elems) {
|
216
|
+
var that = this;
|
217
|
+
return "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)),
|
218
|
+
elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) {
|
219
|
+
var scopedOpts = $.extend(!0, {}, that.opts);
|
220
|
+
if (importAttributeOptions(el, scopedOpts, $.extend(!0, {}, that.userOptions), that.dataAttribute)) {
|
221
|
+
var maskset = generateMaskSet(scopedOpts, that.noMasksCache);
|
222
|
+
void 0 !== maskset && (void 0 !== el.inputmask && (el.inputmask.opts.autoUnmask = !0,
|
223
|
+
el.inputmask.remove()), el.inputmask = new Inputmask(void 0, void 0, !0), el.inputmask.opts = scopedOpts,
|
224
|
+
el.inputmask.noMasksCache = that.noMasksCache, el.inputmask.userOptions = $.extend(!0, {}, that.userOptions),
|
225
|
+
el.inputmask.isRTL = scopedOpts.isRTL || scopedOpts.numericInput, el.inputmask.el = el,
|
226
|
+
el.inputmask.maskset = maskset, $.data(el, "_inputmask_opts", scopedOpts), maskScope.call(el.inputmask, {
|
227
|
+
action: "mask"
|
228
|
+
}));
|
229
|
+
}
|
230
|
+
}), elems && elems[0] && elems[0].inputmask || this;
|
231
|
+
},
|
232
|
+
option: function option(options, noremask) {
|
233
|
+
return "string" == typeof options ? this.opts[options] : "object" === _typeof(options) ? ($.extend(this.userOptions, options),
|
234
|
+
this.el && !0 !== noremask && this.mask(this.el), this) : void 0;
|
235
|
+
},
|
236
|
+
unmaskedvalue: function unmaskedvalue(value) {
|
237
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
238
|
+
maskScope.call(this, {
|
239
|
+
action: "unmaskedvalue",
|
240
|
+
value: value
|
241
|
+
});
|
242
|
+
},
|
243
|
+
remove: function remove() {
|
244
|
+
return maskScope.call(this, {
|
245
|
+
action: "remove"
|
246
|
+
});
|
247
|
+
},
|
248
|
+
getemptymask: function getemptymask() {
|
249
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
250
|
+
maskScope.call(this, {
|
251
|
+
action: "getemptymask"
|
252
|
+
});
|
253
|
+
},
|
254
|
+
hasMaskedValue: function hasMaskedValue() {
|
255
|
+
return !this.opts.autoUnmask;
|
256
|
+
},
|
257
|
+
isComplete: function isComplete() {
|
258
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
259
|
+
maskScope.call(this, {
|
260
|
+
action: "isComplete"
|
261
|
+
});
|
262
|
+
},
|
263
|
+
getmetadata: function getmetadata() {
|
264
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
265
|
+
maskScope.call(this, {
|
266
|
+
action: "getmetadata"
|
267
|
+
});
|
268
|
+
},
|
269
|
+
isValid: function isValid(value) {
|
270
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
271
|
+
maskScope.call(this, {
|
272
|
+
action: "isValid",
|
273
|
+
value: value
|
274
|
+
});
|
275
|
+
},
|
276
|
+
format: function format(value, metadata) {
|
277
|
+
return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
|
278
|
+
maskScope.call(this, {
|
279
|
+
action: "format",
|
280
|
+
value: value,
|
281
|
+
metadata: metadata
|
282
|
+
});
|
283
|
+
},
|
284
|
+
setValue: function setValue(value) {
|
285
|
+
this.el && $(this.el).trigger("setvalue", [ value ]);
|
286
|
+
},
|
287
|
+
analyseMask: analyseMask,
|
288
|
+
positionColorMask: function positionColorMask(input, template) {
|
289
|
+
input.style.left = template.offsetLeft + "px";
|
290
|
+
}
|
291
|
+
}, Inputmask.extendDefaults = function(options) {
|
292
|
+
$.extend(!0, Inputmask.prototype.defaults, options);
|
293
|
+
}, Inputmask.extendDefinitions = function(definition) {
|
294
|
+
$.extend(!0, Inputmask.prototype.definitions, definition);
|
295
|
+
}, Inputmask.extendAliases = function(alias) {
|
296
|
+
$.extend(!0, Inputmask.prototype.aliases, alias);
|
297
|
+
}, Inputmask.format = function(value, options, metadata) {
|
298
|
+
return Inputmask(options).format(value, metadata);
|
299
|
+
}, Inputmask.unmask = function(value, options) {
|
300
|
+
return Inputmask(options).unmaskedvalue(value);
|
301
|
+
}, Inputmask.isValid = function(value, options) {
|
302
|
+
return Inputmask(options).isValid(value);
|
303
|
+
}, Inputmask.remove = function(elems) {
|
304
|
+
"string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)),
|
305
|
+
elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) {
|
306
|
+
el.inputmask && el.inputmask.remove();
|
307
|
+
});
|
308
|
+
}, Inputmask.setValue = function(elems, value) {
|
309
|
+
"string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)),
|
310
|
+
elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) {
|
311
|
+
el.inputmask ? el.inputmask.setValue(value) : $(el).trigger("setvalue", [ value ]);
|
312
|
+
});
|
313
|
+
}, Inputmask.escapeRegex = function(str) {
|
314
|
+
var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
|
315
|
+
return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
|
316
|
+
}, Inputmask.keyCode = {
|
317
|
+
BACKSPACE: 8,
|
318
|
+
BACKSPACE_SAFARI: 127,
|
319
|
+
DELETE: 46,
|
320
|
+
DOWN: 40,
|
321
|
+
END: 35,
|
322
|
+
ENTER: 13,
|
323
|
+
ESCAPE: 27,
|
324
|
+
HOME: 36,
|
325
|
+
INSERT: 45,
|
326
|
+
LEFT: 37,
|
327
|
+
PAGE_DOWN: 34,
|
328
|
+
PAGE_UP: 33,
|
329
|
+
RIGHT: 39,
|
330
|
+
SPACE: 32,
|
331
|
+
TAB: 9,
|
332
|
+
UP: 38,
|
333
|
+
X: 88,
|
334
|
+
CONTROL: 17
|
335
|
+
}, Inputmask.dependencyLib = $, window.Inputmask = Inputmask, module.exports = Inputmask;
|
336
|
+
}, function(module, exports, __webpack_require__) {
|
337
|
+
function _typeof(obj) {
|
338
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
|
339
|
+
return typeof obj;
|
340
|
+
} : function _typeof(obj) {
|
341
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
342
|
+
}, _typeof(obj);
|
343
|
+
}
|
344
|
+
var window = __webpack_require__(4), document = window.document;
|
345
|
+
function indexOf(list, elem) {
|
346
|
+
for (var i = 0, len = list.length; i < len; i++) if (list[i] === elem) return i;
|
347
|
+
return -1;
|
348
|
+
}
|
349
|
+
function isWindow(obj) {
|
350
|
+
return null != obj && obj === obj.window;
|
351
|
+
}
|
352
|
+
function isArraylike(obj) {
|
353
|
+
var length = "length" in obj && obj.length, ltype = _typeof(obj);
|
354
|
+
return "function" !== ltype && !isWindow(obj) && (!(1 !== obj.nodeType || !length) || ("array" === ltype || 0 === length || "number" == typeof length && 0 < length && length - 1 in obj));
|
355
|
+
}
|
356
|
+
function isValidElement(elem) {
|
357
|
+
return elem instanceof Element;
|
358
|
+
}
|
359
|
+
function DependencyLib(elem) {
|
360
|
+
return elem instanceof DependencyLib ? elem : this instanceof DependencyLib ? void (null != elem && elem !== window && (this[0] = elem.nodeName ? elem : void 0 !== elem[0] && elem[0].nodeName ? elem[0] : document.querySelector(elem),
|
361
|
+
void 0 !== this[0] && null !== this[0] && (this[0].eventRegistry = this[0].eventRegistry || {}))) : new DependencyLib(elem);
|
362
|
+
}
|
363
|
+
DependencyLib.prototype = {
|
364
|
+
on: function on(events, handler) {
|
365
|
+
function addEvent(ev, namespace) {
|
366
|
+
elem.addEventListener ? elem.addEventListener(ev, handler, !1) : elem.attachEvent && elem.attachEvent("on" + ev, handler),
|
367
|
+
eventRegistry[ev] = eventRegistry[ev] || {}, eventRegistry[ev][namespace] = eventRegistry[ev][namespace] || [],
|
368
|
+
eventRegistry[ev][namespace].push(handler);
|
369
|
+
}
|
370
|
+
if (isValidElement(this[0])) for (var eventRegistry = this[0].eventRegistry, elem = this[0], _events = events.split(" "), endx = 0; endx < _events.length; endx++) {
|
371
|
+
var nsEvent = _events[endx].split("."), ev = nsEvent[0], namespace = nsEvent[1] || "global";
|
372
|
+
addEvent(ev, namespace);
|
373
|
+
}
|
374
|
+
return this;
|
375
|
+
},
|
376
|
+
off: function off(events, handler) {
|
377
|
+
var eventRegistry, elem;
|
378
|
+
function removeEvent(ev, namespace, handler) {
|
379
|
+
if (ev in eventRegistry == !0) if (elem.removeEventListener ? elem.removeEventListener(ev, handler, !1) : elem.detachEvent && elem.detachEvent("on" + ev, handler),
|
380
|
+
"global" === namespace) for (var nmsp in eventRegistry[ev]) eventRegistry[ev][nmsp].splice(eventRegistry[ev][nmsp].indexOf(handler), 1); else eventRegistry[ev][namespace].splice(eventRegistry[ev][namespace].indexOf(handler), 1);
|
381
|
+
}
|
382
|
+
function resolveNamespace(ev, namespace) {
|
383
|
+
var evts = [], hndx, hndL;
|
384
|
+
if (0 < ev.length) if (void 0 === handler) for (hndx = 0, hndL = eventRegistry[ev][namespace].length; hndx < hndL; hndx++) evts.push({
|
385
|
+
ev: ev,
|
386
|
+
namespace: namespace && 0 < namespace.length ? namespace : "global",
|
387
|
+
handler: eventRegistry[ev][namespace][hndx]
|
388
|
+
}); else evts.push({
|
389
|
+
ev: ev,
|
390
|
+
namespace: namespace && 0 < namespace.length ? namespace : "global",
|
391
|
+
handler: handler
|
392
|
+
}); else if (0 < namespace.length) for (var evNdx in eventRegistry) for (var nmsp in eventRegistry[evNdx]) if (nmsp === namespace) if (void 0 === handler) for (hndx = 0,
|
393
|
+
hndL = eventRegistry[evNdx][nmsp].length; hndx < hndL; hndx++) evts.push({
|
394
|
+
ev: evNdx,
|
395
|
+
namespace: nmsp,
|
396
|
+
handler: eventRegistry[evNdx][nmsp][hndx]
|
397
|
+
}); else evts.push({
|
398
|
+
ev: evNdx,
|
399
|
+
namespace: nmsp,
|
400
|
+
handler: handler
|
401
|
+
});
|
402
|
+
return evts;
|
403
|
+
}
|
404
|
+
if (isValidElement(this[0])) {
|
405
|
+
eventRegistry = this[0].eventRegistry, elem = this[0];
|
406
|
+
for (var _events = events.split(" "), endx = 0; endx < _events.length; endx++) for (var nsEvent = _events[endx].split("."), offEvents = resolveNamespace(nsEvent[0], nsEvent[1]), i = 0, offEventsL = offEvents.length; i < offEventsL; i++) removeEvent(offEvents[i].ev, offEvents[i].namespace, offEvents[i].handler);
|
407
|
+
}
|
408
|
+
return this;
|
409
|
+
},
|
410
|
+
trigger: function trigger(events) {
|
411
|
+
if (isValidElement(this[0])) for (var eventRegistry = this[0].eventRegistry, elem = this[0], _events = "string" == typeof events ? events.split(" ") : [ events.type ], endx = 0; endx < _events.length; endx++) {
|
412
|
+
var nsEvent = _events[endx].split("."), ev = nsEvent[0], namespace = nsEvent[1] || "global";
|
413
|
+
if (void 0 !== document && "global" === namespace) {
|
414
|
+
var evnt, i, params = {
|
415
|
+
bubbles: !0,
|
416
|
+
cancelable: !0,
|
417
|
+
detail: arguments[1]
|
418
|
+
};
|
419
|
+
if (document.createEvent) {
|
420
|
+
try {
|
421
|
+
evnt = new CustomEvent(ev, params);
|
422
|
+
} catch (e) {
|
423
|
+
evnt = document.createEvent("CustomEvent"), evnt.initCustomEvent(ev, params.bubbles, params.cancelable, params.detail);
|
424
|
+
}
|
425
|
+
events.type && DependencyLib.extend(evnt, events), elem.dispatchEvent(evnt);
|
426
|
+
} else evnt = document.createEventObject(), evnt.eventType = ev, evnt.detail = arguments[1],
|
427
|
+
events.type && DependencyLib.extend(evnt, events), elem.fireEvent("on" + evnt.eventType, evnt);
|
428
|
+
} else if (void 0 !== eventRegistry[ev]) if (events = events.type ? events : DependencyLib.Event(events),
|
429
|
+
events.detail = arguments.slice(1), "global" === namespace) for (var nmsp in eventRegistry[ev]) for (i = 0; i < eventRegistry[ev][nmsp].length; i++) eventRegistry[ev][nmsp][i].apply(elem, arguments); else for (i = 0; i < eventRegistry[ev][namespace].length; i++) eventRegistry[ev][namespace][i].apply(elem, arguments);
|
430
|
+
}
|
431
|
+
return this;
|
432
|
+
}
|
433
|
+
}, DependencyLib.isFunction = function(obj) {
|
434
|
+
return "function" == typeof obj;
|
435
|
+
}, DependencyLib.noop = function() {}, DependencyLib.isArray = Array.isArray, DependencyLib.inArray = function(elem, arr, i) {
|
436
|
+
return null == arr ? -1 : indexOf(arr, elem, i);
|
437
|
+
}, DependencyLib.valHooks = void 0, DependencyLib.isPlainObject = function(obj) {
|
438
|
+
return "object" === _typeof(obj) && !obj.nodeType && !isWindow(obj) && !(obj.constructor && !Object.hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf"));
|
439
|
+
}, DependencyLib.extend = function() {
|
440
|
+
var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = !1;
|
441
|
+
for ("boolean" == typeof target && (deep = target, target = arguments[i] || {},
|
442
|
+
i++), "object" === _typeof(target) || DependencyLib.isFunction(target) || (target = {}),
|
443
|
+
i === length && (target = this, i--); i < length; i++) if (null != (options = arguments[i])) for (name in options) src = target[name],
|
444
|
+
copy = options[name], target !== copy && (deep && copy && (DependencyLib.isPlainObject(copy) || (copyIsArray = DependencyLib.isArray(copy))) ? (clone = copyIsArray ? (copyIsArray = !1,
|
445
|
+
src && DependencyLib.isArray(src) ? src : []) : src && DependencyLib.isPlainObject(src) ? src : {},
|
446
|
+
target[name] = DependencyLib.extend(deep, clone, copy)) : void 0 !== copy && (target[name] = copy));
|
447
|
+
return target;
|
448
|
+
}, DependencyLib.each = function(obj, callback) {
|
449
|
+
var value, i = 0;
|
450
|
+
if (isArraylike(obj)) for (var length = obj.length; i < length && (value = callback.call(obj[i], i, obj[i]),
|
451
|
+
!1 !== value); i++) ; else for (i in obj) if (value = callback.call(obj[i], i, obj[i]),
|
452
|
+
!1 === value) break;
|
453
|
+
return obj;
|
454
|
+
}, DependencyLib.data = function(owner, key, value) {
|
455
|
+
if (void 0 === value) return owner.__data ? owner.__data[key] : null;
|
456
|
+
owner.__data = owner.__data || {}, owner.__data[key] = value;
|
457
|
+
}, "function" == typeof window.CustomEvent ? DependencyLib.Event = window.CustomEvent : (DependencyLib.Event = function(event, params) {
|
458
|
+
params = params || {
|
459
|
+
bubbles: !1,
|
460
|
+
cancelable: !1,
|
461
|
+
detail: void 0
|
462
|
+
};
|
463
|
+
var evt = document.createEvent("CustomEvent");
|
464
|
+
return evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail),
|
465
|
+
evt;
|
466
|
+
}, DependencyLib.Event.prototype = window.Event.prototype), module.exports = DependencyLib;
|
467
|
+
}, function(module, exports, __webpack_require__) {
|
468
|
+
var __WEBPACK_AMD_DEFINE_RESULT__;
|
469
|
+
function _typeof(obj) {
|
470
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
|
471
|
+
return typeof obj;
|
472
|
+
} : function _typeof(obj) {
|
473
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
474
|
+
}, _typeof(obj);
|
475
|
+
}
|
476
|
+
__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
477
|
+
return "undefined" != typeof window ? window : new (eval("require('jsdom').JSDOM"))("").window;
|
478
|
+
}.call(exports, __webpack_require__, exports, module), void 0 === __WEBPACK_AMD_DEFINE_RESULT__ || (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
479
|
+
}, function(module, exports, __webpack_require__) {
|
480
|
+
var $ = __webpack_require__(3);
|
481
|
+
function generateMaskSet(opts, nocache) {
|
482
|
+
var ms;
|
483
|
+
function generateMask(mask, metadata, opts) {
|
484
|
+
var regexMask = !1, masksetDefinition, maskdefKey;
|
485
|
+
if (null !== mask && "" !== mask || (regexMask = null !== opts.regex, mask = regexMask ? (mask = opts.regex,
|
486
|
+
mask.replace(/^(\^)(.*)(\$)$/, "$2")) : (regexMask = !0, ".*")), 1 === mask.length && !1 === opts.greedy && 0 !== opts.repeat && (opts.placeholder = ""),
|
487
|
+
0 < opts.repeat || "*" === opts.repeat || "+" === opts.repeat) {
|
488
|
+
var repeatStart = "*" === opts.repeat ? 0 : "+" === opts.repeat ? 1 : opts.repeat;
|
489
|
+
mask = opts.groupmarker[0] + mask + opts.groupmarker[1] + opts.quantifiermarker[0] + repeatStart + "," + opts.repeat + opts.quantifiermarker[1];
|
490
|
+
}
|
491
|
+
return maskdefKey = regexMask ? "regex_" + opts.regex : opts.numericInput ? mask.split("").reverse().join("") : mask,
|
492
|
+
!1 !== opts.keepStatic && (maskdefKey = "ks_" + maskdefKey), void 0 === Inputmask.prototype.masksCache[maskdefKey] || !0 === nocache ? (masksetDefinition = {
|
493
|
+
mask: mask,
|
494
|
+
maskToken: Inputmask.prototype.analyseMask(mask, regexMask, opts),
|
495
|
+
validPositions: {},
|
496
|
+
_buffer: void 0,
|
497
|
+
buffer: void 0,
|
498
|
+
tests: {},
|
499
|
+
excludes: {},
|
500
|
+
metadata: metadata,
|
501
|
+
maskLength: void 0,
|
502
|
+
jitOffset: {}
|
503
|
+
}, !0 !== nocache && (Inputmask.prototype.masksCache[maskdefKey] = masksetDefinition,
|
504
|
+
masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]))) : masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]),
|
505
|
+
masksetDefinition;
|
506
|
+
}
|
507
|
+
if ($.isFunction(opts.mask) && (opts.mask = opts.mask(opts)), $.isArray(opts.mask)) {
|
508
|
+
if (1 < opts.mask.length) {
|
509
|
+
if (null === opts.keepStatic) {
|
510
|
+
opts.keepStatic = "auto";
|
511
|
+
for (var i = 0; i < opts.mask.length; i++) if (opts.mask[i].charAt(0) !== opts.mask[0].charAt(0)) {
|
512
|
+
opts.keepStatic = !0;
|
513
|
+
break;
|
514
|
+
}
|
515
|
+
}
|
516
|
+
var altMask = opts.groupmarker[0];
|
517
|
+
return $.each(opts.isRTL ? opts.mask.reverse() : opts.mask, function(ndx, msk) {
|
518
|
+
1 < altMask.length && (altMask += opts.groupmarker[1] + opts.alternatormarker + opts.groupmarker[0]),
|
519
|
+
void 0 === msk.mask || $.isFunction(msk.mask) ? altMask += msk : altMask += msk.mask;
|
520
|
+
}), altMask += opts.groupmarker[1], generateMask(altMask, opts.mask, opts);
|
521
|
+
}
|
522
|
+
opts.mask = opts.mask.pop();
|
523
|
+
}
|
524
|
+
return ms = opts.mask && void 0 !== opts.mask.mask && !$.isFunction(opts.mask.mask) ? generateMask(opts.mask.mask, opts.mask, opts) : generateMask(opts.mask, opts.mask, opts),
|
525
|
+
ms;
|
526
|
+
}
|
527
|
+
function analyseMask(mask, regexMask, opts) {
|
528
|
+
var tokenizer = /(?:[?*+]|\{[0-9+*]+(?:,[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(), match, m, openenings = [], maskTokens = [], openingToken, currentOpeningToken, alternator, lastMatch, closeRegexGroup = !1;
|
529
|
+
function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
|
530
|
+
this.matches = [], this.openGroup = isGroup || !1, this.alternatorGroup = !1, this.isGroup = isGroup || !1,
|
531
|
+
this.isOptional = isOptional || !1, this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1,
|
532
|
+
this.quantifier = {
|
533
|
+
min: 1,
|
534
|
+
max: 1
|
535
|
+
};
|
536
|
+
}
|
537
|
+
function insertTestDefinition(mtoken, element, position) {
|
538
|
+
position = void 0 !== position ? position : mtoken.matches.length;
|
539
|
+
var prevMatch = mtoken.matches[position - 1];
|
540
|
+
if (regexMask) 0 === element.indexOf("[") || escaped && /\\d|\\s|\\w]/i.test(element) || "." === element ? mtoken.matches.splice(position++, 0, {
|
541
|
+
fn: new RegExp(element, opts.casing ? "i" : ""),
|
542
|
+
static: !1,
|
543
|
+
optionality: !1,
|
544
|
+
newBlockMarker: void 0 === prevMatch ? "master" : prevMatch.def !== element,
|
545
|
+
casing: null,
|
546
|
+
def: element,
|
547
|
+
placeholder: void 0,
|
548
|
+
nativeDef: element
|
549
|
+
}) : (escaped && (element = element[element.length - 1]), $.each(element.split(""), function(ndx, lmnt) {
|
550
|
+
prevMatch = mtoken.matches[position - 1], mtoken.matches.splice(position++, 0, {
|
551
|
+
fn: /[a-z]/i.test(opts.staticDefinitionSymbol || lmnt) ? new RegExp("[" + (opts.staticDefinitionSymbol || lmnt) + "]", opts.casing ? "i" : "") : null,
|
552
|
+
static: !0,
|
553
|
+
optionality: !1,
|
554
|
+
newBlockMarker: void 0 === prevMatch ? "master" : prevMatch.def !== lmnt && !0 !== prevMatch.static,
|
555
|
+
casing: null,
|
556
|
+
def: opts.staticDefinitionSymbol || lmnt,
|
557
|
+
placeholder: void 0 !== opts.staticDefinitionSymbol ? lmnt : void 0,
|
558
|
+
nativeDef: (escaped ? "'" : "") + lmnt
|
559
|
+
});
|
560
|
+
})), escaped = !1; else {
|
561
|
+
var maskdef = (opts.definitions ? opts.definitions[element] : void 0) || Inputmask.prototype.definitions[element];
|
562
|
+
maskdef && !escaped ? mtoken.matches.splice(position++, 0, {
|
563
|
+
fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator, opts.casing ? "i" : "") : new function() {
|
564
|
+
this.test = maskdef.validator;
|
565
|
+
}() : new RegExp("."),
|
566
|
+
static: !1,
|
567
|
+
optionality: !1,
|
568
|
+
newBlockMarker: void 0 === prevMatch ? "master" : prevMatch.def !== (maskdef.definitionSymbol || element),
|
569
|
+
casing: maskdef.casing,
|
570
|
+
def: maskdef.definitionSymbol || element,
|
571
|
+
placeholder: maskdef.placeholder,
|
572
|
+
nativeDef: element
|
573
|
+
}) : (mtoken.matches.splice(position++, 0, {
|
574
|
+
fn: /[a-z]/i.test(opts.staticDefinitionSymbol || element) ? new RegExp("[" + (opts.staticDefinitionSymbol || element) + "]", opts.casing ? "i" : "") : null,
|
575
|
+
static: !0,
|
576
|
+
optionality: !1,
|
577
|
+
newBlockMarker: void 0 === prevMatch ? "master" : prevMatch.def !== element && !0 !== prevMatch.static,
|
578
|
+
casing: null,
|
579
|
+
def: opts.staticDefinitionSymbol || element,
|
580
|
+
placeholder: void 0 !== opts.staticDefinitionSymbol ? element : void 0,
|
581
|
+
nativeDef: (escaped ? "'" : "") + element
|
582
|
+
}), escaped = !1);
|
583
|
+
}
|
584
|
+
}
|
585
|
+
function verifyGroupMarker(maskToken) {
|
586
|
+
maskToken && maskToken.matches && $.each(maskToken.matches, function(ndx, token) {
|
587
|
+
var nextToken = maskToken.matches[ndx + 1];
|
588
|
+
(void 0 === nextToken || void 0 === nextToken.matches || !1 === nextToken.isQuantifier) && token && token.isGroup && (token.isGroup = !1,
|
589
|
+
regexMask || (insertTestDefinition(token, opts.groupmarker[0], 0), !0 !== token.openGroup && insertTestDefinition(token, opts.groupmarker[1]))),
|
590
|
+
verifyGroupMarker(token);
|
591
|
+
});
|
592
|
+
}
|
593
|
+
function defaultCase() {
|
594
|
+
if (0 < openenings.length) {
|
595
|
+
if (currentOpeningToken = openenings[openenings.length - 1], insertTestDefinition(currentOpeningToken, m),
|
596
|
+
currentOpeningToken.isAlternator) {
|
597
|
+
alternator = openenings.pop();
|
598
|
+
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup && (alternator.matches[mndx].isGroup = !1);
|
599
|
+
0 < openenings.length ? (currentOpeningToken = openenings[openenings.length - 1],
|
600
|
+
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
601
|
+
}
|
602
|
+
} else insertTestDefinition(currentToken, m);
|
603
|
+
}
|
604
|
+
function reverseTokens(maskToken) {
|
605
|
+
function reverseStatic(st) {
|
606
|
+
return st === opts.optionalmarker[0] ? st = opts.optionalmarker[1] : st === opts.optionalmarker[1] ? st = opts.optionalmarker[0] : st === opts.groupmarker[0] ? st = opts.groupmarker[1] : st === opts.groupmarker[1] && (st = opts.groupmarker[0]),
|
607
|
+
st;
|
608
|
+
}
|
609
|
+
for (var match in maskToken.matches = maskToken.matches.reverse(), maskToken.matches) if (maskToken.matches.hasOwnProperty(match)) {
|
610
|
+
var intMatch = parseInt(match);
|
611
|
+
if (maskToken.matches[match].isQuantifier && maskToken.matches[intMatch + 1] && maskToken.matches[intMatch + 1].isGroup) {
|
612
|
+
var qt = maskToken.matches[match];
|
613
|
+
maskToken.matches.splice(match, 1), maskToken.matches.splice(intMatch + 1, 0, qt);
|
614
|
+
}
|
615
|
+
void 0 !== maskToken.matches[match].matches ? maskToken.matches[match] = reverseTokens(maskToken.matches[match]) : maskToken.matches[match] = reverseStatic(maskToken.matches[match]);
|
616
|
+
}
|
617
|
+
return maskToken;
|
618
|
+
}
|
619
|
+
function groupify(matches) {
|
620
|
+
var groupToken = new MaskToken(!0);
|
621
|
+
return groupToken.openGroup = !1, groupToken.matches = matches, groupToken;
|
622
|
+
}
|
623
|
+
function closeGroup() {
|
624
|
+
if (openingToken = openenings.pop(), openingToken.openGroup = !1, void 0 !== openingToken) if (0 < openenings.length) {
|
625
|
+
if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken),
|
626
|
+
currentOpeningToken.isAlternator) {
|
627
|
+
alternator = openenings.pop();
|
628
|
+
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1,
|
629
|
+
alternator.matches[mndx].alternatorGroup = !1;
|
630
|
+
0 < openenings.length ? (currentOpeningToken = openenings[openenings.length - 1],
|
631
|
+
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
632
|
+
}
|
633
|
+
} else currentToken.matches.push(openingToken); else defaultCase();
|
634
|
+
}
|
635
|
+
function groupQuantifier(matches) {
|
636
|
+
var lastMatch = matches.pop();
|
637
|
+
return lastMatch.isQuantifier && (lastMatch = groupify([ matches.pop(), lastMatch ])),
|
638
|
+
lastMatch;
|
639
|
+
}
|
640
|
+
for (regexMask && (opts.optionalmarker[0] = void 0, opts.optionalmarker[1] = void 0); match = regexMask ? regexTokenizer.exec(mask) : tokenizer.exec(mask); ) {
|
641
|
+
if (m = match[0], regexMask) switch (m.charAt(0)) {
|
642
|
+
case "?":
|
643
|
+
m = "{0,1}";
|
644
|
+
break;
|
645
|
+
|
646
|
+
case "+":
|
647
|
+
case "*":
|
648
|
+
m = "{" + m + "}";
|
649
|
+
break;
|
650
|
+
|
651
|
+
case "|":
|
652
|
+
if (0 === openenings.length) {
|
653
|
+
var altRegexGroup = groupify(currentToken.matches);
|
654
|
+
altRegexGroup.openGroup = !0, openenings.push(altRegexGroup), currentToken.matches = [],
|
655
|
+
closeRegexGroup = !0;
|
656
|
+
}
|
657
|
+
break;
|
658
|
+
}
|
659
|
+
if (escaped) defaultCase(); else switch (m.charAt(0)) {
|
660
|
+
case "(?=":
|
661
|
+
break;
|
662
|
+
|
663
|
+
case "(?!":
|
664
|
+
break;
|
665
|
+
|
666
|
+
case "(?<=":
|
667
|
+
break;
|
668
|
+
|
669
|
+
case "(?<!":
|
670
|
+
break;
|
671
|
+
|
672
|
+
case opts.escapeChar:
|
673
|
+
escaped = !0, regexMask && defaultCase();
|
674
|
+
break;
|
675
|
+
|
676
|
+
case opts.optionalmarker[1]:
|
677
|
+
case opts.groupmarker[1]:
|
678
|
+
closeGroup();
|
679
|
+
break;
|
680
|
+
|
681
|
+
case opts.optionalmarker[0]:
|
682
|
+
openenings.push(new MaskToken(!1, !0));
|
683
|
+
break;
|
684
|
+
|
685
|
+
case opts.groupmarker[0]:
|
686
|
+
openenings.push(new MaskToken(!0));
|
687
|
+
break;
|
688
|
+
|
689
|
+
case opts.quantifiermarker[0]:
|
690
|
+
var quantifier = new MaskToken(!1, !1, !0);
|
691
|
+
m = m.replace(/[{}]/g, "");
|
692
|
+
var mqj = m.split("|"), mq = mqj[0].split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
|
693
|
+
"*" !== mq0 && "+" !== mq0 || (mq0 = "*" === mq1 ? 0 : 1), quantifier.quantifier = {
|
694
|
+
min: mq0,
|
695
|
+
max: mq1,
|
696
|
+
jit: mqj[1]
|
697
|
+
};
|
698
|
+
var matches = 0 < openenings.length ? openenings[openenings.length - 1].matches : currentToken.matches;
|
699
|
+
if (match = matches.pop(), match.isAlternator) {
|
700
|
+
matches.push(match), matches = match.matches;
|
701
|
+
var groupToken = new MaskToken(!0), tmpMatch = matches.pop();
|
702
|
+
matches.push(groupToken), matches = groupToken.matches, match = tmpMatch;
|
703
|
+
}
|
704
|
+
match.isGroup || (match = groupify([ match ])), matches.push(match), matches.push(quantifier);
|
705
|
+
break;
|
706
|
+
|
707
|
+
case opts.alternatormarker:
|
708
|
+
if (0 < openenings.length) {
|
709
|
+
currentOpeningToken = openenings[openenings.length - 1];
|
710
|
+
var subToken = currentOpeningToken.matches[currentOpeningToken.matches.length - 1];
|
711
|
+
lastMatch = currentOpeningToken.openGroup && (void 0 === subToken.matches || !1 === subToken.isGroup && !1 === subToken.isAlternator) ? openenings.pop() : groupQuantifier(currentOpeningToken.matches);
|
712
|
+
} else lastMatch = groupQuantifier(currentToken.matches);
|
713
|
+
if (lastMatch.isAlternator) openenings.push(lastMatch); else if (lastMatch.alternatorGroup ? (alternator = openenings.pop(),
|
714
|
+
lastMatch.alternatorGroup = !1) : alternator = new MaskToken(!1, !1, !1, !0), alternator.matches.push(lastMatch),
|
715
|
+
openenings.push(alternator), lastMatch.openGroup) {
|
716
|
+
lastMatch.openGroup = !1;
|
717
|
+
var alternatorGroup = new MaskToken(!0);
|
718
|
+
alternatorGroup.alternatorGroup = !0, openenings.push(alternatorGroup);
|
719
|
+
}
|
720
|
+
break;
|
721
|
+
|
722
|
+
default:
|
723
|
+
defaultCase();
|
724
|
+
}
|
725
|
+
}
|
726
|
+
for (closeRegexGroup && closeGroup(); 0 < openenings.length; ) openingToken = openenings.pop(),
|
727
|
+
currentToken.matches.push(openingToken);
|
728
|
+
return 0 < currentToken.matches.length && (verifyGroupMarker(currentToken), maskTokens.push(currentToken)),
|
729
|
+
(opts.numericInput || opts.isRTL) && reverseTokens(maskTokens[0]), maskTokens;
|
730
|
+
}
|
731
|
+
module.exports = {
|
732
|
+
generateMaskSet: generateMaskSet,
|
733
|
+
analyseMask: analyseMask
|
734
|
+
};
|
735
|
+
}, function(module, exports, __webpack_require__) {
|
736
|
+
function _typeof(obj) {
|
737
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
|
738
|
+
return typeof obj;
|
739
|
+
} : function _typeof(obj) {
|
740
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
741
|
+
}, _typeof(obj);
|
742
|
+
}
|
743
|
+
var $ = __webpack_require__(3), window = __webpack_require__(4), document = window.document, ua = window.navigator.userAgent, ie = 0 < ua.indexOf("MSIE ") || 0 < ua.indexOf("Trident/"), mobile = isInputEventSupported("touchstart"), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile;
|
744
|
+
function isInputEventSupported(eventName) {
|
745
|
+
var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el;
|
746
|
+
return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]),
|
747
|
+
el = null, isSupported;
|
748
|
+
}
|
749
|
+
module.exports = function maskScope(actionObj, maskset, opts) {
|
750
|
+
maskset = maskset || this.maskset, opts = opts || this.opts;
|
751
|
+
var inputmask = this, el = this.el, isRTL = this.isRTL || (this.isRTL = opts.numericInput), undoValue, $el, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, maxLength, mouseEnter = !1, colorMask, originalPlaceholder;
|
752
|
+
function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
|
753
|
+
var greedy = opts.greedy;
|
754
|
+
clearOptionalTail && (opts.greedy = !1), minimalPos = minimalPos || 0;
|
755
|
+
var maskTemplate = [], ndxIntlzr, pos = 0, test, testPos;
|
756
|
+
do {
|
757
|
+
if (!0 === baseOnInput && maskset.validPositions[pos]) testPos = clearOptionalTail && !0 === maskset.validPositions[pos].match.optionality && void 0 === maskset.validPositions[pos + 1] && (!0 === maskset.validPositions[pos].generatedInput || maskset.validPositions[pos].input == opts.skipOptionalPartCharacter && 0 < pos) ? determineTestTemplate(pos, getTests(pos, ndxIntlzr, pos - 1)) : maskset.validPositions[pos],
|
758
|
+
test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder(pos, test)); else {
|
759
|
+
testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), test = testPos.match, ndxIntlzr = testPos.locator.slice();
|
760
|
+
var jitMasking = !0 !== noJit && (!1 !== opts.jitMasking ? opts.jitMasking : test.jit);
|
761
|
+
(!1 === jitMasking || void 0 === jitMasking || "number" == typeof jitMasking && isFinite(jitMasking) && pos < jitMasking) && maskTemplate.push(!1 === includeMode ? test.nativeDef : getPlaceholder(pos, test));
|
762
|
+
}
|
763
|
+
"auto" === opts.keepStatic && test.newBlockMarker && !0 !== test.static && (opts.keepStatic = pos - 1),
|
764
|
+
pos++;
|
765
|
+
} while ((void 0 === maxLength || pos < maxLength) && (!0 !== test.static || "" !== test.def) || pos < minimalPos);
|
766
|
+
return "" === maskTemplate[maskTemplate.length - 1] && maskTemplate.pop(), !1 === includeMode && void 0 !== maskset.maskLength || (maskset.maskLength = pos - 1),
|
767
|
+
opts.greedy = greedy, maskTemplate;
|
768
|
+
}
|
769
|
+
function resetMaskSet(soft) {
|
770
|
+
maskset.buffer = void 0, !0 !== soft && (maskset.validPositions = {}, maskset.p = 0);
|
771
|
+
}
|
772
|
+
function getLastValidPosition(closestTo, strict, validPositions) {
|
773
|
+
var before = -1, after = -1, valids = validPositions || maskset.validPositions;
|
774
|
+
for (var posNdx in void 0 === closestTo && (closestTo = -1), valids) {
|
775
|
+
var psNdx = parseInt(posNdx);
|
776
|
+
valids[psNdx] && (strict || !0 !== valids[psNdx].generatedInput) && (psNdx <= closestTo && (before = psNdx),
|
777
|
+
closestTo <= psNdx && (after = psNdx));
|
778
|
+
}
|
779
|
+
return -1 === before || before == closestTo ? after : -1 == after ? before : closestTo - before < after - closestTo ? before : after;
|
780
|
+
}
|
781
|
+
function getDecisionTaker(tst) {
|
782
|
+
var decisionTaker = tst.locator[tst.alternation];
|
783
|
+
return "string" == typeof decisionTaker && 0 < decisionTaker.length && (decisionTaker = decisionTaker.split(",")[0]),
|
784
|
+
void 0 !== decisionTaker ? decisionTaker.toString() : "";
|
785
|
+
}
|
786
|
+
function getLocator(tst, align) {
|
787
|
+
var locator = (null != tst.alternation ? tst.mloc[getDecisionTaker(tst)] : tst.locator).join("");
|
788
|
+
if ("" !== locator) for (;locator.length < align; ) locator += "0";
|
789
|
+
return locator;
|
790
|
+
}
|
791
|
+
function determineTestTemplate(pos, tests) {
|
792
|
+
pos = 0 < pos ? pos - 1 : 0;
|
793
|
+
for (var altTest = getTest(pos), targetLocator = getLocator(altTest), tstLocator, closest, bestMatch, ndx = 0; ndx < tests.length; ndx++) {
|
794
|
+
var tst = tests[ndx];
|
795
|
+
tstLocator = getLocator(tst, targetLocator.length);
|
796
|
+
var distance = Math.abs(tstLocator - targetLocator);
|
797
|
+
(void 0 === closest || "" !== tstLocator && distance < closest || bestMatch && !opts.greedy && bestMatch.match.optionality && "master" === bestMatch.match.newBlockMarker && (!tst.match.optionality || !tst.match.newBlockMarker) || bestMatch && bestMatch.match.optionalQuantifier && !tst.match.optionalQuantifier) && (closest = distance,
|
798
|
+
bestMatch = tst);
|
799
|
+
}
|
800
|
+
return bestMatch;
|
801
|
+
}
|
802
|
+
function getTestTemplate(pos, ndxIntlzr, tstPs) {
|
803
|
+
return maskset.validPositions[pos] || determineTestTemplate(pos, getTests(pos, ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, tstPs));
|
804
|
+
}
|
805
|
+
function getTest(pos, tests) {
|
806
|
+
return maskset.validPositions[pos] ? maskset.validPositions[pos] : (tests || getTests(pos))[0];
|
807
|
+
}
|
808
|
+
function positionCanMatchDefinition(pos, def) {
|
809
|
+
for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) {
|
810
|
+
valid = !0;
|
811
|
+
break;
|
812
|
+
}
|
813
|
+
return !1 === valid && void 0 !== maskset.jitOffset[pos] && (valid = positionCanMatchDefinition(pos + maskset.jitOffset[pos], def)),
|
814
|
+
valid;
|
815
|
+
}
|
816
|
+
function getTests(pos, ndxIntlzr, tstPs) {
|
817
|
+
var maskTokens = maskset.maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = !1, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
|
818
|
+
function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
|
819
|
+
function handleMatch(match, loopNdx, quantifierRecurse) {
|
820
|
+
function isFirstMatch(latestMatch, tokenGroup) {
|
821
|
+
var firstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches);
|
822
|
+
return firstMatch || $.each(tokenGroup.matches, function(ndx, match) {
|
823
|
+
if (!0 === match.isQuantifier ? firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]) : match.hasOwnProperty("matches") && (firstMatch = isFirstMatch(latestMatch, match)),
|
824
|
+
firstMatch) return !1;
|
825
|
+
}), firstMatch;
|
826
|
+
}
|
827
|
+
function resolveNdxInitializer(pos, alternateNdx, targetAlternation) {
|
828
|
+
var bestMatch, indexPos;
|
829
|
+
if ((maskset.tests[pos] || maskset.validPositions[pos]) && $.each(maskset.tests[pos] || [ maskset.validPositions[pos] ], function(ndx, lmnt) {
|
830
|
+
if (lmnt.mloc[alternateNdx]) return bestMatch = lmnt, !1;
|
831
|
+
var alternation = void 0 !== targetAlternation ? targetAlternation : lmnt.alternation, ndxPos = void 0 !== lmnt.locator[alternation] ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1;
|
832
|
+
(void 0 === indexPos || ndxPos < indexPos) && -1 !== ndxPos && (bestMatch = lmnt,
|
833
|
+
indexPos = ndxPos);
|
834
|
+
}), bestMatch) {
|
835
|
+
var bestMatchAltIndex = bestMatch.locator[bestMatch.alternation], locator = bestMatch.mloc[alternateNdx] || bestMatch.mloc[bestMatchAltIndex] || bestMatch.locator;
|
836
|
+
return locator.slice((void 0 !== targetAlternation ? targetAlternation : bestMatch.alternation) + 1);
|
837
|
+
}
|
838
|
+
return void 0 !== targetAlternation ? resolveNdxInitializer(pos, alternateNdx) : void 0;
|
839
|
+
}
|
840
|
+
function isSubsetOf(source, target) {
|
841
|
+
function expand(pattern) {
|
842
|
+
for (var expanded = [], start = -1, end, i = 0, l = pattern.length; i < l; i++) if ("-" === pattern.charAt(i)) for (end = pattern.charCodeAt(i + 1); ++start < end; ) expanded.push(String.fromCharCode(start)); else start = pattern.charCodeAt(i),
|
843
|
+
expanded.push(pattern.charAt(i));
|
844
|
+
return expanded.join("");
|
845
|
+
}
|
846
|
+
return opts.regex && !0 !== source.match.static && !0 !== target.match.static ? -1 !== expand(target.match.def.replace(/[[\]]/g, "")).indexOf(expand(source.match.def.replace(/[[\]]/g, ""))) : source.match.def === target.match.nativeDef;
|
847
|
+
}
|
848
|
+
function staticCanMatchDefinition(source, target) {
|
849
|
+
var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc;
|
850
|
+
return canMatch = !(!canMatch || !0 !== source.match.static || !0 === target.match.static) && target.match.fn.test(source.match.def, maskset, pos, !1, opts, !1),
|
851
|
+
canMatch;
|
852
|
+
}
|
853
|
+
function setMergeLocators(targetMatch, altMatch) {
|
854
|
+
if (void 0 === altMatch || targetMatch.alternation === altMatch.alternation && -1 === targetMatch.locator[targetMatch.alternation].toString().indexOf(altMatch.locator[altMatch.alternation])) {
|
855
|
+
targetMatch.mloc = targetMatch.mloc || {};
|
856
|
+
var locNdx = targetMatch.locator[targetMatch.alternation];
|
857
|
+
if (void 0 !== locNdx) {
|
858
|
+
if ("string" == typeof locNdx && (locNdx = locNdx.split(",")[0]), void 0 === targetMatch.mloc[locNdx] && (targetMatch.mloc[locNdx] = targetMatch.locator.slice()),
|
859
|
+
void 0 !== altMatch) {
|
860
|
+
for (var ndx in altMatch.mloc) "string" == typeof ndx && (ndx = ndx.split(",")[0]),
|
861
|
+
void 0 === targetMatch.mloc[ndx] && (targetMatch.mloc[ndx] = altMatch.mloc[ndx]);
|
862
|
+
targetMatch.locator[targetMatch.alternation] = Object.keys(targetMatch.mloc).join(",");
|
863
|
+
}
|
864
|
+
return !0;
|
865
|
+
}
|
866
|
+
targetMatch.alternation = void 0;
|
867
|
+
}
|
868
|
+
return !1;
|
869
|
+
}
|
870
|
+
if (500 < testPos && void 0 !== quantifierRecurse) 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. " + maskset.mask;
|
871
|
+
if (testPos === pos && void 0 === match.matches) return matches.push({
|
872
|
+
match: match,
|
873
|
+
locator: loopNdx.reverse(),
|
874
|
+
cd: cacheDependency,
|
875
|
+
mloc: {}
|
876
|
+
}), !0;
|
877
|
+
if (void 0 !== match.matches) {
|
878
|
+
if (match.isGroup && quantifierRecurse !== match) {
|
879
|
+
if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx, quantifierRecurse),
|
880
|
+
match) return !0;
|
881
|
+
} else if (match.isOptional) {
|
882
|
+
var optionalToken = match, mtchsNdx = matches.length;
|
883
|
+
if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse),
|
884
|
+
match) {
|
885
|
+
if ($.each(matches, function(ndx, mtch) {
|
886
|
+
mtchsNdx <= ndx && (mtch.match.optionality = !0);
|
887
|
+
}), latestMatch = matches[matches.length - 1].match, void 0 !== quantifierRecurse || !isFirstMatch(latestMatch, optionalToken)) return !0;
|
888
|
+
insertStop = !0, testPos = pos;
|
889
|
+
}
|
890
|
+
} else if (match.isAlternator) {
|
891
|
+
var alternateToken = match, malternateMatches = [], maltMatches, currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = 0 < ndxInitializer.length ? ndxInitializer.shift() : -1;
|
892
|
+
if (-1 === altIndex || "string" == typeof altIndex) {
|
893
|
+
var currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = [], amndx;
|
894
|
+
if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0; amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx.toString());
|
895
|
+
if (maskset.excludes[pos]) {
|
896
|
+
for (var altIndexArrClone = altIndexArr.slice(), i = 0, el = maskset.excludes[pos].length; i < el; i++) altIndexArr.splice(altIndexArr.indexOf(maskset.excludes[pos][i].toString()), 1);
|
897
|
+
0 === altIndexArr.length && (maskset.excludes[pos] = void 0, altIndexArr = altIndexArrClone);
|
898
|
+
}
|
899
|
+
(!0 === opts.keepStatic || isFinite(parseInt(opts.keepStatic)) && currentPos >= opts.keepStatic) && (altIndexArr = altIndexArr.slice(0, 1));
|
900
|
+
for (var unMatchedAlternation = !1, ndx = 0; ndx < altIndexArr.length; ndx++) {
|
901
|
+
amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = "string" == typeof altIndex && resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice(),
|
902
|
+
alternateToken.matches[amndx] && handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) ? match = !0 : 0 === ndx && (unMatchedAlternation = !0),
|
903
|
+
maltMatches = matches.slice(), testPos = currentPos, matches = [];
|
904
|
+
for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
|
905
|
+
var altMatch = maltMatches[ndx1], dropMatch = !1;
|
906
|
+
altMatch.match.jit = altMatch.match.jit || unMatchedAlternation, altMatch.alternation = altMatch.alternation || loopNdxCnt,
|
907
|
+
setMergeLocators(altMatch);
|
908
|
+
for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
|
909
|
+
var altMatch2 = malternateMatches[ndx2];
|
910
|
+
if ("string" != typeof altIndex || void 0 !== altMatch.alternation && -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) {
|
911
|
+
if (altMatch.match.nativeDef === altMatch2.match.nativeDef) {
|
912
|
+
dropMatch = !0, setMergeLocators(altMatch2, altMatch);
|
913
|
+
break;
|
914
|
+
}
|
915
|
+
if (isSubsetOf(altMatch, altMatch2)) {
|
916
|
+
setMergeLocators(altMatch, altMatch2) && (dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
|
917
|
+
break;
|
918
|
+
}
|
919
|
+
if (isSubsetOf(altMatch2, altMatch)) {
|
920
|
+
setMergeLocators(altMatch2, altMatch);
|
921
|
+
break;
|
922
|
+
}
|
923
|
+
if (staticCanMatchDefinition(altMatch, altMatch2)) {
|
924
|
+
setMergeLocators(altMatch, altMatch2) && (dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
|
925
|
+
break;
|
926
|
+
}
|
927
|
+
}
|
928
|
+
}
|
929
|
+
dropMatch || malternateMatches.push(altMatch);
|
930
|
+
}
|
931
|
+
}
|
932
|
+
matches = currentMatches.concat(malternateMatches), testPos = pos, insertStop = 0 < matches.length,
|
933
|
+
match = 0 < malternateMatches.length, ndxInitializer = ndxInitializerClone.slice();
|
934
|
+
} else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse);
|
935
|
+
if (match) return !0;
|
936
|
+
} else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) for (var qt = match, qndx = 0 < ndxInitializer.length ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && testPos <= pos; qndx++) {
|
937
|
+
var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
|
938
|
+
if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup), match) {
|
939
|
+
if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx >= qt.quantifier.min,
|
940
|
+
latestMatch.jit = (qndx || 1) * tokenGroup.matches.indexOf(latestMatch) >= qt.quantifier.jit,
|
941
|
+
latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) {
|
942
|
+
insertStop = !0, testPos = pos;
|
943
|
+
break;
|
944
|
+
}
|
945
|
+
return latestMatch.jit && (maskset.jitOffset[pos] = tokenGroup.matches.length - tokenGroup.matches.indexOf(latestMatch)),
|
946
|
+
!0;
|
947
|
+
}
|
948
|
+
} else if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse),
|
949
|
+
match) return !0;
|
950
|
+
} else testPos++;
|
951
|
+
}
|
952
|
+
for (var tndx = 0 < ndxInitializer.length ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (!0 !== maskToken.matches[tndx].isQuantifier) {
|
953
|
+
var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
|
954
|
+
if (match && testPos === pos) return match;
|
955
|
+
if (pos < testPos) break;
|
956
|
+
}
|
957
|
+
}
|
958
|
+
function mergeLocators(pos, tests) {
|
959
|
+
var locator = [];
|
960
|
+
return $.isArray(tests) || (tests = [ tests ]), 0 < tests.length && (void 0 === tests[0].alternation || !0 === opts.keepStatic ? (locator = determineTestTemplate(pos, tests.slice()).locator.slice(),
|
961
|
+
0 === locator.length && (locator = tests[0].locator.slice())) : $.each(tests, function(ndx, tst) {
|
962
|
+
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]);
|
963
|
+
})), locator;
|
964
|
+
}
|
965
|
+
if (-1 < pos && (void 0 === maxLength || pos < maxLength)) {
|
966
|
+
if (void 0 === ndxIntlzr) {
|
967
|
+
for (var previousPos = pos - 1, test; void 0 === (test = maskset.validPositions[previousPos] || maskset.tests[previousPos]) && -1 < previousPos; ) previousPos--;
|
968
|
+
void 0 !== test && -1 < previousPos && (ndxInitializer = mergeLocators(previousPos, test),
|
969
|
+
cacheDependency = ndxInitializer.join(""), testPos = previousPos);
|
970
|
+
}
|
971
|
+
if (maskset.tests[pos] && maskset.tests[pos][0].cd === cacheDependency) return maskset.tests[pos];
|
972
|
+
for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) {
|
973
|
+
var match = resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]);
|
974
|
+
if (match && testPos === pos || pos < testPos) break;
|
975
|
+
}
|
976
|
+
}
|
977
|
+
return (0 === matches.length || insertStop) && matches.push({
|
978
|
+
match: {
|
979
|
+
fn: null,
|
980
|
+
static: !0,
|
981
|
+
optionality: !1,
|
982
|
+
casing: null,
|
983
|
+
def: "",
|
984
|
+
placeholder: ""
|
985
|
+
},
|
986
|
+
locator: [],
|
987
|
+
mloc: {},
|
988
|
+
cd: cacheDependency
|
989
|
+
}), void 0 !== ndxIntlzr && maskset.tests[pos] ? $.extend(!0, [], matches) : (maskset.tests[pos] = $.extend(!0, [], matches),
|
990
|
+
maskset.tests[pos]);
|
991
|
+
}
|
992
|
+
function getBufferTemplate() {
|
993
|
+
return void 0 === maskset._buffer && (maskset._buffer = getMaskTemplate(!1, 1),
|
994
|
+
void 0 === maskset.buffer && (maskset.buffer = maskset._buffer.slice())), maskset._buffer;
|
995
|
+
}
|
996
|
+
function getBuffer(noCache) {
|
997
|
+
return void 0 !== maskset.buffer && !0 !== noCache || (maskset.buffer = getMaskTemplate(!0, getLastValidPosition(), !0),
|
998
|
+
void 0 === maskset._buffer && (maskset._buffer = maskset.buffer.slice())), maskset.buffer;
|
999
|
+
}
|
1000
|
+
function refreshFromBuffer(start, end, buffer) {
|
1001
|
+
var i, p;
|
1002
|
+
if (!0 === start) resetMaskSet(), maskset.tests = {}, start = 0, end = buffer.length; else for (i = start; i < end; i++) delete maskset.validPositions[i];
|
1003
|
+
for (p = start, i = start; i < end; i++) if (buffer[i] !== opts.skipOptionalPartCharacter) {
|
1004
|
+
var valResult = isValid(p, buffer[i], !opts.negationSymbol || [ i ] !== opts.negationSymbol.front, !opts.negationSymbol || [ i ] !== opts.negationSymbol.front);
|
1005
|
+
!1 !== valResult && (p = void 0 !== valResult.caret ? valResult.caret : valResult.pos + 1);
|
1006
|
+
}
|
1007
|
+
}
|
1008
|
+
function casing(elem, test, pos) {
|
1009
|
+
switch (opts.casing || test.casing) {
|
1010
|
+
case "upper":
|
1011
|
+
elem = elem.toUpperCase();
|
1012
|
+
break;
|
1013
|
+
|
1014
|
+
case "lower":
|
1015
|
+
elem = elem.toLowerCase();
|
1016
|
+
break;
|
1017
|
+
|
1018
|
+
case "title":
|
1019
|
+
var posBefore = maskset.validPositions[pos - 1];
|
1020
|
+
elem = 0 === pos || posBefore && posBefore.input === String.fromCharCode(Inputmask.keyCode.SPACE) ? elem.toUpperCase() : elem.toLowerCase();
|
1021
|
+
break;
|
1022
|
+
|
1023
|
+
default:
|
1024
|
+
if ($.isFunction(opts.casing)) {
|
1025
|
+
var args = Array.prototype.slice.call(arguments);
|
1026
|
+
args.push(maskset.validPositions), elem = opts.casing.apply(this, args);
|
1027
|
+
}
|
1028
|
+
}
|
1029
|
+
return elem;
|
1030
|
+
}
|
1031
|
+
function checkAlternationMatch(altArr1, altArr2, na) {
|
1032
|
+
for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, naArr = void 0 !== na ? na.split(",") : [], naNdx, i = 0; i < naArr.length; i++) -1 !== (naNdx = altArr1.indexOf(naArr[i])) && altArr1.splice(naNdx, 1);
|
1033
|
+
for (var alndx = 0; alndx < altArr1.length; alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) {
|
1034
|
+
isMatch = !0;
|
1035
|
+
break;
|
1036
|
+
}
|
1037
|
+
return isMatch;
|
1038
|
+
}
|
1039
|
+
function alternate(pos, c, strict, fromIsValid, rAltPos) {
|
1040
|
+
var validPsClone = $.extend(!0, {}, maskset.validPositions), lastAlt, alternation, isValidRslt = !1, returnRslt = !1, altPos, prevAltPos, i, validPos, decisionPos, lAltPos = void 0 !== rAltPos ? rAltPos : getLastValidPosition();
|
1041
|
+
function insertPosition(insert) {
|
1042
|
+
if (insert && isValidRslt && void 0 !== c) {
|
1043
|
+
var targetLvp = getLastValidPosition(pos) + 1;
|
1044
|
+
for (i = decisionPos; i < getLastValidPosition() + 1; i++) validPos = maskset.validPositions[i],
|
1045
|
+
(void 0 === validPos || 1 == validPos.match.static) && i < pos + posOffset && posOffset++;
|
1046
|
+
pos += posOffset, isValidRslt = returnRslt = isValid(targetLvp < pos ? targetLvp : pos, c, strict, fromIsValid, !0);
|
1047
|
+
}
|
1048
|
+
}
|
1049
|
+
if (-1 === lAltPos && void 0 === rAltPos) lastAlt = 0, prevAltPos = getTest(lastAlt),
|
1050
|
+
alternation = prevAltPos.alternation; else for (;0 <= lAltPos; lAltPos--) if (altPos = maskset.validPositions[lAltPos],
|
1051
|
+
altPos && void 0 !== altPos.alternation) {
|
1052
|
+
if (prevAltPos && prevAltPos.locator[altPos.alternation] !== altPos.locator[altPos.alternation]) break;
|
1053
|
+
lastAlt = lAltPos, alternation = maskset.validPositions[lastAlt].alternation, prevAltPos = altPos;
|
1054
|
+
}
|
1055
|
+
if (void 0 !== alternation) {
|
1056
|
+
decisionPos = parseInt(lastAlt), maskset.excludes[decisionPos] = maskset.excludes[decisionPos] || [],
|
1057
|
+
!0 !== pos && maskset.excludes[decisionPos].push(getDecisionTaker(prevAltPos));
|
1058
|
+
var validInputsClone = [], staticInputsBeforePos = 0;
|
1059
|
+
for (i = decisionPos; i < getLastValidPosition(void 0, !0) + 1; i++) validPos = maskset.validPositions[i],
|
1060
|
+
validPos && !0 !== validPos.generatedInput ? validInputsClone.push(validPos.input) : i < pos && staticInputsBeforePos++,
|
1061
|
+
delete maskset.validPositions[i];
|
1062
|
+
for (;maskset.excludes[decisionPos] && maskset.excludes[decisionPos].length < 10; ) {
|
1063
|
+
var posOffset = -1 * staticInputsBeforePos, validInputs = validInputsClone.slice();
|
1064
|
+
for (maskset.tests[decisionPos] = void 0, resetMaskSet(!0), isValidRslt = !0, insertPosition(0 === pos); 0 < validInputs.length; ) {
|
1065
|
+
var input = validInputs.shift();
|
1066
|
+
if (!(isValidRslt = isValid(isValidRslt.caret || getLastValidPosition(void 0, !0) + 1, input, !1, fromIsValid, !0))) break;
|
1067
|
+
}
|
1068
|
+
if (insertPosition(0 < pos), isValidRslt) break;
|
1069
|
+
if (resetMaskSet(), prevAltPos = getTest(decisionPos), maskset.validPositions = $.extend(!0, {}, validPsClone),
|
1070
|
+
!maskset.excludes[decisionPos]) {
|
1071
|
+
isValidRslt = alternate(pos, c, strict, fromIsValid, decisionPos - 1);
|
1072
|
+
break;
|
1073
|
+
}
|
1074
|
+
var decisionTaker = getDecisionTaker(prevAltPos);
|
1075
|
+
if (-1 !== maskset.excludes[decisionPos].indexOf(decisionTaker)) {
|
1076
|
+
isValidRslt = alternate(pos, c, strict, fromIsValid, decisionPos - 1);
|
1077
|
+
break;
|
1078
|
+
}
|
1079
|
+
for (maskset.excludes[decisionPos].push(decisionTaker), i = decisionPos; i < getLastValidPosition(void 0, !0) + 1; i++) delete maskset.validPositions[i];
|
1080
|
+
}
|
1081
|
+
}
|
1082
|
+
return maskset.excludes[decisionPos] = void 0, returnRslt;
|
1083
|
+
}
|
1084
|
+
function isValid(pos, c, strict, fromIsValid, fromAlternate, validateOnly) {
|
1085
|
+
function isSelection(posObj) {
|
1086
|
+
return isRTL ? 1 < posObj.begin - posObj.end || posObj.begin - posObj.end == 1 : 1 < posObj.end - posObj.begin || posObj.end - posObj.begin == 1;
|
1087
|
+
}
|
1088
|
+
strict = !0 === strict;
|
1089
|
+
var maskPos = pos;
|
1090
|
+
function processCommandObject(commandObj) {
|
1091
|
+
if (void 0 !== commandObj) {
|
1092
|
+
if (void 0 !== commandObj.remove && ($.isArray(commandObj.remove) || (commandObj.remove = [ commandObj.remove ]),
|
1093
|
+
$.each(commandObj.remove.sort(function(a, b) {
|
1094
|
+
return b.pos - a.pos;
|
1095
|
+
}), function(ndx, lmnt) {
|
1096
|
+
revalidateMask({
|
1097
|
+
begin: lmnt,
|
1098
|
+
end: lmnt + 1
|
1099
|
+
});
|
1100
|
+
}), commandObj.remove = void 0), void 0 !== commandObj.insert && ($.isArray(commandObj.insert) || (commandObj.insert = [ commandObj.insert ]),
|
1101
|
+
$.each(commandObj.insert.sort(function(a, b) {
|
1102
|
+
return a.pos - b.pos;
|
1103
|
+
}), function(ndx, lmnt) {
|
1104
|
+
"" !== lmnt.c && isValid(lmnt.pos, lmnt.c, void 0 === lmnt.strict || lmnt.strict, void 0 !== lmnt.fromIsValid ? lmnt.fromIsValid : fromIsValid);
|
1105
|
+
}), commandObj.insert = void 0), commandObj.refreshFromBuffer && commandObj.buffer) {
|
1106
|
+
var refresh = commandObj.refreshFromBuffer;
|
1107
|
+
refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, commandObj.buffer),
|
1108
|
+
commandObj.refreshFromBuffer = void 0;
|
1109
|
+
}
|
1110
|
+
void 0 !== commandObj.rewritePosition && (maskPos = commandObj.rewritePosition,
|
1111
|
+
commandObj = !0, commandObj.rewritePosition = void 0);
|
1112
|
+
}
|
1113
|
+
return commandObj;
|
1114
|
+
}
|
1115
|
+
function _isValid(position, c, strict) {
|
1116
|
+
var rslt = !1;
|
1117
|
+
return $.each(getTests(position), function(ndx, tst) {
|
1118
|
+
var test = tst.match;
|
1119
|
+
if (getBuffer(!0), rslt = null != test.fn ? test.fn.test(c, maskset, position, strict, opts, isSelection(pos)) : (c === test.def || c === opts.skipOptionalPartCharacter) && "" !== test.def && {
|
1120
|
+
c: getPlaceholder(position, test, !0) || test.def,
|
1121
|
+
pos: position
|
1122
|
+
}, !1 !== rslt) {
|
1123
|
+
var elem = void 0 !== rslt.c ? rslt.c : c, validatedPos = position;
|
1124
|
+
return elem = elem === opts.skipOptionalPartCharacter && !0 === test.static ? getPlaceholder(position, test, !0) || test.def : elem,
|
1125
|
+
rslt = processCommandObject(rslt), !0 !== rslt && void 0 !== rslt.pos && rslt.pos !== position && (validatedPos = rslt.pos),
|
1126
|
+
!0 !== rslt && void 0 === rslt.pos && void 0 === rslt.c ? !1 : (revalidateMask(pos, $.extend({}, tst, {
|
1127
|
+
input: casing(elem, test, validatedPos)
|
1128
|
+
}), fromIsValid, validatedPos) || (rslt = !1), !1);
|
1129
|
+
}
|
1130
|
+
}), rslt;
|
1131
|
+
}
|
1132
|
+
void 0 !== pos.begin && (maskPos = isRTL ? pos.end : pos.begin);
|
1133
|
+
var result = !0, positionsClone = $.extend(!0, {}, maskset.validPositions);
|
1134
|
+
if ($.isFunction(opts.preValidation) && !strict && !0 !== fromIsValid && !0 !== validateOnly && !0 !== fromAlternate && (result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts, maskset),
|
1135
|
+
result = processCommandObject(result)), !0 === result) {
|
1136
|
+
if ((void 0 === maxLength || maskPos < maxLength) && (result = _isValid(maskPos, c, strict),
|
1137
|
+
(!strict || !0 === fromIsValid) && !1 === result && !0 !== validateOnly)) {
|
1138
|
+
var currentPosValid = maskset.validPositions[maskPos];
|
1139
|
+
if (!currentPosValid || !0 !== currentPosValid.match.static || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) {
|
1140
|
+
if (opts.insertMode || void 0 === maskset.validPositions[seekNext(maskPos)]) {
|
1141
|
+
var skip = !1;
|
1142
|
+
if (maskset.jitOffset[maskPos] && void 0 === maskset.validPositions[seekNext(maskPos)] && (result = isValid(maskPos + maskset.jitOffset[maskPos], c, !0),
|
1143
|
+
!1 !== result && (!0 !== fromAlternate && (result.caret = maskPos), skip = !0)),
|
1144
|
+
!skip && !isMask(maskPos, !0)) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) if (result = _isValid(nPos, c, strict),
|
1145
|
+
!1 !== result) {
|
1146
|
+
result = trackbackPositions(maskPos, void 0 !== result.pos ? result.pos : nPos) || result,
|
1147
|
+
maskPos = nPos;
|
1148
|
+
break;
|
1149
|
+
}
|
1150
|
+
}
|
1151
|
+
} else result = {
|
1152
|
+
caret: seekNext(maskPos)
|
1153
|
+
};
|
1154
|
+
}
|
1155
|
+
!1 !== result || !1 === opts.keepStatic || null != opts.regex && !isComplete(getBuffer()) || strict || !0 === fromAlternate || (result = alternate(maskPos, c, strict, fromIsValid)),
|
1156
|
+
!0 === result && (result = {
|
1157
|
+
pos: maskPos
|
1158
|
+
});
|
1159
|
+
}
|
1160
|
+
if ($.isFunction(opts.postValidation) && !1 !== result && !strict && !0 !== fromIsValid && !0 !== validateOnly) {
|
1161
|
+
var postResult = opts.postValidation(getBuffer(!0), void 0 !== pos.begin ? isRTL ? pos.end : pos.begin : pos, result, opts);
|
1162
|
+
void 0 !== postResult && (result = !0 === postResult ? result : postResult);
|
1163
|
+
}
|
1164
|
+
result && void 0 === result.pos && (result.pos = maskPos), !1 === result || !0 === validateOnly ? (resetMaskSet(!0),
|
1165
|
+
maskset.validPositions = $.extend(!0, {}, positionsClone)) : trackbackPositions(void 0, maskPos, !0);
|
1166
|
+
var endResult = processCommandObject(result);
|
1167
|
+
return endResult;
|
1168
|
+
}
|
1169
|
+
function trackbackPositions(originalPos, newPos, fillOnly) {
|
1170
|
+
if (void 0 === originalPos) for (originalPos = newPos - 1; 0 < originalPos && !maskset.validPositions[originalPos]; originalPos--) ;
|
1171
|
+
for (var ps = originalPos; ps < newPos; ps++) if (void 0 === maskset.validPositions[ps] && !isMask(ps, !0)) {
|
1172
|
+
var vp = 0 == ps ? getTest(ps) : maskset.validPositions[ps - 1];
|
1173
|
+
if (vp) {
|
1174
|
+
var tests = getTests(ps).slice();
|
1175
|
+
"" === tests[tests.length - 1].match.def && tests.pop();
|
1176
|
+
var bestMatch = determineTestTemplate(ps, tests), np;
|
1177
|
+
if (bestMatch && (!0 !== bestMatch.match.jit || "master" === bestMatch.match.newBlockMarker && (np = maskset.validPositions[ps + 1]) && !0 === np.match.optionalQuantifier) && (bestMatch = $.extend({}, bestMatch, {
|
1178
|
+
input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def
|
1179
|
+
}), bestMatch.generatedInput = !0, revalidateMask(ps, bestMatch, !0), !0 !== fillOnly)) {
|
1180
|
+
var cvpInput = maskset.validPositions[newPos].input;
|
1181
|
+
return maskset.validPositions[newPos] = void 0, isValid(newPos, cvpInput, !0, !0);
|
1182
|
+
}
|
1183
|
+
}
|
1184
|
+
}
|
1185
|
+
}
|
1186
|
+
function revalidateMask(pos, validTest, fromIsValid, validatedPos) {
|
1187
|
+
function IsEnclosedStatic(pos, valids, selection) {
|
1188
|
+
var posMatch = valids[pos];
|
1189
|
+
if (void 0 === posMatch || (!0 !== posMatch.match.static || !0 === posMatch.match.optionality) && posMatch.input !== opts.radixPoint) return !1;
|
1190
|
+
var prevMatch = selection.begin <= pos - 1 ? valids[pos - 1] && !0 === valids[pos - 1].match.static && valids[pos - 1] : valids[pos - 1], nextMatch = selection.end > pos + 1 ? valids[pos + 1] && !0 === valids[pos + 1].match.static && valids[pos + 1] : valids[pos + 1];
|
1191
|
+
return prevMatch && nextMatch;
|
1192
|
+
}
|
1193
|
+
var begin = void 0 !== pos.begin ? pos.begin : pos, end = void 0 !== pos.end ? pos.end : pos;
|
1194
|
+
if (pos.begin > pos.end && (begin = pos.end, end = pos.begin), validatedPos = void 0 !== validatedPos ? validatedPos : begin,
|
1195
|
+
begin !== end || opts.insertMode && void 0 !== maskset.validPositions[validatedPos] && void 0 === fromIsValid) {
|
1196
|
+
var positionsClone = $.extend(!0, {}, maskset.validPositions), lvp = getLastValidPosition(void 0, !0), i;
|
1197
|
+
for (maskset.p = begin, i = lvp; begin <= i; i--) delete maskset.validPositions[i],
|
1198
|
+
void 0 === validTest && delete maskset.tests[i + 1];
|
1199
|
+
var valid = !0, j = validatedPos, needsValidation = 0 === validatedPos, posMatch = j;
|
1200
|
+
for (i = j, validTest && (maskset.validPositions[validatedPos] = $.extend(!0, {}, validTest),
|
1201
|
+
posMatch++, j++, begin < end && i++); i <= lvp; i++) {
|
1202
|
+
var t = positionsClone[i];
|
1203
|
+
if (void 0 !== t && (end <= i || begin <= i && !0 !== t.generatedInput && IsEnclosedStatic(i, positionsClone, {
|
1204
|
+
begin: begin,
|
1205
|
+
end: end
|
1206
|
+
}))) {
|
1207
|
+
for (;"" !== getTest(posMatch).match.def; ) {
|
1208
|
+
if (!1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.nativeDef === t.match.nativeDef) maskset.validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]),
|
1209
|
+
maskset.validPositions[posMatch].input = t.input, trackbackPositions(void 0, posMatch, !0),
|
1210
|
+
j = posMatch + 1, valid = !0; else if (opts.shiftPositions && (positionCanMatchDefinition(posMatch, t.match.def) || "+" === t.match.def)) {
|
1211
|
+
"+" === t.match.def && getBuffer(!0);
|
1212
|
+
var result = isValid(posMatch, t.input, "+" !== t.match.def, "+" !== t.match.def);
|
1213
|
+
valid = !1 !== result, j = (result.pos || posMatch) + 1, needsValidation = !0;
|
1214
|
+
} else valid = !0 === t.generatedInput;
|
1215
|
+
if (valid) break;
|
1216
|
+
if (!valid && end < posMatch && isMask(posMatch, !0) && (!0 !== t.match.static || posMatch > maskset.maskLength)) break;
|
1217
|
+
posMatch++;
|
1218
|
+
}
|
1219
|
+
"" == getTest(posMatch).match.def && (valid = !1), posMatch = j;
|
1220
|
+
}
|
1221
|
+
if (!valid) break;
|
1222
|
+
}
|
1223
|
+
if (!valid) return maskset.validPositions = $.extend(!0, {}, positionsClone), resetMaskSet(!0),
|
1224
|
+
!1;
|
1225
|
+
} else validTest && (maskset.validPositions[validatedPos] = $.extend(!0, {}, validTest));
|
1226
|
+
return resetMaskSet(!0), !0;
|
1227
|
+
}
|
1228
|
+
function isMask(pos, strict) {
|
1229
|
+
var test = getTestTemplate(pos).match;
|
1230
|
+
if ("" === test.def && (test = getTest(pos).match), 1 != test.static) return test.fn;
|
1231
|
+
if (!0 !== strict && -1 < pos) {
|
1232
|
+
var tests = getTests(pos);
|
1233
|
+
return tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0);
|
1234
|
+
}
|
1235
|
+
return !1;
|
1236
|
+
}
|
1237
|
+
function seekNext(pos, newBlock) {
|
1238
|
+
for (var position = pos + 1; "" !== getTest(position).match.def && (!0 === newBlock && (!0 !== getTest(position).match.newBlockMarker || !isMask(position)) || !0 !== newBlock && !isMask(position)); ) position++;
|
1239
|
+
return position;
|
1240
|
+
}
|
1241
|
+
function seekPrevious(pos, newBlock) {
|
1242
|
+
var position = pos, tests;
|
1243
|
+
if (position <= 0) return 0;
|
1244
|
+
for (;0 < --position && (!0 === newBlock && !0 !== getTest(position).match.newBlockMarker || !0 !== newBlock && !isMask(position) && (tests = getTests(position),
|
1245
|
+
tests.length < 2 || 2 === tests.length && "" === tests[1].match.def)); ) ;
|
1246
|
+
return position;
|
1247
|
+
}
|
1248
|
+
function writeBuffer(input, buffer, caretPos, event, triggerEvents) {
|
1249
|
+
if (event && $.isFunction(opts.onBeforeWrite)) {
|
1250
|
+
var result = opts.onBeforeWrite.call(inputmask, event, buffer, caretPos, opts);
|
1251
|
+
if (result) {
|
1252
|
+
if (result.refreshFromBuffer) {
|
1253
|
+
var refresh = result.refreshFromBuffer;
|
1254
|
+
refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, result.buffer || buffer),
|
1255
|
+
buffer = getBuffer(!0);
|
1256
|
+
}
|
1257
|
+
void 0 !== caretPos && (caretPos = void 0 !== result.caret ? result.caret : caretPos);
|
1258
|
+
}
|
1259
|
+
}
|
1260
|
+
if (void 0 !== input && (input.inputmask._valueSet(buffer.join("")), void 0 === caretPos || void 0 !== event && "blur" === event.type ? renderColorMask(input, caretPos, 0 === buffer.length) : caret(input, caretPos),
|
1261
|
+
!0 === triggerEvents)) {
|
1262
|
+
var $input = $(input), nptVal = input.inputmask._valueGet();
|
1263
|
+
skipInputEvent = !0, $input.trigger("input"), setTimeout(function() {
|
1264
|
+
nptVal === getBufferTemplate().join("") ? $input.trigger("cleared") : !0 === isComplete(buffer) && $input.trigger("complete");
|
1265
|
+
}, 0);
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
function getPlaceholder(pos, test, returnPL) {
|
1269
|
+
if (test = test || getTest(pos).match, void 0 !== test.placeholder || !0 === returnPL) return $.isFunction(test.placeholder) ? test.placeholder(opts) : test.placeholder;
|
1270
|
+
if (!0 !== test.static) return opts.placeholder.charAt(pos % opts.placeholder.length);
|
1271
|
+
if (-1 < pos && void 0 === maskset.validPositions[pos]) {
|
1272
|
+
var tests = getTests(pos), staticAlternations = [], prevTest;
|
1273
|
+
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 && (!0 === tests[i].match.static || void 0 === prevTest || !1 !== tests[i].match.fn.test(prevTest.match.def, maskset, pos, !0, opts)) && (staticAlternations.push(tests[i]),
|
1274
|
+
!0 === tests[i].match.static && (prevTest = tests[i]), 1 < staticAlternations.length && /[0-9a-bA-Z]/.test(staticAlternations[0].match.def))) return opts.placeholder.charAt(pos % opts.placeholder.length);
|
1275
|
+
}
|
1276
|
+
return test.def;
|
1277
|
+
}
|
1278
|
+
function HandleNativePlaceholder(npt, value) {
|
1279
|
+
if (ie) {
|
1280
|
+
if (npt.inputmask._valueGet() !== value && (npt.placeholder !== value || "" === npt.placeholder)) {
|
1281
|
+
var buffer = getBuffer().slice(), nptValue = npt.inputmask._valueGet();
|
1282
|
+
if (nptValue !== value) {
|
1283
|
+
var lvp = getLastValidPosition();
|
1284
|
+
-1 === lvp && nptValue === getBufferTemplate().join("") ? buffer = [] : -1 !== lvp && clearOptionalTail(buffer),
|
1285
|
+
writeBuffer(npt, buffer);
|
1286
|
+
}
|
1287
|
+
}
|
1288
|
+
} else npt.placeholder !== value && (npt.placeholder = value, "" === npt.placeholder && npt.removeAttribute("placeholder"));
|
1289
|
+
}
|
1290
|
+
function determineNewCaretPosition(selectedCaret, tabbed) {
|
1291
|
+
function doRadixFocus(clickPos) {
|
1292
|
+
if ("" !== opts.radixPoint) {
|
1293
|
+
var vps = maskset.validPositions;
|
1294
|
+
if (void 0 === vps[clickPos] || vps[clickPos].input === getPlaceholder(clickPos)) {
|
1295
|
+
if (clickPos < seekNext(-1)) return !0;
|
1296
|
+
var radixPos = $.inArray(opts.radixPoint, getBuffer());
|
1297
|
+
if (-1 !== radixPos) {
|
1298
|
+
for (var vp in vps) if (vps[vp] && radixPos < vp && vps[vp].input !== getPlaceholder(vp)) return !1;
|
1299
|
+
return !0;
|
1300
|
+
}
|
1301
|
+
}
|
1302
|
+
}
|
1303
|
+
return !1;
|
1304
|
+
}
|
1305
|
+
if (tabbed && (isRTL ? selectedCaret.end = selectedCaret.begin : selectedCaret.begin = selectedCaret.end),
|
1306
|
+
selectedCaret.begin === selectedCaret.end) switch (opts.positionCaretOnClick) {
|
1307
|
+
case "none":
|
1308
|
+
break;
|
1309
|
+
|
1310
|
+
case "select":
|
1311
|
+
return {
|
1312
|
+
begin: 0,
|
1313
|
+
end: getBuffer().length
|
1314
|
+
};
|
1315
|
+
|
1316
|
+
case "ignore":
|
1317
|
+
return seekNext(getLastValidPosition());
|
1318
|
+
|
1319
|
+
case "radixFocus":
|
1320
|
+
if (doRadixFocus(selectedCaret.begin)) {
|
1321
|
+
var radixPos = getBuffer().join("").indexOf(opts.radixPoint);
|
1322
|
+
return opts.numericInput ? seekNext(radixPos) : radixPos;
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
default:
|
1326
|
+
var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, !0), lastPosition = seekNext(-1 !== lvclickPosition || isMask(0) ? lvclickPosition : 0);
|
1327
|
+
if (clickPosition < lastPosition) return isMask(clickPosition, !0) || isMask(clickPosition - 1, !0) ? clickPosition : seekNext(clickPosition);
|
1328
|
+
var lvp = maskset.validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : void 0, lvp), placeholder = getPlaceholder(lastPosition, tt.match);
|
1329
|
+
if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask(lastPosition, opts.keepStatic) && tt.match.def === placeholder) {
|
1330
|
+
var newPos = seekNext(lastPosition);
|
1331
|
+
(newPos <= clickPosition || clickPosition === lastPosition) && (lastPosition = newPos);
|
1332
|
+
}
|
1333
|
+
return lastPosition;
|
1334
|
+
}
|
1335
|
+
}
|
1336
|
+
var EventRuler = {
|
1337
|
+
on: function on(input, eventName, eventHandler) {
|
1338
|
+
var ev = function ev(e) {
|
1339
|
+
var that = this, args;
|
1340
|
+
if (void 0 === that.inputmask && "FORM" !== this.nodeName) {
|
1341
|
+
var imOpts = $.data(that, "_inputmask_opts");
|
1342
|
+
imOpts ? new Inputmask(imOpts).mask(that) : EventRuler.off(that);
|
1343
|
+
} else {
|
1344
|
+
if ("setvalue" === e.type || "FORM" === this.nodeName || !(that.disabled || that.readOnly && !("keydown" === e.type && e.ctrlKey && 67 === e.keyCode || !1 === opts.tabThrough && e.keyCode === Inputmask.keyCode.TAB))) {
|
1345
|
+
switch (e.type) {
|
1346
|
+
case "input":
|
1347
|
+
if (!0 === skipInputEvent) return skipInputEvent = !1, e.preventDefault();
|
1348
|
+
if (mobile) return args = arguments, setTimeout(function() {
|
1349
|
+
eventHandler.apply(that, args), caret(that, that.inputmask.caretPos, void 0, !0);
|
1350
|
+
}, 0), !1;
|
1351
|
+
break;
|
1352
|
+
|
1353
|
+
case "keydown":
|
1354
|
+
skipKeyPressEvent = !1, skipInputEvent = !1;
|
1355
|
+
break;
|
1356
|
+
|
1357
|
+
case "keypress":
|
1358
|
+
if (!0 === skipKeyPressEvent) return e.preventDefault();
|
1359
|
+
skipKeyPressEvent = !0;
|
1360
|
+
break;
|
1361
|
+
|
1362
|
+
case "click":
|
1363
|
+
case "focus":
|
1364
|
+
return args = arguments, setTimeout(function() {
|
1365
|
+
eventHandler.apply(that, args);
|
1366
|
+
}, 0), !1;
|
1367
|
+
}
|
1368
|
+
var returnVal = eventHandler.apply(that, arguments);
|
1369
|
+
return !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal;
|
1370
|
+
}
|
1371
|
+
e.preventDefault();
|
1372
|
+
}
|
1373
|
+
};
|
1374
|
+
input.inputmask.events[eventName] = input.inputmask.events[eventName] || [], input.inputmask.events[eventName].push(ev),
|
1375
|
+
-1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).on(eventName, ev) : $(input).on(eventName, ev);
|
1376
|
+
},
|
1377
|
+
off: function off(input, event) {
|
1378
|
+
var events;
|
1379
|
+
input.inputmask && input.inputmask.events && (event ? (events = [], events[event] = input.inputmask.events[event]) : events = input.inputmask.events,
|
1380
|
+
$.each(events, function(eventName, evArr) {
|
1381
|
+
for (;0 < evArr.length; ) {
|
1382
|
+
var ev = evArr.pop();
|
1383
|
+
-1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).off(eventName, ev) : $(input).off(eventName, ev);
|
1384
|
+
}
|
1385
|
+
delete input.inputmask.events[eventName];
|
1386
|
+
}));
|
1387
|
+
}
|
1388
|
+
}, EventHandlers = {
|
1389
|
+
keydownEvent: function keydownEvent(e) {
|
1390
|
+
var input = this, $input = $(this), k = e.keyCode, pos = caret(this), kdResult = opts.onKeyDown.call(this, e, getBuffer(), pos.begin, opts);
|
1391
|
+
if (void 0 !== kdResult) return kdResult;
|
1392
|
+
if (k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && k === Inputmask.keyCode.BACKSPACE_SAFARI || e.ctrlKey && k === Inputmask.keyCode.X && !isInputEventSupported("cut")) e.preventDefault(),
|
1393
|
+
handleRemove(this, k, pos), writeBuffer(this, getBuffer(!0), maskset.p, e, this.inputmask._valueGet() !== getBuffer().join("")); else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) {
|
1394
|
+
e.preventDefault();
|
1395
|
+
var caretPos = seekNext(getLastValidPosition());
|
1396
|
+
caret(this, e.shiftKey ? pos.begin : caretPos, caretPos, !0);
|
1397
|
+
} else k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP ? (e.preventDefault(),
|
1398
|
+
caret(this, 0, e.shiftKey ? pos.begin : 0, !0)) : (opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE || 90 === k && e.ctrlKey) && !0 !== e.altKey ? (checkVal(this, !0, !1, undoValue.split("")),
|
1399
|
+
$input.trigger("click")) : k !== Inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? !0 === opts.tabThrough && k === Inputmask.keyCode.TAB && (!0 === e.shiftKey ? (!0 === getTest(pos.begin).match.static && (pos.begin = seekNext(pos.begin)),
|
1400
|
+
pos.end = seekPrevious(pos.begin, !0), pos.begin = seekPrevious(pos.end, !0)) : (pos.begin = seekNext(pos.begin, !0),
|
1401
|
+
pos.end = seekNext(pos.begin, !0), pos.end < maskset.maskLength && pos.end--), pos.begin < maskset.maskLength && (e.preventDefault(),
|
1402
|
+
caret(this, pos.begin, pos.end))) : (opts.insertMode = !opts.insertMode, this.setAttribute("data-im-insert", opts.insertMode));
|
1403
|
+
ignorable = -1 !== $.inArray(k, opts.ignorables);
|
1404
|
+
},
|
1405
|
+
keypressEvent: function keypressEvent(e, checkval, writeOut, strict, ndx) {
|
1406
|
+
var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode;
|
1407
|
+
if (!(!0 === checkval || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""),
|
1408
|
+
setTimeout(function() {
|
1409
|
+
$input.trigger("change");
|
1410
|
+
}, 0)), !0;
|
1411
|
+
if (k) {
|
1412
|
+
46 === k && !1 === e.shiftKey && "" !== opts.radixPoint && (k = opts.radixPoint.charCodeAt(0));
|
1413
|
+
var pos = checkval ? {
|
1414
|
+
begin: ndx,
|
1415
|
+
end: ndx
|
1416
|
+
} : caret(input), forwardPosition, c = String.fromCharCode(k);
|
1417
|
+
maskset.writeOutBuffer = !0;
|
1418
|
+
var valResult = isValid(pos, c, strict);
|
1419
|
+
if (!1 !== valResult && (resetMaskSet(!0), forwardPosition = void 0 !== valResult.caret ? valResult.caret : seekNext(valResult.pos.begin ? valResult.pos.begin : valResult.pos),
|
1420
|
+
maskset.p = forwardPosition), forwardPosition = opts.numericInput && void 0 === valResult.caret ? seekPrevious(forwardPosition) : forwardPosition,
|
1421
|
+
!1 !== writeOut && (setTimeout(function() {
|
1422
|
+
opts.onKeyValidation.call(input, k, valResult, opts);
|
1423
|
+
}, 0), maskset.writeOutBuffer && !1 !== valResult)) {
|
1424
|
+
var buffer = getBuffer();
|
1425
|
+
writeBuffer(input, buffer, forwardPosition, e, !0 !== checkval);
|
1426
|
+
}
|
1427
|
+
if (e.preventDefault(), checkval) return !1 !== valResult && (valResult.forwardPosition = forwardPosition),
|
1428
|
+
valResult;
|
1429
|
+
}
|
1430
|
+
},
|
1431
|
+
pasteEvent: function pasteEvent(e) {
|
1432
|
+
var input = this, ev = e.originalEvent || e, inputValue = this.inputmask._valueGet(!0), caretPos = caret(this), tempValue;
|
1433
|
+
isRTL && (tempValue = caretPos.end, caretPos.end = caretPos.begin, caretPos.begin = tempValue);
|
1434
|
+
var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
|
1435
|
+
if (valueBeforeCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""),
|
1436
|
+
valueAfterCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(caretPos.end).join("") && (valueAfterCaret = ""),
|
1437
|
+
window.clipboardData && window.clipboardData.getData) inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret; else {
|
1438
|
+
if (!ev.clipboardData || !ev.clipboardData.getData) return !0;
|
1439
|
+
inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret;
|
1440
|
+
}
|
1441
|
+
var pasteValue = inputValue;
|
1442
|
+
if ($.isFunction(opts.onBeforePaste)) {
|
1443
|
+
if (pasteValue = opts.onBeforePaste.call(inputmask, inputValue, opts), !1 === pasteValue) return e.preventDefault();
|
1444
|
+
pasteValue || (pasteValue = inputValue);
|
1445
|
+
}
|
1446
|
+
return checkVal(this, !1, !1, pasteValue.toString().split("")), writeBuffer(this, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join("")),
|
1447
|
+
e.preventDefault();
|
1448
|
+
},
|
1449
|
+
inputFallBackEvent: function inputFallBackEvent(e) {
|
1450
|
+
function radixPointHandler(input, inputValue, caretPos) {
|
1451
|
+
return "." === inputValue.charAt(caretPos.begin - 1) && "" !== opts.radixPoint && (inputValue = inputValue.split(""),
|
1452
|
+
inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0), inputValue = inputValue.join("")),
|
1453
|
+
inputValue;
|
1454
|
+
}
|
1455
|
+
function ieMobileHandler(input, inputValue, caretPos) {
|
1456
|
+
if (iemobile) {
|
1457
|
+
var inputChar = inputValue.replace(getBuffer().join(""), "");
|
1458
|
+
if (1 === inputChar.length) {
|
1459
|
+
var iv = inputValue.split("");
|
1460
|
+
iv.splice(caretPos.begin, 0, inputChar), inputValue = iv.join("");
|
1461
|
+
}
|
1462
|
+
}
|
1463
|
+
return inputValue;
|
1464
|
+
}
|
1465
|
+
var input = this, inputValue = input.inputmask._valueGet();
|
1466
|
+
if (getBuffer().join("") !== inputValue) {
|
1467
|
+
var caretPos = caret(input);
|
1468
|
+
if (inputValue = radixPointHandler(input, inputValue, caretPos), inputValue = ieMobileHandler(input, inputValue, caretPos),
|
1469
|
+
getBuffer().join("") !== inputValue) {
|
1470
|
+
var buffer = getBuffer().join(""), offset = !opts.numericInput && inputValue.length > buffer.length ? -1 : 0, frontPart = inputValue.substr(0, caretPos.begin), backPart = inputValue.substr(caretPos.begin), frontBufferPart = buffer.substr(0, caretPos.begin + offset), backBufferPart = buffer.substr(caretPos.begin + offset), selection = caretPos, entries = "", isEntry = !1;
|
1471
|
+
if (frontPart !== frontBufferPart) {
|
1472
|
+
var fpl = (isEntry = frontPart.length >= frontBufferPart.length) ? frontPart.length : frontBufferPart.length, i;
|
1473
|
+
for (i = 0; frontPart.charAt(i) === frontBufferPart.charAt(i) && i < fpl; i++) ;
|
1474
|
+
isEntry && (selection.begin = i - offset, entries += frontPart.slice(i, selection.end));
|
1475
|
+
}
|
1476
|
+
if (backPart !== backBufferPart && (backPart.length > backBufferPart.length ? entries += backPart.slice(0, 1) : backPart.length < backBufferPart.length && (selection.end += backBufferPart.length - backPart.length,
|
1477
|
+
isEntry || "" === opts.radixPoint || "" !== backPart || frontPart.charAt(selection.begin + offset - 1) !== opts.radixPoint || (selection.begin--,
|
1478
|
+
entries = opts.radixPoint))), writeBuffer(input, getBuffer(), {
|
1479
|
+
begin: selection.begin + offset,
|
1480
|
+
end: selection.end + offset
|
1481
|
+
}), 0 < entries.length) $.each(entries.split(""), function(ndx, entry) {
|
1482
|
+
var keypress = new $.Event("keypress");
|
1483
|
+
keypress.which = entry.charCodeAt(0), ignorable = !1, EventHandlers.keypressEvent.call(input, keypress);
|
1484
|
+
}); else {
|
1485
|
+
selection.begin === selection.end - 1 && (selection.begin = seekPrevious(selection.begin + 1),
|
1486
|
+
selection.begin === selection.end - 1 ? caret(input, selection.begin) : caret(input, selection.begin, selection.end));
|
1487
|
+
var keydown = new $.Event("keydown");
|
1488
|
+
keydown.keyCode = opts.numericInput ? Inputmask.keyCode.BACKSPACE : Inputmask.keyCode.DELETE,
|
1489
|
+
EventHandlers.keydownEvent.call(input, keydown);
|
1490
|
+
}
|
1491
|
+
e.preventDefault();
|
1492
|
+
}
|
1493
|
+
}
|
1494
|
+
},
|
1495
|
+
beforeInputEvent: function beforeInputEvent(e) {
|
1496
|
+
if (e.cancelable) {
|
1497
|
+
var input = this, keydown, keypress;
|
1498
|
+
switch (e.inputType) {
|
1499
|
+
case "insertText":
|
1500
|
+
return $.each(e.data.split(""), function(ndx, entry) {
|
1501
|
+
keypress = new $.Event("keypress"), keypress.which = entry.charCodeAt(0), ignorable = !1,
|
1502
|
+
EventHandlers.keypressEvent.call(input, keypress);
|
1503
|
+
}), e.preventDefault();
|
1504
|
+
|
1505
|
+
case "deleteContentBackward":
|
1506
|
+
return keydown = new $.Event("keydown"), keydown.keyCode = Inputmask.keyCode.BACKSPACE,
|
1507
|
+
EventHandlers.keydownEvent.call(input, keydown), e.preventDefault();
|
1508
|
+
|
1509
|
+
case "deleteContentForward":
|
1510
|
+
return keydown = new $.Event("keydown"), keydown.keyCode = Inputmask.keyCode.DELETE,
|
1511
|
+
EventHandlers.keydownEvent.call(input, keydown), e.preventDefault();
|
1512
|
+
}
|
1513
|
+
}
|
1514
|
+
},
|
1515
|
+
setValueEvent: function setValueEvent(e) {
|
1516
|
+
var input = this, value = e && e.detail ? e.detail[0] : arguments[1];
|
1517
|
+
value = value || this.inputmask._valueGet(!0), applyInputValue(this, value), (e.detail && void 0 !== e.detail[1] || void 0 !== arguments[2]) && caret(this, e.detail ? e.detail[1] : arguments[2]);
|
1518
|
+
},
|
1519
|
+
focusEvent: function focusEvent(e) {
|
1520
|
+
var input = this, nptValue = this.inputmask._valueGet();
|
1521
|
+
console.log(nptValue), opts.showMaskOnFocus && (nptValue !== getBuffer().join("") ? writeBuffer(this, getBuffer(), seekNext(getLastValidPosition())) : !1 === mouseEnter && caret(this, seekNext(getLastValidPosition()))),
|
1522
|
+
!0 === opts.positionCaretOnTab && !1 === mouseEnter && EventHandlers.clickEvent.apply(this, [ e, !0 ]),
|
1523
|
+
undoValue = getBuffer().join("");
|
1524
|
+
},
|
1525
|
+
mouseleaveEvent: function mouseleaveEvent() {
|
1526
|
+
var input = this;
|
1527
|
+
mouseEnter = !1, opts.clearMaskOnLostFocus && document.activeElement !== this && HandleNativePlaceholder(this, originalPlaceholder);
|
1528
|
+
},
|
1529
|
+
clickEvent: function clickEvent(e, tabbed) {
|
1530
|
+
var input = this;
|
1531
|
+
if (document.activeElement === this) {
|
1532
|
+
var newCaretPosition = determineNewCaretPosition(caret(this), tabbed);
|
1533
|
+
void 0 !== newCaretPosition && caret(this, newCaretPosition);
|
1534
|
+
}
|
1535
|
+
},
|
1536
|
+
cutEvent: function cutEvent(e) {
|
1537
|
+
var input = this, pos = caret(this), ev = e.originalEvent || e, clipboardData = window.clipboardData || ev.clipboardData, clipData = isRTL ? getBuffer().slice(pos.end, pos.begin) : getBuffer().slice(pos.begin, pos.end);
|
1538
|
+
clipboardData.setData("text", isRTL ? clipData.reverse().join("") : clipData.join("")),
|
1539
|
+
document.execCommand && document.execCommand("copy"), handleRemove(this, Inputmask.keyCode.DELETE, pos),
|
1540
|
+
writeBuffer(this, getBuffer(), maskset.p, e, undoValue !== getBuffer().join(""));
|
1541
|
+
},
|
1542
|
+
blurEvent: function blurEvent(e) {
|
1543
|
+
var $input = $(this), input = this;
|
1544
|
+
if (this.inputmask) {
|
1545
|
+
HandleNativePlaceholder(this, originalPlaceholder);
|
1546
|
+
var nptValue = this.inputmask._valueGet(), buffer = getBuffer().slice();
|
1547
|
+
"" === nptValue && void 0 === colorMask || (opts.clearMaskOnLostFocus && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)),
|
1548
|
+
!1 === isComplete(buffer) && (setTimeout(function() {
|
1549
|
+
$input.trigger("incomplete");
|
1550
|
+
}, 0), opts.clearIncomplete && (resetMaskSet(), buffer = opts.clearMaskOnLostFocus ? [] : getBufferTemplate().slice())),
|
1551
|
+
writeBuffer(this, buffer, void 0, e)), undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""),
|
1552
|
+
$input.trigger("change"));
|
1553
|
+
}
|
1554
|
+
},
|
1555
|
+
mouseenterEvent: function mouseenterEvent() {
|
1556
|
+
var input = this;
|
1557
|
+
mouseEnter = !0, document.activeElement !== this && (this.placeholder !== originalPlaceholder && (originalPlaceholder = this.placeholder),
|
1558
|
+
opts.showMaskOnHover && HandleNativePlaceholder(this, (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("")));
|
1559
|
+
},
|
1560
|
+
submitEvent: function submitEvent() {
|
1561
|
+
undoValue !== getBuffer().join("") && $el.trigger("change"), opts.clearMaskOnLostFocus && -1 === getLastValidPosition() && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("") && el.inputmask._valueSet(""),
|
1562
|
+
opts.clearIncomplete && !1 === isComplete(getBuffer()) && el.inputmask._valueSet(""),
|
1563
|
+
opts.removeMaskOnSubmit && (el.inputmask._valueSet(el.inputmask.unmaskedvalue(), !0),
|
1564
|
+
setTimeout(function() {
|
1565
|
+
writeBuffer(el, getBuffer());
|
1566
|
+
}, 0));
|
1567
|
+
},
|
1568
|
+
resetEvent: function resetEvent() {
|
1569
|
+
el.inputmask.refreshValue = !0, setTimeout(function() {
|
1570
|
+
applyInputValue(el, el.inputmask._valueGet(!0));
|
1571
|
+
}, 0);
|
1572
|
+
}
|
1573
|
+
}, valueBuffer;
|
1574
|
+
function checkVal(input, writeOut, strict, nptvl, initiatingEvent) {
|
1575
|
+
var inputmask = this || input.inputmask, inputValue = nptvl.slice(), charCodes = "", initialNdx = -1, result = void 0;
|
1576
|
+
function isTemplateMatch(ndx, charCodes) {
|
1577
|
+
if (opts.regex) return !1;
|
1578
|
+
for (var targetTemplate = getMaskTemplate(!0, 0, !1).slice(ndx, seekNext(ndx)).join("").replace(/'/g, ""), charCodeNdx = targetTemplate.indexOf(charCodes); 0 < charCodeNdx && " " === targetTemplate[charCodeNdx - 1]; ) charCodeNdx--;
|
1579
|
+
var match = 0 === charCodeNdx && !isMask(ndx) && (getTest(ndx).match.nativeDef === charCodes.charAt(0) || !0 === getTest(ndx).match.static && getTest(ndx).match.nativeDef === "'" + charCodes.charAt(0) || " " === getTest(ndx).match.nativeDef && (getTest(ndx + 1).match.nativeDef === charCodes.charAt(0) || !0 === getTest(ndx + 1).match.static && getTest(ndx + 1).match.nativeDef === "'" + charCodes.charAt(0)));
|
1580
|
+
return !match && 0 < charCodeNdx && (inputmask.caretPos = {
|
1581
|
+
begin: seekNext(charCodeNdx)
|
1582
|
+
}), match;
|
1583
|
+
}
|
1584
|
+
resetMaskSet(), initialNdx = opts.radixPoint ? determineNewCaretPosition(0) : 0,
|
1585
|
+
maskset.p = initialNdx, inputmask.caretPos = {
|
1586
|
+
begin: initialNdx
|
1587
|
+
};
|
1588
|
+
var staticMatches = [], prevCaretPos = inputmask.caretPos, sndx, validPos, nextValid;
|
1589
|
+
if ($.each(inputValue, function(ndx, charCode) {
|
1590
|
+
if (void 0 !== charCode) if (void 0 === maskset.validPositions[ndx] && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, void 0, void 0, !0)) maskset.p++; else {
|
1591
|
+
var keypress = new $.Event("_checkval");
|
1592
|
+
keypress.which = charCode.charCodeAt(0), charCodes += charCode;
|
1593
|
+
var lvp = getLastValidPosition(void 0, !0);
|
1594
|
+
isTemplateMatch(initialNdx, charCodes) ? result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, lvp + 1) : (result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, inputmask.caretPos.begin),
|
1595
|
+
result && (initialNdx = inputmask.caretPos.begin + 1, charCodes = "")), result ? (void 0 !== result.pos && maskset.validPositions[result.pos] && !0 === maskset.validPositions[result.pos].match.static && (staticMatches.push(result.pos),
|
1596
|
+
isRTL || (result.forwardPosition = result.pos + 1)), writeBuffer(void 0, getBuffer(), result.forwardPosition, keypress, !1),
|
1597
|
+
inputmask.caretPos = {
|
1598
|
+
begin: result.forwardPosition,
|
1599
|
+
end: result.forwardPosition
|
1600
|
+
}, prevCaretPos = inputmask.caretPos) : inputmask.caretPos = prevCaretPos;
|
1601
|
+
}
|
1602
|
+
}), 0 < staticMatches.length) if (!isComplete(getBuffer()) || staticMatches.length < seekNext(0)) for (;void 0 !== (sndx = staticMatches.pop()); ) {
|
1603
|
+
var keypress = new $.Event("_checkval"), nextSndx = sndx + 1;
|
1604
|
+
for (validPos = maskset.validPositions[sndx], validPos.generatedInput = !0, keypress.which = validPos.input.charCodeAt(0); (nextValid = maskset.validPositions[nextSndx]) && nextValid.input === validPos.input; ) nextSndx++;
|
1605
|
+
result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, nextSndx),
|
1606
|
+
result && void 0 !== result.pos && result.pos !== sndx && maskset.validPositions[result.pos] && !0 === maskset.validPositions[result.pos].match.static && staticMatches.push(result.pos);
|
1607
|
+
} else for (;sndx = staticMatches.pop(); ) validPos = maskset.validPositions[sndx],
|
1608
|
+
validPos && (validPos.generatedInput = !0);
|
1609
|
+
writeOut && writeBuffer(input, getBuffer(), result ? result.forwardPosition : void 0, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type);
|
1610
|
+
}
|
1611
|
+
function unmaskedvalue(input) {
|
1612
|
+
if (input) {
|
1613
|
+
if (void 0 === input.inputmask) return input.value;
|
1614
|
+
input.inputmask && input.inputmask.refreshValue && applyInputValue(input, input.inputmask._valueGet(!0));
|
1615
|
+
}
|
1616
|
+
var umValue = [], vps = maskset.validPositions;
|
1617
|
+
for (var pndx in vps) vps[pndx] && vps[pndx].match && 1 != vps[pndx].match.static && umValue.push(vps[pndx].input);
|
1618
|
+
var unmaskedValue = 0 === umValue.length ? "" : (isRTL ? umValue.reverse() : umValue).join("");
|
1619
|
+
if ($.isFunction(opts.onUnMask)) {
|
1620
|
+
var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
|
1621
|
+
unmaskedValue = opts.onUnMask.call(inputmask, bufferValue, unmaskedValue, opts);
|
1622
|
+
}
|
1623
|
+
return unmaskedValue;
|
1624
|
+
}
|
1625
|
+
function caret(input, begin, end, notranslate) {
|
1626
|
+
function translatePosition(pos) {
|
1627
|
+
return !isRTL || "number" != typeof pos || opts.greedy && "" === opts.placeholder || !el || (pos = el.inputmask._valueGet().length - pos),
|
1628
|
+
pos;
|
1629
|
+
}
|
1630
|
+
var range;
|
1631
|
+
if (void 0 === begin) return "selectionStart" in input && "selectionEnd" in input ? (begin = input.selectionStart,
|
1632
|
+
end = input.selectionEnd) : window.getSelection ? (range = window.getSelection().getRangeAt(0),
|
1633
|
+
range.commonAncestorContainer.parentNode !== input && range.commonAncestorContainer !== input || (begin = range.startOffset,
|
1634
|
+
end = range.endOffset)) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
|
1635
|
+
begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length),
|
1636
|
+
end = begin + range.text.length), {
|
1637
|
+
begin: notranslate ? begin : translatePosition(begin),
|
1638
|
+
end: notranslate ? end : translatePosition(end)
|
1639
|
+
};
|
1640
|
+
if ($.isArray(begin) && (end = isRTL ? begin[0] : begin[1], begin = isRTL ? begin[1] : begin[0]),
|
1641
|
+
void 0 !== begin.begin && (end = isRTL ? begin.begin : begin.end, begin = isRTL ? begin.end : begin.begin),
|
1642
|
+
"number" == typeof begin) {
|
1643
|
+
begin = notranslate ? begin : translatePosition(begin), end = notranslate ? end : translatePosition(end),
|
1644
|
+
end = "number" == typeof end ? end : begin;
|
1645
|
+
var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end;
|
1646
|
+
if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, input.inputmask.caretPos = {
|
1647
|
+
begin: begin,
|
1648
|
+
end: end
|
1649
|
+
}, input === document.activeElement) {
|
1650
|
+
if ("setSelectionRange" in input) input.setSelectionRange(begin, end); else if (window.getSelection) {
|
1651
|
+
if (range = document.createRange(), void 0 === input.firstChild || null === input.firstChild) {
|
1652
|
+
var textNode = document.createTextNode("");
|
1653
|
+
input.appendChild(textNode);
|
1654
|
+
}
|
1655
|
+
range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length),
|
1656
|
+
range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length),
|
1657
|
+
range.collapse(!0);
|
1658
|
+
var sel = window.getSelection();
|
1659
|
+
sel.removeAllRanges(), sel.addRange(range);
|
1660
|
+
} else input.createTextRange && (range = input.createTextRange(), range.collapse(!0),
|
1661
|
+
range.moveEnd("character", end), range.moveStart("character", begin), range.select());
|
1662
|
+
renderColorMask(input, {
|
1663
|
+
begin: begin,
|
1664
|
+
end: end
|
1665
|
+
});
|
1666
|
+
}
|
1667
|
+
}
|
1668
|
+
}
|
1669
|
+
function determineLastRequiredPosition(returnDefinition) {
|
1670
|
+
var buffer = getMaskTemplate(!0, getLastValidPosition(), !0, !0), bl = buffer.length, pos, lvp = getLastValidPosition(), positions = {}, lvTest = maskset.validPositions[lvp], ndxIntlzr = void 0 !== lvTest ? lvTest.locator.slice() : void 0, testPos;
|
1671
|
+
for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
1672
|
+
ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos);
|
1673
|
+
var lvTestAlt = lvTest && void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation] : void 0;
|
1674
|
+
for (pos = bl - 1; lvp < pos && (testPos = positions[pos], (testPos.match.optionality || testPos.match.optionalQuantifier && testPos.match.newBlockMarker || lvTestAlt && (lvTestAlt !== positions[pos].locator[lvTest.alternation] && 1 != testPos.match.static || !0 === testPos.match.static && 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--;
|
1675
|
+
return returnDefinition ? {
|
1676
|
+
l: bl,
|
1677
|
+
def: positions[bl] ? positions[bl].match : void 0
|
1678
|
+
} : bl;
|
1679
|
+
}
|
1680
|
+
function clearOptionalTail(buffer) {
|
1681
|
+
buffer.length = 0;
|
1682
|
+
for (var template = getMaskTemplate(!0, 0, !0, void 0, !0), lmnt; void 0 !== (lmnt = template.shift()); ) buffer.push(lmnt);
|
1683
|
+
return buffer;
|
1684
|
+
}
|
1685
|
+
function isComplete(buffer) {
|
1686
|
+
if ($.isFunction(opts.isComplete)) return opts.isComplete(buffer, opts);
|
1687
|
+
if ("*" !== opts.repeat) {
|
1688
|
+
var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l);
|
1689
|
+
if (void 0 === lrp.def || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) {
|
1690
|
+
complete = !0;
|
1691
|
+
for (var i = 0; i <= aml; i++) {
|
1692
|
+
var test = getTestTemplate(i).match;
|
1693
|
+
if (!0 !== test.static && void 0 === maskset.validPositions[i] && !0 !== test.optionality && !0 !== test.optionalQuantifier || !0 === test.static && buffer[i] !== getPlaceholder(i, test)) {
|
1694
|
+
complete = !1;
|
1695
|
+
break;
|
1696
|
+
}
|
1697
|
+
}
|
1698
|
+
}
|
1699
|
+
return complete;
|
1700
|
+
}
|
1701
|
+
}
|
1702
|
+
function handleRemove(input, k, pos, strict, fromIsValid) {
|
1703
|
+
if ((opts.numericInput || isRTL) && (k === Inputmask.keyCode.BACKSPACE ? k = Inputmask.keyCode.DELETE : k === Inputmask.keyCode.DELETE && (k = Inputmask.keyCode.BACKSPACE),
|
1704
|
+
isRTL)) {
|
1705
|
+
var pend = pos.end;
|
1706
|
+
pos.end = pos.begin, pos.begin = pend;
|
1707
|
+
}
|
1708
|
+
if (k === Inputmask.keyCode.BACKSPACE && pos.end - pos.begin < 1 ? (pos.begin = seekPrevious(pos.begin),
|
1709
|
+
void 0 !== maskset.validPositions[pos.begin] && maskset.validPositions[pos.begin].input === opts.groupSeparator && pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end, !0) && maskset.validPositions[pos.end] && maskset.validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1,
|
1710
|
+
void 0 !== maskset.validPositions[pos.begin] && maskset.validPositions[pos.begin].input === opts.groupSeparator && pos.end++),
|
1711
|
+
revalidateMask(pos), !0 !== strict && !1 !== opts.keepStatic || null !== opts.regex) {
|
1712
|
+
var result = alternate(!0);
|
1713
|
+
if (result) {
|
1714
|
+
var newPos = void 0 !== result.caret ? result.caret : result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, !0);
|
1715
|
+
(k !== Inputmask.keyCode.DELETE || pos.begin > newPos) && pos.begin;
|
1716
|
+
}
|
1717
|
+
}
|
1718
|
+
var lvp = getLastValidPosition(pos.begin, !0);
|
1719
|
+
if (lvp < pos.begin || -1 === pos.begin) maskset.p = seekNext(lvp); else if (!0 !== strict && (maskset.p = pos.begin,
|
1720
|
+
!0 !== fromIsValid)) for (;maskset.p < lvp && void 0 === maskset.validPositions[maskset.p]; ) maskset.p++;
|
1721
|
+
}
|
1722
|
+
function initializeColorMask(input) {
|
1723
|
+
var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
|
1724
|
+
function findCaretPos(clientx) {
|
1725
|
+
var e = document.createElement("span"), caretPos;
|
1726
|
+
for (var style in computedStyle) isNaN(style) && -1 !== style.indexOf("font") && (e.style[style] = computedStyle[style]);
|
1727
|
+
e.style.textTransform = computedStyle.textTransform, e.style.letterSpacing = computedStyle.letterSpacing,
|
1728
|
+
e.style.position = "absolute", e.style.height = "auto", e.style.width = "auto",
|
1729
|
+
e.style.visibility = "hidden", e.style.whiteSpace = "nowrap", document.body.appendChild(e);
|
1730
|
+
var inputText = input.inputmask._valueGet(), previousWidth = 0, itl;
|
1731
|
+
for (caretPos = 0, itl = inputText.length; caretPos <= itl; caretPos++) {
|
1732
|
+
if (e.innerHTML += inputText.charAt(caretPos) || "_", e.offsetWidth >= clientx) {
|
1733
|
+
var offset1 = clientx - previousWidth, offset2 = e.offsetWidth - clientx;
|
1734
|
+
e.innerHTML = inputText.charAt(caretPos), offset1 -= e.offsetWidth / 3, caretPos = offset1 < offset2 ? caretPos - 1 : caretPos;
|
1735
|
+
break;
|
1736
|
+
}
|
1737
|
+
previousWidth = e.offsetWidth;
|
1738
|
+
}
|
1739
|
+
return document.body.removeChild(e), caretPos;
|
1740
|
+
}
|
1741
|
+
var template = document.createElement("div");
|
1742
|
+
template.style.width = computedStyle.width, template.style.textAlign = computedStyle.textAlign,
|
1743
|
+
colorMask = document.createElement("div"), input.inputmask.colorMask = colorMask,
|
1744
|
+
colorMask.className = "im-colormask", input.parentNode.insertBefore(colorMask, input),
|
1745
|
+
input.parentNode.removeChild(input), colorMask.appendChild(input), colorMask.appendChild(template),
|
1746
|
+
input.style.left = template.offsetLeft + "px", $(colorMask).on("mouseleave", function(e) {
|
1747
|
+
return EventHandlers.mouseleaveEvent.call(input, [ e ]);
|
1748
|
+
}), $(colorMask).on("mouseenter", function(e) {
|
1749
|
+
return EventHandlers.mouseenterEvent.call(input, [ e ]);
|
1750
|
+
}), $(colorMask).on("click", function(e) {
|
1751
|
+
return caret(input, findCaretPos(e.clientX)), EventHandlers.clickEvent.call(input, [ e ]);
|
1752
|
+
});
|
1753
|
+
}
|
1754
|
+
function renderColorMask(input, caretPos, clear) {
|
1755
|
+
var maskTemplate = [], isStatic = !1, test, testPos, ndxIntlzr, pos = 0;
|
1756
|
+
function setEntry(entry) {
|
1757
|
+
if (void 0 === entry && (entry = ""), isStatic || !0 !== test.static && void 0 !== testPos.input) if (isStatic && (!0 !== test.static && void 0 !== testPos.input || "" === test.def)) {
|
1758
|
+
isStatic = !1;
|
1759
|
+
var mtl = maskTemplate.length;
|
1760
|
+
maskTemplate[mtl - 1] = maskTemplate[mtl - 1] + "</span>", maskTemplate.push(entry);
|
1761
|
+
} else maskTemplate.push(entry); else isStatic = !0, maskTemplate.push("<span class='im-static'>" + entry);
|
1762
|
+
}
|
1763
|
+
function setCaret() {
|
1764
|
+
document.activeElement === input && (maskTemplate.splice(caretPos.begin, 0, caretPos.begin === caretPos.end || caretPos.end > maskset.maskLength ? '<mark class="im-caret" style="border-right-width: 1px;border-right-style: solid;">' : '<mark class="im-caret-select">'),
|
1765
|
+
maskTemplate.splice(caretPos.end + 1, 0, "</mark>"));
|
1766
|
+
}
|
1767
|
+
if (void 0 !== colorMask) {
|
1768
|
+
var buffer = getBuffer();
|
1769
|
+
if (void 0 === caretPos ? caretPos = caret(input) : void 0 === caretPos.begin && (caretPos = {
|
1770
|
+
begin: caretPos,
|
1771
|
+
end: caretPos
|
1772
|
+
}), !0 !== clear) {
|
1773
|
+
for (var lvp = getLastValidPosition(); maskset.validPositions[pos] ? (testPos = maskset.validPositions[pos],
|
1774
|
+
test = testPos.match, ndxIntlzr = testPos.locator.slice(), setEntry(buffer[pos])) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
1775
|
+
test = testPos.match, ndxIntlzr = testPos.locator.slice(), !1 === opts.jitMasking || pos < lvp || "number" == typeof opts.jitMasking && isFinite(opts.jitMasking) && opts.jitMasking > pos ? setEntry(getPlaceholder(pos, test)) : isStatic = !1),
|
1776
|
+
pos++, (void 0 === maxLength || pos < maxLength) && (!0 !== test.static || "" !== test.def) || pos < lvp || isStatic; ) ;
|
1777
|
+
isStatic && setEntry(), setCaret();
|
1778
|
+
}
|
1779
|
+
var template = colorMask.getElementsByTagName("div")[0];
|
1780
|
+
template.innerHTML = maskTemplate.join(""), input.inputmask.positionColorMask(input, template);
|
1781
|
+
}
|
1782
|
+
}
|
1783
|
+
function applyInputValue(input, value) {
|
1784
|
+
input.inputmask.refreshValue = !1, $.isFunction(opts.onBeforeMask) && (value = opts.onBeforeMask.call(inputmask, value, opts) || value),
|
1785
|
+
value = value.toString().split(""), checkVal(input, !0, !1, value), undoValue = getBuffer().join(""),
|
1786
|
+
(opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && -1 === getLastValidPosition() && input.inputmask._valueSet("");
|
1787
|
+
}
|
1788
|
+
function mask(elem) {
|
1789
|
+
function isElementTypeSupported(input, opts) {
|
1790
|
+
function patchValueProperty(npt) {
|
1791
|
+
var valueGet, valueSet;
|
1792
|
+
function patchValhook(type) {
|
1793
|
+
if ($.valHooks && (void 0 === $.valHooks[type] || !0 !== $.valHooks[type].inputmaskpatch)) {
|
1794
|
+
var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) {
|
1795
|
+
return elem.value;
|
1796
|
+
}, valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) {
|
1797
|
+
return elem.value = value, elem;
|
1798
|
+
};
|
1799
|
+
$.valHooks[type] = {
|
1800
|
+
get: function get(elem) {
|
1801
|
+
if (elem.inputmask) {
|
1802
|
+
if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue();
|
1803
|
+
var result = valhookGet(elem);
|
1804
|
+
return -1 !== getLastValidPosition(void 0, void 0, elem.inputmask.maskset.validPositions) || !0 !== opts.nullable ? result : "";
|
1805
|
+
}
|
1806
|
+
return valhookGet(elem);
|
1807
|
+
},
|
1808
|
+
set: function set(elem, value) {
|
1809
|
+
var result = valhookSet(elem, value);
|
1810
|
+
return elem.inputmask && applyInputValue(elem, value), result;
|
1811
|
+
},
|
1812
|
+
inputmaskpatch: !0
|
1813
|
+
};
|
1814
|
+
}
|
1815
|
+
}
|
1816
|
+
function getter() {
|
1817
|
+
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);
|
1818
|
+
}
|
1819
|
+
function setter(value) {
|
1820
|
+
valueSet.call(this, value), this.inputmask && applyInputValue(this, value);
|
1821
|
+
}
|
1822
|
+
function installNativeValueSetFallback(npt) {
|
1823
|
+
EventRuler.on(npt, "mouseenter", function() {
|
1824
|
+
var input = this, value = this.inputmask._valueGet(!0);
|
1825
|
+
value !== (isRTL ? getBuffer().reverse() : getBuffer()).join("") && applyInputValue(this, value);
|
1826
|
+
});
|
1827
|
+
}
|
1828
|
+
if (!npt.inputmask.__valueGet) {
|
1829
|
+
if (!0 !== opts.noValuePatching) {
|
1830
|
+
if (Object.getOwnPropertyDescriptor) {
|
1831
|
+
"function" != typeof Object.getPrototypeOf && (Object.getPrototypeOf = "object" === _typeof("test".__proto__) ? function(object) {
|
1832
|
+
return object.__proto__;
|
1833
|
+
} : function(object) {
|
1834
|
+
return object.constructor.prototype;
|
1835
|
+
});
|
1836
|
+
var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : void 0;
|
1837
|
+
valueProperty && valueProperty.get && valueProperty.set ? (valueGet = valueProperty.get,
|
1838
|
+
valueSet = valueProperty.set, Object.defineProperty(npt, "value", {
|
1839
|
+
get: getter,
|
1840
|
+
set: setter,
|
1841
|
+
configurable: !0
|
1842
|
+
})) : "INPUT" !== npt.tagName && (valueGet = function valueGet() {
|
1843
|
+
return this.textContent;
|
1844
|
+
}, valueSet = function valueSet(value) {
|
1845
|
+
this.textContent = value;
|
1846
|
+
}, Object.defineProperty(npt, "value", {
|
1847
|
+
get: getter,
|
1848
|
+
set: setter,
|
1849
|
+
configurable: !0
|
1850
|
+
}));
|
1851
|
+
} else document.__lookupGetter__ && npt.__lookupGetter__("value") && (valueGet = npt.__lookupGetter__("value"),
|
1852
|
+
valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter),
|
1853
|
+
npt.__defineSetter__("value", setter));
|
1854
|
+
npt.inputmask.__valueGet = valueGet, npt.inputmask.__valueSet = valueSet;
|
1855
|
+
}
|
1856
|
+
npt.inputmask._valueGet = function(overruleRTL) {
|
1857
|
+
return isRTL && !0 !== overruleRTL ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el);
|
1858
|
+
}, npt.inputmask._valueSet = function(value, overruleRTL) {
|
1859
|
+
valueSet.call(this.el, null == value ? "" : !0 !== overruleRTL && isRTL ? value.split("").reverse().join("") : value);
|
1860
|
+
}, void 0 === valueGet && (valueGet = function valueGet() {
|
1861
|
+
return this.value;
|
1862
|
+
}, valueSet = function valueSet(value) {
|
1863
|
+
this.value = value;
|
1864
|
+
}, patchValhook(npt.type), installNativeValueSetFallback(npt));
|
1865
|
+
}
|
1866
|
+
}
|
1867
|
+
var elementType = input.getAttribute("type"), isSupported = "INPUT" === input.tagName && -1 !== $.inArray(elementType, opts.supportsInputType) || input.isContentEditable || "TEXTAREA" === input.tagName;
|
1868
|
+
if (!isSupported) if ("INPUT" === input.tagName) {
|
1869
|
+
var el = document.createElement("input");
|
1870
|
+
el.setAttribute("type", elementType), isSupported = "text" === el.type, el = null;
|
1871
|
+
} else isSupported = "partial";
|
1872
|
+
return !1 !== isSupported ? patchValueProperty(input) : input.inputmask = void 0,
|
1873
|
+
isSupported;
|
1874
|
+
}
|
1875
|
+
EventRuler.off(elem);
|
1876
|
+
var isSupported = isElementTypeSupported(elem, opts);
|
1877
|
+
if (!1 !== isSupported && (el = elem, $el = $(el), originalPlaceholder = el.placeholder,
|
1878
|
+
maxLength = void 0 !== el ? el.maxLength : void 0, -1 === maxLength && (maxLength = void 0),
|
1879
|
+
!0 === opts.colorMask && initializeColorMask(el), mobile && ("inputmode" in el && (el.inputmode = opts.inputmode,
|
1880
|
+
el.setAttribute("inputmode", opts.inputmode)), !0 === opts.disablePredictiveText && ("autocorrect" in el ? el.autocorrect = !1 : (!0 !== opts.colorMask && initializeColorMask(el),
|
1881
|
+
el.type = "password"))), !0 === isSupported && (el.setAttribute("data-im-insert", opts.insertMode),
|
1882
|
+
EventRuler.on(el, "submit", EventHandlers.submitEvent), EventRuler.on(el, "reset", EventHandlers.resetEvent),
|
1883
|
+
EventRuler.on(el, "blur", EventHandlers.blurEvent), EventRuler.on(el, "focus", EventHandlers.focusEvent),
|
1884
|
+
!0 !== opts.colorMask && (EventRuler.on(el, "click", EventHandlers.clickEvent),
|
1885
|
+
EventRuler.on(el, "mouseleave", EventHandlers.mouseleaveEvent), EventRuler.on(el, "mouseenter", EventHandlers.mouseenterEvent)),
|
1886
|
+
EventRuler.on(el, "paste", EventHandlers.pasteEvent), EventRuler.on(el, "cut", EventHandlers.cutEvent),
|
1887
|
+
EventRuler.on(el, "complete", opts.oncomplete), EventRuler.on(el, "incomplete", opts.onincomplete),
|
1888
|
+
EventRuler.on(el, "cleared", opts.oncleared), mobile || !0 === opts.inputEventOnly ? el.removeAttribute("maxLength") : (EventRuler.on(el, "keydown", EventHandlers.keydownEvent),
|
1889
|
+
EventRuler.on(el, "keypress", EventHandlers.keypressEvent)), EventRuler.on(el, "input", EventHandlers.inputFallBackEvent),
|
1890
|
+
EventRuler.on(el, "beforeinput", EventHandlers.beforeInputEvent)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent),
|
1891
|
+
undoValue = getBufferTemplate().join(""), "" !== el.inputmask._valueGet(!0) || !1 === opts.clearMaskOnLostFocus || document.activeElement === el)) {
|
1892
|
+
applyInputValue(el, el.inputmask._valueGet(!0), opts);
|
1893
|
+
var buffer = getBuffer().slice();
|
1894
|
+
!1 === isComplete(buffer) && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus && document.activeElement !== el && (-1 === getLastValidPosition() ? buffer = [] : clearOptionalTail(buffer)),
|
1895
|
+
(!1 === opts.clearMaskOnLostFocus || opts.showMaskOnFocus && document.activeElement === el || "" !== el.inputmask._valueGet(!0)) && writeBuffer(el, buffer),
|
1896
|
+
document.activeElement === el && caret(el, seekNext(getLastValidPosition()));
|
1897
|
+
}
|
1898
|
+
}
|
1899
|
+
if (void 0 !== actionObj) switch (actionObj.action) {
|
1900
|
+
case "isComplete":
|
1901
|
+
return el = actionObj.el, isComplete(getBuffer());
|
1902
|
+
|
1903
|
+
case "unmaskedvalue":
|
1904
|
+
return void 0 !== el && void 0 === actionObj.value || (valueBuffer = actionObj.value,
|
1905
|
+
valueBuffer = ($.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, valueBuffer, opts) || valueBuffer).split(""),
|
1906
|
+
checkVal.call(this, void 0, !1, !1, valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(inputmask, void 0, getBuffer(), 0, opts)),
|
1907
|
+
unmaskedvalue(el);
|
1908
|
+
|
1909
|
+
case "mask":
|
1910
|
+
mask(el);
|
1911
|
+
break;
|
1912
|
+
|
1913
|
+
case "format":
|
1914
|
+
return valueBuffer = ($.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value).split(""),
|
1915
|
+
checkVal.call(this, void 0, !0, !1, valueBuffer), actionObj.metadata ? {
|
1916
|
+
value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
|
1917
|
+
metadata: maskScope.call(this, {
|
1918
|
+
action: "getmetadata"
|
1919
|
+
}, maskset, opts)
|
1920
|
+
} : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
|
1921
|
+
|
1922
|
+
case "isValid":
|
1923
|
+
actionObj.value ? (valueBuffer = ($.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value).split(""),
|
1924
|
+
checkVal.call(this, void 0, !0, !1, valueBuffer)) : actionObj.value = isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
|
1925
|
+
for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; rl < lmib && !isMask(lmib); lmib--) ;
|
1926
|
+
return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === (isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""));
|
1927
|
+
|
1928
|
+
case "getemptymask":
|
1929
|
+
return getBufferTemplate().join("");
|
1930
|
+
|
1931
|
+
case "remove":
|
1932
|
+
if (el && el.inputmask) {
|
1933
|
+
$.data(el, "_inputmask_opts", null), $el = $(el);
|
1934
|
+
var cv = opts.autoUnmask ? unmaskedvalue(el) : el.inputmask._valueGet(opts.autoUnmask), valueProperty;
|
1935
|
+
cv !== getBufferTemplate().join("") ? el.inputmask._valueSet(cv, opts.autoUnmask) : el.inputmask._valueSet(""),
|
1936
|
+
EventRuler.off(el), el.inputmask.colorMask && (colorMask = el.inputmask.colorMask,
|
1937
|
+
colorMask.removeChild(el), colorMask.parentNode.insertBefore(el, colorMask), colorMask.parentNode.removeChild(colorMask)),
|
1938
|
+
Object.getOwnPropertyDescriptor && Object.getPrototypeOf ? (valueProperty = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value"),
|
1939
|
+
valueProperty && el.inputmask.__valueGet && Object.defineProperty(el, "value", {
|
1940
|
+
get: el.inputmask.__valueGet,
|
1941
|
+
set: el.inputmask.__valueSet,
|
1942
|
+
configurable: !0
|
1943
|
+
})) : document.__lookupGetter__ && el.__lookupGetter__("value") && el.inputmask.__valueGet && (el.__defineGetter__("value", el.inputmask.__valueGet),
|
1944
|
+
el.__defineSetter__("value", el.inputmask.__valueSet)), el.inputmask = void 0;
|
1945
|
+
}
|
1946
|
+
return el;
|
1947
|
+
|
1948
|
+
case "getmetadata":
|
1949
|
+
if ($.isArray(maskset.metadata)) {
|
1950
|
+
var maskTarget = getMaskTemplate(!0, 0, !1).join("");
|
1951
|
+
return $.each(maskset.metadata, function(ndx, mtdt) {
|
1952
|
+
if (mtdt.mask === maskTarget) return maskTarget = mtdt, !1;
|
1953
|
+
}), maskTarget;
|
1954
|
+
}
|
1955
|
+
return maskset.metadata;
|
1956
|
+
}
|
1957
|
+
};
|
1958
|
+
}, function(module, exports, __webpack_require__) {
|
1959
|
+
function _typeof(obj) {
|
1960
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
|
1961
|
+
return typeof obj;
|
1962
|
+
} : function _typeof(obj) {
|
1963
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
1964
|
+
}, _typeof(obj);
|
1965
|
+
}
|
1966
|
+
var Inputmask = __webpack_require__(2), $ = Inputmask.dependencyLib, formatCode = {
|
1967
|
+
d: [ "[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", Date.prototype.getDate ],
|
1968
|
+
dd: [ "0[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", function() {
|
1969
|
+
return pad(Date.prototype.getDate.call(this), 2);
|
1970
|
+
} ],
|
1971
|
+
ddd: [ "" ],
|
1972
|
+
dddd: [ "" ],
|
1973
|
+
m: [ "[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
|
1974
|
+
return Date.prototype.getMonth.call(this) + 1;
|
1975
|
+
} ],
|
1976
|
+
mm: [ "0[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
|
1977
|
+
return pad(Date.prototype.getMonth.call(this) + 1, 2);
|
1978
|
+
} ],
|
1979
|
+
mmm: [ "" ],
|
1980
|
+
mmmm: [ "" ],
|
1981
|
+
yy: [ "[0-9]{2}", Date.prototype.setFullYear, "year", function() {
|
1982
|
+
return pad(Date.prototype.getFullYear.call(this), 2);
|
1983
|
+
} ],
|
1984
|
+
yyyy: [ "[0-9]{4}", Date.prototype.setFullYear, "year", function() {
|
1985
|
+
return pad(Date.prototype.getFullYear.call(this), 4);
|
1986
|
+
} ],
|
1987
|
+
h: [ "[1-9]|1[0-2]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
1988
|
+
hh: [ "0[1-9]|1[0-2]", Date.prototype.setHours, "hours", function() {
|
1989
|
+
return pad(Date.prototype.getHours.call(this), 2);
|
1990
|
+
} ],
|
1991
|
+
hhh: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
1992
|
+
H: [ "1?[0-9]|2[0-3]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
1993
|
+
HH: [ "0[0-9]|1[0-9]|2[0-3]", Date.prototype.setHours, "hours", function() {
|
1994
|
+
return pad(Date.prototype.getHours.call(this), 2);
|
1995
|
+
} ],
|
1996
|
+
HHH: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
1997
|
+
M: [ "[1-5]?[0-9]", Date.prototype.setMinutes, "minutes", Date.prototype.getMinutes ],
|
1998
|
+
MM: [ "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setMinutes, "minutes", function() {
|
1999
|
+
return pad(Date.prototype.getMinutes.call(this), 2);
|
2000
|
+
} ],
|
2001
|
+
s: [ "[1-5]?[0-9]", Date.prototype.setSeconds, "seconds", Date.prototype.getSeconds ],
|
2002
|
+
ss: [ "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setSeconds, "seconds", function() {
|
2003
|
+
return pad(Date.prototype.getSeconds.call(this), 2);
|
2004
|
+
} ],
|
2005
|
+
l: [ "[0-9]{3}", Date.prototype.setMilliseconds, "milliseconds", function() {
|
2006
|
+
return pad(Date.prototype.getMilliseconds.call(this), 3);
|
2007
|
+
} ],
|
2008
|
+
L: [ "[0-9]{2}", Date.prototype.setMilliseconds, "milliseconds", function() {
|
2009
|
+
return pad(Date.prototype.getMilliseconds.call(this), 2);
|
2010
|
+
} ],
|
2011
|
+
t: [ "[ap]" ],
|
2012
|
+
tt: [ "[ap]m" ],
|
2013
|
+
T: [ "[AP]" ],
|
2014
|
+
TT: [ "[AP]M" ],
|
2015
|
+
Z: [ "" ],
|
2016
|
+
o: [ "" ],
|
2017
|
+
S: [ "" ]
|
2018
|
+
}, formatAlias = {
|
2019
|
+
isoDate: "yyyy-mm-dd",
|
2020
|
+
isoTime: "HH:MM:ss",
|
2021
|
+
isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
|
2022
|
+
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
|
2023
|
+
};
|
2024
|
+
function getTokenizer(opts) {
|
2025
|
+
if (!opts.tokenizer) {
|
2026
|
+
var tokens = [];
|
2027
|
+
for (var ndx in formatCode) -1 === tokens.indexOf(ndx[0]) && tokens.push(ndx[0]);
|
2028
|
+
opts.tokenizer = "(" + tokens.join("+|") + ")+?|.", opts.tokenizer = new RegExp(opts.tokenizer, "g");
|
2029
|
+
}
|
2030
|
+
return opts.tokenizer;
|
2031
|
+
}
|
2032
|
+
function isValidDate(dateParts, currentResult) {
|
2033
|
+
return (!isFinite(dateParts.rawday) || "29" == dateParts.day && !isFinite(dateParts.rawyear) || new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day) && currentResult;
|
2034
|
+
}
|
2035
|
+
function isDateInRange(dateParts, opts) {
|
2036
|
+
var result = !0;
|
2037
|
+
if (opts.min) {
|
2038
|
+
if (dateParts.rawyear) {
|
2039
|
+
var rawYear = dateParts.rawyear.replace(/[^0-9]/g, ""), minYear = opts.min.year.substr(0, rawYear.length);
|
2040
|
+
result = minYear <= rawYear;
|
2041
|
+
}
|
2042
|
+
dateParts.year === dateParts.rawyear && opts.min.date.getTime() == opts.min.date.getTime() && (result = opts.min.date.getTime() <= dateParts.date.getTime());
|
2043
|
+
}
|
2044
|
+
return result && opts.max && opts.max.date.getTime() == opts.max.date.getTime() && (result = opts.max.date.getTime() >= dateParts.date.getTime()),
|
2045
|
+
result;
|
2046
|
+
}
|
2047
|
+
function parse(format, dateObjValue, opts, raw) {
|
2048
|
+
for (var mask = "", match; match = getTokenizer(opts).exec(format); ) if (void 0 === dateObjValue) if (formatCode[match[0]]) mask += "(" + formatCode[match[0]][0] + ")"; else switch (match[0]) {
|
2049
|
+
case "[":
|
2050
|
+
mask += "(";
|
2051
|
+
break;
|
2052
|
+
|
2053
|
+
case "]":
|
2054
|
+
mask += ")?";
|
2055
|
+
break;
|
2056
|
+
|
2057
|
+
default:
|
2058
|
+
mask += Inputmask.escapeRegex(match[0]);
|
2059
|
+
} else if (formatCode[match[0]]) if (!0 !== raw && formatCode[match[0]][3]) {
|
2060
|
+
var getFn = formatCode[match[0]][3];
|
2061
|
+
mask += getFn.call(dateObjValue.date);
|
2062
|
+
} else formatCode[match[0]][2] ? mask += dateObjValue["raw" + formatCode[match[0]][2]] : mask += match[0]; else mask += match[0];
|
2063
|
+
return mask;
|
2064
|
+
}
|
2065
|
+
function pad(val, len) {
|
2066
|
+
for (val = String(val), len = len || 2; val.length < len; ) val = "0" + val;
|
2067
|
+
return val;
|
2068
|
+
}
|
2069
|
+
function analyseMask(maskString, format, opts) {
|
2070
|
+
var dateObj = {
|
2071
|
+
date: new Date(1, 0, 1)
|
2072
|
+
}, targetProp, mask = maskString, match, dateOperation;
|
2073
|
+
function extendProperty(value) {
|
2074
|
+
var correctedValue = value.replace(/[^0-9]/g, "0");
|
2075
|
+
return correctedValue;
|
2076
|
+
}
|
2077
|
+
function setValue(dateObj, value, opts) {
|
2078
|
+
dateObj[targetProp] = extendProperty(value), dateObj["raw" + targetProp] = value,
|
2079
|
+
void 0 !== dateOperation && dateOperation.call(dateObj.date, "month" == targetProp ? parseInt(dateObj[targetProp]) - 1 : dateObj[targetProp]);
|
2080
|
+
}
|
2081
|
+
if ("string" == typeof mask) {
|
2082
|
+
for (;match = getTokenizer(opts).exec(format); ) {
|
2083
|
+
var value = mask.slice(0, match[0].length);
|
2084
|
+
formatCode.hasOwnProperty(match[0]) && (targetProp = formatCode[match[0]][2], dateOperation = formatCode[match[0]][1],
|
2085
|
+
setValue(dateObj, value, opts)), mask = mask.slice(value.length);
|
2086
|
+
}
|
2087
|
+
return dateObj;
|
2088
|
+
}
|
2089
|
+
if (mask && "object" === _typeof(mask) && mask.hasOwnProperty("date")) return mask;
|
2090
|
+
}
|
2091
|
+
Inputmask.extendAliases({
|
2092
|
+
datetime: {
|
2093
|
+
mask: function mask(opts) {
|
2094
|
+
return formatCode.S = opts.i18n.ordinalSuffix.join("|"), opts.inputFormat = formatAlias[opts.inputFormat] || opts.inputFormat,
|
2095
|
+
opts.displayFormat = formatAlias[opts.displayFormat] || opts.displayFormat || opts.inputFormat,
|
2096
|
+
opts.outputFormat = formatAlias[opts.outputFormat] || opts.outputFormat || opts.inputFormat,
|
2097
|
+
opts.placeholder = "" !== opts.placeholder ? opts.placeholder : opts.inputFormat.replace(/[[\]]/, ""),
|
2098
|
+
opts.regex = parse(opts.inputFormat, void 0, opts), null;
|
2099
|
+
},
|
2100
|
+
placeholder: "",
|
2101
|
+
inputFormat: "isoDateTime",
|
2102
|
+
displayFormat: void 0,
|
2103
|
+
outputFormat: void 0,
|
2104
|
+
min: null,
|
2105
|
+
max: null,
|
2106
|
+
i18n: {
|
2107
|
+
dayNames: [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ],
|
2108
|
+
monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
|
2109
|
+
ordinalSuffix: [ "st", "nd", "rd", "th" ]
|
2110
|
+
},
|
2111
|
+
preValidation: function preValidation(buffer, pos, c, isSelection, opts, maskset) {
|
2112
|
+
var calcPos = 0, targetMatch, match;
|
2113
|
+
if (isNaN(c) && buffer[pos] !== c) {
|
2114
|
+
for (;match = getTokenizer(opts).exec(opts.inputFormat); ) if (calcPos += match[0].length,
|
2115
|
+
pos <= calcPos) {
|
2116
|
+
targetMatch = match, match = getTokenizer(opts).exec(opts.inputFormat);
|
2117
|
+
break;
|
2118
|
+
}
|
2119
|
+
if (match && match[0] === c && 1 < targetMatch[0].length) return buffer[pos] = buffer[pos - 1],
|
2120
|
+
buffer[pos - 1] = "0", {
|
2121
|
+
fuzzy: !0,
|
2122
|
+
buffer: buffer,
|
2123
|
+
refreshFromBuffer: {
|
2124
|
+
start: pos - 1,
|
2125
|
+
end: pos + 1
|
2126
|
+
},
|
2127
|
+
pos: pos + 1
|
2128
|
+
};
|
2129
|
+
}
|
2130
|
+
return !0;
|
2131
|
+
},
|
2132
|
+
postValidation: function postValidation(buffer, pos, currentResult, opts) {
|
2133
|
+
opts.min = analyseMask(opts.min, opts.inputFormat, opts), opts.max = analyseMask(opts.max, opts.inputFormat, opts),
|
2134
|
+
currentResult.fuzzy && (buffer = currentResult.buffer, pos = currentResult.pos);
|
2135
|
+
var result = currentResult, dateParts = analyseMask(buffer.join(""), opts.inputFormat, opts);
|
2136
|
+
return result && dateParts.date.getTime() == dateParts.date.getTime() && (result = isValidDate(dateParts, result),
|
2137
|
+
result = result && isDateInRange(dateParts, opts)), pos && result && currentResult.pos !== pos ? {
|
2138
|
+
buffer: parse(opts.inputFormat, dateParts, opts),
|
2139
|
+
refreshFromBuffer: {
|
2140
|
+
start: pos,
|
2141
|
+
end: currentResult.pos
|
2142
|
+
}
|
2143
|
+
} : result;
|
2144
|
+
},
|
2145
|
+
onKeyDown: function onKeyDown(e, buffer, caretPos, opts) {
|
2146
|
+
var input = this;
|
2147
|
+
if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
|
2148
|
+
for (var today = new Date(), match, date = ""; match = getTokenizer(opts).exec(opts.inputFormat); ) "d" === match[0].charAt(0) ? date += pad(today.getDate(), match[0].length) : "m" === match[0].charAt(0) ? date += pad(today.getMonth() + 1, match[0].length) : "yyyy" === match[0] ? date += today.getFullYear().toString() : "y" === match[0].charAt(0) && (date += pad(today.getYear(), match[0].length));
|
2149
|
+
this.inputmask._valueSet(date), $(this).trigger("setvalue");
|
2150
|
+
}
|
2151
|
+
},
|
2152
|
+
onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
|
2153
|
+
return unmaskedValue ? parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, !0) : unmaskedValue;
|
2154
|
+
},
|
2155
|
+
casing: function casing(elem, test, pos, validPositions) {
|
2156
|
+
return 0 == test.nativeDef.indexOf("[ap]") ? elem.toLowerCase() : 0 == test.nativeDef.indexOf("[AP]") ? elem.toUpperCase() : elem;
|
2157
|
+
},
|
2158
|
+
insertMode: !1,
|
2159
|
+
shiftPositions: !1
|
2160
|
+
}
|
2161
|
+
}), module.exports = Inputmask;
|
2162
|
+
}, function(module, exports, __webpack_require__) {
|
2163
|
+
var Inputmask = __webpack_require__(2), $ = Inputmask.dependencyLib;
|
2164
|
+
function autoEscape(txt, opts) {
|
2165
|
+
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);
|
2166
|
+
return escapedTxt;
|
2167
|
+
}
|
2168
|
+
function alignDigits(buffer, digits, opts) {
|
2169
|
+
if (0 < digits && !opts.digitsOptional && 0 < buffer.length) {
|
2170
|
+
var radixPosition = $.inArray(opts.radixPoint, buffer);
|
2171
|
+
-1 === radixPosition && (buffer.push(opts.radixPoint), radixPosition = buffer.length - 1);
|
2172
|
+
for (var i = 1; i <= digits; i++) buffer[radixPosition + i] = buffer[radixPosition + i] || "0";
|
2173
|
+
}
|
2174
|
+
return buffer;
|
2175
|
+
}
|
2176
|
+
function findValidator(symbol, maskset) {
|
2177
|
+
var posNdx = 0;
|
2178
|
+
if ("+" === symbol) {
|
2179
|
+
for (posNdx in maskset.validPositions) ;
|
2180
|
+
posNdx = parseInt(posNdx);
|
2181
|
+
}
|
2182
|
+
for (var tstNdx in maskset.tests) if (tstNdx = parseInt(tstNdx), posNdx <= tstNdx) for (var ndx = 0, ndxl = maskset.tests[tstNdx].length; ndx < ndxl; ndx++) if ((void 0 === maskset.validPositions[tstNdx] || "-" === symbol) && maskset.tests[tstNdx][ndx].match.def === symbol) return tstNdx + (void 0 !== maskset.validPositions[tstNdx] && "-" !== symbol ? 1 : 0);
|
2183
|
+
return posNdx;
|
2184
|
+
}
|
2185
|
+
function findValid(symbol, maskset) {
|
2186
|
+
var ret = -1;
|
2187
|
+
return $.each(maskset.validPositions, function(ndx, tst) {
|
2188
|
+
if (tst.match.def === symbol) return ret = parseInt(ndx), !1;
|
2189
|
+
}), ret;
|
2190
|
+
}
|
2191
|
+
function parseMinMaxOptions(opts) {
|
2192
|
+
void 0 === opts.parseMinMaxOptions && (null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
2193
|
+
"," === opts.radixPoint && (opts.min = opts.min.replace(opts.radixPoint, ".")),
|
2194
|
+
opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN, isNaN(opts.min) && (opts.min = Number.MIN_VALUE)),
|
2195
|
+
null !== opts.max && (opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
2196
|
+
"," === opts.radixPoint && (opts.max = opts.max.replace(opts.radixPoint, ".")),
|
2197
|
+
opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN, isNaN(opts.max) && (opts.max = Number.MAX_VALUE)),
|
2198
|
+
opts.parseMinMaxOptions = "done");
|
2199
|
+
}
|
2200
|
+
function genMask(opts) {
|
2201
|
+
opts.repeat = 0, opts.groupSeparator === opts.radixPoint && opts.digits && "0" !== opts.digits && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""),
|
2202
|
+
" " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), 1 < opts.placeholder.length && (opts.placeholder = opts.placeholder.charAt(0)),
|
2203
|
+
"radixFocus" === opts.positionCaretOnClick && "" === opts.placeholder && (opts.positionCaretOnClick = "lvp");
|
2204
|
+
var decimalDef = "0";
|
2205
|
+
!0 === opts.numericInput && void 0 === opts.__financeInput ? (decimalDef = "1",
|
2206
|
+
opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick,
|
2207
|
+
isNaN(opts.digits) && (opts.digits = 2), opts._radixDance = !1) : (opts.__financeInput = !1,
|
2208
|
+
opts.numericInput = !0);
|
2209
|
+
var mask = "[+]", altMask;
|
2210
|
+
if (mask += autoEscape(opts.prefix, opts), "" !== opts.groupSeparator ? mask += opts._mask(opts) : mask += "9{+}",
|
2211
|
+
void 0 !== opts.digits) {
|
2212
|
+
var dq = opts.digits.toString().split(",");
|
2213
|
+
isFinite(dq[0]) && dq[1] && isFinite(dq[1]) ? mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}" : (isNaN(opts.digits) || 0 < parseInt(opts.digits)) && (opts.digitsOptional ? (altMask = mask + opts.radixPoint + decimalDef + "{0," + opts.digits + "}",
|
2214
|
+
opts.keepStatic = !0) : mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}");
|
2215
|
+
}
|
2216
|
+
return mask += autoEscape(opts.suffix, opts), mask += "[-]", altMask && (mask = [ altMask + autoEscape(opts.suffix, opts) + "[-]", mask ]),
|
2217
|
+
opts.greedy = !1, parseMinMaxOptions(opts), mask;
|
2218
|
+
}
|
2219
|
+
function hanndleRadixDance(pos, c, radixPos, opts) {
|
2220
|
+
return opts._radixDance && opts.numericInput && c !== opts.negationSymbol.back && pos <= radixPos && (0 < radixPos || c == opts.radixPoint) && (pos -= 1),
|
2221
|
+
pos;
|
2222
|
+
}
|
2223
|
+
function decimalValidator(chrs, maskset, pos, strict, opts) {
|
2224
|
+
var radixPos = maskset.buffer.indexOf(opts.radixPoint), result = -1 !== radixPos && new RegExp("[0-9\uff11-\uff19]").test(chrs);
|
2225
|
+
return opts._radixDance && result && null == maskset.validPositions[radixPos] ? {
|
2226
|
+
insert: {
|
2227
|
+
pos: radixPos === pos ? radixPos + 1 : radixPos,
|
2228
|
+
c: opts.radixPoint
|
2229
|
+
},
|
2230
|
+
pos: pos
|
2231
|
+
} : result;
|
2232
|
+
}
|
2233
|
+
Inputmask.extendAliases({
|
2234
|
+
numeric: {
|
2235
|
+
mask: genMask,
|
2236
|
+
_mask: function _mask(opts) {
|
2237
|
+
return "(" + opts.groupSeparator + "999){+|1}";
|
2238
|
+
},
|
2239
|
+
placeholder: "0",
|
2240
|
+
greedy: !1,
|
2241
|
+
digits: "*",
|
2242
|
+
digitsOptional: !0,
|
2243
|
+
enforceDigitsOnBlur: !1,
|
2244
|
+
radixPoint: ".",
|
2245
|
+
positionCaretOnClick: "radixFocus",
|
2246
|
+
_radixDance: !0,
|
2247
|
+
groupSeparator: "",
|
2248
|
+
allowMinus: !0,
|
2249
|
+
negationSymbol: {
|
2250
|
+
front: "-",
|
2251
|
+
back: ""
|
2252
|
+
},
|
2253
|
+
prefix: "",
|
2254
|
+
suffix: "",
|
2255
|
+
rightAlign: !0,
|
2256
|
+
min: null,
|
2257
|
+
max: null,
|
2258
|
+
step: 1,
|
2259
|
+
insertMode: !0,
|
2260
|
+
autoUnmask: !1,
|
2261
|
+
unmaskAsNumber: !1,
|
2262
|
+
inputmode: "numeric",
|
2263
|
+
definitions: {
|
2264
|
+
0: {
|
2265
|
+
validator: decimalValidator
|
2266
|
+
},
|
2267
|
+
1: {
|
2268
|
+
validator: decimalValidator,
|
2269
|
+
definitionSymbol: "*"
|
2270
|
+
},
|
2271
|
+
"+": {
|
2272
|
+
validator: function validator(chrs, maskset, pos, strict, opts) {
|
2273
|
+
return opts.allowMinus && ("-" === chrs || chrs === opts.negationSymbol.front);
|
2274
|
+
}
|
2275
|
+
},
|
2276
|
+
"-": {
|
2277
|
+
validator: function validator(chrs, maskset, pos, strict, opts) {
|
2278
|
+
return opts.allowMinus && chrs === opts.negationSymbol.back;
|
2279
|
+
}
|
2280
|
+
}
|
2281
|
+
},
|
2282
|
+
preValidation: function preValidation(buffer, pos, c, isSelection, opts, maskset) {
|
2283
|
+
var radixPos = $.inArray(opts.radixPoint, buffer);
|
2284
|
+
if (pos = hanndleRadixDance(pos, c, radixPos, opts), "-" !== c && c !== opts.negationSymbol.front) return -1 !== radixPos && !0 === opts._radixDance && !1 === isSelection && c === opts.radixPoint && void 0 !== opts.digits && (isNaN(opts.digits) || 0 < parseInt(opts.digits)) && radixPos !== pos ? {
|
2285
|
+
caret: opts._radixDance && pos === radixPos - 1 ? radixPos + 1 : radixPos
|
2286
|
+
} : {
|
2287
|
+
rewritePosition: pos
|
2288
|
+
};
|
2289
|
+
if (!0 !== opts.allowMinus) return !1;
|
2290
|
+
var isNegative = !1, front = findValid("+", maskset), back = findValid("-", maskset);
|
2291
|
+
return -1 !== front && (isNegative = [ front, back ]), !1 !== isNegative ? {
|
2292
|
+
remove: isNegative,
|
2293
|
+
caret: pos < radixPos ? pos + 1 : pos
|
2294
|
+
} : {
|
2295
|
+
insert: [ {
|
2296
|
+
pos: findValidator("+", maskset),
|
2297
|
+
c: opts.negationSymbol.front,
|
2298
|
+
fromIsValid: !0
|
2299
|
+
}, {
|
2300
|
+
pos: findValidator("-", maskset),
|
2301
|
+
c: opts.negationSymbol.back,
|
2302
|
+
fromIsValid: void 0
|
2303
|
+
} ],
|
2304
|
+
caret: pos < radixPos ? pos + 1 : pos
|
2305
|
+
};
|
2306
|
+
},
|
2307
|
+
postValidation: function postValidation(buffer, pos, currentResult, opts) {
|
2308
|
+
if (null !== opts.min || null !== opts.max) {
|
2309
|
+
var unmasked = opts.onUnMask(buffer.slice().reverse().join(""), void 0, $.extend({}, opts, {
|
2310
|
+
unmaskAsNumber: !0
|
2311
|
+
}));
|
2312
|
+
if (null !== opts.min && unmasked < opts.min && unmasked.toString().length >= opts.min.toString().length) return !1;
|
2313
|
+
if (null !== opts.max && unmasked > opts.max) return !1;
|
2314
|
+
}
|
2315
|
+
return currentResult;
|
2316
|
+
},
|
2317
|
+
onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
|
2318
|
+
if ("" === unmaskedValue && !0 === opts.nullable) return unmaskedValue;
|
2319
|
+
var processValue = maskedValue.replace(opts.prefix, "");
|
2320
|
+
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
2321
|
+
"" !== opts.placeholder.charAt(0) && (processValue = processValue.replace(new RegExp(opts.placeholder.charAt(0), "g"), "0")),
|
2322
|
+
opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")),
|
2323
|
+
processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"),
|
2324
|
+
processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
|
2325
|
+
Number(processValue)) : processValue;
|
2326
|
+
},
|
2327
|
+
isComplete: function isComplete(buffer, opts) {
|
2328
|
+
var maskedValue = (opts.numericInput ? buffer.slice().reverse() : buffer).join("");
|
2329
|
+
return maskedValue = maskedValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"),
|
2330
|
+
maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
|
2331
|
+
maskedValue = maskedValue.replace(opts.prefix, ""), maskedValue = maskedValue.replace(opts.suffix, ""),
|
2332
|
+
maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator) + "([0-9]{3})", "g"), "$1"),
|
2333
|
+
"," === opts.radixPoint && (maskedValue = maskedValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
|
2334
|
+
isFinite(maskedValue);
|
2335
|
+
},
|
2336
|
+
onBeforeMask: function onBeforeMask(initialValue, opts) {
|
2337
|
+
var radixPoint = opts.radixPoint || ",";
|
2338
|
+
"number" != typeof initialValue && "number" !== opts.inputType || "" === radixPoint || (initialValue = initialValue.toString().replace(".", radixPoint));
|
2339
|
+
var valueParts = initialValue.split(radixPoint), integerPart = valueParts[0].replace(/[^\-0-9]/g, ""), decimalPart = 1 < valueParts.length ? valueParts[1].replace(/[^0-9]/g, "") : "";
|
2340
|
+
initialValue = integerPart + ("" !== decimalPart ? radixPoint + decimalPart : decimalPart);
|
2341
|
+
var digits = 0;
|
2342
|
+
if ("" !== radixPoint && (digits = decimalPart.length, "" !== decimalPart)) {
|
2343
|
+
var digitsFactor = Math.pow(10, digits || 1);
|
2344
|
+
isFinite(opts.digits) && (digits = parseInt(opts.digits), digitsFactor = Math.pow(10, digits)),
|
2345
|
+
initialValue = initialValue.replace(Inputmask.escapeRegex(radixPoint), "."), isFinite(initialValue) && (initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor),
|
2346
|
+
initialValue = initialValue.toString().replace(".", radixPoint);
|
2347
|
+
}
|
2348
|
+
return 0 === opts.digits && -1 !== initialValue.indexOf(Inputmask.escapeRegex(radixPoint)) && (initialValue = initialValue.substring(0, initialValue.indexOf(Inputmask.escapeRegex(radixPoint)))),
|
2349
|
+
alignDigits(initialValue.toString().split(""), digits, opts).join("");
|
2350
|
+
},
|
2351
|
+
onBeforeWrite: function onBeforeWrite(e, buffer, caretPos, opts) {
|
2352
|
+
var result, numberMatches = new RegExp("^" + ("" != opts.negationSymbol.front ? Inputmask.escapeRegex(opts.negationSymbol.front) + "?" : "") + Inputmask.escapeRegex(opts.prefix) + "(?<number>.*)" + Inputmask.escapeRegex(opts.suffix) + ("" != opts.negationSymbol.back ? Inputmask.escapeRegex(opts.negationSymbol.back) + "?" : "") + "$").exec(buffer.slice().reverse().join("")), number = numberMatches ? numberMatches.groups.number : "";
|
2353
|
+
if (0) var newCaretPos, buf, caretNdx, leadingzeroes;
|
2354
|
+
if (e) switch (e.type) {
|
2355
|
+
case "blur":
|
2356
|
+
case "checkval":
|
2357
|
+
"" !== opts.radixPoint && buffer[0] === opts.radixPoint && (result && result.buffer ? result.buffer.shift() : (buffer.shift(),
|
2358
|
+
result = {
|
2359
|
+
refreshFromBuffer: !0,
|
2360
|
+
buffer: buffer
|
2361
|
+
}));
|
2362
|
+
}
|
2363
|
+
return result;
|
2364
|
+
},
|
2365
|
+
onKeyDown: function onKeyDown(e, buffer, caretPos, opts) {
|
2366
|
+
var $input = $(this);
|
2367
|
+
if (e.ctrlKey) switch (e.keyCode) {
|
2368
|
+
case Inputmask.keyCode.UP:
|
2369
|
+
return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)),
|
2370
|
+
$input.trigger("setvalue"), !1;
|
2371
|
+
|
2372
|
+
case Inputmask.keyCode.DOWN:
|
2373
|
+
return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)),
|
2374
|
+
$input.trigger("setvalue"), !1;
|
2375
|
+
}
|
2376
|
+
if ((e.keyCode === Inputmask.keyCode.DELETE || e.keyCode === Inputmask.keyCode.BACKSPACE || e.keyCode === Inputmask.keyCode.BACKSPACE_SAFARI) && !0 === opts._radixDance && !opts.digitsOptional) {
|
2377
|
+
var radixPos = $.inArray(opts.radixPoint, buffer);
|
2378
|
+
if (-1 !== radixPos && (caretPos < radixPos || e.keyCode === Inputmask.keyCode.DELETE && caretPos === radixPos)) {
|
2379
|
+
e.keyCode !== Inputmask.keyCode.BACKSPACE && e.keyCode !== Inputmask.keyCode.BACKSPACE_SAFARI || caretPos++;
|
2380
|
+
var bffr = buffer.slice().reverse();
|
2381
|
+
return bffr.splice(bffr.length - caretPos, 1), $input.trigger("setvalue", [ alignDigits(bffr, opts.digits, opts).join(""), caretPos ]),
|
2382
|
+
!1;
|
2383
|
+
}
|
2384
|
+
}
|
2385
|
+
}
|
2386
|
+
},
|
2387
|
+
currency: {
|
2388
|
+
prefix: "$ ",
|
2389
|
+
groupSeparator: ",",
|
2390
|
+
alias: "numeric",
|
2391
|
+
placeholder: "0",
|
2392
|
+
digits: 2,
|
2393
|
+
digitsOptional: !1
|
2394
|
+
},
|
2395
|
+
decimal: {
|
2396
|
+
alias: "numeric"
|
2397
|
+
},
|
2398
|
+
integer: {
|
2399
|
+
alias: "numeric",
|
2400
|
+
digits: 0
|
2401
|
+
},
|
2402
|
+
percentage: {
|
2403
|
+
alias: "integer",
|
2404
|
+
min: 0,
|
2405
|
+
max: 100,
|
2406
|
+
suffix: " %",
|
2407
|
+
allowMinus: !1
|
2408
|
+
},
|
2409
|
+
indianns: {
|
2410
|
+
alias: "numeric",
|
2411
|
+
_mask: function _mask(opts) {
|
2412
|
+
return "(" + opts.groupSeparator + "99){*|1}(" + opts.groupSeparator + "999){1|1}";
|
2413
|
+
},
|
2414
|
+
groupSeparator: ",",
|
2415
|
+
radixPoint: ".",
|
2416
|
+
placeholder: "0",
|
2417
|
+
digits: 2,
|
2418
|
+
digitsOptional: !1
|
2419
|
+
}
|
2420
|
+
}), module.exports = Inputmask;
|
2421
|
+
} ], installedModules = {}, __webpack_require__.m = modules, __webpack_require__.c = installedModules,
|
2422
|
+
__webpack_require__.d = function(exports, name, getter) {
|
2423
|
+
__webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
|
2424
|
+
enumerable: !0,
|
2425
|
+
get: getter
|
2426
|
+
});
|
2427
|
+
}, __webpack_require__.r = function(exports) {
|
2428
|
+
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
|
2429
|
+
value: "Module"
|
2430
|
+
}), Object.defineProperty(exports, "__esModule", {
|
2431
|
+
value: !0
|
2432
|
+
});
|
2433
|
+
}, __webpack_require__.t = function(value, mode) {
|
2434
|
+
if (1 & mode && (value = __webpack_require__(value)), 8 & mode) return value;
|
2435
|
+
if (4 & mode && "object" == typeof value && value && value.__esModule) return value;
|
2436
|
+
var ns = Object.create(null);
|
2437
|
+
if (__webpack_require__.r(ns), Object.defineProperty(ns, "default", {
|
2438
|
+
enumerable: !0,
|
2439
|
+
value: value
|
2440
|
+
}), 2 & mode && "string" != typeof value) for (var key in value) __webpack_require__.d(ns, key, function(key) {
|
2441
|
+
return value[key];
|
2442
|
+
}.bind(null, key));
|
2443
|
+
return ns;
|
2444
|
+
}, __webpack_require__.n = function(module) {
|
2445
|
+
var getter = module && module.__esModule ? function getDefault() {
|
2446
|
+
return module.default;
|
2447
|
+
} : function getModuleExports() {
|
2448
|
+
return module;
|
2449
|
+
};
|
2450
|
+
return __webpack_require__.d(getter, "a", getter), getter;
|
2451
|
+
}, __webpack_require__.o = function(object, property) {
|
2452
|
+
return Object.prototype.hasOwnProperty.call(object, property);
|
2453
|
+
}, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 0);
|
2454
|
+
function __webpack_require__(moduleId) {
|
2455
|
+
if (installedModules[moduleId]) return installedModules[moduleId].exports;
|
2456
|
+
var module = installedModules[moduleId] = {
|
2457
|
+
i: moduleId,
|
2458
|
+
l: !1,
|
2459
|
+
exports: {}
|
2460
|
+
};
|
2461
|
+
return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
|
2462
|
+
module.l = !0, module.exports;
|
2463
|
+
}
|
2464
|
+
var modules, installedModules;
|
2465
|
+
});
|
2466
|
+
//# sourceMappingURL=inputmask.js.map
|