@bpmn-nova/studio 0.4.0 → 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.
- package/README.md +1 -1
- package/dist/flow-tree.d.ts +4 -0
- package/dist/flow-tree.js +14 -0
- package/dist/modules/flow-tree/controller.js +364 -0
- package/dist/modules/flow-tree/index.d.ts +248 -0
- package/dist/modules/flow-tree/index.js +5 -0
- package/dist/modules/flow-tree/operations.js +484 -0
- package/dist/modules/flow-tree/sample.js +445 -0
- package/dist/modules/flow-tree/schema.js +588 -0
- package/dist/modules/flow-tree/validate.js +125 -0
- package/dist/modules/flow-tree-bpmn/compiler.js +547 -0
- package/dist/modules/flow-tree-bpmn/decompiler.js +524 -0
- package/dist/modules/flow-tree-bpmn/expression.js +135 -0
- package/dist/modules/flow-tree-bpmn/index.d.ts +53 -0
- package/dist/modules/flow-tree-bpmn/index.js +14 -0
- package/dist/modules/flow-tree-renderer/canvas.js +1003 -0
- package/dist/modules/flow-tree-renderer/export-svg.js +325 -0
- package/dist/modules/flow-tree-renderer/index.d.ts +143 -0
- package/dist/modules/flow-tree-renderer/index.js +3 -0
- package/dist/modules/flow-tree-renderer/shell.js +970 -0
- package/dist/modules/i18n/locales/en-US.js +399 -0
- package/dist/modules/i18n/locales/zh-CN.js +399 -0
- package/dist/modules/icons/index.js +23 -0
- package/dist/modules/properties-flow-tree/index.d.ts +56 -0
- package/dist/modules/properties-flow-tree/index.js +2 -0
- package/dist/modules/properties-flow-tree/panel.js +1136 -0
- package/dist/modules/properties-flow-tree/widgets.js +625 -0
- package/dist/modules/viewer/index.js +10 -2
- package/dist/styles.css +2368 -0
- package/llms-full.txt +353 -9
- package/llms.txt +3 -2
- package/package.json +6 -1
|
@@ -0,0 +1,1136 @@
|
|
|
1
|
+
import { createI18n, resolveI18n } from '../i18n/index.js';
|
|
2
|
+
import { createDefaultIconRegistry, hydrateIcons } from '../icons/index.js';
|
|
3
|
+
import { ThemeController } from '../theme/index.js';
|
|
4
|
+
import {
|
|
5
|
+
FLOW_TREE_NODE_DEFINITIONS,
|
|
6
|
+
findFlowTreeNode,
|
|
7
|
+
findFlowTreeNodeLocation,
|
|
8
|
+
resolveFlowTreeTypeLabel,
|
|
9
|
+
} from '../flow-tree/index.js';
|
|
10
|
+
import { compileBranchCondition, compileDelayToTimer } from '../flow-tree-bpmn/index.js';
|
|
11
|
+
import {
|
|
12
|
+
createConditionBuilder,
|
|
13
|
+
createEmbeddedStepsEditor,
|
|
14
|
+
createField,
|
|
15
|
+
createFormPermissionMatrix,
|
|
16
|
+
createKeyValueTable,
|
|
17
|
+
createNumberInput,
|
|
18
|
+
createSection,
|
|
19
|
+
createSelect,
|
|
20
|
+
createSwitch,
|
|
21
|
+
createTargetPicker,
|
|
22
|
+
createTextInput,
|
|
23
|
+
createTextarea,
|
|
24
|
+
dom,
|
|
25
|
+
iconSpan,
|
|
26
|
+
} from './widgets.js';
|
|
27
|
+
|
|
28
|
+
export class FlowTreePropertiesPanel {
|
|
29
|
+
constructor(options = {}) {
|
|
30
|
+
const {
|
|
31
|
+
container,
|
|
32
|
+
controller,
|
|
33
|
+
dataProviders = {},
|
|
34
|
+
nodePanels = {},
|
|
35
|
+
iconRegistry = createDefaultIconRegistry(),
|
|
36
|
+
themeController = null,
|
|
37
|
+
theme = null,
|
|
38
|
+
onThemeChange = null,
|
|
39
|
+
i18n = null,
|
|
40
|
+
locale,
|
|
41
|
+
messages,
|
|
42
|
+
} = options;
|
|
43
|
+
if (!container) throw new Error('FlowTreePropertiesPanel requires a container.');
|
|
44
|
+
if (!controller) throw new Error('FlowTreePropertiesPanel requires a FlowTreeController.');
|
|
45
|
+
|
|
46
|
+
this.container = container;
|
|
47
|
+
this.controller = controller;
|
|
48
|
+
this.dataProviders = dataProviders || {};
|
|
49
|
+
this.nodePanels = nodePanels || {};
|
|
50
|
+
this.iconRegistry = iconRegistry;
|
|
51
|
+
|
|
52
|
+
if (i18n) {
|
|
53
|
+
this.i18n = resolveI18n(i18n);
|
|
54
|
+
this._ownsI18n = false;
|
|
55
|
+
} else if (locale !== undefined || messages !== undefined) {
|
|
56
|
+
this.i18n = createI18n({ locale, messages });
|
|
57
|
+
this._ownsI18n = true;
|
|
58
|
+
} else if (controller.i18n) {
|
|
59
|
+
this.i18n = controller.i18n;
|
|
60
|
+
this._ownsI18n = false;
|
|
61
|
+
} else {
|
|
62
|
+
this.i18n = createI18n();
|
|
63
|
+
this._ownsI18n = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
this.themeController = themeController || new ThemeController({ root: container, theme, onChange: onThemeChange });
|
|
67
|
+
this._ownsThemeController = !themeController;
|
|
68
|
+
this._activeTabByType = new Map();
|
|
69
|
+
this._lastViewKey = '';
|
|
70
|
+
this._formFields = [];
|
|
71
|
+
this._formFieldsLoaded = false;
|
|
72
|
+
this._subProcessOptions = [];
|
|
73
|
+
this._customCleanups = [];
|
|
74
|
+
|
|
75
|
+
this.container.classList.add('nova-ft-properties');
|
|
76
|
+
this._offController = controller.subscribe((event) => {
|
|
77
|
+
if (['selectionChanged', 'documentChanged', 'localeChanged'].includes(event.type)) {
|
|
78
|
+
this.render();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
this._offI18n = this._ownsI18n ? this.i18n.subscribe(() => this.render()) : null;
|
|
82
|
+
|
|
83
|
+
this._loadStaticProviders();
|
|
84
|
+
this.render();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_t(key, params) {
|
|
88
|
+
return this.i18n.t(key, params);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
setDataProviders(nextProviders = {}) {
|
|
92
|
+
this.dataProviders = nextProviders || {};
|
|
93
|
+
this._formFieldsLoaded = false;
|
|
94
|
+
this._loadStaticProviders();
|
|
95
|
+
this.render();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
setTheme(theme) { return this.themeController.setTheme(theme); }
|
|
99
|
+
setLocale(locale, messages) {
|
|
100
|
+
if (!this._ownsI18n && this.controller?.setLocale) return this.controller.setLocale(locale, messages);
|
|
101
|
+
return this.i18n.setLocale(locale, messages);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async _loadStaticProviders() {
|
|
105
|
+
const fieldsProvider = this.dataProviders?.formFields;
|
|
106
|
+
if (fieldsProvider && typeof (fieldsProvider.list || fieldsProvider.search) === 'function') {
|
|
107
|
+
try {
|
|
108
|
+
const result = await (fieldsProvider.list || fieldsProvider.search).call(fieldsProvider);
|
|
109
|
+
this._formFields = Array.isArray(result) ? result : [];
|
|
110
|
+
this._formFieldsLoaded = true;
|
|
111
|
+
this.render();
|
|
112
|
+
} catch {
|
|
113
|
+
this._formFields = [];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const subProvider = this.dataProviders?.subProcesses;
|
|
117
|
+
if (subProvider && typeof (subProvider.list || subProvider.search) === 'function') {
|
|
118
|
+
try {
|
|
119
|
+
const result = await (subProvider.list || subProvider.search).call(subProvider, '');
|
|
120
|
+
this._subProcessOptions = Array.isArray(result) ? result : [];
|
|
121
|
+
this.render();
|
|
122
|
+
} catch {
|
|
123
|
+
this._subProcessOptions = [];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
_clearCustomCleanups() {
|
|
129
|
+
this._customCleanups.splice(0).forEach((fn) => fn?.());
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
destroy() {
|
|
133
|
+
this._clearCustomCleanups();
|
|
134
|
+
this._offController?.();
|
|
135
|
+
this._offI18n?.();
|
|
136
|
+
this.container.innerHTML = '';
|
|
137
|
+
this.container.classList.remove('nova-ft-properties');
|
|
138
|
+
if (this._ownsThemeController) this.themeController.destroy();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
_tabsForNode(node) {
|
|
142
|
+
if (!node) return [];
|
|
143
|
+
if (node.type === 'approver') {
|
|
144
|
+
return [
|
|
145
|
+
{ id: 'basic', label: this._t('flowTree.properties.tabs.basic') },
|
|
146
|
+
{ id: 'rules', label: this._t('flowTree.properties.tabs.rules') },
|
|
147
|
+
{ id: 'buttons', label: this._t('flowTree.properties.tabs.buttons') },
|
|
148
|
+
{ id: 'form', label: this._t('flowTree.properties.tabs.form') },
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
if (node.type === 'handler') {
|
|
152
|
+
return [
|
|
153
|
+
{ id: 'basic', label: this._t('flowTree.properties.tabs.basic') },
|
|
154
|
+
{ id: 'buttons', label: this._t('flowTree.properties.tabs.buttons') },
|
|
155
|
+
{ id: 'form', label: this._t('flowTree.properties.tabs.form') },
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
if (node.type === 'starter' || node.type === 'cc') {
|
|
159
|
+
return [
|
|
160
|
+
{ id: 'basic', label: this._t('flowTree.properties.tabs.basic') },
|
|
161
|
+
{ id: 'form', label: this._t('flowTree.properties.tabs.form') },
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
return [];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
render() {
|
|
168
|
+
this._clearCustomCleanups();
|
|
169
|
+
const state = this.controller.getState();
|
|
170
|
+
const doc = state.document;
|
|
171
|
+
const selection = state.selection;
|
|
172
|
+
const node = selection?.kind === 'node' ? this.controller.getSelectedNode() : null;
|
|
173
|
+
const issues = node
|
|
174
|
+
? state.validationIssues.filter((item) => item.nodeId === node.id)
|
|
175
|
+
: state.validationIssues;
|
|
176
|
+
|
|
177
|
+
const tabs = this._tabsForNode(node);
|
|
178
|
+
let activeTab = 'basic';
|
|
179
|
+
if (tabs.length) {
|
|
180
|
+
const saved = this._activeTabByType.get(node.type);
|
|
181
|
+
activeTab = tabs.some((item) => item.id === saved) ? saved : tabs[0].id;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const viewKey = `${node?.id || '__process__'}:${activeTab}`;
|
|
185
|
+
const sameView = this._lastViewKey === viewKey;
|
|
186
|
+
const scrollHost = this.container.parentElement || this.container;
|
|
187
|
+
const prevScrollTop = sameView ? scrollHost.scrollTop : 0;
|
|
188
|
+
this._lastViewKey = viewKey;
|
|
189
|
+
|
|
190
|
+
const root = dom('div', 'ft-prop-root');
|
|
191
|
+
|
|
192
|
+
// Sticky Header
|
|
193
|
+
const head = dom('header', 'ft-prop-head');
|
|
194
|
+
const headTop = dom('div', 'ft-prop-head-top');
|
|
195
|
+
const def = node ? (this.controller.nodeRegistry.resolve(node.type) || FLOW_TREE_NODE_DEFINITIONS[node.type]) : null;
|
|
196
|
+
const badge = dom('span', `ft-prop-type-badge tone-${def?.tone || 'primary'}`);
|
|
197
|
+
badge.appendChild(iconSpan(def?.iconId || 'flowTree.tree', 'nova-icon nova-icon-sm'));
|
|
198
|
+
const titleCopy = dom('div', 'ft-prop-head-copy');
|
|
199
|
+
titleCopy.append(
|
|
200
|
+
dom('strong', '', node ? (node.name || resolveFlowTreeTypeLabel(node.type, { i18n: this.i18n, nodeRegistry: this.controller.nodeRegistry })) : doc.name),
|
|
201
|
+
dom('small', '', node ? `${resolveFlowTreeTypeLabel(node.type, { i18n: this.i18n, nodeRegistry: this.controller.nodeRegistry })} · ${node.id}` : `${doc.id} · ${doc.engine.toUpperCase()}`),
|
|
202
|
+
);
|
|
203
|
+
headTop.append(badge, titleCopy);
|
|
204
|
+
head.appendChild(headTop);
|
|
205
|
+
|
|
206
|
+
// Embedded subflow breadcrumb back-link
|
|
207
|
+
const nodeLoc = node ? findFlowTreeNodeLocation(doc, node.id) : null;
|
|
208
|
+
if (nodeLoc?.container?.kind === 'embedded') {
|
|
209
|
+
const parentSubFlow = findFlowTreeNode(doc, nodeLoc.container.subFlowId);
|
|
210
|
+
if (parentSubFlow) {
|
|
211
|
+
const backBtn = dom('button', 'ft-prop-breadcrumb');
|
|
212
|
+
backBtn.type = 'button';
|
|
213
|
+
backBtn.append(
|
|
214
|
+
iconSpan('flowTree.moveLeft', 'nova-icon nova-icon-xs'),
|
|
215
|
+
dom('span', '', this._t('flowTree.properties.embeddedSteps.backToSubFlow', { name: parentSubFlow.name || parentSubFlow.id })),
|
|
216
|
+
);
|
|
217
|
+
backBtn.addEventListener('click', () => {
|
|
218
|
+
this.controller.commands.select({ kind: 'node', id: parentSubFlow.id });
|
|
219
|
+
});
|
|
220
|
+
head.appendChild(backBtn);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Optional Tabs
|
|
225
|
+
if (tabs.length) {
|
|
226
|
+
const tabBar = dom('div', 'ft-prop-tabs');
|
|
227
|
+
tabBar.setAttribute('role', 'tablist');
|
|
228
|
+
for (const tab of tabs) {
|
|
229
|
+
const btn = dom('button', `ft-prop-tab${tab.id === activeTab ? ' is-active' : ''}`, tab.label);
|
|
230
|
+
btn.type = 'button';
|
|
231
|
+
btn.setAttribute('role', 'tab');
|
|
232
|
+
btn.setAttribute('aria-selected', tab.id === activeTab ? 'true' : 'false');
|
|
233
|
+
const switchTab = () => {
|
|
234
|
+
if (document.activeElement && this.container.contains(document.activeElement) && document.activeElement !== btn) {
|
|
235
|
+
document.activeElement.blur?.();
|
|
236
|
+
}
|
|
237
|
+
if (this._activeTabByType.get(node.type) === tab.id) return;
|
|
238
|
+
this._activeTabByType.set(node.type, tab.id);
|
|
239
|
+
this.render();
|
|
240
|
+
};
|
|
241
|
+
btn.addEventListener('pointerdown', (event) => {
|
|
242
|
+
if (event.button !== 0) return;
|
|
243
|
+
event.preventDefault();
|
|
244
|
+
switchTab();
|
|
245
|
+
});
|
|
246
|
+
btn.addEventListener('click', () => switchTab());
|
|
247
|
+
tabBar.appendChild(btn);
|
|
248
|
+
}
|
|
249
|
+
head.appendChild(tabBar);
|
|
250
|
+
}
|
|
251
|
+
root.appendChild(head);
|
|
252
|
+
|
|
253
|
+
const body = dom('div', 'ft-prop-body');
|
|
254
|
+
|
|
255
|
+
// Validation alert banner for selected node
|
|
256
|
+
if (node && issues.length) {
|
|
257
|
+
const alert = dom('div', `ft-prop-alert is-${issues.some((i) => i.level === 'error') ? 'error' : 'warning'}`);
|
|
258
|
+
for (const issue of issues) {
|
|
259
|
+
const line = dom('div', 'ft-prop-alert-item');
|
|
260
|
+
line.append(iconSpan('flowTree.warning', 'nova-icon nova-icon-xs'), dom('span', '', issue.message));
|
|
261
|
+
alert.appendChild(line);
|
|
262
|
+
}
|
|
263
|
+
body.appendChild(alert);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Custom host override per node type
|
|
267
|
+
if (node && typeof this.nodePanels?.[node.type] === 'function') {
|
|
268
|
+
const customHost = dom('div', 'ft-prop-custom-host');
|
|
269
|
+
const cleanup = this.nodePanels[node.type]({
|
|
270
|
+
container: customHost,
|
|
271
|
+
node,
|
|
272
|
+
document: doc,
|
|
273
|
+
controller: this.controller,
|
|
274
|
+
dataProviders: this.dataProviders,
|
|
275
|
+
i18n: this.i18n,
|
|
276
|
+
});
|
|
277
|
+
if (typeof cleanup === 'function') this._customCleanups.push(cleanup);
|
|
278
|
+
body.appendChild(customHost);
|
|
279
|
+
} else if (!node) {
|
|
280
|
+
this._renderProcessSettings(body, doc);
|
|
281
|
+
} else if (node.type === 'starter') {
|
|
282
|
+
this._renderStarter(body, node, activeTab);
|
|
283
|
+
} else if (node.type === 'approver') {
|
|
284
|
+
this._renderApprover(body, node, activeTab);
|
|
285
|
+
} else if (node.type === 'cc') {
|
|
286
|
+
this._renderCc(body, node, activeTab);
|
|
287
|
+
} else if (node.type === 'handler') {
|
|
288
|
+
this._renderHandler(body, node, activeTab);
|
|
289
|
+
} else if (node.type === 'conditionBranch' || node.type === 'inclusiveBranch') {
|
|
290
|
+
this._renderConditionBranch(body, node, doc);
|
|
291
|
+
} else if (node.type === 'parallelBranch') {
|
|
292
|
+
this._renderParallelBranch(body, node);
|
|
293
|
+
} else if (node.type === 'delay') {
|
|
294
|
+
this._renderDelay(body, node);
|
|
295
|
+
} else if (node.type === 'trigger') {
|
|
296
|
+
this._renderTrigger(body, node);
|
|
297
|
+
} else if (node.type === 'subFlow') {
|
|
298
|
+
this._renderSubFlow(body, node);
|
|
299
|
+
} else if (node.type === 'end') {
|
|
300
|
+
this._renderEnd(body, node);
|
|
301
|
+
} else {
|
|
302
|
+
this._renderGenericCustomNode(body, node);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
root.appendChild(body);
|
|
306
|
+
this.container.replaceChildren(root);
|
|
307
|
+
hydrateIcons(this.container, this.iconRegistry);
|
|
308
|
+
scrollHost.scrollTop = prevScrollTop;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
_renderProcessSettings(body, doc) {
|
|
312
|
+
const info = createSection(this._t('flowTree.properties.sections.processInfo'));
|
|
313
|
+
info.body.append(
|
|
314
|
+
createField(this._t('flowTree.properties.fields.processId'), createTextInput({
|
|
315
|
+
value: doc.id,
|
|
316
|
+
monospace: true,
|
|
317
|
+
onChange: (value) => value.trim() && this.controller.commands.updateDocument({ id: value.trim() }),
|
|
318
|
+
})),
|
|
319
|
+
createField(this._t('flowTree.properties.fields.processName'), createTextInput({
|
|
320
|
+
value: doc.name,
|
|
321
|
+
onChange: (value) => this.controller.commands.updateDocument({ name: value }),
|
|
322
|
+
})),
|
|
323
|
+
createField(this._t('flowTree.properties.fields.engine'), createSelect({
|
|
324
|
+
value: doc.engine,
|
|
325
|
+
options: [
|
|
326
|
+
{ value: 'flowable', label: 'Flowable (flowable:*)' },
|
|
327
|
+
{ value: 'activiti', label: 'Activiti (activiti:*)' },
|
|
328
|
+
],
|
|
329
|
+
onChange: (value) => this.controller.commands.setEngine(value),
|
|
330
|
+
})),
|
|
331
|
+
createField(this._t('flowTree.properties.fields.documentation'), createTextarea({
|
|
332
|
+
value: doc.description || '',
|
|
333
|
+
rows: 2,
|
|
334
|
+
onChange: (value) => this.controller.commands.updateDocument({ description: value }),
|
|
335
|
+
})),
|
|
336
|
+
);
|
|
337
|
+
body.appendChild(info.section);
|
|
338
|
+
|
|
339
|
+
const compile = createSection(this._t('flowTree.properties.sections.compileOptions'));
|
|
340
|
+
compile.body.append(
|
|
341
|
+
createField(this._t('flowTree.properties.fields.starterCompileMode'), createSelect({
|
|
342
|
+
value: doc.settings?.starterCompileMode || 'startAndUserTask',
|
|
343
|
+
options: [
|
|
344
|
+
{ value: 'startAndUserTask', label: this._t('flowTree.properties.options.starterCompileStartAndTask') },
|
|
345
|
+
{ value: 'startEvent', label: this._t('flowTree.properties.options.starterCompileStartEvent') },
|
|
346
|
+
],
|
|
347
|
+
onChange: (value) => this.controller.commands.updateDocument({ settings: { starterCompileMode: value } }),
|
|
348
|
+
})),
|
|
349
|
+
createField(this._t('flowTree.properties.fields.ccCompileMode'), createSelect({
|
|
350
|
+
value: doc.settings?.ccCompileMode || 'serviceTask',
|
|
351
|
+
options: [
|
|
352
|
+
{ value: 'serviceTask', label: this._t('flowTree.properties.options.ccCompileServiceTask') },
|
|
353
|
+
{ value: 'executionListener', label: this._t('flowTree.properties.options.ccCompileListener') },
|
|
354
|
+
],
|
|
355
|
+
onChange: (value) => this.controller.commands.updateDocument({ settings: { ccCompileMode: value } }),
|
|
356
|
+
})),
|
|
357
|
+
createField(this._t('flowTree.properties.fields.globalDedup'), createSelect({
|
|
358
|
+
value: doc.settings?.autoDeduplicateApprovers || 'none',
|
|
359
|
+
options: [
|
|
360
|
+
{ value: 'none', label: this._t('flowTree.properties.options.dedupNone') },
|
|
361
|
+
{ value: 'consecutive', label: this._t('flowTree.properties.options.dedupConsecutive') },
|
|
362
|
+
{ value: 'all', label: this._t('flowTree.properties.options.dedupAll') },
|
|
363
|
+
],
|
|
364
|
+
onChange: (value) => this.controller.commands.updateDocument({ settings: { autoDeduplicateApprovers: value } }),
|
|
365
|
+
})),
|
|
366
|
+
createField('', createSwitch({
|
|
367
|
+
checked: doc.settings?.allowWithdraw !== false,
|
|
368
|
+
label: this._t('flowTree.properties.fields.allowWithdraw'),
|
|
369
|
+
onChange: (checked) => this.controller.commands.updateDocument({ settings: { allowWithdraw: checked } }),
|
|
370
|
+
})),
|
|
371
|
+
);
|
|
372
|
+
body.appendChild(compile.section);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
_renderStarter(body, node, tab) {
|
|
376
|
+
const config = node.config || {};
|
|
377
|
+
if (tab === 'form') {
|
|
378
|
+
const sec = createSection(this._t('flowTree.properties.sections.formPermissions'));
|
|
379
|
+
sec.body.appendChild(createFormPermissionMatrix({
|
|
380
|
+
permissions: config.formPermissions,
|
|
381
|
+
formFields: this._formFields,
|
|
382
|
+
allowEditable: true,
|
|
383
|
+
i18n: this.i18n,
|
|
384
|
+
onChange: (next) => this.controller.commands.updateNodeConfig(node.id, { formPermissions: next }),
|
|
385
|
+
}));
|
|
386
|
+
body.appendChild(sec.section);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const sec = createSection(this._t('flowTree.properties.sections.starterScope'));
|
|
391
|
+
sec.body.append(
|
|
392
|
+
createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
393
|
+
value: node.name,
|
|
394
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
395
|
+
})),
|
|
396
|
+
createField(this._t('flowTree.properties.fields.starterScopeType'), createSelect({
|
|
397
|
+
value: config.starterScope || 'all',
|
|
398
|
+
options: [
|
|
399
|
+
{ value: 'all', label: this._t('flowTree.properties.options.starterScopeAll') },
|
|
400
|
+
{ value: 'specified', label: this._t('flowTree.properties.options.starterScopeSpecified') },
|
|
401
|
+
],
|
|
402
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { starterScope: value }),
|
|
403
|
+
})),
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
if (config.starterScope === 'specified') {
|
|
407
|
+
sec.body.append(
|
|
408
|
+
createField(this._t('flowTree.properties.fields.selectedUsers'), createTargetPicker({
|
|
409
|
+
value: config.targets?.users || [],
|
|
410
|
+
provider: this.dataProviders?.users,
|
|
411
|
+
i18n: this.i18n,
|
|
412
|
+
onChange: (users) => this.controller.commands.updateNodeConfig(node.id, { targets: { users } }),
|
|
413
|
+
})),
|
|
414
|
+
createField(this._t('flowTree.properties.fields.selectedDepartments'), createTargetPicker({
|
|
415
|
+
value: config.targets?.departments || [],
|
|
416
|
+
provider: this.dataProviders?.departments,
|
|
417
|
+
i18n: this.i18n,
|
|
418
|
+
onChange: (departments) => this.controller.commands.updateNodeConfig(node.id, { targets: { departments } }),
|
|
419
|
+
})),
|
|
420
|
+
createField(this._t('flowTree.properties.fields.selectedRoles'), createTargetPicker({
|
|
421
|
+
value: config.targets?.roles || [],
|
|
422
|
+
provider: this.dataProviders?.roles,
|
|
423
|
+
i18n: this.i18n,
|
|
424
|
+
onChange: (roles) => this.controller.commands.updateNodeConfig(node.id, { targets: { roles } }),
|
|
425
|
+
})),
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
sec.body.appendChild(createField('', createSwitch({
|
|
430
|
+
checked: config.allowResubmit !== false,
|
|
431
|
+
label: this._t('flowTree.properties.fields.allowResubmit'),
|
|
432
|
+
onChange: (checked) => this.controller.commands.updateNodeConfig(node.id, { allowResubmit: checked }),
|
|
433
|
+
})));
|
|
434
|
+
body.appendChild(sec.section);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
_appendAssigneeFields(container, node, { includeMultiSupervisor = true, includeSelfSelect = true, includeInitiatorSelf = true, includeExpression = true } = {}) {
|
|
438
|
+
const config = node.config || {};
|
|
439
|
+
const options = [
|
|
440
|
+
{ value: 'users', label: this._t('flowTree.properties.options.assigneeUsers') },
|
|
441
|
+
{ value: 'roles', label: this._t('flowTree.properties.options.assigneeRoles') },
|
|
442
|
+
{ value: 'departments', label: this._t('flowTree.properties.options.assigneeDepartments') },
|
|
443
|
+
{ value: 'supervisor', label: this._t('flowTree.properties.options.assigneeSupervisor') },
|
|
444
|
+
...(includeMultiSupervisor ? [{ value: 'multiLevelSupervisor', label: this._t('flowTree.properties.options.assigneeMultiSupervisor') }] : []),
|
|
445
|
+
...(includeSelfSelect ? [{ value: 'selfSelect', label: this._t('flowTree.properties.options.assigneeSelfSelect') }] : []),
|
|
446
|
+
{ value: 'formUser', label: this._t('flowTree.properties.options.assigneeFormUser') },
|
|
447
|
+
...(includeInitiatorSelf ? [{ value: 'initiatorSelf', label: this._t('flowTree.properties.options.assigneeInitiatorSelf') }] : []),
|
|
448
|
+
...(includeExpression ? [{ value: 'expression', label: this._t('flowTree.properties.options.assigneeExpression') }] : []),
|
|
449
|
+
];
|
|
450
|
+
|
|
451
|
+
container.appendChild(createField(this._t('flowTree.properties.fields.assigneeType'), createSelect({
|
|
452
|
+
value: config.assigneeType || 'users',
|
|
453
|
+
options,
|
|
454
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { assigneeType: value }),
|
|
455
|
+
})));
|
|
456
|
+
|
|
457
|
+
const type = config.assigneeType || 'users';
|
|
458
|
+
if (type === 'users') {
|
|
459
|
+
container.appendChild(createField(this._t('flowTree.properties.fields.selectedUsers'), createTargetPicker({
|
|
460
|
+
value: config.targets?.users || [],
|
|
461
|
+
provider: this.dataProviders?.users,
|
|
462
|
+
i18n: this.i18n,
|
|
463
|
+
onChange: (users) => this.controller.commands.updateNodeConfig(node.id, { targets: { users } }),
|
|
464
|
+
}), { required: true }));
|
|
465
|
+
} else if (type === 'roles') {
|
|
466
|
+
container.appendChild(createField(this._t('flowTree.properties.fields.selectedRoles'), createTargetPicker({
|
|
467
|
+
value: config.targets?.roles || [],
|
|
468
|
+
provider: this.dataProviders?.roles,
|
|
469
|
+
i18n: this.i18n,
|
|
470
|
+
onChange: (roles) => this.controller.commands.updateNodeConfig(node.id, { targets: { roles } }),
|
|
471
|
+
}), { required: true }));
|
|
472
|
+
} else if (type === 'departments') {
|
|
473
|
+
container.appendChild(createField(this._t('flowTree.properties.fields.selectedDepartments'), createTargetPicker({
|
|
474
|
+
value: config.targets?.departments || [],
|
|
475
|
+
provider: this.dataProviders?.departments,
|
|
476
|
+
i18n: this.i18n,
|
|
477
|
+
onChange: (departments) => this.controller.commands.updateNodeConfig(node.id, { targets: { departments } }),
|
|
478
|
+
}), { required: true }));
|
|
479
|
+
} else if (type === 'supervisor') {
|
|
480
|
+
container.appendChild(createField(this._t('flowTree.properties.fields.supervisorLevel'), createNumberInput({
|
|
481
|
+
value: config.supervisorLevel || 1,
|
|
482
|
+
min: 1,
|
|
483
|
+
max: 10,
|
|
484
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { supervisorLevel: Math.max(1, value || 1) }),
|
|
485
|
+
})));
|
|
486
|
+
} else if (type === 'multiLevelSupervisor') {
|
|
487
|
+
container.appendChild(createField(this._t('flowTree.properties.fields.supervisorEndLevel'), createNumberInput({
|
|
488
|
+
value: config.supervisorEndLevel || 2,
|
|
489
|
+
min: 1,
|
|
490
|
+
max: 10,
|
|
491
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { supervisorEndLevel: Math.max(1, value || 2) }),
|
|
492
|
+
})));
|
|
493
|
+
} else if (type === 'selfSelect') {
|
|
494
|
+
container.appendChild(createField('', createSwitch({
|
|
495
|
+
checked: Boolean(config.selfSelectMultiple),
|
|
496
|
+
label: this._t('flowTree.properties.fields.selfSelectMultiple'),
|
|
497
|
+
onChange: (checked) => this.controller.commands.updateNodeConfig(node.id, { selfSelectMultiple: checked }),
|
|
498
|
+
})));
|
|
499
|
+
} else if (type === 'formUser') {
|
|
500
|
+
const userFields = this._formFields.filter((f) => ['user', 'string'].includes(f.type));
|
|
501
|
+
const control = userFields.length
|
|
502
|
+
? createSelect({
|
|
503
|
+
value: config.formUserField || '',
|
|
504
|
+
options: [{ value: '', label: '—' }, ...userFields.map((f) => ({ value: f.key, label: `${f.label} (${f.key})` }))],
|
|
505
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { formUserField: value }),
|
|
506
|
+
})
|
|
507
|
+
: createTextInput({
|
|
508
|
+
value: config.formUserField || '',
|
|
509
|
+
placeholder: 'ownerUserId',
|
|
510
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { formUserField: value.trim() }),
|
|
511
|
+
});
|
|
512
|
+
container.appendChild(createField(this._t('flowTree.properties.fields.formUserField'), control, { required: true }));
|
|
513
|
+
} else if (type === 'expression') {
|
|
514
|
+
container.appendChild(createField(this._t('flowTree.properties.fields.assigneeExpression'), createTextInput({
|
|
515
|
+
value: config.expression || '',
|
|
516
|
+
placeholder: '${deptManager}',
|
|
517
|
+
monospace: true,
|
|
518
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { expression: value }),
|
|
519
|
+
}), { required: true }));
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
_renderApprover(body, node, tab) {
|
|
524
|
+
const config = node.config || {};
|
|
525
|
+
if (tab === 'form') {
|
|
526
|
+
const sec = createSection(this._t('flowTree.properties.sections.formPermissions'));
|
|
527
|
+
sec.body.appendChild(createFormPermissionMatrix({
|
|
528
|
+
permissions: config.formPermissions,
|
|
529
|
+
formFields: this._formFields,
|
|
530
|
+
allowEditable: true,
|
|
531
|
+
i18n: this.i18n,
|
|
532
|
+
onChange: (next) => this.controller.commands.updateNodeConfig(node.id, { formPermissions: next }),
|
|
533
|
+
}));
|
|
534
|
+
body.appendChild(sec.section);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (tab === 'buttons') {
|
|
539
|
+
const buttons = config.buttons || {};
|
|
540
|
+
const sec = createSection(this._t('flowTree.properties.sections.buttons'));
|
|
541
|
+
for (const key of ['approve', 'reject', 'returnEnabled', 'transfer', 'addSign', 'delegate']) {
|
|
542
|
+
sec.body.appendChild(createField('', createSwitch({
|
|
543
|
+
checked: Boolean(buttons[key]),
|
|
544
|
+
label: this._t(`flowTree.properties.buttons.${key}`),
|
|
545
|
+
onChange: (checked) => this.controller.commands.updateNodeConfig(node.id, { buttons: { [key]: checked } }),
|
|
546
|
+
})));
|
|
547
|
+
}
|
|
548
|
+
if (buttons.returnEnabled) {
|
|
549
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.returnMode'), createSelect({
|
|
550
|
+
value: buttons.returnMode || 'previous',
|
|
551
|
+
options: [
|
|
552
|
+
{ value: 'previous', label: this._t('flowTree.properties.options.returnPrevious') },
|
|
553
|
+
{ value: 'starter', label: this._t('flowTree.properties.options.returnStarter') },
|
|
554
|
+
{ value: 'anyPrevious', label: this._t('flowTree.properties.options.returnAnyPrevious') },
|
|
555
|
+
{ value: 'specified', label: this._t('flowTree.properties.options.returnSpecified') },
|
|
556
|
+
],
|
|
557
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { buttons: { returnMode: value } }),
|
|
558
|
+
})));
|
|
559
|
+
}
|
|
560
|
+
sec.body.appendChild(createField('', createSwitch({
|
|
561
|
+
checked: buttons.commentRequiredOnReject !== false,
|
|
562
|
+
label: this._t('flowTree.properties.fields.commentRequiredOnReject'),
|
|
563
|
+
onChange: (checked) => this.controller.commands.updateNodeConfig(node.id, { buttons: { commentRequiredOnReject: checked } }),
|
|
564
|
+
})));
|
|
565
|
+
body.appendChild(sec.section);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (tab === 'rules') {
|
|
570
|
+
const emptySec = createSection(this._t('flowTree.properties.sections.emptyStrategy'));
|
|
571
|
+
emptySec.body.appendChild(createField(this._t('flowTree.properties.fields.emptyStrategy'), createSelect({
|
|
572
|
+
value: config.emptyStrategy || 'autoPass',
|
|
573
|
+
options: [
|
|
574
|
+
{ value: 'autoPass', label: this._t('flowTree.properties.options.emptyAutoPass') },
|
|
575
|
+
{ value: 'toAdmin', label: this._t('flowTree.properties.options.emptyToAdmin') },
|
|
576
|
+
{ value: 'toSpecified', label: this._t('flowTree.properties.options.emptyToSpecified') },
|
|
577
|
+
{ value: 'reject', label: this._t('flowTree.properties.options.emptyReject') },
|
|
578
|
+
],
|
|
579
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { emptyStrategy: value }),
|
|
580
|
+
})));
|
|
581
|
+
if (config.emptyStrategy === 'toSpecified') {
|
|
582
|
+
emptySec.body.appendChild(createField(this._t('flowTree.properties.fields.fallbackUsers'), createTargetPicker({
|
|
583
|
+
value: config.fallbackUsers || [],
|
|
584
|
+
provider: this.dataProviders?.users,
|
|
585
|
+
i18n: this.i18n,
|
|
586
|
+
onChange: (fallbackUsers) => this.controller.commands.updateNodeConfig(node.id, { fallbackUsers }),
|
|
587
|
+
})));
|
|
588
|
+
}
|
|
589
|
+
body.appendChild(emptySec.section);
|
|
590
|
+
|
|
591
|
+
const dedupSec = createSection(this._t('flowTree.properties.sections.sameAsInitiator'));
|
|
592
|
+
dedupSec.body.append(
|
|
593
|
+
createField(this._t('flowTree.properties.fields.sameAsInitiator'), createSelect({
|
|
594
|
+
value: config.sameAsInitiatorStrategy || 'default',
|
|
595
|
+
options: [
|
|
596
|
+
{ value: 'default', label: this._t('flowTree.properties.options.sameDefault') },
|
|
597
|
+
{ value: 'autoPass', label: this._t('flowTree.properties.options.sameAutoPass') },
|
|
598
|
+
{ value: 'toSupervisor', label: this._t('flowTree.properties.options.sameToSupervisor') },
|
|
599
|
+
{ value: 'toAdmin', label: this._t('flowTree.properties.options.sameToAdmin') },
|
|
600
|
+
],
|
|
601
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { sameAsInitiatorStrategy: value }),
|
|
602
|
+
})),
|
|
603
|
+
createField(this._t('flowTree.properties.fields.dedupStrategy'), createSelect({
|
|
604
|
+
value: config.dedupStrategy || 'inherit',
|
|
605
|
+
options: [
|
|
606
|
+
{ value: 'inherit', label: this._t('flowTree.properties.options.dedupInherit') },
|
|
607
|
+
{ value: 'none', label: this._t('flowTree.properties.options.dedupNone') },
|
|
608
|
+
{ value: 'consecutive', label: this._t('flowTree.properties.options.dedupConsecutive') },
|
|
609
|
+
{ value: 'all', label: this._t('flowTree.properties.options.dedupAll') },
|
|
610
|
+
],
|
|
611
|
+
onChange: (value) => this.controller.commands.updateNodeConfig(node.id, { dedupStrategy: value }),
|
|
612
|
+
})),
|
|
613
|
+
);
|
|
614
|
+
body.appendChild(dedupSec.section);
|
|
615
|
+
|
|
616
|
+
const timeout = config.timeout || {};
|
|
617
|
+
const timeoutSec = createSection(this._t('flowTree.properties.sections.timeout'));
|
|
618
|
+
timeoutSec.body.appendChild(createField('', createSwitch({
|
|
619
|
+
checked: Boolean(timeout.enabled),
|
|
620
|
+
label: this._t('flowTree.properties.fields.timeoutEnabled'),
|
|
621
|
+
onChange: (enabled) => this.controller.commands.updateNodeConfig(node.id, { timeout: { enabled } }),
|
|
622
|
+
})));
|
|
623
|
+
if (timeout.enabled) {
|
|
624
|
+
const inline = dom('div', 'ft-prop-inline-2');
|
|
625
|
+
inline.append(
|
|
626
|
+
createField(this._t('flowTree.properties.fields.timeoutDuration'), createNumberInput({
|
|
627
|
+
value: timeout.duration || 24,
|
|
628
|
+
min: 1,
|
|
629
|
+
onChange: (duration) => this.controller.commands.updateNodeConfig(node.id, { timeout: { duration: Math.max(1, duration || 1) } }),
|
|
630
|
+
})),
|
|
631
|
+
createField(this._t('flowTree.properties.fields.timeoutUnit'), createSelect({
|
|
632
|
+
value: timeout.unit || 'hour',
|
|
633
|
+
options: [
|
|
634
|
+
{ value: 'minute', label: this._t('flowTree.properties.options.unitMinute') },
|
|
635
|
+
{ value: 'hour', label: this._t('flowTree.properties.options.unitHour') },
|
|
636
|
+
{ value: 'day', label: this._t('flowTree.properties.options.unitDay') },
|
|
637
|
+
],
|
|
638
|
+
onChange: (unit) => this.controller.commands.updateNodeConfig(node.id, { timeout: { unit } }),
|
|
639
|
+
})),
|
|
640
|
+
);
|
|
641
|
+
timeoutSec.body.append(
|
|
642
|
+
inline,
|
|
643
|
+
createField(this._t('flowTree.properties.fields.timeoutAction'), createSelect({
|
|
644
|
+
value: timeout.action || 'remind',
|
|
645
|
+
options: [
|
|
646
|
+
{ value: 'remind', label: this._t('flowTree.properties.options.timeoutRemind') },
|
|
647
|
+
{ value: 'autoPass', label: this._t('flowTree.properties.options.timeoutAutoPass') },
|
|
648
|
+
{ value: 'autoReject', label: this._t('flowTree.properties.options.timeoutAutoReject') },
|
|
649
|
+
{ value: 'transfer', label: this._t('flowTree.properties.options.timeoutTransfer') },
|
|
650
|
+
],
|
|
651
|
+
onChange: (action) => this.controller.commands.updateNodeConfig(node.id, { timeout: { action } }),
|
|
652
|
+
})),
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
body.appendChild(timeoutSec.section);
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// Basic tab
|
|
660
|
+
const basicSec = createSection(this._t('flowTree.properties.sections.assignee'));
|
|
661
|
+
basicSec.body.appendChild(createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
662
|
+
value: node.name,
|
|
663
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
664
|
+
})));
|
|
665
|
+
this._appendAssigneeFields(basicSec.body, node);
|
|
666
|
+
body.appendChild(basicSec.section);
|
|
667
|
+
|
|
668
|
+
const modeSec = createSection(this._t('flowTree.properties.sections.approvalMode'));
|
|
669
|
+
modeSec.body.appendChild(createField(this._t('flowTree.properties.fields.approvalMode'), createSelect({
|
|
670
|
+
value: config.approvalMode || 'or',
|
|
671
|
+
options: [
|
|
672
|
+
{ value: 'or', label: this._t('flowTree.properties.options.modeOr') },
|
|
673
|
+
{ value: 'and', label: this._t('flowTree.properties.options.modeAnd') },
|
|
674
|
+
{ value: 'sequential', label: this._t('flowTree.properties.options.modeSequential') },
|
|
675
|
+
{ value: 'percentage', label: this._t('flowTree.properties.options.modePercentage') },
|
|
676
|
+
],
|
|
677
|
+
onChange: (approvalMode) => this.controller.commands.updateNodeConfig(node.id, { approvalMode }),
|
|
678
|
+
})));
|
|
679
|
+
if (config.approvalMode === 'percentage') {
|
|
680
|
+
modeSec.body.appendChild(createField(this._t('flowTree.properties.fields.passPercentage'), createNumberInput({
|
|
681
|
+
value: config.passPercentage ?? 60,
|
|
682
|
+
min: 1,
|
|
683
|
+
max: 100,
|
|
684
|
+
onChange: (passPercentage) => this.controller.commands.updateNodeConfig(node.id, { passPercentage: Math.max(1, Math.min(100, passPercentage || 60)) }),
|
|
685
|
+
})));
|
|
686
|
+
}
|
|
687
|
+
body.appendChild(modeSec.section);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
_renderCc(body, node, tab) {
|
|
691
|
+
const config = node.config || {};
|
|
692
|
+
if (tab === 'form') {
|
|
693
|
+
const sec = createSection(this._t('flowTree.properties.sections.formPermissions'));
|
|
694
|
+
sec.body.appendChild(createFormPermissionMatrix({
|
|
695
|
+
permissions: config.formPermissions,
|
|
696
|
+
formFields: this._formFields,
|
|
697
|
+
allowEditable: false,
|
|
698
|
+
i18n: this.i18n,
|
|
699
|
+
onChange: (next) => this.controller.commands.updateNodeConfig(node.id, { formPermissions: next }),
|
|
700
|
+
}));
|
|
701
|
+
body.appendChild(sec.section);
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
const sec = createSection(this._t('flowTree.properties.sections.ccTargets'));
|
|
706
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
707
|
+
value: node.name,
|
|
708
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
709
|
+
})));
|
|
710
|
+
this._appendAssigneeFields(sec.body, node, {
|
|
711
|
+
includeMultiSupervisor: false,
|
|
712
|
+
includeSelfSelect: false,
|
|
713
|
+
includeInitiatorSelf: false,
|
|
714
|
+
includeExpression: false,
|
|
715
|
+
});
|
|
716
|
+
sec.body.append(
|
|
717
|
+
createField('', createSwitch({
|
|
718
|
+
checked: Boolean(config.allowStarterSelfSelect),
|
|
719
|
+
label: this._t('flowTree.properties.fields.allowStarterSelfSelectCc'),
|
|
720
|
+
onChange: (allowStarterSelfSelect) => this.controller.commands.updateNodeConfig(node.id, { allowStarterSelfSelect }),
|
|
721
|
+
})),
|
|
722
|
+
createField(this._t('flowTree.properties.fields.ccTiming'), createSelect({
|
|
723
|
+
value: config.ccTiming || 'onArrive',
|
|
724
|
+
options: [
|
|
725
|
+
{ value: 'onArrive', label: this._t('flowTree.properties.options.ccOnArrive') },
|
|
726
|
+
{ value: 'onProcessEnd', label: this._t('flowTree.properties.options.ccOnProcessEnd') },
|
|
727
|
+
],
|
|
728
|
+
onChange: (ccTiming) => this.controller.commands.updateNodeConfig(node.id, { ccTiming }),
|
|
729
|
+
})),
|
|
730
|
+
createField(this._t('flowTree.properties.fields.ccDelegateExpression'), createTextInput({
|
|
731
|
+
value: config.delegateExpression || '${novaCcDelegate}',
|
|
732
|
+
monospace: true,
|
|
733
|
+
onChange: (delegateExpression) => this.controller.commands.updateNodeConfig(node.id, { delegateExpression }),
|
|
734
|
+
})),
|
|
735
|
+
);
|
|
736
|
+
body.appendChild(sec.section);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
_renderHandler(body, node, tab) {
|
|
740
|
+
const config = node.config || {};
|
|
741
|
+
if (tab === 'form') {
|
|
742
|
+
const sec = createSection(this._t('flowTree.properties.sections.formPermissions'));
|
|
743
|
+
sec.body.appendChild(createFormPermissionMatrix({
|
|
744
|
+
permissions: config.formPermissions,
|
|
745
|
+
formFields: this._formFields,
|
|
746
|
+
allowEditable: true,
|
|
747
|
+
i18n: this.i18n,
|
|
748
|
+
onChange: (next) => this.controller.commands.updateNodeConfig(node.id, { formPermissions: next }),
|
|
749
|
+
}));
|
|
750
|
+
body.appendChild(sec.section);
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
if (tab === 'buttons') {
|
|
755
|
+
const buttons = config.buttons || {};
|
|
756
|
+
const sec = createSection(this._t('flowTree.properties.sections.buttons'));
|
|
757
|
+
for (const key of ['complete', 'transfer', 'returnEnabled']) {
|
|
758
|
+
sec.body.appendChild(createField('', createSwitch({
|
|
759
|
+
checked: Boolean(buttons[key]),
|
|
760
|
+
label: this._t(`flowTree.properties.buttons.${key}`),
|
|
761
|
+
onChange: (checked) => this.controller.commands.updateNodeConfig(node.id, { buttons: { [key]: checked } }),
|
|
762
|
+
})));
|
|
763
|
+
}
|
|
764
|
+
body.appendChild(sec.section);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
const sec = createSection(this._t('flowTree.properties.sections.handlerAssignee'));
|
|
769
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
770
|
+
value: node.name,
|
|
771
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
772
|
+
})));
|
|
773
|
+
this._appendAssigneeFields(sec.body, node, { includeMultiSupervisor: false });
|
|
774
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.sections.handlerMode'), createSelect({
|
|
775
|
+
value: config.completionMode || 'or',
|
|
776
|
+
options: [
|
|
777
|
+
{ value: 'or', label: this._t('flowTree.properties.options.modeOr') },
|
|
778
|
+
{ value: 'and', label: this._t('flowTree.properties.options.modeAnd') },
|
|
779
|
+
{ value: 'sequential', label: this._t('flowTree.properties.options.modeSequential') },
|
|
780
|
+
],
|
|
781
|
+
onChange: (completionMode) => this.controller.commands.updateNodeConfig(node.id, { completionMode }),
|
|
782
|
+
})));
|
|
783
|
+
body.appendChild(sec.section);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
_renderConditionBranch(body, node, doc) {
|
|
787
|
+
const config = node.config || {};
|
|
788
|
+
const loc = findFlowTreeNodeLocation(doc, node.id);
|
|
789
|
+
const route = loc?.route;
|
|
790
|
+
const sec = createSection(this._t('flowTree.properties.sections.conditionMode'));
|
|
791
|
+
|
|
792
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
793
|
+
value: node.name,
|
|
794
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
795
|
+
})));
|
|
796
|
+
|
|
797
|
+
if (route && !node.isDefault) {
|
|
798
|
+
const movableCount = Math.max(1, route.branches.filter((b) => !b.isDefault).length);
|
|
799
|
+
const priorityOptions = Array.from({ length: movableCount }, (_, index) => ({
|
|
800
|
+
value: String(index),
|
|
801
|
+
label: this._t('flowTree.canvas.priorityBadge', { priority: index + 1 }),
|
|
802
|
+
}));
|
|
803
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.priority'), createSelect({
|
|
804
|
+
value: String(loc.branchIndex),
|
|
805
|
+
options: priorityOptions,
|
|
806
|
+
onChange: (targetIndex) => this.controller.commands.reorderBranch(route.id, loc.branchIndex, Number(targetIndex)),
|
|
807
|
+
})));
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
if (node.isDefault) {
|
|
811
|
+
sec.body.appendChild(dom('div', 'ft-prop-empty-box', this._t('flowTree.canvas.defaultBranchSummary')));
|
|
812
|
+
body.appendChild(sec.section);
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.branchConditionMode'), createSelect({
|
|
817
|
+
value: config.mode || 'visual',
|
|
818
|
+
options: [
|
|
819
|
+
{ value: 'visual', label: this._t('flowTree.properties.options.conditionVisual') },
|
|
820
|
+
{ value: 'expression', label: this._t('flowTree.properties.options.conditionExpression') },
|
|
821
|
+
],
|
|
822
|
+
onChange: (mode) => this.controller.commands.updateNodeConfig(node.id, { mode }),
|
|
823
|
+
})));
|
|
824
|
+
body.appendChild(sec.section);
|
|
825
|
+
|
|
826
|
+
if ((config.mode || 'visual') === 'expression') {
|
|
827
|
+
const exprSec = createSection(this._t('flowTree.properties.sections.conditionExpression'));
|
|
828
|
+
exprSec.body.appendChild(createField('', createTextarea({
|
|
829
|
+
value: config.expression || '',
|
|
830
|
+
rows: 4,
|
|
831
|
+
monospace: true,
|
|
832
|
+
placeholder: '${amount >= 50000 && department == \'RD\'}',
|
|
833
|
+
onChange: (expression) => this.controller.commands.updateNodeConfig(node.id, { expression }),
|
|
834
|
+
})));
|
|
835
|
+
const compiled = compileBranchCondition(node);
|
|
836
|
+
const preview = dom('div', 'ft-cond-preview');
|
|
837
|
+
preview.append(
|
|
838
|
+
dom('small', '', this._t('flowTree.properties.sections.conditionPreview')),
|
|
839
|
+
dom('code', '', compiled || this._t('flowTree.properties.condition.noExpressionYet')),
|
|
840
|
+
);
|
|
841
|
+
exprSec.body.appendChild(preview);
|
|
842
|
+
body.appendChild(exprSec.section);
|
|
843
|
+
} else {
|
|
844
|
+
const builderSec = createSection(this._t('flowTree.properties.sections.conditionBuilder'));
|
|
845
|
+
builderSec.body.appendChild(createConditionBuilder({
|
|
846
|
+
groups: config.conditionGroups || [],
|
|
847
|
+
formFields: this._formFields,
|
|
848
|
+
i18n: this.i18n,
|
|
849
|
+
onChange: (conditionGroups) => this.controller.commands.updateNodeConfig(node.id, { conditionGroups }),
|
|
850
|
+
}));
|
|
851
|
+
body.appendChild(builderSec.section);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
_renderParallelBranch(body, node) {
|
|
856
|
+
const sec = createSection(this._t('flowTree.nodeTypes.parallelBranch'), this._t('flowTree.canvas.parallelBranchSummary'));
|
|
857
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
858
|
+
value: node.name,
|
|
859
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
860
|
+
})));
|
|
861
|
+
body.appendChild(sec.section);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
_renderDelay(body, node) {
|
|
865
|
+
const config = node.config || {};
|
|
866
|
+
const sec = createSection(this._t('flowTree.properties.sections.delayConfig'));
|
|
867
|
+
sec.body.append(
|
|
868
|
+
createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
869
|
+
value: node.name,
|
|
870
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
871
|
+
})),
|
|
872
|
+
createField(this._t('flowTree.properties.fields.delayType'), createSelect({
|
|
873
|
+
value: config.delayType || 'duration',
|
|
874
|
+
options: [
|
|
875
|
+
{ value: 'duration', label: this._t('flowTree.properties.options.delayDuration') },
|
|
876
|
+
{ value: 'fixedDate', label: this._t('flowTree.properties.options.delayFixedDate') },
|
|
877
|
+
{ value: 'cron', label: this._t('flowTree.properties.options.delayCron') },
|
|
878
|
+
],
|
|
879
|
+
onChange: (delayType) => this.controller.commands.updateNodeConfig(node.id, { delayType }),
|
|
880
|
+
})),
|
|
881
|
+
);
|
|
882
|
+
|
|
883
|
+
if ((config.delayType || 'duration') === 'duration') {
|
|
884
|
+
const inline = dom('div', 'ft-prop-inline-2');
|
|
885
|
+
inline.append(
|
|
886
|
+
createField(this._t('flowTree.properties.fields.delayValue'), createNumberInput({
|
|
887
|
+
value: config.duration || 1,
|
|
888
|
+
min: 1,
|
|
889
|
+
onChange: (duration) => this.controller.commands.updateNodeConfig(node.id, { duration: Math.max(1, duration || 1) }),
|
|
890
|
+
})),
|
|
891
|
+
createField(this._t('flowTree.properties.fields.delayUnit'), createSelect({
|
|
892
|
+
value: config.unit || 'hour',
|
|
893
|
+
options: [
|
|
894
|
+
{ value: 'minute', label: this._t('flowTree.properties.options.unitMinute') },
|
|
895
|
+
{ value: 'hour', label: this._t('flowTree.properties.options.unitHour') },
|
|
896
|
+
{ value: 'day', label: this._t('flowTree.properties.options.unitDay') },
|
|
897
|
+
],
|
|
898
|
+
onChange: (unit) => this.controller.commands.updateNodeConfig(node.id, { unit }),
|
|
899
|
+
})),
|
|
900
|
+
);
|
|
901
|
+
sec.body.appendChild(inline);
|
|
902
|
+
} else if (config.delayType === 'fixedDate') {
|
|
903
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.delayDate'), createTextInput({
|
|
904
|
+
value: config.fixedDate || '',
|
|
905
|
+
placeholder: '2026-12-31T09:00:00+08:00 or ${dueDate}',
|
|
906
|
+
monospace: true,
|
|
907
|
+
onChange: (fixedDate) => this.controller.commands.updateNodeConfig(node.id, { fixedDate }),
|
|
908
|
+
})));
|
|
909
|
+
} else {
|
|
910
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.delayCron'), createTextInput({
|
|
911
|
+
value: config.cronExpression || '',
|
|
912
|
+
placeholder: 'R3/PT1H or 0 0 9 * * ?',
|
|
913
|
+
monospace: true,
|
|
914
|
+
onChange: (cronExpression) => this.controller.commands.updateNodeConfig(node.id, { cronExpression }),
|
|
915
|
+
})));
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
const compiled = compileDelayToTimer(config);
|
|
919
|
+
const preview = dom('div', 'ft-cond-preview');
|
|
920
|
+
preview.append(dom('small', '', `BPMN timer (${compiled.timerType})`), dom('code', '', compiled.timerValue || '—'));
|
|
921
|
+
sec.body.appendChild(preview);
|
|
922
|
+
body.appendChild(sec.section);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
_renderTrigger(body, node) {
|
|
926
|
+
const config = node.config || {};
|
|
927
|
+
const sec = createSection(this._t('flowTree.properties.sections.triggerConfig'));
|
|
928
|
+
sec.body.append(
|
|
929
|
+
createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
930
|
+
value: node.name,
|
|
931
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
932
|
+
})),
|
|
933
|
+
createField(this._t('flowTree.properties.fields.triggerType'), createSelect({
|
|
934
|
+
value: config.triggerType || 'webhook',
|
|
935
|
+
options: [
|
|
936
|
+
{ value: 'webhook', label: this._t('flowTree.properties.options.triggerWebhook') },
|
|
937
|
+
{ value: 'serviceClass', label: this._t('flowTree.properties.options.triggerClass') },
|
|
938
|
+
{ value: 'delegateExpression', label: this._t('flowTree.properties.options.triggerDelegateExpression') },
|
|
939
|
+
{ value: 'expression', label: this._t('flowTree.properties.options.triggerExpression') },
|
|
940
|
+
],
|
|
941
|
+
onChange: (triggerType) => this.controller.commands.updateNodeConfig(node.id, { triggerType }),
|
|
942
|
+
})),
|
|
943
|
+
);
|
|
944
|
+
|
|
945
|
+
if ((config.triggerType || 'webhook') === 'webhook') {
|
|
946
|
+
sec.body.append(
|
|
947
|
+
createField(this._t('flowTree.properties.fields.webhookMethod'), createSelect({
|
|
948
|
+
value: config.method || 'POST',
|
|
949
|
+
options: ['POST', 'PUT', 'GET', 'PATCH', 'DELETE'].map((m) => ({ value: m, label: m })),
|
|
950
|
+
onChange: (method) => this.controller.commands.updateNodeConfig(node.id, { method }),
|
|
951
|
+
})),
|
|
952
|
+
createField(this._t('flowTree.properties.fields.webhookUrl'), createTextInput({
|
|
953
|
+
value: config.url || '',
|
|
954
|
+
placeholder: 'https://api.example.com/webhook',
|
|
955
|
+
monospace: true,
|
|
956
|
+
onChange: (url) => this.controller.commands.updateNodeConfig(node.id, { url }),
|
|
957
|
+
}), { required: true }),
|
|
958
|
+
createField(this._t('flowTree.properties.fields.webhookHeaders'), createKeyValueTable({
|
|
959
|
+
rows: config.headers || [],
|
|
960
|
+
columns: [
|
|
961
|
+
{ key: 'key', label: this._t('flowTree.properties.params.headerKey'), placeholder: 'Authorization' },
|
|
962
|
+
{ key: 'value', label: this._t('flowTree.properties.params.headerValue'), placeholder: 'Bearer ...' },
|
|
963
|
+
],
|
|
964
|
+
addLabel: this._t('flowTree.properties.params.addRow'),
|
|
965
|
+
onChange: (headers) => this.controller.commands.updateNodeConfig(node.id, { headers }),
|
|
966
|
+
})),
|
|
967
|
+
createField(this._t('flowTree.properties.fields.webhookBody'), createTextarea({
|
|
968
|
+
value: config.bodyTemplate || '',
|
|
969
|
+
rows: 4,
|
|
970
|
+
monospace: true,
|
|
971
|
+
onChange: (bodyTemplate) => this.controller.commands.updateNodeConfig(node.id, { bodyTemplate }),
|
|
972
|
+
})),
|
|
973
|
+
);
|
|
974
|
+
} else {
|
|
975
|
+
sec.body.append(
|
|
976
|
+
createField(this._t('flowTree.properties.fields.implementation'), createTextInput({
|
|
977
|
+
value: config.implementation || '',
|
|
978
|
+
placeholder: config.triggerType === 'serviceClass' ? 'com.example.workflow.OrderDelegate' : '${orderDelegate}',
|
|
979
|
+
monospace: true,
|
|
980
|
+
onChange: (implementation) => this.controller.commands.updateNodeConfig(node.id, { implementation }),
|
|
981
|
+
}), { required: true }),
|
|
982
|
+
createField(this._t('flowTree.properties.fields.fieldsInjection'), createKeyValueTable({
|
|
983
|
+
rows: config.fields || [],
|
|
984
|
+
columns: [
|
|
985
|
+
{ key: 'name', label: this._t('flowTree.properties.params.fieldName'), placeholder: 'topic' },
|
|
986
|
+
{ key: 'value', label: this._t('flowTree.properties.params.fieldValue'), placeholder: 'order.created' },
|
|
987
|
+
],
|
|
988
|
+
addLabel: this._t('flowTree.properties.params.addRow'),
|
|
989
|
+
onChange: (fields) => this.controller.commands.updateNodeConfig(node.id, { fields: fields.map((f) => ({ type: 'string', ...f })) }),
|
|
990
|
+
})),
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
sec.body.append(
|
|
995
|
+
createField(this._t('flowTree.properties.fields.resultVariable'), createTextInput({
|
|
996
|
+
value: config.resultVariable || '',
|
|
997
|
+
monospace: true,
|
|
998
|
+
placeholder: 'webhookResult',
|
|
999
|
+
onChange: (resultVariable) => this.controller.commands.updateNodeConfig(node.id, { resultVariable }),
|
|
1000
|
+
})),
|
|
1001
|
+
createField('', createSwitch({
|
|
1002
|
+
checked: Boolean(config.async),
|
|
1003
|
+
label: this._t('flowTree.properties.fields.asyncExecution'),
|
|
1004
|
+
onChange: (asyncFlag) => this.controller.commands.updateNodeConfig(node.id, { async: asyncFlag }),
|
|
1005
|
+
})),
|
|
1006
|
+
);
|
|
1007
|
+
if (config.async) {
|
|
1008
|
+
sec.body.appendChild(createField(this._t('flowTree.properties.fields.retryCycle'), createTextInput({
|
|
1009
|
+
value: config.retryCycle || '',
|
|
1010
|
+
monospace: true,
|
|
1011
|
+
placeholder: 'R3/PT5M',
|
|
1012
|
+
onChange: (retryCycle) => this.controller.commands.updateNodeConfig(node.id, { retryCycle }),
|
|
1013
|
+
})));
|
|
1014
|
+
}
|
|
1015
|
+
body.appendChild(sec.section);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
_renderSubFlow(body, node) {
|
|
1019
|
+
const config = node.config || {};
|
|
1020
|
+
const sec = createSection(this._t('flowTree.properties.sections.subFlowConfig'));
|
|
1021
|
+
sec.body.append(
|
|
1022
|
+
createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
1023
|
+
value: node.name,
|
|
1024
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
1025
|
+
})),
|
|
1026
|
+
createField(this._t('flowTree.properties.fields.subFlowMode'), createSelect({
|
|
1027
|
+
value: config.subFlowMode || 'callActivity',
|
|
1028
|
+
options: [
|
|
1029
|
+
{ value: 'callActivity', label: this._t('flowTree.properties.options.subFlowCallActivity') },
|
|
1030
|
+
{ value: 'embedded', label: this._t('flowTree.properties.options.subFlowEmbedded') },
|
|
1031
|
+
],
|
|
1032
|
+
onChange: (subFlowMode) => this.controller.commands.updateNodeConfig(node.id, { subFlowMode }),
|
|
1033
|
+
})),
|
|
1034
|
+
);
|
|
1035
|
+
|
|
1036
|
+
if ((config.subFlowMode || 'callActivity') === 'callActivity') {
|
|
1037
|
+
const targetControl = this._subProcessOptions.length
|
|
1038
|
+
? createSelect({
|
|
1039
|
+
value: config.calledElement || '',
|
|
1040
|
+
options: [
|
|
1041
|
+
{ value: '', label: '—' },
|
|
1042
|
+
...this._subProcessOptions.map((item) => ({ value: item.id, label: `${item.name} (${item.id})` })),
|
|
1043
|
+
...(config.calledElement && !this._subProcessOptions.some((o) => o.id === config.calledElement)
|
|
1044
|
+
? [{ value: config.calledElement, label: config.calledElement }]
|
|
1045
|
+
: []),
|
|
1046
|
+
],
|
|
1047
|
+
onChange: (calledElement) => this.controller.commands.updateNodeConfig(node.id, { calledElement }),
|
|
1048
|
+
})
|
|
1049
|
+
: createTextInput({
|
|
1050
|
+
value: config.calledElement || '',
|
|
1051
|
+
monospace: true,
|
|
1052
|
+
placeholder: 'Process_SubApproval',
|
|
1053
|
+
onChange: (calledElement) => this.controller.commands.updateNodeConfig(node.id, { calledElement }),
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
sec.body.append(
|
|
1057
|
+
createField(this._t('flowTree.properties.fields.calledElement'), targetControl, { required: true }),
|
|
1058
|
+
createField('', createSwitch({
|
|
1059
|
+
checked: config.inheritBusinessKey !== false,
|
|
1060
|
+
label: this._t('flowTree.properties.fields.inheritBusinessKey'),
|
|
1061
|
+
onChange: (inheritBusinessKey) => this.controller.commands.updateNodeConfig(node.id, { inheritBusinessKey }),
|
|
1062
|
+
})),
|
|
1063
|
+
createField('', createSwitch({
|
|
1064
|
+
checked: config.inheritVariables !== false,
|
|
1065
|
+
label: this._t('flowTree.properties.fields.inheritVariables'),
|
|
1066
|
+
onChange: (inheritVariables) => this.controller.commands.updateNodeConfig(node.id, { inheritVariables }),
|
|
1067
|
+
})),
|
|
1068
|
+
createField(this._t('flowTree.properties.fields.inParameters'), createKeyValueTable({
|
|
1069
|
+
rows: config.inParameters || [],
|
|
1070
|
+
columns: [
|
|
1071
|
+
{ key: 'source', label: this._t('flowTree.properties.params.source'), placeholder: 'amount' },
|
|
1072
|
+
{ key: 'target', label: this._t('flowTree.properties.params.target'), placeholder: 'subAmount' },
|
|
1073
|
+
],
|
|
1074
|
+
addLabel: this._t('flowTree.properties.params.addRow'),
|
|
1075
|
+
onChange: (inParameters) => this.controller.commands.updateNodeConfig(node.id, { inParameters }),
|
|
1076
|
+
})),
|
|
1077
|
+
createField(this._t('flowTree.properties.fields.outParameters'), createKeyValueTable({
|
|
1078
|
+
rows: config.outParameters || [],
|
|
1079
|
+
columns: [
|
|
1080
|
+
{ key: 'source', label: this._t('flowTree.properties.params.target'), placeholder: 'subResult' },
|
|
1081
|
+
{ key: 'target', label: this._t('flowTree.properties.params.source'), placeholder: 'approvedResult' },
|
|
1082
|
+
],
|
|
1083
|
+
addLabel: this._t('flowTree.properties.params.addRow'),
|
|
1084
|
+
onChange: (outParameters) => this.controller.commands.updateNodeConfig(node.id, { outParameters }),
|
|
1085
|
+
})),
|
|
1086
|
+
);
|
|
1087
|
+
} else {
|
|
1088
|
+
sec.body.append(
|
|
1089
|
+
dom('p', 'ft-prop-section-desc', this._t('flowTree.properties.fields.embeddedStepsHint')),
|
|
1090
|
+
createEmbeddedStepsEditor({ node, controller: this.controller, i18n: this.i18n }),
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
body.appendChild(sec.section);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
_renderEnd(body, node) {
|
|
1098
|
+
const sec = createSection(this._t('flowTree.properties.sections.endConfig'), this._t('flowTree.canvas.endSummary'));
|
|
1099
|
+
sec.body.append(
|
|
1100
|
+
createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
1101
|
+
value: node.name,
|
|
1102
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
1103
|
+
})),
|
|
1104
|
+
createField(this._t('flowTree.properties.fields.documentation'), createTextarea({
|
|
1105
|
+
value: node.config?.documentation || '',
|
|
1106
|
+
rows: 3,
|
|
1107
|
+
onChange: (documentation) => this.controller.commands.updateNodeConfig(node.id, { documentation }),
|
|
1108
|
+
})),
|
|
1109
|
+
);
|
|
1110
|
+
body.appendChild(sec.section);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
_renderGenericCustomNode(body, node) {
|
|
1114
|
+
const sec = createSection(resolveFlowTreeTypeLabel(node.type, { i18n: this.i18n, nodeRegistry: this.controller.nodeRegistry }));
|
|
1115
|
+
sec.body.append(
|
|
1116
|
+
createField(this._t('flowTree.properties.fields.nodeName'), createTextInput({
|
|
1117
|
+
value: node.name,
|
|
1118
|
+
onChange: (value) => this.controller.commands.updateNode(node.id, { name: value }),
|
|
1119
|
+
})),
|
|
1120
|
+
createField('JSON Config', createTextarea({
|
|
1121
|
+
value: JSON.stringify(node.config || {}, null, 2),
|
|
1122
|
+
rows: 6,
|
|
1123
|
+
monospace: true,
|
|
1124
|
+
onChange: (raw) => {
|
|
1125
|
+
try {
|
|
1126
|
+
const parsed = JSON.parse(raw);
|
|
1127
|
+
this.controller.commands.updateNode(node.id, { config: parsed });
|
|
1128
|
+
} catch {
|
|
1129
|
+
// Keep editing until valid JSON
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
})),
|
|
1133
|
+
);
|
|
1134
|
+
body.appendChild(sec.section);
|
|
1135
|
+
}
|
|
1136
|
+
}
|