@bpmn-nova/studio 0.3.9-preview → 0.4.1

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.
Files changed (79) hide show
  1. package/README.md +2 -2
  2. package/dist/canvas.js +97 -25
  3. package/dist/config.js +13 -0
  4. package/dist/context-menu.js +41 -32
  5. package/dist/controller.js +45 -19
  6. package/dist/flow-tree.d.ts +4 -0
  7. package/dist/flow-tree.js +14 -0
  8. package/dist/index.d.ts +47 -2
  9. package/dist/index.js +1 -0
  10. package/dist/interactions.js +6 -1
  11. package/dist/modules/bpmn-model/index.d.ts +2 -1
  12. package/dist/modules/bpmn-model/index.js +12 -10
  13. package/dist/modules/core/gateway.js +16 -13
  14. package/dist/modules/core/index.d.ts +6 -4
  15. package/dist/modules/core/model.js +12 -7
  16. package/dist/modules/designer/index.d.ts +5 -1
  17. package/dist/modules/designer/index.js +36 -15
  18. package/dist/modules/export-svg/index.d.ts +12 -5
  19. package/dist/modules/export-svg/preview.js +34 -24
  20. package/dist/modules/export-svg/render.js +102 -50
  21. package/dist/modules/flow-tree/controller.js +364 -0
  22. package/dist/modules/flow-tree/index.d.ts +248 -0
  23. package/dist/modules/flow-tree/index.js +5 -0
  24. package/dist/modules/flow-tree/operations.js +484 -0
  25. package/dist/modules/flow-tree/sample.js +445 -0
  26. package/dist/modules/flow-tree/schema.js +588 -0
  27. package/dist/modules/flow-tree/validate.js +125 -0
  28. package/dist/modules/flow-tree-bpmn/compiler.js +547 -0
  29. package/dist/modules/flow-tree-bpmn/decompiler.js +524 -0
  30. package/dist/modules/flow-tree-bpmn/expression.js +135 -0
  31. package/dist/modules/flow-tree-bpmn/index.d.ts +53 -0
  32. package/dist/modules/flow-tree-bpmn/index.js +14 -0
  33. package/dist/modules/flow-tree-renderer/canvas.js +1003 -0
  34. package/dist/modules/flow-tree-renderer/export-svg.js +325 -0
  35. package/dist/modules/flow-tree-renderer/index.d.ts +143 -0
  36. package/dist/modules/flow-tree-renderer/index.js +3 -0
  37. package/dist/modules/flow-tree-renderer/shell.js +970 -0
  38. package/dist/modules/i18n/index.d.ts +647 -0
  39. package/dist/modules/i18n/index.js +247 -0
  40. package/dist/modules/i18n/locales/en-US.js +1222 -0
  41. package/dist/modules/i18n/locales/zh-CN.js +1204 -0
  42. package/dist/modules/icons/index.js +23 -0
  43. package/dist/modules/node-presentation/index.d.ts +3 -2
  44. package/dist/modules/node-presentation/index.js +14 -11
  45. package/dist/modules/palette/index.d.ts +6 -1
  46. package/dist/modules/palette/index.js +26 -8
  47. package/dist/modules/palette/panel.js +44 -6
  48. package/dist/modules/properties/index.d.ts +2 -1
  49. package/dist/modules/properties/index.js +2 -2
  50. package/dist/modules/properties-activiti/index.js +84 -59
  51. package/dist/modules/properties-bpmn/index.js +151 -128
  52. package/dist/modules/properties-core/index.d.ts +9 -3
  53. package/dist/modules/properties-core/index.js +16 -4
  54. package/dist/modules/properties-flow-tree/index.d.ts +56 -0
  55. package/dist/modules/properties-flow-tree/index.js +2 -0
  56. package/dist/modules/properties-flow-tree/panel.js +1136 -0
  57. package/dist/modules/properties-flow-tree/widgets.js +625 -0
  58. package/dist/modules/properties-flowable/index.js +55 -34
  59. package/dist/modules/properties-renderer/index.d.ts +5 -1
  60. package/dist/modules/properties-renderer/index.js +110 -42
  61. package/dist/modules/renderer-svg/index.d.ts +6 -2
  62. package/dist/modules/renderer-svg/index.js +113 -38
  63. package/dist/modules/runtime/index.d.ts +33 -5
  64. package/dist/modules/runtime/index.js +97 -73
  65. package/dist/modules/runtime/time.js +89 -4
  66. package/dist/modules/runtime/visits.js +6 -4
  67. package/dist/modules/theme/index.d.ts +5 -2
  68. package/dist/modules/theme/index.js +8 -4
  69. package/dist/modules/viewer/index.d.ts +28 -7
  70. package/dist/modules/viewer/index.js +223 -58
  71. package/dist/modules/viewer/runtime-content.js +26 -20
  72. package/dist/modules/viewer/runtime-trace.js +43 -25
  73. package/dist/modules/viewer/timeline.js +103 -36
  74. package/dist/shell.js +258 -75
  75. package/dist/sidebars.js +3 -1
  76. package/dist/styles.css +2371 -2
  77. package/llms-full.txt +586 -47
  78. package/llms.txt +6 -5
  79. package/package.json +7 -3
@@ -1,15 +1,17 @@
1
1
  import { NODE_DEFINITIONS, resolveGatewayRole, resolveSwimlaneLabelPlacement } from '../core/index.js';
2
+ import { resolveI18n } from '../i18n/index.js';
2
3
  import { propertyEntry, propertyGroup } from '../properties-core/index.js';
3
4
 
4
5
  const activityKinds = new Set(['task', 'container']);
5
6
  const eventRefs = {
6
- message: { resource: 'messages', label: '消息 Message' },
7
- signal: { resource: 'signals', label: '信号 Signal' },
8
- error: { resource: 'errors', label: '错误 Error' },
9
- escalation: { resource: 'escalations', label: '升级 Escalation' },
7
+ message: { resource: 'messages', labelKey: 'properties.bpmn.eventRefMessage' },
8
+ signal: { resource: 'signals', labelKey: 'properties.bpmn.eventRefSignal' },
9
+ error: { resource: 'errors', labelKey: 'properties.bpmn.eventRefError' },
10
+ escalation: { resource: 'escalations', labelKey: 'properties.bpmn.eventRefEscalation' },
10
11
  };
11
12
 
12
13
  function nodeTypeOptions(context) {
14
+ const i18n = resolveI18n(context);
13
15
  const currentKind = context.definition?.kind;
14
16
  const compatible = currentKind === 'event' || currentKind === 'boundary'
15
17
  ? ['event', 'boundary']
@@ -20,17 +22,18 @@ function nodeTypeOptions(context) {
20
22
  .filter(([type, def]) => type !== 'generic'
21
23
  && compatible.includes(def.kind)
22
24
  && context.studio?.canChangeNodeType?.(context.element?.id, type) !== false)
23
- .map(([value, def]) => ({ value, label: def.label }));
25
+ .map(([value, def]) => ({ value, label: i18n.elementTypeLabel(value, def.label) }));
24
26
  }
25
27
 
26
28
  function idValidator(value, context) {
27
- if (!value) return 'ID 不能为空';
28
- if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(value)) return 'ID 只能包含字母、数字、_、-、.,且不能以数字开头';
29
+ const i18n = resolveI18n(context);
30
+ if (!value) return i18n.t('properties.validators.idRequired');
31
+ if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(value)) return i18n.t('properties.validators.idInvalid');
29
32
  const model = context.model;
30
33
  const processConflict = context.kind !== 'process' && model.id === value;
31
34
  const nodeConflict = model.nodes.some((item) => item.id === value && !(context.kind === 'node' && item === context.element));
32
35
  const edgeConflict = model.edges.some((item) => item.id === value && !(context.kind === 'edge' && item === context.element));
33
- if (processConflict || nodeConflict || edgeConflict) return 'ID 已存在;BPMN Element ID 必须在 Definitions 内唯一';
36
+ if (processConflict || nodeConflict || edgeConflict) return i18n.t('properties.validators.idDuplicate');
34
37
  return null;
35
38
  }
36
39
 
