ソースを参照

#502 fix getmasktemplate

Robin Herbots 11 年 前
コミット
448eb6ee89

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
     "name": "jquery.inputmask",
-    "version": "3.0.0",
+    "version": "3.0.1",
     "main": "./dist/jquery.inputmask.bundle.js",
 	"keywords" : ["jQuery", "plugins", "input", "form", "inputmask", "mask"],
 	"description": "jquery.inputmask is a jquery plugin which create an input mask.",

+ 1 - 1
build.properties

@@ -7,7 +7,7 @@ distdir = dist
 
 build.major = 3
 build.minor = 0
-build.revision = 0
+build.revision = 1
 
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js

BIN
dist/jQuery.InputMask.3.0.0.nupkg


BIN
dist/jQuery.InputMask.3.0.1.nupkg


+ 13 - 8
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2014 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.0.0
+* Version: 3.0.1
 */
 
 (function ($) {
@@ -40,11 +40,12 @@
                 var tokenizer = /(?:[?*+]|\{[0-9]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,
                     escaped = false;
 
-                function maskToken(isGroup, isOptional, isQuantifier) {
+                function maskToken(isGroup, isOptional, isQuantifier, isAlternator) {
                     this.matches = [];
                     this.isGroup = isGroup || false;
                     this.isOptional = isOptional || false;
                     this.isQuantifier = isQuantifier || false;
+                    this.isAlternator = isAlternator || false;
                     this.quantifier = { min: 1, max: 1 };
                 };
 
@@ -125,6 +126,9 @@
                         case opts.escapeChar:
                             escaped = true;
                             break;
+                        case opts.alternatormarker:
+                            console.log("alternator");
+                            break;
                         default:
                             if (openenings.length > 0) {
                                 insertTestDefinition(openenings[openenings.length - 1], m);
@@ -238,7 +242,7 @@
                         ndxIntlzr = validPos["locator"].slice();
                         maskTemplate.push(test["fn"] == null ? test["def"] : (includeInput === true ? validPos["input"] : opts.placeholder.charAt(pos % opts.placeholder.length)));
                     } else {
-                        var testPos = getTests(pos, false, ndxIntlzr, pos - 1);
+                        var testPos = getTests(pos, true, ndxIntlzr, pos - 1);
                         testPos = testPos[opts.greedy || minimalPos > pos ? 0 : (testPos.length - 1)];
                         test = testPos["match"];
                         ndxIntlzr = testPos["locator"].slice();
@@ -1589,6 +1593,7 @@
                 optionalmarker: { start: "[", end: "]" },
                 quantifiermarker: { start: "{", end: "}" },
                 groupmarker: { start: "(", end: ")" },
+                alternatormarker: "|",
                 escapeChar: "\\",
                 mask: null,
                 oncomplete: $.noop, //executes when the mask is complete
@@ -1804,7 +1809,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.0
+Version: 3.0.1
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1914,7 +1919,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.0
+Version: 3.0.1
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2411,7 +2416,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.0
+Version: 3.0.1
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2578,7 +2583,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.0
+Version: 3.0.1
 
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask
@@ -2765,7 +2770,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.0
+Version: 3.0.1
 
 Phone extension.
 When using this extension make sure you specify the correct url to get the masks

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


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


+ 1 - 1
jquery.inputmask.jquery.json

@@ -8,7 +8,7 @@
 		"inputmask",
 		"mask"
     ],
-    "version": "3.0.0",
+    "version": "3.0.1",
     "author": {
         "name": "Robin Herbots",
         "url": "http://github.com/RobinHerbots/jquery.inputmask"

+ 7 - 2
js/jquery.inputmask.js

@@ -40,11 +40,12 @@
                 var tokenizer = /(?:[?*+]|\{[0-9]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,
                     escaped = false;
 
-                function maskToken(isGroup, isOptional, isQuantifier) {
+                function maskToken(isGroup, isOptional, isQuantifier, isAlternator) {
                     this.matches = [];
                     this.isGroup = isGroup || false;
                     this.isOptional = isOptional || false;
                     this.isQuantifier = isQuantifier || false;
+                    this.isAlternator = isAlternator || false;
                     this.quantifier = { min: 1, max: 1 };
                 };
 
@@ -125,6 +126,9 @@
                         case opts.escapeChar:
                             escaped = true;
                             break;
+                        case opts.alternatormarker:
+                            console.log("alternator");
+                            break;
                         default:
                             if (openenings.length > 0) {
                                 insertTestDefinition(openenings[openenings.length - 1], m);
@@ -238,7 +242,7 @@
                         ndxIntlzr = validPos["locator"].slice();
                         maskTemplate.push(test["fn"] == null ? test["def"] : (includeInput === true ? validPos["input"] : opts.placeholder.charAt(pos % opts.placeholder.length)));
                     } else {
-                        var testPos = getTests(pos, false, ndxIntlzr, pos - 1);
+                        var testPos = getTests(pos, true, ndxIntlzr, pos - 1);
                         testPos = testPos[opts.greedy || minimalPos > pos ? 0 : (testPos.length - 1)];
                         test = testPos["match"];
                         ndxIntlzr = testPos["locator"].slice();
@@ -1589,6 +1593,7 @@
                 optionalmarker: { start: "[", end: "]" },
                 quantifiermarker: { start: "{", end: "}" },
                 groupmarker: { start: "(", end: ")" },
+                alternatormarker: "|",
                 escapeChar: "\\",
                 mask: null,
                 oncomplete: $.noop, //executes when the mask is complete

+ 28 - 0
qunit/tests.js

@@ -307,6 +307,34 @@ test("inputmask(\"A.\", { repeat: \"*\" }) - type abc - joostburg", function ()
     $("#testmask").remove();
 });
 
+test("{ mask: \"A\", placeholder: \"\", repeat: 16 }) - type testtest - glosswordteam", function () {
+    var $fixture = $("#qunit-fixture");
+    $fixture.append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask({ mask: "A", placeholder: "", repeat: 16 });
+
+    $("#testmask")[0].focus();
+
+    $("#testmask").Type("testtest");
+
+    equal($("#testmask").val(), "TESTTEST", "Result " + $("#testmask").val());
+
+    $("#testmask").remove();
+});
+
+test("{ mask: \"A\", repeat: 16, greedy: false }) - type testtest - glosswordteam", function () {
+    var $fixture = $("#qunit-fixture");
+    $fixture.append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask({ mask: "A", repeat: 16, greedy: false });
+
+    $("#testmask")[0].focus();
+
+    $("#testmask").Type("testtest");
+
+    equal($("#testmask").val(), "TESTTEST", "Result " + $("#testmask").val());
+
+    $("#testmask").remove();
+});
+
 module("greedy masks");
 test("inputmask(\"*\", { greedy: true, repeat: 10, clearMaskOnLostFocus: false  })", function () {
     var $fixture = $("#qunit-fixture");