Display renderer
This commit is contained in:
parent
b13d47e88d
commit
7133fc0a13
|
@ -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}
|
||||
/>
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue