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>
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>
<RelationshipField {...$$props} {schema} datasourceType={"user"} />
<RelationshipField
{...$$props}
datasourceType={"user"}
primaryDisplay={"email"}
/>

View File

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