Skip to content

Commit

Permalink
[Issue-204] Remove default 10 for numeralIntegerScale
Browse files Browse the repository at this point in the history
  • Loading branch information
nosir committed Jul 23, 2017
1 parent 2249a15 commit af459f4
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 22 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"form",
"input"
],
"version": "0.8.0",
"version": "0.9.0",
"author": {
"name": "Max Huang",
"email": "[email protected]",
Expand Down
6 changes: 3 additions & 3 deletions dist/cleave-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ return /******/ (function(modules) { // webpackBootstrap
var owner = this;

owner.numeralDecimalMark = numeralDecimalMark || '.';
owner.numeralIntegerScale = numeralIntegerScale >= 0 ? numeralIntegerScale : 10;
owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0;
owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2;
owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand;
owner.numeralPositiveOnly = !!numeralPositiveOnly;
Expand Down Expand Up @@ -959,7 +959,7 @@ return /******/ (function(modules) { // webpackBootstrap

// numeral
target.numeral = !!opts.numeral;
target.numeralIntegerScale = opts.numeralIntegerScale >= 0 ? opts.numeralIntegerScale : 10;
target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0;
target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2;
target.numeralDecimalMark = opts.numeralDecimalMark || '.';
target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand';
Expand All @@ -976,7 +976,7 @@ return /******/ (function(modules) { // webpackBootstrap
target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix;
target.copyDelimiter = !!opts.copyDelimiter;

target.initValue = opts.initValue === undefined ? '' : opts.initValue.toString();
target.initValue = (opts.initValue !== undefined && opts.initValue !== null) ? opts.initValue.toString() : '';

target.delimiter =
(opts.delimiter || opts.delimiter === '') ? opts.delimiter :
Expand Down
4 changes: 2 additions & 2 deletions dist/cleave-angular.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/cleave-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ return /******/ (function(modules) { // webpackBootstrap
var owner = this;

owner.numeralDecimalMark = numeralDecimalMark || '.';
owner.numeralIntegerScale = numeralIntegerScale >= 0 ? numeralIntegerScale : 10;
owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0;
owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2;
owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand;
owner.numeralPositiveOnly = !!numeralPositiveOnly;
Expand Down Expand Up @@ -2143,7 +2143,7 @@ return /******/ (function(modules) { // webpackBootstrap

// numeral
target.numeral = !!opts.numeral;
target.numeralIntegerScale = opts.numeralIntegerScale >= 0 ? opts.numeralIntegerScale : 10;
target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0;
target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2;
target.numeralDecimalMark = opts.numeralDecimalMark || '.';
target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand';
Expand All @@ -2160,7 +2160,7 @@ return /******/ (function(modules) { // webpackBootstrap
target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix;
target.copyDelimiter = !!opts.copyDelimiter;

target.initValue = opts.initValue === undefined ? '' : opts.initValue.toString();
target.initValue = opts.initValue !== undefined && opts.initValue !== null ? opts.initValue.toString() : '';

target.delimiter = opts.delimiter || opts.delimiter === '' ? opts.delimiter : opts.date ? '/' : opts.numeral ? ',' : opts.phone ? ' ' : ' ';
target.delimiterLength = target.delimiter.length;
Expand Down
4 changes: 2 additions & 2 deletions dist/cleave-react.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/cleave.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ return /******/ (function(modules) { // webpackBootstrap
var owner = this;

owner.numeralDecimalMark = numeralDecimalMark || '.';
owner.numeralIntegerScale = numeralIntegerScale >= 0 ? numeralIntegerScale : 10;
owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0;
owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2;
owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand;
owner.numeralPositiveOnly = !!numeralPositiveOnly;
Expand Down Expand Up @@ -959,7 +959,7 @@ return /******/ (function(modules) { // webpackBootstrap

// numeral
target.numeral = !!opts.numeral;
target.numeralIntegerScale = opts.numeralIntegerScale >= 0 ? opts.numeralIntegerScale : 10;
target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0;
target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2;
target.numeralDecimalMark = opts.numeralDecimalMark || '.';
target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand';
Expand All @@ -976,7 +976,7 @@ return /******/ (function(modules) { // webpackBootstrap
target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix;
target.copyDelimiter = !!opts.copyDelimiter;

target.initValue = opts.initValue === undefined ? '' : opts.initValue.toString();
target.initValue = (opts.initValue !== undefined && opts.initValue !== null) ? opts.initValue.toString() : '';

target.delimiter =
(opts.delimiter || opts.delimiter === '') ? opts.delimiter :
Expand Down
4 changes: 2 additions & 2 deletions dist/cleave.min.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions doc/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ new Cleave('.my-input', {

An `Int` value indicates the numeral integer scale.

**Default value**: `10`

```js
new Cleave('.my-input', {
numeral: true,
Expand Down
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": "0.8.0",
"version": "0.9.0",
"author": {
"name": "Max Huang",
"url": "http://github.com/nosir",
Expand Down
4 changes: 2 additions & 2 deletions src/common/DefaultProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var DefaultProperties = {

// numeral
target.numeral = !!opts.numeral;
target.numeralIntegerScale = opts.numeralIntegerScale >= 0 ? opts.numeralIntegerScale : 10;
target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0;
target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2;
target.numeralDecimalMark = opts.numeralDecimalMark || '.';
target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand';
Expand All @@ -47,7 +47,7 @@ var DefaultProperties = {
target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix;
target.copyDelimiter = !!opts.copyDelimiter;

target.initValue = opts.initValue !== undefined && opts.initValue !== null ? opts.initValue.toString() : '';
target.initValue = (opts.initValue !== undefined && opts.initValue !== null) ? opts.initValue.toString() : '';

target.delimiter =
(opts.delimiter || opts.delimiter === '') ? opts.delimiter :
Expand Down
2 changes: 1 addition & 1 deletion src/shortcuts/NumeralFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var NumeralFormatter = function (numeralDecimalMark,
var owner = this;

owner.numeralDecimalMark = numeralDecimalMark || '.';
owner.numeralIntegerScale = numeralIntegerScale >= 0 ? numeralIntegerScale : 10;
owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0;
owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2;
owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand;
owner.numeralPositiveOnly = !!numeralPositiveOnly;
Expand Down
17 changes: 17 additions & 0 deletions test/fixtures/numeral.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@
]
]
},
{
"numeralIntegerScale": 0,
"numbers": [
[
"123456789012345",
"123,456,789,012,345"
]
]
},
{
"numbers": [
[
"123456789012345",
"123,456,789,012,345"
]
]
},
{
"numeralDecimalScale": 0,
"numbers": [
Expand Down

0 comments on commit af459f4

Please sign in to comment.