Merge pull request #6473 from Budibase/fix/dates-with-custom-templates

Fix dates with custom templates
This commit is contained in:
Martin McKeaveney 2022-07-04 09:36:37 +01:00 committed by GitHub
commit e0e5002bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

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

View File

@ -178,7 +178,7 @@
.column { .column {
gap: var(--spacing-l); gap: var(--spacing-l);
display: grid; display: grid;
grid-template-columns: 20px 1fr 1fr auto auto; grid-template-columns: 20px 1fr 1fr 16px 16px;
align-items: center; align-items: center;
border-radius: var(--border-radius-s); border-radius: var(--border-radius-s);
transition: background-color ease-in-out 130ms; transition: background-color ease-in-out 130ms;