UBER-1080 improve selection (#3857)

Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2023-10-19 12:55:28 +07:00
committed by GitHub
parent 20fe438e7e
commit 7fdfaaeece
15 changed files with 176 additions and 73 deletions
@@ -66,7 +66,6 @@
noCategory,
openDoc,
SelectDirection,
selectionStore,
setGroupByValues
} from '@hcengineering/view-resources'
import view from '@hcengineering/view-resources/src/plugin'
@@ -149,6 +148,8 @@
const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => {
kanbanUI?.select(offset, of, dir)
})
const selection = listProvider.selection
onMount(() => {
;(document.activeElement as HTMLElement)?.blur()
})
@@ -288,7 +289,7 @@
listProvider.updateFocus(evt.detail)
}}
selection={listProvider.current($focusStore)}
checked={$selectionStore ?? []}
checked={$selection ?? []}
on:check={(evt) => {
listProvider.updateSelection(evt.detail.docs, evt.detail.value)
}}
@@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022, 2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@@ -19,7 +19,7 @@
import { Issue } from '@hcengineering/tracker'
import { AnyComponent, AnySvelteComponent, registerFocus } from '@hcengineering/ui'
import { ViewOptions, Viewlet, ViewletPreference } from '@hcengineering/view'
import { List, ListSelectionProvider, SelectDirection, selectionStore } from '@hcengineering/view-resources'
import { List, ListSelectionProvider, SelectDirection } from '@hcengineering/view-resources'
import { createEventDispatcher } from 'svelte'
import tracker from '../../../plugin'
@@ -47,6 +47,7 @@
listProvider.updateFocus(docs[0])
list?.select(0, undefined)
}
const selection = listProvider.selection
// Focusable control with index
let focused = false
@@ -88,7 +89,8 @@
{createItemDialog}
{createItemDialogProps}
{createItemLabel}
selectedObjectIds={$selectionStore ?? []}
{listProvider}
selectedObjectIds={$selection ?? []}
{compactMode}
on:row-focus={(event) => {
listProvider.updateFocus(event.detail ?? undefined)