UBERF-4472-sharing-views (#4272)

* query param sharing implementation

Signed-off-by: Sergey Voytsehovich <syargreg@gmail.com>

* formatting fixes

Signed-off-by: Sergey Voytsehovich <syargreg@gmail.com>

* fixes

Signed-off-by: Sergey Voytsehovich <syargreg@gmail.com>

* formatting fix

Signed-off-by: Sergey Voytsehovich <syargreg@gmail.com>

* formatting fix

Signed-off-by: Sergey Voytsehovich <syargreg@gmail.com>

---------

Signed-off-by: Sergey Voytsehovich <syargreg@gmail.com>
This commit is contained in:
Sergey Voytsehovich
2023-12-27 16:20:15 +07:00
committed by GitHub
parent 689e2d4caa
commit 76d051bf76
5 changed files with 82 additions and 7 deletions
@@ -26,7 +26,8 @@
Menu,
showPopup,
getTreeCollapsed,
setTreeCollapsed
setTreeCollapsed,
IconActivity
} from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
@@ -47,13 +48,25 @@
export let actions: (originalEvent?: MouseEvent) => Promise<Action[]> = async () => []
let hovered = false
let inlineActions: Action[] = []
let popupMenuActions: Action[] = []
$: actions().then((result) => {
inlineActions = result.filter((action) => action.inline === true)
popupMenuActions = result.filter((action) => action.inline !== true)
})
async function onMenuClick (ev: MouseEvent) {
showPopup(Menu, { actions: await actions(ev), ctx: _id }, ev.target as HTMLElement, () => {
showPopup(Menu, { actions: popupMenuActions, ctx: _id }, ev.target as HTMLElement, () => {
hovered = false
})
hovered = true
}
async function onInlineClick (ev: MouseEvent, action: Action) {
action.action([], ev)
}
const dispatch = createEventDispatcher()
$: if (_id) collapsed = getTreeCollapsed(_id)
$: setTreeCollapsed(_id, collapsed)
@@ -91,6 +104,15 @@
<div class="an-element__grow" />
{#if !parent}
{#each inlineActions as action}
<div
class="an-element__tool"
class:pressed={hovered}
on:click|preventDefault|stopPropagation={(ev) => onInlineClick(ev, action)}
>
<Icon icon={action.icon ?? ActionIcon} size={'small'} />
</div>
{/each}
<div class="an-element__tool" class:pressed={hovered} on:click|preventDefault|stopPropagation={onMenuClick}>
<IconMoreH size={'small'} />
</div>