@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,43 +1,52 @@
1
+ import { resolveI18n } from '../i18n/index.js';
1
2
  import { propertyEntry, propertyGroup } from '../properties-core/index.js';
2
3
 
3
4
  const activityTypes = new Set(['task', 'userTask', 'manualTask', 'serviceTask', 'scriptTask', 'businessRuleTask', 'sendTask', 'receiveTask', 'callActivity', 'subProcess', 'eventSubProcess', 'transaction', 'adHocSubProcess']);
4
5
  const implementationTypes = [['class', 'Java Class'], ['delegateExpression', 'Delegate Expression'], ['expression', 'Expression']];
5
- const implementationColumns = [
6
- { key: 'event', label: 'Event', type: 'select', options: [['start', 'start'], ['end', 'end'], ['take', 'take']] },
7
- { key: 'implementationType', label: '类型', type: 'select', options: implementationTypes },
8
- { key: 'implementation', label: '实现' },
9
- ];
10
- const taskListenerColumns = [
11
- { key: 'event', label: 'Event', type: 'select', options: [['create', 'create'], ['assignment', 'assignment'], ['complete', 'complete'], ['delete', 'delete'], ['all', 'all']] },
12
- { key: 'implementationType', label: '类型', type: 'select', options: implementationTypes },
13
- { key: 'implementation', label: '实现' },
14
- ];
6
+
7
+ function executionColumns(t, eventOptions = [['start', 'start'], ['end', 'end'], ['take', 'take']]) {
8
+ return [
9
+ { key: 'event', label: 'Event', type: 'select', options: eventOptions },
10
+ { key: 'implementationType', label: t('properties.engine.columnType'), type: 'select', options: implementationTypes },
11
+ { key: 'implementation', label: t('properties.engine.columnImplementation') },
12
+ ];
13
+ }
14
+
15
+ function taskListenerColumns(t) {
16
+ return [
17
+ { key: 'event', label: 'Event', type: 'select', options: [['create', 'create'], ['assignment', 'assignment'], ['complete', 'complete'], ['delete', 'delete'], ['all', 'all']] },
18
+ { key: 'implementationType', label: t('properties.engine.columnType'), type: 'select', options: implementationTypes },
19
+ { key: 'implementation', label: t('properties.engine.columnImplementation') },
20
+ ];
21
+ }
15
22
 
