diff --git a/packages/theme/styles/common.scss b/packages/theme/styles/common.scss index 035c27b0a1..ed33c8e322 100644 --- a/packages/theme/styles/common.scss +++ b/packages/theme/styles/common.scss @@ -159,7 +159,6 @@ color: var(--accent-color); } - &.bordered { border-color: var(--divider-color); } &:hover, &.hovered, &.selected { background-color: var(--menu-bg-select); .an-element__icon { color: var(--menu-icon-hover); } diff --git a/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte b/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte index b5f48a6aa2..4eecd4e48c 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte +++ b/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte @@ -25,6 +25,7 @@ export let currentSpace: Ref | undefined export let currentSpecial: string | undefined export let getActions: Function + export let deselect: boolean = false {#if model.specials} @@ -35,7 +36,7 @@ indent={'ml-4'} label={special.label} icon={special.icon} - selected={currentSpace === space._id && special.id === currentSpecial} + selected={deselect ? false : currentSpace === space._id && special.id === currentSpecial} /> {/each} diff --git a/plugins/view-resources/src/components/navigator/TreeElement.svelte b/plugins/view-resources/src/components/navigator/TreeElement.svelte index 20a3c0d37a..2c9a4b8a61 100644 --- a/plugins/view-resources/src/components/navigator/TreeElement.svelte +++ b/plugins/view-resources/src/components/navigator/TreeElement.svelte @@ -28,7 +28,6 @@ export let parent = false export let collapsed = false export let selected = false - export let bordered = false export let bold = false export let actions: () => Promise = async () => [] export let indent: 'default' | 'ml-2' | 'ml-4' | 'ml-8' = 'default' @@ -48,7 +47,6 @@
Promise = async () => [] export let selected: boolean = false - export let bordered: boolean = false export let bold = false export let indent: 'default' | 'ml-2' | 'ml-4' | 'ml-8' = 'default' - + diff --git a/plugins/workbench-resources/src/components/Navigator.svelte b/plugins/workbench-resources/src/components/Navigator.svelte index 2a8fc7a92f..843833b0e6 100644 --- a/plugins/workbench-resources/src/components/Navigator.svelte +++ b/plugins/workbench-resources/src/components/Navigator.svelte @@ -134,6 +134,9 @@ async function checkIsDisabled (special: SpecialNavModel) { return special.checkIsDisabled && (await (await getResource(special.checkIsDisabled))()) } + + let savedMenu: boolean = false + let menuSelection: boolean = false {#if model} @@ -141,14 +144,14 @@ {#if model.specials} {#each specials as special, row} {#if row > 0 && specials[row].position !== specials[row - 1].position} - + {/if} {#await checkIsDisabled(special) then disabled} @@ -157,13 +160,18 @@ {/each} {/if} - {#if specials.length > 0}{/if} - + {#if specials.length > 0 && (starred.length > 0 || savedMenu)}{/if} + (savedMenu = res.detail)} + on:select={(res) => (menuSelection = res.detail)} + /> {#if starred.length} {/if} - {#each model.spaces as m (m.label)} + {#each model.spaces as m, i (m.label)} + {#if (i === 0 && (specials.length > 0 || starred.length || savedMenu)) || i !== 0}{/if} hierarchy.isDerived(it._class, m.spaceClass))} {currentSpace} @@ -171,6 +179,8 @@ model={m} on:open {currentSpecial} + deselect={menuSelection} + separate /> {/each}
diff --git a/plugins/workbench-resources/src/components/SavedView.svelte b/plugins/workbench-resources/src/components/SavedView.svelte index a8fcacc092..1e1908d4f4 100644 --- a/plugins/workbench-resources/src/components/SavedView.svelte +++ b/plugins/workbench-resources/src/components/SavedView.svelte @@ -2,7 +2,7 @@ import { Doc, Ref } from '@hcengineering/core' import { createQuery, getClient } from '@hcengineering/presentation' import setting from '@hcengineering/setting' - import { Action, navigate } from '@hcengineering/ui' + import { Action, navigate, getCurrentLocation, location } from '@hcengineering/ui' import view, { FilteredView } from '@hcengineering/view' import { filterStore, @@ -13,9 +13,11 @@ TreeNode } from '@hcengineering/view-resources' import { Application } from '@hcengineering/workbench' + import { createEventDispatcher } from 'svelte' export let currentApplication: Application | undefined + const dispatch = createEventDispatcher() const client = getClient() const filteredViewsQuery = createQuery() @@ -58,12 +60,26 @@ navigate(fv.location) $filterStore = JSON.parse(fv.filters) } + + let oldLocation: string = '' + $: loc = $location + const clearSelection = () => { + selectedId = selectedFW = undefined + oldLocation = getCurrentLocation().path.join() + dispatch('select', false) + } + $: fs = $filterStore - $: if (Array.isArray(fs) && Array.isArray(filteredViews)) { + $: if (loc && Array.isArray(fs) && fs.length > 0 && Array.isArray(filteredViews)) { const filters = JSON.stringify(fs) selectedFW = filteredViews.filter((fv) => fv.filters === filters) - selectedId = selectedFW.length > 0 ? selectedFW[0]._id : undefined - } else selectedId = selectedFW = undefined + if (selectedFW.length > 0 && selectedFW[0].location.path.join() === loc.path.join()) { + selectedId = selectedFW[0]._id + oldLocation = selectedFW[0].location.path.join() + dispatch('select', true) + } else clearSelection() + } else clearSelection() + $: dispatch('shown', filteredViews !== undefined && filteredViews.length > 0) {#if filteredViews && filteredViews.length > 0} @@ -73,7 +89,7 @@ _id={fv._id} title={fv.name} indent={'ml-2'} - bordered={selectedId === fv._id} + selected={selectedId === fv._id} on:click={() => load(fv)} actions={() => removeAction(fv)} /> diff --git a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte index d517d1315e..237b12bf9e 100644 --- a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte +++ b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte @@ -40,12 +40,16 @@ import { createEventDispatcher } from 'svelte' import plugin from '../../plugin' import { classIcon, getSpaceName } from '../../utils' + import TreeSeparator from './TreeSeparator.svelte' export let model: SpacesNavModel export let currentSpace: Ref | undefined export let spaces: Space[] export let currentSpecial: string | undefined export let hasSpaceBrowser: boolean = false + export let deselect: boolean = false + export let separate: boolean = false + const client = getClient() const dispatch = createEventDispatcher() @@ -120,10 +124,19 @@ getParentActions()} indent={'ml-2'}> - {#each spaces as space (space._id)} + {#each spaces as space, i (space._id)} {#await getObjectPresenter(client, space._class, { key: '' }) then presenter} + {#if separate && i !== 0}{/if} {#if model.specials && presenter} - + {:else} {#await getSpaceName(client, space) then name} @@ -132,7 +145,7 @@ _id={space._id} title={name} icon={classIcon(client, space._class)} - selected={currentSpace === space._id} + selected={deselect ? false : currentSpace === space._id} actions={() => getActions(space)} bold={isChanged(space, $lastViews)} /> diff --git a/plugins/workbench-resources/src/components/navigator/TreeSeparator.svelte b/plugins/workbench-resources/src/components/navigator/TreeSeparator.svelte index 65d4c07b58..7a940e38a0 100644 --- a/plugins/workbench-resources/src/components/navigator/TreeSeparator.svelte +++ b/plugins/workbench-resources/src/components/navigator/TreeSeparator.svelte @@ -12,5 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. --> + -
+