Browse Source

Alias datetime + repeat bug fix #2806

Robin Herbots 1 year ago
parent
commit
81590c7d9c

+ 1 - 0
Changelog.md

@@ -7,6 +7,7 @@
 ### Updates
 
 ### Fixed
+- Alias datetime + repeat bug #2806
 - The inputmask is autocompleted to the min value when deleting the radix point #2773
 
 ## [5.0.9 - 31/05/2024]

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "5.0.10-beta.1",
+  "version": "5.0.10-beta.2",
   "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.10-beta.1",
+  "version": "5.0.10-beta.2",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

+ 15 - 11
dist/colormask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2024 Robin Herbots
  * Licensed under the MIT license
- * Version: 5.0.10-beta.1
+ * Version: 5.0.10-beta.2
  */
 !function(e, t) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = t(); else if ("function" == typeof define && define.amd) define([], t); else {
@@ -853,7 +853,7 @@
                     },
                     setValueEvent: function(e) {
                         var t = this.inputmask, n = t.dependencyLib, i = this, a = e && e.detail ? e.detail[0] : arguments[1];
-                        void 0 === a && (a = i.inputmask._valueGet(!0)), (0, l.applyInputValue)(i, a, new n.Event("input")), 
+                        void 0 === a && (a = i.inputmask._valueGet(!0)), (0, l.applyInputValue)(i, a, new n.Event("input"), void 0 !== (e && e.detail ? e.detail[0] : arguments[1])), 
                         (e.detail && void 0 !== e.detail[1] || void 0 !== arguments[2]) && c.caret.call(t, i, e.detail ? e.detail[1] : arguments[2]);
                     },
                     focusEvent: function(e) {
@@ -1424,10 +1424,14 @@
                 a.default.extendAliases({
                     datetime: {
                         mask: function(e) {
-                            return e.numericInput = !1, y.S = m.ordinalSuffix.join("|"), e.inputFormat = k[e.inputFormat] || e.inputFormat, 
-                            e.displayFormat = k[e.displayFormat] || e.displayFormat || e.inputFormat, e.outputFormat = k[e.outputFormat] || e.outputFormat || e.inputFormat, 
-                            e.regex = O(e.inputFormat, void 0, e), e.min = _(e.min, e.inputFormat, e), e.max = _(e.max, e.inputFormat, e), 
-                            null;
+                            if (e.numericInput = !1, y.S = m.ordinalSuffix.join("|"), e.inputFormat = k[e.inputFormat] || e.inputFormat, 
+                            e.repeat && (e.repeat = parseInt(e.repeat.toString()), e.repeat > 0)) {
+                                for (var t = "", n = 0; n < e.repeat; n++) t += e.inputFormat;
+                                e.inputFormat = t, e.repeat = 0;
+                            }
+                            return e.displayFormat = k[e.displayFormat] || e.displayFormat || e.inputFormat, 
+                            e.outputFormat = k[e.outputFormat] || e.outputFormat || e.inputFormat, e.regex = O(e.inputFormat, void 0, e), 
+                            e.min = _(e.min, e.inputFormat, e), e.max = _(e.max, e.inputFormat, e), null;
                         },
                         placeholder: "",
                         inputFormat: "isoDateTime",
@@ -2103,11 +2107,11 @@
                     return u;
                 }, t.writeBuffer = p;
                 var i = n(845), a = n(30), r = n(839), o = n(711), l = n(215), s = n(713);
-                function c(e, t, n) {
-                    var i = e ? e.inputmask : this, a = i.opts;
-                    e.inputmask.refreshValue = !1, "function" == typeof a.onBeforeMask && (t = a.onBeforeMask.call(i, t, a) || t), 
-                    f(e, !0, !1, t = (t || "").toString().split(""), n), i.undoValue = i._valueGet(!0), 
-                    (a.clearMaskOnLostFocus || a.clearIncomplete) && e.inputmask._valueGet() === o.getBufferTemplate.call(i).join("") && -1 === o.getLastValidPosition.call(i) && e.inputmask._valueSet("");
+                function c(e, t, n, i) {
+                    var a = e ? e.inputmask : this, r = a.opts;
+                    e.inputmask.refreshValue = !1, !0 !== i && "function" == typeof r.onBeforeMask && (t = r.onBeforeMask.call(a, t, r) || t), 
+                    f(e, !0, !1, t = (t || "").toString().split(""), n), a.undoValue = a._valueGet(!0), 
+                    (r.clearMaskOnLostFocus || r.clearIncomplete) && e.inputmask._valueGet() === o.getBufferTemplate.call(a).join("") && -1 === o.getLastValidPosition.call(a) && e.inputmask._valueSet("");
                 }
                 function u(e) {
                     e.length = 0;

File diff suppressed because it is too large
+ 2 - 2
dist/colormask.min.js


+ 15 - 11
dist/inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2024 Robin Herbots
  * Licensed under the MIT license
- * Version: 5.0.10-beta.1
+ * Version: 5.0.10-beta.2
  */
 !function(e, t) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = t(); else if ("function" == typeof define && define.amd) define([], t); else {
@@ -844,7 +844,7 @@
                     },
                     setValueEvent: function(e) {
                         var t = this.inputmask, n = t.dependencyLib, i = this, a = e && e.detail ? e.detail[0] : arguments[1];
-                        void 0 === a && (a = i.inputmask._valueGet(!0)), (0, l.applyInputValue)(i, a, new n.Event("input")), 
+                        void 0 === a && (a = i.inputmask._valueGet(!0)), (0, l.applyInputValue)(i, a, new n.Event("input"), void 0 !== (e && e.detail ? e.detail[0] : arguments[1])), 
                         (e.detail && void 0 !== e.detail[1] || void 0 !== arguments[2]) && c.caret.call(t, i, e.detail ? e.detail[1] : arguments[2]);
                     },
                     focusEvent: function(e) {
@@ -1309,10 +1309,14 @@
                 a.default.extendAliases({
                     datetime: {
                         mask: function(e) {
-                            return e.numericInput = !1, y.S = m.ordinalSuffix.join("|"), e.inputFormat = k[e.inputFormat] || e.inputFormat, 
-                            e.displayFormat = k[e.displayFormat] || e.displayFormat || e.inputFormat, e.outputFormat = k[e.outputFormat] || e.outputFormat || e.inputFormat, 
-                            e.regex = O(e.inputFormat, void 0, e), e.min = M(e.min, e.inputFormat, e), e.max = M(e.max, e.inputFormat, e), 
-                            null;
+                            if (e.numericInput = !1, y.S = m.ordinalSuffix.join("|"), e.inputFormat = k[e.inputFormat] || e.inputFormat, 
+                            e.repeat && (e.repeat = parseInt(e.repeat.toString()), e.repeat > 0)) {
+                                for (var t = "", n = 0; n < e.repeat; n++) t += e.inputFormat;
+                                e.inputFormat = t, e.repeat = 0;
+                            }
+                            return e.displayFormat = k[e.displayFormat] || e.displayFormat || e.inputFormat, 
+                            e.outputFormat = k[e.outputFormat] || e.outputFormat || e.inputFormat, e.regex = O(e.inputFormat, void 0, e), 
+                            e.min = M(e.min, e.inputFormat, e), e.max = M(e.max, e.inputFormat, e), null;
                         },
                         placeholder: "",
                         inputFormat: "isoDateTime",
@@ -1988,11 +1992,11 @@
                     return u;
                 }, t.writeBuffer = p;
                 var i = n(9845), a = n(6030), r = n(2839), o = n(8711), l = n(7215), s = n(4713);
-                function c(e, t, n) {
-                    var i = e ? e.inputmask : this, a = i.opts;
-                    e.inputmask.refreshValue = !1, "function" == typeof a.onBeforeMask && (t = a.onBeforeMask.call(i, t, a) || t), 
-                    f(e, !0, !1, t = (t || "").toString().split(""), n), i.undoValue = i._valueGet(!0), 
-                    (a.clearMaskOnLostFocus || a.clearIncomplete) && e.inputmask._valueGet() === o.getBufferTemplate.call(i).join("") && -1 === o.getLastValidPosition.call(i) && e.inputmask._valueSet("");
+                function c(e, t, n, i) {
+                    var a = e ? e.inputmask : this, r = a.opts;
+                    e.inputmask.refreshValue = !1, !0 !== i && "function" == typeof r.onBeforeMask && (t = r.onBeforeMask.call(a, t, r) || t), 
+                    f(e, !0, !1, t = (t || "").toString().split(""), n), a.undoValue = a._valueGet(!0), 
+                    (r.clearMaskOnLostFocus || r.clearIncomplete) && e.inputmask._valueGet() === o.getBufferTemplate.call(a).join("") && -1 === o.getLastValidPosition.call(a) && e.inputmask._valueSet("");
                 }
                 function u(e) {
                     e.length = 0;

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask.min.js


+ 30 - 26
dist/jquery.inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2024 Robin Herbots
  * Licensed under the MIT license
- * Version: 5.0.10-beta.1
+ * Version: 5.0.10-beta.2
  */
 !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 {
@@ -673,7 +673,7 @@
                     },
                     setValueEvent: function(e) {
                         var t = this.inputmask, n = t.dependencyLib, i = this, a = e && e.detail ? e.detail[0] : arguments[1];
-                        void 0 === a && (a = i.inputmask._valueGet(!0)), (0, s.applyInputValue)(i, a, new n.Event("input")), 
+                        void 0 === a && (a = i.inputmask._valueGet(!0)), (0, s.applyInputValue)(i, a, new n.Event("input"), void 0 !== (e && e.detail ? e.detail[0] : arguments[1])), 
                         (e.detail && void 0 !== e.detail[1] || void 0 !== arguments[2]) && c.caret.call(t, i, e.detail ? e.detail[1] : arguments[2]);
                     },
                     focusEvent: function(e) {
@@ -1138,10 +1138,14 @@
                 a.default.extendAliases({
                     datetime: {
                         mask: function(e) {
-                            return e.numericInput = !1, y.S = v.ordinalSuffix.join("|"), e.inputFormat = k[e.inputFormat] || e.inputFormat, 
-                            e.displayFormat = k[e.displayFormat] || e.displayFormat || e.inputFormat, e.outputFormat = k[e.outputFormat] || e.outputFormat || e.inputFormat, 
-                            e.regex = O(e.inputFormat, void 0, e), e.min = _(e.min, e.inputFormat, e), e.max = _(e.max, e.inputFormat, e), 
-                            null;
+                            if (e.numericInput = !1, y.S = v.ordinalSuffix.join("|"), e.inputFormat = k[e.inputFormat] || e.inputFormat, 
+                            e.repeat && (e.repeat = parseInt(e.repeat.toString()), e.repeat > 0)) {
+                                for (var t = "", n = 0; n < e.repeat; n++) t += e.inputFormat;
+                                e.inputFormat = t, e.repeat = 0;
+                            }
+                            return e.displayFormat = k[e.displayFormat] || e.displayFormat || e.inputFormat, 
+                            e.outputFormat = k[e.outputFormat] || e.outputFormat || e.inputFormat, e.regex = O(e.inputFormat, void 0, e), 
+                            e.min = _(e.min, e.inputFormat, e), e.max = _(e.max, e.inputFormat, e), null;
                         },
                         placeholder: "",
                         inputFormat: "isoDateTime",
@@ -1817,11 +1821,11 @@
                     return u;
                 }, t.writeBuffer = p;
                 var i = n(9845), a = n(6030), r = n(2839), o = n(8711), s = n(7215), l = n(4713);
-                function c(e, t, n) {
-                    var i = e ? e.inputmask : this, a = i.opts;
-                    e.inputmask.refreshValue = !1, "function" == typeof a.onBeforeMask && (t = a.onBeforeMask.call(i, t, a) || t), 
-                    f(e, !0, !1, t = (t || "").toString().split(""), n), i.undoValue = i._valueGet(!0), 
-                    (a.clearMaskOnLostFocus || a.clearIncomplete) && e.inputmask._valueGet() === o.getBufferTemplate.call(i).join("") && -1 === o.getLastValidPosition.call(i) && e.inputmask._valueSet("");
+                function c(e, t, n, i) {
+                    var a = e ? e.inputmask : this, r = a.opts;
+                    e.inputmask.refreshValue = !1, !0 !== i && "function" == typeof r.onBeforeMask && (t = r.onBeforeMask.call(a, t, r) || t), 
+                    f(e, !0, !1, t = (t || "").toString().split(""), n), a.undoValue = a._valueGet(!0), 
+                    (r.clearMaskOnLostFocus || r.clearIncomplete) && e.inputmask._valueGet() === o.getBufferTemplate.call(a).join("") && -1 === o.getLastValidPosition.call(a) && e.inputmask._valueSet("");
                 }
                 function u(e) {
                     e.length = 0;
@@ -3251,35 +3255,35 @@
                                             var I = m.matches[_];
                                             if (I && f(I, [ _ ].concat(s), p)) r = !0; else if (0 === B && (k = i(m)), I && I.matches && I.matches.length > m.matches[0].matches.length) break;
                                             a = v.slice(), h = E, v = [];
-                                            for (var R = 0; R < a.length; R++) {
-                                                var F = a[R], N = !1;
-                                                F.alternation = F.alternation || x, S(F);
+                                            for (var F = 0; F < a.length; F++) {
+                                                var R = a[F], N = !1;
+                                                R.alternation = R.alternation || x, S(R);
                                                 for (var V = 0; V < y.length; V++) {
                                                     var G = y[V];
-                                                    if ("string" != typeof M || void 0 !== F.alternation && T.includes(F.locator[F.alternation].toString())) {
-                                                        if (F.match.nativeDef === G.match.nativeDef) {
-                                                            N = !0, S(G, F);
+                                                    if ("string" != typeof M || void 0 !== R.alternation && T.includes(R.locator[R.alternation].toString())) {
+                                                        if (R.match.nativeDef === G.match.nativeDef) {
+                                                            N = !0, S(G, R);
                                                             break;
                                                         }
-                                                        if (d(F, G, c)) {
-                                                            S(F, G) && (N = !0, y.splice(y.indexOf(G), 0, F));
+                                                        if (d(R, G, c)) {
+                                                            S(R, G) && (N = !0, y.splice(y.indexOf(G), 0, R));
                                                             break;
                                                         }
-                                                        if (d(G, F, c)) {
-                                                            S(G, F);
+                                                        if (d(G, R, c)) {
+                                                            S(G, R);
                                                             break;
                                                         }
-                                                        if (P(F, G)) {
-                                                            O(F, G) || void 0 !== u.inputmask.userOptions.keepStatic ? S(F, G) && (N = !0, y.splice(y.indexOf(G), 0, F)) : c.keepStatic = !0;
+                                                        if (P(R, G)) {
+                                                            O(R, G) || void 0 !== u.inputmask.userOptions.keepStatic ? S(R, G) && (N = !0, y.splice(y.indexOf(G), 0, R)) : c.keepStatic = !0;
                                                             break;
                                                         }
-                                                        if (P(G, F)) {
-                                                            S(G, F);
+                                                        if (P(G, R)) {
+                                                            S(G, R);
                                                             break;
                                                         }
                                                     }
                                                 }
-                                                N || y.push(F);
+                                                N || y.push(R);
                                             }
                                         }
                                         v = b.concat(y), h = e, g = v.length > 0 && k, r = y.length > 0 && !k, k && g && !r && v.forEach((function(e, t) {

File diff suppressed because it is too large
+ 2 - 2
dist/jquery.inputmask.min.js


+ 1 - 0
inputmask-pages/src/assets/Changelog.md

@@ -7,6 +7,7 @@
 ### Updates
 
 ### Fixed
+- Alias datetime + repeat bug #2806
 - The inputmask is autocompleted to the min value when deleting the radix point #2773
 
 ## [5.0.9 - 31/05/2024]

+ 11 - 0
lib/extensions/inputmask.date.extensions.js

@@ -747,6 +747,17 @@ Inputmask.extendAliases({
       formatCode.S = i18n.ordinalSuffix.join("|");
 
       opts.inputFormat = formatAlias[opts.inputFormat] || opts.inputFormat; // resolve possible formatAlias
+      if (opts.repeat) {
+        opts.repeat = parseInt(opts.repeat.toString());
+        if (opts.repeat > 0) {
+          let inputFormat = "";
+          for (let i = 0; i < opts.repeat; i++) {
+            inputFormat = inputFormat + opts.inputFormat;
+          }
+          opts.inputFormat = inputFormat;
+          opts.repeat = 0;
+        }
+      }
       opts.displayFormat =
         formatAlias[opts.displayFormat] ||
         opts.displayFormat ||

+ 2 - 2
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "inputmask",
-  "version": "5.0.9-beta.72",
+  "version": "5.0.10-beta.1",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "inputmask",
-      "version": "5.0.9-beta.72",
+      "version": "5.0.10-beta.1",
       "license": "MIT",
       "devDependencies": {
         "@babel/core": "^7.23.2",

+ 1 - 1
package.json

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