Browse Source
Merge pull request #6473 from Budibase/fix/dates-with-custom-templates
Fix dates with custom templates
pull/6554/head
Martin McKeaveney
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
2 deletions
-
packages/bbui/src/Table/CellRenderer.svelte
-
packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnDrawer.svelte
|
|
|
@ -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 |
|
|
|
|
|
|
|
@ -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; |
|
|
|
|