mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 01:09:46 +00:00
Missing node dialog revamp (#322)
* Basic rework of load workflow warning dialog * Better style * Add vue jest support * Mock vue component in jest test * nit * Make dialog maximizable
This commit is contained in:
38
src/stores/dialogStore.ts
Normal file
38
src/stores/dialogStore.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
// 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
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user