mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
feat(lora-pool): add external value handling and config update support
- Add `onSetValue` callback to handle external updates like workflow loading - Implement `updateConfig` method for direct widget value updates - Add value change detection in `restoreFromConfig` to prevent unnecessary updates - Remove debug console log on component mount - Extend widget value type to support legacy config format
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createApp, type App as VueApp } from 'vue'
|
||||
import PrimeVue from 'primevue/config'
|
||||
import LoraPoolWidget from '@/components/LoraPoolWidget.vue'
|
||||
import type { LoraPoolConfig, LegacyLoraPoolConfig } from './composables/types'
|
||||
|
||||
// @ts-ignore - ComfyUI external module
|
||||
import { app } from '../../../scripts/app.js'
|
||||
@@ -17,16 +18,30 @@ function createLoraPoolWidget(node) {
|
||||
container.style.flexDirection = 'column'
|
||||
container.style.overflow = 'hidden'
|
||||
|
||||
let internalValue: LoraPoolConfig | LegacyLoraPoolConfig | undefined
|
||||
|
||||
const widget = node.addDOMWidget(
|
||||
'pool_config',
|
||||
'LORA_POOL_CONFIG',
|
||||
container,
|
||||
{
|
||||
// getMinHeight: () => 680,
|
||||
getValue() {
|
||||
return internalValue
|
||||
},
|
||||
setValue(v: LoraPoolConfig | LegacyLoraPoolConfig) {
|
||||
internalValue = v
|
||||
if (typeof widget.onSetValue === 'function') {
|
||||
widget.onSetValue(v)
|
||||
}
|
||||
},
|
||||
serialize: true
|
||||
}
|
||||
)
|
||||
|
||||
widget.updateConfig = (v: LoraPoolConfig) => {
|
||||
internalValue = v
|
||||
}
|
||||
|
||||
const vueApp = createApp(LoraPoolWidget, {
|
||||
widget,
|
||||
node
|
||||
|
||||
Reference in New Issue
Block a user