mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-29 17:14:37 +03: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.
|
||||
-->
|
||||
<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}
|
||||
|
Loading…
Reference in New Issue
Block a user