Coder Social home page Coder Social logo

didi / logicflow Goto Github PK

View Code? Open in Web Editor NEW
6.8K 85.0 959.0 15.16 MB

A flow chart editing framework focusing on business customization. 专注于业务自定义的流程图编辑框架,支持实现脑图、ER图、UML、工作流等各种图编辑场景。

Home Page: https://site.logic-flow.cn

License: Apache License 2.0

JavaScript 22.82% HTML 6.36% TypeScript 65.87% CSS 0.72% Shell 0.02% Vue 4.22%
flowchart graph mvvm visualization bpmn diagram flow

logicflow's Introduction

LogicFlow logo

Version Download LICENSE

简体中文 | English

LogicFlow is a flowchart editing framework , providing a series of functions necessary for flowchart interaction and editing, as well as simple and flexible node customization, plug-in and other expansion mechanisms, so that we can quickly meet the needs of class flowcharts in business systems.

Feature

  • 🛠 High scalability

    Compatible with the process editing requirements of various product customizations, most modules are implemented in the form of plug-ins, and each module is supported to be plugged and unplugged freely.

  • 🚀 Independent and Complete

    Flowcharts can fully express business logic without being limited by process engines.

  • 🎯 Professional

    Focus on business process flow editing

Usage

Install

# npm
$ npm install @logicflow/core @logicflow/extension --save

Example

// create container
<div id="container"></div>;

// prepare data
const data = {
  // node data
  nodes: [
    {
      id: '21',
      type: 'rect',
      x: 100,
      y: 200,
      text: 'rect node',
    },
    {
      id: '50',
      type: 'circle',
      x: 300,
      y: 400,
      text: 'circle node',
    },
  ],
  // edge data
  edges: [
    {
      type: 'polyline',
      sourceNodeId: '50',
      targetNodeId: '21',
    },
  ],
};
// render instance
const lf = new LogicFlow({
  container: document.querySelector('#container'),
  width: 700,
  height: 600,
});

lf.render(data);

Document

Our Document Address

Core Capability

Flowchart Editor Quick Build

Providing various capabilities necessary for editing a flowchart, which is also the basic capability of LogicFlow::

  • The ability to draw graphs. Draw nodes and lines of various shapes based on SVG, and provide basic nodes (rectangles, circles, polygons, etc.) and lines (straight lines, polylines, curves)

  • All kinds of interactive capabilities. Respond to various mouse events (hover, click, drag, etc.) of nodes, lines, and graphs. Such as node dragging, dragging to create edges, line adjustment, double-clicking nodes to edit text, etc.

  • Ability to improve editing efficiency. Provide grids, alignment lines, previous step, next step, keyboard shortcuts, image zoom in and out, etc., to help users improve editing efficiency

  • Providing Rich API. Developer completes the interaction with LogicFlow by calling API parameters and listening to events

    The following is an example of a flowchart made through LogicFlow's built-in nodes and supporting capabilities:

Expand based on business scenarios

When basic capabilities cannot meet business needs, it needs to be expanded based on business scene.

  • Set the style of all elements on the graph, such as the size and color of various nodes, lines, anchor points, arrows, alignment lines, etc., to meet the needs of front-end style adjustments
  • API extensions. Supports registering custom methods on LogicFlow, such as extending the method of providing image downloads through API extensions
  • Custom nodes, lines. Built-in graphics nodes such as rectangles and circles often cannot meet actual business needs, and nodes with business significance need to be defined. LogicFlow provides a way for users to customize nodes with custom graphics and business data, such as the "Approval" node in the process approval scenario
  • Extension components. LogicFlow provides an HTML layer and a series of coordinate transformation logic on top of the SVG layer, and supports registering components on the HTML layer. Host R&D can develop components based on any View framework through the LogicFlow API, such as the right-click menu of the node, the control panel, etc.
  • Data conversion adapter. The graph data exported by LogicFlow by default may not be suitable for all businesses. At this time, you can use the adapter API to do custom conversion when the graph data is input and output from LogicFlow, such as converting to BPMN-standard graph data.
  • Built-in partial expansion capabilities. Based on the above-mentioned expansion capabilities, we also provide a extension package, which is used to store the general-purpose nodes and components precipitated under the current business, such as nodes and data adapters oriented to the BPMN specification, and the default menu. Note that extension can be installed separately and supports on-demand import

