2022-04-24 05:18:03 +00:00
|
|
|
<script lang="ts">
|
2022-09-21 08:08:25 +00:00
|
|
|
import { Doc } from '@hcengineering/core'
|
2023-03-15 14:06:03 +00:00
|
|
|
import { getClient } from '@hcengineering/presentation'
|
2023-05-23 10:42:39 +00:00
|
|
|
import { Button, IconDownOutline, IconUpOutline, navigate } from '@hcengineering/ui'
|
2022-04-24 05:18:03 +00:00
|
|
|
import { tick } from 'svelte'
|
|
|
|
import { select } from '../actionImpl'
|
2023-05-15 15:35:46 +00:00
|
|
|
import view from '../plugin'
|
2022-04-24 05:18:03 +00:00
|
|
|
import { focusStore } from '../selection'
|
2023-03-15 14:06:03 +00:00
|
|
|
import { getObjectLinkFragment } from '../utils'
|
2022-04-24 05:18:03 +00:00
|
|
|
|
|
|
|
export let element: Doc
|
|
|
|
|
2023-03-15 14:06:03 +00:00
|
|
|
const client = getClient()
|
|
|
|
|
2022-04-24 05:18:03 +00:00
|
|
|
async function next (evt: Event, pn: boolean): Promise<void> {
|
|
|
|
select(evt, pn ? 1 : -1, element, 'vertical')
|
|
|
|
await tick()
|
2023-05-15 15:35:46 +00:00
|
|
|
if ($focusStore.focus !== undefined) {
|
2023-03-15 14:06:03 +00:00
|
|
|
const doc = await client.findOne($focusStore.focus._class, { _id: $focusStore.focus._id })
|
|
|
|
if (doc !== undefined) {
|
2023-05-15 15:35:46 +00:00
|
|
|
const component = client.getHierarchy().classHierarchyMixin(doc._class, view.mixin.ObjectPanel)
|
|
|
|
const link = await getObjectLinkFragment(
|
|
|
|
client.getHierarchy(),
|
|
|
|
doc,
|
|
|
|
{},
|
|
|
|
component?.component ?? view.component.EditDoc
|
|
|
|
)
|
2023-03-20 08:45:52 +00:00
|
|
|
navigate(link)
|
2023-03-15 14:06:03 +00:00
|
|
|
}
|
2022-04-24 05:18:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-08 14:18:57 +00:00
|
|
|
$: select(undefined, 0, element, 'vertical', true)
|
2022-04-24 05:18:03 +00:00
|
|
|
</script>
|
|
|
|
|
2023-05-15 15:35:46 +00:00
|
|
|
{#if $focusStore.focus !== undefined && $focusStore.provider !== undefined}
|
|
|
|
<Button
|
|
|
|
focusIndex={10005}
|
|
|
|
icon={IconDownOutline}
|
2023-07-06 07:01:27 +00:00
|
|
|
kind={'regular'}
|
2023-05-15 15:35:46 +00:00
|
|
|
size={'medium'}
|
2023-11-20 10:01:43 +00:00
|
|
|
on:click={async (evt) => {
|
|
|
|
await next(evt, true)
|
|
|
|
}}
|
2023-05-15 15:35:46 +00:00
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
focusIndex={10006}
|
|
|
|
icon={IconUpOutline}
|
2023-07-06 07:01:27 +00:00
|
|
|
kind={'regular'}
|
2023-05-15 15:35:46 +00:00
|
|
|
size={'medium'}
|
2023-11-20 10:01:43 +00:00
|
|
|
on:click={async (evt) => {
|
|
|
|
await next(evt, false)
|
|
|
|
}}
|
2023-05-15 15:35:46 +00:00
|
|
|
/>
|
|
|
|
{/if}
|