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 878fa637f7
2 changed files with 10 additions and 2 deletions

View File

@ -26,12 +26,20 @@
array: ArrayRenderer,
internal: InternalRenderer,
}
$: type = schema?.type ?? "string"
$: type = getType(schema)
$: customRenderer = customRenderers?.find(x => x.column === schema?.name)
$: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
$: width = schema?.width || "150px"
$: 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) => {
if (!template) {
return value

View File

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