Based on the above expanded capabilities, front-end R&D can flexibly develop required nodes, components, etc. according to the needs of actual business scenarios. Below are two flow charts based on LogicFlow's expansion capabilities:

Flow Organizer Demo

demo link:https://site.logic-flow.cn/demo/dist/organizer/

code link:https://github.com/Logic-Flow/docs/tree/master/demo/organizer

图片:organizer

BPMN Application Demo

demo link:http://logic-flow.org/examples/#/extension/bpmn

code link:https://github.com/didi/LogicFlow/tree/master/examples/src/pages/usage/bpmn

图片:bpmn

Approval-Flow Application Demo

demo link:http://logic-flow.org/examples/#/usage/approve

code link:https://github.com/didi/LogicFlow/tree/master/examples/src/pages/usage/approve

图片: 审批流

Vue Application Demo

code link: https://github.com/xinxin93/logicflow_vue_demo

https://dpubstatic.udache.com/static/dpubimg/e35cef10-bb7c-4662-a494-f5aac024c092.gif

Examples of Drawing Tools

LogicFlow not only supports the development of a fixed overall style like bpmn.js, but also a flowchart tool that generates data and is executable in the process engine. It also supports drawing tools that implement free control styles like ProcessOn.

demo link:http://logic-flow.org/mvp/index.html

code link:https://github.com/didi/LogicFlow/tree/master/site/mvp

The example picture is as follows: logicflow-1.0-4.png

Vue3 Node-red Style Demo

code link: https://github.com/Logic-Flow/logicflow-node-red-vue3

node-red

LogicFlow with draft-js

code link: https://github.com/towersxu/draft-flow

draft-flow

Contact US

Join Wechat

please add wechat "logic-flow" to join the user group

Join QQ Group

How to Contribute

LogicFlow is open to the outside, whether it is just fixing docment typo or a major reconstruction of the overall function of LogicFlow, we welcome it. For each of your PRs, we will carefully review, reply, and merge them. Details can see LogicFlow Contribution Guides.

Recommended Books

LogicFlow supports the generation of structured data applicable to various process engines. If you are using Activiti process engine in your project, we recommend combining it with Mr. Hebo's book 《深入Activiti流程引擎:核心原理与高阶实战》, This book is very helpful for systematic learning and in-depth mastery of Activiti/Flowable usage.

《深入Activiti流程引擎:核心原理与高阶实战》

logicflow's People

Contributors

akhil-yuan avatar boyongjiong avatar btea avatar chengranyan avatar cpf23333 avatar dymonelewis avatar gh565923562 avatar guozhenyi avatar hmilin avatar juzhiyuan avatar keytolove avatar lww117 avatar muyuanshan avatar mvcrak avatar oe avatar oliwans avatar ospoon avatar s-boaz avatar serendipity96 avatar shanquanyaoyue avatar sunyongjian avatar towersxu avatar way2ex avatar wbccb avatar wuchenguang1998 avatar wumail avatar xiaoxian521 avatar xinxin93 avatar yhlchao avatar zhangmingzhao1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

logicflow's Issues

VUE框架中重复进入到Logicflow页,点击节点右键事件重复触发

问题描述
第一次进入到有默认数据的LogicFlow页,点击节点右键事件触发正常。
然后回退到其他页,再次进入到LogicFlow页,再次点击节点右键事件,就会多触发一次,
... 重复上述动作,每进入到LogicFlow页,右键事件触发次数多增加一次

image

环境信息描述
至少包含以下部分:

  1. 系统类型(Mac或者Windows)
    windows10和ubuntu14
  2. 浏览器类型 (chrome80 或者 IE11)
    chrome88(windows)和chrome87(ubuntu)

最简复现demo
对首页提供的vue demo,进行了修改,可以复现此bug

https://github.com/tongtie/logicflow_vue_demo.git

  1. 从首页点击LogicFlow按钮,进入到LogicFlow页
    image
  2. 在LogicFlow页,点击回退按钮,回退到首页
    image
  3. 重复上述步骤,然后点击节点属性,发现触发了多次,并报错误(如问题描述中的图片所示)

感觉是Menu中的click事件多次注册导致。
前端新手,也有可能是vue框架结合Logicflow用的不对,没有写组件销毁啥的导致,请帮忙定位下,谢谢

群组节点

请问分组节点支持吗?可以把基本节点拖进组里,拖拽组的时候组里的基本节点跟随移动,也可以拖拽移出组。

[Bug report] vite下样式警告

问题描述
请用简洁的语言描述你遇到的bug,至少包括以下部分,如提供截图请尽量完整:

  1. 问题触发的条件
    vite下,代码会出现警告,没在源代码内找到这行,但是是 引入@logicflow/extension/lib/style/index.css才出现

image

  1. 期望的表现
    警告消失
  2. 实际的表现
    出现警告

环境信息描述
至少包含以下部分:

  1. 系统类型(Mac或者Windows) mac
  2. 浏览器类型 (chrome80 或者 IE11) 无关

最简复现demo
一般来说通过文字和截图的描述我们很难定位到问题,为了帮助我们快速定位问题并修复,请按照以下指南编写并上传最简复现demo:

  1. 根据现有项目遇到的问题,尝试精简代码,确定问题的最小复现条件
  2. 使用脚手架创建新项目,基于最小复现条件编写稳定的最简复现demo
  3. 删除项目中的node_modules部分,打包项目,并拖拽到issue输入框中上传(或提供远程可下载地址)

[Bug report] sourceRules规则不触发

问题描述
做一个审批流,希望开始节点只能连接一个其他节点,但是以下代码不符合期望

最简复现demo

  lf.register('START', ({ CircleNode, CircleNodeModel }) => {
    class StartNodeModel extends CircleNodeModel {
      // 开始 0个连入 1个连出
      setAttributes() {
        this.targetRules.push({
          message: '开始节点只能连出',
          validate: (source, target) => {
            return false;
          },
        });
        this.sourceRules.push({
          message: '开始节点只能连出一条分支',
          validate: (source, target) => {
            console.log('触发source', source, target);
            const arr = lf.getEdge({
              sourceNodeId: source.id,
            });
            if (arr.length === 0) {
              return true;
            } else {
              return false;
            }
          },
        });
      }
    }
    return {
      view: CircleNode,
      model: StartNodeModel,
    };
  });

bug复现操作
第一次连接处于选中状态的时候,可以对同一个节点连接多次,没有触发sourceRules里面的规则,后续取消选中状态后恢复正常

bug样式
image

自定义节点创建svg元素

使用 Logic Flow 提供的 h 方法来创建 SVG 元素。对于复杂的元素,可不可以支持导入svg文件,不用一个标签一个标签创建。

LogicFlow使用情况收集有奖问卷

谁在使用 LogicFlow?

感谢正在使用和关注 LogicFlow 的开发者,我们会持续投入,让 LogicFlow 项目和社区更加繁荣。

这个 issue 的出发点

  • 聆听社区的声音,让 LogicFlow 解决实际的问题
  • 吸引更多的开发者参与和贡献
  • 更多的了解 LogicFlow 的实际使用场景,以便后续版本的计划

我们期待您能提供

参与LogicFlow问卷,问卷地址:https://wj.qq.com/s2/9588335/2b7b/。我们会每隔一段时间抽出一部分填写问卷的用户,送出LogicFlow纪念T恤。(目前已经送出第一批30名用户)

LogicFlow 邀你参加活动啦!参加就有机会获得 LogicFlow 周边

社区的各位小伙伴:
大家好!

LogicFlow 开源两个多月,star 数成功突破 1k 。但我们深知 LogicFlow 离优秀、成熟的框架还有距离。为了能更好地服务开发者,让大家能更多地参与到 LogicFlow 的开发中来,同时也期望大家能够更多地了解 LogicFlow ,我们决定推出 LogicFlow 征文活动。

来一点写作灵感!文章内容可参考但不限于以下内容:

  • 新手尝鲜
    还记得第一次安装使用 LogicFlow 吗?还记得把 LogicFlow 嵌入到自己的项目中少写代码,不用操作底层图形的兴奋吗?还记得使用 LogicFlow 遇到的问题、当时怎么解决的吗?欢迎分享 LogicFlow 的教程、实践。

  • 源码解析
    LogicFlow 在框架设计和技术选型上花了大量时间,团队成员在设计之初进行了充分的讨论与尝试。如果你对 LogicFlow 中的任意模块有深入了解,或者你想了解其中某个模块的实现,欢迎撰写源码解析类文章输出到社区。在你探究源码过程中,如果发现有设计不合理或者写的不够好的代码,欢迎随时给我们提 PR ,你的 PR一经采纳,我们将为你寄出一份 LogicFlow 周边礼品。

  • 应用案例
    对于一个开源项目来说,在各种业务场景的应用是最能提现它价值的地方。在 LogicFlow 用户群里,经常看到来自不同公司、不同业务的小伙伴在使用过程中提问,何不借此次机会把你的应用场景分享给广大的社区朋友呢?相信你在使用 LogicFlow 过程中一定有独特的方式和业务场景,LogicFlow 非常需要来自于各种业务场景下的应用案例。

  • 基于 LogicFlow 的二次开发
    社区小伙伴 you 基于 LogicFlow 进行了二次开发,设计出了一套低代码平台:http://hello.321zou.com/ 如果你也有自己的想法和实践,欢迎多多分享,期待你和 LogicFlow 擦出不一样的火花。

  • 写一个插件
    看过 揭秘 LogicFlow 的拓展机制 这篇文章的小伙伴,一定知道 LogicFlow 插件化的**。可以写写你设计的插件的背景,为什么要写这样一个插件?插件有什么功能,插件的设计**、实现细节等等。

  • 贡献文档
    我们收到了一些关于 LogicFlow 文档某个章节难理解的反馈,但是现在团队人力有限,在快速迭代的同时,还要处理群里大家的提问、撰写相关技术文档和使用手册。如果你在使用的过程中发现文档描述不够清晰,示例不够通俗易懂,我们真诚希望你来为 LogicFlow 文档贡献,如:大家在 issue 中提出的 LogicFlow 自定义章节写的比较难理解、不好上手,无论是上手指南,还是示例展示,都期望你来提 PR,一经采纳会在文档中标注贡献者 Github 账号友链。

  • 犀利吐槽

    • 功能不符合预期,缺少某某功能或者某某图形类型
    • bug 有点多,经常看到控制台报错
    • 某个功能模块的设计/代码实现不够优雅
    • ……
      每个项目的环境和技术栈都不太一样,大家在使用过程中难免会遇到各种各样的问题。除了通过在 Github 提 issue 反馈问题,也可以通过本次活动把你在项目中使用 LogicFlow 过程中遇到的各种坑分享给大家。
      当然吐槽不是我们的目的,我们希望针对大家提出的场景能够定位到问题并持续改进,所以我们希望你在吐槽的同时,能够顺便给出你希望达到的效果或者解决方案。我们团队也会针对你在项目中遇到的问题进行修复和改进。
  • 我有一个 idea:
    团队内部维护者的创意是有限的,但社区内小伙伴们的创意是无限的,我们希望和你们一起携手共创。不管你是研发还是产品,假如你有一个很好的 idea,你可以通过本次活动来展现你的创意。包括但不仅限于业务背景、需求调研、需求价值、技术选型、结构流程图等等。我有一个 idea 就差程序员了,这次让 LogicFlow 团队来帮你实现这个愿望。只要你敢想,我们就敢做。还等什么,快来展现你的创意吧!

参与方式

  • 只要是和 LogicFlow 相关的任何文章都可以,我们不限制文章内容、字数,也不限发表文章的平台(专属博客、知乎、掘金等等都可以)。
  • 文章标题中必须带有 LogicFlow 关键字,否则你的文章将不能参与本次活动。文章发布后需要在当前 issue 下评论你的文章链接及标题。
  • 如果你写了一个关于 LogicFlow 的插件,也欢迎评论在此条 issue 下哦。

活动时间

2021 年 4 月 1 日 ~ 2021 年 5 月 31 日

文章评选时间

活动结束后的 7 个工作日内完成评选,我们将通过在你的评论下留言 & 用户群公告的方式通知你的文章是否入选,请记得关注你的 Github 和 群消息哦~

活动奖励

  • 所有入选文章/插件的作者获得 LogicFlow 纪念 T恤一件;
  • 在所有参加活动的小伙伴中抽取 5 名幸运儿,每人赠送 100 元京东卡 1 张
  • 入选文章/插件将在 LogicFlow 官网首页 - 【社区贡献】板块集中展示,并长期留存并标注作者、友链等;
  • 对外 PR 稿标注贡献者 Github 账号。

欢迎各位小伙伴踊跃参与,将你对 LogicFlow 的理解输出到社区,分享给广大的用户,帮助更多的开发者!

声明

注:本次活动最终解释权归 LogicFlow 官方所有。

需要什么功能?

可以反馈下项目中需要的,但是 LogicFlow 目前还不支持的能力。

文档:优化建议

目前 LogicFlow 的文档和示例还是有不太完善的地方,大家可以把在使用过程中,遇到的类似 “想实现某个功能但没有相关文档” 的问题记录到该 issue 下,我们会专门对文档和示例做一次优化。
优化建议举例:

  • 自定义节点的使用文档不易读,成本高,建议优化成怎么怎么样
  • 想实现一个怎么样的常见功能,但是不知道该如何做,希望提供完整的代码示例,希望提供 react/vue 版本的示例
  • 哪部分文档有缺失

不能动态修改 grid 类型和样式

version:0.2.7

问题描述
目前 grid 样式只能在初始化 LogicFlow 时设置,但不能动态修改。

期望
支持通过 API 动态设置 grid 的类型和样式

流程图上传xml,文字位置发生偏移

问题描述
bpmn流程图导出xml文件后,刷新页面,上传xml,文字位置发生偏移。
2. 期望的表现
image
3. 实际的表现
image

环境信息描述
至少包含以下部分:

  1. 系统类型:Mac
  2. 浏览器类型 :Chrome 90.0.4430.212

关于是否要兼容 IE 的讨论

hi,社区的各位小伙伴:

最近 LogicFlow 收到了一些用户反馈,期望 LogicFlow 能兼容 IE 。

如果在你的使用场景中需要在 IE 中使用 LogicFlow,就在此提交一条评论吧,评论内容包括:

  • 需要支持的 IE 版本
  • 需要支持的原因 / 实际场景案例
  • 期望支持的时间

欢迎大家多多反馈交流!
LogicFlow 社区

[Bug report]

自定义节点:使用 Logic Flow 提供的 h 方法来创建 SVG 元素。对于复杂的元素,可不可以支持导入svg文件,不用一个元素一个元素创建。

支持动态修改元素的model

问题描述
在运行时修改元素样式时,需要在view中根据properties修改,这回产生以下问题:

  • 在 view 中修改结构性的样式属性(例如width、height),会导致锚点和外边框不能正常渲染
  • 为了满足业务需求,properties 会存放大量用来修改样式的属性作为依赖,而不是单纯的业务上节点的特性属性
  • view 和 model 的边界变的模糊,渲染数据的变更被插入到了 view 中

自定义节点成本高

version:0.2.*

目前自定义节点成本较高:

  1. 起步复杂,难上手
  2. 自定义步骤不明确
  3. 逻辑不便于理解
  4. 继承内部的简单节点后,效果却与简单节点不一致,失去继承的意义
  5. 坑较多,易受内部代码影响,不熟悉内部代码很难解决遇到的问题

期望:

  1. 上手快速,用最少的代码实现最简单的自定义元素
  2. 步骤明确,无论多复杂的自定义节点,只要跟着文档的步骤,都可以实现
  3. 用户代码清晰
  4. 继承内部节点的类后,不需要太多额外操作,就可以得到内部节点
  5. 消除内部代码对用户代码造成的未知影响

锚点的控制成本较高

问题描述
锚点的设置成本较高,且不便于理解:

  • 配置方式特殊:需要将 anchors 设为访问器属性,并提供 getter
  • 有额外成本:需要使用 mobx 将 其设置为 computed 属性,不好理解

