Display renderer

This commit is contained in:
Adria Navarro 2024-04-22 15:31:38 +02:00
parent b13d47e88d
commit 7133fc0a13
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,21 @@
<script>
import BbReferenceCell from "./BBReferenceCell.svelte"
export let value
export let onChange
export let api
$: arrayValue = (!Array.isArray(value) && value ? [value] : value) || []
$: onValueChange = value => {
value = value[0] || null
onChange(value)
}
</script>
<BbReferenceCell
bind:api
{...$$restProps}
value={arrayValue}
onChange={onValueChange}
/>

View File

@ -13,6 +13,7 @@ import JSONCell from "../cells/JSONCell.svelte"
import AttachmentCell from "../cells/AttachmentCell.svelte"
import AttachmentSingleCell from "../cells/AttachmentSingleCell.svelte"
import BBReferenceCell from "../cells/BBReferenceCell.svelte"
import BBReferenceSingleCell from "../cells/BBReferenceSingleCell.svelte"
const TypeComponentMap = {
[FieldType.STRING]: TextCell,
@ -29,6 +30,7 @@ const TypeComponentMap = {
[FieldType.FORMULA]: FormulaCell,
[FieldType.JSON]: JSONCell,
[FieldType.BB_REFERENCE]: BBReferenceCell,
[FieldType.BB_REFERENCE_SINGLE]: BBReferenceSingleCell,
}
export const getCellRenderer = column => {
return TypeComponentMap[column?.schema?.type] || TextCell