npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

simple-process-designer

v2.0.7

Published

简单好用的图形化流程定义工具, 基于react, 也可用于angular / vue

Downloads

1,944

Readme

process-designer

介绍

项目需要一款图形化流程定义工具. 由于流程定义工具通常作为流程引擎的附属, 相对项目而言过重. 一款较符合需求的 jsplumb 较庞大, 压缩体积 188KB(而且收费), 所以自己造了个新轮子.\

特点

  • 流程节点可根据需要自行配置
  • 支持react / angular等框架
  • 支持节点自动排列(灵感: 百度脑图)
  • 提供辅助线作图, 很容易对齐
  • 特别适合沿竖直轴线排列的流程图

Install

npm install --save simple-process-designer
or
yarn add simple-process-designer

Usage

React: 参见 example 目录
angular: 参见 example-angular 目录
二者的区别是: react 直接引入组件, angular 需要安装在某个预先存在的 dom 节点上\

第一步: 定义节点模板

const nodeTemplates: PNodeTemplate[] = [
  {
    id: 1,
    type: ElementType.Node,
    label: '操作',
    shape: Shape.Rect,
    dim: { w: 100, h: 30 }
  }
];

第二步: 定义事件

目前内置两个自定义事件:

onActiveNode

// 双击 或 点击 node 上的编辑按钮时 触发此事件 // 回调方法将收到整个 node 节点, 可使用 node 节点的 id, 查找对应的业务对象并弹出编辑框 onActiveNode?: (id: PNodeId) => void;

onDelNode

// 在图中删除节点时调用, 同步调用 对应的 业务对象
onDelNode?: (id: PNodeId) => void;

第三步: 初始化

// angular
// 注意将返回 designerController
// 注意 npm i -S react react-dom
// npm i -D @types/react @types/react-dom
// 在 html 里新建一个节点, 以供安装设计器
// xxx.component.html:
// <div id="xxx" style="width:100%;height:100"></div>
const ProcessDesingerId= 'xxx';
ngAfterViewInit() {
  this.designerController = installProcessDesigner({
    el: ProcessDesingerId,
    config: { nodeTemplates },
    events,
    data: {}    // 可以是空对象, 也可以是上次存入数据库的内容,
    hideEdgeFlagInput: boolean  <== 禁止双击边
  });
}

// react
<ProcessDesigner config={this.config} data={processData} events={events} />

第四步: 编辑, 保存

保存时:

  1. 可以使用 getAllAssoc 方法, 获取全部 节点关联, 并应用到 业务对象上
  2. 可以使用 getDesingerData 方法, 获取 节点设计信息, 以备下次使用

License

MIT © g770728y