@bpmn-nova/studio 0.3.8-preview → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/canvas.js +97 -25
- package/dist/config.js +42 -0
- package/dist/context-menu.js +41 -32
- package/dist/controller.js +45 -19
- package/dist/index.d.ts +59 -2
- package/dist/index.js +1 -0
- package/dist/interactions.js +6 -1
- package/dist/modules/bpmn-model/index.d.ts +2 -1
- package/dist/modules/bpmn-model/index.js +12 -10
- package/dist/modules/core/gateway.js +16 -13
- package/dist/modules/core/index.d.ts +6 -4
- package/dist/modules/core/model.js +12 -7
- package/dist/modules/designer/index.d.ts +5 -1
- package/dist/modules/designer/index.js +36 -15
- package/dist/modules/export-svg/index.d.ts +12 -5
- package/dist/modules/export-svg/preview.js +34 -24
- package/dist/modules/export-svg/render.js +102 -50
- package/dist/modules/i18n/index.d.ts +647 -0
- package/dist/modules/i18n/index.js +247 -0
- package/dist/modules/i18n/locales/en-US.js +823 -0
- package/dist/modules/i18n/locales/zh-CN.js +805 -0
- package/dist/modules/node-presentation/index.d.ts +3 -2
- package/dist/modules/node-presentation/index.js +14 -11
- package/dist/modules/palette/index.d.ts +6 -1
- package/dist/modules/palette/index.js +26 -8
- package/dist/modules/palette/panel.js +44 -6
- package/dist/modules/properties/index.d.ts +2 -1
- package/dist/modules/properties/index.js +2 -2
- package/dist/modules/properties-activiti/index.js +84 -59
- package/dist/modules/properties-bpmn/index.js +151 -128
- package/dist/modules/properties-core/index.d.ts +9 -3
- package/dist/modules/properties-core/index.js +16 -4
- package/dist/modules/properties-flowable/index.js +55 -34
- package/dist/modules/properties-renderer/index.d.ts +5 -1
- package/dist/modules/properties-renderer/index.js +110 -42
- package/dist/modules/renderer-svg/index.d.ts +6 -2
- package/dist/modules/renderer-svg/index.js +113 -38
- package/dist/modules/runtime/index.d.ts +33 -5
- package/dist/modules/runtime/index.js +97 -73
- package/dist/modules/runtime/time.js +89 -4
- package/dist/modules/runtime/visits.js +6 -4
- package/dist/modules/theme/index.d.ts +5 -2
- package/dist/modules/theme/index.js +8 -4
- package/dist/modules/viewer/index.d.ts +28 -7
- package/dist/modules/viewer/index.js +213 -56
- package/dist/modules/viewer/runtime-content.js +26 -20
- package/dist/modules/viewer/runtime-trace.js +43 -25
- package/dist/modules/viewer/timeline.js +103 -36
- package/dist/shell.js +279 -75
- package/dist/sidebars.js +3 -1
- package/dist/styles.css +6 -3
- package/llms-full.txt +296 -49
- package/llms.txt +4 -4
- package/package.json +2 -3
package/dist/shell.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createDefaultPaletteRegistry, PalettePanel } from './modules/palette/in
|
|
|
3
3
|
import { createDefaultPropertiesRegistry, PropertiesPanel } from './modules/properties/index.js';
|
|
4
4
|
import { BpmnViewer } from './modules/viewer/index.js';
|
|
5
5
|
import { ThemeController } from './modules/theme/index.js';
|
|
6
|
+
import { createI18n, resolveI18n } from './modules/i18n/index.js';
|
|
6
7
|
import { openSvgExportPreview } from './modules/export-svg/index.js';
|
|
7
8
|
import { BpmnCanvas } from './canvas.js';
|
|
8
9
|
import { StudioSidebars } from './sidebars.js';
|
|
@@ -54,9 +55,9 @@ function sameConfigValue(left, right) {
|
|
|
54
55
|
|
|
55
56
|
const STUDIO_MODES = ['design', 'viewer', 'instance'];
|
|
56
57
|
const STUDIO_MODE_OPTIONS = Object.freeze([
|
|
57
|
-
Object.freeze({ value: 'design',
|
|
58
|
-
Object.freeze({ value: 'viewer',
|
|
59
|
-
Object.freeze({ value: 'instance',
|
|
58
|
+
Object.freeze({ value: 'design', labelKey: 'shell.modes.design', iconId: 'ui.design' }),
|
|
59
|
+
Object.freeze({ value: 'viewer', labelKey: 'shell.modes.viewer', iconId: 'ui.preview' }),
|
|
60
|
+
Object.freeze({ value: 'instance', labelKey: 'shell.modes.instance', iconId: 'ui.trace' }),
|
|
60
61
|
]);
|
|
61
62
|
const STUDIO_SHELL_REGIONS = ['header', 'left', 'right', 'footer'];
|
|
62
63
|
|
|
@@ -96,10 +97,15 @@ export class BpmnStudioShell {
|
|
|
96
97
|
timeline,
|
|
97
98
|
runtimeDetails,
|
|
98
99
|
runtimeTraceOptions,
|
|
100
|
+
formatRuntimeTime,
|
|
101
|
+
runtimeTimeFormat,
|
|
99
102
|
theme = null,
|
|
100
103
|
runtimeAppearance = null,
|
|
101
104
|
svgExport = null,
|
|
102
105
|
onThemeChange = null,
|
|
106
|
+
i18n = null,
|
|
107
|
+
locale,
|
|
108
|
+
messages,
|
|
103
109
|
} = options;
|
|
104
110
|
if (!container || !studio) throw new Error('BpmnStudioShell requires container and studio.');
|
|
105
111
|
const configuredRegions = regions !== null && regions !== undefined
|
|
@@ -107,16 +113,36 @@ export class BpmnStudioShell {
|
|
|
107
113
|
if (typeof layout === 'function' && configuredRegions) {
|
|
108
114
|
throw new Error('BpmnStudioShell options "layout" and "regions" cannot be used together.');
|
|
109
115
|
}
|
|
116
|
+
const hasExplicitLocale = locale !== undefined || messages !== undefined;
|
|
117
|
+
if (i18n) {
|
|
118
|
+
this._ownsI18n = false;
|
|
119
|
+
this._sharesStudioI18n = Boolean(studio?.i18n && i18n === studio.i18n);
|
|
120
|
+
this.i18n = resolveI18n(i18n);
|
|
121
|
+
} else if (studio?.i18n) {
|
|
122
|
+
this._ownsI18n = false;
|
|
123
|
+
this._sharesStudioI18n = true;
|
|
124
|
+
this.i18n = resolveI18n(studio.i18n);
|
|
125
|
+
if (hasExplicitLocale) {
|
|
126
|
+
if (typeof studio.setLocale === 'function') studio.setLocale(locale, messages);
|
|
127
|
+
else this.i18n.setLocale(locale, messages);
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
this._ownsI18n = true;
|
|
131
|
+
this._sharesStudioI18n = false;
|
|
132
|
+
this.i18n = createI18n({ locale, messages });
|
|
133
|
+
}
|
|
110
134
|
const fallbackConfig = {
|
|
111
135
|
viewer: {
|
|
112
136
|
timeline: rendererOptions.timeline,
|
|
113
137
|
runtimeDetails: rendererOptions.runtimeDetails,
|
|
114
138
|
runtimeTraceOptions: rendererOptions.runtimeTraceOptions,
|
|
139
|
+
formatRuntimeTime: rendererOptions.formatRuntimeTime,
|
|
140
|
+
runtimeTimeFormat: rendererOptions.runtimeTimeFormat,
|
|
115
141
|
},
|
|
116
142
|
export: rendererOptions.svgExport,
|
|
117
143
|
};
|
|
118
144
|
const legacyConfig = {};
|
|
119
|
-
for (const name of ['regions', 'leftWidth', 'rightWidth', 'responsive', 'projectionOptions', 'timeline', 'runtimeDetails', 'runtimeTraceOptions', 'svgExport']) {
|
|
145
|
+
for (const name of ['regions', 'leftWidth', 'rightWidth', 'responsive', 'projectionOptions', 'timeline', 'runtimeDetails', 'runtimeTraceOptions', 'formatRuntimeTime', 'runtimeTimeFormat', 'svgExport']) {
|
|
120
146
|
if (Object.prototype.hasOwnProperty.call(options, name)) legacyConfig[name] = options[name];
|
|
121
147
|
}
|
|
122
148
|
const normalizedConfig = normalizeStudioConfig(config, { fallback: fallbackConfig, legacy: legacyConfig });
|
|
@@ -139,6 +165,8 @@ export class BpmnStudioShell {
|
|
|
139
165
|
timeline: resolvedViewer.timeline,
|
|
140
166
|
runtimeDetails: resolvedViewer.runtimeDetails,
|
|
141
167
|
runtimeTraceOptions: resolvedViewer.runtimeTraceOptions,
|
|
168
|
+
formatRuntimeTime: resolvedViewer.formatRuntimeTime,
|
|
169
|
+
runtimeTimeFormat: resolvedViewer.runtimeTimeFormat,
|
|
142
170
|
},
|
|
143
171
|
slots,
|
|
144
172
|
runtime,
|
|
@@ -159,7 +187,7 @@ export class BpmnStudioShell {
|
|
|
159
187
|
_controlMetrics: resolveStudioControlMetrics(resolvedUi.controlSize),
|
|
160
188
|
});
|
|
161
189
|
this.ui = createStudioUiContext(() => this._controlMetrics);
|
|
162
|
-
this.propertiesRegistry = propertiesRegistry || createDefaultPropertiesRegistry({ studio });
|
|
190
|
+
this.propertiesRegistry = propertiesRegistry || createDefaultPropertiesRegistry({ studio, i18n: this.i18n });
|
|
163
191
|
this.interactions = createInteractionController({ studio, templates: templateRegistry });
|
|
164
192
|
this._cleanups = [];
|
|
165
193
|
this._instances = [];
|
|
@@ -196,6 +224,9 @@ export class BpmnStudioShell {
|
|
|
196
224
|
const context = {
|
|
197
225
|
studio,
|
|
198
226
|
shell: this,
|
|
227
|
+
i18n: this.i18n,
|
|
228
|
+
getLocale: () => this.getLocale(),
|
|
229
|
+
setLocale: (nextLocale, nextMessages) => this.setLocale(nextLocale, nextMessages),
|
|
199
230
|
actions: this.actions,
|
|
200
231
|
ui: this.ui,
|
|
201
232
|
getState: () => this.studio.getState(),
|
|
@@ -230,7 +261,25 @@ export class BpmnStudioShell {
|
|
|
230
261
|
this._recordCleanup(this.studio.subscribe((event) => {
|
|
231
262
|
if (['selectionChanged', 'modelChanged', 'scopeChanged'].includes(event.type)) this._updatePanelSelection();
|
|
232
263
|
}));
|
|
264
|
+
this._recordCleanup(this.i18n.subscribe(() => this._syncLocaleChrome()));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
_t(key, params) {
|
|
269
|
+
return this.i18n.t(key, params);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
setLocale(locale, messages) {
|
|
273
|
+
if (this._sharesStudioI18n && typeof this.studio?.setLocale === 'function') {
|
|
274
|
+
this.studio.setLocale(locale, messages);
|
|
275
|
+
} else {
|
|
276
|
+
this.i18n.setLocale(locale, messages);
|
|
233
277
|
}
|
|
278
|
+
return this.getLocale();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
getLocale() {
|
|
282
|
+
return this.i18n.getState();
|
|
234
283
|
}
|
|
235
284
|
|
|
236
285
|
_buildDefault(context, mount) {
|
|
@@ -242,10 +291,10 @@ export class BpmnStudioShell {
|
|
|
242
291
|
brandCopy.append(node('strong', '', 'BPMN Nova'), node('span', '', this.studio.model.name));
|
|
243
292
|
brand.append(brandMark, brandCopy);
|
|
244
293
|
const modeSwitch = node('nav', 'nova-studio-mode-switch');
|
|
245
|
-
modeSwitch.setAttribute('aria-label', '
|
|
294
|
+
modeSwitch.setAttribute('aria-label', this._t('shell.modeAria'));
|
|
246
295
|
const modeButtons = new Map();
|
|
247
296
|
const projectionSwitch = node('nav', 'nova-studio-projection-switch is-hidden');
|
|
248
|
-
projectionSwitch.setAttribute('aria-label', '
|
|
297
|
+
projectionSwitch.setAttribute('aria-label', this._t('shell.projectionAria'));
|
|
249
298
|
const projectionButtons = new Map();
|
|
250
299
|
const centerControls = node('div', 'nova-studio-center-controls');
|
|
251
300
|
centerControls.append(modeSwitch, projectionSwitch);
|
|
@@ -258,52 +307,60 @@ export class BpmnStudioShell {
|
|
|
258
307
|
};
|
|
259
308
|
|
|
260
309
|
const divider = () => tools.appendChild(node('span', 'nova-studio-tool-divider'));
|
|
261
|
-
const undo = tool('', '
|
|
262
|
-
const redo = tool('', '
|
|
310
|
+
const undo = tool('', this._t('shell.tools.undo'), () => this.actions.undo(), 'is-icon', 'ui.undo');
|
|
311
|
+
const redo = tool('', this._t('shell.tools.redo'), () => this.actions.redo(), 'is-icon', 'ui.redo');
|
|
263
312
|
divider();
|
|
264
313
|
const beautifySplit = node('div', 'nova-studio-beautify-split');
|
|
265
314
|
const beautifyButton = node('button', 'nova-studio-tool nova-studio-beautify is-magic');
|
|
266
315
|
beautifyButton.type = 'button';
|
|
267
|
-
beautifyButton.title = '
|
|
268
|
-
|
|
316
|
+
beautifyButton.title = this._t('shell.tools.beautifyTitle');
|
|
317
|
+
const beautifyButtonLabel = node('span', '', this._t('shell.tools.beautify'));
|
|
318
|
+
beautifyButton.append(iconNode('ui.magic'), beautifyButtonLabel);
|
|
269
319
|
beautifyButton.addEventListener('click', () => this._runBeautify());
|
|
270
320
|
const beautifyCaret = node('button', 'nova-studio-tool nova-studio-beautify-caret is-magic');
|
|
271
321
|
beautifyCaret.type = 'button';
|
|
272
|
-
beautifyCaret.title = '
|
|
322
|
+
beautifyCaret.title = this._t('shell.tools.beautifyStrategyTitle');
|
|
273
323
|
beautifyCaret.appendChild(iconNode('ui.chevron', 'nova-icon nova-icon-xs'));
|
|
274
324
|
const beautifyMenu = node('div', 'nova-studio-beautify-menu is-hidden');
|
|
275
|
-
|
|
325
|
+
const beautifyMenuTitle = node('div', 'nova-studio-beautify-title', this._t('shell.tools.beautifyMenuTitle'));
|
|
326
|
+
beautifyMenu.append(beautifyMenuTitle);
|
|
276
327
|
const density = node('div', 'nova-studio-density');
|
|
328
|
+
const densityButtons = new Map();
|
|
277
329
|
for (const item of [
|
|
278
|
-
{ value: 'compact',
|
|
279
|
-
{ value: 'balanced',
|
|
280
|
-
{ value: 'spacious',
|
|
330
|
+
{ value: 'compact', labelKey: 'shell.density.compact' },
|
|
331
|
+
{ value: 'balanced', labelKey: 'shell.density.balanced' },
|
|
332
|
+
{ value: 'spacious', labelKey: 'shell.density.spacious' },
|
|
281
333
|
]) {
|
|
282
|
-
const button = node('button', '', item.
|
|
334
|
+
const button = node('button', '', this._t(item.labelKey));
|
|
283
335
|
button.type = 'button';
|
|
284
336
|
button.setAttribute('data-density', item.value);
|
|
285
337
|
button.addEventListener('click', () => {
|
|
286
338
|
this.studio.commands.updateProcess({ settings: { layoutDensity: item.value } });
|
|
287
339
|
this._syncDensityButtons();
|
|
288
340
|
});
|
|
341
|
+
densityButtons.set(item.value, { button, labelKey: item.labelKey });
|
|
289
342
|
density.appendChild(button);
|
|
290
343
|
}
|
|
291
344
|
beautifyMenu.appendChild(density);
|
|
292
345
|
const actionList = node('div', 'nova-studio-beautify-actions');
|
|
346
|
+
const beautifyActionRefs = [];
|
|
293
347
|
for (const item of [
|
|
294
|
-
{ value: 'horizontal', iconId: 'ui.layoutHorizontal',
|
|
295
|
-
{ value: 'vertical', iconId: 'ui.layoutVertical',
|
|
296
|
-
{ value: 'routing', iconId: 'ui.routeRounded',
|
|
297
|
-
{ value: 'smooth', iconId: 'ui.routeSmooth',
|
|
348
|
+
{ value: 'horizontal', iconId: 'ui.layoutHorizontal', labelKey: 'shell.beautifyActions.horizontal', hintKey: 'shell.beautifyActions.horizontalHint' },
|
|
349
|
+
{ value: 'vertical', iconId: 'ui.layoutVertical', labelKey: 'shell.beautifyActions.vertical', hintKey: 'shell.beautifyActions.verticalHint' },
|
|
350
|
+
{ value: 'routing', iconId: 'ui.routeRounded', labelKey: 'shell.beautifyActions.routing', hintKey: 'shell.beautifyActions.routingHint' },
|
|
351
|
+
{ value: 'smooth', iconId: 'ui.routeSmooth', labelKey: 'shell.beautifyActions.smooth', hintKey: 'shell.beautifyActions.smoothHint' },
|
|
298
352
|
]) {
|
|
299
353
|
const button = node('button', 'nova-studio-beautify-action');
|
|
300
354
|
button.type = 'button';
|
|
301
355
|
button.setAttribute('data-beautify', item.value);
|
|
302
|
-
|
|
356
|
+
const strong = node('strong', '', this._t(item.labelKey));
|
|
357
|
+
const small = node('small', '', this._t(item.hintKey));
|
|
358
|
+
button.append(iconNode(item.iconId, 'nova-icon nova-studio-beautify-action-icon'), strong, small);
|
|
303
359
|
button.addEventListener('click', () => {
|
|
304
360
|
this._runBeautify(item.value);
|
|
305
361
|
beautifyMenu.classList.add('is-hidden');
|
|
306
362
|
});
|
|
363
|
+
beautifyActionRefs.push({ strong, small, labelKey: item.labelKey, hintKey: item.hintKey });
|
|
307
364
|
actionList.appendChild(button);
|
|
308
365
|
}
|
|
309
366
|
beautifyMenu.appendChild(actionList);
|
|
@@ -318,24 +375,33 @@ export class BpmnStudioShell {
|
|
|
318
375
|
let validateButton = null;
|
|
319
376
|
let importButton = null;
|
|
320
377
|
let exportMenu = null;
|
|
378
|
+
let exportButton = null;
|
|
379
|
+
let exportButtonLabel = null;
|
|
321
380
|
let exportPopover = null;
|
|
381
|
+
let exportSvgStrong = null;
|
|
382
|
+
let exportSvgSmall = null;
|
|
322
383
|
let exportBpmnButton = null;
|
|
384
|
+
let exportBpmnStrong = null;
|
|
385
|
+
let exportBpmnSmall = null;
|
|
323
386
|
if (!this.slots.headerActions) {
|
|
324
387
|
const importInput = node('input', 'nova-studio-import-input');
|
|
325
388
|
importInput.type = 'file';
|
|
326
389
|
importInput.accept = '.bpmn,.xml,.bpmn20.xml,text/xml,application/xml';
|
|
327
390
|
importInput.hidden = true;
|
|
328
|
-
validateButton = tool('
|
|
329
|
-
importButton = tool('
|
|
391
|
+
validateButton = tool(this._t('shell.tools.validate'), this._t('shell.tools.validateTitle'), () => this.actions.validate(), 'nova-studio-validate', null, headerActions);
|
|
392
|
+
importButton = tool(this._t('shell.tools.import'), this._t('shell.tools.importTitle'), () => importInput.click(), 'nova-studio-import', null, headerActions);
|
|
330
393
|
exportMenu = node('div', 'nova-studio-export-menu');
|
|
331
|
-
|
|
394
|
+
exportButton = node('button', 'nova-studio-tool nova-studio-export is-primary');
|
|
332
395
|
exportButton.type = 'button';
|
|
333
|
-
exportButton.title = '
|
|
334
|
-
|
|
396
|
+
exportButton.title = this._t('shell.tools.exportTitle');
|
|
397
|
+
exportButtonLabel = node('span', '', this._t('shell.tools.export'));
|
|
398
|
+
exportButton.append(exportButtonLabel, iconNode('ui.chevron', 'nova-icon nova-icon-xs'));
|
|
335
399
|
exportPopover = node('div', 'nova-studio-export-popover is-hidden');
|
|
336
400
|
const exportSvgButton = node('button', 'nova-studio-export-option');
|
|
337
401
|
exportSvgButton.type = 'button';
|
|
338
|
-
|
|
402
|
+
exportSvgStrong = node('strong', '', this._t('shell.tools.exportSvg'));
|
|
403
|
+
exportSvgSmall = node('small', '', this._t('shell.tools.exportSvgHint'));
|
|
404
|
+
exportSvgButton.append(iconNode('ui.preview'), exportSvgStrong, exportSvgSmall);
|
|
339
405
|
exportSvgButton.addEventListener('click', () => {
|
|
340
406
|
exportPopover.classList.add('is-hidden');
|
|
341
407
|
exportButton.focus({ preventScroll: true });
|
|
@@ -343,7 +409,9 @@ export class BpmnStudioShell {
|
|
|
343
409
|
});
|
|
344
410
|
exportBpmnButton = node('button', 'nova-studio-export-option');
|
|
345
411
|
exportBpmnButton.type = 'button';
|
|
346
|
-
|
|
412
|
+
exportBpmnStrong = node('strong', '', this._t('shell.tools.exportBpmn'));
|
|
413
|
+
exportBpmnSmall = node('small', '', this._t('shell.tools.exportBpmnHint'));
|
|
414
|
+
exportBpmnButton.append(iconNode('ui.design'), exportBpmnStrong, exportBpmnSmall);
|
|
347
415
|
exportBpmnButton.addEventListener('click', () => {
|
|
348
416
|
exportPopover.classList.add('is-hidden');
|
|
349
417
|
this._exportBpmn();
|
|
@@ -360,10 +428,10 @@ export class BpmnStudioShell {
|
|
|
360
428
|
if (!file) return;
|
|
361
429
|
try {
|
|
362
430
|
this.actions.importXml(await file.text(), this.studio.model.engine);
|
|
363
|
-
this._setStatus('
|
|
431
|
+
this._setStatus(this._t('shell.status.importedBpmn'), 'ok');
|
|
364
432
|
requestAnimationFrame(() => this._fitActive());
|
|
365
433
|
} catch (error) {
|
|
366
|
-
this._setStatus(
|
|
434
|
+
this._setStatus(this._t('shell.status.importFailed', { message: error.message }), 'error');
|
|
367
435
|
} finally {
|
|
368
436
|
importInput.value = '';
|
|
369
437
|
}
|
|
@@ -379,20 +447,22 @@ export class BpmnStudioShell {
|
|
|
379
447
|
const canvasHost = node('main', 'nova-studio-canvas');
|
|
380
448
|
const floatingHead = node('div', 'nova-studio-canvas-floating-head');
|
|
381
449
|
const editingMode = node('strong', 'nova-studio-editing-mode');
|
|
382
|
-
|
|
450
|
+
const editingModeLabel = node('span', 'nova-studio-editing-mode-label', this._t('shell.canvasHead.editingMode'));
|
|
451
|
+
editingMode.append(iconNode('ui.design', 'nova-icon nova-icon-xs'), editingModeLabel);
|
|
383
452
|
const scopeBack = node('button', 'nova-studio-scope-back');
|
|
384
453
|
scopeBack.type = 'button';
|
|
385
454
|
scopeBack.hidden = true;
|
|
386
|
-
|
|
455
|
+
const scopeBackLabel = node('span', '', this._t('shell.canvasHead.back'));
|
|
456
|
+
scopeBack.append(iconNode('ui.leaveScope', 'nova-icon nova-icon-sm'), scopeBackLabel);
|
|
387
457
|
scopeBack.addEventListener('click', () => this.studio.leaveScope());
|
|
388
458
|
const scopeNav = node('nav', 'nova-studio-scope-nav');
|
|
389
|
-
scopeNav.setAttribute('aria-label', '
|
|
459
|
+
scopeNav.setAttribute('aria-label', this._t('shell.canvasHead.scopeNavAria'));
|
|
390
460
|
floatingHead.append(editingMode, scopeBack, scopeNav);
|
|
391
461
|
canvasStage.append(canvasHost, floatingHead);
|
|
392
462
|
const statusbar = node('footer', 'nova-studio-statusbar');
|
|
393
463
|
const statusLeft = node('div', 'nova-studio-status-left');
|
|
394
464
|
this._statusDot = node('i', 'is-ok');
|
|
395
|
-
this._statusText = node('span', '', '
|
|
465
|
+
this._statusText = node('span', '', this._t('shell.status.ready'));
|
|
396
466
|
statusLeft.append(this._statusDot, this._statusText);
|
|
397
467
|
const viewportTools = node('div', 'nova-studio-viewport-tools');
|
|
398
468
|
const viewportTool = (label, title, action, className = '', iconId = null) => {
|
|
@@ -401,13 +471,13 @@ export class BpmnStudioShell {
|
|
|
401
471
|
if (label) button.appendChild(node('span', '', label));
|
|
402
472
|
button.addEventListener('click', action); viewportTools.appendChild(button); return button;
|
|
403
473
|
};
|
|
404
|
-
viewportTool('', '
|
|
474
|
+
const zoomOutBtn = viewportTool('', this._t('shell.viewport.zoomOut'), () => this._zoomActive(0.9), '', 'ui.zoomOut');
|
|
405
475
|
this._zoomText = node('span', 'nova-studio-zoom-text', '100%');
|
|
406
476
|
viewportTools.appendChild(this._zoomText);
|
|
407
|
-
viewportTool('', '
|
|
477
|
+
const zoomInBtn = viewportTool('', this._t('shell.viewport.zoomIn'), () => this._zoomActive(1.1), '', 'ui.zoomIn');
|
|
408
478
|
viewportTools.appendChild(node('span', 'nova-studio-status-divider'));
|
|
409
|
-
viewportTool('1:1', '
|
|
410
|
-
viewportTool('', '
|
|
479
|
+
const actualSizeBtn = viewportTool('1:1', this._t('shell.viewport.actualSize'), () => this._actualSize(), 'is-text');
|
|
480
|
+
const fitViewBtn = viewportTool('', this._t('shell.viewport.fitView'), () => this._fitActive(), 'is-fit', 'ui.fitView');
|
|
411
481
|
statusbar.append(statusLeft, viewportTools);
|
|
412
482
|
canvasColumn.append(canvasStage, statusbar);
|
|
413
483
|
const right = node('aside', 'nova-studio-right');
|
|
@@ -418,6 +488,30 @@ export class BpmnStudioShell {
|
|
|
418
488
|
body.append(left, canvasColumn, right);
|
|
419
489
|
this.container.append(header, body);
|
|
420
490
|
hydrateIcons(this.container, this.iconRegistry);
|
|
491
|
+
this._localeRefs = {
|
|
492
|
+
undo,
|
|
493
|
+
redo,
|
|
494
|
+
beautifyButton,
|
|
495
|
+
beautifyButtonLabel,
|
|
496
|
+
beautifyCaret,
|
|
497
|
+
beautifyMenuTitle,
|
|
498
|
+
densityButtons,
|
|
499
|
+
beautifyActionRefs,
|
|
500
|
+
validateButton,
|
|
501
|
+
importButton,
|
|
502
|
+
exportButton,
|
|
503
|
+
exportButtonLabel,
|
|
504
|
+
exportSvgStrong,
|
|
505
|
+
exportSvgSmall,
|
|
506
|
+
exportBpmnStrong,
|
|
507
|
+
exportBpmnSmall,
|
|
508
|
+
editingModeLabel,
|
|
509
|
+
scopeBackLabel,
|
|
510
|
+
zoomOutBtn,
|
|
511
|
+
zoomInBtn,
|
|
512
|
+
actualSizeBtn,
|
|
513
|
+
fitViewBtn,
|
|
514
|
+
};
|
|
421
515
|
Object.assign(this, {
|
|
422
516
|
_header: header,
|
|
423
517
|
_headerStart: brand,
|
|
@@ -431,6 +525,7 @@ export class BpmnStudioShell {
|
|
|
431
525
|
_footer: statusbar,
|
|
432
526
|
_canvasHost: canvasHost,
|
|
433
527
|
_floatingHead: floatingHead,
|
|
528
|
+
_editingMode: editingMode,
|
|
434
529
|
_scopeBack: scopeBack,
|
|
435
530
|
_scopeNav: scopeNav,
|
|
436
531
|
_modeButtons: modeButtons,
|
|
@@ -485,19 +580,19 @@ export class BpmnStudioShell {
|
|
|
485
580
|
if (this.viewer) this.viewer.setModel(this.studio.model);
|
|
486
581
|
this._syncDensityButtons();
|
|
487
582
|
const graph = this.studio.getActiveGraph();
|
|
488
|
-
this._setStatus(
|
|
583
|
+
this._setStatus(this._t('shell.status.graphSummary', { nodes: graph.nodes.length, edges: graph.edges.length }), 'ok');
|
|
489
584
|
}
|
|
490
585
|
if (event.type === 'scopeChanged' || event.type === 'modelChanged') this._renderScopePath();
|
|
491
586
|
if (event.type === 'scopeChanged') {
|
|
492
587
|
const graph = this.studio.getActiveGraph();
|
|
493
|
-
this._setStatus(
|
|
588
|
+
this._setStatus(this._t('shell.status.graphSummary', { nodes: graph.nodes.length, edges: graph.edges.length }), 'ok');
|
|
494
589
|
}
|
|
495
590
|
});
|
|
496
591
|
this._cleanups.push(this._offState);
|
|
497
592
|
undo.disabled = !this.studio.history.canUndo;
|
|
498
593
|
redo.disabled = !this.studio.history.canRedo;
|
|
499
594
|
const initialGraph = this.studio.getActiveGraph();
|
|
500
|
-
this._setStatus(
|
|
595
|
+
this._setStatus(this._t('shell.status.graphSummary', { nodes: initialGraph.nodes.length, edges: initialGraph.edges.length }), 'ok');
|
|
501
596
|
const closeBeautify = (event) => {
|
|
502
597
|
if (!beautifySplit.contains(event.target)) beautifyMenu.classList.add('is-hidden');
|
|
503
598
|
if (exportMenu && !exportMenu.contains(event.target)) exportPopover.classList.add('is-hidden');
|
|
@@ -508,15 +603,79 @@ export class BpmnStudioShell {
|
|
|
508
603
|
this._setMode(this.mode, { force: true, emit: false });
|
|
509
604
|
}
|
|
510
605
|
|
|
606
|
+
_syncLocaleChrome() {
|
|
607
|
+
if (this._destroyed) return;
|
|
608
|
+
const refs = this._localeRefs;
|
|
609
|
+
if (this._modeSwitch) this._modeSwitch.setAttribute('aria-label', this._t('shell.modeAria'));
|
|
610
|
+
if (this._projectionSwitch) this._projectionSwitch.setAttribute('aria-label', this._t('shell.projectionAria'));
|
|
611
|
+
if (refs) {
|
|
612
|
+
if (refs.undo) refs.undo.title = this._t('shell.tools.undo');
|
|
613
|
+
if (refs.redo) refs.redo.title = this._t('shell.tools.redo');
|
|
614
|
+
if (refs.beautifyButton) refs.beautifyButton.title = this._t('shell.tools.beautifyTitle');
|
|
615
|
+
if (refs.beautifyButtonLabel) refs.beautifyButtonLabel.textContent = this._t('shell.tools.beautify');
|
|
616
|
+
if (refs.beautifyCaret) refs.beautifyCaret.title = this._t('shell.tools.beautifyStrategyTitle');
|
|
617
|
+
if (refs.beautifyMenuTitle) refs.beautifyMenuTitle.textContent = this._t('shell.tools.beautifyMenuTitle');
|
|
618
|
+
refs.densityButtons?.forEach(({ button, labelKey }) => { button.textContent = this._t(labelKey); });
|
|
619
|
+
refs.beautifyActionRefs?.forEach(({ strong, small, labelKey, hintKey }) => {
|
|
620
|
+
strong.textContent = this._t(labelKey);
|
|
621
|
+
small.textContent = this._t(hintKey);
|
|
622
|
+
});
|
|
623
|
+
if (refs.validateButton) {
|
|
624
|
+
refs.validateButton.title = this._t('shell.tools.validateTitle');
|
|
625
|
+
const span = refs.validateButton.querySelector('span');
|
|
626
|
+
if (span) span.textContent = this._t('shell.tools.validate');
|
|
627
|
+
}
|
|
628
|
+
if (refs.importButton) {
|
|
629
|
+
refs.importButton.title = this._t('shell.tools.importTitle');
|
|
630
|
+
const span = refs.importButton.querySelector('span');
|
|
631
|
+
if (span) span.textContent = this._t('shell.tools.import');
|
|
632
|
+
}
|
|
633
|
+
if (refs.exportButton) refs.exportButton.title = this._t('shell.tools.exportTitle');
|
|
634
|
+
if (refs.exportButtonLabel) refs.exportButtonLabel.textContent = this._t('shell.tools.export');
|
|
635
|
+
if (refs.exportSvgStrong) refs.exportSvgStrong.textContent = this._t('shell.tools.exportSvg');
|
|
636
|
+
if (refs.exportSvgSmall) refs.exportSvgSmall.textContent = this._t('shell.tools.exportSvgHint');
|
|
637
|
+
if (refs.exportBpmnStrong) refs.exportBpmnStrong.textContent = this._t('shell.tools.exportBpmn');
|
|
638
|
+
if (refs.exportBpmnSmall) refs.exportBpmnSmall.textContent = this._t('shell.tools.exportBpmnHint');
|
|
639
|
+
if (refs.editingModeLabel) refs.editingModeLabel.textContent = this._t('shell.canvasHead.editingMode');
|
|
640
|
+
if (refs.scopeBackLabel) refs.scopeBackLabel.textContent = this._t('shell.canvasHead.back');
|
|
641
|
+
if (refs.zoomOutBtn) refs.zoomOutBtn.title = this._t('shell.viewport.zoomOut');
|
|
642
|
+
if (refs.zoomInBtn) refs.zoomInBtn.title = this._t('shell.viewport.zoomIn');
|
|
643
|
+
if (refs.actualSizeBtn) refs.actualSizeBtn.title = this._t('shell.viewport.actualSize');
|
|
644
|
+
if (refs.fitViewBtn) refs.fitViewBtn.title = this._t('shell.viewport.fitView');
|
|
645
|
+
}
|
|
646
|
+
if (this._scopeNav) this._scopeNav.setAttribute('aria-label', this._t('shell.canvasHead.scopeNavAria'));
|
|
647
|
+
this._rebuildModeButtons();
|
|
648
|
+
this._rebuildProjectionButtons();
|
|
649
|
+
this._renderScopePath();
|
|
650
|
+
this._syncProjectionChrome();
|
|
651
|
+
this._sidebars?.apply({ animate: false });
|
|
652
|
+
if (this.mode !== 'design') this._renderReadonlyDetails(this._readonlyPanelDetails());
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
_syncCanvasHead() {
|
|
656
|
+
if (!this._floatingHead) return;
|
|
657
|
+
const { editingMode, scopePath } = this._config.ui.canvasHead;
|
|
658
|
+
const path = this.studio.getState().scopePath || [];
|
|
659
|
+
const nested = path.length > 1;
|
|
660
|
+
const showScopePath = scopePath === 'always' || nested;
|
|
661
|
+
if (this._editingMode) this._editingMode.hidden = !editingMode;
|
|
662
|
+
if (this._scopeNav) this._scopeNav.hidden = !showScopePath;
|
|
663
|
+
// With nothing to show the head takes no space and no pointer events.
|
|
664
|
+
this._floatingHead.hidden = !editingMode && !showScopePath;
|
|
665
|
+
}
|
|
666
|
+
|
|
511
667
|
_renderScopePath() {
|
|
512
668
|
if (!this._scopeNav) return;
|
|
513
669
|
this._scopeNav.replaceChildren();
|
|
514
670
|
const path = this.studio.getState().scopePath || [];
|
|
515
671
|
const parent = path.length > 1 ? path[path.length - 2] : null;
|
|
672
|
+
this._syncCanvasHead();
|
|
516
673
|
this._scopeBack.hidden = !parent;
|
|
517
674
|
if (parent) {
|
|
518
|
-
this.
|
|
519
|
-
this._scopeBack.
|
|
675
|
+
const backLabel = this._t('shell.canvasHead.backToParent', { name: parent.name });
|
|
676
|
+
this._scopeBack.title = backLabel;
|
|
677
|
+
if (backLabel === `返回上一级:${parent.name}`) this._scopeBack.setAttribute('aria-label', `返回上一级:${parent.name}`);
|
|
678
|
+
else this._scopeBack.setAttribute('aria-label', backLabel);
|
|
520
679
|
} else {
|
|
521
680
|
this._scopeBack.removeAttribute('title');
|
|
522
681
|
this._scopeBack.removeAttribute('aria-label');
|
|
@@ -536,7 +695,7 @@ export class BpmnStudioShell {
|
|
|
536
695
|
}
|
|
537
696
|
const button = node('button', `nova-studio-scope-ancestor${index === 0 ? ' is-root' : ''}`, item.name);
|
|
538
697
|
button.type = 'button';
|
|
539
|
-
button.title =
|
|
698
|
+
button.title = this._t('shell.canvasHead.backToScope', { name: item.name });
|
|
540
699
|
button.addEventListener('click', () => this.studio.navigateToScope(item.id));
|
|
541
700
|
this._scopeNav.appendChild(button);
|
|
542
701
|
});
|
|
@@ -564,15 +723,20 @@ export class BpmnStudioShell {
|
|
|
564
723
|
if (!this._modeSwitch) return;
|
|
565
724
|
this._modeSwitch.replaceChildren();
|
|
566
725
|
this._modeButtons = new Map();
|
|
726
|
+
// A switch with a single option has nothing to switch to, so it is not rendered.
|
|
727
|
+
const single = this.allowedModes.length <= 1;
|
|
728
|
+
this._modeSwitch.classList.toggle('is-hidden', single);
|
|
729
|
+
if (single) return;
|
|
567
730
|
for (const item of STUDIO_MODE_OPTIONS.filter(({ value }) => this.allowedModes.includes(value))) {
|
|
731
|
+
const label = this._t(item.labelKey);
|
|
568
732
|
const button = node('button');
|
|
569
733
|
const active = item.value === this.mode;
|
|
570
734
|
button.type = 'button';
|
|
571
735
|
button.setAttribute('data-mode', item.value);
|
|
572
|
-
button.setAttribute('aria-label',
|
|
736
|
+
button.setAttribute('aria-label', this._t('shell.modeSwitchTo', { label }));
|
|
573
737
|
button.setAttribute('aria-pressed', String(active));
|
|
574
738
|
button.classList.toggle('is-active', active);
|
|
575
|
-
button.append(iconNode(item.iconId, 'nova-icon nova-icon-xs'), node('span', '',
|
|
739
|
+
button.append(iconNode(item.iconId, 'nova-icon nova-icon-xs'), node('span', '', label));
|
|
576
740
|
button.addEventListener('click', () => this.setMode(item.value, 'toolbar'));
|
|
577
741
|
this._modeButtons.set(item.value, button);
|
|
578
742
|
this._modeSwitch.appendChild(button);
|
|
@@ -584,9 +748,10 @@ export class BpmnStudioShell {
|
|
|
584
748
|
if (!this._projectionSwitch) return;
|
|
585
749
|
this._projectionSwitch.replaceChildren();
|
|
586
750
|
this._projectionButtons = new Map();
|
|
751
|
+
// Default zh-CN projection labels: 实际路径 / 完整 BPMN
|
|
587
752
|
const options = this.projectionOptions || [
|
|
588
|
-
{ value: this.responsive ? 'auto' : 'approval', label: '
|
|
589
|
-
{ value: 'standard', label: '
|
|
753
|
+
{ value: this.responsive ? 'auto' : 'approval', label: this._t('shell.projections.approval') },
|
|
754
|
+
{ value: 'standard', label: this._t('shell.projections.standard') },
|
|
590
755
|
];
|
|
591
756
|
for (const item of options) {
|
|
592
757
|
const button = node('button', '', item.label);
|
|
@@ -610,6 +775,7 @@ export class BpmnStudioShell {
|
|
|
610
775
|
this._body?.classList.toggle('is-readonly', readonly);
|
|
611
776
|
this._applyRegions({ fit: false });
|
|
612
777
|
this._floatingHead?.classList.toggle('is-hidden', readonly);
|
|
778
|
+
this._syncCanvasHead();
|
|
613
779
|
this._designControls?.forEach((control) => control.classList.toggle('is-hidden-by-mode', readonly));
|
|
614
780
|
this._projectionSwitch?.classList.toggle('is-hidden', this.mode !== 'instance');
|
|
615
781
|
this._exportBpmnButton?.classList.toggle('is-hidden', this.mode !== 'design');
|
|
@@ -623,11 +789,15 @@ export class BpmnStudioShell {
|
|
|
623
789
|
this._viewportTools?.classList.toggle('is-hidden', timeline);
|
|
624
790
|
if (this.mode === 'design') {
|
|
625
791
|
const graph = this.studio.getActiveGraph();
|
|
626
|
-
this._setStatus(
|
|
627
|
-
} else if (this.mode === 'viewer') this._setStatus('
|
|
792
|
+
this._setStatus(this._t('shell.status.graphSummary', { nodes: graph.nodes.length, edges: graph.edges.length }), 'ok');
|
|
793
|
+
} else if (this.mode === 'viewer') this._setStatus(this._t('shell.status.viewerReadonly'), 'ok');
|
|
628
794
|
else {
|
|
629
795
|
const active = this.viewer?.activeProjection || this.projection;
|
|
630
|
-
const status = active === 'compact'
|
|
796
|
+
const status = active === 'compact'
|
|
797
|
+
? this._t('shell.status.traceTimeline')
|
|
798
|
+
: active === 'standard'
|
|
799
|
+
? this._t('shell.status.traceStandard')
|
|
800
|
+
: this._t('shell.status.traceApproval');
|
|
631
801
|
this._setStatus(status, 'ok');
|
|
632
802
|
}
|
|
633
803
|
}
|
|
@@ -657,6 +827,7 @@ export class BpmnStudioShell {
|
|
|
657
827
|
viewer = new BpmnViewer({
|
|
658
828
|
container,
|
|
659
829
|
themeController: this.themeController,
|
|
830
|
+
i18n: this.i18n,
|
|
660
831
|
runtimeAppearance: this.runtimeAppearance,
|
|
661
832
|
model: this.studio.model,
|
|
662
833
|
mode,
|
|
@@ -670,6 +841,8 @@ export class BpmnStudioShell {
|
|
|
670
841
|
runtimeTraceOptions: this.rendererOptions.runtimeTraceOptions,
|
|
671
842
|
timeline: this.rendererOptions.timeline,
|
|
672
843
|
runtimeDetails: this.rendererOptions.runtimeDetails,
|
|
844
|
+
formatRuntimeTime: this.rendererOptions.formatRuntimeTime,
|
|
845
|
+
runtimeTimeFormat: this.rendererOptions.runtimeTimeFormat,
|
|
673
846
|
runtimePresenter: this.rendererOptions.runtimePresenter,
|
|
674
847
|
runtimeTraceProjector: this.rendererOptions.runtimeTraceProjector,
|
|
675
848
|
runtimeAssetResolver: this.rendererOptions.runtimeAssetResolver,
|
|
@@ -860,23 +1033,39 @@ export class BpmnStudioShell {
|
|
|
860
1033
|
this._rightContent.innerHTML = '';
|
|
861
1034
|
const panel = node('div', 'nova-studio-readonly-panel');
|
|
862
1035
|
const header = node('header', 'nova-studio-readonly-header');
|
|
863
|
-
header.append(node('strong', '', element?.name || (selection?.kind === 'edge' ? '
|
|
864
|
-
const badge = node('em', '', this.mode === 'instance' ? '
|
|
1036
|
+
header.append(node('strong', '', element?.name || (selection?.kind === 'edge' ? this._t('shell.readonlyDetails.edgeFallbackTitle') : model.name)), node('span', '', element?.id || model.id));
|
|
1037
|
+
const badge = node('em', '', this.mode === 'instance' ? this._t('shell.readonlyDetails.traceBadge') : this._t('shell.readonlyDetails.readonlyBadge'));
|
|
865
1038
|
header.appendChild(badge);
|
|
866
1039
|
panel.appendChild(header);
|
|
867
1040
|
const runtimeRows = this.mode === 'instance' && selection?.presentation
|
|
868
1041
|
? [
|
|
869
|
-
['
|
|
870
|
-
['
|
|
871
|
-
['
|
|
872
|
-
...(selection.presentation.actionSummary ? [['
|
|
1042
|
+
[this._t('shell.readonlyDetails.currentStatus'), selection.presentation.statusLabel],
|
|
1043
|
+
[this._t('shell.readonlyDetails.participants'), selection.presentation.fullSummary || selection.presentation.summary || '-'],
|
|
1044
|
+
[this._t('shell.readonlyDetails.round'), selection.presentation.round ? this._t('shell.readonlyDetails.roundValue', { round: selection.presentation.round }) : '-'],
|
|
1045
|
+
...(selection.presentation.actionSummary ? [[this._t('shell.readonlyDetails.latestAction'), selection.presentation.actionSummary]] : []),
|
|
873
1046
|
]
|
|
874
1047
|
: [];
|
|
875
1048
|
const rows = selection?.kind === 'node'
|
|
876
|
-
? [
|
|
1049
|
+
? [
|
|
1050
|
+
...runtimeRows,
|
|
1051
|
+
[this._t('shell.readonlyDetails.elementType'), element.type],
|
|
1052
|
+
[this._t('shell.readonlyDetails.bpmnType'), element.bpmnType || '-'],
|
|
1053
|
+
[this._t('shell.readonlyDetails.name'), element.name || '-'],
|
|
1054
|
+
[this._t('shell.readonlyDetails.elementId'), element.id],
|
|
1055
|
+
]
|
|
877
1056
|
: selection?.kind === 'edge'
|
|
878
|
-
? [
|
|
879
|
-
|
|
1057
|
+
? [
|
|
1058
|
+
[this._t('shell.readonlyDetails.source'), element.source],
|
|
1059
|
+
[this._t('shell.readonlyDetails.target'), element.target],
|
|
1060
|
+
[this._t('shell.readonlyDetails.condition'), element.condition || '-'],
|
|
1061
|
+
[this._t('shell.readonlyDetails.elementId'), element.id],
|
|
1062
|
+
]
|
|
1063
|
+
: [
|
|
1064
|
+
[this._t('shell.readonlyDetails.processName'), model.name],
|
|
1065
|
+
[this._t('shell.readonlyDetails.engine'), model.engine],
|
|
1066
|
+
[this._t('shell.readonlyDetails.nodeCount'), String(model.nodes.length)],
|
|
1067
|
+
[this._t('shell.readonlyDetails.edgeCount'), String(model.edges.length)],
|
|
1068
|
+
];
|
|
880
1069
|
const body = node('div', 'nova-studio-readonly-body');
|
|
881
1070
|
for (const [label, value] of rows) {
|
|
882
1071
|
const row = node('div', 'nova-studio-readonly-row');
|
|
@@ -928,9 +1117,10 @@ export class BpmnStudioShell {
|
|
|
928
1117
|
const previousSidebars = this._sidebars?.getState();
|
|
929
1118
|
const nextMetrics = resolveStudioControlMetrics(next.ui.controlSize);
|
|
930
1119
|
const regionsChanged = !sameConfigValue(previous.ui.regions, next.ui.regions);
|
|
1120
|
+
const canvasHeadChanged = !sameConfigValue(previous.ui.canvasHead, next.ui.canvasHead);
|
|
931
1121
|
const projectionOptionsChanged = !sameConfigValue(previous.viewer.projectionOptions, next.viewer.projectionOptions);
|
|
932
1122
|
const responsiveChanged = previous.viewer.responsive !== next.viewer.responsive;
|
|
933
|
-
const displayChanged = ['timeline', 'runtimeDetails', 'runtimeTraceOptions']
|
|
1123
|
+
const displayChanged = ['timeline', 'runtimeDetails', 'runtimeTraceOptions', 'formatRuntimeTime', 'runtimeTimeFormat']
|
|
934
1124
|
.some((name) => !sameConfigValue(previous.viewer[name], next.viewer[name]));
|
|
935
1125
|
const exportChanged = !sameConfigValue(previous.export, next.export);
|
|
936
1126
|
const nextDefaultProjection = next.viewer.responsive ? 'auto' : 'approval';
|
|
@@ -952,6 +1142,8 @@ export class BpmnStudioShell {
|
|
|
952
1142
|
this.rendererOptions.timeline = next.viewer.timeline;
|
|
953
1143
|
this.rendererOptions.runtimeDetails = next.viewer.runtimeDetails;
|
|
954
1144
|
this.rendererOptions.runtimeTraceOptions = next.viewer.runtimeTraceOptions;
|
|
1145
|
+
this.rendererOptions.formatRuntimeTime = next.viewer.formatRuntimeTime;
|
|
1146
|
+
this.rendererOptions.runtimeTimeFormat = next.viewer.runtimeTimeFormat;
|
|
955
1147
|
this.svgExport = next.export || null;
|
|
956
1148
|
this.rendererOptions.svgExport = this.svgExport;
|
|
957
1149
|
if (projectionChanged) {
|
|
@@ -960,6 +1152,7 @@ export class BpmnStudioShell {
|
|
|
960
1152
|
}
|
|
961
1153
|
|
|
962
1154
|
if (regionsChanged) this._applyRegions({ fit: false, sidebars: false });
|
|
1155
|
+
if (canvasHeadChanged) this._syncCanvasHead();
|
|
963
1156
|
if (previousSidebars) this._sidebars.updateConfig(previousSidebars);
|
|
964
1157
|
if (projectionOptionsChanged || responsiveChanged) this._rebuildProjectionButtons();
|
|
965
1158
|
if (this.canvas?.renderer && exportChanged) this.canvas.renderer.svgExportOptions = this.svgExport || {};
|
|
@@ -973,6 +1166,8 @@ export class BpmnStudioShell {
|
|
|
973
1166
|
timeline: next.viewer.timeline,
|
|
974
1167
|
runtimeDetails: next.viewer.runtimeDetails,
|
|
975
1168
|
runtimeTraceOptions: next.viewer.runtimeTraceOptions,
|
|
1169
|
+
formatRuntimeTime: next.viewer.formatRuntimeTime,
|
|
1170
|
+
runtimeTimeFormat: next.viewer.runtimeTimeFormat,
|
|
976
1171
|
replace: true,
|
|
977
1172
|
});
|
|
978
1173
|
} else if (projectionChanged && this.mode === 'instance') this.viewer.refresh();
|
|
@@ -1091,12 +1286,19 @@ export class BpmnStudioShell {
|
|
|
1091
1286
|
}
|
|
1092
1287
|
fitView() { this._fitActive(); }
|
|
1093
1288
|
zoomBy(factor) { this._zoomActive(factor); }
|
|
1289
|
+
_exportViewLabel() {
|
|
1290
|
+
if (this.mode === 'design') return this._t('exportSvg.defaultLabels.design');
|
|
1291
|
+
if (this.mode === 'viewer') return this._t('exportSvg.defaultLabels.viewer');
|
|
1292
|
+
if (this.viewer?.activeProjection === 'compact') return this._t('exportSvg.defaultLabels.timeline');
|
|
1293
|
+
if (this.viewer?.activeProjection === 'approval') return this._t('exportSvg.defaultLabels.approval');
|
|
1294
|
+
return this._t('exportSvg.defaultLabels.standard');
|
|
1295
|
+
}
|
|
1094
1296
|
exportSvg(options) {
|
|
1095
1297
|
const active = this.canvas || this.viewer;
|
|
1096
|
-
if (!active?.exportSvg) return Promise.reject(new Error('
|
|
1097
|
-
const label = this.
|
|
1298
|
+
if (!active?.exportSvg) return Promise.reject(new Error(this._t('shell.errors.svgExportUnsupported')));
|
|
1299
|
+
const label = this._exportViewLabel();
|
|
1098
1300
|
const filename = options?.filename || this.svgExport?.filename || `${this.studio.model.name || this.studio.model.id}-${label}`;
|
|
1099
|
-
return active.exportSvg({ label, ...(options || {}), filename });
|
|
1301
|
+
return active.exportSvg({ label, i18n: this.i18n, ...(options || {}), filename });
|
|
1100
1302
|
}
|
|
1101
1303
|
openSvgExportPreview(options = {}) {
|
|
1102
1304
|
if (this._svgExportPreview && !this._svgExportPreview.closed) {
|
|
@@ -1105,16 +1307,17 @@ export class BpmnStudioShell {
|
|
|
1105
1307
|
}
|
|
1106
1308
|
const active = this.canvas || this.viewer;
|
|
1107
1309
|
if (!active?.exportSvg) return null;
|
|
1108
|
-
const label = this.
|
|
1310
|
+
const label = this._exportViewLabel();
|
|
1109
1311
|
const filename = options.filename || this.svgExport?.filename || `${this.studio.model.name || this.studio.model.id}-${label}`;
|
|
1110
1312
|
this._svgExportPreview = openSvgExportPreview({
|
|
1111
1313
|
container: this.container,
|
|
1112
|
-
|
|
1314
|
+
i18n: this.i18n,
|
|
1315
|
+
title: options.previewTitle || this._t('shell.exportSvgPreviewTitle', { label }),
|
|
1113
1316
|
initialTheme: options.theme || 'current',
|
|
1114
1317
|
createArtifact: (previewOptions) => this.exportSvg({ label, ...options, ...previewOptions, filename }),
|
|
1115
1318
|
onClose: () => { this._svgExportPreview = null; },
|
|
1116
1319
|
onDownload: (artifact) => {
|
|
1117
|
-
this._setStatus(
|
|
1320
|
+
this._setStatus(this._t('shell.status.exportedSvg', { filename: artifact.filename }), 'ok');
|
|
1118
1321
|
options.onDownload?.(artifact);
|
|
1119
1322
|
},
|
|
1120
1323
|
});
|
|
@@ -1131,13 +1334,13 @@ export class BpmnStudioShell {
|
|
|
1131
1334
|
const issues = this.studio.validate();
|
|
1132
1335
|
const errorCount = issues.filter((issue) => issue.level === 'error').length;
|
|
1133
1336
|
const warningCount = issues.filter((issue) => issue.level === 'warning').length;
|
|
1134
|
-
if (!issues.length) this._setStatus('
|
|
1337
|
+
if (!issues.length) this._setStatus(this._t('shell.status.validationPassed'), 'ok');
|
|
1135
1338
|
else {
|
|
1136
1339
|
const summary = [
|
|
1137
|
-
errorCount ?
|
|
1138
|
-
warningCount ?
|
|
1340
|
+
errorCount ? this._t('shell.status.errorCount', { count: errorCount }) : null,
|
|
1341
|
+
warningCount ? this._t('shell.status.warningCount', { count: warningCount }) : null,
|
|
1139
1342
|
].filter(Boolean).join(' · ');
|
|
1140
|
-
this._setStatus(
|
|
1343
|
+
this._setStatus(this._t('shell.status.validationSummary', { summary }), errorCount ? 'error' : 'warning');
|
|
1141
1344
|
}
|
|
1142
1345
|
const eventIssues = Object.freeze(issues.map((issue) => Object.freeze({ ...issue })));
|
|
1143
1346
|
const event = Object.freeze({
|
|
@@ -1167,7 +1370,7 @@ export class BpmnStudioShell {
|
|
|
1167
1370
|
anchor.click();
|
|
1168
1371
|
anchor.remove();
|
|
1169
1372
|
setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
1170
|
-
this._setStatus('
|
|
1373
|
+
this._setStatus(this._t('shell.status.exportedBpmn'), 'ok');
|
|
1171
1374
|
}
|
|
1172
1375
|
|
|
1173
1376
|
_recordCleanup(cleanup) { if (typeof cleanup === 'function') this._cleanups.push(cleanup); }
|
|
@@ -1175,6 +1378,7 @@ export class BpmnStudioShell {
|
|
|
1175
1378
|
return new BpmnCanvas({
|
|
1176
1379
|
container,
|
|
1177
1380
|
studio: this.studio,
|
|
1381
|
+
i18n: this.i18n,
|
|
1178
1382
|
interactions: this.interactions,
|
|
1179
1383
|
selectionToolbar: options.selectionToolbar ?? this.slots.selectionToolbar ?? null,
|
|
1180
1384
|
contextMenu: options.contextMenu ?? this.slots.contextMenu ?? null,
|
|
@@ -1193,11 +1397,11 @@ export class BpmnStudioShell {
|
|
|
1193
1397
|
this._instances.push(instance); return instance;
|
|
1194
1398
|
}
|
|
1195
1399
|
_mountPalette(container, options = {}) {
|
|
1196
|
-
const instance = new PalettePanel({ container, studio: this.studio, registry: this.paletteRegistry, interactions: this.interactions, iconRegistry: this.iconRegistry, themeController: this.themeController, ...options });
|
|
1400
|
+
const instance = new PalettePanel({ container, studio: this.studio, registry: this.paletteRegistry, interactions: this.interactions, iconRegistry: this.iconRegistry, themeController: this.themeController, i18n: this.i18n, ...options });
|
|
1197
1401
|
this._instances.push(instance); return instance;
|
|
1198
1402
|
}
|
|
1199
1403
|
_mountProperties(container, options = {}) {
|
|
1200
|
-
const instance = new PropertiesPanel({ container, studio: this.studio, registry: this.propertiesRegistry, iconRegistry: this.iconRegistry, themeController: this.themeController, ...options });
|
|
1404
|
+
const instance = new PropertiesPanel({ container, studio: this.studio, registry: this.propertiesRegistry, iconRegistry: this.iconRegistry, themeController: this.themeController, i18n: this.i18n, ...options });
|
|
1201
1405
|
instance.render(); this._instances.push(instance); return instance;
|
|
1202
1406
|
}
|
|
1203
1407
|
_releaseInstance(instance) {
|