|
@@ -1,5 +1,4 @@
|
|
|
<template>
|
|
|
-
|
|
|
<g
|
|
|
class="flow-node"
|
|
|
:class="{
|
|
@@ -11,6 +10,7 @@
|
|
|
@dblclick="$emit('nodeDoubleClick',$event)"
|
|
|
>
|
|
|
|
|
|
+ <!-- selection square -->
|
|
|
<rect
|
|
|
class="flow-node__selection"
|
|
|
stroke-dasharray="7,3"
|
|
@@ -20,49 +20,51 @@
|
|
|
:height="bodyProps.height+8"
|
|
|
/>
|
|
|
|
|
|
- <!-- <circle
|
|
|
- :r="bodyProps.r+4"
|
|
|
- stroke-dasharray="7,3"
|
|
|
- class="flow-node__selection"
|
|
|
- />-->
|
|
|
- <svg
|
|
|
- v-if="style.shape == 'thing'"
|
|
|
- ref="body"
|
|
|
- viewBox="0 0 100 100"
|
|
|
- preserveAspectRatio="XMinYMin"
|
|
|
- class="flow-node__body"
|
|
|
- :class="{'flow-node__body--dragging':dragging}"
|
|
|
- v-bind="bodyProps"
|
|
|
- >
|
|
|
- <path d=" M 0 0 l 90 0 l 10 50 l -10 50 l -90 0 c 10 -20, 10 -80, 0 -100 Z " />
|
|
|
- </svg>
|
|
|
-
|
|
|
- <circle
|
|
|
- v-else-if="style.shape == 'circle'"
|
|
|
- ref="body"
|
|
|
- class="flow-node__body"
|
|
|
- :class="{'flow-node__body--dragging':dragging}"
|
|
|
- v-bind="bodyProps"
|
|
|
- />
|
|
|
- <rect
|
|
|
- v-else
|
|
|
- ref="body"
|
|
|
- class="flow-node__body"
|
|
|
- :class="{'flow-node__body--dragging':dragging}"
|
|
|
- v-bind="bodyProps"
|
|
|
- />
|
|
|
+ <!-- shape -->
|
|
|
+ <template>
|
|
|
+ <svg
|
|
|
+ v-if="style.shape == 'thing'"
|
|
|
+ ref="body"
|
|
|
+ viewBox="0 0 100 100"
|
|
|
+ preserveAspectRatio="XMinYMin"
|
|
|
+ class="flow-node__body"
|
|
|
+ :class="{'flow-node__body--dragging':dragging}"
|
|
|
+ v-bind="bodyProps"
|
|
|
+ >
|
|
|
+ <path d=" M 0 0 l 90 0 l 10 50 l -10 50 l -90 0 c 10 -20, 10 -80, 0 -100 Z " />
|
|
|
+ </svg>
|
|
|
+ <circle
|
|
|
+ v-else-if="style.shape == 'circle'"
|
|
|
+ ref="body"
|
|
|
+ class="flow-node__body"
|
|
|
+ :class="{'flow-node__body--dragging':dragging}"
|
|
|
+ v-bind="bodyProps"
|
|
|
+ />
|
|
|
+ <rect
|
|
|
+ v-else
|
|
|
+ ref="body"
|
|
|
+ class="flow-node__body"
|
|
|
+ :class="{'flow-node__body--dragging':dragging}"
|
|
|
+ v-bind="bodyProps"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
|
|
|
+ <!-- label -->
|
|
|
<text
|
|
|
ref="label"
|
|
|
class="flow-node__label"
|
|
|
v-bind="labelProps"
|
|
|
text-anchor="middle">
|
|
|
- <tspan x="0" dy="1em" v-for="s in labelWrap" >
|
|
|
+ <tspan
|
|
|
+ :key="'label-wrap' + i"
|
|
|
+ x="0"
|
|
|
+ dy="1em"
|
|
|
+ v-for="(s,i) in labelWrap" >
|
|
|
{{ s }}
|
|
|
</tspan>
|
|
|
- <!--{{ label }}-->
|
|
|
</text>
|
|
|
|
|
|
+ <!-- Sockets -->
|
|
|
<!-- input -->
|
|
|
<circle
|
|
|
class="flow-node__socket flow-node__socket--inputs"
|
|
@@ -86,6 +88,7 @@
|
|
|
@mousedown.stop.prevent="socketPointerDown($event, {out:0})"
|
|
|
/>
|
|
|
|
|
|
+ <!-- socket labels -->
|
|
|
<text
|
|
|
:key="'inp' +i"
|
|
|
class="flow-node__socket-detail"
|
|
@@ -101,11 +104,16 @@
|
|
|
{{ output }}
|
|
|
</text>
|
|
|
|
|
|
+ <!-- positioning -->
|
|
|
+ <flow-node-status
|
|
|
+ :status="status"
|
|
|
+ :transform="'translate('+bodyProps.width/2 +','+ -bodyProps.height/2 +')'"/>
|
|
|
</g>
|
|
|
-
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import FlowNodeStatus from './nodestatus'
|
|
|
+
|
|
|
import utils from '@/utils/utils'
|
|
|
const shapeOpts = {
|
|
|
'circle': {
|
|
@@ -117,6 +125,7 @@ const shapeOpts = {
|
|
|
}
|
|
|
export default {
|
|
|
name: 'FlowNode',
|
|
|
+ components: {FlowNodeStatus},
|
|
|
props: {
|
|
|
'id': {type: String, required: true},
|
|
|
'label': {type: String, default: ''},
|
|
@@ -238,18 +247,6 @@ export default {
|
|
|
</script>
|
|
|
<style>
|
|
|
|
|
|
-.flow-node[status=running] .flow-node__body{
|
|
|
- stroke: yellow !important;
|
|
|
- fill: yellow !important;
|
|
|
- stroke-width:30;
|
|
|
-}
|
|
|
-
|
|
|
-.flow-node[status=error] .flow-node__body{
|
|
|
- stroke: red !important;
|
|
|
- fill: red !important;
|
|
|
- stroke-width:30;
|
|
|
-}
|
|
|
-
|
|
|
.flow-view:not(.activity) .flow-node:hover,
|
|
|
.flow-node--dragging {
|
|
|
cursor:move;
|