Browse Source

Merge branch '1.x' into 2.x

Conflicts:
	build.properties
	dist/jquery.inputmask.bundle.js
	dist/jquery.inputmask.bundle.min.js
	dist/min/jquery.inputmask.js
	jquery.inputmask.jquery.json
Robin Herbots 13 years ago
parent
commit
e802021915

+ 8 - 0
README.md

@@ -154,6 +154,14 @@ $(document).ready(function(){
 });
 });
 ```
 ```
 
 
+If you define a radixPoint the caret will always jump to the integer part, until you type the radixpoint.  
+
+```javascript
+$(document).ready(function(){
+    $('#test').inputmask('€ 999.999.999,99', { numericInput: true, radixPoint: "," });
+});
+```
+
 ### remove the inputmask
 ### remove the inputmask
 
 
 ```javascript
 ```javascript

+ 1 - 1
build.properties

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

+ 2 - 1
build.xml

@@ -14,7 +14,8 @@
 	   <replaceregexp file="${srcdir}/jquery.inputmask.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.date.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.date.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.numeric.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.numeric.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
-    </target>
+	   <replaceregexp file="./jquery.inputmask.jquery.json" match="&quot;version&quot;:.*" replace="&quot;version&quot;: &quot;${build.major}.${build.minor}.${build.revision}&quot;"  byline="true"/>
+	</target>
 
 
 	<target name="resetVersions">
 	<target name="resetVersions">
        <replaceregexp file="nuget/jquery.inputmask.nuspec" match="&lt;version&gt;.*&lt;/version&gt;" replace="&lt;version&gt;0.0.0&lt;/version&gt;" />
        <replaceregexp file="nuget/jquery.inputmask.nuspec" match="&lt;version&gt;.*&lt;/version&gt;" replace="&lt;version&gt;0.0.0&lt;/version&gt;" />

BIN
dist/jQuery.InputMask.1.3.5.nupkg


BIN
dist/jQuery.InputMask.2.1.2.nupkg