16
23
  const flowableProcessProvider = {
17
24
  id: 'flowable-process', priority: 640, appliesTo: { kind: 'process', engine: 'flowable' },
18
- getGroups() {
25
+ getGroups(context) {
26
+ const t = (key, params) => resolveI18n(context).t(key, params);
19
27
  return [propertyGroup({
20
- id: 'flowable-process-execution', label: 'Flowable 执行监听器', collapsed: true, position: { after: 'global-resources' },
21
- entries: [propertyEntry({ id: 'process-listeners', type: 'table', label: 'Execution Listeners', path: 'properties.executionListeners', rowLabel: '监听器', defaultRow: () => ({ event: 'start', implementationType: 'class', implementation: '' }), columns: implementationColumns.filter((c) => c.key !== 'event' || true) })],
28
+ id: 'flowable-process-execution', label: t('properties.engine.flowableProcessExecutionGroup'), collapsed: true, position: { after: 'global-resources' },
29
+ entries: [propertyEntry({ id: 'process-listeners', type: 'table', label: 'Execution Listeners', path: 'properties.executionListeners', rowLabel: t('properties.engine.listenerRow'), defaultRow: () => ({ event: 'start', implementationType: 'class', implementation: '' }), columns: executionColumns(t) })],
22
30
  })];
23
31
  },
24
32
  };
25
33
 
26
34
  const flowableUserTaskProvider = {
27
35
  id: 'flowable-user-task', priority: 660, appliesTo: { kind: 'node', nodeType: 'userTask', engine: 'flowable' },
28
- getGroups() {
36
+ getGroups(context) {
37
+ const t = (key, params) => resolveI18n(context).t(key, params);
29
38
  return [
30
39
  propertyGroup({
31
- id: 'assignment', label: '人员分配 · Flowable', position: { after: 'basic' },
40
+ id: 'assignment', label: t('properties.engine.flowableAssignmentGroup'), position: { after: 'basic' },
32
41
  entries: [
33
- propertyEntry({ id: 'assignee', type: 'user-select', label: '负责人 Assignee', path: 'properties.assignee', dataProvider: 'identity', allowExpression: true, placeholder: '${manager}' }),
42
+ propertyEntry({ id: 'assignee', type: 'user-select', label: t('properties.engine.assignee'), path: 'properties.assignee', dataProvider: 'identity', allowExpression: true, placeholder: '${manager}' }),
34
43
  propertyEntry({ id: 'owner', type: 'user-select', label: 'Owner', path: 'properties.owner', dataProvider: 'identity', allowExpression: true }),
35
- propertyEntry({ id: 'candidate-users', type: 'tags', label: '候选用户', path: 'properties.candidateUsers', dataProvider: 'identity', placeholder: 'user1,user2' }),
36
- propertyEntry({ id: 'candidate-groups', type: 'tags', label: '候选组', path: 'properties.candidateGroups', dataProvider: 'identity', placeholder: 'manager,finance' }),
44
+ propertyEntry({ id: 'candidate-users', type: 'tags', label: t('properties.engine.candidateUsers'), path: 'properties.candidateUsers', dataProvider: 'identity', placeholder: 'user1,user2' }),
45
+ propertyEntry({ id: 'candidate-groups', type: 'tags', label: t('properties.engine.candidateGroups'), path: 'properties.candidateGroups', dataProvider: 'identity', placeholder: 'manager,finance' }),
37
46
  ],
38
47
  }),
39
48
  propertyGroup({
40
- id: 'task-config', label: '任务属性', position: { after: 'assignment' },
49
+ id: 'task-config', label: t('properties.engine.taskConfigGroup'), position: { after: 'assignment' },
41
50
  entries: [
42
51
  propertyEntry({ id: 'form-key', type: 'form-select', label: 'Form Key', path: 'properties.formKey', dataProvider: 'forms', allowCustom: true }),
43
52
  propertyEntry({ id: 'due-date', type: 'expression', label: 'Due Date', path: 'properties.dueDate', placeholder: '${now().plusDays(1)}' }),
@@ -48,7 +57,7 @@ const flowableUserTaskProvider = {
48
57
  }),
49
58
  propertyGroup({
50
59
  id: 'task-listeners', label: 'Task Listeners', collapsed: true, position: { after: 'multi-instance' },
51
- entries: [propertyEntry({ id: 'task-listener-table', type: 'table', label: '任务监听器', path: 'properties.taskListeners', rowLabel: 'Task Listener', defaultRow: () => ({ event: 'create', implementationType: 'class', implementation: '' }), columns: taskListenerColumns })],
60
+ entries: [propertyEntry({ id: 'task-listener-table', type: 'table', label: t('properties.engine.taskListenersLabel'), path: 'properties.taskListeners', rowLabel: 'Task Listener', defaultRow: () => ({ event: 'create', implementationType: 'class', implementation: '' }), columns: taskListenerColumns(t) })],
52
61
  }),
53
62
  ];
54
63
  },
@@ -58,15 +67,20 @@ const flowableImplementationProvider = {
58
67
  id: 'flowable-implementation', priority: 660,
59
68
  appliesTo: (ctx) => ctx.kind === 'node' && ctx.model.engine === 'flowable' && ['serviceTask', 'sendTask', 'businessRuleTask'].includes(ctx.element.type),
60
69
  getGroups(context) {
61
- const label = context.element.type === 'businessRuleTask' ? '业务规则实现 · Flowable' : context.element.type === 'sendTask' ? '发送实现 · Flowable' : '服务实现 · Flowable';
70
+ const t = (key, params) => resolveI18n(context).t(key, params);
71
+ const label = context.element.type === 'businessRuleTask'
72
+ ? t('properties.engine.flowableRuleImplGroup')
73
+ : context.element.type === 'sendTask'
74
+ ? t('properties.engine.flowableSendImplGroup')
75
+ : t('properties.engine.flowableServiceImplGroup');
62
76
  return [
63
77
  propertyGroup({ id: 'engine-implementation', label, position: { after: 'basic' }, entries: [
64
- propertyEntry({ id: 'implementation-type', type: 'select', label: '实现方式', path: 'properties.implementationType', options: implementationTypes }),
65
- propertyEntry({ id: 'implementation', type: 'expression', label: '实现值', path: 'properties.implementation', placeholder: 'com.example.MyDelegate / ${delegateBean}' }),
78
+ propertyEntry({ id: 'implementation-type', type: 'select', label: t('properties.engine.implementationType'), path: 'properties.implementationType', options: implementationTypes }),
79
+ propertyEntry({ id: 'implementation', type: 'expression', label: t('properties.engine.implementationValue'), path: 'properties.implementation', placeholder: 'com.example.MyDelegate / ${delegateBean}' }),
66
80
  propertyEntry({ id: 'result-variable', label: 'Result Variable', path: 'properties.resultVariable', placeholder: 'result' }),
67
81
  ] }),
68
82
  propertyGroup({ id: 'field-injection', label: 'Field Injection', collapsed: true, position: { after: 'engine-implementation' }, entries: [
69
- propertyEntry({ id: 'fields', type: 'table', label: '字段注入', path: 'properties.fields', rowLabel: 'Field', defaultRow: () => ({ name: '', type: 'string', value: '' }), columns: [{ key: 'name', label: 'Name' }, { key: 'type', label: '类型', type: 'select', options: [['string', 'String'], ['expression', 'Expression']] }, { key: 'value', label: 'Value' }] }),
83
+ propertyEntry({ id: 'fields', type: 'table', label: t('properties.engine.fieldInjectionLabel'), path: 'properties.fields', rowLabel: 'Field', defaultRow: () => ({ name: '', type: 'string', value: '' }), columns: [{ key: 'name', label: 'Name' }, { key: 'type', label: t('properties.engine.columnType'), type: 'select', options: [['string', 'String'], ['expression', 'Expression']] }, { key: 'value', label: 'Value' }] }),
70
84
  ] }),
71
85
  ];
72
86
  },
@@ -75,16 +89,17 @@ const flowableImplementationProvider = {
75
89
  const flowableActivityExecutionProvider = {
76
90
  id: 'flowable-activity-execution', priority: 610,
77
91
  appliesTo: (ctx) => ctx.kind === 'node' && ctx.model.engine === 'flowable' && activityTypes.has(ctx.element.type),
78
- getGroups() {
92
+ getGroups(context) {
93
+ const t = (key, params) => resolveI18n(context).t(key, params);
79
94
  return [
80
- propertyGroup({ id: 'engine-execution', label: '执行配置 · Flowable', collapsed: true, position: { after: 'multi-instance' }, entries: [
95
+ propertyGroup({ id: 'engine-execution', label: t('properties.engine.flowableExecutionGroup'), collapsed: true, position: { after: 'multi-instance' }, entries: [
81
96
  propertyEntry({ id: 'async', type: 'switch', label: 'Async', path: 'properties.async' }),
82
97
  propertyEntry({ id: 'exclusive', type: 'switch', label: 'Exclusive Job', path: 'properties.exclusive' }),
83
98
  propertyEntry({ id: 'async-leave', type: 'switch', label: 'Async Leave', path: 'properties.asyncLeave' }),
84
99
  propertyEntry({ id: 'failed-retry', type: 'expression', label: 'Failed Job Retry Cycle', path: 'properties.failedJobRetryTimeCycle', placeholder: 'R3/PT5M' }),
85
100
  ] }),
86
101
  propertyGroup({ id: 'execution-listeners', label: 'Execution Listeners', collapsed: true, position: { after: 'engine-execution' }, entries: [
87
- propertyEntry({ id: 'execution-listener-table', type: 'table', label: '执行监听器', path: 'properties.executionListeners', rowLabel: 'Execution Listener', defaultRow: () => ({ event: 'start', implementationType: 'class', implementation: '' }), columns: implementationColumns.filter((column) => column.key !== 'event' || true).map((column) => column.key === 'event' ? { ...column, options: [['start', 'start'], ['end', 'end']] } : column) }),
102
+ propertyEntry({ id: 'execution-listener-table', type: 'table', label: t('properties.engine.executionListenersLabel'), path: 'properties.executionListeners', rowLabel: 'Execution Listener', defaultRow: () => ({ event: 'start', implementationType: 'class', implementation: '' }), columns: executionColumns(t, [['start', 'start'], ['end', 'end']]) }),
88
103
  ] }),
89
104
  ];
90
105
  },
@@ -92,18 +107,24 @@ const flowableActivityExecutionProvider = {
92
107
 
93
108
  const flowableCallActivityProvider = {
94
109
  id: 'flowable-call-activity', priority: 650, appliesTo: { kind: 'node', nodeType: 'callActivity', engine: 'flowable' },
95
- getGroups() { return [propertyGroup({ id: 'flowable-call', label: 'Flowable 调用选项', collapsed: true, position: { after: 'call-activity' }, entries: [
96
- propertyEntry({ id: 'same-deployment', type: 'switch', label: 'Same Deployment', path: 'properties.sameDeployment' }),
97
- propertyEntry({ id: 'process-instance-name', type: 'expression', label: 'Process Instance Name', path: 'properties.processInstanceName' }),
98
- ] })]; },
110
+ getGroups(context) {
111
+ const t = (key, params) => resolveI18n(context).t(key, params);
112
+ return [propertyGroup({ id: 'flowable-call', label: t('properties.engine.flowableCallGroup'), collapsed: true, position: { after: 'call-activity' }, entries: [
113
+ propertyEntry({ id: 'same-deployment', type: 'switch', label: 'Same Deployment', path: 'properties.sameDeployment' }),
114
+ propertyEntry({ id: 'process-instance-name', type: 'expression', label: 'Process Instance Name', path: 'properties.processInstanceName' }),
115
+ ] })];
116
+ },
99
117
  };
100
118
 
101
119
  const flowableEdgeProvider = {
102
120
  id: 'flowable-edge-listeners', priority: 620,
103
121
  appliesTo: (ctx) => ctx.kind === 'edge' && ctx.model.engine === 'flowable' && (ctx.element.type || 'sequenceFlow') === 'sequenceFlow',
104
- getGroups() { return [propertyGroup({ id: 'edge-listeners', label: 'Take Listener · Flowable', collapsed: true, position: { after: 'condition' }, entries: [
105
- propertyEntry({ id: 'edge-execution-listeners', type: 'table', label: 'Execution Listeners', path: 'properties.executionListeners', rowLabel: 'Take Listener', defaultRow: () => ({ event: 'take', implementationType: 'class', implementation: '' }), columns: implementationColumns.map((column) => column.key === 'event' ? { ...column, options: [['take', 'take']] } : column) }),
106
- ] })]; },
122
+ getGroups(context) {
123
+ const t = (key, params) => resolveI18n(context).t(key, params);
124
+ return [propertyGroup({ id: 'edge-listeners', label: 'Take Listener · Flowable', collapsed: true, position: { after: 'condition' }, entries: [
125
+ propertyEntry({ id: 'edge-execution-listeners', type: 'table', label: 'Execution Listeners', path: 'properties.executionListeners', rowLabel: 'Take Listener', defaultRow: () => ({ event: 'take', implementationType: 'class', implementation: '' }), columns: executionColumns(t, [['take', 'take']]) }),
126
+ ] })];
127
+ },
107
128
  };
108
129
 
109
130
  export const flowablePropertiesProviders = [flowableProcessProvider, flowableUserTaskProvider, flowableImplementationProvider, flowableActivityExecutionProvider, flowableCallActivityProvider, flowableEdgeProvider];
@@ -1,9 +1,10 @@
1
1
  import type { BpmnEdge, BpmnNode, ElementSelection } from '../core/index.js'
2
+ import type { I18nController, NovaI18nOptions, NovaLocale, NovaLocaleState, NovaMessagesOverride } from '../i18n/index.js'
2
3
  import type { IconRegistry } from '../icons/index.js'
3
4
  import type { PropertiesContext, PropertiesRegistry, PropertiesStudio, PropertyGroup } from '../properties-core/index.js'
4
5
  import type { NovaThemeInput, NovaThemeMode, NovaThemeState, ThemeController } from '../theme/index.js'
5
6
 
6
- export interface PropertiesPanelOptions {
7
+ export interface PropertiesPanelOptions extends NovaI18nOptions {
7
8
  container: HTMLElement
8
9
  registry: PropertiesRegistry
9
10
  studio?: PropertiesStudio | null
@@ -16,8 +17,11 @@ export interface PropertiesPanelOptions {
16
17
  onThemeChange?: ((state: NovaThemeState) => void) | null
17
18
  }
18
19
  export class PropertiesPanel {
20
+ readonly i18n: I18nController
19
21
  constructor(options: PropertiesPanelOptions)
20
22
  render(selection?: ElementSelection | null, element?: BpmnNode | BpmnEdge | null): { groups: PropertyGroup[]; context: PropertiesContext }
23
+ setLocale(locale?: NovaLocale | null, messages?: NovaMessagesOverride | null): NovaLocaleState
24
+ getLocale(): string
21
25
  setTheme(theme: NovaThemeInput): NovaThemeState
22
26
  setThemeMode(mode: NovaThemeMode): NovaThemeState
23
27
  getThemeState(): NovaThemeState
@@ -1,4 +1,5 @@
1
1
  import { NODE_DEFINITIONS } from '../core/index.js';
2
+ import { createI18n, DEFAULT_I18N, resolveI18n } from '../i18n/index.js';
2
3
  import { normalizeOptions } from '../properties-core/index.js';
3
4
  import { createDefaultIconRegistry, hydrateIcons, iconIdForNode } from '../icons/index.js';
4
5
  import { ThemeController } from '../theme/index.js';
@@ -19,19 +20,21 @@ function optionHtml(options, value) {
19
20
  }
20
21
 
21
22
  let selectSeed = 0;
22
- function customSelectHtml(options, value, nativeAttrs, { label = '选择', compact = false, disabled = false } = {}) {
23
+ function customSelectHtml(options, value, nativeAttrs, { label = '', compact = false, disabled = false, i18n = DEFAULT_I18N } = {}) {
24
+ const t = (key, params) => i18n.t(key, params);
25
+ const resolvedLabel = label || t('properties.controls.selectLabel');
23
26
  const normalized = normalizeOptions(options);
24
27
  const selectedValue = String(value ?? '');
25
28
  const selected = normalized.find((option) => String(option.value) === selectedValue);
26
- const selectedLabel = selected?.label ?? normalized[0]?.label ?? '请选择';
29
+ const selectedLabel = selected?.label ?? normalized[0]?.label ?? t('properties.controls.selectPlaceholder');
27
30
  const listboxId = `nova-property-select-${++selectSeed}`;
28
31
  const optionList = normalized.map((option, index) => {
29
32
  const isSelected = String(option.value) === selectedValue;
30
33
  return `<button type="button" class="property-select-option ${isSelected ? 'is-selected' : ''}" role="option" aria-selected="${isSelected ? 'true' : 'false'}" tabindex="-1" data-property-select-option data-option-index="${index}" data-value="${escapeHtml(option.value)}"><span>${escapeHtml(option.label)}</span><span class="nova-icon nova-icon-sm property-select-check" data-icon="ui.check"></span></button>`;
31
34
  }).join('');
32
35
  return `<div class="property-select ${compact ? 'property-select-compact' : ''}" data-property-select>
33
- <button type="button" class="property-select-trigger" data-property-select-trigger aria-label="${escapeHtml(`${label}:${selectedLabel}`)}" aria-haspopup="listbox" aria-expanded="false" aria-controls="${listboxId}" ${disabled ? 'disabled' : ''}><span class="property-select-value">${escapeHtml(selectedLabel)}</span><span class="nova-icon nova-icon-sm property-select-chevron" data-icon="ui.chevron"></span></button>
34
- <div class="property-select-popover" id="${listboxId}" role="listbox" aria-label="${escapeHtml(label)}" hidden>${optionList || '<div class="property-select-empty">暂无选项</div>'}</div>
36
+ <button type="button" class="property-select-trigger" data-property-select-trigger aria-label="${escapeHtml(t('properties.controls.selectAria', { label: resolvedLabel, value: selectedLabel }))}" aria-haspopup="listbox" aria-expanded="false" aria-controls="${listboxId}" ${disabled ? 'disabled' : ''}><span class="property-select-value">${escapeHtml(selectedLabel)}</span><span class="nova-icon nova-icon-sm property-select-chevron" data-icon="ui.chevron"></span></button>
37
+ <div class="property-select-popover" id="${listboxId}" role="listbox" aria-label="${escapeHtml(resolvedLabel)}" hidden>${optionList || `<div class="property-select-empty">${escapeHtml(t('properties.controls.selectEmpty'))}</div>`}</div>
35
38
  <select class="property-select-native" data-property-select-native tabindex="-1" aria-hidden="true" hidden ${nativeAttrs}>${optionHtml(normalized, value)}</select>
36
39
  </div>`;
37
40
  }
@@ -50,6 +53,8 @@ function fieldShell(entry, control, error = null) {
50
53
  }
51
54
 
52
55
  function renderBasicEntry(entry, value, context) {
56
+ const i18n = resolveI18n(context);
57
+ const t = (key, params) => i18n.t(key, params);
53
58
  const attrs = `data-property-input="${escapeHtml(entry.id)}" ${entry.readonly ? 'disabled' : ''}`;
54
59
  const placeholder = entry.placeholder ? `placeholder="${escapeHtml(entry.placeholder)}"` : '';
55
60
  if (entry.type === 'readonly') return fieldShell(entry, `<div class="property-readonly">${escapeHtml(resolveMaybe(entry.getValue ? value : (entry.value ?? value), context) || '—')}</div>`);
@@ -59,20 +64,20 @@ function renderBasicEntry(entry, value, context) {
59
64
  }
60
65
  if (entry.type === 'select') {
61
66
  const options = resolveMaybe(entry.options, context) || [];
62
- return fieldShell(entry, customSelectHtml(options, value, attrs, { label: entry.label, disabled: entry.readonly }));
67
+ return fieldShell(entry, customSelectHtml(options, value, attrs, { label: entry.label, disabled: entry.readonly, i18n }));
63
68
  }
64
69
  if (entry.type === 'switch') {
65
- return fieldShell(entry, `<button type="button" class="property-switch ${value ? 'is-on' : ''}" data-property-switch="${escapeHtml(entry.id)}" aria-pressed="${value ? 'true' : 'false'}"><span></span><strong>${value ? '开启' : '关闭'}</strong></button>`);
70
+ return fieldShell(entry, `<button type="button" class="property-switch ${value ? 'is-on' : ''}" data-property-switch="${escapeHtml(entry.id)}" aria-pressed="${value ? 'true' : 'false'}"><span></span><strong>${escapeHtml(t(value ? 'properties.controls.switchOn' : 'properties.controls.switchOff'))}</strong></button>`);
66
71
  }
67
72
  if (entry.type === 'range') {
68
73
  return fieldShell(entry, `<div class="property-range"><input type="range" min="${entry.min ?? 0}" max="${entry.max ?? 100}" step="${entry.step ?? 1}" value="${Number(value ?? entry.min ?? 0)}" ${attrs}/><span data-range-value="${escapeHtml(entry.id)}">${escapeHtml(valueText(value))}${escapeHtml(entry.unit || '')}</span></div>`);
69
74
  }
70
75
  if (entry.type === 'action') {
71
76
  const actionIcon = entry.iconId ? `<span class="nova-icon nova-icon-sm" data-icon="${escapeHtml(entry.iconId)}"></span>` : '';
72
- return fieldShell(entry, `<button type="button" class="property-action ${entry.variant === 'danger' ? 'is-danger' : ''}" data-property-action="${escapeHtml(entry.id)}">${actionIcon}<span>${escapeHtml(entry.actionLabel || entry.label || '执行')}</span></button>`);
77
+ return fieldShell(entry, `<button type="button" class="property-action ${entry.variant === 'danger' ? 'is-danger' : ''}" data-property-action="${escapeHtml(entry.id)}">${actionIcon}<span>${escapeHtml(entry.actionLabel || entry.label || t('properties.controls.defaultAction'))}</span></button>`);
73
78
  }
74
79
  if (entry.type === 'tags') {
75
- return fieldShell(entry, `<input class="property-control" type="text" value="${escapeHtml(valueText(value))}" ${attrs} ${placeholder}/><div class="property-inline-hint">使用逗号分隔多个值;也可填写表达式。</div>`);
80
+ return fieldShell(entry, `<input class="property-control" type="text" value="${escapeHtml(valueText(value))}" ${attrs} ${placeholder}/><div class="property-inline-hint">${escapeHtml(t('properties.controls.tagsHint'))}</div>`);
76
81
  }
77
82
  if (entry.type === 'number') {
78
83
  return fieldShell(entry, `<input class="property-control" type="number" value="${escapeHtml(valueText(value))}" min="${entry.min ?? ''}" max="${entry.max ?? ''}" step="${entry.step ?? 1}" ${attrs} ${placeholder}/>`);
@@ -81,11 +86,12 @@ function renderBasicEntry(entry, value, context) {
81
86
  }
82
87
 
83
88
  function renderSmartSelect(entry, value, context, panelId) {
89
+ const t = (key, params) => resolveI18n(context).t(key, params);
84
90
  const options = smartOptions(entry, context);
85
91
  const listId = `${panelId}-${entry.id}-list`;
86
92
  const optionList = Array.isArray(options) ? options : [];
87
93
  const datalist = `<datalist id="${escapeHtml(listId)}">${normalizeOptions(optionList).map((option) => `<option value="${escapeHtml(option.value)}">${escapeHtml(option.label)}</option>`).join('')}</datalist>`;
88
- return fieldShell(entry, `<div class="property-smart-select"><input class="property-control" list="${escapeHtml(listId)}" type="text" value="${escapeHtml(valueText(value))}" data-property-input="${escapeHtml(entry.id)}" placeholder="${escapeHtml(entry.placeholder || '选择或输入值')}"/><span class="nova-icon nova-icon-sm property-smart-icon" data-icon="ui.chevron"></span></div>${datalist}`);
94
+ return fieldShell(entry, `<div class="property-smart-select"><input class="property-control" list="${escapeHtml(listId)}" type="text" value="${escapeHtml(valueText(value))}" data-property-input="${escapeHtml(entry.id)}" placeholder="${escapeHtml(entry.placeholder || t('properties.controls.smartSelectPlaceholder'))}"/><span class="nova-icon nova-icon-sm property-smart-icon" data-icon="ui.chevron"></span></div>${datalist}`);
89
95
  }
90
96
 
91
97
  function smartOptions(entry, context) {
@@ -111,75 +117,82 @@ function smartOptions(entry, context) {
111
117
  }
112
118
 
113
119
  function renderNodeList(entry, value, context) {
120
+ const i18n = resolveI18n(context);
121
+ const t = (key, params) => i18n.t(key, params);
114
122
  const rows = (value || []).map((id) => context.model.nodes.find((node) => node.id === id)).filter(Boolean);
115
123
  const content = rows.length ? rows.map((node) => {
116
124
  const definition = NODE_DEFINITIONS[node.type] || NODE_DEFINITIONS.generic;
117
- const label = node.name || definition?.label || node.id;
118
- const typeLabel = definition?.label || node.type || '流程节点';
119
- return `<button type="button" class="property-node-ref" data-node-ref="${escapeHtml(node.id)}" aria-label="${escapeHtml(`定位到节点:${label}`)}">
125
+ const typeLabel = node.type ? i18n.elementTypeLabel(node.type, definition?.label) : t('properties.controls.nodeFallbackType');
126
+ const label = node.name || typeLabel || node.id;
127
+ return `<button type="button" class="property-node-ref" data-node-ref="${escapeHtml(node.id)}" aria-label="${escapeHtml(t('properties.controls.locateNodeAria', { label }))}">
120
128
  <span class="property-node-ref-icon"><span class="nova-icon nova-icon-sm" data-icon="${escapeHtml(iconIdForNode(node.type, definition))}"></span></span>
121
129
  <span class="property-node-ref-copy"><strong title="${escapeHtml(label)}">${escapeHtml(label)}</strong><small title="${escapeHtml(`${typeLabel} · ${node.id}`)}">${escapeHtml(typeLabel)} · ${escapeHtml(node.id)}</small></span>
122
130
  <span class="property-node-ref-locate nova-icon nova-icon-xs" data-icon="ui.locate"></span>
123
131
  </button>`;
124
- }).join('') : '<div class="property-empty-row">暂无节点引用</div>';
132
+ }).join('') : `<div class="property-empty-row">${escapeHtml(t('properties.controls.emptyNodeList'))}</div>`;
125
133
  return fieldShell(entry, `<div class="property-node-list">${content}</div>`);
126
134
  }
127
135
 
128
136
  function renderFlowList(entry, value, context) {
137
+ const t = (key, params) => resolveI18n(context).t(key, params);
129
138
  const rows = Array.isArray(value) ? value : [];
130
139
  const content = rows.length ? rows.map((edge, index) => {
131
140
  const relation = entry.relation === 'target' ? 'target' : 'source';
132
141
  const related = context.model.nodes.find((node) => node.id === edge[relation]);
133
142
  return `<button type="button" class="property-flow-ref" data-flow-ref="${escapeHtml(edge.id)}">
134
143
  <span class="property-flow-index">${index + 1}</span>
135
- <span class="property-flow-copy"><strong>${escapeHtml(related?.name || edge[relation] || '未连接')}</strong><small>${escapeHtml(edge.name || edge.id)}</small></span>
144
+ <span class="property-flow-copy"><strong>${escapeHtml(related?.name || edge[relation] || t('properties.controls.unconnected'))}</strong><small>${escapeHtml(edge.name || edge.id)}</small></span>
136
145
  <span class="nova-icon nova-icon-xs" data-icon="ui.locate"></span>
137
146
  </button>`;
138
- }).join('') : `<div class="property-empty-row">${escapeHtml(entry.emptyText || '暂无线路')}</div>`;
147
+ }).join('') : `<div class="property-empty-row">${escapeHtml(entry.emptyText || t('properties.controls.emptyFlowList'))}</div>`;
139
148
  return fieldShell(entry, `<div class="property-flow-list">${content}</div>`);
140
149
  }
141
150
 
142
- function renderTable(entry, value) {
151
+ function renderTable(entry, value, context = null) {
152
+ const i18n = resolveI18n(context);
153
+ const t = (key, params) => i18n.t(key, params);
143
154
  const rows = Array.isArray(value) ? value : [];
144
155
  const columns = entry.columns || [];
145
156
  const head = columns.map((column) => `<span>${escapeHtml(column.label)}</span>`).join('') + '<span></span>';
157
+ const removeLabel = t('properties.controls.removeRow');
146
158
  const rowHtml = rows.map((row, rowIndex) => {
147
159
  const cells = columns.map((column) => {
148
160
  const cellValue = row?.[column.key] ?? '';
149
- if (column.type === 'select') return customSelectHtml(column.options || [], cellValue, `data-table-input data-table-entry="${escapeHtml(entry.id)}" data-row="${rowIndex}" data-key="${escapeHtml(column.key)}"`, { label: column.label, compact: true });
161
+ if (column.type === 'select') return customSelectHtml(column.options || [], cellValue, `data-table-input data-table-entry="${escapeHtml(entry.id)}" data-row="${rowIndex}" data-key="${escapeHtml(column.key)}"`, { label: column.label, compact: true, i18n });
150
162
  return `<input class="property-table-input" type="text" value="${escapeHtml(cellValue)}" data-table-entry="${escapeHtml(entry.id)}" data-row="${rowIndex}" data-key="${escapeHtml(column.key)}" placeholder="${escapeHtml(column.placeholder || '')}"/>`;
151
163
  }).join('');
152
- return `<div class="property-table-row" style="--property-columns:${Math.max(1, columns.length)}">${cells}<button type="button" class="property-row-remove" data-table-remove="${escapeHtml(entry.id)}" data-row="${rowIndex}" title="删除" aria-label="删除"><span class="nova-icon nova-icon-sm" data-icon="ui.delete"></span></button></div>`;
164
+ return `<div class="property-table-row" style="--property-columns:${Math.max(1, columns.length)}">${cells}<button type="button" class="property-row-remove" data-table-remove="${escapeHtml(entry.id)}" data-row="${rowIndex}" title="${escapeHtml(removeLabel)}" aria-label="${escapeHtml(removeLabel)}"><span class="nova-icon nova-icon-sm" data-icon="ui.delete"></span></button></div>`;
153
165
  }).join('');
154
- return fieldShell(entry, `<div class="property-table"><div class="property-table-head" style="--property-columns:${Math.max(1, columns.length)}">${head}</div>${rowHtml || '<div class="property-empty-row">暂无配置</div>'}<button type="button" class="property-row-add" data-table-add="${escapeHtml(entry.id)}"><span class="nova-icon nova-icon-sm" data-icon="ui.add"></span><span>添加${escapeHtml(entry.rowLabel || '一项')}</span></button></div>`);
166
+ return fieldShell(entry, `<div class="property-table"><div class="property-table-head" style="--property-columns:${Math.max(1, columns.length)}">${head}</div>${rowHtml || `<div class="property-empty-row">${escapeHtml(t('properties.controls.emptyTable'))}</div>`}<button type="button" class="property-row-add" data-table-add="${escapeHtml(entry.id)}"><span class="nova-icon nova-icon-sm" data-icon="ui.add"></span><span>${escapeHtml(t('properties.controls.addRow', { label: entry.rowLabel || t('properties.controls.defaultRowLabel') }))}</span></button></div>`);
155
167
  }
156
168
 
157
169
  function renderBranchList(entry, value, context) {
170
+ const t = (key, params) => resolveI18n(context).t(key, params);
158
171
  const rows = Array.isArray(value) ? value : [];
159
172
  const fields = new Set(entry.fields || ['name', 'condition', 'default']);
160
173
  const html = rows.length ? rows.map((row, index) => {
161
174
  const target = context.model.nodes.find((node) => node.id === row.target);
162
175
  return `<div class="property-branch-card ${row.isDefault ? 'is-default' : ''}" data-branch-index="${index}">
163
176
  <div class="property-branch-head">
164
- <div class="property-branch-identity"><span>${index + 1}</span><div><strong>分支 ${index + 1}</strong><small>Sequence Flow</small></div></div>
165
- <button type="button" class="property-branch-locate" data-branch-select="${index}"><span>定位</span><span class="nova-icon nova-icon-xs" data-icon="ui.locate"></span></button>
177
+ <div class="property-branch-identity"><span>${index + 1}</span><div><strong>${escapeHtml(t('properties.branchList.title', { index: index + 1 }))}</strong><small>Sequence Flow</small></div></div>
178
+ <button type="button" class="property-branch-locate" data-branch-select="${index}"><span>${escapeHtml(t('properties.branchList.locate'))}</span><span class="nova-icon nova-icon-xs" data-icon="ui.locate"></span></button>
166
179
  </div>
167
180
  <div class="property-branch-condition ${fields.size === 1 ? 'is-single-field' : ''}">
168
- ${fields.has('name') ? `<label><span>出口名称</span><input class="property-control" type="text" value="${escapeHtml(row.name || '')}" data-branch-field="name" data-row="${index}" placeholder="例如:采购审批"/></label>` : ''}
169
- ${fields.has('condition') ? `<label><span>条件表达式</span><textarea class="property-control property-expression" rows="2" data-branch-field="condition" data-row="${index}" placeholder="${escapeHtml('${condition}')}">${escapeHtml(row.condition || '')}</textarea></label>` : ''}
181
+ ${fields.has('name') ? `<label><span>${escapeHtml(t('properties.branchList.nameLabel'))}</span><input class="property-control" type="text" value="${escapeHtml(row.name || '')}" data-branch-field="name" data-row="${index}" placeholder="${escapeHtml(t('properties.branchList.namePlaceholder'))}"/></label>` : ''}
182
+ ${fields.has('condition') ? `<label><span>${escapeHtml(t('properties.branchList.conditionLabel'))}</span><textarea class="property-control property-expression" rows="2" data-branch-field="condition" data-row="${index}" placeholder="${escapeHtml('${condition}')}">${escapeHtml(row.condition || '')}</textarea></label>` : ''}
170
183
  </div>
171
184
  <div class="property-branch-foot ${fields.has('default') ? '' : 'is-target-only'}">
172
- ${fields.has('default') ? `<label class="property-branch-default ${row.isDefault ? 'is-active' : ''}"><input type="radio" name="default-branch-${escapeHtml(context.element.id)}" data-branch-default="${index}" ${row.isDefault ? 'checked' : ''}/><i></i><span>默认线路</span></label>` : ''}
173
- <div class="property-branch-target"><small>流向</small><strong>${escapeHtml(target?.name || row.target || '未连接')}</strong><span>→</span></div>
185
+ ${fields.has('default') ? `<label class="property-branch-default ${row.isDefault ? 'is-active' : ''}"><input type="radio" name="default-branch-${escapeHtml(context.element.id)}" data-branch-default="${index}" ${row.isDefault ? 'checked' : ''}/><i></i><span>${escapeHtml(t('properties.branchList.defaultFlow'))}</span></label>` : ''}
186
+ <div class="property-branch-target"><small>${escapeHtml(t('properties.branchList.targetLabel'))}</small><strong>${escapeHtml(target?.name || row.target || t('properties.controls.unconnected'))}</strong><span>→</span></div>
174
187
  </div>
175
188
  </div>`;
176
- }).join('') : '<div class="property-empty-row">当前网关没有出口分支</div>';
189
+ }).join('') : `<div class="property-empty-row">${escapeHtml(t('properties.branchList.empty'))}</div>`;
177
190
  return fieldShell(entry, `<div class="property-branch-list">${html}</div>`);
178
191
  }
179
192
 
180
193
  let panelSeed = 0;
181
194
  export class PropertiesPanel {
182
- constructor({ container, registry, studio = registry?.studio, designer = null, canvas = null, iconRegistry = createDefaultIconRegistry(), emptyText = '请选择元素查看属性', themeController = null, theme = null, onThemeChange = null } = {}) {
195
+ constructor({ container, registry, studio = registry?.studio, designer = null, canvas = null, iconRegistry = createDefaultIconRegistry(), emptyText, themeController = null, theme = null, onThemeChange = null, i18n = null, locale, messages } = {}) {
183
196
  if (!container) throw new Error('PropertiesPanel requires a container.');
184
197
  if (!registry) throw new Error('PropertiesPanel requires a PropertiesRegistry.');
185
198
  this.container = container;
@@ -189,7 +202,24 @@ export class PropertiesPanel {
189
202
  this.canvas = canvas;
190
203
  this.iconRegistry = iconRegistry;
191
204
  this.registry.setStudio(this.studio);
192
- this.emptyText = emptyText;
205
+ if (i18n) {
206
+ this.i18n = resolveI18n(i18n);
207
+ this._ownsI18n = false;
208
+ } else if (locale !== undefined || messages !== undefined) {
209
+ this.i18n = createI18n({ locale, messages });
210
+ this._ownsI18n = true;
211
+ } else if (this.studio?.i18n) {
212
+ this.i18n = this.studio.i18n;
213
+ this._ownsI18n = false;
214
+ } else if (this.registry?.i18n) {
215
+ this.i18n = this.registry.i18n;
216
+ this._ownsI18n = false;
217
+ } else {
218
+ this.i18n = createI18n();
219
+ this._ownsI18n = true;
220
+ }
221
+ this._customEmptyText = emptyText !== undefined ? emptyText : null;
222
+ this.emptyText = emptyText !== undefined ? emptyText : this.i18n.t('properties.empty');
193
223
  this.collapseState = new Map();
194
224
  this.id = `nova-properties-${++panelSeed}`;
195
225
  this.container.classList.add('nova-properties');
@@ -199,17 +229,42 @@ export class PropertiesPanel {
199
229
  this._offStudio = this.studio?.subscribe?.((event) => {
200
230
  if (['selectionChanged', 'modelChanged', 'propertiesProfileChanged'].includes(event.type)) this.render();
201
231
  });
232
+ this._offI18n = typeof this.i18n.subscribe === 'function'
233
+ ? this.i18n.subscribe(() => {
234
+ if (this._customEmptyText === null) this.emptyText = this.i18n.t('properties.empty');
235
+ this.render();
236
+ })
237
+ : null;
202
238
  }
203
239
 
204
240
  destroy() {
205
241
  this._customCleanups.forEach((cleanup) => cleanup?.());
206
242
  this._customCleanups = [];
207
243
  this._offStudio?.();
244
+ this._offI18n?.();
245
+ this._offI18n = null;
208
246
  this.container.innerHTML = '';
209
247
  this.container.classList.remove('nova-properties');
210
248
  if (this._ownsThemeController) this.themeController.destroy();
211
249
  }
212
250
 
251
+ setLocale(locale, messages) {
252
+ if (!this._ownsI18n) {
253
+ this._offI18n?.();
254
+ this.i18n = createI18n({ locale: locale ?? this.i18n.locale, messages });
255
+ this._ownsI18n = true;
256
+ this._offI18n = this.i18n.subscribe(() => {
257
+ if (this._customEmptyText === null) this.emptyText = this.i18n.t('properties.empty');
258
+ this.render();
259
+ });
260
+ if (this._customEmptyText === null) this.emptyText = this.i18n.t('properties.empty');
261
+ this.render();
262
+ return this.i18n.getState();
263
+ }
264
+ return this.i18n.setLocale(locale, messages);
265
+ }
266
+ getLocale() { return this.i18n.locale; }
267
+
213
268
  setTheme(theme) { return this.themeController.setTheme(theme); }
214
269
  setThemeMode(mode) { return this.themeController.setMode(mode); }
215
270
  getThemeState() { return this.themeController.getState(); }
@@ -217,10 +272,11 @@ export class PropertiesPanel {
217
272
  render(selection, element) {
218
273
  this._customCleanups.forEach((cleanup) => cleanup?.());
219
274
  this._customCleanups = [];
220
- const { groups, context } = this.registry.getGroups(selection, element);
275
+ const { groups, context } = this.registry.getGroups(selection, element, { i18n: this.i18n });
221
276
  const header = this._header(context);
222
277
  const groupHtml = groups.map((group) => this._group(group, context)).join('');
223
- const emptyContent = context.kind === 'multi' ? this._multiSummary(context) : `<div class="properties-empty">${escapeHtml(this.emptyText)}</div>`;
278
+ const resolvedEmpty = this._customEmptyText !== null ? this._customEmptyText : this.i18n.t('properties.empty');
279
+ const emptyContent = context.kind === 'multi' ? this._multiSummary(context) : `<div class="properties-empty">${escapeHtml(resolvedEmpty)}</div>`;
224
280
  this.container.innerHTML = `${header}<div class="properties-body">${groupHtml || emptyContent}</div>`;
225
281
  hydrateIcons(this.container, this.iconRegistry);
226
282
  this._bind(groups, context);
@@ -229,35 +285,47 @@ export class PropertiesPanel {
229
285
  }
230
286
 
231
287
  _multiSummary(context) {
232
- const labels = { task: '任务', event: '事件', gateway: '网关', container: '子流程', boundary: '边界事件' };
288
+ const t = (key, params) => resolveI18n(context).t(key, params);
289
+ const labels = {
290
+ task: t('properties.multiSummary.kinds.task'),
291
+ event: t('properties.multiSummary.kinds.event'),
292
+ gateway: t('properties.multiSummary.kinds.gateway'),
293
+ container: t('properties.multiSummary.kinds.container'),
294
+ boundary: t('properties.multiSummary.kinds.boundary'),
295
+ };
233
296
  const counts = new Map();
234
297
  for (const element of context.element || []) {
235
298
  const definition = element?.type ? NODE_DEFINITIONS[element.type] : null;
236
299
  if (!definition) continue;
237
- const label = labels[definition.kind] || '其他';
300
+ const label = labels[definition.kind] || t('properties.multiSummary.kinds.other');
238
301
  counts.set(label, (counts.get(label) || 0) + 1);
239
302
  }
240
303
  const chips = [...counts].map(([label, count]) => `<span>${escapeHtml(label)} <strong>${count}</strong></span>`).join('');
241
304
  return `<section class="properties-multi-summary">
242
305
  <div class="properties-multi-icon"><span class="nova-icon" data-icon="ui.layoutSelection"></span></div>
243
- <strong>批量布局选区</strong>
244
- <p>在画布上使用悬浮工具栏进行对齐、分布和局部美化。</p>
306
+ <strong>${escapeHtml(t('properties.multiSummary.title'))}</strong>
307
+ <p>${escapeHtml(t('properties.multiSummary.description'))}</p>
245
308
  <div class="properties-multi-counts">${chips}</div>
246
- ${this.canvas ? '<button type="button" data-fit-selection><span class="nova-icon nova-icon-sm" data-icon="ui.fitSelection"></span><span>适应选区</span></button>' : ''}
309
+ ${this.canvas ? `<button type="button" data-fit-selection><span class="nova-icon nova-icon-sm" data-icon="ui.fitSelection"></span><span>${escapeHtml(t('properties.multiSummary.fitSelection'))}</span></button>` : ''}
247
310
  </section>`;
248
311
  }
249
312
 
250
313
  _header(context) {
314
+ const i18n = resolveI18n(context);
315
+ const t = (key, params) => i18n.t(key, params);
251
316
  const profile = context.profile || 'business';
252
- const profileSwitch = `<div class="properties-profile-switch" aria-label="属性视图"><button type="button" data-properties-profile="business" class="${profile === 'business' ? 'is-active' : ''}">业务</button><button type="button" data-properties-profile="developer" class="${profile === 'developer' ? 'is-active' : ''}">开发者</button></div>`;
253
- const renderHeader = (title, className = '') => `<div class="properties-head ${className}"><div class="properties-title-row"><div class="properties-title">${escapeHtml(title)}</div>${profileSwitch}</div></div>`;
254
- if (context.kind === 'none') return renderHeader('未选择元素');
255
- if (context.kind === 'multi') return renderHeader(`已选择 ${context.element.length} 个元素`);
317
+ const profileSwitch = `<div class="properties-profile-switch" aria-label="${escapeHtml(t('properties.profileAria'))}"><button type="button" data-properties-profile="business" class="${profile === 'business' ? 'is-active' : ''}">${escapeHtml(t('properties.profiles.business'))}</button><button type="button" data-properties-profile="developer" class="${profile === 'developer' ? 'is-active' : ''}">${escapeHtml(t('properties.profiles.developer'))}</button></div>`;
318
+ const renderHeader = (title, className = '') => {
319
+ if (className === 'properties-head-process') title = t('properties.header.process');
320
+ return `<div class="properties-head ${className}"><div class="properties-title-row"><div class="properties-title">${escapeHtml(title)}</div>${profileSwitch}</div></div>`;
321
+ };
322
+ if (context.kind === 'none') return renderHeader(t('properties.header.none'));
323
+ if (context.kind === 'multi') return renderHeader(t('properties.header.multiSelected', { count: context.element.length }));
256
324
  if (context.kind === 'process') return renderHeader('流程与画布', 'properties-head-process');
257
325
  if (context.kind === 'edge') {
258
- return renderHeader(context.element.name || (context.element.type === 'association' ? '关联' : '流程分支'));
326
+ return renderHeader(context.element.name || t(context.element.type === 'association' ? 'properties.header.association' : 'properties.header.sequenceFlow'));
259
327
  }
260
- return renderHeader(context.element.name || context.definition?.label || '未命名元素');
328
+ return renderHeader(context.element.name || (context.element.type ? i18n.elementTypeLabel(context.element.type, context.definition?.label) : null) || t('properties.header.unnamedElement'));
261
329
  }
262
330
 
263
331
  _group(group, context) {
@@ -277,7 +345,7 @@ export class PropertiesPanel {
277
345
  const error = this.registry.validateEntry(entry, context);
278
346
  const custom = this.registry.components.get(entry.component || entry.type);
279
347
  if (custom) return fieldShell(entry, `<div class="property-custom-host" data-custom-entry="${escapeHtml(entry.id)}"></div>`, error);
280
- if (entry.type === 'table') return renderTable(entry, value);
348
+ if (entry.type === 'table') return renderTable(entry, value, context);
281
349
  if (entry.type === 'branchList') return renderBranchList(entry, value, context);
282
350
  if (entry.type === 'flow-list') return renderFlowList(entry, value, context);
283
351
  if (entry.type === 'node-list') return renderNodeList(entry, value, context);
@@ -1,4 +1,5 @@
1
1
  import type { AlignmentGuide, BpmnEdge, BpmnNode, ElementSelection, Point, ProcessModel, SelectionRect } from '../core/index.js'
2
+ import type { I18nController, NovaI18nOptions, NovaLocale, NovaLocaleState, NovaMessagesOverride } from '../i18n/index.js'
2
3
  import type { IconRegistry, NodeVisualResolution } from '../icons/index.js'
3
4
  import type { NodeRuntimePresentation, ProcessInstanceSnapshot, RuntimePresentation } from '../runtime/index.js'
4
5
  import type { NovaThemeInput, NovaThemeMode, NovaThemeState, RuntimeAppearanceResolver, ThemeController } from '../theme/index.js'
@@ -70,7 +71,7 @@ export interface DiagramNodeRendererContext {
70
71
  renderSemanticIcon(target?: Element, options?: { className?: string; title?: string }): SVGSVGElement | null
71
72
  }
72
73
  export type DiagramNodeRenderer = (context: DiagramNodeRendererContext) => void | (() => void)
73
- export interface DiagramRendererOptions {
74
+ export interface DiagramRendererOptions extends NovaI18nOptions {
74
75
  model?: ProcessModel
75
76
  mode?: 'design' | 'viewer' | 'instance'
76
77
  runtime?: ProcessInstanceSnapshot | null
@@ -78,7 +79,7 @@ export interface DiagramRendererOptions {
78
79
  nodeRenderers?: Record<string, DiagramNodeRenderer>
79
80
  nodeRenderer?: DiagramNodeRenderer
80
81
  nodeSubtitleResolver?: NodeSubtitleResolver
81
- runtimePresenter?: (context: { model: ProcessModel; runtime: ProcessInstanceSnapshot | null; appearance: RuntimeAppearanceResolver | null }) => RuntimePresentation
82
+ runtimePresenter?: (context: { model: ProcessModel; runtime: ProcessInstanceSnapshot | null; appearance: RuntimeAppearanceResolver | null; i18n?: I18nController }) => RuntimePresentation
82
83
  runtimeAppearance?: RuntimeAppearanceResolver | null
83
84
  svgExport?: SvgExportOptions & { label?: string; nodeRenderers?: Record<string, SvgNodeRenderer> }
84
85
  themeController?: ThemeController
@@ -93,6 +94,7 @@ export interface DiagramRendererOptions {
93
94
  [key: string]: unknown
94
95
  }
95
96
  export class DiagramRenderer {
97
+ readonly i18n: I18nController
96
98
  constructor(container: HTMLElement, options?: DiagramRendererOptions)
97
99
  model: ProcessModel
98
100
  screenToWorld(clientX: number, clientY: number): Point
@@ -110,6 +112,8 @@ export class DiagramRenderer {
110
112
  setInteractionMode(mode: string): void
111
113
  getViewportState(): { zoom: number; pan: Point }
112
114
  setViewportState(state: { zoom?: number; pan?: Point }): void
115
+ setLocale(locale?: NovaLocale | null, messages?: NovaMessagesOverride | null): NovaLocaleState
116
+ getLocale(): string
113
117
  setTheme(theme: NovaThemeInput): NovaThemeState
114
118
  setThemeMode(mode: NovaThemeMode): NovaThemeState
115
119
  getThemeState(): NovaThemeState