mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-20 23:04:06 +00:00
* Basic rework of load workflow warning dialog * Better style * Add vue jest support * Mock vue component in jest test * nit * Make dialog maximizable
39 lines
880 B
TypeScript
39 lines
880 B
TypeScript
// 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 { defineStore } from 'pinia'
|
|
import { Component } from 'vue'
|
|
|
|
interface DialogState {
|
|
isVisible: boolean
|
|
title: string
|
|
component: Component | null
|
|
props: Record<string, any>
|
|
}
|
|
|
|
export const useDialogStore = defineStore('dialog', {
|
|
state: (): DialogState => ({
|
|
isVisible: false,
|
|
title: '',
|
|
component: null,
|
|
props: {}
|
|
}),
|
|
|
|
actions: {
|
|
showDialog(options: {
|
|
title?: string
|
|
component: Component
|
|
props?: Record<string, any>
|
|
}) {
|
|
this.title = options.title
|
|
this.component = options.component
|
|
this.props = options.props || {}
|
|
this.isVisible = true
|
|
},
|
|
|
|
closeDialog() {
|
|
this.isVisible = false
|
|
}
|
|
}
|
|
})
|