fix(todo): broken context actions (#4889)

Signed-off-by: Eduard Aksamitov <e@euaaaio.ru>
This commit is contained in:
Eduard Aksamitov
2024-03-06 22:36:41 +07:00
committed by GitHub
parent e9cb464b92
commit b155bf0e53
3 changed files with 28 additions and 23 deletions
+6 -6
View File
@@ -158,6 +158,10 @@ export function createModel (builder: Builder): void {
titleProvider: time.function.ToDoTitleProvider
})
builder.mixin(time.class.ToDo, core.class.Class, view.mixin.ObjectPanel, {
component: time.component.EditToDo
})
builder.createDoc(
workbench.class.Application,
core.space.Model,
@@ -269,14 +273,10 @@ export function createModel (builder: Builder): void {
createAction(
builder,
{
action: view.actionImpl.ShowPopup,
action: view.actionImpl.ShowPanel,
actionProps: {
component: time.component.EditToDo,
element: 'top',
fillProps: {
_object: 'object',
space: 'space'
}
element: 'content'
},
label: time.string.EditToDo,
icon: view.icon.Edit,
+21 -16
View File
@@ -23,7 +23,7 @@
import type { AnySvelteComponent, PopupOptions, DeviceOptions } from '../types'
import Spinner from './Spinner.svelte'
export let contentPanel: HTMLElement
export let contentPanel: HTMLElement | undefined
export let kind: 'default' | 'modern' = 'default'
export let embedded: boolean = false
export let readonly: boolean = false
@@ -106,34 +106,39 @@
}
const _update = (): void => {
if (props) {
if (props && contentPanel) {
fitPopup(props, contentPanel)
}
}
const checkResize = (el: Element) => {
if (props) fitPopup(props, contentPanel)
}
afterUpdate(() => {
if (props) fitPopup(props, contentPanel)
if (!keepSize && props?.element === 'content' && contentPanel !== undefined) {
keepSize = true
resizeObserver(contentPanel, checkResize)
}
})
export function fitPopupInstance (): void {
if (props) fitPopup(props, contentPanel)
if (props && contentPanel) fitPopup(props, contentPanel)
}
onMount(() => {
if (props) fitPopup(props, contentPanel)
if (props && contentPanel) fitPopup(props, contentPanel)
})
afterUpdate(() => {
if (props && contentPanel) fitPopup(props, contentPanel)
})
$: if (props && contentPanel !== undefined) {
fitPopup(props, contentPanel)
if (!keepSize && props?.element === 'content') {
keepSize = true
resizeObserver(contentPanel, checkResize)
}
}
export function fitPopupInstance (): void {
if (props && contentPanel) fitPopup(props, contentPanel)
}
</script>
<svelte:window
on:resize={() => {
if (props) fitPopup(props, contentPanel)
if (props && contentPanel) fitPopup(props, contentPanel)
}}
on:keydown={(evt) => {
if (props) handleKeydown(evt)
@@ -83,7 +83,7 @@
import TopMenu from './icons/TopMenu.svelte'
let contentPanel: HTMLElement
let replacedPanel: HTMLElement
let replacedPanel: HTMLElement | undefined
const { setTheme } = getContext<{ setTheme: (theme: string) => void }>('theme')