Fix display

This commit is contained in:
Adria Navarro 2023-09-20 17:22:07 +02:00
parent 2bc96addc2
commit db2fcf3606
2 changed files with 11 additions and 9 deletions

View File

@ -1,11 +1,9 @@
<script> <script>
import RelationshipField from "./RelationshipField.svelte" import RelationshipField from "./RelationshipField.svelte"
const schema = {
...$$props.schema,
// This is not really used, just adding some content to be able to render the relationship cell
tableId: "external",
}
</script> </script>
<RelationshipField {...$$props} {schema} datasourceType={"user"} /> <RelationshipField
{...$$props}
datasourceType={"user"}
primaryDisplay={"email"}
/>

View File

@ -17,6 +17,7 @@
export let onChange export let onChange
export let filter export let filter
export let datasourceType = "table" export let datasourceType = "table"
export let primaryDisplay
let fieldState let fieldState
let fieldApi let fieldApi
@ -25,6 +26,9 @@
let searchTerm let searchTerm
let open let open
$: type =
datasourceType === "table" ? FieldTypes.LINK : FieldTypes.BB_REFERENCE
$: multiselect = fieldSchema?.relationshipType !== "one-to-many" $: multiselect = fieldSchema?.relationshipType !== "one-to-many"
$: linkedTableId = fieldSchema?.tableId $: linkedTableId = fieldSchema?.tableId
$: fetch = fetchData({ $: fetch = fetchData({
@ -45,7 +49,7 @@
: flatten(fieldState?.value)?.[0] : flatten(fieldState?.value)?.[0]
$: component = multiselect ? CoreMultiselect : CoreSelect $: component = multiselect ? CoreMultiselect : CoreSelect
$: expandedDefaultValue = expand(defaultValue) $: expandedDefaultValue = expand(defaultValue)
$: primaryDisplay = tableDefinition?.primaryDisplay $: primaryDisplay = primaryDisplay || tableDefinition?.primaryDisplay
let optionsObj = {} let optionsObj = {}
let initialValuesProcessed let initialValuesProcessed
@ -162,7 +166,7 @@
{disabled} {disabled}
{validation} {validation}
defaultValue={expandedDefaultValue} defaultValue={expandedDefaultValue}
type={FieldTypes.LINK} {type}
bind:fieldState bind:fieldState
bind:fieldApi bind:fieldApi
bind:fieldSchema bind:fieldSchema