截屏2021-03-09 下午7 00 18

期望

配置简单,便于理解

内部装饰器类型报错

version:<=0.2.8

问题描述:
内部使用装饰器时会有 TypeScript 类型报错 ts(2345),例如:
截屏2021-03-05 下午2 36 49

可能原因:
以上图为例,MultipleSelect 继承自 preact 的 Component,其类型自然也由 preact 提供。
装饰器 @observer 的函数参数类型由 mobx-react 提供,具体类型如下:
截屏2021-03-05 下午2 42 36
其中 IReactComponent 是一个联合类型,每一种都由 React 提供:
截屏2021-03-05 下午2 44 58
也就是 preact 提供的类型与 react 提供的类型不能匹配。

[Bug report]自定义节点中存在的BUG和问题

  1. 在继承自rect的自定义节点中, 设置radius不生效, 一直是直角
  2. 在继承自circle的自定义节点中, 通过设置拖动添加节点时, 该自定义节点的图形一直停留在画布左上角(x=0,y=0), 但是锚点和文本却可以拖动, 查看该节点对应的x和y属性是正确的值, 但是图形显示的位置一直在左上角, 且无法改变

下载BPMN的XML格式错乱,并且有多个换行

问题描述
下载BPMN的XML格式错乱,并且有多个换行。
2. 期望的表现
image

  1. 实际的表现
    image

环境信息描述
至少包含以下部分:

  1. 系统类型:Mac
    2.浏览器类型 :Chrome 90.0.4430.212

vue 项目开发环境properties取值与打包后生产环境取值方式不一致

问题描述
使用拖拽新增节点在properties下定义了一个data属性,开发环境和打包到生产环境取值方式不一致

环境信息描述

  1. Vue项目

最简复现demo

//增加节点
let obj = {
      type: "rect",
      text: item.name,
      des: item.des,
      properties: {
          data: JSON.stringify({
              task_type: 1
          })
      }
  }
this.lf.dnd.startDrag(obj);
//从节点取值
let nodeObj = this.lf.getProperties(node.id);
let properties = {};
if(nodeObj.data){
     // 项目打包需要这样取值
     properties = JSON.parse(nodeObj.data);
 }else if(nodeObj.__ob__){
    // 测试环境需要这样取值
    properties = JSON.parse(nodeObj.__ob__.value.data);
 }

bpmn支持

目前logicflow在extension中内置了bpmnElements和bpmnAdapter两个插件,对于bpmn支持存在如下问题:

  1. bpmnElements只提供了一部分节点。其它类型的节点不支持。
  2. bpmnAdapter只对bpmnElements内置的节点进行了转换,不支持自定义的其它节点。
  3. 支持边界事件。
  4. 支持子流程。

[Bug report] node:click事件有延迟

问题描述
请用简洁的语言描述你遇到的bug,至少包括以下部分,如提供截图请尽量完整:

  1. 问题触发的条件:点击节点的响应事件有延迟
  2. 期望的表现:点击完立马有效果
  3. 实际的表现:点击完有0.5秒左右延迟

环境信息描述
至少包含以下部分:
windows10 chrome 89.0.4389.90

最简复现demo
一般来说通过文字和截图的描述我们很难定位到问题,为了帮助我们快速定位问题并修复,请按照以下指南编写并上传最简复现demo:
官方文档示列代码
screen

获取不到graphModel,所以不能通过配置方式实现nodeMenu和edgeMenu操作节点或边

问题描述

比如我想我的edgeMenu只有删除选项,那么只能通过自定义方式传入进去,如:
const edgeMenu = [ { text: '删除连线', className: 'lf-menu-item', callback(edge) { graphModel.removeEdgeById(edge.id); }, }, ];
但我在自定义配置时,不能获取到graphModel,所以不能实现对边的操作。
节点类似(但节点可以通过自定义节点模型实现,可以满足这个需求)

期望可以支持两种方式。

  1. 支持选择显示默认配置,比如默认edgeMenu已经支持了删除连线、编辑文本,我只想要显示删除连线。
  2. 可以自定义配置中可以获取到graphModel, 方便用户自己实现对边或节点的操作。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.