From 7fdfaaeece582a821c5679d41ceeb9ddb98d8519 Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Thu, 19 Oct 2023 12:55:28 +0700 Subject: [PATCH] UBER-1080 improve selection (#3857) Signed-off-by: Alexander Onnikov --- .../src/components/KanbanView.svelte | 5 +- .../src/components/kanban/KanbanView.svelte | 5 +- .../src/components/issues/KanbanView.svelte | 5 +- .../issues/edit/SubIssueList.svelte | 8 +- plugins/view-resources/src/actionImpl.ts | 37 ++++-- plugins/view-resources/src/actions.ts | 12 +- .../src/components/ActionHandler.svelte | 13 ++- .../src/components/ActionsPopup.svelte | 6 +- .../src/components/TableBrowser.svelte | 5 +- .../src/components/list/List.svelte | 3 + .../src/components/list/ListCategories.svelte | 3 + .../src/components/list/ListCategory.svelte | 4 +- .../src/components/list/ListHeader.svelte | 14 ++- .../src/components/list/ListView.svelte | 20 +++- plugins/view-resources/src/selection.ts | 109 +++++++++++++----- 15 files changed, 176 insertions(+), 73 deletions(-) diff --git a/plugins/board-resources/src/components/KanbanView.svelte b/plugins/board-resources/src/components/KanbanView.svelte index 424f78a4d7..06df18d6e7 100644 --- a/plugins/board-resources/src/components/KanbanView.svelte +++ b/plugins/board-resources/src/components/KanbanView.svelte @@ -38,7 +38,6 @@ groupBy, ListSelectionProvider, SelectDirection, - selectionStore, setGroupByValues } from '@hcengineering/view-resources' import { onMount } from 'svelte' @@ -100,6 +99,8 @@ ;(document.activeElement as HTMLElement)?.blur() }) + const selection = listProvider.selection + const showMenu = async (ev: MouseEvent, object: Doc): Promise => { ev.preventDefault() if (object._class !== board.class.Card) { @@ -156,7 +157,7 @@ }} {groupByDocs} {getUpdateProps} - checked={$selectionStore ?? []} + checked={$selection ?? []} on:check={(evt) => { listProvider.updateSelection(evt.detail.docs, evt.detail.value) }} diff --git a/plugins/task-resources/src/components/kanban/KanbanView.svelte b/plugins/task-resources/src/components/kanban/KanbanView.svelte index da2de5ba98..37d90bd1f0 100644 --- a/plugins/task-resources/src/components/kanban/KanbanView.svelte +++ b/plugins/task-resources/src/components/kanban/KanbanView.svelte @@ -56,7 +56,6 @@ Menu, noCategory, SelectDirection, - selectionStore, setGroupByValues } from '@hcengineering/view-resources' import view from '@hcengineering/view-resources/src/plugin' @@ -113,6 +112,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() }) @@ -248,7 +249,7 @@ listProvider.updateFocus(evt.detail) }} selection={listProvider.current($focusStore)} - checked={$selectionStore ?? []} + checked={$selection ?? []} on:check={(evt) => { listProvider.updateSelection(evt.detail.docs, evt.detail.value) }} diff --git a/plugins/tracker-resources/src/components/issues/KanbanView.svelte b/plugins/tracker-resources/src/components/issues/KanbanView.svelte index e2cb890ef3..02a8155425 100644 --- a/plugins/tracker-resources/src/components/issues/KanbanView.svelte +++ b/plugins/tracker-resources/src/components/issues/KanbanView.svelte @@ -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) }} diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte index 48df6e3b62..e4a5db476b 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte @@ -1,5 +1,5 @@