fix: relationship to many creation

This commit is contained in:
Arman
2023-04-03 09:44:14 +02:00
parent 2059e4142b
commit 7da96eef2f
2 changed files with 4 additions and 8 deletions
@@ -11,7 +11,7 @@
export let id: string;
export let label: string;
export let optionalText: string | undefined = undefined;
export let value: string | number | boolean | null;
export let value: string | number | boolean | null | string[];
export let editing = false;
export let attribute:
| Models.AttributeBoolean
@@ -68,12 +68,6 @@
//Reactive statements
$: getDocuments(search).then((res) => (documentList = res));
$: if (!!attribute?.type && isRelationshipToMany(attribute)) {
// value = relatedList;
} else {
value = singleRel;
}
$: paginatedItems = editing
? relatedList
.slice()
@@ -163,6 +157,7 @@
bind:value={relatedList[total]}
options={options?.filter((n) => !relatedList.includes(n.value))}
on:select={() => {
value = relatedList;
showInput = false;
}}
let:option={o}>
@@ -254,7 +249,8 @@
bind:search
bind:value={singleRel}
{options}
let:option={o}>
let:option={o}
on:select={() => (value = singleRel)}>
<SelectSearchItem data={o.data}>
{o.label}
</SelectSearchItem>