Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/dev-yunai

# Conflicts:
#	yudao-ui-admin-vue3/pnpm-lock.yaml
This commit is contained in:
YunaiV 2023-02-07 22:56:49 +08:00
commit 0d5daa69fb
64 changed files with 3276 additions and 1699 deletions

View File

@ -262,11 +262,11 @@ ps核心功能已经实现正在对接微信小程序中...
| 框架 | 说明 | 版本 | | 框架 | 说明 | 版本 |
|----------------------------------------------------------------------|:------------:|:------:| |----------------------------------------------------------------------|:------------:|:------:|
| [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.45 | | [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.47 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 4.0.4 | | [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 4.1.1 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.28 | | [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.29 |
| [TypeScript](https://www.typescriptlang.org/docs/) | TypeScript | 4.9.4 | | [TypeScript](https://www.typescriptlang.org/docs/) | TypeScript | 4.9.5 |
| [pinia](https://pinia.vuejs.org/) | vuex5 | 2.0.28 | | [pinia](https://pinia.vuejs.org/) | vuex5 | 2.0.30 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 | | [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 |
| [vxe-table](https://vxetable.cn/) | vue最强表单 | 4.3.9 | | [vxe-table](https://vxetable.cn/) | vue最强表单 | 4.3.9 |

View File

@ -28,12 +28,12 @@
| 框架 | 说明 | 版本 | | 框架 | 说明 | 版本 |
| --- | --- |--------| | --- | --- |--------|
| [Vue](https://staging-cn.vuejs.org/) | vue 框架 | 3.2.45 | | [Vue](https://staging-cn.vuejs.org/) | vue 框架 | 3.2.47 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 4.0.4 | | [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 4.1.1 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.28 | | [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.29 |
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 的超集 | 4.9.4 | | [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 的超集 | 4.9.5 |
| [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.0.28 | | [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.0.30 |
| [vueuse](https://vueuse.org/) | 常用工具集 | 9.10.0 | | [vueuse](https://vueuse.org/) | 常用工具集 | 9.12.0 |
| [vxe-table](https://vxetable.cn/) | vue 最强表单 | 4.3.9 | | [vxe-table](https://vxetable.cn/) | vue 最强表单 | 4.3.9 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 | | [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 |
| [vue-router](https://router.vuejs.org/) | vue 路由 | 4.1.6 | | [vue-router](https://router.vuejs.org/) | vue 路由 | 4.1.6 |

View File

@ -14,6 +14,7 @@ const include = [
'vue-i18n', 'vue-i18n',
'xe-utils', 'xe-utils',
'crypto-js', 'crypto-js',
'cropperjs',
'lodash-es', 'lodash-es',
'vxe-table', 'vxe-table',
'nprogress', 'nprogress',

View File

@ -1,6 +1,6 @@
{ {
"name": "yudao-ui-admin-vue3", "name": "yudao-ui-admin-vue3",
"version": "1.7.0-snapshot.1925", "version": "1.7.0-snapshot.1921",
"description": "基于vue3、vite4、element-plus、typesScript", "description": "基于vue3、vite4、element-plus、typesScript",
"author": "xingyu", "author": "xingyu",
"private": false, "private": false,
@ -27,12 +27,12 @@
"@form-create/designer": "^3.1.0", "@form-create/designer": "^3.1.0",
"@form-create/element-ui": "^3.1.17", "@form-create/element-ui": "^3.1.17",
"@iconify/iconify": "^3.1.0", "@iconify/iconify": "^3.1.0",
"@vueuse/core": "^9.11.1", "@vueuse/core": "^9.12.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.10", "@wangeditor/editor-for-vue": "^5.1.10",
"@zxcvbn-ts/core": "^2.2.0", "@zxcvbn-ts/core": "^2.2.0",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^1.2.5", "axios": "^1.3.2",
"bpmn-js-token-simulation": "^0.10.0", "bpmn-js-token-simulation": "^0.10.0",
"camunda-bpmn-moddle": "^7.0.1", "camunda-bpmn-moddle": "^7.0.1",
"cropperjs": "^1.5.13", "cropperjs": "^1.5.13",
@ -41,7 +41,7 @@
"diagram-js": "^11.6.0", "diagram-js": "^11.6.0",
"echarts": "^5.4.1", "echarts": "^5.4.1",
"echarts-wordcloud": "^2.1.0", "echarts-wordcloud": "^2.1.0",
"element-plus": "2.2.28", "element-plus": "2.2.29",
"fast-xml-parser": "^4.0.13", "fast-xml-parser": "^4.0.13",
"highlight.js": "^11.7.0", "highlight.js": "^11.7.0",
"intro.js": "^6.0.0", "intro.js": "^6.0.0",
@ -50,16 +50,15 @@
"min-dash": "^4.0.0", "min-dash": "^4.0.0",
"mitt": "^3.0.0", "mitt": "^3.0.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pinia": "^2.0.29", "pinia": "^2.0.30",
"qrcode": "^1.5.1", "qrcode": "^1.5.1",
"qs": "^6.11.0", "qs": "^6.11.0",
"steady-xml": "^0.1.0", "steady-xml": "^0.1.0",
"url": "^0.11.0", "url": "^0.11.0",
"vue": "3.2.45", "vue": "3.2.47",
"vue-i18n": "9.2.2", "vue-i18n": "9.2.2",
"vue-router": "^4.1.6", "vue-router": "^4.1.6",
"vue-types": "^5.0.2", "vue-types": "^5.0.2",
"vue3-treeselect": "^0.1.10",
"vuedraggable": "^4.1.0", "vuedraggable": "^4.1.0",
"vxe-table": "^4.3.9", "vxe-table": "^4.3.9",
"web-storage-cache": "^1.1.1", "web-storage-cache": "^1.1.1",
@ -69,27 +68,27 @@
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.4.2", "@commitlint/cli": "^17.4.2",
"@commitlint/config-conventional": "^17.4.2", "@commitlint/config-conventional": "^17.4.2",
"@iconify/json": "^2.2.13", "@iconify/json": "^2.2.16",
"@intlify/unplugin-vue-i18n": "^0.8.1", "@intlify/unplugin-vue-i18n": "^0.8.1",
"@purge-icons/generated": "^0.9.0", "@purge-icons/generated": "^0.9.0",
"@types/intro.js": "^5.1.0", "@types/intro.js": "^5.1.0",
"@types/lodash-es": "^4.17.6", "@types/lodash-es": "^4.17.6",
"@types/node": "^18.11.18", "@types/node": "^18.11.19",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.5.0", "@types/qrcode": "^1.5.0",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.49.0", "@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.49.0", "@typescript-eslint/parser": "^5.50.0",
"@vitejs/plugin-legacy": "^3.0.2", "@vitejs/plugin-legacy": "^4.0.1",
"@vitejs/plugin-vue": "^4.0.0", "@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.0", "@vitejs/plugin-vue-jsx": "^3.0.0",
"autoprefixer": "^10.4.13", "autoprefixer": "^10.4.13",
"bpmn-js": "^8.9.0", "bpmn-js": "^8.9.0",
"bpmn-js-properties-panel": "^0.46.0", "bpmn-js-properties-panel": "^0.46.0",
"consola": "^2.15.3", "consola": "^2.15.3",
"eslint": "^8.32.0", "eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.6.0",
"eslint-define-config": "^1.14.0", "eslint-define-config": "^1.15.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.9.0", "eslint-plugin-vue": "^9.9.0",
"lint-staged": "^13.1.0", "lint-staged": "^13.1.0",
@ -98,20 +97,20 @@
"postcss-scss": "^4.0.6", "postcss-scss": "^4.0.6",
"prettier": "^2.8.3", "prettier": "^2.8.3",
"rimraf": "^4.1.2", "rimraf": "^4.1.2",
"rollup": "^3.11.0", "rollup": "^3.14.0",
"sass": "^1.57.1", "sass": "^1.58.0",
"stylelint": "^14.16.1", "stylelint": "^14.16.1",
"stylelint-config-html": "^1.1.0", "stylelint-config-html": "^1.1.0",
"stylelint-config-prettier": "^9.0.4", "stylelint-config-prettier": "^9.0.4",
"stylelint-config-recommended": "^9.0.0", "stylelint-config-recommended": "^9.0.0",
"stylelint-config-standard": "^29.0.0", "stylelint-config-standard": "^29.0.0",
"stylelint-order": "^6.0.1", "stylelint-order": "^6.0.1",
"terser": "^5.16.1", "terser": "^5.16.3",
"typescript": "4.9.4", "typescript": "4.9.5",
"unplugin-auto-import": "^0.12.2", "unplugin-auto-import": "^0.13.0",
"unplugin-element-plus": "^0.4.1", "unplugin-element-plus": "^0.6.0",
"unplugin-vue-components": "^0.22.12", "unplugin-vue-components": "^0.23.0",
"vite": "4.0.4", "vite": "4.1.1",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-ejs": "^1.6.4", "vite-plugin-ejs": "^1.6.4",
"vite-plugin-eslint": "^1.8.1", "vite-plugin-eslint": "^1.8.1",
@ -135,4 +134,4 @@
"url": "https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues" "url": "https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues"
}, },
"homepage": "https://gitee.com/zhijiantianya/ruoyi-vue-pro" "homepage": "https://gitee.com/zhijiantianya/ruoyi-vue-pro"
} }

File diff suppressed because it is too large Load Diff

View File

@ -119,6 +119,7 @@ import { dataURLtoBlob } from '@/utils/filt'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import type { CropendResult, Cropper } from './types' import type { CropendResult, Cropper } from './types'
import { propTypes } from '@/utils/propTypes' import { propTypes } from '@/utils/propTypes'
import { CropperImage } from '@/components/Cropper'
const props = defineProps({ const props = defineProps({
srcValue: propTypes.string.def(''), srcValue: propTypes.string.def(''),

View File

@ -209,8 +209,7 @@
// import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css' // import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css'
// import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css' // import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
// import 'bpmn-js-properties-panel/dist/assets/bpmn-js-properties-panel.css' // // import 'bpmn-js-properties-panel/dist/assets/bpmn-js-properties-panel.css' //
import { ElTooltip, ElButtonGroup, ElButton, ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { computed, onBeforeMount, onBeforeUnmount, onMounted, provide, ref } from 'vue'
import BpmnModeler from 'bpmn-js/lib/Modeler' import BpmnModeler from 'bpmn-js/lib/Modeler'
import DefaultEmptyXML from './plugins/defaultEmpty' import DefaultEmptyXML from './plugins/defaultEmpty'
// //
@ -262,9 +261,17 @@ const props = defineProps({
processId: String, // key processId: String, // key
processName: String, // name processName: String, // name
formId: Number, // form formId: Number, // form
translations: Object, // translations: {
//
type: Object,
default: () => {}
},
additionalModel: [Object, Array], // model additionalModel: [Object, Array], // model
moddleExtension: Object, // moddle moddleExtension: {
// moddle
type: Object,
default: () => {}
},
onlyCustomizeAddi: { onlyCustomizeAddi: {
type: Boolean, type: Boolean,
default: false default: false
@ -292,18 +299,18 @@ const props = defineProps({
headerButtonSize: { headerButtonSize: {
type: String, type: String,
default: 'small', default: 'small',
validator: (value) => ['default', 'medium', 'small', 'mini'].indexOf(value) !== -1 validator: (value: string) => ['default', 'medium', 'small', 'mini'].indexOf(value) !== -1
}, },
headerButtonType: { headerButtonType: {
type: String, type: String,
default: 'primary', default: 'primary',
validator: (value) => validator: (value: string) =>
['default', 'primary', 'success', 'warning', 'danger', 'info'].indexOf(value) !== -1 ['default', 'primary', 'success', 'warning', 'danger', 'info'].indexOf(value) !== -1
} }
}) })
provide('configGlobal', props) provide('configGlobal', props)
let bpmnModeler = null let bpmnModeler: any = null
const defaultZoom = ref(1) const defaultZoom = ref(1)
const previewModelVisible = ref(false) const previewModelVisible = ref(false)
const simulationStatus = ref(false) const simulationStatus = ref(false)
@ -313,7 +320,7 @@ const recoverable = ref(false)
const revocable = ref(false) const revocable = ref(false)
const additionalModules = computed(() => { const additionalModules = computed(() => {
console.log(props.additionalModel, 'additionalModel') console.log(props.additionalModel, 'additionalModel')
const Modules = [] const Modules: any[] = []
// //
if (props.onlyCustomizeAddi) { if (props.onlyCustomizeAddi) {
if (Object.prototype.toString.call(props.additionalModel) == '[object Array]') { if (Object.prototype.toString.call(props.additionalModel) == '[object Array]') {
@ -361,7 +368,7 @@ const moddleExtensions = computed(() => {
console.log(props.onlyCustomizeModdle, 'props.onlyCustomizeModdle') console.log(props.onlyCustomizeModdle, 'props.onlyCustomizeModdle')
console.log(props.moddleExtension, 'props.moddleExtension') console.log(props.moddleExtension, 'props.moddleExtension')
console.log(props.prefix, 'props.prefix') console.log(props.prefix, 'props.prefix')
const Extensions = {} const Extensions: any = {}
// 使 // 使
if (props.onlyCustomizeModdle) { if (props.onlyCustomizeModdle) {
return props.moddleExtension || null return props.moddleExtension || null
@ -432,7 +439,7 @@ const initModelListeners = () => {
const EventBus = bpmnModeler.get('eventBus') const EventBus = bpmnModeler.get('eventBus')
console.log(EventBus, 'EventBus') console.log(EventBus, 'EventBus')
// , . - , // , . - ,
props.events.forEach((event) => { props.events.forEach((event: any) => {
EventBus.on(event, function (eventObj) { EventBus.on(event, function (eventObj) {
let eventName = event.replace(/\./g, '-') let eventName = event.replace(/\./g, '-')
// eventName.name = eventName // eventName.name = eventName
@ -452,7 +459,7 @@ const initModelListeners = () => {
emit('commandStack-changed', event) emit('commandStack-changed', event)
emit('input', xml) emit('input', xml)
emit('change', xml) emit('change', xml)
} catch (e) { } catch (e: any) {
console.error(`[Process Designer Warn]: ${e.message || e}`) console.error(`[Process Designer Warn]: ${e.message || e}`)
} }
}) })
@ -478,13 +485,13 @@ const createNewDiagram = async (xml) => {
if (warnings && warnings.length) { if (warnings && warnings.length) {
warnings.forEach((warn) => console.warn(warn)) warnings.forEach((warn) => console.warn(warn))
} }
} catch (e) { } catch (e: any) {
console.error(`[Process Designer Warn]: ${e?.message || e}`) console.error(`[Process Designer Warn]: ${e.message || e}`)
} }
} }
// //
const downloadProcess = async (type, name) => { const downloadProcess = async (type) => {
try { try {
// //
if (type === 'xml' || type === 'bpmn') { if (type === 'xml' || type === 'bpmn') {
@ -493,7 +500,7 @@ const downloadProcess = async (type, name) => {
if (err) { if (err) {
console.error(`[Process Designer Warn ]: ${err.message || err}`) console.error(`[Process Designer Warn ]: ${err.message || err}`)
} }
let { href, filename } = setEncoded(type.toUpperCase(), name, xml) let { href, filename } = setEncoded(type.toUpperCase(), xml)
downloadFunc(href, filename) downloadFunc(href, filename)
} else { } else {
const { err, svg } = await bpmnModeler.saveSVG() const { err, svg } = await bpmnModeler.saveSVG()
@ -501,10 +508,10 @@ const downloadProcess = async (type, name) => {
if (err) { if (err) {
return console.error(err) return console.error(err)
} }
let { href, filename } = setEncoded('SVG', name, svg) let { href, filename } = setEncoded('SVG', svg)
downloadFunc(href, filename) downloadFunc(href, filename)
} }
} catch (e) { } catch (e: any) {
console.error(`[Process Designer Warn ]: ${e.message || e}`) console.error(`[Process Designer Warn ]: ${e.message || e}`)
} }
// //
@ -520,7 +527,8 @@ const downloadProcess = async (type, name) => {
} }
// //
const setEncoded = (type, filename = 'diagram', data) => { const setEncoded = (type, data) => {
const filename = 'diagram'
const encodedData = encodeURIComponent(data) const encodedData = encodeURIComponent(data)
return { return {
filename: `${filename}.${type}`, filename: `${filename}.${type}`,
@ -643,7 +651,7 @@ const previewProcessJson = () => {
// const xmlContent = builder // const xmlContent = builder
// console.log(xmlContent, 'xmlContent') // console.log(xmlContent, 'xmlContent')
// console.log(xml2js, 'convertconvertconvert') // console.log(xml2js, 'convertconvertconvert')
previewResult.value = rootNodes.parent.toJSON() previewResult.value = rootNodes.parent?.toJSON() as unknown as string
// previewResult.value = jObj // previewResult.value = jObj
// previewResult.value = convert.xml2json(xml, {explicitArray : false},{ spaces: 2 }) // previewResult.value = convert.xml2json(xml, {explicitArray : false},{ spaces: 2 })
previewType.value = 'json' previewType.value = 'json'

View File

@ -9,12 +9,12 @@
<script setup lang="ts" name="MyProcessViewer"> <script setup lang="ts" name="MyProcessViewer">
import BpmnViewer from 'bpmn-js/lib/Viewer' import BpmnViewer from 'bpmn-js/lib/Viewer'
import DefaultEmptyXML from './plugins/defaultEmpty' import DefaultEmptyXML from './plugins/defaultEmpty'
import { onMounted, onBeforeUnmount, provide, ref, watch, toRaw } from 'vue'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
const props = defineProps({ const props = defineProps({
value: { value: {
// BPMN XML // BPMN XML
type: String type: String,
default: ''
}, },
prefix: { prefix: {
// 使 // 使
@ -28,7 +28,8 @@ const props = defineProps({
}, },
processInstanceData: { processInstanceData: {
// //
type: Object type: Object,
default: () => {}
}, },
taskData: { taskData: {
// UserTask // UserTask
@ -44,13 +45,13 @@ const emit = defineEmits(['destroy'])
let bpmnModeler let bpmnModeler
const xml = ref('') const xml = ref('')
const activityLists = ref([]) const activityLists = ref<any[]>([])
const processInstance = ref(undefined) const processInstance = ref<any>(undefined)
const taskList = ref([]) const taskList = ref<any[]>([])
const bpmnCanvas = ref() const bpmnCanvas = ref()
// const element = ref() // const element = ref()
const elementOverlayIds = ref(null) const elementOverlayIds = ref<any>(null)
const overlays = ref(null) const overlays = ref<any>(null)
const initBpmnModeler = () => { const initBpmnModeler = () => {
if (bpmnModeler) return if (bpmnModeler) return
@ -90,18 +91,18 @@ const highlightDiagram = async () => {
// https://gitee.com/tony2y/RuoYi-flowable/blob/master/ruoyi-ui/src/components/Process/index.vue#L222 // https://gitee.com/tony2y/RuoYi-flowable/blob/master/ruoyi-ui/src/components/Process/index.vue#L222
// //
let canvas = bpmnModeler.get('canvas') let canvas = bpmnModeler.get('canvas')
let todoActivity = activityList.find((m) => !m.endTime) // let todoActivity: any = activityList.find((m: any) => !m.endTime) //
let endActivity = activityList[activityList.length - 1] // let endActivity: any = activityList[activityList.length - 1] //
// debugger // debugger
bpmnModeler.getDefinitions().rootElements[0].flowElements?.forEach((n) => { bpmnModeler.getDefinitions().rootElements[0].flowElements?.forEach((n: any) => {
let activity = activityList.find((m) => m.key === n.id) // let activity: any = activityList.find((m: any) => m.key === n.id) //
if (!activity) { if (!activity) {
return return
} }
if (n.$type === 'bpmn:UserTask') { if (n.$type === 'bpmn:UserTask') {
// //
// //
const task = taskList.value.find((m) => m.id === activity.taskId) // taskId const task: any = taskList.value.find((m: any) => m.id === activity.taskId) // taskId
if (!task) { if (!task) {
return return
} }
@ -114,9 +115,9 @@ const highlightDiagram = async () => {
} }
// outgoing 线 // outgoing 线
const outgoing = getActivityOutgoing(activity) const outgoing = getActivityOutgoing(activity)
outgoing?.forEach((nn) => { outgoing?.forEach((nn: any) => {
// debugger // debugger
let targetActivity = activityList.find((m) => m.key === nn.targetRef.id) let targetActivity: any = activityList.find((m: any) => m.key === nn.targetRef.id)
// bpmn:SequenceFlow线 // bpmn:SequenceFlow线
if (targetActivity) { if (targetActivity) {
canvas.addMarker(nn.id, targetActivity.endTime ? 'highlight' : 'highlight-todo') canvas.addMarker(nn.id, targetActivity.endTime ? 'highlight' : 'highlight-todo')
@ -141,10 +142,10 @@ const highlightDiagram = async () => {
// bpmn:ExclusiveGateway // bpmn:ExclusiveGateway
canvas.addMarker(n.id, getActivityHighlightCss(activity)) canvas.addMarker(n.id, getActivityHighlightCss(activity))
// 线 // 线
let matchNN = undefined let matchNN: any = undefined
let matchActivity = undefined let matchActivity: any = undefined
n.outgoing?.forEach((nn) => { n.outgoing?.forEach((nn: any) => {
let targetActivity = activityList.find((m) => m.key === nn.targetRef.id) let targetActivity = activityList.find((m: any) => m.key === nn.targetRef.id)
if (!targetActivity) { if (!targetActivity) {
return return
} }
@ -165,9 +166,9 @@ const highlightDiagram = async () => {
// //
// bpmn:ParallelGateway // bpmn:ParallelGateway
canvas.addMarker(n.id, getActivityHighlightCss(activity)) canvas.addMarker(n.id, getActivityHighlightCss(activity))
n.outgoing?.forEach((nn) => { n.outgoing?.forEach((nn: any) => {
// 线 // 线
const targetActivity = activityList.find((m) => m.key === nn.targetRef.id) const targetActivity = activityList.find((m: any) => m.key === nn.targetRef.id)
if (targetActivity) { if (targetActivity) {
canvas.addMarker(nn.id, getActivityHighlightCss(targetActivity)) // bpmn:SequenceFlow线 canvas.addMarker(nn.id, getActivityHighlightCss(targetActivity)) // bpmn:SequenceFlow线
// ... ... bpm:UserTask bpm:UserTask // ... ... bpm:UserTask bpm:UserTask
@ -179,7 +180,7 @@ const highlightDiagram = async () => {
n.outgoing?.forEach((nn) => { n.outgoing?.forEach((nn) => {
// outgoing bpmn:SequenceFlow线 // outgoing bpmn:SequenceFlow线
// 线 // 线
let targetActivity = activityList.find((m) => m.key === nn.targetRef.id) let targetActivity = activityList.find((m: any) => m.key === nn.targetRef.id)
if (targetActivity) { if (targetActivity) {
canvas.addMarker(nn.id, 'highlight') // bpmn:SequenceFlow线 canvas.addMarker(nn.id, 'highlight') // bpmn:SequenceFlow线
canvas.addMarker(n.id, 'highlight') // bpmn:StartEvent canvas.addMarker(n.id, 'highlight') // bpmn:StartEvent
@ -235,8 +236,8 @@ const getActivityOutgoing = (activity) => {
} }
// bpmn:SequenceFlowbpmn-js UserTask outgoing // bpmn:SequenceFlowbpmn-js UserTask outgoing
const flowElements = bpmnModeler.getDefinitions().rootElements[0].flowElements const flowElements = bpmnModeler.getDefinitions().rootElements[0].flowElements
const outgoing = [] const outgoing: any[] = []
flowElements.forEach((item) => { flowElements.forEach((item: any) => {
if (item.$type !== 'bpmn:SequenceFlow') { if (item.$type !== 'bpmn:SequenceFlow') {
return return
} }

View File

@ -1,19 +1,19 @@
import { assign, forEach, isArray } from 'min-dash' import { assign, forEach, isArray } from 'min-dash'
import { is } from "bpmn-js/lib/util/ModelUtil" import { is } from 'bpmn-js/lib/util/ModelUtil'
import { isExpanded, isEventSubProcess } from "bpmn-js/lib/util/DiUtil" import { isExpanded, isEventSubProcess } from 'bpmn-js/lib/util/DiUtil'
import { isAny } from "bpmn-js/lib/features/modeling/util/ModelingUtil" import { isAny } from 'bpmn-js/lib/features/modeling/util/ModelingUtil'
import { getChildLanes } from "bpmn-js/lib/features/modeling/util/LaneUtil" import { getChildLanes } from 'bpmn-js/lib/features/modeling/util/LaneUtil'
import { hasPrimaryModifier } from "diagram-js/lib/util/Mouse" import { hasPrimaryModifier } from 'diagram-js/lib/util/Mouse'
/** /**
* A provider for BPMN 2.0 elements context pad * A provider for BPMN 2.0 elements context pad
*/ */
export default function ContextPadProvider ( export default function ContextPadProvider(
config, config,
injector, injector,
eventBus, eventBus,
@ -25,8 +25,7 @@ export default function ContextPadProvider (
popupMenu, popupMenu,
canvas, canvas,
rules, rules,
translate, translate
elementRegistry
) { ) {
config = config || {} config = config || {}
@ -45,10 +44,10 @@ export default function ContextPadProvider (
this._translate = translate this._translate = translate
if (config.autoPlace !== false) { if (config.autoPlace !== false) {
this._autoPlace = injector.get("autoPlace", false) this._autoPlace = injector.get('autoPlace', false)
} }
eventBus.on("create.end", 250, function (event) { eventBus.on('create.end', 250, function (event) {
const context = event.context, const context = event.context,
shape = context.shape shape = context.shape
@ -65,19 +64,19 @@ export default function ContextPadProvider (
} }
ContextPadProvider.$inject = [ ContextPadProvider.$inject = [
"config.contextPad", 'config.contextPad',
"injector", 'injector',
"eventBus", 'eventBus',
"contextPad", 'contextPad',
"modeling", 'modeling',
"elementFactory", 'elementFactory',
"connect", 'connect',
"create", 'create',
"popupMenu", 'popupMenu',
"canvas", 'canvas',
"rules", 'rules',
"translate", 'translate',
"elementRegistry" 'elementRegistry'
] ]
ContextPadProvider.prototype.getContextPadEntries = function (element) { ContextPadProvider.prototype.getContextPadEntries = function (element) {
@ -94,21 +93,21 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
const actions = {} const actions = {}
if (element.type === "label") { if (element.type === 'label') {
return actions return actions
} }
const businessObject = element.businessObject const businessObject = element.businessObject
function startConnect (event, element) { function startConnect(event, element) {
connect.start(event, element) connect.start(event, element)
} }
function removeElement () { function removeElement() {
modeling.removeElements([element]) modeling.removeElements([element])
} }
function getReplaceMenuPosition (element) { function getReplaceMenuPosition(element) {
const Y_OFFSET = 5 const Y_OFFSET = 5
const diagramContainer = canvas.getContainer(), const diagramContainer = canvas.getContainer(),
@ -138,13 +137,13 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
* *
* @return {Object} descriptor * @return {Object} descriptor
*/ */
function appendAction (type, className, title, options) { function appendAction(type, className, title, options) {
if (typeof title !== "string") { if (typeof title !== 'string') {
options = title options = title
title = translate("Append {type}", { type: type.replace(/^bpmn:/, "") }) title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') })
} }
function appendStart (event, element) { function appendStart(event, element) {
const shape = elementFactory.createShape(assign({ type: type }, options)) const shape = elementFactory.createShape(assign({ type: type }, options))
create.start(event, shape, { create.start(event, shape, {
source: element source: element
@ -153,14 +152,14 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
const append = autoPlace const append = autoPlace
? function (event, element) { ? function (event, element) {
const shape = elementFactory.createShape(assign({ type: type }, options)) const shape = elementFactory.createShape(assign({ type: type }, options))
autoPlace.append(element, shape) autoPlace.append(element, shape)
} }
: appendStart : appendStart
return { return {
group: "model", group: 'model',
className: className, className: className,
title: title, title: title,
action: { action: {
@ -170,7 +169,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
} }
} }
function splitLaneHandler (count) { function splitLaneHandler(count) {
return function (event, element) { return function (event, element) {
// actual split // actual split
modeling.splitLane(element, count) modeling.splitLane(element, count)
@ -181,17 +180,17 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
} }
} }
if (isAny(businessObject, ["bpmn:Lane", "bpmn:Participant"]) && isExpanded(businessObject)) { if (isAny(businessObject, ['bpmn:Lane', 'bpmn:Participant']) && isExpanded(businessObject)) {
const childLanes = getChildLanes(element) const childLanes = getChildLanes(element)
assign(actions, { assign(actions, {
"lane-insert-above": { 'lane-insert-above': {
group: "lane-insert-above", group: 'lane-insert-above',
className: "bpmn-icon-lane-insert-above", className: 'bpmn-icon-lane-insert-above',
title: translate("Add Lane above"), title: translate('Add Lane above'),
action: { action: {
click: function (event, element) { click: function (event, element) {
modeling.addLane(element, "top") modeling.addLane(element, 'top')
} }
} }
} }
@ -200,10 +199,10 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
if (childLanes.length < 2) { if (childLanes.length < 2) {
if (element.height >= 120) { if (element.height >= 120) {
assign(actions, { assign(actions, {
"lane-divide-two": { 'lane-divide-two': {
group: "lane-divide", group: 'lane-divide',
className: "bpmn-icon-lane-divide-two", className: 'bpmn-icon-lane-divide-two',
title: translate("Divide into two Lanes"), title: translate('Divide into two Lanes'),
action: { action: {
click: splitLaneHandler(2) click: splitLaneHandler(2)
} }
@ -213,10 +212,10 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
if (element.height >= 180) { if (element.height >= 180) {
assign(actions, { assign(actions, {
"lane-divide-three": { 'lane-divide-three': {
group: "lane-divide", group: 'lane-divide',
className: "bpmn-icon-lane-divide-three", className: 'bpmn-icon-lane-divide-three',
title: translate("Divide into three Lanes"), title: translate('Divide into three Lanes'),
action: { action: {
click: splitLaneHandler(3) click: splitLaneHandler(3)
} }
@ -226,79 +225,102 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
} }
assign(actions, { assign(actions, {
"lane-insert-below": { 'lane-insert-below': {
group: "lane-insert-below", group: 'lane-insert-below',
className: "bpmn-icon-lane-insert-below", className: 'bpmn-icon-lane-insert-below',
title: translate("Add Lane below"), title: translate('Add Lane below'),
action: { action: {
click: function (event, element) { click: function (event, element) {
modeling.addLane(element, "bottom") modeling.addLane(element, 'bottom')
} }
} }
} }
}) })
} }
if (is(businessObject, "bpmn:FlowNode")) { if (is(businessObject, 'bpmn:FlowNode')) {
if (is(businessObject, "bpmn:EventBasedGateway")) { if (is(businessObject, 'bpmn:EventBasedGateway')) {
assign(actions, { assign(actions, {
"append.receive-task": appendAction("bpmn:ReceiveTask", "bpmn-icon-receive-task", translate("Append ReceiveTask")), 'append.receive-task': appendAction(
"append.message-intermediate-event": appendAction( 'bpmn:ReceiveTask',
"bpmn:IntermediateCatchEvent", 'bpmn-icon-receive-task',
"bpmn-icon-intermediate-event-catch-message", translate('Append ReceiveTask')
translate("Append MessageIntermediateCatchEvent"),
{ eventDefinitionType: "bpmn:MessageEventDefinition" }
), ),
"append.timer-intermediate-event": appendAction( 'append.message-intermediate-event': appendAction(
"bpmn:IntermediateCatchEvent", 'bpmn:IntermediateCatchEvent',
"bpmn-icon-intermediate-event-catch-timer", 'bpmn-icon-intermediate-event-catch-message',
translate("Append TimerIntermediateCatchEvent"), translate('Append MessageIntermediateCatchEvent'),
{ eventDefinitionType: "bpmn:TimerEventDefinition" } { eventDefinitionType: 'bpmn:MessageEventDefinition' }
), ),
"append.condition-intermediate-event": appendAction( 'append.timer-intermediate-event': appendAction(
"bpmn:IntermediateCatchEvent", 'bpmn:IntermediateCatchEvent',
"bpmn-icon-intermediate-event-catch-condition", 'bpmn-icon-intermediate-event-catch-timer',
translate("Append ConditionIntermediateCatchEvent"), translate('Append TimerIntermediateCatchEvent'),
{ eventDefinitionType: "bpmn:ConditionalEventDefinition" } { eventDefinitionType: 'bpmn:TimerEventDefinition' }
), ),
"append.signal-intermediate-event": appendAction( 'append.condition-intermediate-event': appendAction(
"bpmn:IntermediateCatchEvent", 'bpmn:IntermediateCatchEvent',
"bpmn-icon-intermediate-event-catch-signal", 'bpmn-icon-intermediate-event-catch-condition',
translate("Append SignalIntermediateCatchEvent"), translate('Append ConditionIntermediateCatchEvent'),
{ eventDefinitionType: "bpmn:SignalEventDefinition" } { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
),
'append.signal-intermediate-event': appendAction(
'bpmn:IntermediateCatchEvent',
'bpmn-icon-intermediate-event-catch-signal',
translate('Append SignalIntermediateCatchEvent'),
{ eventDefinitionType: 'bpmn:SignalEventDefinition' }
) )
}) })
} else if (isEventType(businessObject, "bpmn:BoundaryEvent", "bpmn:CompensateEventDefinition")) { } else if (
isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')
) {
assign(actions, { assign(actions, {
"append.compensation-activity": appendAction("bpmn:Task", "bpmn-icon-task", translate("Append compensation activity"), { 'append.compensation-activity': appendAction(
isForCompensation: true 'bpmn:Task',
}) 'bpmn-icon-task',
translate('Append compensation activity'),
{
isForCompensation: true
}
)
}) })
} else if ( } else if (
!is(businessObject, "bpmn:EndEvent") && !is(businessObject, 'bpmn:EndEvent') &&
!businessObject.isForCompensation && !businessObject.isForCompensation &&
!isEventType(businessObject, "bpmn:IntermediateThrowEvent", "bpmn:LinkEventDefinition") && !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
!isEventSubProcess(businessObject) !isEventSubProcess(businessObject)
) { ) {
assign(actions, { assign(actions, {
"append.end-event": appendAction("bpmn:EndEvent", "bpmn-icon-end-event-none", translate("Append EndEvent")), 'append.end-event': appendAction(
"append.gateway": appendAction("bpmn:ExclusiveGateway", "bpmn-icon-gateway-none", translate("Append Gateway")), 'bpmn:EndEvent',
"append.append-task": appendAction("bpmn:UserTask", "bpmn-icon-user-task", translate("Append Task")), 'bpmn-icon-end-event-none',
"append.intermediate-event": appendAction( translate('Append EndEvent')
"bpmn:IntermediateThrowEvent", ),
"bpmn-icon-intermediate-event-none", 'append.gateway': appendAction(
translate("Append Intermediate/Boundary Event") 'bpmn:ExclusiveGateway',
'bpmn-icon-gateway-none',
translate('Append Gateway')
),
'append.append-task': appendAction(
'bpmn:UserTask',
'bpmn-icon-user-task',
translate('Append Task')
),
'append.intermediate-event': appendAction(
'bpmn:IntermediateThrowEvent',
'bpmn-icon-intermediate-event-none',
translate('Append Intermediate/Boundary Event')
) )
}) })
} }
} }
if (!popupMenu.isEmpty(element, "bpmn-replace")) { if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
// Replace menu entry // Replace menu entry
assign(actions, { assign(actions, {
replace: { replace: {
group: "edit", group: 'edit',
className: "bpmn-icon-screw-wrench", className: 'bpmn-icon-screw-wrench',
title: '修改类型', title: '修改类型',
action: { action: {
click: function (event, element) { click: function (event, element) {
@ -306,21 +328,32 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
cursor: { x: event.x, y: event.y } cursor: { x: event.x, y: event.y }
}) })
popupMenu.open(element, "bpmn-replace", position) popupMenu.open(element, 'bpmn-replace', position)
} }
} }
} }
}) })
} }
if (isAny(businessObject, ["bpmn:FlowNode", "bpmn:InteractionNode", "bpmn:DataObjectReference", "bpmn:DataStoreReference"])) { if (
isAny(businessObject, [
'bpmn:FlowNode',
'bpmn:InteractionNode',
'bpmn:DataObjectReference',
'bpmn:DataStoreReference'
])
) {
assign(actions, { assign(actions, {
"append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation"), 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation'),
connect: { connect: {
group: "connect", group: 'connect',
className: "bpmn-icon-connection-multi", className: 'bpmn-icon-connection-multi',
title: translate("Connect using " + (businessObject.isForCompensation ? "" : "Sequence/MessageFlow or ") + "Association"), title: translate(
'Connect using ' +
(businessObject.isForCompensation ? '' : 'Sequence/MessageFlow or ') +
'Association'
),
action: { action: {
click: startConnect, click: startConnect,
dragstart: startConnect dragstart: startConnect
@ -329,12 +362,12 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
}) })
} }
if (isAny(businessObject, ["bpmn:DataObjectReference", "bpmn:DataStoreReference"])) { if (isAny(businessObject, ['bpmn:DataObjectReference', 'bpmn:DataStoreReference'])) {
assign(actions, { assign(actions, {
connect: { connect: {
group: "connect", group: 'connect',
className: "bpmn-icon-connection-multi", className: 'bpmn-icon-connection-multi',
title: translate("Connect using DataInputAssociation"), title: translate('Connect using DataInputAssociation'),
action: { action: {
click: startConnect, click: startConnect,
dragstart: startConnect dragstart: startConnect
@ -343,9 +376,9 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
}) })
} }
if (is(businessObject, "bpmn:Group")) { if (is(businessObject, 'bpmn:Group')) {
assign(actions, { assign(actions, {
"append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation") 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
}) })
} }
@ -360,9 +393,9 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
if (deleteAllowed) { if (deleteAllowed) {
assign(actions, { assign(actions, {
delete: { delete: {
group: "edit", group: 'edit',
className: "bpmn-icon-trash", className: 'bpmn-icon-trash',
title: translate("Remove"), title: translate('Remove'),
action: { action: {
click: removeElement click: removeElement
} }
@ -375,7 +408,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
// helpers ///////// // helpers /////////
function isEventType (eventBo, type, definition) { function isEventType(eventBo, type, definition) {
const isType = eventBo.$instanceOf(type) const isType = eventBo.$instanceOf(type)
let isDefinition = false let isDefinition = false

View File

@ -1,6 +1,6 @@
import CustomContextPadProvider from "./contentPadProvider"; import CustomContextPadProvider from './contentPadProvider'
export default { export default {
__init__: ["contextPadProvider"], __init__: ['contextPadProvider'],
contextPadProvider: ["type", CustomContextPadProvider] contextPadProvider: ['type', CustomContextPadProvider]
}; }

View File

@ -1,10 +1,10 @@
export default (key, name, type) => { export default (key, name, type) => {
if (!type) type = "camunda"; if (!type) type = 'camunda'
const TYPE_TARGET = { const TYPE_TARGET = {
activiti: "http://activiti.org/bpmn", activiti: 'http://activiti.org/bpmn',
camunda: "http://bpmn.io/schema/bpmn", camunda: 'http://bpmn.io/schema/bpmn',
flowable: "http://flowable.org/bpmn" flowable: 'http://flowable.org/bpmn'
}; }
return `<?xml version="1.0" encoding="UTF-8"?> return `<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions <bpmn2:definitions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@ -20,5 +20,5 @@ export default (key, name, type) => {
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="${key}"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="${key}">
</bpmndi:BPMNPlane> </bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram> </bpmndi:BPMNDiagram>
</bpmn2:definitions>`; </bpmn2:definitions>`
}; }

View File

@ -10,9 +10,7 @@
{ {
"name": "Definitions", "name": "Definitions",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Definitions"],
"bpmn:Definitions"
],
"properties": [ "properties": [
{ {
"name": "diagramRelationId", "name": "diagramRelationId",
@ -23,9 +21,7 @@
}, },
{ {
"name": "InOutBinding", "name": "InOutBinding",
"superClass": [ "superClass": ["Element"],
"Element"
],
"isAbstract": true, "isAbstract": true,
"properties": [ "properties": [
{ {
@ -63,34 +59,22 @@
}, },
{ {
"name": "In", "name": "In",
"superClass": [ "superClass": ["InOutBinding"],
"InOutBinding"
],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:CallActivity"]
"bpmn:CallActivity"
]
} }
}, },
{ {
"name": "Out", "name": "Out",
"superClass": [ "superClass": ["InOutBinding"],
"InOutBinding"
],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:CallActivity"]
"bpmn:CallActivity"
]
} }
}, },
{ {
"name": "AsyncCapable", "name": "AsyncCapable",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Activity", "bpmn:Gateway", "bpmn:Event"],
"bpmn:Activity",
"bpmn:Gateway",
"bpmn:Event"
],
"properties": [ "properties": [
{ {
"name": "async", "name": "async",
@ -121,10 +105,7 @@
{ {
"name": "JobPriorized", "name": "JobPriorized",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Process", "activiti:AsyncCapable"],
"bpmn:Process",
"activiti:AsyncCapable"
],
"properties": [ "properties": [
{ {
"name": "jobPriority", "name": "jobPriority",
@ -136,9 +117,7 @@
{ {
"name": "SignalEventDefinition", "name": "SignalEventDefinition",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:SignalEventDefinition"],
"bpmn:SignalEventDefinition"
],
"properties": [ "properties": [
{ {
"name": "async", "name": "async",
@ -151,9 +130,7 @@
{ {
"name": "ErrorEventDefinition", "name": "ErrorEventDefinition",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:ErrorEventDefinition"],
"bpmn:ErrorEventDefinition"
],
"properties": [ "properties": [
{ {
"name": "errorCodeVariable", "name": "errorCodeVariable",
@ -170,9 +147,7 @@
{ {
"name": "Error", "name": "Error",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Error"],
"bpmn:Error"
],
"properties": [ "properties": [
{ {
"name": "activiti:errorMessage", "name": "activiti:errorMessage",
@ -183,9 +158,7 @@
}, },
{ {
"name": "PotentialStarter", "name": "PotentialStarter",
"superClass": [ "superClass": ["Element"],
"Element"
],
"properties": [ "properties": [
{ {
"name": "resourceAssignmentExpression", "name": "resourceAssignmentExpression",
@ -196,10 +169,7 @@
{ {
"name": "FormSupported", "name": "FormSupported",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:StartEvent", "bpmn:UserTask"],
"bpmn:StartEvent",
"bpmn:UserTask"
],
"properties": [ "properties": [
{ {
"name": "formHandlerClass", "name": "formHandlerClass",
@ -216,10 +186,7 @@
{ {
"name": "TemplateSupported", "name": "TemplateSupported",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Process", "bpmn:FlowElement"],
"bpmn:Process",
"bpmn:FlowElement"
],
"properties": [ "properties": [
{ {
"name": "modelerTemplate", "name": "modelerTemplate",
@ -231,7 +198,7 @@
{ {
"name": "Initiator", "name": "Initiator",
"isAbstract": true, "isAbstract": true,
"extends": [ "bpmn:StartEvent" ], "extends": ["bpmn:StartEvent"],
"properties": [ "properties": [
{ {
"name": "initiator", "name": "initiator",
@ -243,9 +210,7 @@
{ {
"name": "ScriptTask", "name": "ScriptTask",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:ScriptTask"],
"bpmn:ScriptTask"
],
"properties": [ "properties": [
{ {
"name": "resultVariable", "name": "resultVariable",
@ -262,9 +227,7 @@
{ {
"name": "Process", "name": "Process",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Process"],
"bpmn:Process"
],
"properties": [ "properties": [
{ {
"name": "candidateStarterGroups", "name": "candidateStarterGroups",
@ -293,18 +256,16 @@
"default": true "default": true
}, },
{ {
"name":"executionListener", "name": "executionListener",
"isAbstract": true, "isAbstract": true,
"type":"Expression" "type": "Expression"
} }
] ]
}, },
{ {
"name": "EscalationEventDefinition", "name": "EscalationEventDefinition",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:EscalationEventDefinition"],
"bpmn:EscalationEventDefinition"
],
"properties": [ "properties": [
{ {
"name": "escalationCodeVariable", "name": "escalationCodeVariable",
@ -316,9 +277,7 @@
{ {
"name": "FormalExpression", "name": "FormalExpression",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:FormalExpression"],
"bpmn:FormalExpression"
],
"properties": [ "properties": [
{ {
"name": "resource", "name": "resource",
@ -329,19 +288,15 @@
}, },
{ {
"name": "multiinstance_type", "name": "multiinstance_type",
"superClass":[ "superClass": ["Element"]
"Element"
]
}, },
{ {
"name": "multiinstance_condition", "name": "multiinstance_condition",
"superClass":[ "superClass": ["Element"]
"Element"
]
}, },
{ {
"name": "Assignable", "name": "Assignable",
"extends": [ "bpmn:UserTask" ], "extends": ["bpmn:UserTask"],
"properties": [ "properties": [
{ {
"name": "assignee", "name": "assignee",
@ -382,7 +337,7 @@
}, },
{ {
"name": "CallActivity", "name": "CallActivity",
"extends": [ "bpmn:CallActivity" ], "extends": ["bpmn:CallActivity"],
"properties": [ "properties": [
{ {
"name": "calledElementBinding", "name": "calledElementBinding",
@ -471,9 +426,7 @@
}, },
{ {
"name": "DmnCapable", "name": "DmnCapable",
"extends": [ "extends": ["bpmn:BusinessRuleTask"],
"bpmn:BusinessRuleTask"
],
"properties": [ "properties": [
{ {
"name": "decisionRef", "name": "decisionRef",
@ -506,9 +459,7 @@
}, },
{ {
"name": "ExternalCapable", "name": "ExternalCapable",
"extends": [ "extends": ["activiti:ServiceTaskLike"],
"activiti:ServiceTaskLike"
],
"properties": [ "properties": [
{ {
"name": "type", "name": "type",
@ -524,10 +475,7 @@
}, },
{ {
"name": "TaskPriorized", "name": "TaskPriorized",
"extends": [ "extends": ["bpmn:Process", "activiti:ExternalCapable"],
"bpmn:Process",
"activiti:ExternalCapable"
],
"properties": [ "properties": [
{ {
"name": "taskPriority", "name": "taskPriority",
@ -538,11 +486,9 @@
}, },
{ {
"name": "Properties", "name": "Properties",
"superClass": [ "superClass": ["Element"],
"Element"
],
"meta": { "meta": {
"allowedIn": [ "*" ] "allowedIn": ["*"]
}, },
"properties": [ "properties": [
{ {
@ -554,9 +500,7 @@
}, },
{ {
"name": "Property", "name": "Property",
"superClass": [ "superClass": ["Element"],
"Element"
],
"properties": [ "properties": [
{ {
"name": "id", "name": "id",
@ -577,13 +521,9 @@
}, },
{ {
"name": "Connector", "name": "Connector",
"superClass": [ "superClass": ["Element"],
"Element"
],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["activiti:ServiceTaskLike"]
"activiti:ServiceTaskLike"
]
}, },
"properties": [ "properties": [
{ {
@ -598,14 +538,9 @@
}, },
{ {
"name": "InputOutput", "name": "InputOutput",
"superClass": [ "superClass": ["Element"],
"Element"
],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:FlowNode", "activiti:Connector"]
"bpmn:FlowNode",
"activiti:Connector"
]
}, },
"properties": [ "properties": [
{ {
@ -653,7 +588,7 @@
}, },
{ {
"name": "List", "name": "List",
"superClass": [ "InputOutputParameterDefinition" ], "superClass": ["InputOutputParameterDefinition"],
"properties": [ "properties": [
{ {
"name": "items", "name": "items",
@ -664,7 +599,7 @@
}, },
{ {
"name": "Map", "name": "Map",
"superClass": [ "InputOutputParameterDefinition" ], "superClass": ["InputOutputParameterDefinition"],
"properties": [ "properties": [
{ {
"name": "entries", "name": "entries",
@ -694,9 +629,7 @@
}, },
{ {
"name": "Value", "name": "Value",
"superClass": [ "superClass": ["InputOutputParameterDefinition"],
"InputOutputParameterDefinition"
],
"properties": [ "properties": [
{ {
"name": "id", "name": "id",
@ -717,7 +650,7 @@
}, },
{ {
"name": "Script", "name": "Script",
"superClass": [ "InputOutputParameterDefinition" ], "superClass": ["InputOutputParameterDefinition"],
"properties": [ "properties": [
{ {
"name": "scriptFormat", "name": "scriptFormat",
@ -738,7 +671,7 @@
}, },
{ {
"name": "Field", "name": "Field",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": [
"activiti:ServiceTaskLike", "activiti:ServiceTaskLike",
@ -769,17 +702,17 @@
}, },
{ {
"name": "InputParameter", "name": "InputParameter",
"superClass": [ "InputOutputParameter" ] "superClass": ["InputOutputParameter"]
}, },
{ {
"name": "OutputParameter", "name": "OutputParameter",
"superClass": [ "InputOutputParameter" ] "superClass": ["InputOutputParameter"]
}, },
{ {
"name": "Collectable", "name": "Collectable",
"isAbstract": true, "isAbstract": true,
"extends": [ "bpmn:MultiInstanceLoopCharacteristics" ], "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
"superClass": [ "activiti:AsyncCapable" ], "superClass": ["activiti:AsyncCapable"],
"properties": [ "properties": [
{ {
"name": "collection", "name": "collection",
@ -795,12 +728,9 @@
}, },
{ {
"name": "FailedJobRetryTimeCycle", "name": "FailedJobRetryTimeCycle",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["activiti:AsyncCapable", "bpmn:MultiInstanceLoopCharacteristics"]
"activiti:AsyncCapable",
"bpmn:MultiInstanceLoopCharacteristics"
]
}, },
"properties": [ "properties": [
{ {
@ -812,7 +742,7 @@
}, },
{ {
"name": "ExecutionListener", "name": "ExecutionListener",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": [
"bpmn:Task", "bpmn:Task",
@ -871,11 +801,9 @@
}, },
{ {
"name": "TaskListener", "name": "TaskListener",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:UserTask"]
"bpmn:UserTask"
]
}, },
"properties": [ "properties": [
{ {
@ -911,12 +839,9 @@
}, },
{ {
"name": "FormProperty", "name": "FormProperty",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:StartEvent", "bpmn:UserTask"]
"bpmn:StartEvent",
"bpmn:UserTask"
]
}, },
"properties": [ "properties": [
{ {
@ -978,7 +903,7 @@
}, },
{ {
"name": "FormProperty", "name": "FormProperty",
"superClass": [ "Element" ], "superClass": ["Element"],
"properties": [ "properties": [
{ {
"name": "id", "name": "id",
@ -1022,7 +947,7 @@
}, },
{ {
"name": "Validation", "name": "Validation",
"superClass": [ "Element" ], "superClass": ["Element"],
"properties": [ "properties": [
{ {
"name": "constraints", "name": "constraints",
@ -1033,7 +958,7 @@
}, },
{ {
"name": "Constraint", "name": "Constraint",
"superClass": [ "Element" ], "superClass": ["Element"],
"properties": [ "properties": [
{ {
"name": "name", "name": "name",
@ -1050,9 +975,7 @@
{ {
"name": "ConditionalEventDefinition", "name": "ConditionalEventDefinition",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:ConditionalEventDefinition"],
"bpmn:ConditionalEventDefinition"
],
"properties": [ "properties": [
{ {
"name": "variableName", "name": "variableName",
@ -1067,5 +990,5 @@
] ]
} }
], ],
"emumerations": [ ] "emumerations": []
} }

View File

@ -10,9 +10,7 @@
{ {
"name": "Definitions", "name": "Definitions",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Definitions"],
"bpmn:Definitions"
],
"properties": [ "properties": [
{ {
"name": "diagramRelationId", "name": "diagramRelationId",
@ -23,9 +21,7 @@
}, },
{ {
"name": "InOutBinding", "name": "InOutBinding",
"superClass": [ "superClass": ["Element"],
"Element"
],
"isAbstract": true, "isAbstract": true,
"properties": [ "properties": [
{ {
@ -63,35 +59,22 @@
}, },
{ {
"name": "In", "name": "In",
"superClass": [ "superClass": ["InOutBinding"],
"InOutBinding"
],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:CallActivity", "bpmn:SignalEventDefinition"]
"bpmn:CallActivity",
"bpmn:SignalEventDefinition"
]
} }
}, },
{ {
"name": "Out", "name": "Out",
"superClass": [ "superClass": ["InOutBinding"],
"InOutBinding"
],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:CallActivity"]
"bpmn:CallActivity"
]
} }
}, },
{ {
"name": "AsyncCapable", "name": "AsyncCapable",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Activity", "bpmn:Gateway", "bpmn:Event"],
"bpmn:Activity",
"bpmn:Gateway",
"bpmn:Event"
],
"properties": [ "properties": [
{ {
"name": "async", "name": "async",
@ -122,10 +105,7 @@
{ {
"name": "JobPriorized", "name": "JobPriorized",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Process", "camunda:AsyncCapable"],
"bpmn:Process",
"camunda:AsyncCapable"
],
"properties": [ "properties": [
{ {
"name": "jobPriority", "name": "jobPriority",
@ -137,9 +117,7 @@
{ {
"name": "SignalEventDefinition", "name": "SignalEventDefinition",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:SignalEventDefinition"],
"bpmn:SignalEventDefinition"
],
"properties": [ "properties": [
{ {
"name": "async", "name": "async",
@ -152,9 +130,7 @@
{ {
"name": "ErrorEventDefinition", "name": "ErrorEventDefinition",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:ErrorEventDefinition"],
"bpmn:ErrorEventDefinition"
],
"properties": [ "properties": [
{ {
"name": "errorCodeVariable", "name": "errorCodeVariable",
@ -171,9 +147,7 @@
{ {
"name": "Error", "name": "Error",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Error"],
"bpmn:Error"
],
"properties": [ "properties": [
{ {
"name": "camunda:errorMessage", "name": "camunda:errorMessage",
@ -184,9 +158,7 @@
}, },
{ {
"name": "PotentialStarter", "name": "PotentialStarter",
"superClass": [ "superClass": ["Element"],
"Element"
],
"properties": [ "properties": [
{ {
"name": "resourceAssignmentExpression", "name": "resourceAssignmentExpression",
@ -197,10 +169,7 @@
{ {
"name": "FormSupported", "name": "FormSupported",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:StartEvent", "bpmn:UserTask"],
"bpmn:StartEvent",
"bpmn:UserTask"
],
"properties": [ "properties": [
{ {
"name": "formHandlerClass", "name": "formHandlerClass",
@ -217,10 +186,7 @@
{ {
"name": "TemplateSupported", "name": "TemplateSupported",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Process", "bpmn:FlowElement"],
"bpmn:Process",
"bpmn:FlowElement"
],
"properties": [ "properties": [
{ {
"name": "modelerTemplate", "name": "modelerTemplate",
@ -237,7 +203,7 @@
{ {
"name": "Initiator", "name": "Initiator",
"isAbstract": true, "isAbstract": true,
"extends": [ "bpmn:StartEvent" ], "extends": ["bpmn:StartEvent"],
"properties": [ "properties": [
{ {
"name": "initiator", "name": "initiator",
@ -249,9 +215,7 @@
{ {
"name": "ScriptTask", "name": "ScriptTask",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:ScriptTask"],
"bpmn:ScriptTask"
],
"properties": [ "properties": [
{ {
"name": "resultVariable", "name": "resultVariable",
@ -268,9 +232,7 @@
{ {
"name": "Process", "name": "Process",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:Process"],
"bpmn:Process"
],
"properties": [ "properties": [
{ {
"name": "candidateStarterGroups", "name": "candidateStarterGroups",
@ -303,9 +265,7 @@
{ {
"name": "EscalationEventDefinition", "name": "EscalationEventDefinition",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:EscalationEventDefinition"],
"bpmn:EscalationEventDefinition"
],
"properties": [ "properties": [
{ {
"name": "escalationCodeVariable", "name": "escalationCodeVariable",
@ -317,9 +277,7 @@
{ {
"name": "FormalExpression", "name": "FormalExpression",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:FormalExpression"],
"bpmn:FormalExpression"
],
"properties": [ "properties": [
{ {
"name": "resource", "name": "resource",
@ -330,7 +288,7 @@
}, },
{ {
"name": "Assignable", "name": "Assignable",
"extends": [ "bpmn:UserTask" ], "extends": ["bpmn:UserTask"],
"properties": [ "properties": [
{ {
"name": "assignee", "name": "assignee",
@ -366,7 +324,7 @@
}, },
{ {
"name": "CallActivity", "name": "CallActivity",
"extends": [ "bpmn:CallActivity" ], "extends": ["bpmn:CallActivity"],
"properties": [ "properties": [
{ {
"name": "calledElementBinding", "name": "calledElementBinding",
@ -455,9 +413,7 @@
}, },
{ {
"name": "DmnCapable", "name": "DmnCapable",
"extends": [ "extends": ["bpmn:BusinessRuleTask"],
"bpmn:BusinessRuleTask"
],
"properties": [ "properties": [
{ {
"name": "decisionRef", "name": "decisionRef",
@ -490,9 +446,7 @@
}, },
{ {
"name": "ExternalCapable", "name": "ExternalCapable",
"extends": [ "extends": ["camunda:ServiceTaskLike"],
"camunda:ServiceTaskLike"
],
"properties": [ "properties": [
{ {
"name": "type", "name": "type",
@ -508,10 +462,7 @@
}, },
{ {
"name": "TaskPriorized", "name": "TaskPriorized",
"extends": [ "extends": ["bpmn:Process", "camunda:ExternalCapable"],
"bpmn:Process",
"camunda:ExternalCapable"
],
"properties": [ "properties": [
{ {
"name": "taskPriority", "name": "taskPriority",
@ -522,11 +473,9 @@
}, },
{ {
"name": "Properties", "name": "Properties",
"superClass": [ "superClass": ["Element"],
"Element"
],
"meta": { "meta": {
"allowedIn": [ "*" ] "allowedIn": ["*"]
}, },
"properties": [ "properties": [
{ {
@ -538,9 +487,7 @@
}, },
{ {
"name": "Property", "name": "Property",
"superClass": [ "superClass": ["Element"],
"Element"
],
"properties": [ "properties": [
{ {
"name": "id", "name": "id",
@ -561,13 +508,9 @@
}, },
{ {
"name": "Connector", "name": "Connector",
"superClass": [ "superClass": ["Element"],
"Element"
],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["camunda:ServiceTaskLike"]
"camunda:ServiceTaskLike"
]
}, },
"properties": [ "properties": [
{ {
@ -582,14 +525,9 @@
}, },
{ {
"name": "InputOutput", "name": "InputOutput",
"superClass": [ "superClass": ["Element"],
"Element"
],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:FlowNode", "camunda:Connector"]
"bpmn:FlowNode",
"camunda:Connector"
]
}, },
"properties": [ "properties": [
{ {
@ -637,7 +575,7 @@
}, },
{ {
"name": "List", "name": "List",
"superClass": [ "InputOutputParameterDefinition" ], "superClass": ["InputOutputParameterDefinition"],
"properties": [ "properties": [
{ {
"name": "items", "name": "items",
@ -648,7 +586,7 @@
}, },
{ {
"name": "Map", "name": "Map",
"superClass": [ "InputOutputParameterDefinition" ], "superClass": ["InputOutputParameterDefinition"],
"properties": [ "properties": [
{ {
"name": "entries", "name": "entries",
@ -678,9 +616,7 @@
}, },
{ {
"name": "Value", "name": "Value",
"superClass": [ "superClass": ["InputOutputParameterDefinition"],
"InputOutputParameterDefinition"
],
"properties": [ "properties": [
{ {
"name": "id", "name": "id",
@ -701,7 +637,7 @@
}, },
{ {
"name": "Script", "name": "Script",
"superClass": [ "InputOutputParameterDefinition" ], "superClass": ["InputOutputParameterDefinition"],
"properties": [ "properties": [
{ {
"name": "scriptFormat", "name": "scriptFormat",
@ -722,7 +658,7 @@
}, },
{ {
"name": "Field", "name": "Field",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": [
"camunda:ServiceTaskLike", "camunda:ServiceTaskLike",
@ -753,17 +689,17 @@
}, },
{ {
"name": "InputParameter", "name": "InputParameter",
"superClass": [ "InputOutputParameter" ] "superClass": ["InputOutputParameter"]
}, },
{ {
"name": "OutputParameter", "name": "OutputParameter",
"superClass": [ "InputOutputParameter" ] "superClass": ["InputOutputParameter"]
}, },
{ {
"name": "Collectable", "name": "Collectable",
"isAbstract": true, "isAbstract": true,
"extends": [ "bpmn:MultiInstanceLoopCharacteristics" ], "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
"superClass": [ "camunda:AsyncCapable" ], "superClass": ["camunda:AsyncCapable"],
"properties": [ "properties": [
{ {
"name": "collection", "name": "collection",
@ -779,12 +715,9 @@
}, },
{ {
"name": "FailedJobRetryTimeCycle", "name": "FailedJobRetryTimeCycle",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["camunda:AsyncCapable", "bpmn:MultiInstanceLoopCharacteristics"]
"camunda:AsyncCapable",
"bpmn:MultiInstanceLoopCharacteristics"
]
}, },
"properties": [ "properties": [
{ {
@ -796,7 +729,7 @@
}, },
{ {
"name": "ExecutionListener", "name": "ExecutionListener",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": [
"bpmn:Task", "bpmn:Task",
@ -855,11 +788,9 @@
}, },
{ {
"name": "TaskListener", "name": "TaskListener",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:UserTask"]
"bpmn:UserTask"
]
}, },
"properties": [ "properties": [
{ {
@ -905,12 +836,9 @@
}, },
{ {
"name": "FormProperty", "name": "FormProperty",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:StartEvent", "bpmn:UserTask"]
"bpmn:StartEvent",
"bpmn:UserTask"
]
}, },
"properties": [ "properties": [
{ {
@ -972,12 +900,9 @@
}, },
{ {
"name": "FormData", "name": "FormData",
"superClass": [ "Element" ], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["bpmn:StartEvent", "bpmn:UserTask"]
"bpmn:StartEvent",
"bpmn:UserTask"
]
}, },
"properties": [ "properties": [
{ {
@ -994,7 +919,7 @@
}, },
{ {
"name": "FormField", "name": "FormField",
"superClass": [ "Element" ], "superClass": ["Element"],
"properties": [ "properties": [
{ {
"name": "id", "name": "id",
@ -1038,7 +963,7 @@
}, },
{ {
"name": "Validation", "name": "Validation",
"superClass": [ "Element" ], "superClass": ["Element"],
"properties": [ "properties": [
{ {
"name": "constraints", "name": "constraints",
@ -1049,7 +974,7 @@
}, },
{ {
"name": "Constraint", "name": "Constraint",
"superClass": [ "Element" ], "superClass": ["Element"],
"properties": [ "properties": [
{ {
"name": "name", "name": "name",
@ -1066,9 +991,7 @@
{ {
"name": "ConditionalEventDefinition", "name": "ConditionalEventDefinition",
"isAbstract": true, "isAbstract": true,
"extends": [ "extends": ["bpmn:ConditionalEventDefinition"],
"bpmn:ConditionalEventDefinition"
],
"properties": [ "properties": [
{ {
"name": "variableName", "name": "variableName",
@ -1083,5 +1006,5 @@
] ]
} }
], ],
"emumerations": [ ] "emumerations": []
} }

View File

@ -875,10 +875,7 @@
"name": "FailedJobRetryTimeCycle", "name": "FailedJobRetryTimeCycle",
"superClass": ["Element"], "superClass": ["Element"],
"meta": { "meta": {
"allowedIn": [ "allowedIn": ["flowable:AsyncCapable", "bpmn:MultiInstanceLoopCharacteristics"]
"flowable:AsyncCapable",
"bpmn:MultiInstanceLoopCharacteristics"
]
}, },
"properties": [ "properties": [
{ {

View File

@ -1,4 +1,4 @@
"use strict" 'use strict'
import { some } from 'min-dash' import { some } from 'min-dash'
@ -6,20 +6,25 @@ import { some } from 'min-dash'
// const some = some // const some = some
const ALLOWED_TYPES = { const ALLOWED_TYPES = {
FailedJobRetryTimeCycle: ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity'], FailedJobRetryTimeCycle: [
'bpmn:StartEvent',
'bpmn:BoundaryEvent',
'bpmn:IntermediateCatchEvent',
'bpmn:Activity'
],
Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'], Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'],
Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'] Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent']
} }
function is (element, type) { function is(element, type) {
return element && typeof element.$instanceOf === "function" && element.$instanceOf(type) return element && typeof element.$instanceOf === 'function' && element.$instanceOf(type)
} }
function exists (element) { function exists(element) {
return element && element.length return element && element.length
} }
function includesType (collection, type) { function includesType(collection, type) {
return ( return (
exists(collection) && exists(collection) &&
some(collection, function (element) { some(collection, function (element) {
@ -28,22 +33,22 @@ function includesType (collection, type) {
) )
} }
function anyType (element, types) { function anyType(element, types) {
return some(types, function (type) { return some(types, function (type) {
return is(element, type) return is(element, type)
}) })
} }
function isAllowed (propName, propDescriptor, newElement) { function isAllowed(propName, propDescriptor, newElement) {
const name = propDescriptor.name, const name = propDescriptor.name,
types = ALLOWED_TYPES[name.replace(/activiti:/, '')] types = ALLOWED_TYPES[name.replace(/activiti:/, '')]
return name === propName && anyType(newElement, types) return name === propName && anyType(newElement, types)
} }
function ActivitiModdleExtension (eventBus) { function ActivitiModdleExtension(eventBus) {
eventBus.on( eventBus.on(
"property.clone", 'property.clone',
function (context) { function (context) {
const newElement = context.newElement, const newElement = context.newElement,
propDescriptor = context.propertyDescriptor propDescriptor = context.propertyDescriptor
@ -54,26 +59,25 @@ function ActivitiModdleExtension (eventBus) {
) )
} }
ActivitiModdleExtension.$inject = ["eventBus"] ActivitiModdleExtension.$inject = ['eventBus']
ActivitiModdleExtension.prototype.canCloneProperty = function (newElement, propDescriptor) { ActivitiModdleExtension.prototype.canCloneProperty = function (newElement, propDescriptor) {
if (isAllowed("activiti:FailedJobRetryTimeCycle", propDescriptor, newElement)) { if (isAllowed('activiti:FailedJobRetryTimeCycle', propDescriptor, newElement)) {
return ( return (
includesType(newElement.eventDefinitions, "bpmn:TimerEventDefinition") || includesType(newElement.eventDefinitions, 'bpmn:TimerEventDefinition') ||
includesType(newElement.eventDefinitions, "bpmn:SignalEventDefinition") || includesType(newElement.eventDefinitions, 'bpmn:SignalEventDefinition') ||
is(newElement.loopCharacteristics, "bpmn:MultiInstanceLoopCharacteristics") is(newElement.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')
) )
} }
if (isAllowed("activiti:Connector", propDescriptor, newElement)) { if (isAllowed('activiti:Connector', propDescriptor, newElement)) {
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition") return includesType(newElement.eventDefinitions, 'bpmn:MessageEventDefinition')
} }
if (isAllowed("activiti:Field", propDescriptor, newElement)) { if (isAllowed('activiti:Field', propDescriptor, newElement)) {
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition") return includesType(newElement.eventDefinitions, 'bpmn:MessageEventDefinition')
} }
} }
// module.exports = ActivitiModdleExtension; // module.exports = ActivitiModdleExtension;
export default ActivitiModdleExtension export default ActivitiModdleExtension

View File

@ -3,9 +3,9 @@
* address https://github.com/igdianov/activiti-bpmn-moddle * address https://github.com/igdianov/activiti-bpmn-moddle
* */ * */
import activitiExtension from "./activitiExtension" import activitiExtension from './activitiExtension'
export default { export default {
__init__: ["ActivitiModdleExtension"], __init__: ['ActivitiModdleExtension'],
ActivitiModdleExtension: ["type", activitiExtension] ActivitiModdleExtension: ['type', activitiExtension]
} }

View File

@ -1,11 +1,6 @@
"use strict" 'use strict'
import { isFunction, isObject, some } from 'min-dash'
import {
isFunction,
isObject,
some
} from 'min-dash'
// const isFunction = isFunction, // const isFunction = isFunction,
// isObject = isObject, // isObject = isObject,
@ -16,10 +11,11 @@ import {
const WILDCARD = '*' const WILDCARD = '*'
function CamundaModdleExtension (eventBus) { function CamundaModdleExtension(eventBus) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this const self = this
eventBus.on("moddleCopy.canCopyProperty", function (context) { eventBus.on('moddleCopy.canCopyProperty', function (context) {
const property = context.property, const property = context.property,
parent = context.parent parent = context.parent
@ -27,7 +23,7 @@ function CamundaModdleExtension (eventBus) {
}) })
} }
CamundaModdleExtension.$inject = ["eventBus"] CamundaModdleExtension.$inject = ['eventBus']
/** /**
* Check wether to disallow copying property. * Check wether to disallow copying property.
@ -40,15 +36,15 @@ CamundaModdleExtension.prototype.canCopyProperty = function (property, parent) {
// (2) check more complex scenarios // (2) check more complex scenarios
if (is(property, "camunda:InputOutput") && !this.canHostInputOutput(parent)) { if (is(property, 'camunda:InputOutput') && !this.canHostInputOutput(parent)) {
return false return false
} }
if (isAny(property, ["camunda:Connector", "camunda:Field"]) && !this.canHostConnector(parent)) { if (isAny(property, ['camunda:Connector', 'camunda:Field']) && !this.canHostConnector(parent)) {
return false return false
} }
if (is(property, "camunda:In") && !this.canHostIn(parent)) { if (is(property, 'camunda:In') && !this.canHostIn(parent)) {
return false return false
} }
} }
@ -68,21 +64,19 @@ CamundaModdleExtension.prototype.canHostInputOutput = function (parent) {
return false return false
} }
if (isAny(flowNode, ["bpmn:StartEvent", "bpmn:Gateway", "bpmn:BoundaryEvent"])) { if (isAny(flowNode, ['bpmn:StartEvent', 'bpmn:Gateway', 'bpmn:BoundaryEvent'])) {
return false return false
} }
return !(is(flowNode, "bpmn:SubProcess") && flowNode.get("triggeredByEvent")) return !(is(flowNode, 'bpmn:SubProcess') && flowNode.get('triggeredByEvent'))
} }
CamundaModdleExtension.prototype.canHostConnector = function (parent) { CamundaModdleExtension.prototype.canHostConnector = function (parent) {
const serviceTaskLike = getParent(parent, 'camunda:ServiceTaskLike') const serviceTaskLike = getParent(parent, 'camunda:ServiceTaskLike')
if (is(serviceTaskLike, "bpmn:MessageEventDefinition")) { if (is(serviceTaskLike, 'bpmn:MessageEventDefinition')) {
// only allow on throw and end events // only allow on throw and end events
return getParent(parent, "bpmn:IntermediateThrowEvent") || getParent(parent, "bpmn:EndEvent") return getParent(parent, 'bpmn:IntermediateThrowEvent') || getParent(parent, 'bpmn:EndEvent')
} }
return true return true
@ -99,7 +93,7 @@ CamundaModdleExtension.prototype.canHostIn = function (parent) {
if (signalEventDefinition) { if (signalEventDefinition) {
// only allow on throw and end events // only allow on throw and end events
return getParent(parent, "bpmn:IntermediateThrowEvent") || getParent(parent, "bpmn:EndEvent") return getParent(parent, 'bpmn:IntermediateThrowEvent') || getParent(parent, 'bpmn:EndEvent')
} }
return true return true
@ -110,17 +104,17 @@ export default CamundaModdleExtension
// helpers ////////// // helpers //////////
function is (element, type) { function is(element, type) {
return element && isFunction(element.$instanceOf) && element.$instanceOf(type) return element && isFunction(element.$instanceOf) && element.$instanceOf(type)
} }
function isAny (element, types) { function isAny(element, types) {
return some(types, function (t) { return some(types, function (t) {
return is(element, t) return is(element, t)
}) })
} }
function getParent (element, type) { function getParent(element, type) {
if (!type) { if (!type) {
return element.$parent return element.$parent
} }
@ -136,7 +130,7 @@ function getParent (element, type) {
return getParent(element.$parent, type) return getParent(element.$parent, type)
} }
function isAllowedInParent (property, parent) { function isAllowedInParent(property, parent) {
// (1) find property descriptor // (1) find property descriptor
const descriptor = property.$type && property.$model.getTypeDescriptor(property.$type) const descriptor = property.$type && property.$model.getTypeDescriptor(property.$type)
@ -152,6 +146,6 @@ function isAllowedInParent (property, parent) {
}) })
} }
function isWildcard (allowedIn) { function isWildcard(allowedIn) {
return allowedIn.indexOf(WILDCARD) !== -1 return allowedIn.indexOf(WILDCARD) !== -1
} }

View File

@ -1,8 +1,8 @@
"use strict" 'use strict'
import extension from "./extension" import extension from './extension'
export default { export default {
__init__: ["camundaModdleExtension"], __init__: ['camundaModdleExtension'],
camundaModdleExtension: ["type", extension] camundaModdleExtension: ['type', extension]
} }

View File

@ -1,27 +1,30 @@
"use strict" 'use strict'
import { some } from 'min-dash' import { some } from 'min-dash'
// const some = some // const some = some
// const some = require('min-dash').some // const some = require('min-dash').some
const ALLOWED_TYPES = { const ALLOWED_TYPES = {
FailedJobRetryTimeCycle: ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity'], FailedJobRetryTimeCycle: [
'bpmn:StartEvent',
'bpmn:BoundaryEvent',
'bpmn:IntermediateCatchEvent',
'bpmn:Activity'
],
Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'], Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'],
Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'] Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent']
} }
function is (element, type) { function is(element, type) {
return element && typeof element.$instanceOf === "function" && element.$instanceOf(type) return element && typeof element.$instanceOf === 'function' && element.$instanceOf(type)
} }
function exists (element) { function exists(element) {
return element && element.length return element && element.length
} }
function includesType (collection, type) { function includesType(collection, type) {
return ( return (
exists(collection) && exists(collection) &&
some(collection, function (element) { some(collection, function (element) {
@ -30,22 +33,22 @@ function includesType (collection, type) {
) )
} }
function anyType (element, types) { function anyType(element, types) {
return some(types, function (type) { return some(types, function (type) {
return is(element, type) return is(element, type)
}) })
} }
function isAllowed (propName, propDescriptor, newElement) { function isAllowed(propName, propDescriptor, newElement) {
const name = propDescriptor.name, const name = propDescriptor.name,
types = ALLOWED_TYPES[name.replace(/flowable:/, '')] types = ALLOWED_TYPES[name.replace(/flowable:/, '')]
return name === propName && anyType(newElement, types) return name === propName && anyType(newElement, types)
} }
function FlowableModdleExtension (eventBus) { function FlowableModdleExtension(eventBus) {
eventBus.on( eventBus.on(
"property.clone", 'property.clone',
function (context) { function (context) {
const newElement = context.newElement, const newElement = context.newElement,
propDescriptor = context.propertyDescriptor propDescriptor = context.propertyDescriptor
@ -56,23 +59,23 @@ function FlowableModdleExtension (eventBus) {
) )
} }
FlowableModdleExtension.$inject = ["eventBus"] FlowableModdleExtension.$inject = ['eventBus']
FlowableModdleExtension.prototype.canCloneProperty = function (newElement, propDescriptor) { FlowableModdleExtension.prototype.canCloneProperty = function (newElement, propDescriptor) {
if (isAllowed("flowable:FailedJobRetryTimeCycle", propDescriptor, newElement)) { if (isAllowed('flowable:FailedJobRetryTimeCycle', propDescriptor, newElement)) {
return ( return (
includesType(newElement.eventDefinitions, "bpmn:TimerEventDefinition") || includesType(newElement.eventDefinitions, 'bpmn:TimerEventDefinition') ||
includesType(newElement.eventDefinitions, "bpmn:SignalEventDefinition") || includesType(newElement.eventDefinitions, 'bpmn:SignalEventDefinition') ||
is(newElement.loopCharacteristics, "bpmn:MultiInstanceLoopCharacteristics") is(newElement.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')
) )
} }
if (isAllowed("flowable:Connector", propDescriptor, newElement)) { if (isAllowed('flowable:Connector', propDescriptor, newElement)) {
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition") return includesType(newElement.eventDefinitions, 'bpmn:MessageEventDefinition')
} }
if (isAllowed("flowable:Field", propDescriptor, newElement)) { if (isAllowed('flowable:Field', propDescriptor, newElement)) {
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition") return includesType(newElement.eventDefinitions, 'bpmn:MessageEventDefinition')
} }
} }

View File

@ -2,9 +2,9 @@
* @author igdianov * @author igdianov
* address https://github.com/igdianov/activiti-bpmn-moddle * address https://github.com/igdianov/activiti-bpmn-moddle
* */ * */
import flowableExtension from "./flowableExtension" import flowableExtension from './flowableExtension'
export default { export default {
__init__: ["FlowableModdleExtension"], __init__: ['FlowableModdleExtension'],
FlowableModdleExtension: ["type", flowableExtension] FlowableModdleExtension: ['type', flowableExtension]
} }

View File

@ -1,11 +1,31 @@
import PaletteProvider from 'bpmn-js/lib/features/palette/PaletteProvider' import PaletteProvider from 'bpmn-js/lib/features/palette/PaletteProvider'
import { assign } from "min-dash" import { assign } from 'min-dash'
export default function CustomPalette (palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) { export default function CustomPalette(
PaletteProvider.call(this, palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate, 2000) palette,
create,
elementFactory,
spaceTool,
lassoTool,
handTool,
globalConnect,
translate
) {
PaletteProvider.call(
this,
palette,
create,
elementFactory,
spaceTool,
lassoTool,
handTool,
globalConnect,
translate,
2000
)
} }
const F = function () { } // 核心,利用空对象作为中介; const F = function () {} // 核心,利用空对象作为中介;
F.prototype = PaletteProvider.prototype // 核心将父类的原型赋值给空对象F F.prototype = PaletteProvider.prototype // 核心将父类的原型赋值给空对象F
// 利用中介函数重写原型链方法 // 利用中介函数重写原型链方法
@ -19,8 +39,8 @@ F.prototype.getPaletteEntries = function () {
globalConnect = this._globalConnect, globalConnect = this._globalConnect,
translate = this._translate translate = this._translate
function createAction (type, group, className, title, options) { function createAction(type, group, className, title, options) {
function createListener (event) { function createListener(event) {
const shape = elementFactory.createShape(assign({ type: type }, options)) const shape = elementFactory.createShape(assign({ type: type }, options))
if (options) { if (options) {
@ -35,7 +55,7 @@ F.prototype.getPaletteEntries = function () {
return { return {
group: group, group: group,
className: className, className: className,
title: title || translate("Create {type}", { type: shortType }), title: title || translate('Create {type}', { type: shortType }),
action: { action: {
dragstart: createListener, dragstart: createListener,
click: createListener click: createListener
@ -43,7 +63,7 @@ F.prototype.getPaletteEntries = function () {
} }
} }
function createSubprocess (event) { function createSubprocess(event) {
const subProcess = elementFactory.createShape({ const subProcess = elementFactory.createShape({
type: 'bpmn:SubProcess', type: 'bpmn:SubProcess',
x: 0, x: 0,
@ -65,14 +85,14 @@ F.prototype.getPaletteEntries = function () {
}) })
} }
function createParticipant (event) { function createParticipant(event) {
create.start(event, elementFactory.createParticipantShape()) create.start(event, elementFactory.createParticipantShape())
} }
assign(actions, { assign(actions, {
"hand-tool": { 'hand-tool': {
group: "tools", group: 'tools',
className: "bpmn-icon-hand-tool", className: 'bpmn-icon-hand-tool',
title: '激活抓手工具', title: '激活抓手工具',
// title: translate("Activate the hand tool"), // title: translate("Activate the hand tool"),
action: { action: {
@ -81,77 +101,121 @@ F.prototype.getPaletteEntries = function () {
} }
} }
}, },
"lasso-tool": { 'lasso-tool': {
group: "tools", group: 'tools',
className: "bpmn-icon-lasso-tool", className: 'bpmn-icon-lasso-tool',
title: translate("Activate the lasso tool"), title: translate('Activate the lasso tool'),
action: { action: {
click: function (event) { click: function (event) {
lassoTool.activateSelection(event) lassoTool.activateSelection(event)
} }
} }
}, },
"space-tool": { 'space-tool': {
group: "tools", group: 'tools',
className: "bpmn-icon-space-tool", className: 'bpmn-icon-space-tool',
title: translate("Activate the create/remove space tool"), title: translate('Activate the create/remove space tool'),
action: { action: {
click: function (event) { click: function (event) {
spaceTool.activateSelection(event) spaceTool.activateSelection(event)
} }
} }
}, },
"global-connect-tool": { 'global-connect-tool': {
group: "tools", group: 'tools',
className: "bpmn-icon-connection-multi", className: 'bpmn-icon-connection-multi',
title: translate("Activate the global connect tool"), title: translate('Activate the global connect tool'),
action: { action: {
click: function (event) { click: function (event) {
globalConnect.toggle(event) globalConnect.toggle(event)
} }
} }
}, },
"tool-separator": { 'tool-separator': {
group: "tools", group: 'tools',
separator: true separator: true
}, },
"create.start-event": createAction("bpmn:StartEvent", "event", "bpmn-icon-start-event-none", translate("Create StartEvent")), 'create.start-event': createAction(
"create.intermediate-event": createAction( 'bpmn:StartEvent',
"bpmn:IntermediateThrowEvent", 'event',
"event", 'bpmn-icon-start-event-none',
"bpmn-icon-intermediate-event-none", translate('Create StartEvent')
translate("Create Intermediate/Boundary Event")
), ),
"create.end-event": createAction("bpmn:EndEvent", "event", "bpmn-icon-end-event-none", translate("Create EndEvent")), 'create.intermediate-event': createAction(
"create.exclusive-gateway": createAction("bpmn:ExclusiveGateway", "gateway", "bpmn-icon-gateway-none", translate("Create Gateway")), 'bpmn:IntermediateThrowEvent',
"create.user-task": createAction("bpmn:UserTask", "activity", "bpmn-icon-user-task", translate("Create User Task")), 'event',
"create.data-object": createAction("bpmn:DataObjectReference", "data-object", "bpmn-icon-data-object", translate("Create DataObjectReference")), 'bpmn-icon-intermediate-event-none',
"create.data-store": createAction("bpmn:DataStoreReference", "data-store", "bpmn-icon-data-store", translate("Create DataStoreReference")), translate('Create Intermediate/Boundary Event')
"create.subprocess-expanded": { ),
group: "activity", 'create.end-event': createAction(
className: "bpmn-icon-subprocess-expanded", 'bpmn:EndEvent',
title: translate("Create expanded SubProcess"), 'event',
'bpmn-icon-end-event-none',
translate('Create EndEvent')
),
'create.exclusive-gateway': createAction(
'bpmn:ExclusiveGateway',
'gateway',
'bpmn-icon-gateway-none',
translate('Create Gateway')
),
'create.user-task': createAction(
'bpmn:UserTask',
'activity',
'bpmn-icon-user-task',
translate('Create User Task')
),
'create.data-object': createAction(
'bpmn:DataObjectReference',
'data-object',
'bpmn-icon-data-object',
translate('Create DataObjectReference')
),
'create.data-store': createAction(
'bpmn:DataStoreReference',
'data-store',
'bpmn-icon-data-store',
translate('Create DataStoreReference')
),
'create.subprocess-expanded': {
group: 'activity',
className: 'bpmn-icon-subprocess-expanded',
title: translate('Create expanded SubProcess'),
action: { action: {
dragstart: createSubprocess, dragstart: createSubprocess,
click: createSubprocess click: createSubprocess
} }
}, },
"create.participant-expanded": { 'create.participant-expanded': {
group: "collaboration", group: 'collaboration',
className: "bpmn-icon-participant", className: 'bpmn-icon-participant',
title: translate("Create Pool/Participant"), title: translate('Create Pool/Participant'),
action: { action: {
dragstart: createParticipant, dragstart: createParticipant,
click: createParticipant click: createParticipant
} }
}, },
"create.group": createAction("bpmn:Group", "artifact", "bpmn-icon-group", translate("Create Group")) 'create.group': createAction(
'bpmn:Group',
'artifact',
'bpmn-icon-group',
translate('Create Group')
)
}) })
return actions return actions
} }
CustomPalette.$inject = ["palette", "create", "elementFactory", "spaceTool", "lassoTool", "handTool", "globalConnect", "translate"] CustomPalette.$inject = [
'palette',
'create',
'elementFactory',
'spaceTool',
'lassoTool',
'handTool',
'globalConnect',
'translate'
]
CustomPalette.prototype = new F() // 核心,将 F的实例赋值给子类 CustomPalette.prototype = new F() // 核心,将 F的实例赋值给子类
CustomPalette.prototype.constructor = CustomPalette // 修复子类CustomPalette的构造器指向防止原型链的混乱 CustomPalette.prototype.constructor = CustomPalette // 修复子类CustomPalette的构造器指向防止原型链的混乱

View File

@ -14,9 +14,9 @@
// paletteProvider: ["type", PaletteProvider] // paletteProvider: ["type", PaletteProvider]
// }; // };
import CustomPalette from "./CustomPalette"; import CustomPalette from './CustomPalette'
export default { export default {
__init__: ["paletteProvider"], __init__: ['paletteProvider'],
paletteProvider: ["type", CustomPalette] paletteProvider: ['type', CustomPalette]
}; }

View File

@ -1,9 +1,18 @@
import { assign } from "min-dash" import { assign } from 'min-dash'
/** /**
* A palette provider for BPMN 2.0 elements. * A palette provider for BPMN 2.0 elements.
*/ */
export default function PaletteProvider (palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) { export default function PaletteProvider(
palette,
create,
elementFactory,
spaceTool,
lassoTool,
handTool,
globalConnect,
translate
) {
this._palette = palette this._palette = palette
this._create = create this._create = create
this._elementFactory = elementFactory this._elementFactory = elementFactory
@ -16,7 +25,16 @@ export default function PaletteProvider (palette, create, elementFactory, spaceT
palette.registerProvider(this) palette.registerProvider(this)
} }
PaletteProvider.$inject = ["palette", "create", "elementFactory", "spaceTool", "lassoTool", "handTool", "globalConnect", "translate"] PaletteProvider.$inject = [
'palette',
'create',
'elementFactory',
'spaceTool',
'lassoTool',
'handTool',
'globalConnect',
'translate'
]
PaletteProvider.prototype.getPaletteEntries = function () { PaletteProvider.prototype.getPaletteEntries = function () {
const actions = {}, const actions = {},
@ -28,8 +46,8 @@ PaletteProvider.prototype.getPaletteEntries = function () {
globalConnect = this._globalConnect, globalConnect = this._globalConnect,
translate = this._translate translate = this._translate
function createAction (type, group, className, title, options) { function createAction(type, group, className, title, options) {
function createListener (event) { function createListener(event) {
const shape = elementFactory.createShape(assign({ type: type }, options)) const shape = elementFactory.createShape(assign({ type: type }, options))
if (options) { if (options) {
@ -44,7 +62,7 @@ PaletteProvider.prototype.getPaletteEntries = function () {
return { return {
group: group, group: group,
className: className, className: className,
title: title || translate("Create {type}", { type: shortType }), title: title || translate('Create {type}', { type: shortType }),
action: { action: {
dragstart: createListener, dragstart: createListener,
click: createListener click: createListener
@ -52,7 +70,7 @@ PaletteProvider.prototype.getPaletteEntries = function () {
} }
} }
function createSubprocess (event) { function createSubprocess(event) {
const subProcess = elementFactory.createShape({ const subProcess = elementFactory.createShape({
type: 'bpmn:SubProcess', type: 'bpmn:SubProcess',
x: 0, x: 0,
@ -74,86 +92,121 @@ PaletteProvider.prototype.getPaletteEntries = function () {
}) })
} }
function createParticipant (event) { function createParticipant(event) {
create.start(event, elementFactory.createParticipantShape()) create.start(event, elementFactory.createParticipantShape())
} }
assign(actions, { assign(actions, {
"hand-tool": { 'hand-tool': {
group: "tools", group: 'tools',
className: "bpmn-icon-hand-tool", className: 'bpmn-icon-hand-tool',
title: translate("Activate the hand tool"), title: translate('Activate the hand tool'),
action: { action: {
click: function (event) { click: function (event) {
handTool.activateHand(event) handTool.activateHand(event)
} }
} }
}, },
"lasso-tool": { 'lasso-tool': {
group: "tools", group: 'tools',
className: "bpmn-icon-lasso-tool", className: 'bpmn-icon-lasso-tool',
title: translate("Activate the lasso tool"), title: translate('Activate the lasso tool'),
action: { action: {
click: function (event) { click: function (event) {
lassoTool.activateSelection(event) lassoTool.activateSelection(event)
} }
} }
}, },
"space-tool": { 'space-tool': {
group: "tools", group: 'tools',
className: "bpmn-icon-space-tool", className: 'bpmn-icon-space-tool',
title: translate("Activate the create/remove space tool"), title: translate('Activate the create/remove space tool'),
action: { action: {
click: function (event) { click: function (event) {
spaceTool.activateSelection(event) spaceTool.activateSelection(event)
} }
} }
}, },
"global-connect-tool": { 'global-connect-tool': {
group: "tools", group: 'tools',
className: "bpmn-icon-connection-multi", className: 'bpmn-icon-connection-multi',
title: translate("Activate the global connect tool"), title: translate('Activate the global connect tool'),
action: { action: {
click: function (event) { click: function (event) {
globalConnect.toggle(event) globalConnect.toggle(event)
} }
} }
}, },
"tool-separator": { 'tool-separator': {
group: "tools", group: 'tools',
separator: true separator: true
}, },
"create.start-event": createAction("bpmn:StartEvent", "event", "bpmn-icon-start-event-none", translate("Create StartEvent")), 'create.start-event': createAction(
"create.intermediate-event": createAction( 'bpmn:StartEvent',
"bpmn:IntermediateThrowEvent", 'event',
"event", 'bpmn-icon-start-event-none',
"bpmn-icon-intermediate-event-none", translate('Create StartEvent')
translate("Create Intermediate/Boundary Event")
), ),
"create.end-event": createAction("bpmn:EndEvent", "event", "bpmn-icon-end-event-none", translate("Create EndEvent")), 'create.intermediate-event': createAction(
"create.exclusive-gateway": createAction("bpmn:ExclusiveGateway", "gateway", "bpmn-icon-gateway-none", translate("Create Gateway")), 'bpmn:IntermediateThrowEvent',
"create.user-task": createAction("bpmn:UserTask", "activity", "bpmn-icon-user-task", translate("Create User Task")), 'event',
"create.data-object": createAction("bpmn:DataObjectReference", "data-object", "bpmn-icon-data-object", translate("Create DataObjectReference")), 'bpmn-icon-intermediate-event-none',
"create.data-store": createAction("bpmn:DataStoreReference", "data-store", "bpmn-icon-data-store", translate("Create DataStoreReference")), translate('Create Intermediate/Boundary Event')
"create.subprocess-expanded": { ),
group: "activity", 'create.end-event': createAction(
className: "bpmn-icon-subprocess-expanded", 'bpmn:EndEvent',
title: translate("Create expanded SubProcess"), 'event',
'bpmn-icon-end-event-none',
translate('Create EndEvent')
),
'create.exclusive-gateway': createAction(
'bpmn:ExclusiveGateway',
'gateway',
'bpmn-icon-gateway-none',
translate('Create Gateway')
),
'create.user-task': createAction(
'bpmn:UserTask',
'activity',
'bpmn-icon-user-task',
translate('Create User Task')
),
'create.data-object': createAction(
'bpmn:DataObjectReference',
'data-object',
'bpmn-icon-data-object',
translate('Create DataObjectReference')
),
'create.data-store': createAction(
'bpmn:DataStoreReference',
'data-store',
'bpmn-icon-data-store',
translate('Create DataStoreReference')
),
'create.subprocess-expanded': {
group: 'activity',
className: 'bpmn-icon-subprocess-expanded',
title: translate('Create expanded SubProcess'),
action: { action: {
dragstart: createSubprocess, dragstart: createSubprocess,
click: createSubprocess click: createSubprocess
} }
}, },
"create.participant-expanded": { 'create.participant-expanded': {
group: "collaboration", group: 'collaboration',
className: "bpmn-icon-participant", className: 'bpmn-icon-participant',
title: translate("Create Pool/Participant"), title: translate('Create Pool/Participant'),
action: { action: {
dragstart: createParticipant, dragstart: createParticipant,
click: createParticipant click: createParticipant
} }
}, },
"create.group": createAction("bpmn:Group", "artifact", "bpmn-icon-group", translate("Create Group")) 'create.group': createAction(
'bpmn:Group',
'artifact',
'bpmn-icon-group',
translate('Create Group')
)
}) })
return actions return actions

View File

@ -22,20 +22,23 @@
// } // }
export default function customTranslate(translations) { export default function customTranslate(translations) {
return function(template, replacements) { return function (template, replacements) {
replacements = replacements || {}; replacements = replacements || {}
// Translate // Translate
template = translations[template] || template; template = translations[template] || template
// Replace // Replace
return template.replace(/{([^}]+)}/g, function(_, key) { return template.replace(/{([^}]+)}/g, function (_, key) {
let str = replacements[key]; let str = replacements[key]
if (translations[replacements[key]] !== null && translations[replacements[key]] !== undefined) { if (
translations[replacements[key]] !== null &&
translations[replacements[key]] !== undefined
) {
// eslint-disable-next-line no-mixed-spaces-and-tabs // eslint-disable-next-line no-mixed-spaces-and-tabs
str = translations[replacements[key]]; str = translations[replacements[key]]
// eslint-disable-next-line no-mixed-spaces-and-tabs // eslint-disable-next-line no-mixed-spaces-and-tabs
} }
return str || "{" + key + "}"; return str || '{' + key + '}'
}); })
}; }
} }

View File

@ -6,233 +6,235 @@
*/ */
export default { export default {
// 添加部分 // 添加部分
"Append EndEvent": "追加结束事件", 'Append EndEvent': '追加结束事件',
"Append Gateway": "追加网关", 'Append Gateway': '追加网关',
"Append Task": "追加任务", 'Append Task': '追加任务',
"Append Intermediate/Boundary Event": "追加中间抛出事件/边界事件", 'Append Intermediate/Boundary Event': '追加中间抛出事件/边界事件',
"Activate the global connect tool": "激活全局连接工具", 'Activate the global connect tool': '激活全局连接工具',
"Append {type}": "添加 {type}", 'Append {type}': '添加 {type}',
"Add Lane above": "在上面添加道", 'Add Lane above': '在上面添加道',
"Divide into two Lanes": "分割成两个道", 'Divide into two Lanes': '分割成两个道',
"Divide into three Lanes": "分割成三个道", 'Divide into three Lanes': '分割成三个道',
"Add Lane below": "在下面添加道", 'Add Lane below': '在下面添加道',
"Append compensation activity": "追加补偿活动", 'Append compensation activity': '追加补偿活动',
"Change type": "修改类型", 'Change type': '修改类型',
"Connect using Association": "使用关联连接", 'Connect using Association': '使用关联连接',
"Connect using Sequence/MessageFlow or Association": "使用顺序/消息流或者关联连接", 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
"Connect using DataInputAssociation": "使用数据输入关联连接", 'Connect using DataInputAssociation': '使用数据输入关联连接',
Remove: "移除", Remove: '移除',
"Activate the hand tool": "激活抓手工具", 'Activate the hand tool': '激活抓手工具',
"Activate the lasso tool": "激活套索工具", 'Activate the lasso tool': '激活套索工具',
"Activate the create/remove space tool": "激活创建/删除空间工具", 'Activate the create/remove space tool': '激活创建/删除空间工具',
"Create expanded SubProcess": "创建扩展子过程", 'Create expanded SubProcess': '创建扩展子过程',
"Create IntermediateThrowEvent/BoundaryEvent": "创建中间抛出事件/边界事件", 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
"Create Pool/Participant": "创建池/参与者", 'Create Pool/Participant': '创建池/参与者',
"Parallel Multi Instance": "并行多重事件", 'Parallel Multi Instance': '并行多重事件',
"Sequential Multi Instance": "时序多重事件", 'Sequential Multi Instance': '时序多重事件',
DataObjectReference: "数据对象参考", DataObjectReference: '数据对象参考',
DataStoreReference: "数据存储参考", DataStoreReference: '数据存储参考',
Loop: "循环", Loop: '循环',
"Ad-hoc": "即席", 'Ad-hoc': '即席',
"Create {type}": "创建 {type}", 'Create {type}': '创建 {type}',
Task: "任务", Task: '任务',
"Send Task": "发送任务", 'Send Task': '发送任务',
"Receive Task": "接收任务", 'Receive Task': '接收任务',
"User Task": "用户任务", 'User Task': '用户任务',
"Manual Task": "手工任务", 'Manual Task': '手工任务',
"Business Rule Task": "业务规则任务", 'Business Rule Task': '业务规则任务',
"Service Task": "服务任务", 'Service Task': '服务任务',
"Script Task": "脚本任务", 'Script Task': '脚本任务',
"Call Activity": "调用活动", 'Call Activity': '调用活动',
"Sub Process (collapsed)": "子流程(折叠的)", 'Sub Process (collapsed)': '子流程(折叠的)',
"Sub Process (expanded)": "子流程(展开的)", 'Sub Process (expanded)': '子流程(展开的)',
"Start Event": "开始事件", 'Start Event': '开始事件',
StartEvent: "开始事件", StartEvent: '开始事件',
"Intermediate Throw Event": "中间事件", 'Intermediate Throw Event': '中间事件',
"End Event": "结束事件", 'End Event': '结束事件',
EndEvent: "结束事件", EndEvent: '结束事件',
"Create StartEvent": "创建开始事件", 'Create StartEvent': '创建开始事件',
"Create EndEvent": "创建结束事件", 'Create EndEvent': '创建结束事件',
"Create Task": "创建任务", 'Create Task': '创建任务',
"Create User Task": "创建用户任务", 'Create User Task': '创建用户任务',
"Create Gateway": "创建网关", 'Create Gateway': '创建网关',
"Create DataObjectReference": "创建数据对象", 'Create DataObjectReference': '创建数据对象',
"Create DataStoreReference": "创建数据存储", 'Create DataStoreReference': '创建数据存储',
"Create Group": "创建分组", 'Create Group': '创建分组',
"Create Intermediate/Boundary Event": "创建中间/边界事件", 'Create Intermediate/Boundary Event': '创建中间/边界事件',
"Message Start Event": "消息开始事件", 'Message Start Event': '消息开始事件',
"Timer Start Event": "定时开始事件", 'Timer Start Event': '定时开始事件',
"Conditional Start Event": "条件开始事件", 'Conditional Start Event': '条件开始事件',
"Signal Start Event": "信号开始事件", 'Signal Start Event': '信号开始事件',
"Error Start Event": "错误开始事件", 'Error Start Event': '错误开始事件',
"Escalation Start Event": "升级开始事件", 'Escalation Start Event': '升级开始事件',
"Compensation Start Event": "补偿开始事件", 'Compensation Start Event': '补偿开始事件',
"Message Start Event (non-interrupting)": "消息开始事件(非中断)", 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
"Timer Start Event (non-interrupting)": "定时开始事件(非中断)", 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
"Conditional Start Event (non-interrupting)": "条件开始事件(非中断)", 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
"Signal Start Event (non-interrupting)": "信号开始事件(非中断)", 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
"Escalation Start Event (non-interrupting)": "升级开始事件(非中断)", 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
"Message Intermediate Catch Event": "消息中间捕获事件", 'Message Intermediate Catch Event': '消息中间捕获事件',
"Message Intermediate Throw Event": "消息中间抛出事件", 'Message Intermediate Throw Event': '消息中间抛出事件',
"Timer Intermediate Catch Event": "定时中间捕获事件", 'Timer Intermediate Catch Event': '定时中间捕获事件',
"Escalation Intermediate Throw Event": "升级中间抛出事件", 'Escalation Intermediate Throw Event': '升级中间抛出事件',
"Conditional Intermediate Catch Event": "条件中间捕获事件", 'Conditional Intermediate Catch Event': '条件中间捕获事件',
"Link Intermediate Catch Event": "链接中间捕获事件", 'Link Intermediate Catch Event': '链接中间捕获事件',
"Link Intermediate Throw Event": "链接中间抛出事件", 'Link Intermediate Throw Event': '链接中间抛出事件',
"Compensation Intermediate Throw Event": "补偿中间抛出事件", 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
"Signal Intermediate Catch Event": "信号中间捕获事件", 'Signal Intermediate Catch Event': '信号中间捕获事件',
"Signal Intermediate Throw Event": "信号中间抛出事件", 'Signal Intermediate Throw Event': '信号中间抛出事件',
"Message End Event": "消息结束事件", 'Message End Event': '消息结束事件',
"Escalation End Event": "定时结束事件", 'Escalation End Event': '定时结束事件',
"Error End Event": "错误结束事件", 'Error End Event': '错误结束事件',
"Cancel End Event": "取消结束事件", 'Cancel End Event': '取消结束事件',
"Compensation End Event": "补偿结束事件", 'Compensation End Event': '补偿结束事件',
"Signal End Event": "信号结束事件", 'Signal End Event': '信号结束事件',
"Terminate End Event": "终止结束事件", 'Terminate End Event': '终止结束事件',
"Message Boundary Event": "消息边界事件", 'Message Boundary Event': '消息边界事件',
"Message Boundary Event (non-interrupting)": "消息边界事件(非中断)", 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
"Timer Boundary Event": "定时边界事件", 'Timer Boundary Event': '定时边界事件',
"Timer Boundary Event (non-interrupting)": "定时边界事件(非中断)", 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
"Escalation Boundary Event": "升级边界事件", 'Escalation Boundary Event': '升级边界事件',
"Escalation Boundary Event (non-interrupting)": "升级边界事件(非中断)", 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
"Conditional Boundary Event": "条件边界事件", 'Conditional Boundary Event': '条件边界事件',
"Conditional Boundary Event (non-interrupting)": "条件边界事件(非中断)", 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
"Error Boundary Event": "错误边界事件", 'Error Boundary Event': '错误边界事件',
"Cancel Boundary Event": "取消边界事件", 'Cancel Boundary Event': '取消边界事件',
"Signal Boundary Event": "信号边界事件", 'Signal Boundary Event': '信号边界事件',
"Signal Boundary Event (non-interrupting)": "信号边界事件(非中断)", 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
"Compensation Boundary Event": "补偿边界事件", 'Compensation Boundary Event': '补偿边界事件',
"Exclusive Gateway": "互斥网关", 'Exclusive Gateway': '互斥网关',
"Parallel Gateway": "并行网关", 'Parallel Gateway': '并行网关',
"Inclusive Gateway": "相容网关", 'Inclusive Gateway': '相容网关',
"Complex Gateway": "复杂网关", 'Complex Gateway': '复杂网关',
"Event based Gateway": "事件网关", 'Event based Gateway': '事件网关',
Transaction: "转运", Transaction: '转运',
"Sub Process": "子流程", 'Sub Process': '子流程',
"Event Sub Process": "事件子流程", 'Event Sub Process': '事件子流程',
"Collapsed Pool": "折叠池", 'Collapsed Pool': '折叠池',
"Expanded Pool": "展开池", 'Expanded Pool': '展开池',
// Errors // Errors
"no parent for {element} in {parent}": "在{parent}里,{element}没有父类", 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
"no shape type specified": "没有指定的形状类型", 'no shape type specified': '没有指定的形状类型',
"flow elements must be children of pools/participants": "流元素必须是池/参与者的子类", 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
"out of bounds release": "out of bounds release", 'out of bounds release': 'out of bounds release',
"more than {count} child lanes": "子道大于{count} ", 'more than {count} child lanes': '子道大于{count} ',
"element required": "元素不能为空", 'element required': '元素不能为空',
"diagram not part of bpmn:Definitions": "流程图不符合bpmn规范", 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
"no diagram to display": "没有可展示的流程图", 'no diagram to display': '没有可展示的流程图',
"no process or collaboration to display": "没有可展示的流程/协作", 'no process or collaboration to display': '没有可展示的流程/协作',
"element {element} referenced by {referenced}#{property} not yet drawn": "由{referenced}#{property}引用的{element}元素仍未绘制", 'element {element} referenced by {referenced}#{property} not yet drawn':
"already rendered {element}": "{element} 已被渲染", '由{referenced}#{property}引用的{element}元素仍未绘制',
"failed to import {element}": "导入{element}失败", 'already rendered {element}': '{element} 已被渲染',
'failed to import {element}': '导入{element}失败',
//属性面板的参数 //属性面板的参数
Id: "编号", Id: '编号',
Name: "名称", Name: '名称',
General: "常规", General: '常规',
Details: "详情", Details: '详情',
"Message Name": "消息名称", 'Message Name': '消息名称',
Message: "消息", Message: '消息',
Initiator: "创建者", Initiator: '创建者',
"Asynchronous Continuations": "持续异步", 'Asynchronous Continuations': '持续异步',
"Asynchronous Before": "异步前", 'Asynchronous Before': '异步前',
"Asynchronous After": "异步后", 'Asynchronous After': '异步后',
"Job Configuration": "工作配置", 'Job Configuration': '工作配置',
Exclusive: "排除", Exclusive: '排除',
"Job Priority": "工作优先级", 'Job Priority': '工作优先级',
"Retry Time Cycle": "重试时间周期", 'Retry Time Cycle': '重试时间周期',
Documentation: "文档", Documentation: '文档',
"Element Documentation": "元素文档", 'Element Documentation': '元素文档',
"History Configuration": "历史配置", 'History Configuration': '历史配置',
"History Time To Live": "历史的生存时间", 'History Time To Live': '历史的生存时间',
Forms: "表单", Forms: '表单',
"Form Key": "表单key", 'Form Key': '表单key',
"Form Fields": "表单字段", 'Form Fields': '表单字段',
"Business Key": "业务key", 'Business Key': '业务key',
"Form Field": "表单字段", 'Form Field': '表单字段',
ID: "编号", ID: '编号',
Type: "类型", Type: '类型',
Label: "名称", Label: '名称',
"Default Value": "默认值", 'Default Value': '默认值',
"Default Flow": "默认流转路径", 'Default Flow': '默认流转路径',
"Conditional Flow": "条件流转路径", 'Conditional Flow': '条件流转路径',
"Sequence Flow": "普通流转路径", 'Sequence Flow': '普通流转路径',
Validation: "校验", Validation: '校验',
"Add Constraint": "添加约束", 'Add Constraint': '添加约束',
Config: "配置", Config: '配置',
Properties: "属性", Properties: '属性',
"Add Property": "添加属性", 'Add Property': '添加属性',
Value: "值", Value: '值',
Listeners: "监听器", Listeners: '监听器',
"Execution Listener": "执行监听", 'Execution Listener': '执行监听',
"Event Type": "事件类型", 'Event Type': '事件类型',
"Listener Type": "监听器类型", 'Listener Type': '监听器类型',
"Java Class": "Java类", 'Java Class': 'Java类',
Expression: "表达式", Expression: '表达式',
"Must provide a value": "必须提供一个值", 'Must provide a value': '必须提供一个值',
"Delegate Expression": "代理表达式", 'Delegate Expression': '代理表达式',
Script: "脚本", Script: '脚本',
"Script Format": "脚本格式", 'Script Format': '脚本格式',
"Script Type": "脚本类型", 'Script Type': '脚本类型',
"Inline Script": "内联脚本", 'Inline Script': '内联脚本',
"External Script": "外部脚本", 'External Script': '外部脚本',
Resource: "资源", Resource: '资源',
"Field Injection": "字段注入", 'Field Injection': '字段注入',
Extensions: "扩展", Extensions: '扩展',
"Input/Output": "输入/输出", 'Input/Output': '输入/输出',
"Input Parameters": "输入参数", 'Input Parameters': '输入参数',
"Output Parameters": "输出参数", 'Output Parameters': '输出参数',
Parameters: "参数", Parameters: '参数',
"Output Parameter": "输出参数", 'Output Parameter': '输出参数',
"Timer Definition Type": "定时器定义类型", 'Timer Definition Type': '定时器定义类型',
"Timer Definition": "定时器定义", 'Timer Definition': '定时器定义',
Date: "日期", Date: '日期',
Duration: "持续", Duration: '持续',
Cycle: "循环", Cycle: '循环',
Signal: "信号", Signal: '信号',
"Signal Name": "信号名称", 'Signal Name': '信号名称',
Escalation: "升级", Escalation: '升级',
Error: "错误", Error: '错误',
"Link Name": "链接名称", 'Link Name': '链接名称',
Condition: "条件名称", Condition: '条件名称',
"Variable Name": "变量名称", 'Variable Name': '变量名称',
"Variable Event": "变量事件", 'Variable Event': '变量事件',
"Specify more than one variable change event as a comma separated list.": "多个变量事件以逗号隔开", 'Specify more than one variable change event as a comma separated list.':
"Wait for Completion": "等待完成", '多个变量事件以逗号隔开',
"Activity Ref": "活动参考", 'Wait for Completion': '等待完成',
"Version Tag": "版本标签", 'Activity Ref': '活动参考',
Executable: "可执行文件", 'Version Tag': '版本标签',
"External Task Configuration": "扩展任务配置", Executable: '可执行文件',
"Task Priority": "任务优先级", 'External Task Configuration': '扩展任务配置',
External: "外部", 'Task Priority': '任务优先级',
Connector: "连接器", External: '外部',
"Must configure Connector": "必须配置连接器", Connector: '连接器',
"Connector Id": "连接器编号", 'Must configure Connector': '必须配置连接器',
Implementation: "实现方式", 'Connector Id': '连接器编号',
"Field Injections": "字段注入", Implementation: '实现方式',
Fields: "字段", 'Field Injections': '字段注入',
"Result Variable": "结果变量", Fields: '字段',
Topic: "主题", 'Result Variable': '结果变量',
"Configure Connector": "配置连接器", Topic: '主题',
"Input Parameter": "输入参数", 'Configure Connector': '配置连接器',
Assignee: "代理人", 'Input Parameter': '输入参数',
"Candidate Users": "候选用户", Assignee: '代理人',
"Candidate Groups": "候选组", 'Candidate Users': '候选用户',
"Due Date": "到期时间", 'Candidate Groups': '候选组',
"Follow Up Date": "跟踪日期", 'Due Date': '到期时间',
Priority: "优先级", 'Follow Up Date': '跟踪日期',
"The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)": Priority: '优先级',
"跟踪日期必须符合EL表达式 ${someDate} ,或者一个ISO标准日期2015-06-26T09:54:00", 'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)':
"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',
"跟踪日期必须符合EL表达式 ${someDate} ,或者一个ISO标准日期2015-06-26T09:54:00", 'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)':
Variables: "变量", '跟踪日期必须符合EL表达式 ${someDate} ,或者一个ISO标准日期2015-06-26T09:54:00',
"Candidate Starter Configuration": "候选人起动器配置", Variables: '变量',
"Candidate Starter Groups": "候选人起动器组", 'Candidate Starter Configuration': '候选人起动器配置',
"This maps to the process definition key.": "这映射到流程定义键。", 'Candidate Starter Groups': '候选人起动器组',
"Candidate Starter Users": "候选人起动器的用户", 'This maps to the process definition key.': '这映射到流程定义键。',
"Specify more than one user as a comma separated list.": "指定多个用户作为逗号分隔的列表。", 'Candidate Starter Users': '候选人起动器的用户',
"Tasklist Configuration": "Tasklist配置", 'Specify more than one user as a comma separated list.': '指定多个用户作为逗号分隔的列表。',
Startable: "启动", 'Tasklist Configuration': 'Tasklist配置',
"Specify more than one group as a comma separated list.": "指定多个组作为逗号分隔的列表。" Startable: '启动',
}; 'Specify more than one group as a comma separated list.': '指定多个组作为逗号分隔的列表。'
}

View File

@ -73,8 +73,6 @@ import ElementListeners from './listeners/ElementListeners.vue'
import ElementProperties from './properties/ElementProperties.vue' import ElementProperties from './properties/ElementProperties.vue'
// import ElementForm from './form/ElementForm.vue' // import ElementForm from './form/ElementForm.vue'
import UserTaskListeners from './listeners/UserTaskListeners.vue' import UserTaskListeners from './listeners/UserTaskListeners.vue'
import { provide, ref, watch, onBeforeUnmount, onMounted } from 'vue'
import { ElCollapse, ElCollapseItem, ElLink } from 'element-plus'
/** /**
* 侧边栏 * 侧边栏
* @Author MiyueFE * @Author MiyueFE
@ -82,7 +80,10 @@ import { ElCollapse, ElCollapseItem, ElLink } from 'element-plus'
* @Date 2021年3月31日18:57:51 * @Date 2021年3月31日18:57:51
*/ */
const props = defineProps({ const props = defineProps({
bpmnModeler: Object, bpmnModeler: {
type: Object,
default: () => {}
},
prefix: { prefix: {
type: String, type: String,
default: 'camunda' default: 'camunda'
@ -101,7 +102,7 @@ const props = defineProps({
const activeTab = ref('base') const activeTab = ref('base')
const elementId = ref('') const elementId = ref('')
const elementType = ref('') const elementType = ref('')
const elementBusinessObject = ref({}) // businessObject 使 const elementBusinessObject = ref<any>({}) // businessObject 使
const conditionFormVisible = ref(false) // const conditionFormVisible = ref(false) //
const formVisible = ref(false) // const formVisible = ref(false) //
const bpmnElement = ref() const bpmnElement = ref()

View File

@ -38,15 +38,19 @@
</div> </div>
</template> </template>
<script setup lang="ts" name="ElementBaseInfo"> <script setup lang="ts" name="ElementBaseInfo">
import { ref, reactive, watch, onMounted, onBeforeUnmount, toRaw } from 'vue'
import { ElLink, ElForm, ElFormItem, ElInput } from 'element-plus'
const props = defineProps({ const props = defineProps({
businessObject: Object, businessObject: {
model: Object // type: Object,
default: () => {}
},
model: {
type: Object,
default: () => {}
}
}) })
const needProps = ref({}) const needProps = ref<any>({})
const bpmnElement = ref() const bpmnElement = ref()
const elementBaseInfo = ref({}) const elementBaseInfo = ref<any>({})
// //
// const forms = ref([]) // const forms = ref([])
// //

View File

@ -63,14 +63,11 @@
</template> </template>
<script setup lang="ts" name="FlowCondition"> <script setup lang="ts" name="FlowCondition">
import { ref, nextTick, watch, onBeforeUnmount, toRaw } from 'vue'
import { ElSelect, ElForm, ElFormItem, ElInput, ElOption } from 'element-plus'
const props = defineProps({ const props = defineProps({
businessObject: Object, businessObject: Object,
type: String type: String
}) })
const flowConditionForm = ref({}) const flowConditionForm = ref<any>({})
const bpmnElement = ref() const bpmnElement = ref()
const bpmnElementSource = ref() const bpmnElementSource = ref()
const bpmnElementSourceRef = ref() const bpmnElementSourceRef = ref()

View File

@ -205,20 +205,6 @@
</template> </template>
<script setup lang="ts" name="ElementForm"> <script setup lang="ts" name="ElementForm">
import { ref, inject, watch, nextTick, toRaw } from 'vue'
import {
ElDialog,
ElForm,
ElFormItem,
ElSelect,
ElOption,
ElDivider,
ElTable,
ElTableColumn,
ElButton,
ElDrawer,
ElInput
} from 'element-plus'
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String type: String
@ -229,8 +215,8 @@ const width = inject('width')
const formKey = ref('') const formKey = ref('')
const businessKey = ref('') const businessKey = ref('')
const optionModelTitle = ref('') const optionModelTitle = ref('')
const fieldList = ref([]) const fieldList = ref<any[]>([])
const formFieldForm = ref({}) const formFieldForm = ref<any>({})
const fieldType = ref({ const fieldType = ref({
long: '长整型', long: '长整型',
string: '字符串', string: '字符串',
@ -243,11 +229,11 @@ const formFieldIndex = ref(-1) // 编辑中的字段, -1 为新增
const formFieldOptionIndex = ref(-1) // -1 const formFieldOptionIndex = ref(-1) // -1
const fieldModelVisible = ref(false) const fieldModelVisible = ref(false)
const fieldOptionModelVisible = ref(false) const fieldOptionModelVisible = ref(false)
const fieldOptionForm = ref({}) // const fieldOptionForm = ref<any>({}) //
const fieldOptionType = ref('') // const fieldOptionType = ref('') //
const fieldEnumList = ref([]) // const fieldEnumList = ref<any[]>([]) //
const fieldConstraintsList = ref([]) // const fieldConstraintsList = ref<any[]>([]) //
const fieldPropertiesList = ref([]) // const fieldPropertiesList = ref<any[]>([]) //
const bpmnELement = ref() const bpmnELement = ref()
const elExtensionElements = ref() const elExtensionElements = ref()
const formData = ref() const formData = ref()

View File

@ -1,7 +1,7 @@
import MyPropertiesPanel from "./PropertiesPanel.vue"; import MyPropertiesPanel from './PropertiesPanel.vue'
MyPropertiesPanel.install = function(Vue) { MyPropertiesPanel.install = function (Vue) {
Vue.component(MyPropertiesPanel.name, MyPropertiesPanel); Vue.component(MyPropertiesPanel.name, MyPropertiesPanel)
}; }
export default MyPropertiesPanel; export default MyPropertiesPanel

View File

@ -15,11 +15,7 @@
>编辑</el-button >编辑</el-button
> >
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-button <el-button size="small" link style="color: #ff4d4f" @click="removeListener(scope.$index)"
size="small"
link
style="color: #ff4d4f"
@click="removeListener(scope.row, scope.$index)"
>移除</el-button >移除</el-button
> >
</template> </template>
@ -171,7 +167,7 @@
size="small" size="small"
link link
style="color: #ff4d4f" style="color: #ff4d4f"
@click="removeListenerField(scope.row, scope.$index)" @click="removeListenerField(scope.$index)"
>移除</el-button >移除</el-button
> >
</template> </template>
@ -268,11 +264,11 @@ const props = defineProps({
}) })
const prefix = inject('prefix') const prefix = inject('prefix')
const width = inject('width') const width = inject('width')
const elementListenersList = ref([]) // const elementListenersList = ref<any[]>([]) //
const listenerForm = ref({}) // const listenerForm = ref<any>({}) //
const listenerFormModelVisible = ref(false) // const listenerFormModelVisible = ref(false) //
const fieldsListOfListener = ref([]) const fieldsListOfListener = ref<any[]>([])
const listenerFieldForm = ref({}) // const listenerFieldForm = ref<any>({}) //
const listenerFieldFormModelVisible = ref(false) // const listenerFieldFormModelVisible = ref(false) //
const editingListenerIndex = ref(-1) // -1 const editingListenerIndex = ref(-1) // -1
const editingListenerFieldIndex = ref(-1) // -1 const editingListenerFieldIndex = ref(-1) // -1
@ -296,7 +292,7 @@ const resetListenersList = () => {
) )
} }
// //
const openListenerForm = (listener, index) => { const openListenerForm = (listener, index?) => {
if (listener) { if (listener) {
listenerForm.value = initListenerForm(listener) listenerForm.value = initListenerForm(listener)
editingListenerIndex.value = index editingListenerIndex.value = index
@ -322,7 +318,7 @@ const openListenerForm = (listener, index) => {
}) })
} }
// //
const openListenerFieldForm = (field, index) => { const openListenerFieldForm = (field, index?) => {
listenerFieldForm.value = field ? JSON.parse(JSON.stringify(field)) : {} listenerFieldForm.value = field ? JSON.parse(JSON.stringify(field)) : {}
editingListenerFieldIndex.value = field ? index : -1 editingListenerFieldIndex.value = field ? index : -1
listenerFieldFormModelVisible.value = true listenerFieldFormModelVisible.value = true

View File

@ -288,20 +288,7 @@
</div> </div>
</template> </template>
<script lang="ts" setup name="UserTaskListeners"> <script lang="ts" setup name="UserTaskListeners">
import { ref, inject, watch, nextTick } from 'vue' import { ElMessageBox } from 'element-plus'
import {
ElDialog,
ElForm,
ElFormItem,
ElSelect,
ElOption,
ElDivider,
ElTable,
ElTableColumn,
ElMessageBox,
ElButton,
ElDrawer
} from 'element-plus'
import { createListenerObject, updateElementExtensions } from '../../utils' import { createListenerObject, updateElementExtensions } from '../../utils'
import { initListenerForm, initListenerType, eventType, listenerType, fieldType } from './utilSelf' import { initListenerForm, initListenerType, eventType, listenerType, fieldType } from './utilSelf'
const props = defineProps({ const props = defineProps({
@ -310,17 +297,17 @@ const props = defineProps({
}) })
const prefix = inject('prefix') const prefix = inject('prefix')
const width = inject('width') const width = inject('width')
const elementListenersList = ref([]) const elementListenersList = ref<any[]>([])
const listenerEventTypeObject = ref(eventType) const listenerEventTypeObject = ref(eventType)
const listenerTypeObject = ref(listenerType) const listenerTypeObject = ref(listenerType)
const listenerFormModelVisible = ref(false) const listenerFormModelVisible = ref(false)
const listenerForm = ref({}) const listenerForm = ref<any>({})
const fieldTypeObject = ref(fieldType) const fieldTypeObject = ref(fieldType)
const fieldsListOfListener = ref([]) const fieldsListOfListener = ref<any[]>([])
const listenerFieldFormModelVisible = ref(false) // const listenerFieldFormModelVisible = ref(false) //
const editingListenerIndex = ref(-1) // -1 const editingListenerIndex = ref(-1) // -1
const editingListenerFieldIndex = ref(-1) // -1 const editingListenerFieldIndex = ref(-1) // -1
const listenerFieldForm = ref({}) // const listenerFieldForm = ref<any>({}) //
const bpmnElement = ref() const bpmnElement = ref()
const bpmnElementListeners = ref() const bpmnElementListeners = ref()
const otherExtensionList = ref() const otherExtensionList = ref()
@ -342,7 +329,7 @@ const resetListenersList = () => {
initListenerType(listener) initListenerType(listener)
) )
} }
const openListenerForm = (listener, index) => { const openListenerForm = (listener, index?) => {
if (listener) { if (listener) {
listenerForm.value = initListenerForm(listener) listenerForm.value = initListenerForm(listener)
editingListenerIndex.value = index editingListenerIndex.value = index
@ -366,7 +353,7 @@ const openListenerForm = (listener, index) => {
}) })
} }
// //
const removeListener = (listener, index) => { const removeListener = (listener, index?) => {
console.log(listener, 'listener') console.log(listener, 'listener')
ElMessageBox.confirm('确认移除该监听器吗?', '提示', { ElMessageBox.confirm('确认移除该监听器吗?', '提示', {
confirmButtonText: '确 认', confirmButtonText: '确 认',
@ -408,7 +395,7 @@ const saveListenerConfig = async () => {
listenerForm.value = {} listenerForm.value = {}
} }
// //
const openListenerFieldForm = (field, index) => { const openListenerFieldForm = (field, index?) => {
listenerFieldForm.value = field ? JSON.parse(JSON.stringify(field)) : {} listenerFieldForm.value = field ? JSON.parse(JSON.stringify(field)) : {}
editingListenerFieldIndex.value = field ? index : -1 editingListenerFieldIndex.value = field ? index : -1
listenerFieldFormModelVisible.value = true listenerFieldFormModelVisible.value = true

View File

@ -1,4 +1,4 @@
export const template = isTaskListener => { export const template = (isTaskListener) => {
return ` return `
<div class="panel-tab__content"> <div class="panel-tab__content">
<el-table :data="elementListenersList" size="small" border> <el-table :data="elementListenersList" size="small" border>
@ -97,20 +97,21 @@ export const template = isTaskListener => {
<el-input v-model="listenerForm.resource" clearable /> <el-input v-model="listenerForm.resource" clearable />
</el-form-item> </el-form-item>
</template> </template>
${isTaskListener ${
? "<el-form-item label='定时器类型' prop='eventDefinitionType' key='eventDefinitionType'>" + isTaskListener
"<el-select v-model='listenerForm.eventDefinitionType'>" + ? "<el-form-item label='定时器类型' prop='eventDefinitionType' key='eventDefinitionType'>" +
"<el-option label='日期' value='date' />" + "<el-select v-model='listenerForm.eventDefinitionType'>" +
"<el-option label='持续时长' value='duration' />" + "<el-option label='日期' value='date' />" +
"<el-option label='循环' value='cycle' />" + "<el-option label='持续时长' value='duration' />" +
"<el-option label='无' value='' />" + "<el-option label='循环' value='cycle' />" +
"</el-select>" + "<el-option label='无' value='' />" +
"</el-form-item>" + '</el-select>' +
"<el-form-item v-if='!!listenerForm.eventDefinitionType' label='定时器' prop='eventDefinitions' key='eventDefinitions'>" + '</el-form-item>' +
"<el-input v-model='listenerForm.eventDefinitions' clearable />" + "<el-form-item v-if='!!listenerForm.eventDefinitionType' label='定时器' prop='eventDefinitions' key='eventDefinitions'>" +
"</el-form-item>" "<el-input v-model='listenerForm.eventDefinitions' clearable />" +
: "" '</el-form-item>'
} : ''
}
</el-form> </el-form>
<el-divider /> <el-divider />
<p class="listener-filed__title"> <p class="listener-filed__title">

View File

@ -69,8 +69,6 @@
</template> </template>
<script setup lang="ts" name="ElementMultiInstance"> <script setup lang="ts" name="ElementMultiInstance">
import { inject, ref, onBeforeUnmount, watch, toRaw } from 'vue'
import { ElForm, ElFormItem, ElSelect, ElOption, ElCheckbox, ElInput } from 'element-plus'
const props = defineProps({ const props = defineProps({
businessObject: Object, businessObject: Object,
type: String type: String
@ -86,7 +84,7 @@ const defaultLoopInstanceForm = ref({
asyncBefore: false, asyncBefore: false,
exclusive: false exclusive: false
}) })
const loopInstanceForm = ref({}) const loopInstanceForm = ref<any>({})
const bpmnElement = ref(null) const bpmnElement = ref(null)
const multiLoopInstance = ref(null) const multiLoopInstance = ref(null)

View File

@ -17,8 +17,6 @@
</template> </template>
<script setup lang="ts" name="ElementOtherConfig"> <script setup lang="ts" name="ElementOtherConfig">
import { ref, watch, nextTick, onBeforeUnmount, toRaw } from 'vue'
import { ElInput } from 'element-plus'
const props = defineProps({ const props = defineProps({
id: String id: String
}) })

View File

@ -53,18 +53,7 @@
</template> </template>
<script setup lang="ts" name="ElementProperties"> <script setup lang="ts" name="ElementProperties">
import { ref, inject, nextTick, watch, toRaw } from 'vue' import { ElMessageBox } from 'element-plus'
import {
ElMessageBox,
ElDialog,
ElButton,
ElForm,
ElFormItem,
ElTable,
ElTableColumn,
ElDivider,
ElInput
} from 'element-plus'
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String type: String
@ -72,8 +61,8 @@ const props = defineProps({
const prefix = inject('prefix') const prefix = inject('prefix')
// const width = inject('width') // const width = inject('width')
const elementPropertyList = ref([]) const elementPropertyList = ref<any[]>([])
const propertyForm = ref({}) const propertyForm = ref<any>({})
const editingPropertyIndex = ref(-1) const editingPropertyIndex = ref(-1)
const propertyFormModelVisible = ref(false) const propertyFormModelVisible = ref(false)
const bpmnElement = ref() const bpmnElement = ref()

View File

@ -57,11 +57,11 @@ import {
ElInput ElInput
} from 'element-plus' } from 'element-plus'
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
const signalList = ref([]) const signalList = ref<any[]>([])
const messageList = ref([]) const messageList = ref<any[]>([])
const modelVisible = ref(false) const modelVisible = ref(false)
const modelType = ref('') const modelType = ref('')
const modelObjectForm = ref({}) const modelObjectForm = ref<any>({})
const rootElements = ref() const rootElements = ref()
const messageIdMap = ref() const messageIdMap = ref()
const signalIdMap = ref() const signalIdMap = ref()

View File

@ -21,8 +21,6 @@
</template> </template>
<script setup lang="ts" name="ElementTaskConfig"> <script setup lang="ts" name="ElementTaskConfig">
import { ref, watch } from 'vue'
import { ElForm, ElFormItem, ElCheckbox } from 'element-plus'
import UserTask from './task-components/UserTask.vue' import UserTask from './task-components/UserTask.vue'
import ScriptTask from './task-components/ScriptTask.vue' import ScriptTask from './task-components/ScriptTask.vue'
import ReceiveTask from './task-components/ReceiveTask.vue' import ReceiveTask from './task-components/ReceiveTask.vue'

View File

@ -49,19 +49,20 @@
</template> </template>
<script setup lang="ts" name="ReceiveTask"> <script setup lang="ts" name="ReceiveTask">
import { ref, watch, onBeforeUnmount, onMounted, nextTick, toRaw } from 'vue'
import { ElMessage, ElFormItem, ElDialog, ElForm, ElSelect, ElOption } from 'element-plus'
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String type: String
}) })
const message = useMessage()
const bindMessageId = ref('') const bindMessageId = ref('')
const newMessageForm = ref({}) const newMessageForm = ref<any>({})
const messageMap = ref({}) const messageMap = ref<any>({})
const messageModelVisible = ref(false) const messageModelVisible = ref(false)
const bpmnElement = ref() const bpmnElement = ref<any>()
const bpmnMessageRefsMap = ref() const bpmnMessageRefsMap = ref<any>()
const bpmnRootElements = ref() const bpmnRootElements = ref<any>()
const getBindMessage = () => { const getBindMessage = () => {
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = window.bpmnInstances.bpmnElement
@ -73,7 +74,7 @@ const openMessageModel = () => {
} }
const createNewMessage = () => { const createNewMessage = () => {
if (messageMap.value[newMessageForm.value.id]) { if (messageMap.value[newMessageForm.value.id]) {
ElMessage.error('该消息已存在请修改id后重新保存') message.error('该消息已存在请修改id后重新保存')
return return
} }
const newMessage = window.bpmnInstances.moddle.create('bpmn:Message', newMessageForm.value) const newMessage = window.bpmnInstances.moddle.create('bpmn:Message', newMessageForm.value)

View File

@ -57,7 +57,7 @@ const defaultTaskForm = ref({
resource: '', resource: '',
resultVariable: '' resultVariable: ''
}) })
const scriptTaskForm = ref({}) const scriptTaskForm = ref<any>({})
const bpmnElement = ref() const bpmnElement = ref()
const resetTaskForm = () => { const resetTaskForm = () => {

View File

@ -38,8 +38,6 @@
</template> </template>
<script setup lang="ts" name="UserTask"> <script setup lang="ts" name="UserTask">
import { ref, watch, nextTick, onBeforeUnmount, toRaw } from 'vue'
import { ElLink, ElFormItem, ElInput } from 'element-plus'
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String type: String
@ -52,7 +50,7 @@ const defaultTaskForm = ref({
followUpDate: '', followUpDate: '',
priority: '' priority: ''
}) })
const userTaskForm = ref({}) const userTaskForm = ref<any>({})
// const mockData=ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) // const mockData=ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
const bpmnElement = ref() const bpmnElement = ref()
const resetTaskForm = () => { const resetTaskForm = () => {

View File

@ -5,7 +5,7 @@ $--color-danger: #ff4d4f;
/* 改变 icon 字体路径变量,必需 */ /* 改变 icon 字体路径变量,必需 */
$--font-path: '~element-ui/lib/theme-chalk/fonts'; $--font-path: '~element-ui/lib/theme-chalk/fonts';
@import "~element-ui/packages/theme-chalk/src/index"; @import '~element-ui/packages/theme-chalk/src/index';
.el-table td, .el-table td,
.el-table th { .el-table th {
@ -20,7 +20,7 @@ $--font-path: '~element-ui/lib/theme-chalk/fonts';
box-sizing: border-box; box-sizing: border-box;
border-bottom: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;
} }
div[class^="el-drawer"]:focus, div[class^='el-drawer']:focus,
span:focus { span:focus {
outline: none; outline: none;
} }
@ -63,7 +63,7 @@ span:focus {
width: 100%; width: 100%;
} }
.el-divider:not(.el-divider--horizontal) { .el-divider:not(.el-divider--horizontal) {
margin: 0 8px ; margin: 0 8px;
} }
.el-divider.el-divider--horizontal { .el-divider.el-divider--horizontal {
margin: 16px 0; margin: 16px 0;

View File

@ -1,2 +1,2 @@
@import "./process-designer.scss"; @import './process-designer.scss';
@import "./process-panel.scss"; @import './process-panel.scss';

View File

@ -1,5 +1,5 @@
const hljs = require("highlight.js/lib/core"); const hljs = require('highlight.js/lib/core')
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml")); hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'))
hljs.registerLanguage("json", require("highlight.js/lib/languages/json")); hljs.registerLanguage('json', require('highlight.js/lib/languages/json'))
module.exports = hljs; module.exports = hljs

View File

@ -1,14 +1,14 @@
import BpmnRenderer from "bpmn-js/lib/draw/BpmnRenderer"; import BpmnRenderer from 'bpmn-js/lib/draw/BpmnRenderer'
export default function CustomRenderer(config, eventBus, styles, pathMap, canvas, textRenderer) { export default function CustomRenderer(config, eventBus, styles, pathMap, canvas, textRenderer) {
BpmnRenderer.call(this, config, eventBus, styles, pathMap, canvas, textRenderer, 2000); BpmnRenderer.call(this, config, eventBus, styles, pathMap, canvas, textRenderer, 2000)
this.handlers["label"] = function() { this.handlers['label'] = function () {
return null; return null
}; }
} }
const F = function() {}; // 核心,利用空对象作为中介; const F = function () {} // 核心,利用空对象作为中介;
F.prototype = BpmnRenderer.prototype; // 核心将父类的原型赋值给空对象F F.prototype = BpmnRenderer.prototype // 核心将父类的原型赋值给空对象F
CustomRenderer.prototype = new F(); // 核心,将 F的实例赋值给子类 CustomRenderer.prototype = new F() // 核心,将 F的实例赋值给子类
CustomRenderer.prototype.constructor = CustomRenderer; // 修复子类CustomRenderer的构造器指向防止原型链的混乱 CustomRenderer.prototype.constructor = CustomRenderer // 修复子类CustomRenderer的构造器指向防止原型链的混乱

View File

@ -1,6 +1,6 @@
import CustomRenderer from "./CustomRenderer"; import CustomRenderer from './CustomRenderer'
export default { export default {
__init__: ["customRenderer"], __init__: ['customRenderer'],
customRenderer: ["type", CustomRenderer] customRenderer: ['type', CustomRenderer]
}; }

View File

@ -1,16 +1,16 @@
import BpmnRules from "bpmn-js/lib/features/rules/BpmnRules"; import BpmnRules from 'bpmn-js/lib/features/rules/BpmnRules'
import inherits from "inherits"; import inherits from 'inherits'
export default function CustomRules(eventBus) { export default function CustomRules(eventBus) {
BpmnRules.call(this, eventBus); BpmnRules.call(this, eventBus)
} }
inherits(CustomRules, BpmnRules); inherits(CustomRules, BpmnRules)
CustomRules.prototype.canDrop = function() { CustomRules.prototype.canDrop = function () {
return false; return false
}; }
CustomRules.prototype.canMove = function() { CustomRules.prototype.canMove = function () {
return false; return false
}; }

View File

@ -1,6 +1,6 @@
import CustomRules from "./CustomRules"; import CustomRules from './CustomRules'
export default { export default {
__init__: ["customRules"], __init__: ['customRules'],
customRules: ["type", CustomRules] customRules: ['type', CustomRules]
}; }

View File

@ -1,39 +1,39 @@
//outside.js //outside.js
const ctx = "@@clickoutsideContext"; const ctx = '@@clickoutsideContext'
export default { export default {
bind(el, binding, vnode) { bind(el, binding, vnode) {
const ele = el; const ele = el
const documentHandler = e => { const documentHandler = (e) => {
if (!vnode.context || ele.contains(e.target)) { if (!vnode.context || ele.contains(e.target)) {
return false; return false
} }
// 调用指令回调 // 调用指令回调
if (binding.expression) { if (binding.expression) {
vnode.context[el[ctx].methodName](e); vnode.context[el[ctx].methodName](e)
} else { } else {
el[ctx].bindingFn(e); el[ctx].bindingFn(e)
} }
}; }
// 将方法添加到ele // 将方法添加到ele
ele[ctx] = { ele[ctx] = {
documentHandler, documentHandler,
methodName: binding.expression, methodName: binding.expression,
bindingFn: binding.value bindingFn: binding.value
}; }
setTimeout(() => { setTimeout(() => {
document.addEventListener("touchstart", documentHandler); // 为document绑定事件 document.addEventListener('touchstart', documentHandler) // 为document绑定事件
}); })
}, },
update(el, binding) { update(el, binding) {
const ele = el; const ele = el
ele[ctx].methodName = binding.expression; ele[ctx].methodName = binding.expression
ele[ctx].bindingFn = binding.value; ele[ctx].bindingFn = binding.value
}, },
unbind(el) { unbind(el) {
document.removeEventListener("touchstart", el[ctx].documentHandler); // 解绑 document.removeEventListener('touchstart', el[ctx].documentHandler) // 解绑
delete el[ctx]; delete el[ctx]
} }
}; }

View File

@ -1,10 +1,10 @@
export function debounce(fn, delay = 500) { export function debounce(fn, delay = 500) {
let timer; let timer
return function(...args) { return function (...args) {
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer)
timer = null; timer = null
} }
timer = setTimeout(fn.bind(this, ...args), delay); timer = setTimeout(fn.bind(this, ...args), delay)
}; }
} }

View File

@ -1,63 +0,0 @@
class Log {
static type = ["primary", "success", "warn", "error", "info"];
static typeColor(type = "default") {
let color = "";
switch (type) {
case "primary":
color = "#2d8cf0";
break;
case "success":
color = "#19be6b";
break;
case "info":
color = "#909399";
break;
case "warn":
color = "#ff9900";
break;
case "error":
color = "#f03f14";
break;
case "default":
color = "#35495E";
break;
default:
color = type;
break;
}
return color;
}
static print(text, type = "default", back = false) {
if (typeof text === "object") {
// 如果是對象則調用打印對象方式
console.dir(text);
return;
}
if (back) {
// 如果是打印帶背景圖的
console.log(`%c ${text} `, `background:${this.typeColor(type)}; padding: 2px; border-radius: 4px;color: #fff;`);
} else {
console.log(`%c ${text} `, `color: ${this.typeColor(type)};`);
}
}
static pretty(title, text, type = "primary") {
if (typeof text === "object") {
console.log(
`%c ${title} %c`,
`background:${this.typeColor(type)};border:1px solid ${this.typeColor(type)}; padding: 1px; border-radius: 4px 0 0 4px; color: #fff;`
);
console.dir(text);
return;
}
console.log(
`%c ${title} %c ${text} %c`,
`background:${this.typeColor(type)};border:1px solid ${this.typeColor(type)}; padding: 1px; border-radius: 4px 0 0 4px; color: #fff;`,
`border:1px solid ${this.typeColor(type)}; padding: 1px; border-radius: 0 4px 4px 0; color: ${this.typeColor(type)};`,
"background:transparent"
);
}
}
export default Log;

View File

@ -1,50 +1,50 @@
function xmlStr2XmlObj(xmlStr) { function xmlStr2XmlObj(xmlStr) {
let xmlObj = {}; let xmlObj = {}
if (document.all) { if (document.all) {
const xmlDom = new window.ActiveXObject("Microsoft.XMLDOM"); const xmlDom = new window.ActiveXObject('Microsoft.XMLDOM')
xmlDom.loadXML(xmlStr); xmlDom.loadXML(xmlStr)
xmlObj = xmlDom; xmlObj = xmlDom
} else { } else {
xmlObj = new DOMParser().parseFromString(xmlStr, "text/xml"); xmlObj = new DOMParser().parseFromString(xmlStr, 'text/xml')
} }
return xmlObj; return xmlObj
} }
function xml2json(xml) { function xml2json(xml) {
try { try {
let obj = {}; let obj = {}
if (xml.children.length > 0) { if (xml.children.length > 0) {
for (let i = 0; i < xml.children.length; i++) { for (let i = 0; i < xml.children.length; i++) {
const item = xml.children.item(i); const item = xml.children.item(i)
const nodeName = item.nodeName; const nodeName = item.nodeName
if (typeof obj[nodeName] == "undefined") { if (typeof obj[nodeName] == 'undefined') {
obj[nodeName] = xml2json(item); obj[nodeName] = xml2json(item)
} else { } else {
if (typeof obj[nodeName].push == "undefined") { if (typeof obj[nodeName].push == 'undefined') {
const old = obj[nodeName]; const old = obj[nodeName]
obj[nodeName] = []; obj[nodeName] = []
obj[nodeName].push(old); obj[nodeName].push(old)
} }
obj[nodeName].push(xml2json(item)); obj[nodeName].push(xml2json(item))
} }
} }
} else { } else {
obj = xml.textContent; obj = xml.textContent
} }
return obj; return obj
} catch (e) { } catch (e) {
console.log(e.message); console.log(e.message)
} }
} }
function xmlObj2json(xml) { function xmlObj2json(xml) {
const xmlObj = xmlStr2XmlObj(xml); const xmlObj = xmlStr2XmlObj(xml)
console.log(xmlObj); console.log(xmlObj)
let jsonObj = {}; let jsonObj = {}
if (xmlObj.childNodes.length > 0) { if (xmlObj.childNodes.length > 0) {
jsonObj = xml2json(xmlObj); jsonObj = xml2json(xmlObj)
} }
return jsonObj; return jsonObj
} }
export default xmlObj2json; export default xmlObj2json

View File

@ -1,10 +1,4 @@
import axios, { import axios, { AxiosInstance, AxiosRequestHeaders, AxiosResponse, AxiosError } from 'axios'
AxiosInstance,
AxiosRequestConfig,
AxiosRequestHeaders,
AxiosResponse,
AxiosError
} from 'axios'
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus' import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
import qs from 'qs' import qs from 'qs'
import { config } from '@/config/axios/config' import { config } from '@/config/axios/config'
@ -41,7 +35,7 @@ const service: AxiosInstance = axios.create({
// request拦截器 // request拦截器
service.interceptors.request.use( service.interceptors.request.use(
(config: AxiosRequestConfig) => { (config) => {
// 是否需要设置 token // 是否需要设置 token
let isToken = (config!.headers || {}).isToken === false let isToken = (config!.headers || {}).isToken === false
whiteList.some((v) => { whiteList.some((v) => {

View File

@ -5,7 +5,7 @@ import * as NotifyMessageApi from '@/api/system/notify/message'
const { push } = useRouter() const { push } = useRouter()
const activeName = ref('notice') const activeName = ref('notice')
const unreadCount = ref(0) // const unreadCount = ref(0) //
const list = ref([]) // const list = ref<any[]>([]) //
// //
const getList = async () => { const getList = async () => {

View File

@ -52,9 +52,10 @@ import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
import hljs from 'highlight.js' //导入代码高亮文件 import hljs from 'highlight.js' //导入代码高亮文件
import 'highlight.js/styles/github.css' //导入代码高亮样式 新版 import 'highlight.js/styles/github.css' //导入代码高亮样式 新版
import Logger from '@/utils/Logger'
// 本地开发模式 全局引入 element-plus 样式,加快第一次进入速度 // 本地开发模式 全局引入 element-plus 样式,加快第一次进入速度
if (isDevMode()) { if (isDevMode() == true) {
console.info(isDevMode())
import('element-plus/dist/index.css') import('element-plus/dist/index.css')
} }
@ -94,3 +95,5 @@ const setupAll = async () => {
} }
setupAll() setupAll()
Logger.prettyPrimary(`欢迎使用`, import.meta.env.VITE_APP_TITLE)

View File

@ -23,13 +23,17 @@ declare module '@vue/runtime-core' {
Editor: typeof import('./../components/Editor/src/Editor.vue')['default'] Editor: typeof import('./../components/Editor/src/Editor.vue')['default']
ElBadge: typeof import('element-plus/es')['ElBadge'] ElBadge: typeof import('element-plus/es')['ElBadge']
ElButton: typeof import('element-plus/es')['ElButton'] ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
ElCard: typeof import('element-plus/es')['ElCard'] ElCard: typeof import('element-plus/es')['ElCard']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCol: typeof import('element-plus/es')['ElCol'] ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElCollapseTransition: typeof import('element-plus/es')['ElCollapseTransition'] ElCollapseTransition: typeof import('element-plus/es')['ElCollapseTransition']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider'] ElDivider: typeof import('element-plus/es')['ElDivider']
ElDrawer: typeof import('element-plus/es')['ElDrawer'] ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdown: typeof import('element-plus/es')['ElDropdown']
@ -47,26 +51,21 @@ declare module '@vue/runtime-core' {
ElIcon: typeof import('element-plus/es')['ElIcon'] ElIcon: typeof import('element-plus/es')['ElIcon']
ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
ElInput: typeof import('element-plus/es')['ElInput'] ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElLink: typeof import('element-plus/es')['ElLink'] ElLink: typeof import('element-plus/es')['ElLink']
ElOption: typeof import('element-plus/es')['ElOption'] ElOption: typeof import('element-plus/es')['ElOption']
ElPopover: typeof import('element-plus/es')['ElPopover'] ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio'] ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow'] ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect'] ElSelect: typeof import('element-plus/es')['ElSelect']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs'] ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag'] ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
ElUpload: typeof import('element-plus/es')['ElUpload'] ElUpload: typeof import('element-plus/es')['ElUpload']
Error: typeof import('./../components/Error/src/Error.vue')['default'] Error: typeof import('./../components/Error/src/Error.vue')['default']
FlowCondition: typeof import('./../components/bpmnProcessDesigner/package/penal/flow-condition/FlowCondition.vue')['default'] FlowCondition: typeof import('./../components/bpmnProcessDesigner/package/penal/flow-condition/FlowCondition.vue')['default']

View File

@ -0,0 +1,100 @@
const isArray = function (obj: any): boolean {
return Object.prototype.toString.call(obj) === '[object Array]'
}
const Logger = () => {}
Logger.typeColor = function (type: string) {
let color = ''
switch (type) {
case 'primary':
color = '#2d8cf0'
break
case 'success':
color = '#19be6b'
break
case 'info':
color = '#909399'
break
case 'warn':
color = '#ff9900'
break
case 'error':
color = '#f03f14'
break
default:
color = '#35495E'
break
}
return color
}
Logger.print = function (type = 'default', text: any, back = false) {
if (typeof text === 'object') {
// 如果是對象則調用打印對象方式
isArray(text) ? console.table(text) : console.dir(text)
return
}
if (back) {
// 如果是打印帶背景圖的
console.log(
`%c ${text} `,
`background:${Logger.typeColor(type)}; padding: 2px; border-radius: 4px; color: #fff;`
)
} else {
console.log(
`%c ${text} `,
`border: 1px solid ${Logger.typeColor(type)};
padding: 2px; border-radius: 4px;
color: ${Logger.typeColor(type)};`
)
}
}
Logger.printBack = function (type = 'primary', text) {
this.print(type, text, true)
}
Logger.pretty = function (type = 'primary', title, text) {
if (typeof text === 'object') {
console.group('Console Group', title)
console.log(
`%c ${title}`,
`background:${Logger.typeColor(type)};border:1px solid ${Logger.typeColor(type)};
padding: 1px; border-radius: 4px; color: #fff;`
)
isArray(text) ? console.table(text) : console.dir(text)
console.groupEnd()
return
}
console.log(
`%c ${title} %c ${text} %c`,
`background:${Logger.typeColor(type)};border:1px solid ${Logger.typeColor(type)};
padding: 1px; border-radius: 4px 0 0 4px; color: #fff;`,
`border:1px solid ${Logger.typeColor(type)};
padding: 1px; border-radius: 0 4px 4px 0; color: ${Logger.typeColor(type)};`,
'background:transparent'
)
}
Logger.prettyPrimary = function (title, ...text) {
text.forEach((t) => this.pretty('primary', title, t))
}
Logger.prettySuccess = function (title, ...text) {
text.forEach((t) => this.pretty('success', title, t))
}
Logger.prettyWarn = function (title, ...text) {
text.forEach((t) => this.pretty('warn', title, t))
}
Logger.prettyError = function (title, ...text) {
text.forEach((t) => this.pretty('error', title, t))
}
Logger.prettyInfo = function (title, ...text) {
text.forEach((t) => this.pretty('info', title, t))
}
export default Logger

View File

@ -212,9 +212,9 @@ const { proxy } = getCurrentInstance()
// ========== ========== // ========== ==========
const id = query.id as unknown as number const id = query.id as unknown as number
const processInstanceLoading = ref(false) // const processInstanceLoading = ref(false) //
const processInstance = ref({}) // const processInstance = ref<any>({}) //
const runningTasks = ref([]) // const runningTasks = ref<any[]>([]) //
const auditForms = ref([]) // const auditForms = ref<any[]>([]) //
const auditRule = reactive({ const auditRule = reactive({
reason: [{ required: true, message: '审批建议不能为空', trigger: 'blur' }] reason: [{ required: true, message: '审批建议不能为空', trigger: 'blur' }]
}) })
@ -260,7 +260,7 @@ const detailForm = ref({
// ========== ========== // ========== ==========
const tasksLoad = ref(true) const tasksLoad = ref(true)
const tasks = ref([]) const tasks = ref<any[]>([])
const getTimelineItemIcon = (item) => { const getTimelineItemIcon = (item) => {
if (item.result === 1) { if (item.result === 1) {
@ -304,7 +304,7 @@ const updateAssigneeRules = ref({
assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }] assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }]
}) })
const updateAssigneeFormRef = ref() const updateAssigneeFormRef = ref()
const userOptions = ref([]) const userOptions = ref<any[]>([])
// //
const handleUpdateAssignee = (task) => { const handleUpdateAssignee = (task) => {

View File

@ -16,7 +16,7 @@
<template #toMail_default="{ row }"> <template #toMail_default="{ row }">
<div>{{ row.toMail }}</div> <div>{{ row.toMail }}</div>
<div v-if="row.userType && row.userId"> <div v-if="row.userType && row.userId">
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />{{ '(' + row.userId + ')' }} <DictTag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />{{ '(' + row.userId + ')' }}
</div> </div>
</template> </template>
<template #actionbtns_default="{ row }"> <template #actionbtns_default="{ row }">
@ -46,6 +46,7 @@
</template> </template>
<script setup lang="ts" name="MailLog"> <script setup lang="ts" name="MailLog">
// import // import
import { DICT_TYPE } from '@/utils/dict'
import { allSchemas } from './log.data' import { allSchemas } from './log.data'
import * as MailLogApi from '@/api/system/mail/log' import * as MailLogApi from '@/api/system/mail/log'
import * as MailAccountApi from '@/api/system/mail/account' import * as MailAccountApi from '@/api/system/mail/account'
@ -61,7 +62,7 @@ const [registerTable] = useXTable({
params: queryParams, params: queryParams,
getListApi: MailLogApi.getMailLogPageApi getListApi: MailLogApi.getMailLogPageApi
}) })
const accountOptions = ref([]) // const accountOptions = ref<any[]>([]) //
// //
const modelVisible = ref(false) // const modelVisible = ref(false) //

View File

@ -152,7 +152,7 @@ const [registerTable, { reload, deleteData }] = useXTable({
getListApi: MailTemplateApi.getMailTemplatePageApi, getListApi: MailTemplateApi.getMailTemplatePageApi,
deleteApi: MailTemplateApi.deleteMailTemplateApi deleteApi: MailTemplateApi.deleteMailTemplateApi
}) })
const accountOptions = ref([]) // const accountOptions = ref<any[]>([]) //
// //
const modelVisible = ref(false) // const modelVisible = ref(false) //

View File

@ -202,7 +202,7 @@ const submitForm = async () => {
const sendForm = ref({ const sendForm = ref({
content: '', content: '',
params: {}, params: {},
userId: undefined, userId: 0,
templateCode: '', templateCode: '',
templateParams: {} templateParams: {}
}) })

View File

@ -0,0 +1,93 @@
<template>
<!-- 弹窗 -->
<XModal id="PostForm" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
<!-- 表单添加/修改 -->
<Form
ref="formRef"
v-if="['create', 'update'].includes(actionType)"
:schema="allSchemas.formSchema"
:rules="rules"
/>
<!-- 表单详情 -->
<Descriptions
v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema"
:data="detailData"
/>
<template #footer>
<!-- 按钮保存 -->
<XButton
v-if="['create', 'update'].includes(actionType)"
type="primary"
:title="t('action.save')"
:loading="actionLoading"
@click="submitForm()"
/>
<!-- 按钮关闭 -->
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
</template>
</XModal>
</template>
<script setup lang="ts">
import type { FormExpose } from '@/components/Form'
import * as PostApi from '@/api/system/post'
import { rules, allSchemas } from './post.data'
const { t } = useI18n() //
const message = useMessage() //
const emit = defineEmits(['success'])
//
const modelVisible = ref(false) //
const modelTitle = ref('edit') //
const modelLoading = ref(false) // loading
const actionType = ref('') //
const actionLoading = ref(false) // Loading
const formRef = ref<FormExpose>() // Ref
const detailData = ref() // Ref
const openModal = async (type: string, rowId?: number) => {
modelLoading.value = true
modelTitle.value = t('action.' + type)
actionType.value = type
modelVisible.value = true
//
if (rowId) {
const res = await PostApi.getPostApi(rowId)
if (type === 'update') {
unref(formRef)?.setValues(res)
} else if (type === 'detail') {
detailData.value = res
}
}
modelLoading.value = false
}
// /
const submitForm = async () => {
const elForm = unref(formRef)?.getElFormRef()
if (!elForm) return
elForm.validate(async (valid) => {
if (valid) {
actionLoading.value = true
//
try {
const data = unref(formRef)?.formModel as PostApi.PostVO
if (actionType.value === 'create') {
await PostApi.createPostApi(data)
message.success(t('common.createSuccess'))
} else {
await PostApi.updatePostApi(data)
message.success(t('common.updateSuccess'))
}
modelVisible.value = false
emit('success')
} finally {
actionLoading.value = false
}
}
})
}
defineExpose({ openModal: openModal })
</script>

View File

@ -9,7 +9,7 @@
preIcon="ep:zoom-in" preIcon="ep:zoom-in"
:title="t('action.add')" :title="t('action.add')"
v-hasPermi="['system:post:create']" v-hasPermi="['system:post:create']"
@click="openModel('create')" @click="openModal('create')"
/> />
<!-- 操作导出 --> <!-- 操作导出 -->
<XButton <XButton
@ -25,13 +25,13 @@
<XTextButton <XTextButton
preIcon="ep:edit" preIcon="ep:edit"
v-hasPermi="['system:post:update']" v-hasPermi="['system:post:update']"
@click="openModel('update', row.id)" @click="openModal('update', row.id)"
/> />
<!-- 操作详情 --> <!-- 操作详情 -->
<XTextButton <XTextButton
preIcon="ep:view" preIcon="ep:view"
v-hasPermi="['system:post:query']" v-hasPermi="['system:post:query']"
@click="openModel('detail', row.id)" @click="openModal('detail', row.id)"
/> />
<!-- 操作删除 --> <!-- 操作删除 -->
<XTextButton <XTextButton
@ -42,43 +42,16 @@
</template> </template>
</XTable> </XTable>
</ContentWrap> </ContentWrap>
<!-- 弹窗 --> <PostForm ref="modalRef" @success="reload()" />
<XModal id="postModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
<!-- 表单添加/修改 -->
<Form
ref="formRef"
v-if="['create', 'update'].includes(actionType)"
:schema="allSchemas.formSchema"
:rules="rules"
/>
<!-- 表单详情 -->
<Descriptions
v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema"
:data="detailData"
/>
<template #footer>
<!-- 按钮保存 -->
<XButton
v-if="['create', 'update'].includes(actionType)"
type="primary"
:title="t('action.save')"
:loading="actionLoading"
@click="submitForm()"
/>
<!-- 按钮关闭 -->
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
</template>
</XModal>
</template> </template>
<script setup lang="ts" name="Post"> <script setup lang="ts" name="Post">
import type { FormExpose } from '@/components/Form'
// import // import
import * as PostApi from '@/api/system/post' import * as PostApi from '@/api/system/post'
import { rules, allSchemas } from './post.data' import { allSchemas } from './post.data'
import PostForm from './PostForm.vue'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const modalRef = ref()
// //
const [registerTable, { reload, deleteData, exportList }] = useXTable({ const [registerTable, { reload, deleteData, exportList }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
@ -86,56 +59,8 @@ const [registerTable, { reload, deleteData, exportList }] = useXTable({
deleteApi: PostApi.deletePostApi, deleteApi: PostApi.deletePostApi,
exportListApi: PostApi.exportPostApi exportListApi: PostApi.exportPostApi
}) })
//
const modelVisible = ref(false) //
const modelTitle = ref('edit') //
const modelLoading = ref(false) // loading
const actionType = ref('') //
const actionLoading = ref(false) // Loading
const formRef = ref<FormExpose>() // Ref
const detailData = ref() // Ref
const openModel = async (type: string, rowId?: number) => { const openModal = (type: string, rowId?: number) => {
modelLoading.value = true modalRef.value.openModal(type, rowId)
modelTitle.value = t('action.' + type)
actionType.value = type
modelVisible.value = true
//
if (rowId) {
const res = await PostApi.getPostApi(rowId)
if (type === 'update') {
unref(formRef)?.setValues(res)
} else if (type === 'detail') {
detailData.value = res
}
}
modelLoading.value = false
}
// /
const submitForm = async () => {
const elForm = unref(formRef)?.getElFormRef()
if (!elForm) return
elForm.validate(async (valid) => {
if (valid) {
actionLoading.value = true
//
try {
const data = unref(formRef)?.formModel as PostApi.PostVO
if (actionType.value === 'create') {
await PostApi.createPostApi(data)
message.success(t('common.createSuccess'))
} else {
await PostApi.updatePostApi(data)
message.success(t('common.updateSuccess'))
}
modelVisible.value = false
} finally {
actionLoading.value = false
//
reload()
}
}
})
} }
</script> </script>

View File

@ -29,7 +29,8 @@
"element-plus/global", "element-plus/global",
"@types/intro.js", "@types/intro.js",
"@types/qrcode", "@types/qrcode",
"vite-plugin-svg-icons/client" "vite-plugin-svg-icons/client",
"@form-create/element-ui/types"
], ],
"typeRoots": ["./node_modules/@types/", "./types"] "typeRoots": ["./node_modules/@types/", "./types"]
}, },