mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
[feat] Add Vue selection widgets
- WidgetSelect: Dropdown selection with Select component - WidgetMultiSelect: Multiple selection with MultiSelect component - WidgetSelectButton: Button group selection with SelectButton component - WidgetTreeSelect: Hierarchical selection with TreeSelect component
This commit is contained in:
36
src/components/graph/vueWidgets/WidgetMultiSelect.vue
Normal file
36
src/components/graph/vueWidgets/WidgetMultiSelect.vue
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<label v-if="widget.name" class="text-sm opacity-80">{{
|
||||||
|
widget.name
|
||||||
|
}}</label>
|
||||||
|
<MultiSelect v-model="value" v-bind="filteredProps" :disabled="readonly" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import MultiSelect from 'primevue/multiselect'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
import type { SimplifiedWidget } from '@/types/simplifiedWidget'
|
||||||
|
import {
|
||||||
|
PANEL_EXCLUDED_PROPS,
|
||||||
|
filterWidgetProps
|
||||||
|
} from '@/utils/widgetPropFilter'
|
||||||
|
|
||||||
|
const value = defineModel<any[]>({ required: true })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
widget: SimplifiedWidget<any[]>
|
||||||
|
readonly?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
// MultiSelect specific excluded props include overlay styles
|
||||||
|
const MULTISELECT_EXCLUDED_PROPS = [
|
||||||
|
...PANEL_EXCLUDED_PROPS,
|
||||||
|
'overlayStyle'
|
||||||
|
] as const
|
||||||
|
|
||||||
|
const filteredProps = computed(() =>
|
||||||
|
filterWidgetProps(props.widget.options, MULTISELECT_EXCLUDED_PROPS)
|
||||||
|
)
|
||||||
|
</script>
|
||||||
30
src/components/graph/vueWidgets/WidgetSelect.vue
Normal file
30
src/components/graph/vueWidgets/WidgetSelect.vue
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<label v-if="widget.name" class="text-sm opacity-80">{{
|
||||||
|
widget.name
|
||||||
|
}}</label>
|
||||||
|
<Select v-model="value" v-bind="filteredProps" :disabled="readonly" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import Select from 'primevue/select'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
import type { SimplifiedWidget } from '@/types/simplifiedWidget'
|
||||||
|
import {
|
||||||
|
PANEL_EXCLUDED_PROPS,
|
||||||
|
filterWidgetProps
|
||||||
|
} from '@/utils/widgetPropFilter'
|
||||||
|
|
||||||
|
const value = defineModel<any>({ required: true })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
widget: SimplifiedWidget<any>
|
||||||
|
readonly?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const filteredProps = computed(() =>
|
||||||
|
filterWidgetProps(props.widget.options, PANEL_EXCLUDED_PROPS)
|
||||||
|
)
|
||||||
|
</script>
|
||||||
30
src/components/graph/vueWidgets/WidgetSelectButton.vue
Normal file
30
src/components/graph/vueWidgets/WidgetSelectButton.vue
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<label v-if="widget.name" class="text-sm opacity-80">{{
|
||||||
|
widget.name
|
||||||
|
}}</label>
|
||||||
|
<SelectButton v-model="value" v-bind="filteredProps" :disabled="readonly" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import SelectButton from 'primevue/selectbutton'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
import type { SimplifiedWidget } from '@/types/simplifiedWidget'
|
||||||
|
import {
|
||||||
|
STANDARD_EXCLUDED_PROPS,
|
||||||
|
filterWidgetProps
|
||||||
|
} from '@/utils/widgetPropFilter'
|
||||||
|
|
||||||
|
const value = defineModel<any>({ required: true })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
widget: SimplifiedWidget<any>
|
||||||
|
readonly?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const filteredProps = computed(() =>
|
||||||
|
filterWidgetProps(props.widget.options, STANDARD_EXCLUDED_PROPS)
|
||||||
|
)
|
||||||
|
</script>
|
||||||
37
src/components/graph/vueWidgets/WidgetTreeSelect.vue
Normal file
37
src/components/graph/vueWidgets/WidgetTreeSelect.vue
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<label v-if="widget.name" class="text-sm opacity-80">{{
|
||||||
|
widget.name
|
||||||
|
}}</label>
|
||||||
|
<TreeSelect v-model="value" v-bind="filteredProps" :disabled="readonly" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import TreeSelect from 'primevue/treeselect'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
import type { SimplifiedWidget } from '@/types/simplifiedWidget'
|
||||||
|
import {
|
||||||
|
PANEL_EXCLUDED_PROPS,
|
||||||
|
filterWidgetProps
|
||||||
|
} from '@/utils/widgetPropFilter'
|
||||||
|
|
||||||
|
const value = defineModel<any>({ required: true })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
widget: SimplifiedWidget<any>
|
||||||
|
readonly?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
// TreeSelect specific excluded props
|
||||||
|
const TREE_SELECT_EXCLUDED_PROPS = [
|
||||||
|
...PANEL_EXCLUDED_PROPS,
|
||||||
|
'inputClass',
|
||||||
|
'inputStyle'
|
||||||
|
] as const
|
||||||
|
|
||||||
|
const filteredProps = computed(() =>
|
||||||
|
filterWidgetProps(props.widget.options, TREE_SELECT_EXCLUDED_PROPS)
|
||||||
|
)
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user