Allow numbers starting with dot in WidgetNumber (#11108)

[Screencast from 2024-09-17 13-20-40.webm](https://github.com/user-attachments/assets/561adebb-7d93-4939-9dde-5453d5f304be)

(cherry picked from commit 5725e2427d)
This commit is contained in:
Adam Obuchowicz 2024-09-17 15:07:06 +02:00 committed by James Dunkerley
parent 0857604f8e
commit 5c4fe1b07a
2 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,7 @@
- [Fixed files associations not properly registered on Windows][11030]
- [Fixed "rename project" button being broken after not changing project
name][11103]
- [Numbers starting with dot (`.5`) are accepted in Numeric Widget][11108]
[10774]: https://github.com/enso-org/enso/pull/10774
[10814]: https://github.com/enso-org/enso/pull/10814
@ -31,6 +32,7 @@
[11014]: https://github.com/enso-org/enso/pull/11014
[11030]: https://github.com/enso-org/enso/pull/11030
[11103]: https://github.com/enso-org/enso/pull/11103
[11108]: https://github.com/enso-org/enso/pull/11108
#### Enso Standard Library

View File

@ -28,6 +28,8 @@ const lastValidValue = ref<string>()
watch(editedValue, (newValue) => {
if (newValue == '' || isNumericLiteral(newValue)) {
lastValidValue.value = newValue
} else if (isNumericLiteral('0' + newValue)) {
lastValidValue.value = '0' + newValue
}
})
const valueString = computed(() => (props.modelValue != null ? props.modelValue.toString() : ''))