mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-22 07:44:11 +00:00
Allow passthrough to root component when creating dialog (#2787)
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
class="global-dialog"
|
||||
v-bind="item.dialogComponentProps"
|
||||
:auto-z-index="false"
|
||||
:pt="item.dialogComponentProps.pt"
|
||||
:pt:mask:style="{ zIndex: baseZIndex + index + 1 }"
|
||||
:aria-labelledby="item.key"
|
||||
>
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
// We should consider moving to https://primevue.org/dynamicdialog/ once everything is in Vue.
|
||||
// Currently we need to bridge between legacy app code and Vue app with a Pinia store.
|
||||
import { merge } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
import type { DialogPassThroughOptions } from 'primevue/dialog'
|
||||
import { type Component, markRaw, ref } from 'vue'
|
||||
|
||||
interface DialogComponentProps {
|
||||
import type GlobalDialog from '@/components/dialog/GlobalDialog.vue'
|
||||
|
||||
interface CustomDialogComponentProps {
|
||||
maximizable?: boolean
|
||||
maximized?: boolean
|
||||
onClose?: () => void
|
||||
pt?: DialogPassThroughOptions
|
||||
}
|
||||
|
||||
type DialogComponentProps = InstanceType<typeof GlobalDialog>['$props'] &
|
||||
CustomDialogComponentProps
|
||||
|
||||
interface DialogInstance {
|
||||
key: string
|
||||
visible: boolean
|
||||
@@ -15,7 +24,7 @@ interface DialogInstance {
|
||||
headerComponent?: Component
|
||||
component: Component
|
||||
contentProps: Record<string, any>
|
||||
dialogComponentProps: Record<string, any>
|
||||
dialogComponentProps: DialogComponentProps
|
||||
}
|
||||
|
||||
export interface ShowDialogOptions {
|
||||
@@ -90,13 +99,13 @@ export const useDialogStore = defineStore('dialog', () => {
|
||||
onAfterHide: () => {
|
||||
closeDialog(dialog)
|
||||
},
|
||||
pt: {
|
||||
pt: merge(options.dialogComponentProps?.pt || {}, {
|
||||
root: {
|
||||
onMousedown: () => {
|
||||
riseDialog(dialog)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
dialogStack.value.push(dialog)
|
||||
|
||||
Reference in New Issue
Block a user