TSK-1524/UBER-195 (#3230)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-05-22 15:25:45 +06:00 committed by GitHub
parent 818067dad9
commit fb5c4b1f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 8 deletions

View File

@ -14,7 +14,7 @@
// limitations under the License. // limitations under the License.
--> -->
<script lang="ts"> <script lang="ts">
import { afterUpdate } from 'svelte' import { afterUpdate, createEventDispatcher, onMount } from 'svelte'
import { Writable, writable } from 'svelte/store' import { Writable, writable } from 'svelte/store'
import activity from '@hcengineering/activity' import activity from '@hcengineering/activity'
@ -56,6 +56,8 @@
let lastScrollHeight: number = -1 let lastScrollHeight: number = -1
let count: number = 0 let count: number = 0
const dispatch = createEventDispatcher()
const waitCount = 10 const waitCount = 10
const PanelScrollTop: Writable<Record<string, number>> = writable<Record<string, number>>({}) const PanelScrollTop: Writable<Record<string, number>> = writable<Record<string, number>>({})
@ -86,6 +88,10 @@
startScrollHeightCheck() startScrollHeightCheck()
} }
}) })
onMount(() => {
dispatch('open')
})
</script> </script>
<Panel <Panel

View File

@ -89,8 +89,20 @@
} }
} }
function _open (): void {
if (modalHTML && props) {
if (props.element === 'content') {
modalHTML.classList.add('bg')
} else {
modalHTML.classList.remove('bg')
}
}
}
const _update = (): void => { const _update = (): void => {
if (props) fitPopup(props, contentPanel) if (props) {
fitPopup(props, contentPanel)
}
} }
afterUpdate(() => { afterUpdate(() => {
@ -120,7 +132,7 @@
<slot name="panel-header" /> <slot name="panel-header" />
<div <div
class="panel-instance" class="panel-instance"
class:bg={props.element === 'content'} class:bg={false}
bind:this={modalHTML} bind:this={modalHTML}
style:top={options?.props?.top} style:top={options?.props?.top}
style:bottom={options?.props?.bottom} style:bottom={options?.props?.bottom}
@ -142,6 +154,7 @@
rightSection={props.rightSection} rightSection={props.rightSection}
position={props.element} position={props.element}
bind:popupOptions={options} bind:popupOptions={options}
on:open={_open}
on:close={_close} on:close={_close}
on:update={_update} on:update={_update}
/> />

View File

@ -380,6 +380,7 @@
bind:innerWidth bind:innerWidth
floatAside={false} floatAside={false}
useMaxWidth={true} useMaxWidth={true}
on:open
on:close={() => dispatch('close')} on:close={() => dispatch('close')}
> >
<svelte:fragment slot="navigator"> <svelte:fragment slot="navigator">

View File

@ -35,7 +35,7 @@
showPopup showPopup
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { ActionContext, ContextMenu, DocNavLink, UpDownNavigator, contextStore } from '@hcengineering/view-resources' import { ActionContext, ContextMenu, DocNavLink, UpDownNavigator, contextStore } from '@hcengineering/view-resources'
import { createEventDispatcher, onDestroy, onMount } from 'svelte' import { createEventDispatcher, onDestroy } from 'svelte'
import { generateIssueShortLink, getIssueId } from '../../../issues' import { generateIssueShortLink, getIssueId } from '../../../issues'
import tracker from '../../../plugin' import tracker from '../../../plugin'
import IssueStatusActivity from '../IssueStatusActivity.svelte' import IssueStatusActivity from '../IssueStatusActivity.svelte'
@ -140,10 +140,6 @@
} }
} }
onMount(() => {
dispatch('open', { ignoreKeys: ['comments', 'name', 'description', 'number'] })
})
const manager = createFocusManager() const manager = createFocusManager()
export function canClose (): boolean { export function canClose (): boolean {
if (descriptionBox.isFocused()) { if (descriptionBox.isFocused()) {
@ -176,6 +172,7 @@
{embedded} {embedded}
withoutTitle withoutTitle
bind:innerWidth bind:innerWidth
on:open
on:close={() => dispatch('close')} on:close={() => dispatch('close')}
> >
<svelte:fragment slot="navigator"> <svelte:fragment slot="navigator">

View File

@ -283,6 +283,7 @@
isAside={true} isAside={true}
bind:panelWidth bind:panelWidth
bind:innerWidth bind:innerWidth
on:open
on:update={(ev) => _update(ev.detail)} on:update={(ev) => _update(ev.detail)}
on:close={() => { on:close={() => {
dispatch('close') dispatch('close')