Skip to content

Commit

Permalink
fix(editor): Float Editor not working with .5 but works with 0.5
Browse files Browse the repository at this point in the history
- first char can also be empty so .5 should be acceptable
  • Loading branch information
ghiscoding committed Nov 24, 2018
1 parent 824af29 commit 1082fdf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class FloatEditor implements Editor {
valid: false,
msg: errorMsg || Constants.VALIDATION_EDITOR_NUMBER_MAX.replace(/{{maxValue}}/gi, (matched) => mapValidation[matched])
};
} else if ((decPlaces > 0 && !new RegExp(`^(\\d+(\\.)?(\\d){0,${decPlaces}})$`).test(elmValue))) {
} else if ((decPlaces > 0 && !new RegExp(`^(\\d*(\\.)?(\\d){0,${decPlaces}})$`).test(elmValue))) {
// when decimal value is bigger than 0, we only accept the decimal values as that value set
// for example if we set decimalPlaces to 2, we will only accept numbers between 0 and 2 decimals
return {
Expand Down
2 changes: 1 addition & 1 deletion aurelia-slickgrid/src/examples/slickgrid/example3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export class Example3 {
name: 'Duration (days)',
field: 'duration',
filterable: true,
minWidth: 100,
sortable: true,
type: FieldType.number,
filter: { model: Filters.slider, params: { hideSliderNumber: false } },
Expand All @@ -182,7 +183,6 @@ export class Example3 {
params: { decimalPlaces: 2 },
},
*/
minWidth: 100
}, {
id: 'complete',
name: '% Complete',
Expand Down

0 comments on commit 1082fdf

Please sign in to comment.