Skip to content

Commit d6f6fd1

Browse files
committed
VCST-2213: Cannot save empty field for catalog property with type decimal number (#2859)
fix: Allow to save empty field for catalog property with type decimal number
1 parent 2795264 commit d6f6fd1

File tree

1 file changed

+4
-3
lines changed
  • src/VirtoCommerce.Platform.Web/wwwroot/js/common/directives

1 file changed

+4
-3
lines changed

src/VirtoCommerce.Platform.Web/wwwroot/js/common/directives/smartFloat.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ angular.module('platformWebApp')
1717
// possible values for fraction are: 0, positive number, negative number, none
1818
// when fraction is a negative number result has maximum length of the fractional part of the value
1919
var fraction = (attrs.fraction || Number(attrs.fraction) === 0) ? attrs.fraction : 2;
20-
if (attrs.numType === "float") {
20+
if (attrs.numType === 'float') {
2121
ctrl.$parsers.unshift(function (viewValue) {
2222
if (FLOAT_REGEXP_1.test(viewValue)) {
2323
ctrl.$setValidity('float', true);
@@ -32,7 +32,8 @@ angular.module('platformWebApp')
3232
ctrl.$setValidity('float', true);
3333
return parseFloat(viewValue.replace(',', '.'));
3434
} else {
35-
ctrl.$setValidity('float', false);
35+
//Allow to use empty values
36+
ctrl.$setValidity('float', !viewValue);
3637
return viewValue;
3738
}
3839
});
@@ -54,7 +55,7 @@ angular.module('platformWebApp')
5455
}
5556
);
5657
}
57-
else if (attrs.numType === "positiveInteger") {
58+
else if (attrs.numType === 'positiveInteger') {
5859
ctrl.$parsers.unshift(function (viewValue) {
5960
ctrl.$setValidity('positiveInteger', INTEGER_REGEXP.test(viewValue) && viewValue > 0);
6061
return viewValue;

0 commit comments

Comments
 (0)