Subissues list selection (#2644)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-02-16 14:19:53 +06:00 committed by GitHub
parent 0c1c11c7a4
commit 96a00697d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,10 +13,17 @@
// limitations under the License.
-->
<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 { 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'
export let query: DocumentQuery<Issue> | undefined = undefined
@ -28,6 +35,19 @@
// Extra properties
export let teams: Map<Ref<Team>, Team> | undefined
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>
<ActionContext
@ -38,6 +58,7 @@
{#if viewlet}
<List
bind:this={list}
_class={tracker.class.Issue}
{viewOptions}
viewOptionsConfig={viewlet.viewOptions?.other}
@ -47,5 +68,15 @@
flatHeaders={true}
props={{ teams, issueStatuses }}
{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}