mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-05 15:24:22 +00:00
Subissues list selection (#2644)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
0c1c11c7a4
commit
96a00697d4
@ -13,10 +13,17 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { DocumentQuery, Ref, WithLookup } from '@hcengineering/core'
|
import { Doc, DocumentQuery, Ref, WithLookup } from '@hcengineering/core'
|
||||||
import { Issue, IssueStatus, Team } from '@hcengineering/tracker'
|
import { Issue, IssueStatus, Team } from '@hcengineering/tracker'
|
||||||
import { Viewlet, ViewOptions } from '@hcengineering/view'
|
import { Viewlet, ViewOptions } from '@hcengineering/view'
|
||||||
import { ActionContext, List } from '@hcengineering/view-resources'
|
import {
|
||||||
|
ActionContext,
|
||||||
|
List,
|
||||||
|
ListSelectionProvider,
|
||||||
|
SelectDirection,
|
||||||
|
selectionStore
|
||||||
|
} from '@hcengineering/view-resources'
|
||||||
|
import { onDestroy } from 'svelte'
|
||||||
import tracker from '../../../plugin'
|
import tracker from '../../../plugin'
|
||||||
|
|
||||||
export let query: DocumentQuery<Issue> | undefined = undefined
|
export let query: DocumentQuery<Issue> | undefined = undefined
|
||||||
@ -28,6 +35,19 @@
|
|||||||
// Extra properties
|
// Extra properties
|
||||||
export let teams: Map<Ref<Team>, Team> | undefined
|
export let teams: Map<Ref<Team>, Team> | undefined
|
||||||
export let issueStatuses: Map<Ref<Team>, WithLookup<IssueStatus>[]>
|
export let issueStatuses: Map<Ref<Team>, WithLookup<IssueStatus>[]>
|
||||||
|
|
||||||
|
let list: List
|
||||||
|
|
||||||
|
const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => {
|
||||||
|
if (dir === 'vertical') {
|
||||||
|
// Select next
|
||||||
|
list.select(offset, of)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
ListSelectionProvider.Pop()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ActionContext
|
<ActionContext
|
||||||
@ -38,6 +58,7 @@
|
|||||||
|
|
||||||
{#if viewlet}
|
{#if viewlet}
|
||||||
<List
|
<List
|
||||||
|
bind:this={list}
|
||||||
_class={tracker.class.Issue}
|
_class={tracker.class.Issue}
|
||||||
{viewOptions}
|
{viewOptions}
|
||||||
viewOptionsConfig={viewlet.viewOptions?.other}
|
viewOptionsConfig={viewlet.viewOptions?.other}
|
||||||
@ -47,5 +68,15 @@
|
|||||||
flatHeaders={true}
|
flatHeaders={true}
|
||||||
props={{ teams, issueStatuses }}
|
props={{ teams, issueStatuses }}
|
||||||
{disableHeader}
|
{disableHeader}
|
||||||
|
selectedObjectIds={$selectionStore ?? []}
|
||||||
|
on:row-focus={(event) => {
|
||||||
|
listProvider.updateFocus(event.detail ?? undefined)
|
||||||
|
}}
|
||||||
|
on:check={(event) => {
|
||||||
|
listProvider.updateSelection(event.detail.docs, event.detail.value)
|
||||||
|
}}
|
||||||
|
on:content={(evt) => {
|
||||||
|
listProvider.update(evt.detail)
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user