├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── README.md ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── index.js └── prod.env.js ├── index.html ├── package-lock.json ├── package.json ├── src ├── App.vue ├── assets │ └── logo.png ├── components │ ├── HelloWorld.vue │ ├── HelloWorldPro-orgi.vue │ ├── HelloWorldPro.vue │ ├── ViewerPro.vue │ ├── custom │ │ ├── CustomContextPad.js │ │ ├── CustomPalette.js │ │ └── index.js │ ├── customer-viewer.js │ ├── draggableForm │ │ ├── attribute.vue │ │ ├── container.vue │ │ ├── container2.vue │ │ ├── containernew.vue │ │ ├── draggableItem.vue │ │ ├── formItem.vue │ │ ├── formitemnew.vue │ │ ├── index.vue │ │ ├── indexnew.vue │ │ ├── jsonDiaolog.vue │ │ ├── modelitem.vue │ │ ├── previewContainer.vue │ │ └── previewDiaolog.vue │ ├── panel copy.vue │ ├── panel-formAndListener.vue │ ├── panel-orgi.vue │ ├── panel.vue │ ├── resource │ │ ├── activiti.json │ │ ├── file.bpmn │ │ ├── file1.bpmn │ │ ├── flowable.json │ │ ├── modeler.json │ │ └── xml.js │ ├── translate │ │ ├── CustomTranslate.js │ │ ├── TranslationsChinese.js │ │ └── index.js │ ├── utils │ │ ├── PanelData.js │ │ └── PanelUtils.js │ └── viewer.vue ├── main.js ├── router │ └── index.js ├── utils │ └── index.js └── views │ ├── draggable.vue │ ├── fm-generate.vue │ └── makingForm.vue ├── static ├── .gitkeep └── workflow.xml └── vue.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parserOptions: { 6 | parser: 'babel-eslint' 7 | }, 8 | env: { 9 | browser: true, 10 | }, 11 | extends: [ 12 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention 13 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 14 | 'plugin:vue/essential', 15 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 16 | 'standard' 17 | ], 18 | // required to lint *.vue files 19 | plugins: [ 20 | 'vue' 21 | ], 22 | // add your custom rules here 23 | rules: { 24 | // allow async-await 25 | 'generator-star-spacing': 'off', 26 | // allow debugger during development 27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-bpmn-flowable 2 | 3 | > vue-bpmn-flowable 4 | 5 | # package.json 6 | 结合activiti的bpmn包 7 | > "activiti-bpmn-moddle": "https://github.com/igdianov/activiti-bpmn-moddle.git", 8 | > "bpmn-js-properties-panel": "https://github.com/RubyLinT/bpmn-js-properties-panel.git, 9 | 10 | 11 | ## Build Setup 12 | 13 | ``` bash 14 | # install dependencies 15 | npm install 16 | 17 | # serve with hot reload at localhost:8080 18 | npm run dev 19 | 20 | # build for production with minification 21 | npm run build 22 | 23 | # build for production and view the bundle analyzer report 24 | npm run build --report 25 | ``` 26 | 27 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 28 | 29 | --- 30 | ## 2.新建空的图,功能要求: 31 | 32 | ① 空的,能自己画; 33 | 34 | ② 以SVG image格式、BPMN diagram格式下载在本地; 35 | 36 | ## 参考链接:(其实就是理解它的思路,把jQuery转化成vue) 37 | 38 | https://github.com/bpmn-io/bpmn-js-examples/blob/master/properties-panel/app/index.html 39 | 40 | https://github.com/bpmn-io/bpmn-js-examples/blob/master/properties-panel/app/index.js 41 | 42 | html: 43 | ```html 44 | 59 | ``` 60 | 61 | js: 62 | ``` 63 | 174 | ``` 175 | css: 176 | ```css 177 | 222 | ``` 223 | 1.一打开页面(图片显示不全可参考详细描述) 224 | 225 | ![](https://upload-images.jianshu.io/upload_images/7016617-103288648736ff80.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 226 | 227 | 2.修改之后下载按钮亮起(图片显示不全可参考详细描述) 228 | 229 | ![](https://upload-images.jianshu.io/upload_images/7016617-74d2a5f8f1f262bd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 230 | 231 | 232 | ### 详细描述 233 | https://www.jianshu.com/p/bdc990db5159 234 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuchfStrong/vue-bpmn-flowable/ec972bcac1e6c8be129998a29e774c336190dd7d/build/logo.png -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function (_path) { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | 15 | exports.cssLoaders = function (options) { 16 | options = options || {} 17 | 18 | const cssLoader = { 19 | loader: 'css-loader', 20 | options: { 21 | sourceMap: options.sourceMap 22 | } 23 | } 24 | 25 | const postcssLoader = { 26 | loader: 'postcss-loader', 27 | options: { 28 | sourceMap: options.sourceMap 29 | } 30 | } 31 | 32 | // generate loader string to be used with extract text plugin 33 | function generateLoaders (loader, loaderOptions) { 34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 35 | 36 | if (loader) { 37 | loaders.push({ 38 | loader: loader + '-loader', 39 | options: Object.assign({}, loaderOptions, { 40 | sourceMap: options.sourceMap 41 | }) 42 | }) 43 | } 44 | 45 | // Extract CSS when that option is specified 46 | // (which is the case during production build) 47 | if (options.extract) { 48 | return ExtractTextPlugin.extract({ 49 | use: loaders, 50 | fallback: 'vue-style-loader' 51 | }) 52 | } else { 53 | return ['vue-style-loader'].concat(loaders) 54 | } 55 | } 56 | 57 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 58 | return { 59 | css: generateLoaders(), 60 | postcss: generateLoaders(), 61 | less: generateLoaders('less'), 62 | sass: generateLoaders('sass', { indentedSyntax: true }), 63 | scss: generateLoaders('sass'), 64 | stylus: generateLoaders('stylus'), 65 | styl: generateLoaders('stylus') 66 | } 67 | } 68 | 69 | // Generate loaders for standalone style files (outside of .vue) 70 | exports.styleLoaders = function (options) { 71 | const output = [] 72 | const loaders = exports.cssLoaders(options) 73 | 74 | for (const extension in loaders) { 75 | const loader = loaders[extension] 76 | output.push({ 77 | test: new RegExp('\\.' + extension + '$'), 78 | use: loader 79 | }) 80 | } 81 | 82 | return output 83 | } 84 | 85 | exports.createNotifierCallback = () => { 86 | const notifier = require('node-notifier') 87 | 88 | return (severity, errors) => { 89 | if (severity !== 'error') return 90 | 91 | const error = errors[0] 92 | const filename = error.file && error.file.split('!').pop() 93 | 94 | notifier.notify({ 95 | title: packageConfig.name, 96 | message: severity + ': ' + error.name, 97 | subtitle: filename || '', 98 | icon: path.join(__dirname, 'logo.png') 99 | }) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | const createLintingRule = () => ({ 12 | test: /\.(js|vue)$/, 13 | loader: 'eslint-loader', 14 | enforce: 'pre', 15 | include: [resolve('src'), resolve('test')], 16 | options: { 17 | formatter: require('eslint-friendly-formatter'), 18 | emitWarning: !config.dev.showEslintErrorsInOverlay 19 | } 20 | }) 21 | 22 | module.exports = { 23 | context: path.resolve(__dirname, '../'), 24 | entry: { 25 | app: './src/main.js' 26 | }, 27 | output: { 28 | path: config.build.assetsRoot, 29 | filename: '[name].js', 30 | publicPath: process.env.NODE_ENV === 'production' 31 | ? config.build.assetsPublicPath 32 | : config.dev.assetsPublicPath 33 | }, 34 | resolve: { 35 | extensions: ['.js', '.vue', '.json'], 36 | alias: { 37 | 'vue$': 'vue/dist/vue.esm.js', 38 | '@': resolve('src'), 39 | } 40 | }, 41 | module: { 42 | rules: [ 43 | ...(config.dev.useEslint ? [createLintingRule()] : []), 44 | { 45 | test: /\.vue$/, 46 | loader: 'vue-loader', 47 | options: vueLoaderConfig 48 | }, 49 | { 50 | test: /\.js$/, 51 | loader: 'babel-loader', 52 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 53 | }, 54 | { 55 | test: /\.scss$/, 56 | loaders: ['style', 'css', 'sass'] 57 | }, 58 | { 59 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 60 | loader: 'url-loader', 61 | options: { 62 | limit: 10000, 63 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 64 | } 65 | }, 66 | { 67 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 68 | loader: 'url-loader', 69 | options: { 70 | limit: 10000, 71 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 72 | } 73 | }, 74 | { 75 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 76 | loader: 'url-loader', 77 | options: { 78 | limit: 10000, 79 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 80 | } 81 | } 82 | ] 83 | }, 84 | node: { 85 | // prevent webpack from injecting useless setImmediate polyfill because Vue 86 | // source contains it (although only uses it if it's native). 87 | setImmediate: false, 88 | // prevent webpack from injecting mocks to Node native modules 89 | // that does not make sense for the client 90 | dgram: 'empty', 91 | fs: 'empty', 92 | net: 'empty', 93 | tls: 'empty', 94 | child_process: 'empty' 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const path = require('path') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 11 | const portfinder = require('portfinder') 12 | 13 | const HOST = process.env.HOST 14 | const PORT = process.env.PORT && Number(process.env.PORT) 15 | 16 | const devWebpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: config.dev.devtool, 22 | 23 | // these devServer options should be customized in /config/index.js 24 | devServer: { 25 | clientLogLevel: 'warning', 26 | historyApiFallback: { 27 | rewrites: [ 28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 29 | ], 30 | }, 31 | hot: true, 32 | contentBase: false, // since we use CopyWebpackPlugin. 33 | compress: true, 34 | host: HOST || config.dev.host, 35 | port: PORT || config.dev.port, 36 | open: config.dev.autoOpenBrowser, 37 | overlay: config.dev.errorOverlay 38 | ? { warnings: false, errors: true } 39 | : false, 40 | publicPath: config.dev.assetsPublicPath, 41 | proxy: config.dev.proxyTable, 42 | quiet: true, // necessary for FriendlyErrorsPlugin 43 | watchOptions: { 44 | poll: config.dev.poll, 45 | } 46 | }, 47 | plugins: [ 48 | new webpack.DefinePlugin({ 49 | 'process.env': require('../config/dev.env') 50 | }), 51 | new webpack.HotModuleReplacementPlugin(), 52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 53 | new webpack.NoEmitOnErrorsPlugin(), 54 | // https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: 'index.html', 57 | template: 'index.html', 58 | inject: true 59 | }), 60 | // copy custom static assets 61 | new CopyWebpackPlugin([ 62 | { 63 | from: path.resolve(__dirname, '../static'), 64 | to: config.dev.assetsSubDirectory, 65 | ignore: ['.*'] 66 | } 67 | ]) 68 | ] 69 | }) 70 | 71 | module.exports = new Promise((resolve, reject) => { 72 | portfinder.basePort = process.env.PORT || config.dev.port 73 | portfinder.getPort((err, port) => { 74 | if (err) { 75 | reject(err) 76 | } else { 77 | // publish the new Port, necessary for e2e tests 78 | process.env.PORT = port 79 | // add port to devServer config 80 | devWebpackConfig.devServer.port = port 81 | 82 | // Add FriendlyErrorsPlugin 83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 84 | compilationSuccessInfo: { 85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 86 | }, 87 | onErrors: config.dev.notifyOnErrors 88 | ? utils.createNotifierCallback() 89 | : undefined 90 | })) 91 | 92 | resolve(devWebpackConfig) 93 | } 94 | }) 95 | }) 96 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 13 | 14 | const env = require('../config/prod.env') 15 | 16 | const webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true, 21 | usePostCSS: true 22 | }) 23 | }, 24 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 25 | output: { 26 | path: config.build.assetsRoot, 27 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 29 | }, 30 | plugins: [ 31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 32 | new webpack.DefinePlugin({ 33 | 'process.env': env 34 | }), 35 | new UglifyJsPlugin({ 36 | uglifyOptions: { 37 | compress: { 38 | warnings: false 39 | } 40 | }, 41 | sourceMap: config.build.productionSourceMap, 42 | parallel: true 43 | }), 44 | // extract css into its own file 45 | new ExtractTextPlugin({ 46 | filename: utils.assetsPath('css/[name].[contenthash].css'), 47 | // Setting the following option to `false` will not extract CSS from codesplit chunks. 48 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. 49 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 50 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 51 | allChunks: true, 52 | }), 53 | // Compress extracted CSS. We are using this plugin so that possible 54 | // duplicated CSS from different components can be deduped. 55 | new OptimizeCSSPlugin({ 56 | cssProcessorOptions: config.build.productionSourceMap 57 | ? { safe: true, map: { inline: false } } 58 | : { safe: true } 59 | }), 60 | // generate dist index.html with correct asset hash for caching. 61 | // you can customize output by editing /index.html 62 | // see https://github.com/ampedandwired/html-webpack-plugin 63 | new HtmlWebpackPlugin({ 64 | filename: config.build.index, 65 | template: 'index.html', 66 | inject: true, 67 | minify: { 68 | removeComments: true, 69 | collapseWhitespace: true, 70 | removeAttributeQuotes: true 71 | // more options: 72 | // https://github.com/kangax/html-minifier#options-quick-reference 73 | }, 74 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 75 | chunksSortMode: 'dependency' 76 | }), 77 | // keep module.id stable when vendor modules does not change 78 | new webpack.HashedModuleIdsPlugin(), 79 | // enable scope hoisting 80 | new webpack.optimize.ModuleConcatenationPlugin(), 81 | // split vendor js into its own file 82 | new webpack.optimize.CommonsChunkPlugin({ 83 | name: 'vendor', 84 | minChunks (module) { 85 | // any required modules inside node_modules are extracted to vendor 86 | return ( 87 | module.resource && 88 | /\.js$/.test(module.resource) && 89 | module.resource.indexOf( 90 | path.join(__dirname, '../node_modules') 91 | ) === 0 92 | ) 93 | } 94 | }), 95 | // extract webpack runtime and module manifest to its own file in order to 96 | // prevent vendor hash from being updated whenever app bundle is updated 97 | new webpack.optimize.CommonsChunkPlugin({ 98 | name: 'manifest', 99 | minChunks: Infinity 100 | }), 101 | // This instance extracts shared chunks from code splitted chunks and bundles them 102 | // in a separate chunk, similar to the vendor chunk 103 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk 104 | new webpack.optimize.CommonsChunkPlugin({ 105 | name: 'app', 106 | async: 'vendor-async', 107 | children: true, 108 | minChunks: 3 109 | }), 110 | 111 | // copy custom static assets 112 | new CopyWebpackPlugin([ 113 | { 114 | from: path.resolve(__dirname, '../static'), 115 | to: config.build.assetsSubDirectory, 116 | ignore: ['.*'] 117 | } 118 | ]) 119 | ] 120 | }) 121 | 122 | if (config.build.productionGzip) { 123 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 124 | 125 | webpackConfig.plugins.push( 126 | new CompressionWebpackPlugin({ 127 | asset: '[path].gz[query]', 128 | algorithm: 'gzip', 129 | test: new RegExp( 130 | '\\.(' + 131 | config.build.productionGzipExtensions.join('|') + 132 | ')$' 133 | ), 134 | threshold: 10240, 135 | minRatio: 0.8 136 | }) 137 | ) 138 | } 139 | 140 | if (config.build.bundleAnalyzerReport) { 141 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 142 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 143 | } 144 | 145 | module.exports = webpackConfig 146 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.3.1 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '/', 13 | proxyTable: {}, 14 | 15 | // Various Dev Server settings 16 | host: 'localhost', // can be overwritten by process.env.HOST 17 | port: 8085, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 18 | autoOpenBrowser: true, 19 | errorOverlay: true, 20 | notifyOnErrors: true, 21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 22 | 23 | // Use Eslint Loader? 24 | // If true, your code will be linted during bundling and 25 | // linting errors and warnings will be shown in the console. 26 | useEslint: false, 27 | // If true, eslint errors and warnings will also be shown in the error overlay 28 | // in the browser. 29 | showEslintErrorsInOverlay: false, 30 | 31 | /** 32 | * Source Maps 33 | */ 34 | 35 | // https://webpack.js.org/configuration/devtool/#development 36 | devtool: 'cheap-module-eval-source-map', 37 | 38 | // If you have problems debugging vue-files in devtools, 39 | // set this to false - it *may* help 40 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 41 | cacheBusting: true, 42 | 43 | cssSourceMap: true 44 | }, 45 | 46 | build: { 47 | // Template for index.html 48 | index: path.resolve(__dirname, '../dist/index.html'), 49 | 50 | // Paths 51 | assetsRoot: path.resolve(__dirname, '../dist'), 52 | assetsSubDirectory: 'static', 53 | assetsPublicPath: '/', 54 | 55 | /** 56 | * Source Maps 57 | */ 58 | 59 | productionSourceMap: true, 60 | // https://webpack.js.org/configuration/devtool/#production 61 | devtool: '#source-map', 62 | 63 | // Gzip off by default as many popular static hosts such as 64 | // Surge or Netlify already gzip all static assets for you. 65 | // Before setting to `true`, make sure to: 66 | // npm install --save-dev compression-webpack-plugin 67 | productionGzip: false, 68 | productionGzipExtensions: ['js', 'css'], 69 | 70 | // Run the build command with an extra argument to 71 | // View the bundle analyzer report after build finishes: 72 | // `npm run build --report` 73 | // Set to `true` or `false` to always turn it on or off 74 | bundleAnalyzerReport: process.env.npm_config_report 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | vue-bpmn-demo 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-bpmn-flowable", 3 | "version": "1.0.0", 4 | "description": "vue-bpmn", 5 | "author": "", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "lint": "eslint --ext .js,.vue src", 11 | "build": "node build/build.js" 12 | }, 13 | "dependencies": { 14 | "axios": "^0.19.1", 15 | "bpmn-js": "^6.1.1", 16 | "diagram-js": "^6.2.2", 17 | "element-ui": "^2.4.11", 18 | "form-making": "^1.2.7", 19 | "vue": "^2.5.2", 20 | "vue-codemirror": "^4.0.6", 21 | "vue-drag-resize": "^1.3.2", 22 | "vue-router": "^3.0.1", 23 | "vuedraggable": "^2.23.2", 24 | "x2js": "^3.4.0" 25 | }, 26 | "devDependencies": { 27 | "autoprefixer": "^7.1.2", 28 | "babel-core": "^6.22.1", 29 | "babel-eslint": "^8.2.1", 30 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 31 | "babel-loader": "^7.1.1", 32 | "babel-plugin-syntax-jsx": "^6.18.0", 33 | "babel-plugin-transform-runtime": "^6.22.0", 34 | "babel-plugin-transform-vue-jsx": "^3.5.0", 35 | "babel-preset-env": "^1.3.2", 36 | "babel-preset-stage-2": "^6.22.0", 37 | "bpmn-js-properties-panel": "https://github.com/RubyLinT/bpmn-js-properties-panel.git", 38 | "camunda-bpmn-moddle": "^3.0.0", 39 | "activiti-bpmn-moddle": "https://github.com/RubyLinT/activiti-bpmn-moddle.git", 40 | "chalk": "^2.0.1", 41 | "copy-webpack-plugin": "^4.0.1", 42 | "css-loader": "^0.28.0", 43 | "eslint": "^4.15.0", 44 | "eslint-config-standard": "^10.2.1", 45 | "eslint-friendly-formatter": "^3.0.0", 46 | "eslint-loader": "^1.7.1", 47 | "eslint-plugin-import": "^2.7.0", 48 | "eslint-plugin-node": "^5.2.0", 49 | "eslint-plugin-promise": "^3.4.0", 50 | "eslint-plugin-standard": "^3.0.1", 51 | "eslint-plugin-vue": "^4.0.0", 52 | "extract-text-webpack-plugin": "^3.0.0", 53 | "file-loader": "^1.1.4", 54 | "friendly-errors-webpack-plugin": "^1.6.1", 55 | "html-webpack-plugin": "^2.30.1", 56 | "node-notifier": "^5.1.2", 57 | "node-sass": "^4.9.3", 58 | "optimize-css-assets-webpack-plugin": "^3.2.0", 59 | "ora": "^1.2.0", 60 | "portfinder": "^1.0.13", 61 | "postcss-import": "^11.0.0", 62 | "postcss-loader": "^2.0.8", 63 | "postcss-url": "^7.2.1", 64 | "rimraf": "^2.6.0", 65 | "sass-loader": "^7.1.0", 66 | "semver": "^5.3.0", 67 | "shelljs": "^0.7.6", 68 | "uglifyjs-webpack-plugin": "^1.1.1", 69 | "url-loader": "^0.5.8", 70 | "vue-loader": "^13.3.0", 71 | "vue-style-loader": "^3.0.1", 72 | "vue-template-compiler": "^2.5.2", 73 | "webpack": "^3.6.0", 74 | "webpack-bundle-analyzer": "^2.9.0", 75 | "webpack-dev-server": "^3.1.11", 76 | "webpack-merge": "^4.1.0" 77 | }, 78 | "engines": { 79 | "node": ">= 6.0.0", 80 | "npm": ">= 3.0.0" 81 | }, 82 | "browserslist": [ 83 | "> 1%", 84 | "last 2 versions", 85 | "not ie <= 8" 86 | ] 87 | } 88 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 23 | -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuchfStrong/vue-bpmn-flowable/ec972bcac1e6c8be129998a29e774c336190dd7d/src/assets/logo.png -------------------------------------------------------------------------------- /src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 226 | 227 | 284 | -------------------------------------------------------------------------------- /src/components/HelloWorldPro-orgi.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 179 | 180 | 236 | -------------------------------------------------------------------------------- /src/components/HelloWorldPro.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | 262 | 263 | 356 | -------------------------------------------------------------------------------- /src/components/ViewerPro.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 151 | 152 | 175 | -------------------------------------------------------------------------------- /src/components/custom/CustomContextPad.js: -------------------------------------------------------------------------------- 1 | import { is } from "bpmn-js/lib/util/ModelUtil" 2 | export default class CustomContextPad { 3 | constructor(config, contextPad, create, elementFactory, injector, translate) { 4 | this.create = create; 5 | this.elementFactory = elementFactory; 6 | this.translate = translate; 7 | 8 | if (config.autoPlace !== false) { 9 | this.autoPlace = injector.get('autoPlace', false); 10 | } 11 | 12 | contextPad.registerProvider(this); 13 | } 14 | 15 | getContextPadEntries(element) { 16 | const { 17 | autoPlace, 18 | create, 19 | elementFactory, 20 | translate 21 | } = this; 22 | 23 | function appendServiceTask(event, element) { 24 | if (autoPlace) { 25 | const shape = elementFactory.createShape({ type: 'bpmn:ServiceTask' }); 26 | 27 | autoPlace.append(element, shape); 28 | } else { 29 | appendServiceTaskStart(event, element); 30 | } 31 | } 32 | 33 | function appendUserTask(event, element) { 34 | if (autoPlace) { 35 | const shape = elementFactory.createShape({ type: 'bpmn:UserTask' }); 36 | 37 | autoPlace.append(element, shape); 38 | } else { 39 | appendUserTaskStart(event, element); 40 | } 41 | } 42 | 43 | function appendServiceTaskStart(event) { 44 | const shape = elementFactory.createShape({ type: 'bpmn:ServiceTask' }); 45 | 46 | create.start(event, shape, element); 47 | } 48 | 49 | function appendUserTaskStart(event) { 50 | const shape = elementFactory.createShape({ type: 'bpmn:UserTask' }); 51 | 52 | create.start(event, shape, element); 53 | } 54 | 55 | // 根据条件判断是否显示在contextPad中 56 | if (!is(element, 'bpmn:SequenceFlow')) { 57 | return { 58 | 'append.service-task': { 59 | group: 'model', 60 | className: 'bpmn-icon-service-task', 61 | title: translate('Append ServiceTask'), 62 | action: { 63 | click: appendServiceTask, 64 | dragstart: appendServiceTaskStart 65 | } 66 | }, 67 | 'append.user-task': { 68 | group: 'model', 69 | className: 'bpmn-icon-user-task', 70 | title: translate('Append UserTask'), 71 | action: { 72 | click: appendUserTask, 73 | dragstart: appendUserTaskStart 74 | } 75 | } 76 | }; 77 | } else { 78 | return null 79 | } 80 | } 81 | } 82 | 83 | CustomContextPad.$inject = [ 84 | 'config', 85 | 'contextPad', 86 | 'create', 87 | 'elementFactory', 88 | 'injector', 89 | 'translate' 90 | ]; -------------------------------------------------------------------------------- /src/components/custom/CustomPalette.js: -------------------------------------------------------------------------------- 1 | export default class CustomPalette { 2 | constructor(create, elementFactory, palette, translate) { 3 | this.create = create; 4 | this.elementFactory = elementFactory; 5 | this.translate = translate; 6 | 7 | palette.registerProvider(this); 8 | } 9 | 10 | getPaletteEntries(element) { 11 | const { 12 | create, 13 | elementFactory, 14 | translate 15 | } = this; 16 | 17 | function createServiceTask(event) { 18 | const shape = elementFactory.createShape({ type: 'bpmn:ServiceTask' }); 19 | 20 | create.start(event, shape); 21 | } 22 | 23 | function createUserTask(event) { 24 | const shape = elementFactory.createShape({ type: 'bpmn:UserTask' }); 25 | 26 | create.start(event, shape); 27 | } 28 | 29 | return { 30 | 'create.service-task': { 31 | group: 'activity', 32 | className: 'bpmn-icon-service-task', 33 | title: translate('Create ServiceTask'), 34 | action: { 35 | dragstart: createServiceTask, 36 | click: createServiceTask 37 | } 38 | }, 39 | 'create.user-task': { 40 | group: 'activity', 41 | className: 'bpmn-icon-user-task', 42 | title: translate('Create UserTask'), 43 | action: { 44 | dragstart: createUserTask, 45 | click: createUserTask 46 | } 47 | }, 48 | } 49 | } 50 | } 51 | 52 | CustomPalette.$inject = [ 53 | 'create', 54 | 'elementFactory', 55 | 'palette', 56 | 'translate' 57 | ]; -------------------------------------------------------------------------------- /src/components/custom/index.js: -------------------------------------------------------------------------------- 1 | import CustomContextPad from './CustomContextPad'; 2 | import CustomPalette from './CustomPalette'; 3 | 4 | export default { 5 | __init__: [ 'customContextPad', 'customPalette' ], 6 | customContextPad: [ 'type', CustomContextPad ], 7 | customPalette: [ 'type', CustomPalette ] 8 | }; -------------------------------------------------------------------------------- /src/components/customer-viewer.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits'; 2 | 3 | import Viewer from 'bpmn-js/lib/Viewer'; 4 | 5 | import ZoomScrollModule from 'diagram-js/lib/navigation/zoomscroll'; 6 | import MoveCanvasModule from 'diagram-js/lib/navigation/movecanvas'; 7 | 8 | 9 | /** 10 | * A viewer that includes mouse navigation and other goodies. 11 | * 12 | * @param {Object} options 13 | */ 14 | export default function CustomViewer(options) { 15 | Viewer.call(this, options); 16 | } 17 | 18 | inherits(CustomViewer, Viewer); 19 | 20 | CustomViewer.prototype._customModules = [ 21 | ZoomScrollModule, 22 | MoveCanvasModule 23 | ]; 24 | 25 | CustomViewer.prototype._modules = [].concat( 26 | Viewer.prototype._modules, 27 | CustomViewer.prototype._customModules 28 | ); -------------------------------------------------------------------------------- /src/components/draggableForm/container.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 94 | 95 | -------------------------------------------------------------------------------- /src/components/draggableForm/container2.vue: -------------------------------------------------------------------------------- 1 | 71 | 72 | 166 | 167 | 181 | -------------------------------------------------------------------------------- /src/components/draggableForm/containernew.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 86 | 87 | -------------------------------------------------------------------------------- /src/components/draggableForm/draggableItem.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /src/components/draggableForm/formItem.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 89 | 90 | -------------------------------------------------------------------------------- /src/components/draggableForm/formitemnew.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 112 | 113 | -------------------------------------------------------------------------------- /src/components/draggableForm/index.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 57 | -------------------------------------------------------------------------------- /src/components/draggableForm/indexnew.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 100 | -------------------------------------------------------------------------------- /src/components/draggableForm/jsonDiaolog.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 59 | 60 | -------------------------------------------------------------------------------- /src/components/draggableForm/modelitem.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 201 | 202 | -------------------------------------------------------------------------------- /src/components/draggableForm/previewContainer.vue: -------------------------------------------------------------------------------- 1 | 67 | 68 | 98 | 99 | -------------------------------------------------------------------------------- /src/components/draggableForm/previewDiaolog.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 42 | 43 | -------------------------------------------------------------------------------- /src/components/panel-formAndListener.vue: -------------------------------------------------------------------------------- 1 | 134 | 135 | 359 | 360 | 389 | -------------------------------------------------------------------------------- /src/components/panel-orgi.vue: -------------------------------------------------------------------------------- 1 | 109 | 110 | 305 | 306 | 334 | -------------------------------------------------------------------------------- /src/components/resource/activiti.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Activiti", 3 | "uri": "http://some-company/schema/bpmn/activiti", 4 | "prefix": "activiti", 5 | "xml": { 6 | "tagAlias": "lowerCase" 7 | }, 8 | "types": [ 9 | { 10 | "name": "FormSupported", 11 | "isAbstract": true, 12 | "extends": [ 13 | "bpmn:StartEvent", 14 | "bpmn:UserTask" 15 | ], 16 | "properties": [ 17 | { 18 | "name": "formKey", 19 | "isAttr": true, 20 | "type": "String" 21 | }, 22 | { 23 | "name": "initiator", 24 | "isAttr": true, 25 | "type": "String" 26 | } 27 | ] 28 | }, 29 | { 30 | "name": "ExecutionListener", 31 | "superClass": [ "Element" ], 32 | "meta": { 33 | "allowedIn": [ 34 | "bpmn:Task", 35 | "bpmn:ServiceTask", 36 | "bpmn:UserTask", 37 | "bpmn:BusinessRuleTask", 38 | "bpmn:ScriptTask", 39 | "bpmn:ReceiveTask", 40 | "bpmn:ManualTask", 41 | "bpmn:ExclusiveGateway", 42 | "bpmn:SequenceFlow", 43 | "bpmn:ParallelGateway", 44 | "bpmn:InclusiveGateway", 45 | "bpmn:EventBasedGateway", 46 | "bpmn:StartEvent", 47 | "bpmn:IntermediateCatchEvent", 48 | "bpmn:IntermediateThrowEvent", 49 | "bpmn:EndEvent", 50 | "bpmn:BoundaryEvent", 51 | "bpmn:CallActivity", 52 | "bpmn:SubProcess" 53 | ] 54 | }, 55 | "properties": [ 56 | { 57 | "name": "expression", 58 | "isAttr": true, 59 | "type": "String" 60 | }, 61 | { 62 | "name": "class", 63 | "isAttr": true, 64 | "type": "String" 65 | }, 66 | { 67 | "name": "delegateExpression", 68 | "isAttr": true, 69 | "type": "String" 70 | }, 71 | { 72 | "name": "event", 73 | "isAttr": true, 74 | "type": "String" 75 | }, 76 | { 77 | "name": "script", 78 | "type": "Script" 79 | }, 80 | { 81 | "name": "fields", 82 | "type": "Field", 83 | "isMany": true 84 | } 85 | ] 86 | }, 87 | { 88 | "name": "TaskListener", 89 | "superClass": [ "Element" ], 90 | "meta": { 91 | "allowedIn": [ 92 | "bpmn:UserTask" 93 | ] 94 | }, 95 | "properties": [ 96 | { 97 | "name": "expression", 98 | "isAttr": true, 99 | "type": "String" 100 | }, 101 | { 102 | "name": "class", 103 | "isAttr": true, 104 | "type": "String" 105 | }, 106 | { 107 | "name": "delegateExpression", 108 | "isAttr": true, 109 | "type": "String" 110 | }, 111 | { 112 | "name": "event", 113 | "isAttr": true, 114 | "type": "String" 115 | }, 116 | { 117 | "name": "script", 118 | "type": "Script" 119 | }, 120 | { 121 | "name": "fields", 122 | "type": "Field", 123 | "isMany": true 124 | } 125 | ] 126 | }, 127 | { 128 | "name": "FormProperty", 129 | "superClass": [ "Element" ], 130 | "meta": { 131 | "allowedIn": [ 132 | "bpmn:StartEvent", 133 | "bpmn:UserTask" 134 | ] 135 | }, 136 | "properties": [ 137 | { 138 | "name": "id", 139 | "type": "String", 140 | "isAttr": true 141 | }, 142 | { 143 | "name": "name", 144 | "type": "String", 145 | "isAttr": true 146 | }, 147 | { 148 | "name": "type", 149 | "type": "String", 150 | "isAttr": true 151 | }, 152 | { 153 | "name": "default", 154 | "type": "String", 155 | "isAttr": true 156 | } 157 | ] 158 | }, 159 | { 160 | "name": "DateSupported", 161 | "isAbstract": true, 162 | "extends": [ 163 | "bpmn:FormalExpression" 164 | ], 165 | "properties": [ 166 | { 167 | "name": "endDate", 168 | "isAttr": true, 169 | "type": "Date" 170 | } 171 | ] 172 | }, 173 | { 174 | "name": "UserSupported", 175 | "isAbstract": true, 176 | "extends": [ 177 | "bpmn:UserTask" 178 | ], 179 | "properties": [ 180 | { 181 | "name": "candidateGroups", 182 | "isAttr": true, 183 | "type": "String" 184 | }, 185 | { 186 | "name": "candidateUser", 187 | "isAttr": true, 188 | "type": "String" 189 | }, 190 | { 191 | "name": "assignee", 192 | "isAttr": true, 193 | "type": "String" 194 | }, 195 | { 196 | "name": "exclusive", 197 | "isAttr": true, 198 | "type": "Boolean" 199 | }, 200 | { 201 | "name": "priority", 202 | "isAttr": true, 203 | "type": "Integer" 204 | } 205 | ] 206 | } 207 | ], 208 | "emumerations": [], 209 | "associations": [] 210 | } 211 | -------------------------------------------------------------------------------- /src/components/resource/file.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/components/resource/file1.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/components/resource/flowable.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Flowable", 3 | "uri": "http://flowable.org/bpmn", 4 | "prefix": "flowable", 5 | "xml": { 6 | "tagAlias": "lowerCase" 7 | }, 8 | "types": [ 9 | { 10 | "name": "FormSupported", 11 | "isAbstract": true, 12 | "extends": [ 13 | "bpmn:StartEvent", 14 | "bpmn:UserTask" 15 | ], 16 | "properties": [ 17 | { 18 | "name": "formKey", 19 | "isAttr": true, 20 | "type": "String" 21 | }, 22 | { 23 | "name": "initiator", 24 | "isAttr": true, 25 | "type": "String" 26 | } 27 | ] 28 | }, 29 | { 30 | "name": "ExecutionListener", 31 | "superClass": [ "Element" ], 32 | "meta": { 33 | "allowedIn": [ 34 | "bpmn:Task", 35 | "bpmn:ServiceTask", 36 | "bpmn:UserTask", 37 | "bpmn:BusinessRuleTask", 38 | "bpmn:ScriptTask", 39 | "bpmn:ReceiveTask", 40 | "bpmn:ManualTask", 41 | "bpmn:ExclusiveGateway", 42 | "bpmn:SequenceFlow", 43 | "bpmn:ParallelGateway", 44 | "bpmn:InclusiveGateway", 45 | "bpmn:EventBasedGateway", 46 | "bpmn:StartEvent", 47 | "bpmn:IntermediateCatchEvent", 48 | "bpmn:IntermediateThrowEvent", 49 | "bpmn:EndEvent", 50 | "bpmn:BoundaryEvent", 51 | "bpmn:CallActivity", 52 | "bpmn:SubProcess" 53 | ] 54 | }, 55 | "properties": [ 56 | { 57 | "name": "id", 58 | "type": "String", 59 | "isAttr": true 60 | }, 61 | { 62 | "name": "expression", 63 | "isAttr": true, 64 | "type": "String" 65 | }, 66 | { 67 | "name": "class", 68 | "isAttr": true, 69 | "type": "String" 70 | }, 71 | { 72 | "name": "delegateExpression", 73 | "isAttr": true, 74 | "type": "String" 75 | }, 76 | { 77 | "name": "event", 78 | "isAttr": true, 79 | "type": "String" 80 | }, 81 | { 82 | "name": "script", 83 | "type": "Script" 84 | }, 85 | { 86 | "name": "fields", 87 | "type": "Field", 88 | "isMany": true 89 | } 90 | ] 91 | }, 92 | { 93 | "name": "TaskListener", 94 | "superClass": [ "Element" ], 95 | "meta": { 96 | "allowedIn": [ 97 | "bpmn:UserTask" 98 | ] 99 | }, 100 | "properties": [ 101 | { 102 | "name": "id", 103 | "type": "String", 104 | "isAttr": true 105 | }, 106 | { 107 | "name": "expression", 108 | "isAttr": true, 109 | "type": "String" 110 | }, 111 | { 112 | "name": "class", 113 | "isAttr": true, 114 | "type": "String" 115 | }, 116 | { 117 | "name": "delegateExpression", 118 | "isAttr": true, 119 | "type": "String" 120 | }, 121 | { 122 | "name": "event", 123 | "isAttr": true, 124 | "type": "String" 125 | }, 126 | { 127 | "name": "script", 128 | "type": "Script" 129 | }, 130 | { 131 | "name": "body", 132 | "isBody": true, 133 | "type": "String" 134 | } 135 | ] 136 | }, 137 | { 138 | "name": "FormProperty", 139 | "superClass": [ "Element" ], 140 | "meta": { 141 | "allowedIn": [ 142 | "bpmn:StartEvent", 143 | "bpmn:UserTask" 144 | ] 145 | }, 146 | "properties": [ 147 | { 148 | "name": "id", 149 | "type": "String", 150 | "isAttr": true 151 | }, 152 | { 153 | "name": "name", 154 | "type": "String", 155 | "isAttr": true 156 | }, 157 | { 158 | "name": "type", 159 | "type": "String", 160 | "isAttr": true 161 | }, 162 | { 163 | "name": "default", 164 | "type": "String", 165 | "isAttr": true 166 | }, 167 | { 168 | "name": "isForCompensation", 169 | "type": "String", 170 | "isAttr": true 171 | } 172 | ] 173 | }, 174 | { 175 | "name": "DateSupported", 176 | "isAbstract": true, 177 | "extends": [ 178 | "bpmn:FormalExpression" 179 | ], 180 | "properties": [ 181 | { 182 | "name": "endDate", 183 | "isAttr": true, 184 | "type": "Date" 185 | } 186 | ] 187 | }, 188 | { 189 | "name": "UserSupported", 190 | "isAbstract": true, 191 | "extends": [ 192 | "bpmn:UserTask", 193 | "bpmn:ServiceTask", 194 | "bpmn:StartEvent" 195 | ], 196 | "properties": [ 197 | { 198 | "name": "category", 199 | "isAttr": true, 200 | "type": "String" 201 | }, 202 | { 203 | "name": "formFieldValidation", 204 | "isAttr": true, 205 | "type": "Boolean", 206 | "default": false 207 | } 208 | ] 209 | }, 210 | { 211 | "name": "Assignable", 212 | "extends": [ "bpmn:UserTask" ], 213 | "properties": [ 214 | { 215 | "name": "assignee", 216 | "isAttr": true, 217 | "type": "String" 218 | }, 219 | { 220 | "name": "candidateUsers", 221 | "isAttr": true, 222 | "type": "String" 223 | }, 224 | { 225 | "name": "candidateGroups", 226 | "isAttr": true, 227 | "type": "String" 228 | }, 229 | { 230 | "name": "dueDate", 231 | "isAttr": true, 232 | "type": "String" 233 | }, 234 | { 235 | "name": "followUpDate", 236 | "isAttr": true, 237 | "type": "String" 238 | }, 239 | { 240 | "name": "priority", 241 | "isAttr": true, 242 | "type": "String" 243 | } 244 | ] 245 | }, 246 | { 247 | "name": "AsyncCapable", 248 | "isAbstract": true, 249 | "extends": [ 250 | "bpmn:Activity", 251 | "bpmn:Gateway", 252 | "bpmn:Event" 253 | ], 254 | "properties": [ 255 | { 256 | "name": "async", 257 | "isAttr": true, 258 | "type": "Boolean", 259 | "default": false 260 | }, 261 | { 262 | "name": "exclusive", 263 | "isAttr": true, 264 | "type": "Boolean", 265 | "default": true 266 | } 267 | ] 268 | }, 269 | { 270 | "name": "Collectable", 271 | "isAbstract": true, 272 | "extends": [ "bpmn:MultiInstanceLoopCharacteristics" ], 273 | "superClass": [ "flowable:AsyncCapable" ], 274 | "properties": [ 275 | { 276 | "name": "collection", 277 | "isAttr": true, 278 | "type": "String" 279 | }, 280 | { 281 | "name": "elementVariable", 282 | "isAttr": true, 283 | "type": "String" 284 | } 285 | ] 286 | }, 287 | { 288 | "name": "SkipExpress", 289 | "isAbstract": true, 290 | "extends": [ 291 | "bpmn:ServiceTask", 292 | "bpmn:UserTask" 293 | ], 294 | "properties": [ 295 | { 296 | "name": "skipExpression", 297 | "isAttr": true, 298 | "type": "String" 299 | } 300 | ] 301 | }, 302 | { 303 | "name": "ServiceTaskLike", 304 | "extends": [ 305 | "bpmn:ServiceTask", 306 | "bpmn:BusinessRuleTask", 307 | "bpmn:SendTask", 308 | "bpmn:MessageEventDefinition" 309 | ], 310 | "properties": [ 311 | { 312 | "name": "expression", 313 | "isAttr": true, 314 | "type": "String" 315 | }, 316 | { 317 | "name": "class", 318 | "isAttr": true, 319 | "type": "String" 320 | }, 321 | { 322 | "name": "delegateExpression", 323 | "isAttr": true, 324 | "type": "String" 325 | }, 326 | { 327 | "name": "resultVariableName", 328 | "isAttr": true, 329 | "type": "String" 330 | }, 331 | { 332 | "name": "triggerable", 333 | "isAttr": true, 334 | "type": "String" 335 | }, 336 | { 337 | "name": "useLocalScopeForResultVariable", 338 | "isAttr": true, 339 | "type": "String" 340 | } 341 | ] 342 | } 343 | ], 344 | "emumerations": [], 345 | "associations": [] 346 | } 347 | -------------------------------------------------------------------------------- /src/components/resource/modeler.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Modeler", 3 | "uri": "http://flowable.org/modeler", 4 | "prefix": "modeler", 5 | "xml": { 6 | "tagAlias": "" 7 | }, 8 | "types": [ 9 | { 10 | "name": "initiator-can-complete", 11 | "superClass": [ "Element" ], 12 | "meta": { 13 | "allowedIn": [ 14 | "bpmn:UserTask" 15 | ] 16 | }, 17 | "properties": [ 18 | { 19 | "name": "id", 20 | "type": "String", 21 | "isAttr": true 22 | }, 23 | { 24 | "name": "name", 25 | "isAttr": true, 26 | "type": "String" 27 | }, 28 | { 29 | "name": "modeler", 30 | "isAttr": true, 31 | "type": "String" 32 | }, 33 | { 34 | "name": "body", 35 | "isBody": true, 36 | "type": "Boolean", 37 | "default": false 38 | } 39 | ] 40 | } 41 | ], 42 | "emumerations": [], 43 | "associations": [] 44 | } 45 | -------------------------------------------------------------------------------- /src/components/resource/xml.js: -------------------------------------------------------------------------------- 1 | export const diagramXML = ` 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | `; -------------------------------------------------------------------------------- /src/components/translate/CustomTranslate.js: -------------------------------------------------------------------------------- 1 | import TranslationsChinese from './TranslationsChinese' 2 | export default function (template, replacements) { 3 | replacements = replacements || {}; 4 | template = TranslationsChinese[template] || template; 5 | return template.replace(/{([^}]+)}/g, function (_, key) { 6 | return replacements[key] || '{' + key + '}'; 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /src/components/translate/TranslationsChinese.js: -------------------------------------------------------------------------------- 1 | export default { 2 | // Labels 3 | 'Activate the global connect tool': '激活全局连接工具', 4 | 'Append {type}': '添加{type}', 5 | 'Add Lane above': '添加上面泳道', 6 | 'Divide into two Lanes': '拆分两个泳道', 7 | 'Divide into three Lanes': '拆分三个泳道', 8 | 'Add Lane below': '添下面泳道', 9 | 'Append compensation activity': '添加补偿活动', 10 | 'Change type': '设置', 11 | 'Connect using Association': '使用关联连接', 12 | 'Connect using Sequence/MessageFlow or Association': '连线', 13 | 'Connect using DataInputAssociation': '使用数据输入关联连接', 14 | 'Remove': '删除', 15 | 'Activate the hand tool': '激活拖拽工具', 16 | 'Activate the lasso tool': '激活框选工具', 17 | 'Activate the create/remove space tool': '激活空间移动工具', 18 | 'Create Gateway': '创建网关', 19 | 'Append Gateway': '添加网关', 20 | 'Create expanded SubProcess': '创建扩展子流程', 21 | 'Append Intermediate/Boundary Event': '添加终止事件', 22 | 'Create Intermediate/Boundary Event': '创建终止事件', 23 | 'Create Pool/Participant': '创建泳池或参与者', 24 | 'Parallel Multi Instance': '并行多实例', 25 | 'Sequential Multi Instance': '顺序多重实例', 26 | 'Loop': '循环', 27 | 'Ad-hoc': '特别指定', 28 | 'Create {type}': '创建{type}', 29 | 'Task': '任务', 30 | 'Send Task': '发送任务', 31 | 'Receive Task': '接收任务', 32 | 'User Task': '用户任务', 33 | 'Manual Task': '手工任务', 34 | 'Business Rule Task': '作业规则任务', 35 | 'Service Task': '服务任务', 36 | 'Script Task': '脚本任务', 37 | 'Call Activity': '调用活动', 38 | 'Sub Process (collapsed)': '子过程(折叠的)', 39 | 'Sub Process (expanded)': '子过程(展开的)', 40 | 'Start Event': '开始事件', 41 | 'startEvent': '开始事件', 42 | 'Intermediate Throw Event': '终止事件', 43 | 'End Event': '结束事件', 44 | 'Message Start Event': '消息开始事件', 45 | 'Timer Start Event': '时间开始事件', 46 | 'Conditional Start Event': '条件开始事件', 47 | 'Signal Start Event': '信号开始事件', 48 | 'Error Start Event': '错误开始事件', 49 | 'Escalation Start Event': '升级开始事件', 50 | 'Compensation Start Event': '补偿开始事件', 51 | 'Message Start Event (non-interrupting)': '消息开始事件(不中断)', 52 | 'Timer Start Event (non-interrupting)': '定时开始事件(不中断)', 53 | 'Conditional Start Event (non-interrupting)': '条件开始事件(不中断)', 54 | 'Signal Start Event (non-interrupting)': '信号开始事件(不中断)', 55 | 'Escalation Start Event (non-interrupting)': '升级开始事件(不中断)', 56 | 'Message Intermediate Catch Event': '信息捕获事件', 57 | 'Message Intermediate Throw Event': '信息终止事件', 58 | 'Timer Intermediate Catch Event': '定时器捕获事件', 59 | 'Escalation Intermediate Throw Event': '升级终止事件', 60 | 'Conditional Intermediate Catch Event': '条件捕获事件', 61 | 'Link Intermediate Catch Event': '链接捕获事件', 62 | 'Link Intermediate Throw Event': '链接终止事件', 63 | 'Compensation Intermediate Throw Event': '补偿终止事件', 64 | 'Signal Intermediate Catch Event': '信号捕获事件', 65 | 'Signal Intermediate Throw Event': '信号终止事件', 66 | 'Message End Event': '消息结束事件', 67 | 'Escalation End Event': '升级结束事件', 68 | 'Error End Event': '错误结束事件', 69 | 'Cancel End Event': '取消结束事件', 70 | 'Compensation End Event': '补偿结束事件', 71 | 'Signal End Event': '信号结束事件', 72 | 'Terminate End Event': '终止结束事件', 73 | 'Message Boundary Event': '消息边界事件', 74 | 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)', 75 | 'Timer Boundary Event': '定时边界事件', 76 | 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)', 77 | 'Escalation Boundary Event': '升级边界事件', 78 | 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)', 79 | 'Conditional Boundary Event': '有条件的边界事件', 80 | 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)', 81 | 'Error Boundary Event': '错误边界事件', 82 | 'Cancel Boundary Event': '取消边界事件', 83 | 'Signal Boundary Event': '信号边界事件', 84 | 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)', 85 | 'Compensation Boundary Event': '补偿边界事件', 86 | 'Exclusive Gateway': '互斥网关', 87 | 'Parallel Gateway': '并行网关', 88 | 'Inclusive Gateway': '相容网关', 89 | 'Complex Gateway': '复杂网关', 90 | 'Event based Gateway': '事件网关', 91 | 'Transaction': '交换', 92 | 'Sub Process': '子流程', 93 | 'Event Sub Process': '事件子流程', 94 | 'Collapsed Pool': '合并泳池', 95 | 'Expanded Pool': '扩展泳池', 96 | 'Create StartEvent': '创建开始事件', 97 | 'Create EndEvent': '创建结束事件', 98 | 'Create ServiceTask': '创建服务任务', 99 | 'Create UserTask': '创建用户任务', 100 | 'Create Group': '创建组', 101 | 'Append ServiceTask': '添加服务任务', 102 | 'Append EndEvent': '添加结束节点', 103 | 'Append UserTask': '添加用户任务', 104 | 'Default Flow': '默认流程', 105 | 'Conditional Flow': '条件流程', 106 | 'Sequence Flow': '顺序流程', 107 | 108 | // Errors 109 | 'no parent for {element} in {parent}': '在{parent}中的{element}没有父元素', 110 | 'no shape type specified': '没有指定的形状类型', 111 | 'flow elements must be children of pools/participants': '流动元素必须是游泳池/参与者', 112 | 'out of bounds release': '跨界界释放', 113 | 'more than {count} child lanes': '超出{count}分支', 114 | 'element required': '被请求元素', 115 | 'diagram not part of bpmn': '图在bpmn中', 116 | 'no diagram to display': '没有图表来显示', 117 | 'no process or collaboration to display': '没有流程或协作显示', 118 | 'element {element} referenced by {referenced}#{property} not yet drawn': '元素{element}在{referenced}#{property}的引用还没有绘制', 119 | 'already rendered {element}': '已经提供{element}', 120 | 'failed to import {element}': '元素导入失败{element}', 121 | 122 | // props lable 123 | 'General': '基本属性', 124 | 'Documentation': '备注', 125 | 'Element Documentation': '元素备注', 126 | 'Executable': '可执行的', 127 | 'Process Documentation': '过程说明', 128 | 129 | 'Listeners': '监听器', 130 | 'Execution Listener': '扩展监听器', 131 | 'Extensions': '扩展', 132 | 'Properties': '属性', 133 | 'Add Property': '添加属性', 134 | 'Name': '名称', 135 | 'Id': '标识', 136 | 'ID': '标识', 137 | 'Value': '值', 138 | 'Version Tag': '版本标记', 139 | 'External Task Configuration': '外部任务配置', 140 | 'Task Priority': '任务优先级', 141 | 'Job Configuration': '作业配置', 142 | 'Job Priority': '作业优先级', 143 | 'History Configuration': '历史配置', 144 | 'History Time To Live': '历史生存时间', 145 | 'Details': '详情', 146 | 'Initiator': '初始化', 147 | 'Asynchronous Continuations': '异步连续', 148 | 'Asynchronous Before': '异步之前', 149 | 'Asynchronous After': '异步之后', 150 | 'Forms': '表单', 151 | 'Form Key': '表单键', 152 | 'Form Fields': '表单字段', 153 | 'Form Field': '表单字段', 154 | 'Business Key': '业务键', 155 | 'Type': '类型', 156 | 'Label': '标签', 157 | 'Default Value': '默认值', 158 | 'Validation': '校验', 159 | 'Add Constraint': '添加约束', 160 | 'Config': '配置', 161 | 'Must provide a value': '必须提供一个值', 162 | 'Event Type': '事件类型', 163 | 'Listener Type': '监听器类型', 164 | 'Java Class': 'Java 类', 165 | 'Field Injection': '字段注入', 166 | 'Fields': '字段', 167 | 'Expression': '表达式', 168 | 'Delegate Expression': '委托表达式', 169 | 'Script': '脚本', 170 | 'Parameter must have a name': '参数必须有一个名称', 171 | 'String': '字符串', 172 | 'Implementation': '实现', 173 | 'External': '外部', 174 | 'Connector': '连接器', 175 | 'Must configure Connector': '必须配置连接器', 176 | 'Connector Id': '连接器ID', 177 | 'Input/Output': '输入/输出', 178 | 'Input Parameters': '输入参数', 179 | 'Input Parameter': '输入参数', 180 | 'Output Parameters': '输出参数', 181 | 'Output Parameter': '输出参数', 182 | 'Text': '文本', 183 | 'List': '列表', 184 | 'Add Entry': '增加条目', 185 | 'Field Injections': '字段注入', 186 | 'Append TextAnnotation': '文本注释', 187 | 'TextAnnotation': '文本注释', 188 | 'Variables': '变量', 189 | 'In Mapping': '输入映射', 190 | 'Out Mapping': '输出映射', 191 | 'Target': '目标', 192 | 'Source': '来源', 193 | 'Local': '本地', 194 | 'Candidate Starter Configuration': '候选人起动器配置', 195 | 'Candidate Starter Groups': '候选人起动器组', 196 | 'Candidate Starter Users': '候选人起动器用户', 197 | 'Configure Connector': '配置连接器', 198 | 'Assignee': '受理人', 199 | 'Candidate Users': '候选用户', 200 | 'Candidate Groups': '候选组', 201 | 'Due Date': '到期', 202 | 'Follow Up Date': '跟踪日期', 203 | 'Priority': '优先级', 204 | 'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '可以使用EL表达式,(例如:${someDate} 或者ISO日期(例如:2015-06-26T09:54:00))', 205 | 'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '可以使用EL表达式,(例如:${someDate} 或者ISO日期(例如:2015-06-26T09:54:00))' 206 | } 207 | -------------------------------------------------------------------------------- /src/components/translate/index.js: -------------------------------------------------------------------------------- 1 | import CustomTranslate from './CustomTranslate' 2 | 3 | export default { 4 | translate: ['value', CustomTranslate] 5 | } 6 | -------------------------------------------------------------------------------- /src/components/utils/PanelData.js: -------------------------------------------------------------------------------- 1 | export const defaultShowProperty = { 2 | MultiInstanceLoopCharacteristics: false, 3 | conditionExpression: false 4 | } -------------------------------------------------------------------------------- /src/components/utils/PanelUtils.js: -------------------------------------------------------------------------------- 1 | import { is } from "bpmn-js/lib/util/ModelUtil"; 2 | import { isAny } from "bpmn-js/lib/features/modeling/util/ModelingUtil"; 3 | /** 4 | * 是否应该显示该属性面板 5 | * 6 | * @param {String} property 7 | * @param {Object} businessObject 8 | * 9 | * @return {Boolean} 10 | */ 11 | export function isShouldShowProperty(property, businessObject) { 12 | let elementType = [] 13 | if (property === 'formFieldValidation') { 14 | elementType = ['bpmn:StartEvent', 'bpmn:UserTask'] 15 | } 16 | 17 | if (['exclusive', 'async'].includes(property)) { 18 | elementType = ['bpmn:Activity', 'bpmn:Gateway'] 19 | } 20 | 21 | if (property === 'dueDate') { 22 | elementType = ['bpmn:UserTask'] 23 | } 24 | 25 | if (property === 'assignee') { 26 | elementType = ['bpmn:UserTask'] 27 | } 28 | 29 | if (property === 'candidateUsers') { 30 | elementType = ['bpmn:UserTask'] 31 | } 32 | 33 | if (property === 'candidateGroups') { 34 | elementType = ['bpmn:UserTask'] 35 | } 36 | 37 | if (property === 'priority') { 38 | elementType = ['bpmn:UserTask'] 39 | } 40 | 41 | if (property === 'category') { 42 | elementType = ['bpmn:UserTask'] 43 | } 44 | 45 | if (property === 'isForCompensation') { 46 | elementType = ['bpmn:UserTask', 'bpmn:ServiceTask'] 47 | } 48 | 49 | if (property === 'skipExpression') { 50 | elementType = ['bpmn:UserTask', 'bpmn:ServiceTask'] 51 | } 52 | 53 | const serviceLikePopoerty = ['expression', 'class', 'delegateExpression', 'resultVariableName', 'triggerable', 'useLocalScopeForResultVariable'] 54 | if (serviceLikePopoerty.includes(property)) { 55 | elementType = ['bpmn:ServiceTask'] 56 | } 57 | 58 | if (property === 'multiInstance') { 59 | elementType = ['bpmn:Activity'] 60 | } 61 | 62 | if (property === 'listener') { 63 | elementType = ['bpmn:Event', 'bpmn:Activity', 'bpmn:Gateway'] 64 | } 65 | 66 | if (property === 'TaskListener') { 67 | elementType = ['bpmn:UserTask'] 68 | } 69 | 70 | if (property === 'SequenceFlow') { 71 | elementType = ['bpmn:SequenceFlow'] 72 | } 73 | return isAny(businessObject, elementType) 74 | } 75 | 76 | /** 77 | * 根据类型判断是否显示 78 | * @param {String} type 79 | * @param {Object} businessObject 80 | */ 81 | export function isShouldShowByType(type, businessObject) { 82 | let res = false 83 | if (type === 'MultiInstanceLoopCharacteristics') { 84 | res = is(businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics') 85 | } 86 | if (type === 'conditionExpression') { 87 | res = businessObject.conditionExpression? true:false 88 | } 89 | return res 90 | } 91 | 92 | export function getExtension(businessObject, type) { 93 | if (!businessObject.extensionElements) { 94 | return; 95 | } 96 | return businessObject.extensionElements.values.filter(function(e) { 97 | return e.$instanceOf(type); 98 | })[0] 99 | } 100 | 101 | export function getExtensionAll(businessObject, type) { 102 | if (!businessObject.extensionElements) { 103 | return; 104 | } 105 | return businessObject.extensionElements.values.filter(function(e) { 106 | return e.$instanceOf(type); 107 | }) 108 | } 109 | 110 | // 生成随机数 111 | export function random(lower, upper) { 112 | return Math.floor(Math.random() * (upper - lower)) + lower; 113 | } 114 | 115 | -------------------------------------------------------------------------------- /src/components/viewer.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 201 | 202 | 259 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import ElementUI from 'element-ui' 5 | import 'element-ui/lib/theme-chalk/index.css' 6 | import App from './App' 7 | import router from './router' 8 | import FormMaking from 'form-making' 9 | import 'form-making/dist/FormMaking.css' 10 | import x2js from 'x2js' 11 | 12 | Vue.use(FormMaking) 13 | Vue.use(ElementUI) 14 | Vue.config.productionTip = false 15 | Vue.prototype.$x2js = new x2js() 16 | 17 | 18 | /* eslint-disable no-new */ 19 | Vue.prototype.$copy = function(v){return JSON.parse(JSON.stringify(v))} 20 | new Vue({ 21 | el: '#app', 22 | router, 23 | components: { App }, 24 | template: '' 25 | }) 26 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import HelloWorld from '@/components/HelloWorld' 4 | import HelloWorldPro from '@/components/HelloWorldPro' 5 | import makingForm from '@/views/makingForm' 6 | import generate from '@/views/fm-generate' 7 | import draggable from '@/views/draggable' 8 | import viewer from '@/components/viewer' 9 | import ViewerPro from '@/components/ViewerPro' 10 | Vue.use(Router) 11 | 12 | export default new Router({ 13 | routes: [ 14 | { 15 | path: '/', 16 | name: 'HelloWorld', 17 | component: HelloWorld 18 | }, 19 | { 20 | path: '/pro', 21 | name: 'HelloWorldPro', 22 | component: HelloWorldPro 23 | }, 24 | { 25 | path: '/makingForm', 26 | name: 'makingForm', 27 | component: makingForm 28 | }, 29 | { 30 | path: '/generate', 31 | name: 'generate', 32 | component: generate 33 | }, 34 | { 35 | path:'/draggable', 36 | name:'draggable', 37 | component:draggable 38 | }, 39 | { 40 | path:'/viewer', 41 | name:'viewer', 42 | component:viewer 43 | }, 44 | { 45 | path:'/ViewerPro', 46 | name:'ViewerPro', 47 | component:ViewerPro 48 | } 49 | ] 50 | }) 51 | -------------------------------------------------------------------------------- /src/utils/index.js: -------------------------------------------------------------------------------- 1 | 2 | export function formatXml(text) { 3 | //去掉多余的空格 4 | text = '\n' + text.replace(/(<\w+)(\s.*?>)/g, function($0, name, props) { 5 | return name + ' ' + props.replace(/\s+(\w+=)/g, " $1"); 6 | }).replace(/>\s*?\n<"); 7 | 8 | //把注释编码 9 | text = text.replace(/\n/g, '\r').replace(//g, function($0, text) { 10 | var ret = ''; 11 | //alert(ret); 12 | return ret; 13 | }).replace(/\r/g, '\n'); 14 | 15 | //调整格式 16 | var rgx = /\n(<(([^\?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(?:(\/)>)|(?:<(\/)\2>)))?)/mg; 17 | var nodeStack = []; 18 | var output = text.replace(rgx, function($0, all, name, isBegin, isCloseFull1, isCloseFull2, isFull1, isFull2) { 19 | var isClosed = (isCloseFull1 == '/') || (isCloseFull2 == '/') || (isFull1 == '/') || (isFull2 == '/'); 20 | //alert([all,isClosed].join('=')); 21 | var prefix = ''; 22 | if (isBegin == '!') { 23 | prefix = getPrefix(nodeStack.length); 24 | } else { 25 | if (isBegin != '/') { 26 | prefix = getPrefix(nodeStack.length); 27 | if (!isClosed) { 28 | nodeStack.push(name); 29 | } 30 | } else { 31 | nodeStack.pop(); 32 | prefix = getPrefix(nodeStack.length); 33 | } 34 | 35 | } 36 | var ret = '\n' + prefix + all; 37 | return ret; 38 | }); 39 | 40 | var prefixSpace = -1; 41 | var outputText = output.substring(1); 42 | //alert(outputText); 43 | 44 | //把注释还原并解码,调格式 45 | outputText = outputText.replace(/\n/g, '\r').replace(/(\s*)/g, function($0, prefix, text) { 46 | //alert(['[',prefix,']=',prefix.length].join('')); 47 | if (prefix.charAt(0) == '\r') 48 | prefix = prefix.substring(1); 49 | text = unescape(text).replace(/\r/g, '\n'); 50 | var ret = '\n' + prefix + ''; 51 | //alert(ret); 52 | return ret; 53 | }); 54 | 55 | return outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n'); 56 | } 57 | 58 | function getPrefix(prefixIndex) { 59 | var span = ' '; 60 | var output = []; 61 | for (var i = 0; i < prefixIndex; ++i) { 62 | output.push(span); 63 | } 64 | 65 | return output.join(''); 66 | } 67 | -------------------------------------------------------------------------------- /src/views/draggable.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 23 | 24 | -------------------------------------------------------------------------------- /src/views/fm-generate.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 25 | 26 | -------------------------------------------------------------------------------- /src/views/makingForm.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 43 | 44 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuchfStrong/vue-bpmn-flowable/ec972bcac1e6c8be129998a29e774c336190dd7d/static/.gitkeep -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | devServer: { 3 | overlay: { 4 | warnings: false, 5 | errors: false 6 | }, 7 | lintOnSave: process.env.NODE_ENV === 'development' ? 'error' : false, 8 | } 9 | } --------------------------------------------------------------------------------