diff --git a/app/src/main/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/providers/InputFieldsProvider.kt b/app/src/main/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/providers/InputFieldsProvider.kt index dbbc2040ee..4dd1678f0e 100644 --- a/app/src/main/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/providers/InputFieldsProvider.kt +++ b/app/src/main/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/providers/InputFieldsProvider.kt @@ -9,6 +9,8 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag +import androidx.compose.ui.text.TextRange +import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import org.dhis2.R import org.dhis2.commons.resources.ResourceManager @@ -51,8 +53,14 @@ fun ProvideInputDate( ) { if (uiModel.showField) { Spacer(modifier = Modifier.height(16.dp)) + val textSelection = TextRange(if (uiModel.eventDate.dateValue != null) uiModel.eventDate.dateValue.length else 0) + var value by remember(uiModel.eventDate.dateValue) { - mutableStateOf(uiModel.eventDate.dateValue?.let { formatStoredDateToUI(it) }) + if (uiModel.eventDate.dateValue != null) { + mutableStateOf(TextFieldValue(formatStoredDateToUI(uiModel.eventDate.dateValue) ?: "", textSelection)) + } else { + mutableStateOf(TextFieldValue()) + } } var state by remember { @@ -62,25 +70,21 @@ fun ProvideInputDate( InputDateTime( title = uiModel.eventDate.label ?: "", allowsManualInput = uiModel.allowsManualInput, - value = value, + inputTextFieldValue = value, actionIconType = DateTimeActionIconType.DATE, onActionClicked = uiModel.onDateClick, state = state, visualTransformation = DateTransformation(), onValueChanged = { value = it - state = getInputShellStateBasedOnValue(it) - manageActionBasedOnValue(uiModel, it) + state = getInputShellStateBasedOnValue(it.text) + manageActionBasedOnValue(uiModel, it.text) }, isRequired = uiModel.required, modifier = modifier.testTag(INPUT_EVENT_INITIAL_DATE), onFocusChanged = { focused -> - if (!focused) { - value?.let { - if (!isValid(it)) { - state = InputShellState.ERROR - } - } + if (!focused && !isValid(value.text)) { + state = InputShellState.ERROR } }, ) diff --git a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/DateProvider.kt b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/DateProvider.kt index 2d79a341e3..3083b5dfc3 100644 --- a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/DateProvider.kt +++ b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/DateProvider.kt @@ -8,6 +8,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.text.TextRange +import androidx.compose.ui.text.input.TextFieldValue import org.dhis2.commons.date.DateUtils import org.dhis2.commons.extensions.toDate import org.dhis2.form.extensions.inputState @@ -36,14 +38,21 @@ fun ProvideInputDate( ValueType.TIME -> DateTimeActionIconType.TIME to TimeTransformation() else -> DateTimeActionIconType.DATE to DateTransformation() } + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value?.let { formatStoredDateToUI(it, fieldUiModel.valueType) }) + mutableStateOf( + if (fieldUiModel.value != null) { + TextFieldValue(formatStoredDateToUI(fieldUiModel.value!!, fieldUiModel.valueType), textSelection) + } else { + TextFieldValue() + }, + ) } InputDateTime( title = fieldUiModel.label, - value = value, + inputTextFieldValue = value, actionIconType = actionType, onActionClicked = { when (actionType) { @@ -51,7 +60,7 @@ fun ProvideInputDate( RecyclerViewUiEvents.OpenCustomCalendar( uid = fieldUiModel.uid, label = fieldUiModel.label, - date = value?.toDate(), + date = value.text.toDate(), allowFutureDates = fieldUiModel.allowFutureDates ?: true, isDateTime = false, ), @@ -61,7 +70,7 @@ fun ProvideInputDate( RecyclerViewUiEvents.OpenTimePicker( uid = fieldUiModel.uid, label = fieldUiModel.label, - date = formatUIDateToStored(value, fieldUiModel.valueType)?.let { + date = formatUIDateToStored(value.text, fieldUiModel.valueType)?.let { DateUtils.timeFormat().parse(it) }, isDateTime = false, @@ -72,7 +81,7 @@ fun ProvideInputDate( RecyclerViewUiEvents.OpenCustomCalendar( uid = fieldUiModel.uid, label = fieldUiModel.label, - date = formatUIDateToStored(value, fieldUiModel.valueType)?.let { + date = formatUIDateToStored(value.text, fieldUiModel.valueType)?.let { DateUtils.databaseDateFormatNoSeconds().parse(it) }, allowFutureDates = fieldUiModel.allowFutureDates ?: true, @@ -81,7 +90,7 @@ fun ProvideInputDate( ) } }, - modifier = modifier.semantics { contentDescription = formatStoredDateToUI(value ?: "", fieldUiModel.valueType) }, + modifier = modifier.semantics { contentDescription = formatStoredDateToUI(value.text, fieldUiModel.valueType) }, state = fieldUiModel.inputState(), legendData = fieldUiModel.legend(), supportingText = fieldUiModel.supportingText(), @@ -94,7 +103,7 @@ fun ProvideInputDate( intentHandler.invoke( FormIntent.OnTextChange( uid = fieldUiModel.uid, - value = formatUIDateToStored(it, fieldUiModel.valueType), + value = formatUIDateToStored(it.text, fieldUiModel.valueType), valueType = fieldUiModel.valueType, allowFutureDates = fieldUiModel.allowFutureDates ?: true, ), diff --git a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/FieldProvider.kt b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/FieldProvider.kt index 8039db46dc..625a51a7e5 100644 --- a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/FieldProvider.kt +++ b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/FieldProvider.kt @@ -23,7 +23,9 @@ import androidx.compose.ui.geometry.Rect import androidx.compose.ui.geometry.Size import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.TextFieldValue import kotlinx.coroutines.launch import org.dhis2.commons.resources.ResourceManager import org.dhis2.form.extensions.autocompleteList @@ -447,8 +449,10 @@ private fun ProvideIntegerPositive( focusManager: FocusManager, onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputPositiveInteger( @@ -457,15 +461,15 @@ private fun ProvideIntegerPositive( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -486,8 +490,10 @@ private fun ProvideIntegerPositiveOrZero( onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputPositiveIntegerOrZero( @@ -496,15 +502,15 @@ private fun ProvideIntegerPositiveOrZero( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -525,8 +531,10 @@ private fun ProvidePercentage( onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputPercentage( @@ -535,15 +543,15 @@ private fun ProvidePercentage( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -564,8 +572,10 @@ private fun ProvideNumber( onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputNumber( @@ -574,15 +584,15 @@ private fun ProvideNumber( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -604,8 +614,9 @@ private fun ProvideIntegerNegative( onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value?.replace("-", "")) + mutableStateOf(TextFieldValue(fieldUiModel.value?.replace("-", "") ?: "", textSelection)) } InputNegativeInteger( @@ -614,15 +625,15 @@ private fun ProvideIntegerNegative( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -643,8 +654,10 @@ private fun ProvideLongText( onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputLongText( @@ -653,15 +666,15 @@ private fun ProvideLongText( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -683,8 +696,9 @@ private fun ProvideLetter( onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputLetter( @@ -693,15 +707,15 @@ private fun ProvideLetter( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -722,8 +736,9 @@ private fun ProvideInteger( onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputInteger( @@ -732,15 +747,15 @@ private fun ProvideInteger( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -761,8 +776,10 @@ private fun ProvideEmail( focusManager: FocusManager, onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputEmail( @@ -771,15 +788,15 @@ private fun ProvideEmail( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -788,7 +805,7 @@ private fun ProvideEmail( uiEventHandler.invoke( RecyclerViewUiEvents.OpenChooserIntent( Intent.ACTION_SENDTO, - value, + value.text, fieldUiModel.uid, ), ) @@ -810,8 +827,10 @@ private fun ProvideInputPhoneNumber( onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputPhoneNumber( @@ -820,15 +839,15 @@ private fun ProvideInputPhoneNumber( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -837,7 +856,7 @@ private fun ProvideInputPhoneNumber( uiEventHandler.invoke( RecyclerViewUiEvents.OpenChooserIntent( Intent.ACTION_DIAL, - value, + value.text, fieldUiModel.uid, ), ) @@ -859,8 +878,10 @@ private fun ProvideInputLink( onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputLink( @@ -869,15 +890,15 @@ private fun ProvideInputLink( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -886,7 +907,7 @@ private fun ProvideInputLink( uiEventHandler.invoke( RecyclerViewUiEvents.OpenChooserIntent( Intent.ACTION_VIEW, - value, + value.text, fieldUiModel.uid, ), ) diff --git a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/InputsForTextValueTypeProvider.kt b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/InputsForTextValueTypeProvider.kt index e51321a7bb..9d069fdea0 100644 --- a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/InputsForTextValueTypeProvider.kt +++ b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/InputsForTextValueTypeProvider.kt @@ -8,6 +8,8 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusManager +import androidx.compose.ui.text.TextRange +import androidx.compose.ui.text.input.TextFieldValue import org.dhis2.form.extensions.autocompleteList import org.dhis2.form.extensions.inputState import org.dhis2.form.extensions.legend @@ -71,8 +73,9 @@ private fun ProvideQRInput( focusManager: FocusManager, onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputQRCode( @@ -81,21 +84,21 @@ private fun ProvideQRInput( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) }, onQRButtonClicked = { - if (value.isNullOrEmpty()) { + if (value.text.isEmpty()) { uiEventHandler.invoke( RecyclerViewUiEvents.ScanQRCode( fieldUiModel.uid, @@ -108,7 +111,7 @@ private fun ProvideQRInput( RecyclerViewUiEvents.DisplayQRCode( fieldUiModel.uid, optionSet = fieldUiModel.optionSet, - value = value!!, + value = value.text, renderingType = fieldUiModel.renderingType, editable = fieldUiModel.editable, label = fieldUiModel.label, @@ -132,7 +135,7 @@ private fun ProvideDefaultTextInput( onNextClicked: () -> Unit, ) { var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "")) } InputText( modifier = modifier.fillMaxWidth(), @@ -140,15 +143,15 @@ private fun ProvideDefaultTextInput( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) @@ -169,8 +172,10 @@ private fun ProvideBarcodeInput( focusManager: FocusManager, onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputBarCode( @@ -179,21 +184,21 @@ private fun ProvideBarcodeInput( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) }, onActionButtonClicked = { - if (value.isNullOrEmpty()) { + if (value.text.isEmpty()) { uiEventHandler.invoke( RecyclerViewUiEvents.ScanQRCode( fieldUiModel.uid, @@ -206,7 +211,7 @@ private fun ProvideBarcodeInput( RecyclerViewUiEvents.DisplayQRCode( fieldUiModel.uid, optionSet = fieldUiModel.optionSet, - value = value!!, + value = value.text, renderingType = fieldUiModel.renderingType, editable = fieldUiModel.editable, label = fieldUiModel.label, diff --git a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/UnitIntervalInputProvider.kt b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/UnitIntervalInputProvider.kt index 9c4558ae90..eb7dfa93f8 100644 --- a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/UnitIntervalInputProvider.kt +++ b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/UnitIntervalInputProvider.kt @@ -7,6 +7,8 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.text.TextRange +import androidx.compose.ui.text.input.TextFieldValue import org.dhis2.form.extensions.inputState import org.dhis2.form.extensions.legend import org.dhis2.form.extensions.supportingText @@ -21,8 +23,10 @@ fun ProvideUnitIntervalInput( intentHandler: (FormIntent) -> Unit, onNextClicked: () -> Unit, ) { + val textSelection = TextRange(if (fieldUiModel.value != null) fieldUiModel.value!!.length else 0) + var value by remember(fieldUiModel.value) { - mutableStateOf(fieldUiModel.value) + mutableStateOf(TextFieldValue(fieldUiModel.value ?: "", textSelection)) } InputUnitInterval( modifier = modifier.fillMaxWidth(), @@ -30,15 +34,15 @@ fun ProvideUnitIntervalInput( state = fieldUiModel.inputState(), supportingText = fieldUiModel.supportingText(), legendData = fieldUiModel.legend(), - inputText = value ?: "", + inputTextFieldValue = value, isRequiredField = fieldUiModel.mandatory, onNextClicked = onNextClicked, onValueChanged = { - value = it + value = it ?: TextFieldValue() intentHandler( FormIntent.OnTextChange( fieldUiModel.uid, - value, + value.text, fieldUiModel.valueType, ), ) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5173b968ea..b7e71c8cfa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ kotlin = '1.9.21' hilt = '2.47' hiltCompiler = '1.0.0' jacoco = '0.8.10' -designSystem = "0.2-20240123.112704-7" +designSystem = "0.2-20240206.071329-16" dhis2sdk = "1.10.0-20240119.100209-6" ruleEngine = "2.1.9" appcompat = "1.6.1"