Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

workflow-bpmn-modeler-zf

GoldSubmarine74MIT3.0.9

基于 vue`bpmn.io@7.0` ,实现 flowable 的 modeler 模型设计器

vue, iview-ui, flowable, 模型设计器

readme

English | 简体中文

workflow-bpmn-modeler

NPM Version NPM Downloads

🔥 This project implements flowable's workflow designer based on vue and `bpmn.io@7.0`

Preview 📟

20200930030243

Online demo 📢

👉 https://goldsubmarine.github.io/workflow-bpmn-modeler/demo/

Install ⏳

# Install
yarn add workflow-bpmn-modeler

How to use 👣

<template>
  <div>
    <bpmn-modeler
      ref="refNode"
      :xml="xml"
      :users="users"
      :groups="groups"
      :categorys="categorys"
      :is-view="false"
      @save="save"
    />
  </div>
</template>

<script>
import bpmnModeler from "workflow-bpmn-modeler";

export default {
  components: {
    bpmnModeler,
  },
  data() {
    return {
      xml: "", // Query the xml
      users: [
        { name: "The Beatles", id: "1" },
        { name: "The Rolling Stones", id: "2" },
        { name: "Pink Floyed", id: "3" },
      ],
      groups: [
        { name: "Folk Music", id: "4" },
        { name: "Rock Music", id: "5" },
        { name: "Classical Music", id: "6" },
      ],
      categorys: [
        { name: "Music", id: "7" },
        { name: "Articles", id: "8" },
      ],
    };
  },
  methods: {
    getModelDetail() {
      // Send request to get xml
      // this.xml = response.xml
    },
    save(data) {
      console.log(data);  // { process: {...}, xml: '...', svg: '...' }
    },
  },
};
</script>

Iframe Deployment 🎪

If your project is a jquery or react project, you can integrate the workflow designer by means of an iframe

This repository deployed a static page by the github pages, using jsdelivr cdn, access in China is also very fast, so you can directly integrate the pages of this repository, because all the free github resources are used, did not build their own server maintenance, so do not worry about the failure of resources.

Of course you can also download the corresponding version from the docs/lib folder for local deployment.

The integration method is as follows (ps: you can copy the following code directly into an html file and try it out)

<!DOCTYPE html>
<html lang="en">
  <body>
    <iframe
      src="https://goldsubmarine.github.io/workflow-bpmn-modeler/cdn/0.2.8/"
      id="myFrame"
      frameborder="0"
      width="100%"
      height="800px">
    </iframe>

    <script>
      let myFrame = document.getElementById("myFrame");
      // Get details
      window.addEventListener("message", (event) => {
        console.log(event.data); // { xml: 'xxx', img: 'xxx', process: {} }
      });
      myFrame.onload = () => {
        let postMsg = {
          xml: "", // Query the xml
          users: [
            { name: "The Beatles", id: "1" },
            { name: "The Rolling Stones", id: "2" },
            { name: "Pink Floyed", id: "3" },
          ],
          groups: [
            { name: "Folk Music", id: "4" },
            { name: "Rock Music", id: "5" },
            { name: "Classical Music", id: "6" },
          ],
          categorys: [
            { name: "Music", id: "7" },
            { name: "Articles", id: "8" },
          ],
          isView: false
        }
        // Set initialization value
        myFrame.contentWindow.postMessage(postMsg, "*")
      }
    </script>
  </body>
</html>

Customization 🛠

This component is aligned to the official flowable designer, which is the standard for implementing flowable's xml rules, and the terms used in it are all terminology from the official documentation. So this component is just a tool for programmers to model and export xml by themselves during the development phase, and it is wrong to try to customize the behavior of this modeler. Your own business should be developed separately to implement it.

The component will not upgrade the UI library or vue in the future, and regardless of library compatibility, integrating the modeler via an iframe is the easiest and correct way to do it.

:zap: wechat :zap: alipay
  • @bufegar ¥100
  • anonymous ¥20

License 📄

MIT

Copyright (c) 2020-present, charles

changelog

ChangeLog

v0.2.0

  • 支持配置执行监听器
  • 修复CDATA丢失问题

v0.2.1

  • 支持 iframe 部署

v0.2.2

  • 支持 view 模式,自适应实现居中效果
  • 转换为 es5 后发布

v0.2.3

  • 操作栏增加保存模型按钮
  • 居中功能移除左侧面板宽度
  • iframe部署交互方式修改
  • 任务节点支持多实例
  • 用户任务节点支持任务监听器
  • 修复打开xml,执行监听器数据丢失问题
  • 修复属性删除后再次点击又恢复的问题
  • iframe部署支持设置isView属性

v0.2.4

  • 修复候选组设置后数据不能回显到面板
  • 移除对element的监听,提升性能

v0.2.5

  • 修复初始化流程面板加载,fix #8
  • 修复滚轮缩放问题,fix #17
  • 修复svg高度问题,fix #18