2022-06-08 14:03:26 +00:00
|
|
|
<script lang="ts">
|
|
|
|
import core, { Ref, Space, WithLookup } from '@anticrm/core'
|
2022-06-08 15:49:50 +00:00
|
|
|
import { IntlString, translate } from '@anticrm/platform'
|
2022-06-08 14:03:26 +00:00
|
|
|
import { getClient } from '@anticrm/presentation'
|
2022-06-10 09:44:46 +00:00
|
|
|
import { IssuesDateModificationPeriod, IssuesGrouping, IssuesOrdering, Team, ViewOptions } from '@anticrm/tracker'
|
2022-06-08 15:49:50 +00:00
|
|
|
import { Button, IconDetails } from '@anticrm/ui'
|
2022-06-08 14:03:26 +00:00
|
|
|
import view, { Filter, Viewlet } from '@anticrm/view'
|
2022-06-08 15:49:50 +00:00
|
|
|
import { FilterBar } from '@anticrm/view-resources'
|
|
|
|
import tracker from '../../plugin'
|
2022-06-08 14:03:26 +00:00
|
|
|
import IssuesContent from './IssuesContent.svelte'
|
|
|
|
import IssuesHeader from './IssuesHeader.svelte'
|
|
|
|
|
|
|
|
export let currentSpace: Ref<Team> | undefined
|
|
|
|
export let query = {}
|
|
|
|
export let title: IntlString | undefined = undefined
|
|
|
|
export let label: string = ''
|
|
|
|
|
2022-06-08 15:49:50 +00:00
|
|
|
export let panelWidth: number = 0
|
|
|
|
|
2022-06-08 14:03:26 +00:00
|
|
|
let viewlet: WithLookup<Viewlet> | undefined = undefined
|
|
|
|
let filters: Filter[]
|
2022-06-10 09:44:46 +00:00
|
|
|
let viewOptions: ViewOptions = {
|
2022-06-08 14:03:26 +00:00
|
|
|
groupBy: IssuesGrouping.Status,
|
|
|
|
orderBy: IssuesOrdering.Status,
|
|
|
|
completedIssuesPeriod: IssuesDateModificationPeriod.All,
|
2022-06-10 09:44:46 +00:00
|
|
|
shouldShowEmptyGroups: false,
|
|
|
|
shouldShowSubIssues: false
|
2022-06-08 14:03:26 +00:00
|
|
|
}
|
|
|
|
let resultQuery = {}
|
|
|
|
|
|
|
|
const client = getClient()
|
|
|
|
|
|
|
|
let viewlets: WithLookup<Viewlet>[] = []
|
|
|
|
|
|
|
|
$: update(currentSpace)
|
|
|
|
|
|
|
|
async function update (currentSpace?: Ref<Space>): Promise<void> {
|
|
|
|
const space = await client.findOne(core.class.Space, { _id: currentSpace })
|
|
|
|
if (space) {
|
|
|
|
viewlets = await client.findAll(
|
|
|
|
view.class.Viewlet,
|
|
|
|
{ attachTo: tracker.class.Issue },
|
|
|
|
{
|
|
|
|
lookup: {
|
|
|
|
descriptor: view.class.ViewletDescriptor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
;[viewlet] = viewlets
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$: if (!label && title) {
|
|
|
|
translate(title, {}).then((res) => {
|
|
|
|
label = res
|
|
|
|
})
|
|
|
|
}
|
2022-06-08 15:49:50 +00:00
|
|
|
|
|
|
|
let asideFloat: boolean = false
|
|
|
|
let asideShown: boolean = true
|
|
|
|
$: if (panelWidth < 900 && !asideFloat) asideFloat = true
|
|
|
|
$: if (panelWidth >= 900 && asideFloat) {
|
|
|
|
asideFloat = false
|
|
|
|
asideShown = false
|
|
|
|
}
|
|
|
|
let docWidth: number
|
|
|
|
let docSize: boolean = false
|
|
|
|
$: if (docWidth <= 900 && !docSize) docSize = true
|
|
|
|
$: if (docWidth > 900 && docSize) docSize = false
|
2022-06-08 14:03:26 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if currentSpace}
|
2022-06-10 18:25:13 +00:00
|
|
|
<IssuesHeader {currentSpace} {viewlets} {label} bind:viewlet bind:viewOptions bind:filters>
|
|
|
|
<svelte:fragment slot="extra">
|
|
|
|
{#if asideFloat && $$slots.aside}
|
|
|
|
<Button
|
|
|
|
icon={IconDetails}
|
|
|
|
kind={'transparent'}
|
|
|
|
size={'medium'}
|
|
|
|
selected={asideShown}
|
|
|
|
on:click={() => {
|
|
|
|
asideShown = !asideShown
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
{/if}
|
|
|
|
</svelte:fragment>
|
|
|
|
</IssuesHeader>
|
|
|
|
<FilterBar _class={tracker.class.Issue} {query} bind:filters on:change={(e) => (resultQuery = e.detail)} />
|
2022-06-08 14:03:26 +00:00
|
|
|
<div class="flex h-full">
|
|
|
|
<div class="antiPanel-component">
|
|
|
|
<IssuesContent {currentSpace} {viewlet} query={resultQuery} {viewOptions} />
|
|
|
|
</div>
|
2022-06-08 15:49:50 +00:00
|
|
|
{#if $$slots.aside !== undefined && asideShown}
|
|
|
|
<div class="popupPanel-body__aside" class:float={asideFloat} class:shown={asideShown}>
|
2022-06-08 14:03:26 +00:00
|
|
|
<slot name="aside" />
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
{/if}
|