Skip to content

Commit

Permalink
alignDigits when setting value
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinHerbots committed May 11, 2018
1 parent 288d99b commit 65c8715
Show file tree
Hide file tree
Showing 47 changed files with 86 additions and 73 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inputmask",
"version": "4.0.0-beta.56",
"version": "4.0.0-beta.57",
"main": [
"./index.js",
"./css/inputmask.css"
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "inputmask",
"repository": "robinherbots/Inputmask",
"description": "Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.",
"version": "4.0.0-beta.56",
"version": "4.0.0-beta.57",
"keywords": [
"jquery",
"plugins",
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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": "4.0.0-beta.56",
"version": "4.0.0-beta.57",
"type": "library",
"keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
"homepage": "http://robinherbots.github.io/Inputmask",
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/bindings/inputmask.binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/dependencyLibs/inputmask.dependencyLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/global/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

"function" == typeof define && define.amd ? define(function() {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/global/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

"function" == typeof define && define.amd ? define(function() {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/inputmask.date.extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/inputmask.extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/inputmask.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
9 changes: 7 additions & 2 deletions dist/inputmask/inputmask.numeric.extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down Expand Up @@ -295,7 +295,12 @@
initialValue = (initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor).toString().replace(".", opts.radixPoint);
}
}
return initialValue;
return function(buffer, opts) {
var radixPosition = $.inArray(opts.radixPoint, buffer);
-1 === radixPosition && (buffer.push(opts.radixPoint), radixPosition = buffer.length - 1);
for (var i = 1; i <= opts.digits; i++) buffer[radixPosition + i] = buffer[radixPosition + i] || "0";
return buffer;
}(initialValue.toString().split(""), opts).join("");
},
onKeyDown: function(e, buffer, caretPos, opts) {
var $input = $(this);
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/inputmask.phone.extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/jquery.inputmask.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/phone-codes/phone-be.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/phone-codes/phone-ca.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/phone-codes/phone-hu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/phone-codes/phone-it.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/phone-codes/phone-mx.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/phone-codes/phone-nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/phone-codes/phone-ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
2 changes: 1 addition & 1 deletion dist/inputmask/phone-codes/phone.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(factory) {
Expand Down
9 changes: 7 additions & 2 deletions dist/jquery.inputmask.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(modules) {
Expand Down Expand Up @@ -2238,7 +2238,12 @@
initialValue = (initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor).toString().replace(".", opts.radixPoint);
}
}
return initialValue;
return function(buffer, opts) {
var radixPosition = $.inArray(opts.radixPoint, buffer);
-1 === radixPosition && (buffer.push(opts.radixPoint), radixPosition = buffer.length - 1);
for (var i = 1; i <= opts.digits; i++) buffer[radixPosition + i] = buffer[radixPosition + i] || "0";
return buffer;
}(initialValue.toString().split(""), opts).join("");
},
onKeyDown: function(e, buffer, caretPos, opts) {
var $input = $(this);
Expand Down
2 changes: 1 addition & 1 deletion dist/min/inputmask/bindings/inputmask.binding.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(a){"function"==typeof define&&define.amd?define(["jquery","../inputmask","../global/document"],a):"object"==typeof exports?module.exports=a(require("jquery"),require("../inputmask"),require("../global/document")):a(jQuery,window.Inputmask,document)}(function(a,t,n){a(n).ajaxComplete(function(n,i,e){-1!==a.inArray("html",e.dataTypes)&&a(".inputmask, [data-inputmask], [data-inputmask-mask], [data-inputmask-alias]").each(function(a,n){void 0===n.inputmask&&t().mask(n)})}).ready(function(){a(".inputmask, [data-inputmask], [data-inputmask-mask], [data-inputmask-alias]").each(function(a,n){void 0===n.inputmask&&t().mask(n)})})});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):window.dependencyLib=e(jQuery)}(function(e){return e});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/min/inputmask/global/document.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

"function"==typeof define&&define.amd?define(function(){return document}):"object"==typeof exports&&(module.exports=document);
2 changes: 1 addition & 1 deletion dist/min/inputmask/global/window.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.0-beta.56
* Version: 4.0.0-beta.57
*/

"function"==typeof define&&define.amd?define(function(){return window}):"object"==typeof exports&&(module.exports=window);
Loading

0 comments on commit 65c8715

Please sign in to comment.