1
0
Fork 0
mirror of synced 2024-09-30 09:07:25 +13:00

Use string renderer for datetime fields with custom templates

This commit is contained in:
Andrew Kingston 2022-06-27 14:44:52 +01:00
parent c4730c36ba
commit 148c916416

View file

@ -26,12 +26,20 @@
array: ArrayRenderer, array: ArrayRenderer,
internal: InternalRenderer, internal: InternalRenderer,
} }
$: type = schema?.type ?? "string" $: type = getType(schema)
$: customRenderer = customRenderers?.find(x => x.column === schema?.name) $: customRenderer = customRenderers?.find(x => x.column === schema?.name)
$: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer $: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
$: width = schema?.width || "150px" $: width = schema?.width || "150px"
$: cellValue = getCellValue(value, schema.template) $: cellValue = getCellValue(value, schema.template)
const getType = schema => {
// Use a string renderer for dates if we use a custom template
if (schema?.type === "datetime" && schema?.template) {
return "string"
}
return schema?.type || "string"
}
const getCellValue = (value, template) => { const getCellValue = (value, template) => {
if (!template) { if (!template) {
return value return value