Properly parse number cells as floats
This commit is contained in:
parent
5728cf9b2a
commit
0e0ee590c8
|
@ -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" />
|
||||
|
|
Loading…
Reference in New Issue