Properly parse number cells as floats

This commit is contained in:
Andrew Kingston 2023-04-27 12:25:21 +01:00
parent 5728cf9b2a
commit 0e0ee590c8
1 changed files with 8 additions and 1 deletions

View File

@ -2,6 +2,13 @@
import TextCell from "./TextCell.svelte"
export let api
export let onChange
const numberOnChange = value => {
const float = parseFloat(value)
const newValue = isNaN(float) ? null : float
onChange(newValue)
}
</script>
<TextCell {...$$props} bind:api type="number" />
<TextCell {...$$props} onChange={numberOnChange} bind:api type="number" />