2022-07-01 06:14:31 +00:00
|
|
|
<script lang="ts">
|
2022-09-21 08:08:25 +00:00
|
|
|
import { Class, Doc, Ref } from '@hcengineering/core'
|
|
|
|
import { Issue } from '@hcengineering/tracker'
|
2022-09-09 03:44:33 +00:00
|
|
|
import RelationEditorPart from './RelationEditorPart.svelte'
|
2022-07-01 06:14:31 +00:00
|
|
|
|
|
|
|
export let value: Issue
|
2022-09-09 03:44:33 +00:00
|
|
|
export let type: 'isBlocking' | 'blockedBy' | 'relations'
|
|
|
|
export let blockedBy: Doc[] | undefined = undefined
|
|
|
|
|
|
|
|
$: valueGroup = (type === 'isBlocking' ? blockedBy ?? [] : value[type] ?? []).reduce<
|
|
|
|
Map<Ref<Class<Doc>>, Ref<Doc>[]>
|
|
|
|
>((rv, x) => {
|
|
|
|
if (rv.has(x._class)) {
|
|
|
|
rv.get(x._class)?.push(x._id)
|
|
|
|
} else {
|
|
|
|
rv.set(x._class, [x._id])
|
2022-07-01 06:14:31 +00:00
|
|
|
}
|
2022-09-09 03:44:33 +00:00
|
|
|
return rv
|
|
|
|
}, new Map())
|
|
|
|
|
|
|
|
$: classes = Array.from(valueGroup.keys())
|
2022-07-01 06:14:31 +00:00
|
|
|
</script>
|
|
|
|
|
2023-09-06 15:52:48 +00:00
|
|
|
<div class="flex-column flex-grow clear-mins">
|
2022-09-09 03:44:33 +00:00
|
|
|
{#each classes as classCategory}
|
|
|
|
{@const vals = valueGroup.get(classCategory)}
|
|
|
|
{#if vals}
|
|
|
|
<RelationEditorPart {value} _class={classCategory} documentIds={vals} {type} />
|
2022-07-01 06:14:31 +00:00
|
|
|
{/if}
|
|
|
|
{/each}
|
|
|
|
</div>
|