mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-27 20:14:57 +02:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user