Skip to content

Commit

Permalink
[ISSUE-247][ISSUE-442] Fix react component phone prefix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nosir committed Mar 10, 2019
1 parent 3bfd3c5 commit 4afa2ce
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description":
"JavaScript library for formatting input text content when you are typing",
"keywords": ["cleave", "javascript", "html", "form", "input"],
"version": "1.4.8",
"version": "1.4.9",
"author": {
"name": "Max Huang",
"email": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion dist/cleave-angular.min.js

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

6 changes: 5 additions & 1 deletion dist/cleave-react-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,11 @@ return /******/ (function(modules) { // webpackBootstrap

// phone formatter
if (pps.phone) {
pps.result = pps.phoneFormatter.format(value);
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
pps.result = pps.prefix + pps.phoneFormatter.format(value).slice(pps.prefix.length);
} else {
pps.result = pps.phoneFormatter.format(value);
}
owner.updateValueState();

return;
Expand Down
4 changes: 2 additions & 2 deletions dist/cleave-react-node.min.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/cleave-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,11 @@ return /******/ (function(modules) { // webpackBootstrap

// phone formatter
if (pps.phone) {
pps.result = pps.phoneFormatter.format(value);
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
pps.result = pps.prefix + pps.phoneFormatter.format(value).slice(pps.prefix.length);
} else {
pps.result = pps.phoneFormatter.format(value);
}
owner.updateValueState();

return;
Expand Down
4 changes: 2 additions & 2 deletions dist/cleave-react.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cleave.min.js

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"form",
"input"
],
"version": "1.4.8",
"version": "1.4.9",
"files": [
"src",
"dist",
Expand Down
6 changes: 5 additions & 1 deletion src/Cleave.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ var cleaveReactClass = CreateReactClass({

// phone formatter
if (pps.phone) {
pps.result = pps.phoneFormatter.format(value);
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
pps.result = pps.prefix + pps.phoneFormatter.format(value).slice(pps.prefix.length);
} else {
pps.result = pps.phoneFormatter.format(value);
}
owner.updateValueState();

return;
Expand Down

0 comments on commit 4afa2ce

Please sign in to comment.