Skip to content

Commit

Permalink
VCST-2213: Cannot save empty field for catalog property with type dec…
Browse files Browse the repository at this point in the history
…imal number (#2859)

fix: Allow to save empty field for catalog property with type decimal number
  • Loading branch information
OlegoO committed Nov 7, 2024
1 parent 2795264 commit d6f6fd1
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ angular.module('platformWebApp')
// possible values for fraction are: 0, positive number, negative number, none
// when fraction is a negative number result has maximum length of the fractional part of the value
var fraction = (attrs.fraction || Number(attrs.fraction) === 0) ? attrs.fraction : 2;
if (attrs.numType === "float") {
if (attrs.numType === 'float') {
ctrl.$parsers.unshift(function (viewValue) {
if (FLOAT_REGEXP_1.test(viewValue)) {
ctrl.$setValidity('float', true);
Expand All @@ -32,7 +32,8 @@ angular.module('platformWebApp')
ctrl.$setValidity('float', true);
return parseFloat(viewValue.replace(',', '.'));
} else {
ctrl.$setValidity('float', false);
//Allow to use empty values
ctrl.$setValidity('float', !viewValue);
return viewValue;
}
});
Expand All @@ -54,7 +55,7 @@ angular.module('platformWebApp')
}
);
}
else if (attrs.numType === "positiveInteger") {
else if (attrs.numType === 'positiveInteger') {
ctrl.$parsers.unshift(function (viewValue) {
ctrl.$setValidity('positiveInteger', INTEGER_REGEXP.test(viewValue) && viewValue > 0);
return viewValue;
Expand Down

0 comments on commit d6f6fd1

Please sign in to comment.