Merge pull request #6473 from Budibase/fix/dates-with-custom-templates
Fix dates with custom templates
This commit is contained in:
commit
e0e5002bf6
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue