Drawflow

2025-12-11 0 395

Drawflow

简单的流库。

Drawflow使您可以轻松,快速地创建数据流。

安装一个JavaScript库和四行代码。

现场演示

?主题编辑生成器

目录

  • 特征
  • 安装
    • 跑步
  • 鼠标和钥匙
  • 编辑
    • 选项
  • 模块
  • 节点
  • 方法
    • 方法示例
  • 事件
    • 事件示例
  • 导出 /导入
    • 导出示例
  • 例子
  • 执照

特征

  • 阻力节点
  • 多个输入 /输出
  • 多个连接
  • 删除节点和连接
  • 添加/删除输入/输出
  • 重新路由连接
  • 数据同步节点
  • 放大 /退出
  • 清除数据模块
  • 支持模块
  • 编辑模式编辑,固定或查看
  • 进出口数据
  • 事件
  • 移动支持
  • 香草JavaScript(无依赖关系)
  • NPM
  • VUE支持组件节点&& nuxt

安装

下载或克隆存储库,然后复制DIST文件夹,CDN选项或NPM。

克隆

git克隆https://gi*thub.c*om*/jerosoler/drawflow.git

CDN

Drawflow.min.css\”>
<script src=\”https://cdn.jsd*el*i*vr.net/gh/jerosoler/Drawflow/dist/ Drawflow .min.js\”></script>
# or version view releases https://*git*hub.*com/jerosoler/Drawflow/releases
<link rel=\”stylesheet\” href=\”https://unpkg**.co*m/Drawflow@x.x.xx/dist/ Drawflow .min.css\” />
<script src=\”https://unpkg**.co*m/Drawflow@x.x.xx/dist/ Drawflow .min.js\”></script>\”>

# Last
< link rel =\" stylesheet \" href =\" https://cdn.jsd*el*i*vr.net/gh/jerosoler/Drawflow/dist/ Drawflow .min.css \" >
< script src =\" https://cdn.jsd*el*i*vr.net/gh/jerosoler/Drawflow/dist/ Drawflow .min.js \" > </ script >
# or version view releases https://*git*hub.*com/jerosoler/Drawflow/releases
< link rel =\" stylesheet \" href =\" https://unpkg**.co*m/Drawflow@x.x.xx/dist/ Drawflow .min.css \" />
< script src =\" https://unpkg**.co*m/Drawflow@x.x.xx/dist/ Drawflow .min.js \" > </ script > 

NPM

 npm i Drawflow

打字稿

外部包装。更多信息#119

 npm install - D @ types / Drawflow 

进口

Drawflow \’
import style Drawflow from \’ Drawflow /dist/ Drawflow .min.css\’\”>

 import Drawflow from \' Drawflow \'
import style Drawflow from \' Drawflow /dist/ Drawflow .min.css\' 

要求

Drawflow \’)
var style Drawflow = require(\’ Drawflow /dist/ Drawflow .min.css\’)\”>

 var Drawflow = require ( \' Drawflow \' )
var style Drawflow = require ( \' Drawflow /dist/ Drawflow .min.css\' )

创建Drawflow的父元素。

 < div id =\" Drawflow \" > </ div >

跑步

启动Drawflow 。

Drawflow\”);
const editor = new Drawflow (id);
editor.start();\”>

 var id = document . getElementById ( \" Drawflow \" ) ;
const editor = new Drawflow ( id ) ;
editor . start ( ) ;
范围 类型 描述
ID 目的 模块的名称
使成为 目的 这是为Vue。
父母 目的 这是为Vue。父实例

对于VUE 2示例。

 import Vue from \'vue\'

// Pass render Vue
this . editor = new Drawflow ( id , Vue , this ) ;

对于VUE 3示例。

Drawflow(id, Vue);
// Pass render Vue 3 Instance
const internalInstance = getCurrentInstance()
editor.value = new Drawflow (id, Vue, internalInstance.appContext.app._context);\”>

 import { h , getCurrentInstance , render } from \'vue\'
const Vue = { version : 3 , h , render } ;

this . editor = new Drawflow ( id , Vue ) ;
// Pass render Vue 3 Instance
const internalInstance = getCurrentInstance ( )
editor . value = new Drawflow ( id , Vue , internalInstance . appContext . app . _context ) ;

nuxt

添加到nuxt.config.js文件

Drawflow\’],

}\”>

build: {
    transpile : [ \' Drawflow \' ] ,
    ...
  } 

鼠标和钥匙

  • DEL键删除元素。
  • 右键单击以显示删除选项(移动长按)。
  • 左键按下以移动选择的编辑器或节点。
  • CTRL +鼠标车轮放大/输出(移动捏)。

编辑

您可以将编辑器更改为固定类型以阻止。只有编辑器才能移动。您可以在开始前将其放置。

 editor . editor_mode = \'edit\' ; // Default
editor . editor_mode = \'fixed\' ; // Only scroll

您还可以调整缩放值。

 editor . zoom_max = 1.6 ;
editor . zoom_min = 0.5 ;
editor . zoom_value = 0.1 ;

编辑选项

范围 类型 默认 描述
重新路由 布尔 错误的 主动重新路由
reroute_fix_curvature 布尔 错误的 修复添加点
曲率 数字 0.5 曲率
reroute_curvature_start_end 数字 0.5 曲面重新路由第一点和LAS点
reroute_curvaturation 数字 0.5 曲面重新路由
reroute_width 数字 6 重新路由的宽度
line_path 数字 5 线的宽度
force_first_input 布尔 错误的 强制第一个输入将连接放在节点顶部
editor_mode 文本 编辑 编辑编辑,修复了已修复的节点但可用的输入字段,仅查看以查看
飞涨 数字 1 默认缩放
zoom_max 数字 1.6 默认缩放最大
zoom_min 数字 0.5 默认变焦最小
zoom_value 数字 0.1 默认缩放值更新
ZOOM_LAST_VALUE 数字 1 默认缩放最后值
draggable_inputs 布尔 真的 在单击输入上拖动节点
USEUUID 布尔 错误的 将UUID用作节点ID代替整数索引。仅影响新创建的节点,不影响导入的节点

重新路由

主动重新路由连接。在开始或导入之前使用。

 editor . reroute = true ;

使用双击线连接创建点。双击点以进行删除。

模块

在不同的编辑器中分开您的流量。

 editor . addModule ( \'nameNewModule\' ) ;
editor . changeModule ( \'nameNewModule\' ) ;
editor . removeModule ( \'nameModule\' ) ;
// Default Module is Home
editor . changeModule ( \'Home\' ) ;

删除模块是否在同一模块中,将其重定向到家庭模块

节点

添加节点很简单。

 editor . addNode ( name , inputs , outputs , posx , posy , class , data , html ) ;
范围 类型 描述
姓名 文本 模块的名称
输入 数字 DE输入数量
输出 数字 DE输出数量
pos_x 数字 左开始节点的位置
铭文 数字 在开始节点上的位置
班级 文本 将className添加到de node。多个班级名称被空间隔开
数据 JSON 传递到节点的数据
html 文本 html在节点或寄存器节点的名称上绘制。
TypeNode 布尔和文字 默认为false,对象html,vue的vue

您可以在输入,TextAarea中使用属性df-*,也可以选择与节点数据同步和可满足的

trributs倍增父母支持df – * – *…

节点示例

 var html = `
<div><input type=\"text\" df-name></div>
` ;
var data = { \"name\" : \'\' } ;

editor . addNode ( \'github\' , 0 , 1 , 150 , 300 , \'github\' , data , html ) ;

注册节点

可以重复使用的注册节点。

Drawflow!!\”;
editor.registerNode(\’test\’, html);
// Use
editor.addNode(\’github\’, 0, 1, 150, 300, \’github\’, data, \’test\’, true);

// For vue
import component from \’~/components/testcomponent.vue\’
editor.registerNode(\’name\’, component, props, options);
// Use for vue
editor.addNode(\’github\’, 0, 1, 150, 300, \’github\’, data, \’name\’, \’vue\’);\”>

 var html = document . createElement ( \"div\" ) ;
html . innerHTML =  \"Hello Drawflow !!\" ;
editor . registerNode ( \'test\' , html ) ;
// Use
editor . addNode ( \'github\' , 0 , 1 , 150 , 300 , \'github\' , data , \'test\' , true ) ;

// For vue
import component from \'~/components/testcomponent.vue\'
editor . registerNode ( \'name\' , component , props , options ) ;
// Use for vue
editor . addNode ( \'github\' , 0 , 1 , 150 , 300 , \'github\' , data , \'name\' , \'vue\' ) ;
范围 类型 描述
姓名 文本 模块已注册的名称。
html 文本 html到绘制或VUE组件。
道具 JSON 仅用于Vue。组件的道具。不需要
选项 JSON 仅用于Vue。组件的选项。不需要

方法

其他可用功能。

Mehtod 描述
zoom_in() 增量Zoom +0.1
zoom_out() 减速-0.1
getNodeFromid(id) 获取节点的信息。例如:ID:5
getNodesFromName(名称) 返回节点ID的数组。例如:名称:电报
removenodeid(id) 删除节点。 EX ID:node-x
UPDATATENODEDATAFOMID 更新数据元素。例如:5,{名称:\’ Drawflow \’}
addNodeInput(ID) 将输入添加到节点。 EX ID:5
AddNodeOutput(ID) 将输出添加到节点。 EX ID:5
removenodeInput(ID,input_class) 删除输入到节点。 EX ID:5,Input_2
removEnodeOutput(ID,output_class) 删除输出到节点。 EX ID:5,output_2
addConnection(id_output,id_input,output_class,input_class) 添加连接。例如:15,16,\’output_1\’,\’input_1\’
removesingLeconNection(ID_OUTPUT,ID_INPUT,output_class,input_class) 删除连接。例如:15,16,\’output_1\’,\’input_1\’
UpdateConnectionNodes(ID) 来自节点EX ID的更新连接位置:node-x
removeConnectionNodeid(ID) 删除节点连接。 EX ID:node-x
getModuleFromNodeID(ID) 获取模块的名称在哪里ID。 EX ID:5
clearModuleselectectectear() 选择的模块的清晰数据
清除() 清除所有模块和模块的所有数据删除。

方法示例

 editor . removeNodeId ( \'node-4\' ) ; 

事件

您可以检测正在发生的事件。

可用事件列表:

事件 返回 描述
结节 ID 节点的ID
肿瘤 ID 节点的ID
nodatatachanged ID 节点df-*属性的ID更改。
nodeSelectect ID 节点的ID
节点选择 真的 取消选择节点
nodemaved ID 节点的ID
连接start {output_id,output_class} 选定的节点和输出的ID
ConnectionCancel 真的 连接取消
连接创建 {output_id,input_id,output_class,input_class} ID的节点和输出/输入选择
连接授予 {output_id,input_id,output_class,input_class} ID的节点和输出/输入选择
连接选择 {output_id,input_id,output_class,input_class} ID的节点和输出/输入选择
ConnectionUnselected 真的 取消选择连接
AddReroute ID 节点输出的ID
REMOVEREROUTE ID 节点输出的ID
重新布置 ID 节点输出的ID
模块化 姓名 模块的名称
模块化 姓名 模块的名称
调制 姓名 模块的名称
点击 事件 点击事件
点击端 事件 单击更改后
ContextMenu 事件 单击第二个按钮鼠标事件
莫斯莫夫 {x,y} 位置
MouseUp 事件 MouseUp事件
钥匙 事件 关键事件
飞涨 zoom_level 缩放水平
翻译 {x,y} 位置翻译编辑器
进口 进口 完成导入
出口 数据 数据导出

事件示例

 editor . on ( \'nodeCreated\' , function ( id ) {
  console . log ( \"Node created \" + id ) ;
} ) 

导出 /导入

您可以导出和导入数据。

 var exportdata = editor . export ( ) ;
editor . import ( exportdata ) ;

导出示例

导出数据的示例:

Drawflow\”: {
\”Home\”: {
\”data\”: {}
},
\”Other\”: {
\”data\”: {
\”16\”: {
\”id\”: 16,
\”name\”: \”facebook\”,
\”data\”: {},
\”class\”: \”facebook\”,
\”html\”: \”\\n
\\n
Facebook Message
\\n
\\n \”,
\”inputs\”: {},
\”outputs\”: {
\”output_1\”: {
\”connections\”: [
{
\”node\”: \”17\”,
\”output\”: \”input_1\”
}
]
}
},
\”pos_x\”: 226,
\”pos_y\”: 138
},
\”17\”: {
\”id\”: 17,
\”name\”: \”log\”,
\”data\”: {},
\”class\”: \”log\”,
\”html\”: \”\\n
\\n
Save log file
\\n
\\n \”,
\”inputs\”: {
\”input_1\”: {
\”connections\”: [
{
\”node\”: \”16\”,
\”input\”: \”output_1\”
}
]
}
},
\”outputs\”: {},
\”pos_x\”: 690,
\”pos_y\”: 129
}
}
}
}
}
\”>

{
    \" Drawflow \" : {
        \"Home\" : {
            \"data\" : {}
        },
        \"Other\" : {
            \"data\" : {
                \"16\" : {
                    \"id\" : 16 ,
                    \"name\" : \" facebook \" ,
                    \"data\" : {},
                    \"class\" : \" facebook \" ,
                    \"html\" : \"\\n        
\\n          
 Facebook Message
\\n        
\\n        \",
                    \"inputs\" : {},
                    \"outputs\" : {
                        \"output_1\" : {
                            \"connections\" : [
                                {
                                    \"node\" : \" 17 \" ,
                                    \"output\" : \" input_1 \"
                                }
                            ]
                        }
                    },
                    \"pos_x\" : 226 ,
                    \"pos_y\" : 138
                },
                \"17\" : {
                    \"id\" : 17 ,
                    \"name\" : \" log \" ,
                    \"data\" : {},
                    \"class\" : \" log \" ,
                    \"html\" : \"\\n            
\\n              
 Save log file
\\n            
\\n            \",
                    \"inputs\" : {
                        \"input_1\" : {
                            \"connections\" : [
                                {
                                    \"node\" : \" 16 \" ,
                                    \"input\" : \" output_1 \"
                                }
                            ]
                        }
                    },
                    \"outputs\" : {},
                    \"pos_x\" : 690 ,
                    \"pos_y\" : 129
                }
            }
        }
    }
}

