|
|
@@ -20,12 +20,20 @@
|
|
|
@input="handleOutputChange"
|
|
|
/>
|
|
|
<el-select
|
|
|
+ v-if="setType"
|
|
|
v-model="output.type"
|
|
|
:options="VARIABLE_TYPE_OPTIONS"
|
|
|
class="w-1/3 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white min-w-[100px]"
|
|
|
@change="handleOutputChange"
|
|
|
>
|
|
|
</el-select>
|
|
|
+ <VarSelect
|
|
|
+ v-if="setValue"
|
|
|
+ v-model="output.value"
|
|
|
+ class="w-1/3"
|
|
|
+ placeholder="{x} 设置变量值"
|
|
|
+ @change="(val) => val && (output.type = val.type as NodeVariableType)"
|
|
|
+ />
|
|
|
<IconButton link icon="lucide:trash-2" class="text-red-500" @click="removeOutput(index)" />
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -35,18 +43,24 @@
|
|
|
<script setup lang="ts">
|
|
|
import { ref, watch } from 'vue'
|
|
|
import { IconButton } from '@repo/ui'
|
|
|
+import VarSelect from './VarSelect.vue'
|
|
|
import { VARIABLE_TYPE_OPTIONS } from '@/constant'
|
|
|
-import type { NodeVariable } from '@/nodes/Interface'
|
|
|
+import type { NodeVariable, NodeVariableType } from '@/nodes/Interface'
|
|
|
|
|
|
interface Props {
|
|
|
modelValue: NodeVariable[]
|
|
|
+ setType?: boolean
|
|
|
+ setValue?: boolean
|
|
|
}
|
|
|
|
|
|
interface Emits {
|
|
|
(e: 'update:modelValue', value: NodeVariable[]): void
|
|
|
}
|
|
|
|
|
|
-const props = defineProps<Props>()
|
|
|
+const props = withDefaults(defineProps<Props>(), {
|
|
|
+ setType: true,
|
|
|
+ setValue: false
|
|
|
+})
|
|
|
const emit = defineEmits<Emits>()
|
|
|
|
|
|
const outputs = ref<NodeVariable[]>(props.modelValue || [])
|