Ensure new row cells don't use custom formats

This commit is contained in:
Andrew Kingston 2025-01-30 13:40:14 +00:00
parent 2e0543eed8
commit dd3c68ec0f
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View File

@ -3,6 +3,7 @@
import GridCell from "./GridCell.svelte"
import { getCellRenderer } from "../lib/renderers"
import { derived, writable } from "svelte/store"
import TextCell from "./TextCell.svelte"
const {
rows,
@ -36,7 +37,10 @@
let api
$: value = column.format ? column.format(row) : row[column.name]
// Get the appropriate cell renderer and value
$: hasCustomFormat = column.format && !row._isNewRow
$: renderer = hasCustomFormat ? TextCell : getCellRenderer(column)
$: value = hasCustomFormat ? column.format(row) : row[column.name]
// Get the error for this cell if the cell is focused or selected
$: error = getErrorStore(rowFocused, cellId)
@ -138,7 +142,7 @@
}}
>
<svelte:component
this={getCellRenderer(column)}
this={renderer}
bind:api
{value}
schema={column.schema}

View File

@ -50,9 +50,6 @@ function getCellRendererByType(type: FieldType | "role" | undefined) {
}
export const getCellRenderer = (column: UIColumn) => {
if (column.format) {
return TextCell
}
if (column.calculationType) {
return NumberCell
}