Skip to content

Commit 024c4c9

Browse files
authoredSep 19, 2018
Merge pull request formio#668 from formio/bugfix/for-1638-numbe-delimiter-options
FOR-1638: Added Number delimiter options.
2 parents 1a910d6 + 7ce7513 commit 024c4c9

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed
 

‎src/components/number/Number.form.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import baseEditForm from '../base/Base.form';
22

3+
import NumberEditData from './editForm/Number.edit.data';
34
import NumberEditValidation from './editForm/Number.edit.validation';
45

56
export default function(...extend) {
67
return baseEditForm([
8+
{
9+
key: 'data',
10+
components: NumberEditData
11+
},
712
{
813
key: 'validation',
914
components: NumberEditValidation

‎src/components/number/Number.js

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export default class NumberComponent extends BaseComponent {
8383
mask: createNumberMask({
8484
prefix: '',
8585
suffix: '',
86+
requireDecimal: _.get(this.component, 'requireDecimal', false),
8687
thousandsSeparatorSymbol: _.get(this.component, 'thousandsSeparator', this.delimiter),
8788
decimalSymbol: _.get(this.component, 'decimalSymbol', this.decimalSeparator),
8889
decimalLimit: _.get(this.component, 'decimalLimit', this.decimalLimit),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export default [
2+
{
3+
type: 'checkbox',
4+
input: true,
5+
weight: 70,
6+
key: 'delimiter',
7+
label: 'Use Delimiter',
8+
tooltip: 'Separate thousands by local delimiter.'
9+
},
10+
{
11+
type: 'number',
12+
input: true,
13+
weight: 80,
14+
key: 'decimalLimit',
15+
label: 'Decimal Places',
16+
tooltip: 'The maximum number of decimal places.'
17+
},
18+
{
19+
type: 'checkbox',
20+
input: true,
21+
weight: 90,
22+
key: 'requireDecimal',
23+
label: 'Require Decimal',
24+
tooltip: 'Always show decimals, even if trailing zeros.'
25+
}
26+
];

‎src/components/number/editForm/Number.edit.validation.js

-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
export default [
22
{
3-
weight: 100,
4-
type: 'checkbox',
5-
label: 'Unique',
6-
tooltip: 'Makes sure the data submitted for this field is unique, and has not been submitted before.',
73
key: 'validate.unique',
8-
input: true,
94
ignore: true
105
},
116
{

0 commit comments

Comments
 (0)
Please sign in to comment.