# flow-view **Repository Path**: dreamof2080/flow-view ## Basic Information - **Project Name**: flow-view - **Description**: 流程图展示 - **Primary Language**: TypeScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-02-14 - **Last Updated**: 2022-09-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 流程图展示工具库 图形化界面展示流程图引擎的流程图信息 ## 使用说明 ### npm ```shell npm install --save-dev @dreamof2080/flow-view ``` ### yarn ```shell yarn add @dreamof2080/flow-view ``` ### yarn和npm方式需要配置webpack 引入如下依赖 ```shell yarn add copy-webpack-plugin --dev // or npm install --save-dev copy-webpack-plugin ``` 在webpack.config.js中配置: ```js const CopyPlugin = require('copy-webpack-plugin'); module.exports = { plugins: [ new CopyPlugin({ patterns: [ { from: path.resolve(__dirname, 'node_modules/@dreamof2080/flow-view/dist/mxgraph'), to: 'mxgraph', }, ] }) ], } ``` 使用 ```js import {initFlowGraph, renderFlowGraph} from '@dreamof2080/flow-view' function view(data) { // 流程图xml数据 const xmlData = ''; // 流程图渲染容器 const container = document.createElement('div'); // 流程图缩略图容器 const thumbnail = document.createElement('div'); // 初始化流程图 const graph = initFlowGraph({ container, // 节点阴影颜色,若取消阴影可设置值为'none' shadowColor: '#050505', // 节点间连接线水流效果颜色 flowedEdgeColor: '#525050', // 节点点击事件 onClick: (id, left, top) => { nodeInfo.style.display = id ? 'block' : 'none' nodeInfo.style.left = left + 'px' nodeInfo.style.top = top + 'px' }, thumbnail }); // 渲染流程图 renderFlowGraph({ graph, data: data2, currentIds: ['ff80808177389ca401776166e46e013e', 'ff80808177389ca401775caec0b700f3'], flowedEdgeIds: ['ff80808177389ca401775c97f23a00de', 'ff80808177389ca401776166e4990140', 'ff80808177389ca401775caec0fd00f4'], }) } ``` 详细用列: https://gitee.com/dreamof2080/flow-view-webpack-test 注意:若要显示水流效果,请增加以下样式信息 ```css .edge-flow-style { stroke-dasharray: 8; animation: dash 0.5s linear; animation-iteration-count: infinite; } @keyframes dash { to { stroke-dashoffset: -16; } } ``` ### script标签引入的方式使用 ```html