ソースを参照

error message: Cannot read properties of undefined (reading 'allowMinus') #2642

Robin Herbots 3 年 前
コミット
74a4f74d51

+ 1 - 0
CHANGELOG.md

@@ -14,6 +14,7 @@
 - fix value reversing with noValuePatching & numericInput - #2629
 
 ### Fixed
+- error message: Cannot read properties of undefined (reading 'allowMinus') #2642
 - fix iphone\ios bug for cyrillic keyboard - #2637
 - getemptymask returns a reversed string in 5.x #2605
 - DateTime milliseconds (unmaskedvalue) #2597

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "5.0.8-beta.35",
+  "version": "5.0.8-beta.37",
   "main": [
 	  "./index.js",
     "./css/inputmask.css"

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/inputmask",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-  "version": "5.0.8-beta.35",
+  "version": "5.0.8-beta.37",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

+ 5 - 5
dist/inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2022 Robin Herbots
  * Licensed under the MIT license
- * Version: 5.0.8-beta.35
+ * Version: 5.0.8-beta.37
  */
 !function(e, t) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = t(); else if ("function" == typeof define && define.amd) define([], t); else {
@@ -329,7 +329,7 @@
                     return a;
                 }
                 var f = {
-                    keydownEvent: function(e, t, i, c, u) {
+                    keyEvent: function(e, t, i, c, u) {
                         var p = this.inputmask, d = p.opts, h = p.dependencyLib, v = p.maskset, m = this, g = h(m), k = e.key, y = a.caret.call(p, m), b = d.onKeyDown.call(this, e, a.getBuffer.call(p), y, d);
                         if (void 0 !== b) return b;
                         if (k === n.keys.Backspace || k === n.keys.Delete || r.iphone && k === n.keys.BACKSPACE_SAFARI || e.ctrlKey && k === n.keys.x && !("oncut" in m)) e.preventDefault(), 
@@ -472,7 +472,7 @@
 
                               case "deleteContentBackward":
                                 var v = new o.Event("keydown");
-                                v.key = n.keys.Backspace, f.keydownEvent.call(c, v);
+                                v.key = n.keys.Backspace, f.keyEvent.call(c, v);
                                 break;
 
                               default:
@@ -2341,7 +2341,7 @@
                         o.EventRuler.on(i, "mouseenter", c.EventHandlers.mouseenterEvent), o.EventRuler.on(i, "paste", c.EventHandlers.pasteEvent), 
                         o.EventRuler.on(i, "cut", c.EventHandlers.cutEvent), o.EventRuler.on(i, "complete", t.oncomplete), 
                         o.EventRuler.on(i, "incomplete", t.onincomplete), o.EventRuler.on(i, "cleared", t.oncleared), 
-                        !0 !== t.inputEventOnly && (o.EventRuler.on(i, "keydown", c.EventHandlers.keydownEvent), 
+                        !0 !== t.inputEventOnly && (o.EventRuler.on(i, "keydown", c.EventHandlers.keyEvent), 
                         o.EventRuler.on(i, "keyup", c.EventHandlers.keyupEvent)), (s.mobile || t.inputEventOnly) && i.removeAttribute("maxLength"), 
                         o.EventRuler.on(i, "input", c.EventHandlers.inputFallBackEvent), o.EventRuler.on(i, "compositionend", c.EventHandlers.compositionendEvent)), 
                         o.EventRuler.on(i, "setvalue", c.EventHandlers.setValueEvent), n.getBufferTemplate.call(e).join(""), 
@@ -2997,7 +2997,7 @@
                 }
                 function p(e, t, i) {
                     for (var n = this.maskset, r = !1, o = a.getTests.call(this, e), s = 0; s < o.length; s++) {
-                        if (o[s].match && (o[s].match.nativeDef === t.match[i.shiftPositions ? "def" : "nativeDef"] && (!i.shiftPositions || !t.match.static) || o[s].match.nativeDef === t.match.nativeDef || i.regex && !o[s].match.static && o[s].match.fn.test(t.input))) {
+                        if (o[s].match && (o[s].match.nativeDef === t.match[i.shiftPositions ? "def" : "nativeDef"] && (!i.shiftPositions || !t.match.static) || o[s].match.nativeDef === t.match.nativeDef || i.regex && !o[s].match.static && o[s].match.fn.test(t.input, n, e, !1, i))) {
                             r = !0;
                             break;
                         }

ファイルの差分が大きいため隠しています
+ 2 - 2
dist/inputmask.min.js


+ 5 - 5
dist/jquery.inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2022 Robin Herbots
  * Licensed under the MIT license
- * Version: 5.0.8-beta.35
+ * Version: 5.0.8-beta.37
  */
 !function(e, t) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = t(require("jquery")); else if ("function" == typeof define && define.amd) define([ "jquery" ], t); else {
@@ -208,7 +208,7 @@
                     return a;
                 }
                 var f = {
-                    keydownEvent: function(e, t, i, c, u) {
+                    keyEvent: function(e, t, i, c, u) {
                         var p = this.inputmask, d = p.opts, h = p.dependencyLib, m = p.maskset, v = this, g = h(v), k = e.key, y = a.caret.call(p, v), b = d.onKeyDown.call(this, e, a.getBuffer.call(p), y, d);
                         if (void 0 !== b) return b;
                         if (k === n.keys.Backspace || k === n.keys.Delete || r.iphone && k === n.keys.BACKSPACE_SAFARI || e.ctrlKey && k === n.keys.x && !("oncut" in v)) e.preventDefault(), 
@@ -351,7 +351,7 @@
 
                               case "deleteContentBackward":
                                 var m = new o.Event("keydown");
-                                m.key = n.keys.Backspace, f.keydownEvent.call(c, m);
+                                m.key = n.keys.Backspace, f.keyEvent.call(c, m);
                                 break;
 
                               default:
@@ -2288,7 +2288,7 @@
                         o.EventRuler.on(i, "mouseenter", c.EventHandlers.mouseenterEvent), o.EventRuler.on(i, "paste", c.EventHandlers.pasteEvent), 
                         o.EventRuler.on(i, "cut", c.EventHandlers.cutEvent), o.EventRuler.on(i, "complete", t.oncomplete), 
                         o.EventRuler.on(i, "incomplete", t.onincomplete), o.EventRuler.on(i, "cleared", t.oncleared), 
-                        !0 !== t.inputEventOnly && (o.EventRuler.on(i, "keydown", c.EventHandlers.keydownEvent), 
+                        !0 !== t.inputEventOnly && (o.EventRuler.on(i, "keydown", c.EventHandlers.keyEvent), 
                         o.EventRuler.on(i, "keyup", c.EventHandlers.keyupEvent)), (s.mobile || t.inputEventOnly) && i.removeAttribute("maxLength"), 
                         o.EventRuler.on(i, "input", c.EventHandlers.inputFallBackEvent), o.EventRuler.on(i, "compositionend", c.EventHandlers.compositionendEvent)), 
                         o.EventRuler.on(i, "setvalue", c.EventHandlers.setValueEvent), n.getBufferTemplate.call(e).join(""), 
@@ -2944,7 +2944,7 @@
                 }
                 function p(e, t, i) {
                     for (var n = this.maskset, r = !1, o = a.getTests.call(this, e), s = 0; s < o.length; s++) {
-                        if (o[s].match && (o[s].match.nativeDef === t.match[i.shiftPositions ? "def" : "nativeDef"] && (!i.shiftPositions || !t.match.static) || o[s].match.nativeDef === t.match.nativeDef || i.regex && !o[s].match.static && o[s].match.fn.test(t.input))) {
+                        if (o[s].match && (o[s].match.nativeDef === t.match[i.shiftPositions ? "def" : "nativeDef"] && (!i.shiftPositions || !t.match.static) || o[s].match.nativeDef === t.match.nativeDef || i.regex && !o[s].match.static && o[s].match.fn.test(t.input, n, e, !1, i))) {
                             r = !0;
                             break;
                         }

ファイルの差分が大きいため隠しています
+ 2 - 2
dist/jquery.inputmask.min.js


+ 2 - 2
lib/eventhandlers.js

@@ -16,7 +16,7 @@ import {getPlaceholder, getTest} from "./validation-tests";
 export {EventHandlers};
 
 var EventHandlers = {
-    keydownEvent: function (e, checkval, writeOut, strict, ndx) {
+    keyEvent: function (e, checkval, writeOut, strict, ndx) {
         const inputmask = this.inputmask, opts = inputmask.opts, $ = inputmask.dependencyLib,
             maskset = inputmask.maskset;
 
@@ -337,7 +337,7 @@ var EventHandlers = {
                 case "deleteContentBackward":
                     var keydown = new $.Event("keydown");
                     keydown.key = keys.Backspace;
-                    EventHandlers.keydownEvent.call(input, keydown);
+                    EventHandlers.keyEvent.call(input, keydown);
                     break;
                 default:
                     applyInputValue(input, inputValue);

+ 1 - 1
lib/mask.js

@@ -205,7 +205,7 @@ function mask() {
             EventRuler.on(el, "incomplete", opts.onincomplete);
             EventRuler.on(el, "cleared", opts.oncleared);
             if (opts.inputEventOnly !== true) {
-                EventRuler.on(el, "keydown", EventHandlers.keydownEvent);
+                EventRuler.on(el, "keydown", EventHandlers.keyEvent);
                 // EventRuler.on(el, "keypress", EventHandlers.keypressEvent);
                 EventRuler.on(el, "keyup", EventHandlers.keyupEvent);
             }

+ 2 - 1
lib/validation.js

@@ -488,7 +488,8 @@ function positionCanMatchDefinition(pos, testDefinition, opts) {
     for (var tndx = 0; tndx < tests.length; tndx++) {
         if (tests[tndx].match &&
             ((tests[tndx].match["nativeDef"] === testDefinition.match[opts.shiftPositions ? "def" : "nativeDef"] && (!opts.shiftPositions || !testDefinition.match.static)) ||
-                tests[tndx].match["nativeDef"] === testDefinition.match["nativeDef"] || (opts.regex && !tests[tndx].match.static && tests[tndx].match.fn.test(testDefinition.input)))) {
+                tests[tndx].match["nativeDef"] === testDefinition.match["nativeDef"] ||
+                (opts.regex && !tests[tndx].match.static && tests[tndx].match.fn.test(testDefinition.input, maskset, pos, false, opts)))) {
             valid = true;
             break;
         } else if (tests[tndx].match && tests[tndx].match["def"] === testDefinition.match["nativeDef"]) {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "5.0.8-beta.35",
+  "version": "5.0.8-beta.37",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
   "main": "dist/inputmask.js",
   "files": [