Fixed value of value CSA when no default value is set and clear() action is used. (#11409)

This commit is contained in:
Devanshu Rastogi 2024-12-04 13:52:33 +05:30 committed by GitHub
parent c3b14dac27
commit 05b25cfe82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View file

@ -236,7 +236,7 @@ export const numberinputConfig = {
},
],
exposedVariables: {
value: 99,
value: 0,
isMandatory: false,
isVisible: true,
isDisabled: false,

View file

@ -72,6 +72,9 @@ export const NumberInput = function NumberInput({
useEffect(() => {
setInputValue(Number(parseFloat(properties.value).toFixed(properties.decimalPlaces)));
if (isNaN(Number(parseFloat(properties.value).toFixed(properties.decimalPlaces)))) {
setExposedVariable('value', null);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [properties.value]);
@ -144,6 +147,7 @@ export const NumberInput = function NumberInput({
},
clear: async function () {
setInputValue('');
setExposedVariable('value', null);
fireEvent('onChange');
},
setLoading: async function (loading) {
@ -167,7 +171,8 @@ export const NumberInput = function NumberInput({
};
if (!isNaN(value)) {
exposedVariables.value = value;
}
} else exposedVariables.value = null;
setExposedVariables(exposedVariables);
isInitialRender.current = false;

View file

@ -236,7 +236,7 @@ export const numberinputConfig = {
},
],
exposedVariables: {
value: 99,
value: 0,
isMandatory: false,
isVisible: true,
isDisabled: false,

View file

@ -236,7 +236,7 @@ export const numberinputConfig = {
},
],
exposedVariables: {
value: 99,
value: 0,
isMandatory: false,
isVisible: true,
isDisabled: false,