Git Product home page Git Product logo

cade's Introduction

Cade

一个可视化流程图编辑器,因为目前(2019/04/27)G2的流程图编辑器还不是开源的产品,公司需要自己做一个工作流引擎,所以就用Konvajs自己写了一个。

Demo

https://hashencode.github.io/cade/dist/

Installing

克隆项目后安装依赖

npm install
npm run start

Example

import { Cade } from "./src/scripts/cade";

const cade = new Cade();
// 舞台初始化
cade.stageInit();
// 监听失去焦点事件
cade.onElementBlur().subscribe(res => {
  // do something
});

API

cade.stageInit()
// 初始化舞台
cade.stageInit();
cade.stageImport()
// 导入舞台数据,并设置事件监听
const _stageData = otherStage.toJSON();
cade.stageImport(_stageData);
cade.onCreateBlock()
// 监听块的创建,返回被创建的块
cade.onCreateBlock().subscribe(res=>{
	console.log(res)
})
cade.onUpdateBlock()
// 监听块的更新,返回被更新的块
cade.onUpdateBlock().subscribe(res=>{
	console.log(res)
})
cade.onDestroyBlock()
// 监听块的销毁,返回被销毁的块的副本
cade.onDestroyBlock().subscribe(res=>{
	console.log(res)
})
cade.onCreateArrow()
// 监听箭头的创建,返回被创建的箭头
cade.onCreateArrow().subscribe(res=>{
	console.log(res)
})
cade.onUpdateArrow()
// 监听箭头的更新,返回被更新的箭头
cade.onUpdateArrow().subscribe(res=>{
	console.log(res)
})
cade.onDestroyArrow()
// 监听箭头的销毁,返回被销毁的箭头的副本
cade.onDestroyArrow().subscribe(res=>{
	console.log(res)
})
cade.onElementFocus()
// 监听元素的聚焦,返回被聚焦的元素
cade.onElementFocus().subscribe(res=>{
	console.log(res)
})
cade.onElementBlur()
// 监听元素的失去焦点,返回失去焦点的元素
cade.onElementBlur().subscribe(res=>{
	console.log(res)
})

cade's People

Contributors

hashencode avatar

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.