UNPKG

rh-vue3-snakerflow-designer

Version:

情怀!N年前使用的工作流引擎,虽然原作者已经不再维护,但是还是有那么一波人还在使用。个人看来其核心功能尚好,麻雀虽少,五脏俱全,是用来学习工作流引擎的好项目。但其流程设计器所用的技术栈可能就跟不上时代了(2016年前的开源项目)。为了让大伙或自己用得更舒心,或者也为了让更多人认识或重新认识这个工作流引擎。本人就花些许时间,使用现阶段前端主流的技术栈重新开发此款流程设计器。如大家在使用的过程中如有啥问题,欢迎留言或进群交流!

90 lines (84 loc) 2.56 kB
import { GraphModel, h, NodeConfig, PolygonNode, PolygonNodeModel } from '@logicflow/core' import { nodeStyleHandle } from '../tool' class JoinModel extends PolygonNodeModel { static extendKey = 'JoinModel'; constructor (data: NodeConfig, graphModel: GraphModel) { if (!data.text) { data.text = '' } if (data.text && typeof data.text === 'string') { data.text = { value: data.text, x: data.x, y: data.y + 40 } } super(data, graphModel) this.points = [ [25, 0], [50, 25], [25, 50], [0, 25] ] } getNodeStyle (): { [x: string]: any; fill?: string; stroke?: string; strokeWidth?: number; } { const style = super.getNodeStyle() style.fill = '#ffffff' style.stroke = '#efb339' return nodeStyleHandle(this, style) } } class JoinView extends PolygonNode { static extendKey = 'JoinNode'; getShape ():h.JSX.Element { const { model } = this.props const { x, y, width, height, points } = model const style = model.getNodeStyle() return h( 'g', { transform: `matrix(1 0 0 1 ${x - width / 2} ${y - height / 2})` }, h('polygon', { ...style, x, y, points }), h( 'svg', { x: (width - 28) / 2, y: (height - 28) / 2, width: 28, height: 28, viewBox: '0 0 1024 1024' }, h('path', { fill: style.stroke, d: 'M256 298.666667a42.666667 42.666667 0 1 0 0-85.333334 42.666667 42.666667 0 0 0 0 85.333334z m0 85.333333a128 128 0 1 0 0-256 128 128 0 0 0 0 256zM256 810.666667a42.666667 42.666667 0 1 0 0-85.333334 42.666667 42.666667 0 0 0 0 85.333334z m0 85.333333a128 128 0 1 0 0-256 128 128 0 0 0 0 256zM768 810.666667a42.666667 42.666667 0 1 0 0-85.333334 42.666667 42.666667 0 0 0 0 85.333334z m0 85.333333a128 128 0 1 0 0-256 128 128 0 0 0 0 256z' }), h('path', { fill: style.stroke, d: 'M213.333333 341.333333h85.333334v341.333334H213.333333V341.333333z' }), h('path', { fill: style.stroke, d: 'M213.333333 341.333333h85.333334a128 128 0 0 0 128 128h170.666666a213.333333 213.333333 0 0 1 213.333334 213.333334h-85.333334a128 128 0 0 0-128-128h-170.666666a213.333333 213.333333 0 0 1-213.333334-213.333334z' }) ) ) } } const Join = { type: 'snaker:join', view: JoinView, model: JoinModel } export { JoinView, JoinModel } export default Join