diff --git a/packages/bbui/src/Table/CellRenderer.svelte b/packages/bbui/src/Table/CellRenderer.svelte index 49d7264671..89f7e8716d 100644 --- a/packages/bbui/src/Table/CellRenderer.svelte +++ b/packages/bbui/src/Table/CellRenderer.svelte @@ -11,22 +11,23 @@ export let customRenderers = [] const plainTypes = ["string", "options", "number", "longform"] + const typeMap = { + boolean: BooleanRenderer, + datetime: DateTimeRenderer, + link: RelationshipRenderer, + attachment: AttachmentRenderer, + string: StringRenderer, + options: StringRenderer, + number: StringRenderer, + longform: StringRenderer, + } $: type = schema?.type ?? "string" $: customRenderer = customRenderers?.find(x => x.column === schema?.name) + $: renderer = customRenderer?.component ?? typeMap[type] -{#if value != null && value !== ''} - {#if customRenderer} - - {:else if plainTypes.includes(type)} - - {:else if type === 'boolean'} - - {:else if type === 'datetime'} - - {:else if type === 'link'} - - {:else if type === 'attachment'} - - {/if} +{#if renderer && value != null && value !== ''} + + + {/if} diff --git a/packages/bbui/src/Table/StringRenderer.svelte b/packages/bbui/src/Table/StringRenderer.svelte index 2756839616..ae95297dfc 100644 --- a/packages/bbui/src/Table/StringRenderer.svelte +++ b/packages/bbui/src/Table/StringRenderer.svelte @@ -3,6 +3,7 @@
{value}
+