Add number cell

This commit is contained in:
Andrew Kingston 2023-02-21 10:00:18 +00:00
parent e26163e274
commit 8316692ecf
3 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,5 @@
<script>
import TextCell from "./TextCell.svelte"
</script>
<TextCell {...$$props} type="number" />

View File

@ -6,6 +6,7 @@
import OptionsCell from "./OptionsCell.svelte"
import DateCell from "./DateCell.svelte"
import MultiSelectCell from "./MultiSelectCell.svelte"
import NumberCell from "./NumberCell.svelte"
export let table
export let filter
@ -83,6 +84,8 @@
return DateCell
} else if (type === "array") {
return MultiSelectCell
} else if (type === "number") {
return NumberCell
}
return TextCell
}

View File

@ -2,6 +2,7 @@
export let value
export let selected = false
export let onChange
export let type = "text"
const handleChange = e => {
onChange(e.target.value)
@ -9,7 +10,7 @@
</script>
{#if selected}
<input type="text" value={value || ""} on:change={handleChange} />
<input {type} value={value || ""} on:change={handleChange} />
{:else}
<div class="text-cell">
{value || ""}