|
@@ -3,55 +3,69 @@ import {
|
|
|
CurrentHeaderOperationProvideName,
|
|
|
GrandparentMethod,
|
|
|
HJInterNodeData,
|
|
|
- HJMethodName, HJNodeData,
|
|
|
- HJPosition
|
|
|
-} from '../../types/comTypes';
|
|
|
-import {Handle} from '@vue-flow/core'
|
|
|
-import {Position} from '@vue-flow/core';
|
|
|
-import {inject, watch} from "vue";
|
|
|
+ HJMethodName,
|
|
|
+ HJNodeData,
|
|
|
+ HJPosition,
|
|
|
+} from "../../types/comTypes";
|
|
|
+import { Handle } from "@vue-flow/core";
|
|
|
+import { Position } from "@vue-flow/core";
|
|
|
+import { inject, watch } from "vue";
|
|
|
const props = defineProps<HJInterNodeData>();
|
|
|
|
|
|
// 'basic-box--selected': props.data.isSelected || (currentHeaderOperationNode && currentHeaderOperationNode.id === props.id) 如果是选中或者正在通过header编辑节点信息的样式
|
|
|
-const currentHeaderOperationNode = inject<HJNodeData | null>(CurrentHeaderOperationProvideName)
|
|
|
-
|
|
|
-
|
|
|
+const currentHeaderOperationNode = inject<HJNodeData | null>(
|
|
|
+ CurrentHeaderOperationProvideName
|
|
|
+);
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div
|
|
|
- class="basic-box"
|
|
|
- :class="{
|
|
|
+ class="basic-box"
|
|
|
+ :class="{
|
|
|
[`basic-box--${props.type}`]: props.type,
|
|
|
- 'basic-box--selected': props.data.isSelected || (currentHeaderOperationNode && currentHeaderOperationNode.id === props.id),
|
|
|
+ 'basic-box--selected':
|
|
|
+ props.data.isSelected ||
|
|
|
+ (currentHeaderOperationNode &&
|
|
|
+ currentHeaderOperationNode.id === props.id),
|
|
|
'basic-box--dragging': props.data.isDragging,
|
|
|
}"
|
|
|
>
|
|
|
-
|
|
|
<slot name="header"></slot>
|
|
|
|
|
|
- <slot name="default">
|
|
|
- </slot>
|
|
|
+ <slot name="default"> </slot>
|
|
|
|
|
|
<!-- 这里是handle的操作-->
|
|
|
<div v-if="props.sourcePosition && props.targetPosition">
|
|
|
- <Handle class="handle-style" type="source" :position="props.sourcePosition"/>
|
|
|
- <Handle class="handle-style" type="target" :position="props.targetPosition"/>
|
|
|
+ <Handle
|
|
|
+ class="handle-style"
|
|
|
+ type="source"
|
|
|
+ :position="props.sourcePosition"
|
|
|
+ />
|
|
|
+ <Handle
|
|
|
+ class="handle-style"
|
|
|
+ type="target"
|
|
|
+ :position="props.targetPosition"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div v-else-if="props.data.handles && props.data.handles.length">
|
|
|
- <Handle class="handle-style" v-for="(handle, index) in props.data.handles" :type="handle.type"
|
|
|
- :position="handle.position" :style="handle.style"/>
|
|
|
+ <Handle
|
|
|
+ class="handle-style"
|
|
|
+ v-for="(handle, index) in props.data.handles"
|
|
|
+ :type="handle.type"
|
|
|
+ :position="handle.position"
|
|
|
+ :style="handle.style"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
- <Handle class="handle-style" type="target" :position="Position.Top"/>
|
|
|
- <Handle class="handle-style" type="source" :position="Position.Bottom"/>
|
|
|
+ <Handle class="handle-style" type="target" :position="Position.Top" />
|
|
|
+ <Handle class="handle-style" type="source" :position="Position.Bottom" />
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
.basic-box {
|
|
|
- width: 200px;
|
|
|
+ width: 220px;
|
|
|
height: 60px;
|
|
|
border: 2px solid #625454;
|
|
|
border-radius: 5px;
|
|
@@ -64,7 +78,6 @@ const currentHeaderOperationNode = inject<HJNodeData | null>(CurrentHeaderOperat
|
|
|
height: 10px;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//可以根据type类型来设置不同的Node的样式
|
|
|
.basic-box--custom {
|
|
|
border-style: dashed;
|