edges reordser fix

This commit is contained in:
2023-11-01 13:09:32 +02:00
parent 7ac59fc0fe
commit 1442b68503
4 changed files with 24 additions and 24 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"main.js": {
"file": "assets/main.016edc6c.js",
"file": "assets/main.96863591.js",
"src": "main.js",
"isEntry": true,
"css": [
@@ -21,7 +21,6 @@
.map((edge) => {
return graph.records.find((increc) => increc.id === edge.target && record.id === edge.source);
}).filter((rec) => (rec?.id ? true : false)) ?? [];
let collections = channel.schemas.filter((aschema) =>
field.collections.includes(aschema.name)
);
@@ -44,7 +43,7 @@
function insert(e) {
e.preventDefault();
graph = insertEdges(graph,record,e.detail.records,field.name,e.detail.action);
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
}
$:visibleColumns = [];
@@ -62,11 +61,11 @@
{/if}
<div class="inline-card-wrapper">
<ReferenceInlineButtons
buttonClass="mt-2"
recordId={null}
schemas={collections}
on:insert={insert}
on:save={insert}
buttonClass="mt-2"
recordId={null}
schemas={collections}
on:insert={insert}
on:save={insert}
/>
</div>
{#if references.length > 0}
@@ -78,11 +77,11 @@
{#each visibleColumns as field}
<th
class="field-ui-{field.ui}"
scope="col"
title={field.help}
data-bs-toggle="tooltip"
data-bs-placement="top">{field.label}</th
class="field-ui-{field.ui}"
scope="col"
title={field.help}
data-bs-toggle="tooltip"
data-bs-placement="top">{field.label}</th
>
{/each}
<th/>
@@ -95,9 +94,9 @@
<div class="">
<div class="d-flex align-items-center">
<a
class="me-2 text-decoration-none text-dark fs-6"
href="{channel.lucentUrl}/records/{record.id}"
target="_blank"
class="me-2 text-decoration-none text-dark fs-6"
href="{channel.lucentUrl}/records/{record.id}"
target="_blank"
>
{previewTitle(channel.schemas, record)}
</a>
@@ -107,17 +106,17 @@
{#each visibleColumns as field, index}
<td class="field-ui-{field.ui}">
<RenderField
{record}
{graph}
schema={collection}
{field}
{record}
{graph}
schema={collection}
{field}
/>
</td>
{/each}
<td>
<button
class="trash-button text-dark btn btn-sm btn-link"
on:click={(e) =>
class="trash-button text-dark btn btn-sm btn-link"
on:click={(e) =>
removeReference(e, record.id)}
>
<Icon icon="trash-can"/>
@@ -8,6 +8,7 @@ export function insertEdges(graph, sourceRecord, targetRecords, fieldName, actio
sourceSchema: sourceRecord.schema,
targetSchema: r.schema,
field: fieldName,
depth: 1,
rank: ""
};
});
@@ -18,6 +19,6 @@ export function insertEdges(graph, sourceRecord, targetRecords, fieldName, actio
}
graph.records = uniqBy([...graph.records, ...targetRecords], (r) => r.id);
graph.edges = uniqBy([...replacedEdges, ...newEdges], (edge) => edge.source + edge.target + edge.field);
graph.edges = uniqBy([...replacedEdges, ...newEdges], (edge) => edge.source + edge.target + edge.field + edge.depth);
return graph;
}