例子

查看文件夹文档中的完整示例。
还有一个示例如何在自定义元素中使用Drawflow 。 (基于litelement)。

执照

麻省理工学院许可证

下载源码

通过命令行克隆项目:

git clone https://github.com/jerosoler/Drawflow.git

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

申明:本文由第三方发布,内容仅代表作者观点,与本网站无关。对本文以及其中全部或者部分内容的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。本网发布或转载文章出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,也不代表本网对其真实性负责。

左子网 建站资源 Drawflow https://www.zuozi.net/35151.html

lite xl
上一篇: lite xl
webglstudio.js
下一篇: webglstudio.js
常见问题
  • 1、自动:拍下后,点击(下载)链接即可下载;2、手动:拍下后,联系卖家发放即可或者联系官方找开发者发货。
查看详情
  • 1、源码默认交易周期:手动发货商品为1-3天,并且用户付款金额将会进入平台担保直到交易完成或者3-7天即可发放,如遇纠纷无限期延长收款金额直至纠纷解决或者退款!;
查看详情
  • 1、描述:源码描述(含标题)与实际源码不一致的(例:货不对板); 2、演示:有演示站时,与实际源码小于95%一致的(但描述中有”不保证完全一样、有变化的可能性”类似显著声明的除外); 3、发货:不发货可无理由退款; 4、安装:免费提供安装服务的源码但卖家不履行的; 5、收费:价格虚标,额外收取其他费用的(但描述中有显著声明或双方交易前有商定的除外); 6、其他:如质量方面的硬性常规问题BUG等。 注:经核实符合上述任一,均支持退款,但卖家予以积极解决问题则除外。
查看详情
  • 1、左子会对双方交易的过程及交易商品的快照进行永久存档,以确保交易的真实、有效、安全! 2、左子无法对如“永久包更新”、“永久技术支持”等类似交易之后的商家承诺做担保,请买家自行鉴别; 3、在源码同时有网站演示与图片演示,且站演与图演不一致时,默认按图演作为纠纷评判依据(特别声明或有商定除外); 4、在没有”无任何正当退款依据”的前提下,商品写有”一旦售出,概不支持退款”等类似的声明,视为无效声明; 5、在未拍下前,双方在QQ上所商定的交易内容,亦可成为纠纷评判依据(商定与描述冲突时,商定为准); 6、因聊天记录可作为纠纷评判依据,故双方联系时,只与对方在左子上所留的QQ、手机号沟通,以防对方不承认自我承诺。 7、虽然交易产生纠纷的几率很小,但一定要保留如聊天记录、手机短信等这样的重要信息,以防产生纠纷时便于左子介入快速处理。
查看详情

相关文章

猜你喜欢
发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务