BIN
dist/jQuery.InputMask.2.1.3.nupkg


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 2.1.2
+* Version: 2.1.3
 */
 */
 
 
 (function ($) {
 (function ($) {
@@ -35,7 +35,7 @@
                 skipOptionalPartCharacter: " ", //a character which can be used to skip an optional part of a mask
                 skipOptionalPartCharacter: " ", //a character which can be used to skip an optional part of a mask
                 //numeric basic properties
                 //numeric basic properties
                 numericInput: false, //numericInput input direction style (input shifts to the left while holding the caret position)
                 numericInput: false, //numericInput input direction style (input shifts to the left while holding the caret position)
-                radixPoint: ".", // | ","
+                radixPoint: "", //".", // | ","
                 //numeric basic properties
                 //numeric basic properties
                 definitions: {
                 definitions: {
                     '9': {
                     '9': {
@@ -597,7 +597,7 @@
                 if (clearInvalid) {
                 if (clearInvalid) {
                     writeBuffer(input, buffer);
                     writeBuffer(input, buffer);
                 }
                 }
-                return isRTL ? (opts.numericInput ? ($.inArray(opts.radixPoint, buffer) != -1 && skipRadixHandling !== true ? $.inArray(opts.radixPoint, buffer) : seekNext(buffer, maskL)) : seekNext(buffer, rtlMatch)) : seekNext(buffer, lastMatch);
+                return isRTL ? (opts.numericInput ? (opts.radixPoint != "" && $.inArray(opts.radixPoint, buffer) != -1 && skipRadixHandling !== true ? $.inArray(opts.radixPoint, buffer) : seekNext(buffer, maskL)) : seekNext(buffer, rtlMatch)) : seekNext(buffer, lastMatch);
             }
             }
 
 
             function escapeRegex(str) {
             function escapeRegex(str) {
@@ -1028,7 +1028,7 @@
                     var input = this, k = e.keyCode, pos = caret(input);
                     var input = this, k = e.keyCode, pos = caret(input);
 
 
                     //set input direction according the position to the radixPoint
                     //set input direction according the position to the radixPoint
-                    if (opts.numericInput) {
+                    if (opts.numericInput && opts.radixPoint != "") {
                         var nptStr = input._valueGet();
                         var nptStr = input._valueGet();
                         var radixPosition = nptStr.indexOf(opts.radixPoint);
                         var radixPosition = nptStr.indexOf(opts.radixPoint);
                         if (radixPosition != -1) {
                         if (radixPosition != -1) {
@@ -1055,9 +1055,13 @@
                                 beginPos = firstMaskPos;
                                 beginPos = firstMaskPos;
                             }
                             }
                             if (beginPos >= firstMaskPos) {
                             if (beginPos >= firstMaskPos) {
+                                console.log('before delete ' + buffer);
                                 if (opts.numericInput && opts.greedy && k == opts.keyCode.DELETE && buffer[beginPos] == opts.radixPoint) {
                                 if (opts.numericInput && opts.greedy && k == opts.keyCode.DELETE && buffer[beginPos] == opts.radixPoint) {
                                     beginPos = seekNext(buffer, beginPos);
                                     beginPos = seekNext(buffer, beginPos);
                                     isRTL = false;
                                     isRTL = false;
+                                } else if (opts.numericInput && opts.greedy && k == opts.keyCode.BACKSPACE && buffer[beginPos] == opts.radixPoint) {
+                                    beginPos--;
+                                    isRTL = true;
                                 }
                                 }
                                 if (isRTL) {
                                 if (isRTL) {
                                     beginPos = shiftR(firstMaskPos, beginPos, getPlaceHolder(beginPos), true);
                                     beginPos = shiftR(firstMaskPos, beginPos, getPlaceHolder(beginPos), true);
@@ -1162,7 +1166,7 @@
                                     }
                                     }
 
 
                                     if (writeOutBuffer) {
                                     if (writeOutBuffer) {
-                                        writeBuffer(input, buffer, opts.numericInput ? seekNext(buffer, p) : p);
+                                        writeBuffer(input, buffer, opts.numericInput ? p + 1 : p);
                                         setTimeout(function () { //timeout needed for IE
                                         setTimeout(function () { //timeout needed for IE
                                             if (isComplete(input))
                                             if (isComplete(input))
                                                 $input.trigger("complete");
                                                 $input.trigger("complete");
@@ -1230,7 +1234,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.1.2
+Version: 2.1.3
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1327,7 +1331,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2012 Robin Herbots
 Copyright (c) 2010 - 2012 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.1.2
+Version: 2.1.3
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1805,7 +1809,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2012 Robin Herbots
 Copyright (c) 2010 - 2012 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.1.2
+Version: 2.1.3
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1820,6 +1824,7 @@ Optional extensions on the jquery.inputmask base
             numericInput: true,
             numericInput: true,
             digits: "*", //numer of digits
             digits: "*", //numer of digits
             groupSeparator: ",", // | "."
             groupSeparator: ",", // | "."
+			radixPoint: ".",
             groupSize: 3,
             groupSize: 3,
             autoGroup: false,
             autoGroup: false,
             postFormat: function (buffer, pos, reformatOnly, opts) {
             postFormat: function (buffer, pos, reformatOnly, opts) {

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


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


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


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 8 - 4
js/jquery.inputmask.js

@@ -35,7 +35,7 @@
                 skipOptionalPartCharacter: " ", //a character which can be used to skip an optional part of a mask
                 skipOptionalPartCharacter: " ", //a character which can be used to skip an optional part of a mask
                 //numeric basic properties
                 //numeric basic properties
                 numericInput: false, //numericInput input direction style (input shifts to the left while holding the caret position)
                 numericInput: false, //numericInput input direction style (input shifts to the left while holding the caret position)
-                radixPoint: ".", // | ","
+                radixPoint: "", //".", // | ","
                 //numeric basic properties
                 //numeric basic properties
                 definitions: {
                 definitions: {
                     '9': {
                     '9': {
@@ -597,7 +597,7 @@
                 if (clearInvalid) {
                 if (clearInvalid) {
                     writeBuffer(input, buffer);
                     writeBuffer(input, buffer);
                 }
                 }
-                return isRTL ? (opts.numericInput ? ($.inArray(opts.radixPoint, buffer) != -1 && skipRadixHandling !== true ? $.inArray(opts.radixPoint, buffer) : seekNext(buffer, maskL)) : seekNext(buffer, rtlMatch)) : seekNext(buffer, lastMatch);
+                return isRTL ? (opts.numericInput ? (opts.radixPoint != "" && $.inArray(opts.radixPoint, buffer) != -1 && skipRadixHandling !== true ? $.inArray(opts.radixPoint, buffer) : seekNext(buffer, maskL)) : seekNext(buffer, rtlMatch)) : seekNext(buffer, lastMatch);
             }
             }
 
 
             function escapeRegex(str) {
             function escapeRegex(str) {
@@ -1028,7 +1028,7 @@
                     var input = this, k = e.keyCode, pos = caret(input);
                     var input = this, k = e.keyCode, pos = caret(input);
 
 
                     //set input direction according the position to the radixPoint
                     //set input direction according the position to the radixPoint
-                    if (opts.numericInput) {
+                    if (opts.numericInput && opts.radixPoint != "") {
                         var nptStr = input._valueGet();
                         var nptStr = input._valueGet();
                         var radixPosition = nptStr.indexOf(opts.radixPoint);
                         var radixPosition = nptStr.indexOf(opts.radixPoint);
                         if (radixPosition != -1) {
                         if (radixPosition != -1) {
@@ -1055,9 +1055,13 @@
                                 beginPos = firstMaskPos;
                                 beginPos = firstMaskPos;
                             }
                             }
                             if (beginPos >= firstMaskPos) {
                             if (beginPos >= firstMaskPos) {
+                                console.log('before delete ' + buffer);
                                 if (opts.numericInput && opts.greedy && k == opts.keyCode.DELETE && buffer[beginPos] == opts.radixPoint) {
                                 if (opts.numericInput && opts.greedy && k == opts.keyCode.DELETE && buffer[beginPos] == opts.radixPoint) {
                                     beginPos = seekNext(buffer, beginPos);
                                     beginPos = seekNext(buffer, beginPos);
                                     isRTL = false;
                                     isRTL = false;
+                                } else if (opts.numericInput && opts.greedy && k == opts.keyCode.BACKSPACE && buffer[beginPos] == opts.radixPoint) {
+                                    beginPos--;
+                                    isRTL = true;
                                 }
                                 }
                                 if (isRTL) {
                                 if (isRTL) {
                                     beginPos = shiftR(firstMaskPos, beginPos, getPlaceHolder(beginPos), true);
                                     beginPos = shiftR(firstMaskPos, beginPos, getPlaceHolder(beginPos), true);
@@ -1162,7 +1166,7 @@
                                     }
                                     }
 
 
                                     if (writeOutBuffer) {
                                     if (writeOutBuffer) {
-                                        writeBuffer(input, buffer, opts.numericInput ? seekNext(buffer, p) : p);
+                                        writeBuffer(input, buffer, opts.numericInput ? p + 1 : p);
                                         setTimeout(function () { //timeout needed for IE
                                         setTimeout(function () { //timeout needed for IE
                                             if (isComplete(input))
                                             if (isComplete(input))
                                                 $input.trigger("complete");
                                                 $input.trigger("complete");

+ 1 - 0
js/jquery.inputmask.numeric.extensions.js

@@ -18,6 +18,7 @@ Optional extensions on the jquery.inputmask base
             numericInput: true,
             numericInput: true,
             digits: "*", //numer of digits
             digits: "*", //numer of digits
             groupSeparator: ",", // | "."
             groupSeparator: ",", // | "."
+			radixPoint: ".",
             groupSize: 3,
             groupSize: 3,
             autoGroup: false,
             autoGroup: false,
             postFormat: function (buffer, pos, reformatOnly, opts) {
             postFormat: function (buffer, pos, reformatOnly, opts) {