TP-40583 update text field data before triggering value change action… (#183)

This commit is contained in:
Hitesh Kumar
2023-09-20 12:58:34 +05:30
committed by GitHub
parent 03f52aff59
commit dc094af136

View File

@@ -298,14 +298,14 @@ class CustomTextFieldRenderer(
if (!updatedInput.isInvalidInput(property.invalidCharRegex)) {
property.maxChar?.let { maxChar ->
if (maxChar >= updatedInput.length) {
inputValue = updatedInput
val transformedText = transformInput(
property.valueTransformation,
updatedInput
)
val transformedText = transformInput(property.valueTransformation, updatedInput)
if (property.isDataMutable.orFalse()) {
uiTronViewModel.handle[property.layoutId.getDataId()] =
customTextFieldData?.copy(inputText = transformedText)
}
inputValue = transformedText
customTextFieldData?.inputText = transformedText
uiTronViewModel.handle[property.layoutId.getInputId()] =
transformedText
uiTronViewModel.handle[property.layoutId.getInputId()] = transformedText
if (property.applyValidationOnValueChange.orFalse() || customTextFieldData?.hasError == true) {
uiTronViewModel.handleActions(customTextFieldData?.onValueChangeAction)
}
@@ -316,22 +316,18 @@ class CustomTextFieldRenderer(
return customTextFieldData?.inputText.orEmpty()
}
} ?: run {
inputValue = updatedInput
val transformedText = transformInput(
property.valueTransformation,
updatedInput
)
val transformedText = transformInput(property.valueTransformation, updatedInput)
if (property.isDataMutable.orFalse()) {
uiTronViewModel.handle[property.layoutId.getDataId()] =
customTextFieldData?.copy(inputText = transformedText)
}
inputValue = transformedText
customTextFieldData?.inputText = transformedText
uiTronViewModel.handle[property.layoutId.getInputId()] =
transformedText
uiTronViewModel.handle[property.layoutId.getInputId()] = transformedText
if (property.applyValidationOnValueChange.orFalse() || customTextFieldData?.hasError == true) {
uiTronViewModel.handleActions(customTextFieldData?.onValueChangeAction)
}
}
if (property.isDataMutable.orFalse()) {
uiTronViewModel.handle[property.layoutId.getDataId()] =
customTextFieldData?.copy(inputText = inputValue)
}
updateMvelValuesInActions(
customTextFieldData?.onInputValueChangeAction?.actions,
mapOf(
@@ -341,6 +337,8 @@ class CustomTextFieldRenderer(
)
)
uiTronViewModel.handleActions(customTextFieldData?.onInputValueChangeAction)
} else {
return customTextFieldData?.inputText.orEmpty()
}
return inputValue
}