workflow-bpmn-modeler-andtv-vue3 10.0.6 → 10.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/workflow-bpmn-modeler-andtv-vue3.common.js +2 -185
- package/dist/workflow-bpmn-modeler-andtv-vue3.umd.js +2 -185
- package/dist/workflow-bpmn-modeler-andtv-vue3.umd.min.js +2 -185
- package/package/bpmn-styles.css +40 -0
- package/package/index.vue +147 -23
- package/package.json +1 -1
- package/dist/fonts/bpmn.5d33bee4.eot +0 -0
- package/dist/fonts/bpmn.67058807.woff2 +0 -0
- package/dist/fonts/bpmn.b5c9250d.ttf +0 -0
- package/dist/fonts/bpmn.e9e7d076.woff +0 -0
- package/dist/img/bpmn.74eea12b.svg +0 -224
@@ -0,0 +1,40 @@
|
|
1
|
+
/* BPMN.js 核心样式 */
|
2
|
+
@import url('https://cdn.jsdelivr.net/npm/bpmn-js@8.10.0/dist/assets/diagram-js.css');
|
3
|
+
@import url('https://cdn.jsdelivr.net/npm/bpmn-js@8.10.0/dist/assets/bpmn-font/css/bpmn.css');
|
4
|
+
@import url('https://cdn.jsdelivr.net/npm/bpmn-js@8.10.0/dist/assets/bpmn-font/css/bpmn-codes.css');
|
5
|
+
@import url('https://cdn.jsdelivr.net/npm/bpmn-js@8.10.0/dist/assets/bpmn-font/css/bpmn-embedded.css');
|
6
|
+
|
7
|
+
/* 确保BPMN容器有正确的高度 */
|
8
|
+
.bpmn-container {
|
9
|
+
width: 100%;
|
10
|
+
height: 100%;
|
11
|
+
min-height: 400px;
|
12
|
+
}
|
13
|
+
|
14
|
+
.bpmn-container .djs-container {
|
15
|
+
width: 100%;
|
16
|
+
height: 100%;
|
17
|
+
}
|
18
|
+
|
19
|
+
.bpmn-container .djs-container svg {
|
20
|
+
width: 100%;
|
21
|
+
height: 100%;
|
22
|
+
}
|
23
|
+
|
24
|
+
/* 确保工具栏正确显示 */
|
25
|
+
.djs-palette {
|
26
|
+
position: absolute !important;
|
27
|
+
left: 20px !important;
|
28
|
+
top: 20px !important;
|
29
|
+
z-index: 10 !important;
|
30
|
+
}
|
31
|
+
|
32
|
+
/* 确保画布区域可见 */
|
33
|
+
.djs-canvas {
|
34
|
+
background: white !important;
|
35
|
+
}
|
36
|
+
|
37
|
+
/* 修复可能的显示问题 */
|
38
|
+
.djs-element {
|
39
|
+
pointer-events: auto !important;
|
40
|
+
}
|
package/package/index.vue
CHANGED
@@ -157,6 +157,23 @@ const props = withDefaults(defineProps<Props>(), {
|
|
157
157
|
const emit = defineEmits<{
|
158
158
|
save: [data: SaveData]
|
159
159
|
}>()
|
160
|
+
|
161
|
+
// 暴露手动初始化方法
|
162
|
+
const manualInit = () => {
|
163
|
+
if (!modeler.value && canvas.value) {
|
164
|
+
console.log('Manual initialization triggered')
|
165
|
+
onMounted()
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
// 暴露给父组件
|
170
|
+
defineExpose({
|
171
|
+
manualInit,
|
172
|
+
getProcess,
|
173
|
+
saveXML,
|
174
|
+
saveImg,
|
175
|
+
save
|
176
|
+
})
|
160
177
|
const canvas = ref<HTMLElement | null>(null)
|
161
178
|
const modeler = ref<Modeler | null>(null)
|
162
179
|
const taskList = ref<any[]>([])
|
@@ -168,24 +185,90 @@ watch(() => props.xml, (val: string) => {
|
|
168
185
|
}
|
169
186
|
})
|
170
187
|
|
171
|
-
onMounted(() => {
|
172
|
-
//
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
188
|
+
onMounted(async () => {
|
189
|
+
// 延迟初始化,确保DOM完全渲染
|
190
|
+
await nextTick()
|
191
|
+
|
192
|
+
const initializeModeler = async () => {
|
193
|
+
try {
|
194
|
+
// 确保容器存在且有尺寸
|
195
|
+
if (!canvas.value || canvas.value.offsetWidth === 0 || canvas.value.offsetHeight === 0) {
|
196
|
+
console.log('Canvas container not ready, waiting...')
|
197
|
+
return false
|
178
198
|
}
|
179
|
-
|
180
|
-
|
181
|
-
|
199
|
+
|
200
|
+
console.log('Canvas container found, initializing modeler...')
|
201
|
+
|
202
|
+
// 生成实例
|
203
|
+
modeler.value = new Modeler({
|
204
|
+
container: canvas.value,
|
205
|
+
additionalModules: [
|
206
|
+
{
|
207
|
+
translate: ['value', customTranslate]
|
208
|
+
}
|
209
|
+
],
|
210
|
+
moddleExtensions: {
|
211
|
+
flowable: flowableModdle
|
212
|
+
}
|
213
|
+
})
|
214
|
+
|
215
|
+
// 等待下一个tick确保DOM更新
|
216
|
+
await nextTick()
|
217
|
+
|
218
|
+
// 新增流程定义
|
219
|
+
if (!props.xml) {
|
220
|
+
newDiagram()
|
221
|
+
} else {
|
222
|
+
createNewDiagram(props.xml)
|
223
|
+
}
|
224
|
+
|
225
|
+
console.log('BPMN Modeler initialized successfully')
|
226
|
+
return true
|
227
|
+
} catch (error) {
|
228
|
+
console.error('BPMN Modeler initialization failed:', error)
|
229
|
+
return false
|
182
230
|
}
|
183
|
-
}
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
231
|
+
}
|
232
|
+
|
233
|
+
// 立即尝试初始化
|
234
|
+
let initialized = await initializeModeler()
|
235
|
+
|
236
|
+
// 如果初始化失败,使用多种策略重试
|
237
|
+
if (!initialized) {
|
238
|
+
// 策略1: 使用MutationObserver监听DOM变化
|
239
|
+
const observer = new MutationObserver(async () => {
|
240
|
+
if (canvas.value && canvas.value.offsetWidth > 0 && canvas.value.offsetHeight > 0) {
|
241
|
+
observer.disconnect()
|
242
|
+
await initializeModeler()
|
243
|
+
}
|
244
|
+
})
|
245
|
+
|
246
|
+
// 监听父容器变化
|
247
|
+
if (canvas.value?.parentElement) {
|
248
|
+
observer.observe(canvas.value.parentElement, {
|
249
|
+
childList: true,
|
250
|
+
subtree: true,
|
251
|
+
attributes: true,
|
252
|
+
attributeFilter: ['style', 'class']
|
253
|
+
})
|
254
|
+
}
|
255
|
+
|
256
|
+
// 策略2: 定时重试(最多10秒)
|
257
|
+
let retryCount = 0
|
258
|
+
const maxRetries = 50 // 10秒,每200ms重试一次
|
259
|
+
|
260
|
+
const retryTimer = setInterval(async () => {
|
261
|
+
retryCount++
|
262
|
+
initialized = await initializeModeler()
|
263
|
+
|
264
|
+
if (initialized || retryCount >= maxRetries) {
|
265
|
+
clearInterval(retryTimer)
|
266
|
+
observer.disconnect()
|
267
|
+
if (!initialized) {
|
268
|
+
console.error('Failed to initialize BPMN Modeler after maximum retries')
|
269
|
+
}
|
270
|
+
}
|
271
|
+
}, 200)
|
189
272
|
}
|
190
273
|
})
|
191
274
|
|
@@ -229,13 +312,25 @@ const createNewDiagram = async (data: string): Promise<void> => {
|
|
229
312
|
return str.replace(/</g, '<')
|
230
313
|
})
|
231
314
|
try {
|
232
|
-
if (!modeler.value)
|
315
|
+
if (!modeler.value) {
|
316
|
+
console.error('Modeler not initialized')
|
317
|
+
return
|
318
|
+
}
|
319
|
+
|
320
|
+
console.log('Importing XML data...', data.substring(0, 200) + '...')
|
233
321
|
await modeler.value.importXML(data)
|
322
|
+
console.log('XML imported successfully')
|
323
|
+
|
324
|
+
// 等待DOM更新
|
325
|
+
await nextTick()
|
326
|
+
|
234
327
|
adjustPalette()
|
235
328
|
fitViewport()
|
329
|
+
|
330
|
+
console.log('Diagram created successfully')
|
236
331
|
// fillColor()
|
237
332
|
} catch (err: any) {
|
238
|
-
console.error(err.message, err.warnings)
|
333
|
+
console.error('Failed to create diagram:', err.message, err.warnings)
|
239
334
|
}
|
240
335
|
}
|
241
336
|
|
@@ -423,11 +518,11 @@ const downloadFile = (filename: string, data: string, type: string): void => {
|
|
423
518
|
</script>
|
424
519
|
|
425
520
|
<style lang="scss">
|
426
|
-
/* BPMN.js 样式导入 */
|
427
|
-
@import
|
428
|
-
@import
|
429
|
-
@import
|
430
|
-
@import
|
521
|
+
/* BPMN.js 样式导入 - 使用CDN确保样式正确加载 */
|
522
|
+
@import url('https://cdn.jsdelivr.net/npm/bpmn-js@8.10.0/dist/assets/diagram-js.css');
|
523
|
+
@import url('https://cdn.jsdelivr.net/npm/bpmn-js@8.10.0/dist/assets/bpmn-font/css/bpmn.css');
|
524
|
+
@import url('https://cdn.jsdelivr.net/npm/bpmn-js@8.10.0/dist/assets/bpmn-font/css/bpmn-codes.css');
|
525
|
+
@import url('https://cdn.jsdelivr.net/npm/bpmn-js@8.10.0/dist/assets/bpmn-font/css/bpmn-embedded.css');
|
431
526
|
|
432
527
|
/* 视图模式样式 */
|
433
528
|
.view-mode {
|
@@ -607,6 +702,35 @@ const downloadFile = (filename: string, data: string, type: string): void => {
|
|
607
702
|
height: 100%;
|
608
703
|
position: relative;
|
609
704
|
z-index: 1;
|
705
|
+
min-height: 400px;
|
706
|
+
display: block;
|
707
|
+
|
708
|
+
/* 确保BPMN容器正确显示 */
|
709
|
+
:deep(.djs-container) {
|
710
|
+
width: 100% !important;
|
711
|
+
height: 100% !important;
|
712
|
+
min-height: 400px !important;
|
713
|
+
display: block !important;
|
714
|
+
}
|
715
|
+
|
716
|
+
:deep(.djs-container svg) {
|
717
|
+
width: 100% !important;
|
718
|
+
height: 100% !important;
|
719
|
+
background: white !important;
|
720
|
+
display: block !important;
|
721
|
+
}
|
722
|
+
|
723
|
+
:deep(.djs-canvas) {
|
724
|
+
background: white !important;
|
725
|
+
width: 100% !important;
|
726
|
+
height: 100% !important;
|
727
|
+
}
|
728
|
+
|
729
|
+
/* 确保在jeecgboot环境中正确显示 */
|
730
|
+
:deep(.viewport) {
|
731
|
+
width: 100% !important;
|
732
|
+
height: 100% !important;
|
733
|
+
}
|
610
734
|
}
|
611
735
|
|
612
736
|
/* 属性面板 */
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "workflow-bpmn-modeler-andtv-vue3",
|
3
|
-
"version": "10.0.
|
3
|
+
"version": "10.0.8",
|
4
4
|
"description": "基于 `Vue3` + `TypeScript` + `Ant Design Vue` 和 `bpmn.io@8.10` ,实现 flowable 的 modeler 模型设计器",
|
5
5
|
"main": "dist/workflow-bpmn-modeler-andtv-vue3.common.js",
|
6
6
|
"module": "dist/workflow-bpmn-modeler-andtv-vue3.common.js",
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|