Skip to content

Commit

Permalink
feat: add a prop for dynamic icon component
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Dec 29, 2023
1 parent 99e7671 commit c351efb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/nodes/BasicNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
>
<div v-if="state" class="status-div" :class="[`bg-${stateColor}`]" />
<div class="icon rounded">
<TaskIcon :cls="cls" :class="taskIconBg" class="rounded bg-white" theme="light" :icons="icons" />
<component :is="iconComponent || TaskIcon" :cls="cls" :class="taskIconBg" class="rounded bg-white" theme="light" :icons="icons" />
</div>
<div class="node-content">
<div class="d-flex node-title">
Expand Down Expand Up @@ -59,8 +59,11 @@
</div>
</template>

<script>
<script setup>
import TaskIcon from "../misc/TaskIcon.vue";
</script>

<script>
import InformationOutline from "vue-material-design-icons/InformationOutline.vue";
import {EVENTS} from "../../utils/constants.js";
import ArrowExpand from "vue-material-design-icons/ArrowExpand.vue";
Expand All @@ -72,7 +75,6 @@
export default {
components: {
ArrowExpand,
TaskIcon,
InformationOutline,
OpenInNew,
Tooltip
Expand Down Expand Up @@ -115,6 +117,10 @@
icons: {
type: Object,
default: undefined
},
iconComponent: {
type: Object,
default: undefined
}
},
methods: {
Expand Down
5 changes: 5 additions & 0 deletions src/components/nodes/TaskNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:state="state"
:class="classes"
:icons="icons"
:icon-component="iconComponent"
@show-description="forwardEvent(EVENTS.SHOW_DESCRIPTION, $event)"
@expand="forwardEvent(EVENTS.EXPAND, expandData)"
@open-link="forwardEvent(EVENTS.OPEN_LINK, $event)"
Expand Down Expand Up @@ -211,6 +212,10 @@
type: Object,
default: undefined
},
iconComponent: {
type: Object,
default: undefined
},
enableSubflowInteraction: {
type: Boolean,
default: true
Expand Down
5 changes: 5 additions & 0 deletions src/components/nodes/TriggerNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:data="data"
:color="color"
:icons="icons"
:icon-component="iconComponent"
@show-description="forwardEvent(EVENTS.SHOW_DESCRIPTION, $event)"
@expand="forwardEvent(EVENTS.EXPAND, {id})"
>
Expand Down Expand Up @@ -88,6 +89,10 @@
icons: {
type: Object,
default: undefined
},
iconComponent: {
type: Object,
default: undefined
}
},
methods: {
Expand Down
6 changes: 6 additions & 0 deletions src/components/topology/Topology.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
type: Object,
default: undefined
},
iconComponent: {
type: Object,
default: undefined
},
enableSubflowInteraction: {
type: Boolean,
default: true
Expand Down Expand Up @@ -325,6 +329,7 @@
<TaskNode
v-bind="taskProps"
:icons="icons"
:icon-component="iconComponent"
@edit="forwardEvent(EVENTS.EDIT, $event)"
@delete="forwardEvent(EVENTS.DELETE, $event)"
@expand="expand($event)"
Expand All @@ -342,6 +347,7 @@
<TriggerNode
v-bind="triggerProps"
:icons="icons"
:icon-component="iconComponent"
:is-read-only="isReadOnly"
:is-allowed-edit="isAllowedEdit"
@delete="forwardEvent(EVENTS.DELETE, $event)"
Expand Down

0 comments on commit c351efb

Please sign in to comment.