@@ -38,16 +41,17 @@ const basicProvider = {
38
41
  id: 'bpmn-basic',
39
42
  priority: 1000,
40
43
  getGroups(context) {
44
+ const t = (key, params) => resolveI18n(context).t(key, params);
41
45
  if (context.kind === 'process') {
42
46
  return [propertyGroup({
43
- id: 'basic', label: '基本信息', collapsible: false,
47
+ id: 'basic', label: t('properties.bpmn.basicGroup'), collapsible: false,
44
48
  entries: [
45
- propertyEntry({ id: 'process-name', label: '流程名称', path: 'name', required: true }),
46
- propertyEntry({ id: 'process-id', label: 'Process ID', path: 'id', required: true, validate: idValidator, note: '部署到流程引擎时作为 processDefinitionKey。', level: 'developer' }),
49
+ propertyEntry({ id: 'process-name', label: t('properties.bpmn.processName'), path: 'name', required: true }),
50
+ propertyEntry({ id: 'process-id', label: 'Process ID', path: 'id', required: true, validate: idValidator, note: t('properties.bpmn.processIdNote'), level: 'developer' }),
47
51
  propertyEntry({ id: 'namespace', label: 'Target Namespace', path: 'targetNamespace', placeholder: 'urn:company:workflow', level: 'developer' }),
48
- propertyEntry({ id: 'executable', type: 'switch', label: '可执行流程', path: 'isExecutable' }),
52
+ propertyEntry({ id: 'executable', type: 'switch', label: t('properties.bpmn.executable'), path: 'isExecutable' }),
49
53
  propertyEntry({
50
- id: 'engine', type: 'select', label: '流程引擎',
54
+ id: 'engine', type: 'select', label: t('properties.bpmn.engine'),
51
55
  options: [{ value: 'flowable', label: 'Flowable' }, { value: 'activiti', label: 'Activiti' }],
52
56
  getValue: (ctx) => ctx.model.engine,
53
57
  setValue: (ctx, value) => ctx.studio.setEngine(value),
@@ -57,22 +61,21 @@ const basicProvider = {
57
61
  }
58
62
  if (context.kind === 'edge') {
59
63
  return [propertyGroup({
60
- id: 'basic', label: context.element.type === 'sequenceFlow' ? '分支定义' : '连线信息', collapsible: false,
64
+ id: 'basic', label: t(context.element.type === 'sequenceFlow' ? 'properties.bpmn.branchDefGroup' : 'properties.bpmn.edgeInfoGroup'), collapsible: false,
61
65
  entries: [
62
- propertyEntry({ id: 'edge-name', label: '名称', path: 'name', placeholder: '例如:同意 / 驳回 / 金额 ≥ 5万' }),
66
+ propertyEntry({ id: 'edge-name', label: t('properties.bpmn.name'), path: 'name', placeholder: t('properties.bpmn.edgeNamePlaceholder') }),
63
67
  propertyEntry({ id: 'edge-id', label: 'Flow ID', path: 'id', required: true, validate: idValidator }),
64
68
  propertyEntry({ id: 'edge-type', type: 'readonly', label: 'BPMN Type', getValue: (ctx) => ctx.element.type === 'messageFlow' ? 'bpmn:MessageFlow' : ctx.element.type === 'association' ? 'bpmn:Association' : 'bpmn:SequenceFlow' }),
65
69
  ],
66
70
  })];
67
71
  }
68
- const def = context.definition;
69
72
  return [propertyGroup({
70
- id: 'basic', label: '基本信息', collapsible: false,
73
+ id: 'basic', label: t('properties.bpmn.basicGroup'), collapsible: false,
71
74
  entries: [
72
- propertyEntry({ id: 'name', label: '名称', path: 'name', required: true }),
75
+ propertyEntry({ id: 'name', label: t('properties.bpmn.name'), path: 'name', required: true }),
73
76
  propertyEntry({ id: 'id', label: 'Element ID', path: 'id', required: true, validate: idValidator, level: 'developer' }),
74
77
  propertyEntry({
75
- id: 'node-type', type: 'select', label: '节点类型', options: nodeTypeOptions,
78
+ id: 'node-type', type: 'select', label: t('properties.bpmn.nodeType'), options: nodeTypeOptions,
76
79
  getValue: (ctx) => ctx.element.type,
77
80
  setValue: (ctx, value) => ctx.designer.changeNodeType(ctx.element.id, value),
78
81
  }),
@@ -86,11 +89,12 @@ const documentationProvider = {
86
89
  id: 'bpmn-documentation',
87
90
  priority: 200,
88
91
  getGroups(context) {
92
+ const t = (key, params) => resolveI18n(context).t(key, params);
89
93
  return [propertyGroup({
90
- id: 'documentation', label: '文档说明', collapsed: true, position: { append: true },
94
+ id: 'documentation', label: t('properties.bpmn.documentationGroup'), collapsed: true, position: { append: true },
91
95
  entries: [propertyEntry({
92
96
  id: 'documentation', type: 'textarea', label: 'Documentation', path: context.kind === 'process' ? 'properties.documentation' : 'properties.documentation',
93
- placeholder: '节点说明、业务规则、实现备注或流程文档。', rows: 5,
97
+ placeholder: t('properties.bpmn.documentationPlaceholder'), rows: 5,
94
98
  })],
95
99
  })];
96
100
  },
@@ -100,51 +104,52 @@ const processProvider = {
100
104
  id: 'bpmn-process',
101
105
  priority: 800,
102
106
  appliesTo: { kind: 'process' },
103
- getGroups() {
107
+ getGroups(context) {
108
+ const t = (key, params) => resolveI18n(context).t(key, params);
104
109
  return [
105
110
  propertyGroup({
106
- id: 'process-start-permissions', label: '启动权限', collapsed: true, position: { after: 'basic' },
111
+ id: 'process-start-permissions', label: t('properties.bpmn.startPermissionsGroup'), collapsed: true, position: { after: 'basic' },
107
112
  entries: [
108
- propertyEntry({ id: 'starter-users', type: 'tags', label: '候选启动用户', path: 'properties.candidateStarterUsers', placeholder: 'user1,user2' }),
109
- propertyEntry({ id: 'starter-groups', type: 'tags', label: '候选启动组', path: 'properties.candidateStarterGroups', placeholder: 'manager,finance' }),
113
+ propertyEntry({ id: 'starter-users', type: 'tags', label: t('properties.bpmn.starterUsers'), path: 'properties.candidateStarterUsers', placeholder: 'user1,user2' }),
114
+ propertyEntry({ id: 'starter-groups', type: 'tags', label: t('properties.bpmn.starterGroups'), path: 'properties.candidateStarterGroups', placeholder: 'manager,finance' }),
110
115
  ],
111
116
  }),
112
117
  propertyGroup({
113
- id: 'global-resources', label: '全局事件资源', collapsed: true, position: { after: 'process-start-permissions' },
114
- description: '集中管理 Message / Signal / Error / Escalation,事件节点通过 ID 引用。',
118
+ id: 'global-resources', label: t('properties.bpmn.globalResourcesGroup'), collapsed: true, position: { after: 'process-start-permissions' },
119
+ description: t('properties.bpmn.globalResourcesDesc'),
115
120
  entries: [
116
- propertyEntry({ id: 'messages', type: 'table', label: 'Messages', path: 'resources.messages', rowLabel: '消息', defaultRow: () => ({ id: `Message_${Date.now().toString(36)}`, name: '新消息' }), columns: [{ key: 'id', label: 'ID' }, { key: 'name', label: '名称' }] }),
117
- propertyEntry({ id: 'signals', type: 'table', label: 'Signals', path: 'resources.signals', rowLabel: '信号', defaultRow: () => ({ id: `Signal_${Date.now().toString(36)}`, name: '新信号' }), columns: [{ key: 'id', label: 'ID' }, { key: 'name', label: '名称' }] }),
118
- propertyEntry({ id: 'errors', type: 'table', label: 'Errors', path: 'resources.errors', rowLabel: '错误', defaultRow: () => ({ id: `Error_${Date.now().toString(36)}`, name: '业务错误', errorCode: 'BUSINESS_ERROR' }), columns: [{ key: 'id', label: 'ID' }, { key: 'name', label: '名称' }, { key: 'errorCode', label: 'Error Code' }] }),
119
- propertyEntry({ id: 'escalations', type: 'table', label: 'Escalations', path: 'resources.escalations', rowLabel: '升级', defaultRow: () => ({ id: `Escalation_${Date.now().toString(36)}`, name: '业务升级', escalationCode: 'ESCALATE' }), columns: [{ key: 'id', label: 'ID' }, { key: 'name', label: '名称' }, { key: 'escalationCode', label: 'Code' }] }),
121
+ propertyEntry({ id: 'messages', type: 'table', label: 'Messages', path: 'resources.messages', rowLabel: t('properties.bpmn.messageRowLabel'), defaultRow: () => ({ id: `Message_${Date.now().toString(36)}`, name: t('properties.bpmn.messageDefaultName') }), columns: [{ key: 'id', label: 'ID' }, { key: 'name', label: t('properties.bpmn.name') }] }),
122
+ propertyEntry({ id: 'signals', type: 'table', label: 'Signals', path: 'resources.signals', rowLabel: t('properties.bpmn.signalRowLabel'), defaultRow: () => ({ id: `Signal_${Date.now().toString(36)}`, name: t('properties.bpmn.signalDefaultName') }), columns: [{ key: 'id', label: 'ID' }, { key: 'name', label: t('properties.bpmn.name') }] }),
123
+ propertyEntry({ id: 'errors', type: 'table', label: 'Errors', path: 'resources.errors', rowLabel: t('properties.bpmn.errorRowLabel'), defaultRow: () => ({ id: `Error_${Date.now().toString(36)}`, name: t('properties.bpmn.errorDefaultName'), errorCode: 'BUSINESS_ERROR' }), columns: [{ key: 'id', label: 'ID' }, { key: 'name', label: t('properties.bpmn.name') }, { key: 'errorCode', label: 'Error Code' }] }),
124
+ propertyEntry({ id: 'escalations', type: 'table', label: 'Escalations', path: 'resources.escalations', rowLabel: t('properties.bpmn.escalationRowLabel'), defaultRow: () => ({ id: `Escalation_${Date.now().toString(36)}`, name: t('properties.bpmn.escalationDefaultName'), escalationCode: 'ESCALATE' }), columns: [{ key: 'id', label: 'ID' }, { key: 'name', label: t('properties.bpmn.name') }, { key: 'escalationCode', label: 'Code' }] }),
120
125
  ],
121
126
  }),
122
127
  propertyGroup({
123
- id: 'namespaces', label: '命名空间', collapsed: true, position: { after: 'global-resources' },
124
- description: '自定义属性 / Extension Element 使用的 XML Namespace。填写前缀时使用 xmlns:company 形式。',
128
+ id: 'namespaces', label: t('properties.bpmn.namespacesGroup'), collapsed: true, position: { after: 'global-resources' },
129
+ description: t('properties.bpmn.namespacesDesc'),
125
130
  entries: [propertyEntry({
126
131
  id: 'namespace-table', type: 'table', label: 'Namespace Declarations',
127
132
  getValue: (ctx) => Object.entries(ctx.model.namespaceDeclarations || {}).map(([name, uri]) => ({ name, uri })),
128
133
  setValue: (ctx, rows) => ctx.designer.updateProcess({ namespaceDeclarations: Object.fromEntries((rows || []).filter((row) => row.name && row.uri).map((row) => [row.name.startsWith('xmlns:') ? row.name : `xmlns:${row.name}`, row.uri])) }),
129
- rowLabel: '命名空间', defaultRow: () => ({ name: 'xmlns:company', uri: 'urn:company:bpmn-extension' }), columns: [{ key: 'name', label: 'Prefix' }, { key: 'uri', label: 'URI' }],
134
+ rowLabel: t('properties.bpmn.namespaceRowLabel'), defaultRow: () => ({ name: 'xmlns:company', uri: 'urn:company:bpmn-extension' }), columns: [{ key: 'name', label: 'Prefix' }, { key: 'uri', label: 'URI' }],
130
135
  })],
131
136
  }),
132
137
  propertyGroup({
133
- id: 'canvas-display', label: '画布显示', position: { after: 'basic' },
138
+ id: 'canvas-display', label: t('properties.bpmn.canvasDisplayGroup'), position: { after: 'basic' },
134
139
  entries: [
135
- propertyEntry({ id: 'show-grid', type: 'switch', label: '显示网格', path: 'settings.showGrid', defaultValue: true }),
136
- propertyEntry({ id: 'grid-size', type: 'range', label: '网格尺寸', path: 'settings.gridSize', defaultValue: 16, min: 8, max: 40, step: 4, unit: 'px' }),
137
- propertyEntry({ id: 'snap-to-grid', type: 'switch', label: '吸附到网格', path: 'settings.snapToGrid', defaultValue: false }),
138
- propertyEntry({ id: 'alignment-guides', type: 'switch', label: '智能对齐辅助线', path: 'settings.alignmentGuides', defaultValue: true, note: '关闭后不再进行磁性对齐,也不显示拖动辅助线。' }),
140
+ propertyEntry({ id: 'show-grid', type: 'switch', label: t('properties.bpmn.showGrid'), path: 'settings.showGrid', defaultValue: true }),
141
+ propertyEntry({ id: 'grid-size', type: 'range', label: t('properties.bpmn.gridSize'), path: 'settings.gridSize', defaultValue: 16, min: 8, max: 40, step: 4, unit: 'px' }),
142
+ propertyEntry({ id: 'snap-to-grid', type: 'switch', label: t('properties.bpmn.snapToGrid'), path: 'settings.snapToGrid', defaultValue: false }),
143
+ propertyEntry({ id: 'alignment-guides', type: 'switch', label: t('properties.bpmn.alignmentGuides'), path: 'settings.alignmentGuides', defaultValue: true, note: t('properties.bpmn.alignmentGuidesNote') }),
139
144
  ],
140
145
  }),
141
146
  propertyGroup({
142
- id: 'nova-layout', label: '布局与连线', position: { after: 'canvas-display' },
147
+ id: 'nova-layout', label: t('properties.bpmn.layoutGroup'), position: { after: 'canvas-display' },
143
148
  entries: [
144
- propertyEntry({ id: 'direction', type: 'select', label: '默认布局方向', path: 'settings.direction', options: [['horizontal', '横向 Left → Right'], ['vertical', '纵向 Top → Bottom']] }),
145
- propertyEntry({ id: 'density', type: 'select', label: '布局紧凑度', path: 'settings.layoutDensity', options: [['compact', '紧凑'], ['balanced', '标准'], ['spacious', '舒展']], note: '影响快捷添加和一键美化的节点间距。' }),
146
- propertyEntry({ id: 'edge-style', type: 'select', label: '默认连线风格', path: 'settings.edgeStyle', options: [['rounded', '圆角折线'], ['smooth', '柔和曲线'], ['straight', '直角折线']] }),
147
- propertyEntry({ id: 'beautify', type: 'action', label: '一键整理全部节点与连线', actionLabel: '一键美化', iconId: 'ui.magic', action: (ctx) => ctx.designer.beautify({ direction: ctx.model.settings?.direction, density: ctx.model.settings?.layoutDensity, edgeStyle: ctx.model.settings?.edgeStyle }) }),
149
+ propertyEntry({ id: 'direction', type: 'select', label: t('properties.bpmn.defaultDirection'), path: 'settings.direction', options: [['horizontal', t('properties.bpmn.directionHorizontal')], ['vertical', t('properties.bpmn.directionVertical')]] }),
150
+ propertyEntry({ id: 'density', type: 'select', label: t('properties.bpmn.layoutDensity'), path: 'settings.layoutDensity', options: [['compact', t('shell.density.compact')], ['balanced', t('shell.density.balanced')], ['spacious', t('shell.density.spacious')]], note: t('properties.bpmn.layoutDensityNote') }),
151
+ propertyEntry({ id: 'edge-style', type: 'select', label: t('properties.bpmn.defaultEdgeStyle'), path: 'settings.edgeStyle', options: [['rounded', t('properties.bpmn.edgeStyleRounded')], ['smooth', t('properties.bpmn.edgeStyleSmooth')], ['straight', t('properties.bpmn.edgeStyleStraight')]] }),
152
+ propertyEntry({ id: 'beautify', type: 'action', label: t('properties.bpmn.beautifyEntryLabel'), actionLabel: t('properties.bpmn.beautifyActionLabel'), iconId: 'ui.magic', action: (ctx) => ctx.designer.beautify({ direction: ctx.model.settings?.direction, density: ctx.model.settings?.layoutDensity, edgeStyle: ctx.model.settings?.edgeStyle }) }),
148
153
  ],
149
154
  }),
150
155
  ];
@@ -156,15 +161,16 @@ const sequenceFlowProvider = {
156
161
  priority: 850,
157
162
  appliesTo: (ctx) => ctx.kind === 'edge' && (ctx.element.type || 'sequenceFlow') === 'sequenceFlow',
158
163
  getGroups(context) {
164
+ const t = (key, params) => resolveI18n(context).t(key, params);
159
165
  const source = context.model.nodes.find((node) => node.id === context.element.source);
160
166
  const sourceDef = NODE_DEFINITIONS[source?.type] || {};
161
167
  return [
162
168
  propertyGroup({
163
- id: 'condition', label: '条件与默认出口', position: { after: 'basic' },
169
+ id: 'condition', label: t('properties.bpmn.conditionGroup'), position: { after: 'basic' },
164
170
  entries: [
165
- propertyEntry({ id: 'condition-expression', type: 'expression', label: '条件表达式', path: 'condition', placeholder: '${amount >= 50000}', note: source?.type === 'parallelGateway' ? '并行网关不会根据条件选择出口;仅供开发者清理历史数据。' : '导出为 bpmn:conditionExpression。', visible: (ctx) => source?.type === 'parallelGateway' ? ctx.profile === 'developer' : sourceDef.kind === 'gateway' || !!context.element.condition }),
171
+ propertyEntry({ id: 'condition-expression', type: 'expression', label: t('properties.bpmn.conditionExpression'), path: 'condition', placeholder: '${amount >= 50000}', note: source?.type === 'parallelGateway' ? t('properties.bpmn.conditionParallelNote') : t('properties.bpmn.conditionDefaultNote'), visible: (ctx) => source?.type === 'parallelGateway' ? ctx.profile === 'developer' : sourceDef.kind === 'gateway' || !!context.element.condition }),
166
172
  propertyEntry({
167
- id: 'default-flow', type: 'switch', label: '默认线路', getValue: (ctx) => !!ctx.element.isDefault,
173
+ id: 'default-flow', type: 'switch', label: t('properties.bpmn.defaultFlow'), getValue: (ctx) => !!ctx.element.isDefault,
168
174
  setValue: (ctx, value) => {
169
175
  const patches = [];
170
176
  if (value) {
@@ -173,17 +179,17 @@ const sequenceFlowProvider = {
173
179
  patches.push({ id: ctx.element.id, patch: { isDefault: !!value } });
174
180
  ctx.designer.updateEdges(patches);
175
181
  },
176
- note: source?.type === 'parallelGateway' ? '并行网关不支持默认出口;仅供开发者清理历史数据。' : '',
182
+ note: source?.type === 'parallelGateway' ? t('properties.bpmn.defaultFlowParallelNote') : '',
177
183
  visible: (ctx) => ['exclusiveGateway', 'inclusiveGateway', 'complexGateway'].includes(source?.type) || (source?.type === 'parallelGateway' && ctx.profile === 'developer'),
178
184
  }),
179
185
  ],
180
186
  }),
181
187
  propertyGroup({
182
- id: 'nova-edge-style', label: '流程图显示', collapsed: true, position: { after: 'condition' },
188
+ id: 'nova-edge-style', label: t('properties.bpmn.edgeStyleGroup'), collapsed: true, position: { after: 'condition' },
183
189
  entries: [
184
- propertyEntry({ id: 'route-style', type: 'select', label: '线路样式', path: 'routeStyle', options: [['rounded', '圆角折线'], ['smooth', '柔和曲线'], ['straight', '直角折线']] }),
185
- propertyEntry({ id: 'corner-radius', type: 'range', label: '圆角半径', path: 'cornerRadius', min: 0, max: 28, step: 1, unit: 'px' }),
186
- propertyEntry({ id: 'reset-route', type: 'action', label: '重算最佳路径', actionLabel: '重算线路', iconId: 'ui.routeSmooth', action: (ctx) => ctx.designer.resetEdgeRoute(ctx.element.id) }),
190
+ propertyEntry({ id: 'route-style', type: 'select', label: t('properties.bpmn.routeStyle'), path: 'routeStyle', options: [['rounded', t('properties.bpmn.edgeStyleRounded')], ['smooth', t('properties.bpmn.edgeStyleSmooth')], ['straight', t('properties.bpmn.edgeStyleStraight')]] }),
191
+ propertyEntry({ id: 'corner-radius', type: 'range', label: t('properties.bpmn.cornerRadius'), path: 'cornerRadius', min: 0, max: 28, step: 1, unit: 'px' }),
192
+ propertyEntry({ id: 'reset-route', type: 'action', label: t('properties.bpmn.resetRouteLabel'), actionLabel: t('properties.bpmn.resetRouteActionLabel'), iconId: 'ui.routeSmooth', action: (ctx) => ctx.designer.resetEdgeRoute(ctx.element.id) }),
187
193
  ],
188
194
  }),
189
195
  ];
@@ -194,12 +200,13 @@ const activityProvider = {
194
200
  id: 'bpmn-activity',
195
201
  priority: 700,
196
202
  appliesTo: (ctx) => ctx.kind === 'node' && activityKinds.has(ctx.definition?.kind),
197
- getGroups() {
203
+ getGroups(context) {
204
+ const t = (key, params) => resolveI18n(context).t(key, params);
198
205
  return [
199
206
  propertyGroup({
200
- id: 'multi-instance', label: '循环 / 多实例', collapsed: true, position: { after: 'basic' },
207
+ id: 'multi-instance', label: t('properties.bpmn.multiInstanceGroup'), collapsed: true, position: { after: 'basic' },
201
208
  entries: [
202
- propertyEntry({ id: 'loop-type', type: 'select', label: '循环类型', path: 'properties.loopType', options: [['none', '无'], ['standard', '标准循环'], ['parallel', '并行多实例'], ['sequential', '串行多实例']] }),
209
+ propertyEntry({ id: 'loop-type', type: 'select', label: t('properties.bpmn.loopType'), path: 'properties.loopType', options: [['none', t('properties.bpmn.loopNone')], ['standard', t('properties.bpmn.loopStandard')], ['parallel', t('properties.bpmn.loopParallel')], ['sequential', t('properties.bpmn.loopSequential')]] }),
203
210
  propertyEntry({ id: 'loop-condition', type: 'expression', label: 'Loop Condition', path: 'properties.loopCondition', placeholder: '${retry == true}', visible: (ctx) => ctx.get('properties.loopType') === 'standard' }),
204
211
  propertyEntry({ id: 'loop-test-before', type: 'switch', label: 'Test Before', path: 'properties.testBefore', visible: (ctx) => ctx.get('properties.loopType') === 'standard' }),
205
212
  propertyEntry({ id: 'loop-maximum', type: 'number', label: 'Loop Maximum', path: 'properties.loopMaximum', min: 0, visible: (ctx) => ctx.get('properties.loopType') === 'standard' }),
@@ -208,7 +215,7 @@ const activityProvider = {
208
215
  propertyEntry({ id: 'element-index-variable', label: 'Element Index Variable', path: 'properties.elementIndexVariable', placeholder: 'index', visible: (ctx) => ['parallel', 'sequential'].includes(ctx.get('properties.loopType')) }),
209
216
  propertyEntry({ id: 'loop-cardinality', type: 'expression', label: 'Loop Cardinality', path: 'properties.loopCardinality', placeholder: '${3}', visible: (ctx) => ['parallel', 'sequential'].includes(ctx.get('properties.loopType')) }),
210
217
  propertyEntry({ id: 'completion-condition', type: 'expression', label: 'Completion Condition', path: 'properties.completionCondition', placeholder: '${nrOfCompletedInstances >= 2}', visible: (ctx) => ['parallel', 'sequential'].includes(ctx.get('properties.loopType')) }),
211
- propertyEntry({ id: 'compensation', type: 'switch', label: '补偿活动', path: 'properties.isForCompensation' }),
218
+ propertyEntry({ id: 'compensation', type: 'switch', label: t('properties.bpmn.isForCompensation'), path: 'properties.isForCompensation' }),
212
219
  ],
213
220
  }),
214
221
  ];
@@ -217,39 +224,46 @@ const activityProvider = {
217
224
 
218
225
  const scriptProvider = {
219
226
  id: 'bpmn-script-task', priority: 720, appliesTo: { kind: 'node', nodeType: 'scriptTask' },
220
- getGroups() { return [propertyGroup({ id: 'script', label: '脚本', position: { after: 'basic' }, entries: [
221
- propertyEntry({ id: 'script-format', label: 'Script Format', path: 'properties.scriptFormat', placeholder: 'javascript / groovy' }),
222
- propertyEntry({ id: 'script-body', type: 'code', label: 'Script', path: 'properties.script', rows: 9, placeholder: '// script body' }),
223
- propertyEntry({ id: 'script-result', label: 'Result Variable', path: 'properties.resultVariable', placeholder: 'result' }),
224
- ] })]; },
227
+ getGroups(context) {
228
+ const t = (key, params) => resolveI18n(context).t(key, params);
229
+ return [propertyGroup({ id: 'script', label: t('properties.bpmn.scriptGroup'), position: { after: 'basic' }, entries: [
230
+ propertyEntry({ id: 'script-format', label: 'Script Format', path: 'properties.scriptFormat', placeholder: 'javascript / groovy' }),
231
+ propertyEntry({ id: 'script-body', type: 'code', label: 'Script', path: 'properties.script', rows: 9, placeholder: '// script body' }),
232
+ propertyEntry({ id: 'script-result', label: 'Result Variable', path: 'properties.resultVariable', placeholder: 'result' }),
233
+ ] })];
234
+ },
225
235
  };
226
236
 
227
237
  const callActivityProvider = {
228
238
  id: 'bpmn-call-activity', priority: 720, appliesTo: { kind: 'node', nodeType: 'callActivity' },
229
- getGroups() { return [propertyGroup({ id: 'call-activity', label: '调用流程', position: { after: 'basic' }, entries: [
230
- propertyEntry({ id: 'called-element', type: 'process-select', label: 'Called Element', path: 'properties.calledElement', placeholder: 'Process_Sub_1', dataProvider: 'processes', allowCustom: true }),
231
- propertyEntry({ id: 'called-business-key', type: 'expression', label: 'Business Key', path: 'properties.businessKey', placeholder: '${businessKey}' }),
232
- propertyEntry({ id: 'inherit-business-key', type: 'switch', label: '继承 Business Key', path: 'properties.inheritBusinessKey' }),
233
- propertyEntry({ id: 'inherit-variables', type: 'switch', label: '继承流程变量', path: 'properties.inheritVariables' }),
234
- propertyEntry({ id: 'input-mapping', type: 'table', label: '输入参数 In', path: 'properties.inParameters', rowLabel: '输入映射', defaultRow: () => ({ source: '', sourceExpression: '', target: '' }), columns: [{ key: 'source', label: 'Source' }, { key: 'sourceExpression', label: 'Expression' }, { key: 'target', label: 'Target' }] }),
235
- propertyEntry({ id: 'output-mapping', type: 'table', label: '输出参数 Out', path: 'properties.outParameters', rowLabel: '输出映射', defaultRow: () => ({ source: '', sourceExpression: '', target: '' }), columns: [{ key: 'source', label: 'Source' }, { key: 'sourceExpression', label: 'Expression' }, { key: 'target', label: 'Target' }] }),
236
- ] })]; },
239
+ getGroups(context) {
240
+ const t = (key, params) => resolveI18n(context).t(key, params);
241
+ return [propertyGroup({ id: 'call-activity', label: t('properties.bpmn.callActivityGroup'), position: { after: 'basic' }, entries: [
242
+ propertyEntry({ id: 'called-element', type: 'process-select', label: 'Called Element', path: 'properties.calledElement', placeholder: 'Process_Sub_1', dataProvider: 'processes', allowCustom: true }),
243
+ propertyEntry({ id: 'called-business-key', type: 'expression', label: 'Business Key', path: 'properties.businessKey', placeholder: '${businessKey}' }),
244
+ propertyEntry({ id: 'inherit-business-key', type: 'switch', label: t('properties.bpmn.inheritBusinessKey'), path: 'properties.inheritBusinessKey' }),
245
+ propertyEntry({ id: 'inherit-variables', type: 'switch', label: t('properties.bpmn.inheritVariables'), path: 'properties.inheritVariables' }),
246
+ propertyEntry({ id: 'input-mapping', type: 'table', label: t('properties.bpmn.inputMapping'), path: 'properties.inParameters', rowLabel: t('properties.bpmn.inputMappingRow'), defaultRow: () => ({ source: '', sourceExpression: '', target: '' }), columns: [{ key: 'source', label: 'Source' }, { key: 'sourceExpression', label: 'Expression' }, { key: 'target', label: 'Target' }] }),
247
+ propertyEntry({ id: 'output-mapping', type: 'table', label: t('properties.bpmn.outputMapping'), path: 'properties.outParameters', rowLabel: t('properties.bpmn.outputMappingRow'), defaultRow: () => ({ source: '', sourceExpression: '', target: '' }), columns: [{ key: 'source', label: 'Source' }, { key: 'sourceExpression', label: 'Expression' }, { key: 'target', label: 'Target' }] }),
248
+ ] })];
249
+ },
237
250
  };
238
251
 
239
252
  const messageTaskProvider = {
240
253
  id: 'bpmn-message-task', priority: 725,
241
254
  appliesTo: (ctx) => ctx.kind === 'node' && ['sendTask', 'receiveTask'].includes(ctx.element.type),
242
255
  getGroups(context) {
256
+ const t = (key, params) => resolveI18n(context).t(key, params);
243
257
  const entries = [
244
258
  propertyEntry({
245
259
  id: 'message-ref', type: 'resource-select', label: 'Message Ref', path: 'properties.messageRef', resource: 'messages', allowCustom: true,
246
260
  options: (ctx) => (ctx.model.resources?.messages || []).map((item) => ({ value: item.id, label: `${item.name || item.id} · ${item.id}` })),
247
- placeholder: '选择或输入 Message ID',
261
+ placeholder: t('properties.bpmn.messageRefPlaceholder'),
248
262
  }),
249
263
  propertyEntry({ id: 'operation-ref', label: 'Operation Ref', path: 'properties.operationRef', placeholder: 'Operation_1' }),
250
264
  ];
251
265
  if (context.element.type === 'receiveTask') entries.push(propertyEntry({ id: 'instantiate-receive', type: 'switch', label: 'Instantiate', path: 'properties.instantiate' }));
252
- return [propertyGroup({ id: 'message-task', label: context.element.type === 'sendTask' ? '消息发送' : '消息接收', position: { after: 'basic' }, entries })];
266
+ return [propertyGroup({ id: 'message-task', label: t(context.element.type === 'sendTask' ? 'properties.bpmn.messageSendGroup' : 'properties.bpmn.messageReceiveGroup'), position: { after: 'basic' }, entries })];
253
267
  },
254
268
  };
255
269
 
@@ -257,6 +271,7 @@ const subProcessProvider = {
257
271
  id: 'bpmn-sub-process', priority: 710,
258
272
  appliesTo: (ctx) => ctx.kind === 'node' && ctx.definition?.kind === 'container',
259
273
  getGroups(context) {
274
+ const t = (key, params) => resolveI18n(context).t(key, params);
260
275
  const entries = [];
261
276
  if (context.element.type === 'eventSubProcess') entries.push(propertyEntry({ id: 'triggered-by-event', type: 'readonly', label: 'Triggered By Event', value: 'true' }));
262
277
  if (context.element.type === 'adHocSubProcess') entries.push(
@@ -265,36 +280,40 @@ const subProcessProvider = {
265
280
  propertyEntry({ id: 'adhoc-cancel', type: 'switch', label: 'Cancel Remaining Instances', path: 'properties.cancelRemainingInstances' }),
266
281
  );
267
282
  if (!entries.length) return [];
268
- return [propertyGroup({ id: 'sub-process', label: '子流程行为', position: { after: 'basic' }, entries })];
283
+ return [propertyGroup({ id: 'sub-process', label: t('properties.bpmn.subProcessGroup'), position: { after: 'basic' }, entries })];
269
284
  },
270
285
  };
271
286
 
272
287
  const gatewayProvider = {
273
288
  id: 'bpmn-gateway', priority: 760, appliesTo: { kind: 'node', elementKind: 'gateway' },
274
289
  getGroups(context) {
275
- const role = resolveGatewayRole(context.model, context.element);
290
+ const i18n = resolveI18n(context);
291
+ const t = (key, params) => i18n.t(key, params);
292
+ const role = resolveGatewayRole(context.model, context.element, { i18n });
276
293
  const isParallel = context.element.type === 'parallelGateway';
277
294
  const entries = [];
278
295
  if (isParallel && context.profile === 'business') entries.push(propertyEntry({
279
- id: 'parallel-role', type: 'select', label: '并行角色', path: 'properties.gatewayDirection',
296
+ id: 'parallel-role', type: 'select', label: t('properties.bpmn.parallelRole'), path: 'properties.gatewayDirection',
280
297
  options: (ctx) => [
281
- ['Unspecified', '自动判断'], ['Diverging', '并行分支'], ['Converging', '并行汇聚'],
282
- ...(ctx.element.properties?.gatewayDirection === 'Mixed' ? [['Mixed', '混合(开发者配置)']] : []),
298
+ ['Unspecified', t('properties.bpmn.parallelRoleAuto')],
299
+ ['Diverging', t('elementTypes.parallelDiverging')],
300
+ ['Converging', t('elementTypes.parallelConverging')],
301
+ ...(ctx.element.properties?.gatewayDirection === 'Mixed' ? [['Mixed', t('properties.bpmn.parallelRoleMixedDev')]] : []),
283
302
  ],
284
- note: role.effective === 'Converging' ? '并行汇聚会等待所有入口到达后再继续。' : '',
303
+ note: role.effective === 'Converging' ? t('properties.bpmn.parallelConvergingNote') : '',
285
304
  }));
286
- if (context.profile === 'developer' || !isParallel) entries.push(propertyEntry({ id: 'gateway-direction', type: 'select', label: 'Gateway Direction', path: 'properties.gatewayDirection', options: [['Unspecified', 'Unspecified'], ['Diverging', 'Diverging / 分支'], ['Converging', 'Converging / 汇聚'], ['Mixed', 'Mixed']] }));
305
+ if (context.profile === 'developer' || !isParallel) entries.push(propertyEntry({ id: 'gateway-direction', type: 'select', label: 'Gateway Direction', path: 'properties.gatewayDirection', options: [['Unspecified', 'Unspecified'], ['Diverging', t('properties.bpmn.gatewayDirectionDiverging')], ['Converging', t('properties.bpmn.gatewayDirectionConverging')], ['Mixed', 'Mixed']] }));
287
306
  if (context.element.type === 'eventBasedGateway') entries.push(
288
307
  propertyEntry({ id: 'instantiate', type: 'switch', label: 'Instantiate', path: 'properties.instantiate' }),
289
308
  propertyEntry({ id: 'event-gateway-type', type: 'select', label: 'Event Gateway Type', path: 'properties.eventGatewayType', options: [['Exclusive', 'Exclusive'], ['Parallel', 'Parallel']] }),
290
309
  );
291
310
  if (context.element.type === 'complexGateway') entries.push(propertyEntry({ id: 'activation-condition', type: 'expression', label: 'Activation Condition', path: 'properties.activationCondition' }));
292
311
  const groups = [];
293
- if (entries.length) groups.push(propertyGroup({ id: 'gateway', label: '网关配置', position: { after: 'basic' }, entries }));
312
+ if (entries.length) groups.push(propertyGroup({ id: 'gateway', label: t('properties.bpmn.gatewayGroup'), position: { after: 'basic' }, entries }));
294
313
  if (!isParallel) {
295
314
  groups.push(propertyGroup({
296
- id: 'gateway-branches', label: `分支线路 · ${role.outgoing.length}`, collapsed: false, position: { after: 'gateway' },
297
- description: '直接在网关面板维护出口名称、条件和默认线路;点击定位可选中对应 Sequence Flow。',
315
+ id: 'gateway-branches', label: t('properties.bpmn.gatewayBranchesGroup', { count: role.outgoing.length }), collapsed: false, position: { after: 'gateway' },
316
+ description: t('properties.bpmn.gatewayBranchesDesc'),
298
317
  entries: [propertyEntry({
299
318
  id: 'branches', type: 'branchList', label: '',
300
319
  getValue: () => role.outgoing.map((edge) => ({ id: edge.id, name: edge.name || '', condition: edge.condition || '', isDefault: !!edge.isDefault, target: edge.target })),
@@ -315,8 +334,8 @@ const gatewayProvider = {
315
334
  let structureAfter = 'gateway';
316
335
  if (role.effective === 'Diverging') {
317
336
  groups.push(propertyGroup({
318
- id: 'gateway-branches', label: `并行出口 · ${role.outgoing.length}`, collapsed: false, position: { after: 'gateway' },
319
- description: '并行分支会同时激活所有出口;可维护线路名称或定位对应 Sequence Flow。',
337
+ id: 'gateway-branches', label: t('properties.bpmn.parallelOutgoingGroup', { count: role.outgoing.length }), collapsed: false, position: { after: 'gateway' },
338
+ description: t('properties.bpmn.parallelOutgoingDesc'),
320
339
  entries: [
321
340
  propertyEntry({
322
341
  id: 'branches', type: 'branchList', label: '', fields: ['name'],
@@ -324,35 +343,34 @@ const gatewayProvider = {
324
343
  setValue: (ctx, rows) => ctx.designer.updateEdges(rows.map((row) => ({ id: row.id, patch: { name: row.name } }))),
325
344
  selectRow: (ctx, row) => ctx.designer.select({ kind: 'edge', id: row.id }),
326
345
  }),
327
- propertyEntry({ id: 'connect-parallel-branch', type: 'action', label: '连接已有节点', actionLabel: '连接并行分支', iconId: 'ui.connect', action: (ctx) => ctx.designer.startConnect(ctx.element.id) }),
346
+ propertyEntry({ id: 'connect-parallel-branch', type: 'action', label: t('properties.bpmn.connectExistingNode'), actionLabel: t('properties.bpmn.connectParallelBranch'), iconId: 'ui.connect', action: (ctx) => ctx.designer.startConnect(ctx.element.id) }),
328
347
  ],
329
348
  }));
330
349
  structureAfter = 'gateway-branches';
331
350
  } else {
332
351
  const isJoin = role.effective === 'Converging';
333
352
  groups.push(propertyGroup({
334
- id: 'parallel-incoming', label: `${isJoin ? '汇聚入口' : '入口线路'} · ${role.incoming.length}`, collapsed: false, position: { after: 'gateway' },
335
- description: isJoin ? '并行汇聚会等待所有入口到达后再继续。' : '当前角色尚未确定,仅展示已有入口线路。',
336
- entries: [propertyEntry({ id: 'incoming-flows', type: 'flow-list', label: '', relation: 'source', emptyText: '当前并行网关没有入口线路', getValue: () => role.incoming })],
353
+ id: 'parallel-incoming', label: t(isJoin ? 'properties.bpmn.parallelJoinIncomingGroup' : 'properties.bpmn.parallelIncomingGroup', { count: role.incoming.length }), collapsed: false, position: { after: 'gateway' },
354
+ description: t(isJoin ? 'properties.bpmn.parallelConvergingNote' : 'properties.bpmn.parallelIncomingAmbiguousDesc'),
355
+ entries: [propertyEntry({ id: 'incoming-flows', type: 'flow-list', label: '', relation: 'source', emptyText: t('properties.bpmn.parallelIncomingEmpty'), getValue: () => role.incoming })],
337
356
  }));
338
357
  groups.push(propertyGroup({
339
- id: 'parallel-outgoing', label: `${isJoin ? '后续出口' : '出口线路'} · ${role.outgoing.length}`, collapsed: false, position: { after: 'parallel-incoming' },
340
- description: isJoin ? '并行汇聚通常只连接一个后续节点。' : '当前角色尚未确定,仅展示已有出口线路。',
358
+ id: 'parallel-outgoing', label: t(isJoin ? 'properties.bpmn.parallelJoinOutgoingGroup' : 'properties.bpmn.parallelOutgoingAmbiguousGroup', { count: role.outgoing.length }), collapsed: false, position: { after: 'parallel-incoming' },
359
+ description: t(isJoin ? 'properties.bpmn.parallelJoinOutgoingDesc' : 'properties.bpmn.parallelOutgoingAmbiguousDesc'),
341
360
  entries: [
342
- propertyEntry({ id: 'outgoing-flows', type: 'flow-list', label: '', relation: 'target', emptyText: '当前并行网关没有出口线路', getValue: () => role.outgoing }),
343
- ...(isJoin && role.outgoing.length === 0 ? [propertyEntry({ id: 'connect-parallel-next', type: 'action', label: '连接后续节点', actionLabel: '连接后续节点', iconId: 'ui.connect', action: (ctx) => ctx.designer.startConnect(ctx.element.id) })] : []),
361
+ propertyEntry({ id: 'outgoing-flows', type: 'flow-list', label: '', relation: 'target', emptyText: t('properties.bpmn.parallelOutgoingEmpty'), getValue: () => role.outgoing }),
362
+ ...(isJoin && role.outgoing.length === 0 ? [propertyEntry({ id: 'connect-parallel-next', type: 'action', label: t('properties.bpmn.connectParallelNext'), actionLabel: t('properties.bpmn.connectParallelNext'), iconId: 'ui.connect', action: (ctx) => ctx.designer.startConnect(ctx.element.id) })] : []),
344
363
  ],
345
364
  }));
346
365
  structureAfter = 'parallel-outgoing';
347
366
  }
348
367
 
349
- const statusLabels = { valid: '结构正常', incomplete: '结构未完成', conflict: '结构冲突', ambiguous: '角色待判断' };
350
368
  groups.push(propertyGroup({
351
- id: 'parallel-structure', label: '结构校验', collapsed: false, position: { after: structureAfter },
369
+ id: 'parallel-structure', label: t('properties.bpmn.parallelStructureGroup'), collapsed: false, position: { after: structureAfter },
352
370
  entries: [
353
- propertyEntry({ id: 'parallel-structure-summary', type: 'readonly', label: '线路结构', value: `${role.incoming.length} 入 · ${role.outgoing.length} 出` }),
354
- propertyEntry({ id: 'parallel-structure-status', type: 'readonly', label: '状态', variant: role.status, value: statusLabels[role.status] }),
355
- ...(role.issues.length ? [propertyEntry({ id: 'parallel-structure-issues', type: 'readonly', label: '提示', variant: role.status, value: role.issues.join(';') })] : []),
371
+ propertyEntry({ id: 'parallel-structure-summary', type: 'readonly', label: t('properties.bpmn.parallelStructureSummaryLabel'), value: t('properties.bpmn.parallelStructureSummaryValue', { incoming: role.incoming.length, outgoing: role.outgoing.length }) }),
372
+ propertyEntry({ id: 'parallel-structure-status', type: 'readonly', label: t('properties.bpmn.parallelStructureStatusLabel'), variant: role.status, value: t(`canvas.gatewayRoleStatus.${role.status}`) }),
373
+ ...(role.issues.length ? [propertyEntry({ id: 'parallel-structure-issues', type: 'readonly', label: t('properties.bpmn.parallelStructureIssuesLabel'), variant: role.status, value: role.issues.join(t('common.issueSeparator')) })] : []),
356
374
  ],
357
375
  }));
358
376
  return groups;
@@ -363,19 +381,20 @@ const eventProvider = {
363
381
  id: 'bpmn-events', priority: 750,
364
382
  appliesTo: (ctx) => ctx.kind === 'node' && ['event', 'boundary'].includes(ctx.definition?.kind),
365
383
  getGroups(context) {
384
+ const t = (key, params) => resolveI18n(context).t(key, params);
366
385
  const def = context.definition;
367
386
  const entries = [];
368
387
  if (def.eventDefinition === 'timer') entries.push(
369
- propertyEntry({ id: 'timer-type', type: 'select', label: '定时类型', path: 'properties.timerType', options: [['duration', 'Duration'], ['date', 'Date'], ['cycle', 'Cycle']] }),
370
- propertyEntry({ id: 'timer-value', type: 'expression', label: '时间表达式', path: 'properties.timerValue', placeholder: 'PT1H / 2026-08-26T09:00 / R3/PT10M' }),
388
+ propertyEntry({ id: 'timer-type', type: 'select', label: t('properties.bpmn.timerType'), path: 'properties.timerType', options: [['duration', 'Duration'], ['date', 'Date'], ['cycle', 'Cycle']] }),
389
+ propertyEntry({ id: 'timer-value', type: 'expression', label: t('properties.bpmn.timerValue'), path: 'properties.timerValue', placeholder: 'PT1H / 2026-08-26T09:00 / R3/PT10M' }),
371
390
  );
372
- if (def.eventDefinition === 'conditional') entries.push(propertyEntry({ id: 'event-condition', type: 'expression', label: '条件表达式', path: 'properties.condition', placeholder: '${approved == true}' }));
391
+ if (def.eventDefinition === 'conditional') entries.push(propertyEntry({ id: 'event-condition', type: 'expression', label: t('properties.bpmn.conditionExpression'), path: 'properties.condition', placeholder: '${approved == true}' }));
373
392
  if (eventRefs[def.eventDefinition]) {
374
393
  const meta = eventRefs[def.eventDefinition];
375
394
  entries.push(propertyEntry({
376
- id: 'event-ref', type: 'resource-select', label: meta.label, path: 'properties.eventRef', resource: meta.resource, allowCustom: true,
395
+ id: 'event-ref', type: 'resource-select', label: t(meta.labelKey), path: 'properties.eventRef', resource: meta.resource, allowCustom: true,
377
396
  options: (ctx) => (ctx.model.resources?.[meta.resource] || []).map((item) => ({ value: item.id, label: `${item.name || item.id} · ${item.id}` })),
378
- placeholder: '选择或输入资源 ID',
397
+ placeholder: t('properties.bpmn.eventRefPlaceholder'),
379
398
  }));
380
399
  }
381
400
  if (def.eventDefinition === 'link') entries.push(propertyEntry({ id: 'link-name', label: 'Link Name', path: 'properties.eventRef', placeholder: 'Link_A' }));
@@ -386,12 +405,12 @@ const eventProvider = {
386
405
  if ((def.eventStage === 'start' || (def.eventStage === 'intermediate' && def.eventRole === 'catch')) && ['message', 'signal'].includes(def.eventDefinition)) {
387
406
  entries.push(propertyEntry({ id: 'parallel-multiple', type: 'switch', label: 'Parallel Multiple', path: 'properties.parallelMultiple' }));
388
407
  }
389
- if (!entries.length) entries.push(propertyEntry({ id: 'event-info', type: 'readonly', label: '事件定义', getValue: () => def.eventDefinition ? def.eventDefinition : 'None' }));
390
- const groups = [propertyGroup({ id: 'event-definition', label: '事件定义', position: { after: 'basic' }, entries })];
408
+ if (!entries.length) entries.push(propertyEntry({ id: 'event-info', type: 'readonly', label: t('properties.bpmn.eventDefinition'), getValue: () => def.eventDefinition ? def.eventDefinition : 'None' }));
409
+ const groups = [propertyGroup({ id: 'event-definition', label: t('properties.bpmn.eventDefinition'), position: { after: 'basic' }, entries })];
391
410
  if (def.kind === 'boundary') groups.push(propertyGroup({
392
- id: 'boundary', label: '边界事件', position: { after: 'event-definition' }, entries: [
393
- propertyEntry({ id: 'attached-to', type: 'node-select', label: '附着到活动', path: 'properties.attachedToRef', nodeFilter: (node) => activityKinds.has(NODE_DEFINITIONS[node.type]?.kind) }),
394
- propertyEntry({ id: 'cancel-activity', type: 'switch', label: '中断主活动', path: 'properties.cancelActivity' }),
411
+ id: 'boundary', label: t('properties.bpmn.boundaryGroup'), position: { after: 'event-definition' }, entries: [
412
+ propertyEntry({ id: 'attached-to', type: 'node-select', label: t('properties.bpmn.attachedToRef'), path: 'properties.attachedToRef', nodeFilter: (node) => activityKinds.has(NODE_DEFINITIONS[node.type]?.kind) }),
413
+ propertyEntry({ id: 'cancel-activity', type: 'switch', label: t('properties.bpmn.cancelActivity'), path: 'properties.cancelActivity' }),
395
414
  ],
396
415
  }));
397
416
  return groups;
@@ -402,60 +421,61 @@ const artifactProvider = {
402
421
  id: 'bpmn-artifacts', priority: 730,
403
422
  appliesTo: (ctx) => ctx.kind === 'node' && ['data', 'dataStore', 'annotation', 'group', 'participant', 'lane'].includes(ctx.definition?.kind),
404
423
  getGroups(context) {
424
+ const t = (key, params) => resolveI18n(context).t(key, params);
405
425
  const type = context.element.type;
406
426
  const entries = [];
407
- if (type === 'textAnnotation') entries.push(propertyEntry({ id: 'annotation-text', type: 'textarea', label: '文本', path: 'properties.text', rows: 6 }), propertyEntry({ id: 'annotation-format', label: 'Text Format', path: 'properties.textFormat', placeholder: 'text/plain' }));
427
+ if (type === 'textAnnotation') entries.push(propertyEntry({ id: 'annotation-text', type: 'textarea', label: t('properties.bpmn.annotationText'), path: 'properties.text', rows: 6 }), propertyEntry({ id: 'annotation-format', label: 'Text Format', path: 'properties.textFormat', placeholder: 'text/plain' }));
408
428
  if (type === 'dataObjectReference') entries.push(propertyEntry({ id: 'data-object-ref', label: 'Data Object Ref', path: 'properties.dataObjectRef' }), propertyEntry({ id: 'data-state', label: 'Data State', path: 'properties.dataState' }));
409
429
  if (type === 'dataStoreReference') entries.push(propertyEntry({ id: 'data-store-ref', label: 'Data Store Ref', path: 'properties.dataStoreRef' }), propertyEntry({ id: 'data-state', label: 'Data State', path: 'properties.dataState' }));
410
430
  if (type === 'participant') entries.push(
411
431
  propertyEntry({
412
- id: 'swimlane-label-placement', type: 'select', label: '标题位置', path: 'properties.swimlaneLabelPlacement', defaultValue: 'side',
413
- options: [['side', '左侧竖排'], ['top', '上方横排']],
414
- note: '挂载到此 Pool 的 Lane 会继承该标题布局。',
432
+ id: 'swimlane-label-placement', type: 'select', label: t('properties.bpmn.swimlaneLabelPlacement'), path: 'properties.swimlaneLabelPlacement', defaultValue: 'side',
433
+ options: [['side', t('properties.bpmn.swimlaneSide')], ['top', t('properties.bpmn.swimlaneTop')]],
434
+ note: t('properties.bpmn.swimlanePoolNote'),
415
435
  }),
416
436
  propertyEntry({ id: 'process-ref', label: 'Process Ref', path: 'properties.processRef' }),
417
437
  );
418
438
  if (type === 'lane') entries.push(
419
439
  context.element.containerId
420
440
  ? propertyEntry({
421
- id: 'swimlane-label-placement-inherited', type: 'readonly', label: '标题位置',
422
- getValue: (ctx) => resolveSwimlaneLabelPlacement(ctx.model, ctx.element) === 'top' ? '上方横排(跟随 Pool)' : '左侧竖排(跟随 Pool)',
423
- note: '挂载 Lane 的标题布局由所属 Pool 统一控制。',
441
+ id: 'swimlane-label-placement-inherited', type: 'readonly', label: t('properties.bpmn.swimlaneLabelPlacement'),
442
+ getValue: (ctx) => resolveI18n(ctx).t(resolveSwimlaneLabelPlacement(ctx.model, ctx.element) === 'top' ? 'properties.bpmn.swimlaneTopInherited' : 'properties.bpmn.swimlaneSideInherited'),
443
+ note: t('properties.bpmn.swimlaneLaneInheritedNote'),
424
444
  })
425
445
  : propertyEntry({
426
- id: 'swimlane-label-placement', type: 'select', label: '标题位置', path: 'properties.swimlaneLabelPlacement', defaultValue: 'side',
427
- options: [['side', '左侧竖排'], ['top', '上方横排']],
428
- note: '该设置仅影响编辑器展示,不写入标准 BPMN XML。',
446
+ id: 'swimlane-label-placement', type: 'select', label: t('properties.bpmn.swimlaneLabelPlacement'), path: 'properties.swimlaneLabelPlacement', defaultValue: 'side',
447
+ options: [['side', t('properties.bpmn.swimlaneSide')], ['top', t('properties.bpmn.swimlaneTop')]],
448
+ note: t('properties.bpmn.swimlaneLaneLocalNote'),
429
449
  }),
430
- propertyEntry({ id: 'lane-members', type: 'node-list', label: '包含节点', getValue: (ctx) => ctx.element.properties?.flowNodeRefs || [], note: '节点拖入 Lane 后可由布局/containment 模块维护;此处用于检查当前引用。' }),
450
+ propertyEntry({ id: 'lane-members', type: 'node-list', label: t('properties.bpmn.laneMembers'), getValue: (ctx) => ctx.element.properties?.flowNodeRefs || [], note: t('properties.bpmn.laneMembersNote') }),
431
451
  );
432
452
  if (type === 'group') entries.push(propertyEntry({ id: 'category-value', label: 'Category Value', path: 'properties.categoryValue', placeholder: context.element.name }));
433
- return entries.length ? [propertyGroup({ id: 'artifact', label: '元素配置', position: { after: 'basic' }, entries })] : [];
453
+ return entries.length ? [propertyGroup({ id: 'artifact', label: t('properties.bpmn.artifactGroup'), position: { after: 'basic' }, entries })] : [];
434
454
  },
435
455
  };
436
456
 
437
-
438
-
439
457
  const nonSequenceEdgeProvider = {
440
458
  id: 'bpmn-non-sequence-edge', priority: 845,
441
459
  appliesTo: (ctx) => ctx.kind === 'edge' && ['messageFlow', 'association'].includes(ctx.element.type),
442
460
  getGroups(context) {
461
+ const t = (key, params) => resolveI18n(context).t(key, params);
443
462
  const entries = context.element.type === 'messageFlow'
444
463
  ? [propertyEntry({
445
464
  id: 'message-flow-ref', type: 'resource-select', label: 'Message Ref', path: 'properties.messageRef', resource: 'messages', allowCustom: true,
446
465
  options: (ctx) => (ctx.model.resources?.messages || []).map((item) => ({ value: item.id, label: `${item.name || item.id} · ${item.id}` })),
447
466
  })]
448
467
  : [propertyEntry({ id: 'association-direction', type: 'select', label: 'Association Direction', path: 'properties.associationDirection', options: [['None', 'None'], ['One', 'One'], ['Both', 'Both']] })];
449
- return [propertyGroup({ id: 'edge-semantics', label: context.element.type === 'messageFlow' ? '消息流' : '关联', position: { after: 'basic' }, entries })];
468
+ return [propertyGroup({ id: 'edge-semantics', label: t(context.element.type === 'messageFlow' ? 'edgeTypes.messageFlow' : 'edgeTypes.association'), position: { after: 'basic' }, entries })];
450
469
  },
451
470
  };
452
471
 
453
472
  const extensionElementsProvider = {
454
473
  id: 'bpmn-extension-elements', priority: 110,
455
474
  getGroups(context) {
475
+ const t = (key, params) => resolveI18n(context).t(key, params);
456
476
  return [propertyGroup({
457
477
  id: 'extension-elements', label: 'Extension Elements', collapsed: true, position: { append: true },
458
- description: '原始扩展 XML 会无损保留。推荐通过 Properties Provider + Engine/Extension serializer 管理结构化扩展;此处适合查看或维护少量未知扩展。',
478
+ description: t('properties.bpmn.extensionElementsDesc'),
459
479
  entries: [propertyEntry({
460
480
  id: 'raw-extension-elements', type: 'table', label: 'Raw XML',
461
481
  getValue: (ctx) => (ctx.get('extensionElements', []) || []).map((xml) => ({ xml })),
@@ -469,15 +489,16 @@ const extensionElementsProvider = {
469
489
  const extensionAttributesProvider = {
470
490
  id: 'bpmn-extension-attributes', priority: 120,
471
491
  getGroups(context) {
492
+ const t = (key, params) => resolveI18n(context).t(key, params);
472
493
  const rootPath = 'properties.extensionAttributes';
473
494
  return [propertyGroup({
474
- id: 'extension-attributes', label: '扩展属性', collapsed: true, position: { append: true },
475
- description: '用于企业自定义 namespace attribute。请同时在 Process 的 namespaceDeclarations 中注册对应 xmlns 前缀。未知 Extension Elements 在导入/导出时仍会保留。',
495
+ id: 'extension-attributes', label: t('properties.bpmn.extensionAttributesGroup'), collapsed: true, position: { append: true },
496
+ description: t('properties.bpmn.extensionAttributesDesc'),
476
497
  entries: [propertyEntry({
477
498
  id: 'extension-attribute-table', type: 'table', label: 'Custom Attributes',
478
499
  getValue: (ctx) => Object.entries(ctx.get(rootPath, {}) || {}).map(([name, value]) => ({ name, value })),
479
500
  setValue: (ctx, rows) => ctx.set(rootPath, Object.fromEntries((rows || []).filter((row) => row.name).map((row) => [row.name, row.value || '']))),
480
- rowLabel: '属性', defaultRow: () => ({ name: 'company:property', value: '' }), columns: [{ key: 'name', label: 'QName' }, { key: 'value', label: 'Value' }],
501
+ rowLabel: t('properties.bpmn.extensionAttributeRow'), defaultRow: () => ({ name: 'company:property', value: '' }), columns: [{ key: 'name', label: 'QName' }, { key: 'value', label: 'Value' }],
481
502
  })],
482
503
  })];
483
504
  },
@@ -486,13 +507,15 @@ const extensionAttributesProvider = {
486
507
  const destructiveActionsProvider = {
487
508
  id: 'bpmn-actions', priority: 20,
488
509
  appliesTo: (ctx) => ctx.kind === 'node' || ctx.kind === 'edge',
489
- getGroups() {
510
+ getGroups(context) {
511
+ const t = (key, params) => resolveI18n(context).t(key, params);
490
512
  return [propertyGroup({
491
- id: 'element-actions', label: '元素操作', collapsed: true, position: { append: true },
492
- entries: [propertyEntry({ id: 'delete-element', type: 'action', label: '删除当前元素', actionLabel: '删除元素', variant: 'danger', action: (ctx) => ctx.studio.commands.remove() })],
513
+ id: 'element-actions', label: t('properties.bpmn.elementActionsGroup'), collapsed: true, position: { append: true },
514
+ entries: [propertyEntry({ id: 'delete-element', type: 'action', label: t('properties.bpmn.deleteElementLabel'), actionLabel: t('properties.bpmn.deleteElementAction'), variant: 'danger', action: (ctx) => ctx.studio.commands.remove() })],
493
515
  })];
494
516
  },
495
517
  };
518
+
496
519
  export const bpmnPropertiesProviders = [
497
520
  basicProvider,
498
521
  processProvider,