Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(todo): broken context actions #4889

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions models/time/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
29 changes: 17 additions & 12 deletions packages/ui/src/components/PanelInstance.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,34 +106,39 @@
}

const _update = (): void => {
if (props) {
if (props && contentPanel) {
fitPopup(props, contentPanel)
}
}

const checkResize = (el: Element) => {
if (props) fitPopup(props, contentPanel)
if (props && contentPanel) fitPopup(props, contentPanel)
}

onMount(() => {
if (props && contentPanel) fitPopup(props, contentPanel)
})

afterUpdate(() => {
if (props) fitPopup(props, contentPanel)
if (!keepSize && props?.element === 'content' && contentPanel !== undefined) {
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) fitPopup(props, contentPanel)
}

onMount(() => {
if (props) fitPopup(props, contentPanel)
})
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down