A Visual Flow Editor Based on Vue and antv/g6

A Visual Flow Editor Based on Vue and antv/g6

A visual flow editor based on vue and antv/g6

Introduction

vue-visual-flowIt is based on antv/g6the configuration of the visualization routine implemented Vuecomponents

Project uses rolluppackaged, are provided cjs esmin two modular form to introduce ways, size is only about 100K

Design ideas

In order to remove the business logic as much as possible, the component shares the G6 instance, as well as the current operating node and edge instance, for users to complete their own business logic externally

About G6 api: G6

Part of the problem and progress tracking

  • Currently antv/g6there will be an updated version of the problem after the disappearance of custom graphics, it does not support the new antv/g6tracking Issue: G6-Issue

issue has been fixed, use antv/[email protected]and above

  • Currently does not support simultaneous node configuration settings tipsand anchor configuration labelNamecauses a problem can not be switched prompt information g6-issue

issue has been fixed, use antv/[email protected]and above

demo

Personal use demo

use

installation

$ npm install @antv/g6 --save
$ npm install vue-visual-flow --save

Configuration

main.js

import VisualFlow from 'vue-visual-flow';
Vue.use(VisualFlow);

index.vue

<template>
  <div id="app">
    <visual-flow
      :tree-list="treeList"
      :tool-list="toolList"
      :contextmenu-list="contextmenuList"

      :graph.sync="graph"
      :current-node.sync="currentNode"
      :current-edge.sync="currentEdge"

      @contextmenuEvent="contextmenuEvent"
    />
  </div>
</template>

< script > 
export  default  { 
  name : 'App' , 
  data ( )  { 
    return  { 
      // Tree node list on the left, compatible with 2-n depth 
      treeList : [ 
        // First level category 
        { 
          label : 'First level category 1' , 
          showFlag : false , 
          children : [ 
            // Secondary category 
            { 
              label : 'Secondary category 1-1' , 
              showFlag : false , 
              children : [ 
                // Three-level category (node) 
                { 
                  // Basic attribute 
                  label: 'Node 1' ,  // Node display name 
                  tips : 'Add some node description information here~' ,  // (Optional) Node floating tip 
                  inPoints : [  // Enter anchor point array 
                    { 
                      dataType : 'type1' ,  / / Custom anchor point type, only in and out anchor points of the same type can be connected 
                      labelName : 'Incoming anchor point type is type1' ,  // (optional) Anchor point prompt information 
                    } , 
                    { 
                      dataType : 'type2' , 
                      labelName : 'Incoming anchor point type is type2' , 
                    } , 
                  ] , 
                  outPoints : [  // Out anchor point array 
                    { 
                      dataType : 'type1', 
                      labelName : 'Anchor point type is type1' , 
                    } , 
                  ] ,

                  // Custom attribute 
                  itemId : 'xxx' ,  // Node id 
                } , 
              ] , 
            } , 
          ] , 
        } , 
      ] , 
      // Optional canvas control 
      toolList : [ 'zoomIn' ,  'zoomOut' ,  'adjustCanvas' ,  ' realRatio' ,  'autoFormat' ,  'fullScreen' ] ,  
      // right-click menu configuration 
      contextmenuList : { 
        // node right-click menu 
        node : [ 
          { 
            label : 'delete node' , 
            eventName :'removeNode' ,  // custom event contextmenuEvent will capture this field 
          } , 
        ] , 
        // side right-click menu 
        edge : [ 
          { 
            label : 'remove edge' , 
            eventName : 'removeEdge' , 
          } , 
        ] , 
        // right-click menu 
        canvas : [ 
          { 
            label : 'Don't know what to do' , 
            eventName : 'unknow' , 
          } , 
        ] , 
      } ,

      // Share g6 instance 
      graph with components : { } ,  // g6 instance 
      currentNode : { } ,  // Node instance 
      currentEdge : { } ,  // Edge instance when left and right keys 
    } ; 
  } , 
  methods : { 
    contextmenuEvent ( eventName )  { 
      // eventName matches the field with the same name in contextmenuList 
      if  ( eventName  ===  'removeNode' )  { 
        this . graph . removeItem ( this . currentNode);
      }

      if (eventName === 'removeEdge') {
        this.graph.removeItem(this.currentEdge);
      }

      if  ( eventName  ===  'unknow' )  { 
        alert ( 'Really didn't do anything' ) ; 
      } 
    } , 
  } , 
} ; 
</ script >

Download Details:

Author: qunzi0214

Demo: https://github.com/qunzi0214/vue-visual-flow-demo

Source Code: https://github.com/qunzi0214/vue-visual-flow

vue vuejs javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

8 Popular Websites That Use The Vue.JS Framework

In this article, we are going to list out the most popular websites using Vue JS as their frontend framework. Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.

Vue Native is a framework to build cross platform native mobile apps using JavaScript

Vue Native is a framework to build cross platform native mobile apps using JavaScript. It is a wrapper around the APIs of React Native. So, with Vue Native, you can do everything that you can do with React Native. With Vue Native, you get

How to Make a Simple Vue Custom Select Component

In this article, you’ll learn how to build a Vue custom select component that can be easily be styled using your own CSS. In fact, it’s the same component that we use in production on Qvault, and you can see it in action on the playground.

Creating a Custom Tooltip Component in Vue

There are plenty of libraries out there that will have you up and running with a good tooltip solution in minutes. However, if you are like me, you are sick and tired of giant dependency trees that have the distinct possibility of breaking at any time.

Vue ShortKey plugin for Vue.js

Vue-ShortKey - The ultimate shortcut plugin to improve the UX .Vue-ShortKey - plugin for VueJS 2.x accepts shortcuts globaly and in a single listener.