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-15 15:35:46 +00:00
|
|
|
import ui, { Button, closeTooltip, IconDownOutline, IconNavPrev, 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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-18 06:33:11 +00:00
|
|
|
function goBack () {
|
2022-12-21 06:04:55 +00:00
|
|
|
closeTooltip()
|
|
|
|
history.back()
|
2022-10-18 06:33:11 +00:00
|
|
|
}
|
|
|
|
|
2022-04-29 05:27:17 +00:00
|
|
|
$: select(undefined, 0, element, 'vertical')
|
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}
|
|
|
|
kind={'secondary'}
|
|
|
|
size={'medium'}
|
|
|
|
on:click={(evt) => next(evt, true)}
|
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
focusIndex={10006}
|
|
|
|
icon={IconUpOutline}
|
|
|
|
kind={'secondary'}
|
|
|
|
size={'medium'}
|
|
|
|
on:click={(evt) => next(evt, false)}
|
|
|
|
/>
|
|
|
|
{/if}
|
2023-05-04 13:21:06 +00:00
|
|
|
<Button
|
|
|
|
focusIndex={10007}
|
2023-01-14 10:54:54 +00:00
|
|
|
showTooltip={{ label: ui.string.Back, direction: 'bottom' }}
|
2022-12-21 06:04:55 +00:00
|
|
|
icon={IconNavPrev}
|
|
|
|
kind={'secondary'}
|
|
|
|
size={'medium'}
|
|
|
|
on:click={goBack}
|
|
|
|
/>
|