Files
ComfyUI_frontend/src/stores/dialogStore.ts
Chenlei Hu a5f0d2b201 Categorize setting items (#338)
* Basic setting panel rework

* refactor

* Style the setting item

* Reject invalid value

* nit

* nit

* Sort settings by label

* info chip as icon

* nit
2024-08-08 17:52:41 -04:00

43 lines
1.0 KiB
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 { type Component, markRaw } from 'vue'
interface DialogState {
isVisible: boolean
title: string
headerComponent: Component | null
component: Component | null
props: Record<string, any>
}
export const useDialogStore = defineStore('dialog', {
state: (): DialogState => ({
isVisible: false,
title: '',
headerComponent: null,
component: null,
props: {}
}),
actions: {
showDialog(options: {
title?: string
headerComponent?: Component
component: Component
props?: Record<string, any>
}) {
this.title = options.title
this.headerComponent = markRaw(options.headerComponent)
this.component = markRaw(options.component)
this.props = options.props || {}
this.isVisible = true
},
closeDialog() {
this.isVisible = false
}
}
})