From b4cc7c677677b4074d6f10f497570f19858e12d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Tue, 9 Feb 2021 15:35:09 +0100 Subject: [PATCH] initial work on handling single vs multiple values in builder components --- .../common/LinkedRowSelector.svelte | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/packages/builder/src/components/common/LinkedRowSelector.svelte b/packages/builder/src/components/common/LinkedRowSelector.svelte index a9a05cf12b..5cacd7c236 100644 --- a/packages/builder/src/components/common/LinkedRowSelector.svelte +++ b/packages/builder/src/components/common/LinkedRowSelector.svelte @@ -8,6 +8,8 @@ export let schema export let linkedRows = [] + console.log(schema) + console.log(linkedRows) let rows = [] $: label = capitalise(schema.name) @@ -31,6 +33,12 @@ function getPrettyName(row) { return row[linkedTable.primaryDisplay || "_id"] } + + let oneToManyRow = getPrettyName(linkedRows[0]) || '' + + function oneToManyValueSetter(value) { + linkedRows = [value] + } {#if linkedTable.primaryDisplay == null} @@ -41,13 +49,22 @@ table. {:else} - - {#each rows as row} - - {/each} - + {#if schema.oneToMany} + + {:else} + + {#each rows as row} + + {/each} + + {/if} {/if}