mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-09 01:20:09 +00:00
* Basic setting panel rework * refactor * Style the setting item * Reject invalid value * nit * nit * Sort settings by label * info chip as icon * nit
43 lines
1.0 KiB
TypeScript
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
|
|
}
|
|
}
|
|
})
|