|
@@ -1,52 +1,7 @@
|
|
|
-<template>
|
|
|
|
|
- <div
|
|
|
|
|
- :class="nodeClass"
|
|
|
|
|
- class="default-node w-96px h-96px bg-#fff box-border border-2 border-solid border-#dcdcdc rounded-8px relative"
|
|
|
|
|
- >
|
|
|
|
|
- <div className="w-full h-full relative flex items-center justify-center">
|
|
|
|
|
- <div
|
|
|
|
|
- class="relative flex-shrink-0 flex items-center justify-center w-10 h-10 rounded-lg"
|
|
|
|
|
- :style="{ background: nodeType?.iconColor }"
|
|
|
|
|
- >
|
|
|
|
|
- <div
|
|
|
|
|
- class="absolute inset-0 bg-gradient-to-br from-white/30 to-transparent rounded-lg"
|
|
|
|
|
- ></div>
|
|
|
|
|
- <Icon
|
|
|
|
|
- :icon="nodeType?.icon ?? 'lucide:cloud'"
|
|
|
|
|
- color="#ffffff"
|
|
|
|
|
- class="relative z-10"
|
|
|
|
|
- :size="20"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <!-- toolbar -->
|
|
|
|
|
- <div class="tool-bar absolute -top-9 right-0 h-7 pb-1 transition-all duration-300 ease-out">
|
|
|
|
|
- <NodeToolbar v-if="delayedHovered" />
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <!-- warning -->
|
|
|
|
|
- <el-tooltip>
|
|
|
|
|
- <template #content>{{ warningInfo || '请检查配置' }}</template>
|
|
|
|
|
- <div v-if="warningInfo" class="absolute right-10px bottom-0">
|
|
|
|
|
- <Icon icon="clarity:warning-solid" color="#ff4d4f" size="16" />
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-tooltip>
|
|
|
|
|
-
|
|
|
|
|
- <div className="absolute w-full bottom--24px text-12px text-center text-#333">
|
|
|
|
|
- <div>{{ data?.title || nodeType?.displayName || '节点标题' }}</div>
|
|
|
|
|
- <div className="text-12px text-center text-#999 truncate">
|
|
|
|
|
- {{ data?.subtitle }}
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
-</template>
|
|
|
|
|
-
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { ref, inject, computed, watch, type Ref } from 'vue'
|
|
|
|
|
|
|
+import { inject, computed, type Ref } from 'vue'
|
|
|
import { Icon } from '@repo/ui'
|
|
import { Icon } from '@repo/ui'
|
|
|
import { nodeMap } from '@repo/nodes'
|
|
import { nodeMap } from '@repo/nodes'
|
|
|
-import NodeToolbar from '../../node-tool-bar/index.vue'
|
|
|
|
|
|
|
|
|
|
import type { NodeProps } from '@vue-flow/core'
|
|
import type { NodeProps } from '@vue-flow/core'
|
|
|
import type { IWorkflowNode, CanvasConnectionPort } from '../../../../Interface'
|
|
import type { IWorkflowNode, CanvasConnectionPort } from '../../../../Interface'
|
|
@@ -83,26 +38,43 @@ const warningInfo = computed(() => {
|
|
|
const validate = nodeType.value?.validate
|
|
const validate = nodeType.value?.validate
|
|
|
return validate && validate(data.value?.data)
|
|
return validate && validate(data.value?.data)
|
|
|
})
|
|
})
|
|
|
|
|
+</script>
|
|
|
|
|
|
|
|
-const delayedHovered = ref()
|
|
|
|
|
-const delayedHoveredSetTimeoutRef = ref<ReturnType<typeof setTimeout> | null>(null)
|
|
|
|
|
-const delayedHoveredTimeout = 600
|
|
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div
|
|
|
|
|
+ :class="nodeClass"
|
|
|
|
|
+ class="default-node w-96px h-96px bg-#fff box-border border-2 border-solid border-#dcdcdc rounded-8px relative"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div className="w-full h-full relative flex items-center justify-center">
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="relative flex-shrink-0 flex items-center justify-center w-10 h-10 rounded-lg"
|
|
|
|
|
+ :style="{ background: nodeType?.iconColor }"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="absolute inset-0 bg-gradient-to-br from-white/30 to-transparent rounded-lg"
|
|
|
|
|
+ ></div>
|
|
|
|
|
+ <Icon
|
|
|
|
|
+ :icon="nodeType?.icon ?? 'lucide:cloud'"
|
|
|
|
|
+ color="#ffffff"
|
|
|
|
|
+ class="relative z-10"
|
|
|
|
|
+ :size="20"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
-watch(
|
|
|
|
|
- () => node?.props?.hovered,
|
|
|
|
|
- (isHovered) => {
|
|
|
|
|
- console.log('isHovered', isHovered)
|
|
|
|
|
- if (isHovered) {
|
|
|
|
|
- if (delayedHoveredSetTimeoutRef.value) clearTimeout(delayedHoveredSetTimeoutRef.value)
|
|
|
|
|
- delayedHovered.value = true
|
|
|
|
|
- } else {
|
|
|
|
|
- delayedHoveredSetTimeoutRef.value = setTimeout(() => {
|
|
|
|
|
- delayedHovered.value = false
|
|
|
|
|
- }, delayedHoveredTimeout)
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- { immediate: true }
|
|
|
|
|
-)
|
|
|
|
|
|
|
+ <!-- warning -->
|
|
|
|
|
+ <el-tooltip>
|
|
|
|
|
+ <template #content>{{ warningInfo || '请检查配置' }}</template>
|
|
|
|
|
+ <div v-if="warningInfo" class="absolute right-10px bottom-0">
|
|
|
|
|
+ <Icon icon="clarity:warning-solid" color="#ff4d4f" size="16" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-tooltip>
|
|
|
|
|
|
|
|
-const renderToolbar = computed(() => delayedHovered.value && !node?.props?.readOnly)
|
|
|
|
|
-</script>
|
|
|
|
|
|
|
+ <div className="absolute w-full bottom--24px text-12px text-center text-#333">
|
|
|
|
|
+ <div>{{ data?.title || nodeType?.displayName || '节点标题' }}</div>
|
|
|
|
|
+ <div className="text-12px text-center text-#999 truncate">
|
|
|
|
|
+ {{ data?.subtitle }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|