@5minds/node-red-dashboard-2-processcube-dynamic-form 2.2.1-feature-f23868-me6xe1gp → 2.2.1-feature-451281-mf6lqajn
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/nodes/ui-dynamic-form.html +332 -63
- package/package.json +1 -1
- package/resources/ui-dynamic-form.umd.js +14 -14
- package/ui/components/FooterActions.vue +13 -47
- package/ui/components/UIDynamicForm.vue +82 -69
|
@@ -59,6 +59,12 @@
|
|
|
59
59
|
handle_confirmation_dialogs: {
|
|
60
60
|
value: false,
|
|
61
61
|
},
|
|
62
|
+
confirm_actions: {
|
|
63
|
+
value: [
|
|
64
|
+
{ label: 'Confirm', primary: 'primary', alignment: 'right' },
|
|
65
|
+
{ label: 'Decline', primary: 'primary', alignment: 'right' },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
62
68
|
width: {
|
|
63
69
|
value: 0,
|
|
64
70
|
validate: function (v) {
|
|
@@ -78,17 +84,15 @@
|
|
|
78
84
|
outputLabels: function (index) {
|
|
79
85
|
const labels = [...this.options.map((i) => i.label)];
|
|
80
86
|
|
|
81
|
-
if (this.handle_confirmation_dialogs) {
|
|
82
|
-
|
|
87
|
+
if (this.handle_confirmation_dialogs && this.confirm_actions) {
|
|
88
|
+
// Labels come from user task field configuration (confirmButtonText/declineButtonText)
|
|
89
|
+
labels.push('Decline (from UserTask)', 'Confirm (from UserTask)');
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
if (this.trigger_on_change) {
|
|
86
93
|
labels.push('Triggered on change');
|
|
87
94
|
}
|
|
88
95
|
|
|
89
|
-
labels.push('Suspend');
|
|
90
|
-
labels.push('Terminate');
|
|
91
|
-
|
|
92
96
|
return labels[index];
|
|
93
97
|
},
|
|
94
98
|
icon: 'ui_dynamic_form.svg',
|
|
@@ -121,43 +125,66 @@
|
|
|
121
125
|
});
|
|
122
126
|
|
|
123
127
|
function generateOption(i, option) {
|
|
124
|
-
const
|
|
125
|
-
style: 'background: var(--red-ui-secondary-background, #fff);
|
|
128
|
+
const row = $('<tr/>', {
|
|
129
|
+
style: 'background: var(--red-ui-secondary-background, #fff);',
|
|
126
130
|
});
|
|
127
131
|
|
|
128
|
-
const
|
|
132
|
+
const labelCell = $('<td/>', {
|
|
133
|
+
style: 'padding: 4px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #eee);',
|
|
134
|
+
}).appendTo(row);
|
|
129
135
|
$('<input/>', {
|
|
130
136
|
class: 'node-input-option-label',
|
|
131
137
|
type: 'text',
|
|
132
|
-
style:
|
|
138
|
+
style:
|
|
139
|
+
'width: 100%; box-sizing: border-box; border: 1px solid var(--red-ui-form-input-border-color, #ccc); padding: 3px;',
|
|
133
140
|
placeholder: 'Label',
|
|
134
141
|
value: option.label,
|
|
135
|
-
}).appendTo(
|
|
142
|
+
}).appendTo(labelCell);
|
|
136
143
|
|
|
137
|
-
$('<
|
|
144
|
+
const conditionCell = $('<td/>', {
|
|
145
|
+
style: 'padding: 4px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #eee);',
|
|
146
|
+
}).appendTo(row);
|
|
147
|
+
const conditionInput = $('<input/>', {
|
|
138
148
|
class: 'node-input-option-condition',
|
|
139
149
|
type: 'text',
|
|
140
|
-
style:
|
|
150
|
+
style:
|
|
151
|
+
'width: 100%; box-sizing: border-box; border: 1px solid var(--red-ui-form-input-border-color, #ccc); padding: 3px;',
|
|
141
152
|
placeholder: 'Condition',
|
|
142
153
|
value: option.condition,
|
|
143
|
-
}).appendTo(
|
|
154
|
+
}).appendTo(conditionCell);
|
|
155
|
+
|
|
156
|
+
conditionInput.data('explicitly-cleared', false);
|
|
157
|
+
conditionInput.on('input', function () {
|
|
158
|
+
if ($(this).val().trim() === '') {
|
|
159
|
+
$(this).data('explicitly-cleared', true);
|
|
160
|
+
} else {
|
|
161
|
+
$(this).data('explicitly-cleared', false);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
144
164
|
|
|
165
|
+
const errorCell = $('<td/>', {
|
|
166
|
+
style: 'padding: 4px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #eee);',
|
|
167
|
+
}).appendTo(row);
|
|
145
168
|
$('<input/>', {
|
|
146
169
|
class: 'node-input-option-error',
|
|
147
170
|
type: 'text',
|
|
148
|
-
style:
|
|
171
|
+
style:
|
|
172
|
+
'width: 100%; box-sizing: border-box; border: 1px solid var(--red-ui-form-input-border-color, #ccc); padding: 3px;',
|
|
149
173
|
placeholder: 'Error message',
|
|
150
174
|
value: option.errorMessage,
|
|
151
|
-
}).appendTo(
|
|
175
|
+
}).appendTo(errorCell);
|
|
152
176
|
|
|
177
|
+
const alignmentCell = $('<td/>', {
|
|
178
|
+
style: 'padding: 4px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #eee);',
|
|
179
|
+
}).appendTo(row);
|
|
153
180
|
$('<input/>', {
|
|
154
181
|
class: 'node-input-option-alignment',
|
|
155
182
|
type: 'text',
|
|
156
|
-
style: '
|
|
183
|
+
style: 'width: 100%; box-sizing: border-box;',
|
|
157
184
|
placeholder: 'Alignment',
|
|
158
185
|
value: option.alignment,
|
|
159
186
|
})
|
|
160
|
-
.appendTo(
|
|
187
|
+
.appendTo(alignmentCell)
|
|
161
188
|
.typedInput({
|
|
162
189
|
types: [
|
|
163
190
|
{
|
|
@@ -170,51 +197,85 @@
|
|
|
170
197
|
],
|
|
171
198
|
});
|
|
172
199
|
|
|
200
|
+
const typeCell = $('<td/>', {
|
|
201
|
+
style: 'padding: 4px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #eee);',
|
|
202
|
+
}).appendTo(row);
|
|
173
203
|
$('<input/>', {
|
|
174
204
|
class: 'node-input-option-primary',
|
|
175
205
|
type: 'text',
|
|
176
|
-
style: '
|
|
206
|
+
style: 'width: 100%; box-sizing: border-box;',
|
|
177
207
|
placeholder: 'Action type',
|
|
178
208
|
value: option.primary,
|
|
179
209
|
})
|
|
180
|
-
.appendTo(
|
|
210
|
+
.appendTo(typeCell)
|
|
181
211
|
.typedInput({
|
|
182
212
|
types: [
|
|
183
213
|
{
|
|
184
|
-
value: '
|
|
214
|
+
value: 'type',
|
|
185
215
|
options: [
|
|
186
|
-
{ value: '
|
|
187
|
-
{ value: '
|
|
216
|
+
{ value: 'primary', label: 'Primary action' },
|
|
217
|
+
{ value: 'secondary', label: 'Secondary action' },
|
|
218
|
+
{ value: 'destructive', label: 'Destructive action' },
|
|
188
219
|
],
|
|
189
220
|
},
|
|
190
221
|
],
|
|
191
222
|
});
|
|
192
223
|
|
|
193
|
-
const
|
|
194
|
-
style:
|
|
224
|
+
const deleteCell = $('<td/>', {
|
|
225
|
+
style:
|
|
226
|
+
'padding: 4px; text-align: center; width: 30px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #eee);',
|
|
195
227
|
}).appendTo(row);
|
|
196
228
|
const deleteButton = $('<a/>', {
|
|
197
229
|
href: '#',
|
|
198
230
|
class: 'editor-button editor-button-small',
|
|
199
|
-
style: '
|
|
200
|
-
}).appendTo(
|
|
231
|
+
style: 'height: 28px; display: inline-flex; align-items: center; justify-content: center;',
|
|
232
|
+
}).appendTo(deleteCell);
|
|
201
233
|
$('<i/>', { class: 'fa fa-remove' }).appendTo(deleteButton);
|
|
202
234
|
|
|
203
235
|
deleteButton.click(function () {
|
|
204
|
-
|
|
236
|
+
row.css({
|
|
205
237
|
background: 'var(--red-ui-secondary-background-inactive, #fee)',
|
|
206
238
|
});
|
|
207
|
-
|
|
239
|
+
row.fadeOut(300, function () {
|
|
208
240
|
$(this).remove();
|
|
241
|
+
checkForDuplicateLabels();
|
|
209
242
|
});
|
|
210
243
|
});
|
|
211
244
|
|
|
212
|
-
$('#node-input-option-container').append(
|
|
245
|
+
$('#node-input-option-container tbody').append(row);
|
|
246
|
+
|
|
247
|
+
row.find('.node-input-option-label').on('input', checkForDuplicateLabels);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function checkForDuplicateLabels() {
|
|
251
|
+
const labels = [];
|
|
252
|
+
let hasDuplicates = false;
|
|
253
|
+
|
|
254
|
+
$('#node-input-option-container tbody .node-input-option-label').each(function () {
|
|
255
|
+
const label = $(this).val().trim();
|
|
256
|
+
if (label && labels.includes(label)) {
|
|
257
|
+
hasDuplicates = true;
|
|
258
|
+
}
|
|
259
|
+
if (label) {
|
|
260
|
+
labels.push(label);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
if (hasDuplicates) {
|
|
265
|
+
$('#valWarning').show();
|
|
266
|
+
} else {
|
|
267
|
+
$('#valWarning').hide();
|
|
268
|
+
}
|
|
213
269
|
}
|
|
214
270
|
|
|
215
271
|
$('#node-input-add-option').click(function () {
|
|
216
|
-
|
|
272
|
+
const newOption = {};
|
|
273
|
+
if ($('#node-input-handle_confirmation_dialogs').is(':checked')) {
|
|
274
|
+
newOption.condition = '!usertask.isConfirmDialog';
|
|
275
|
+
}
|
|
276
|
+
generateOption($('#node-input-option-container tbody tr').length + 1, newOption);
|
|
217
277
|
$('#node-input-option-container-div').scrollTop($('#node-input-option-container-div').get(0).scrollHeight);
|
|
278
|
+
checkForDuplicateLabels();
|
|
218
279
|
});
|
|
219
280
|
|
|
220
281
|
for (let i = 0; i < this.options.length; i++) {
|
|
@@ -222,29 +283,176 @@
|
|
|
222
283
|
generateOption(i + 1, option);
|
|
223
284
|
}
|
|
224
285
|
|
|
225
|
-
$('#node-input-option-container').
|
|
286
|
+
$('#node-input-option-container tbody .node-input-option-condition').each(function () {
|
|
287
|
+
const conditionInput = $(this);
|
|
288
|
+
if (!conditionInput.val().trim()) {
|
|
289
|
+
conditionInput.data('explicitly-cleared', true);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
checkForDuplicateLabels();
|
|
294
|
+
|
|
295
|
+
$('#node-input-option-container tbody').sortable({
|
|
226
296
|
axis: 'y',
|
|
227
|
-
handle: '.node-input-option-handle',
|
|
228
297
|
cursor: 'move',
|
|
298
|
+
helper: function (e, tr) {
|
|
299
|
+
var $originals = tr.children();
|
|
300
|
+
var $helper = tr.clone();
|
|
301
|
+
$helper.children().each(function (index) {
|
|
302
|
+
$(this).width($originals.eq(index).width());
|
|
303
|
+
});
|
|
304
|
+
return $helper;
|
|
305
|
+
},
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
function generateConfirmOption(option, index) {
|
|
309
|
+
const row = $('<tr/>', {
|
|
310
|
+
style: 'background: var(--red-ui-secondary-background, #fff);',
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
const labelCell = $('<td/>', {
|
|
314
|
+
style: 'padding: 4px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #eee);',
|
|
315
|
+
}).appendTo(row);
|
|
316
|
+
$('<input/>', {
|
|
317
|
+
class: 'node-input-confirm-option-label',
|
|
318
|
+
type: 'text',
|
|
319
|
+
style:
|
|
320
|
+
'width: 100%; box-sizing: border-box; background-color: var(--red-ui-form-input-background-disabled, #f9f9f9); border: 1px solid var(--red-ui-form-input-border-color, #ccc); padding: 3px;',
|
|
321
|
+
placeholder: 'Label',
|
|
322
|
+
value: option.label,
|
|
323
|
+
readonly: true,
|
|
324
|
+
}).appendTo(labelCell);
|
|
325
|
+
|
|
326
|
+
const alignmentCell = $('<td/>', {
|
|
327
|
+
style: 'padding: 4px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #eee);',
|
|
328
|
+
}).appendTo(row);
|
|
329
|
+
$('<input/>', {
|
|
330
|
+
class: 'node-input-confirm-option-alignment',
|
|
331
|
+
type: 'text',
|
|
332
|
+
style: 'width: 100%; box-sizing: border-box;',
|
|
333
|
+
placeholder: 'Alignment',
|
|
334
|
+
value: option.alignment,
|
|
335
|
+
})
|
|
336
|
+
.appendTo(alignmentCell)
|
|
337
|
+
.typedInput({
|
|
338
|
+
types: [
|
|
339
|
+
{
|
|
340
|
+
value: 'alignment',
|
|
341
|
+
options: [
|
|
342
|
+
{ value: 'left', label: 'Align left' },
|
|
343
|
+
{ value: 'right', label: 'Align right' },
|
|
344
|
+
],
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
const primaryCell = $('<td/>', {
|
|
350
|
+
style: 'padding: 4px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #eee);',
|
|
351
|
+
}).appendTo(row);
|
|
352
|
+
$('<input/>', {
|
|
353
|
+
class: 'node-input-confirm-option-primary',
|
|
354
|
+
type: 'text',
|
|
355
|
+
style: 'width: 100%; box-sizing: border-box;',
|
|
356
|
+
placeholder: 'Action type',
|
|
357
|
+
value: option.primary,
|
|
358
|
+
})
|
|
359
|
+
.appendTo(primaryCell)
|
|
360
|
+
.typedInput({
|
|
361
|
+
types: [
|
|
362
|
+
{
|
|
363
|
+
value: 'type',
|
|
364
|
+
options: [
|
|
365
|
+
{ value: 'primary', label: 'Primary action' },
|
|
366
|
+
{ value: 'secondary', label: 'Secondary action' },
|
|
367
|
+
{ value: 'destructive', label: 'Destructive action' },
|
|
368
|
+
],
|
|
369
|
+
},
|
|
370
|
+
],
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
$('#node-input-confirm-option-container tbody').append(row);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const confirmActions = this.confirm_actions || [
|
|
377
|
+
{ label: 'Confirm', primary: 'primary', alignment: 'right' },
|
|
378
|
+
{ label: 'Decline', primary: 'primary', alignment: 'right' },
|
|
379
|
+
];
|
|
380
|
+
|
|
381
|
+
for (let i = 0; i < confirmActions.length; i++) {
|
|
382
|
+
const option = confirmActions[i];
|
|
383
|
+
generateConfirmOption(option, i);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function toggleConfirmActionsSection() {
|
|
387
|
+
const isChecked = $('#node-input-handle_confirmation_dialogs').is(':checked');
|
|
388
|
+
$('#confirm-actions-section').toggle(isChecked);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function handleConfirmationDialogToggle() {
|
|
392
|
+
const isChecked = $('#node-input-handle_confirmation_dialogs').is(':checked');
|
|
393
|
+
|
|
394
|
+
if (isChecked) {
|
|
395
|
+
$('#node-input-option-container tbody .node-input-option-condition').each(function () {
|
|
396
|
+
const conditionInput = $(this);
|
|
397
|
+
if (!conditionInput.val().trim() && !conditionInput.data('explicitly-cleared')) {
|
|
398
|
+
conditionInput.val('!usertask.isConfirmDialog');
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
} else {
|
|
402
|
+
$('#node-input-option-container tbody .node-input-option-condition').each(function () {
|
|
403
|
+
const conditionInput = $(this);
|
|
404
|
+
if (conditionInput.val().trim() === '!usertask.isConfirmDialog') {
|
|
405
|
+
conditionInput.val('');
|
|
406
|
+
conditionInput.data('explicitly-cleared', false);
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
toggleConfirmActionsSection();
|
|
413
|
+
|
|
414
|
+
$('#node-input-handle_confirmation_dialogs').on('change', function () {
|
|
415
|
+
toggleConfirmActionsSection();
|
|
416
|
+
handleConfirmationDialogToggle();
|
|
229
417
|
});
|
|
230
418
|
},
|
|
231
419
|
oneditsave: function () {
|
|
232
|
-
const options = $('#node-input-option-container')
|
|
420
|
+
const options = $('#node-input-option-container tbody tr');
|
|
233
421
|
const node = this;
|
|
234
422
|
node.options = [];
|
|
235
423
|
options.each(function (i) {
|
|
236
|
-
const
|
|
424
|
+
const row = $(this);
|
|
237
425
|
const o = {
|
|
238
|
-
label:
|
|
239
|
-
condition:
|
|
240
|
-
errorMessage:
|
|
241
|
-
alignment:
|
|
242
|
-
primary:
|
|
426
|
+
label: row.find('.node-input-option-label').val(),
|
|
427
|
+
condition: row.find('.node-input-option-condition').val().trim(),
|
|
428
|
+
errorMessage: row.find('.node-input-option-error').val(),
|
|
429
|
+
alignment: row.find('.node-input-option-alignment').val(),
|
|
430
|
+
primary: row.find('.node-input-option-primary').val(),
|
|
243
431
|
};
|
|
244
432
|
|
|
245
433
|
node.options.push(o);
|
|
246
434
|
});
|
|
247
435
|
|
|
436
|
+
const confirmOptions = $('#node-input-confirm-option-container tbody tr');
|
|
437
|
+
node.confirm_actions = [];
|
|
438
|
+
if (confirmOptions.length > 0) {
|
|
439
|
+
confirmOptions.each(function (i) {
|
|
440
|
+
const row = $(this);
|
|
441
|
+
const o = {
|
|
442
|
+
label: row.find('.node-input-confirm-option-label').val(),
|
|
443
|
+
alignment: row.find('.node-input-confirm-option-alignment').val(),
|
|
444
|
+
primary: row.find('.node-input-confirm-option-primary').val(),
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
node.confirm_actions.push(o);
|
|
448
|
+
});
|
|
449
|
+
} else {
|
|
450
|
+
node.confirm_actions = [
|
|
451
|
+
{ label: 'Confirm', primary: 'primary', alignment: 'right' },
|
|
452
|
+
{ label: 'Decline', primary: 'primary', alignment: 'right' },
|
|
453
|
+
];
|
|
454
|
+
}
|
|
455
|
+
|
|
248
456
|
this.outputs = node.options.length || 0;
|
|
249
457
|
|
|
250
458
|
if ($('#node-input-trigger_on_change').is(':checked')) {
|
|
@@ -252,13 +460,8 @@
|
|
|
252
460
|
}
|
|
253
461
|
|
|
254
462
|
if ($('#node-input-handle_confirmation_dialogs').is(':checked')) {
|
|
255
|
-
|
|
256
|
-
this.outputs += confirmationOutputs;
|
|
463
|
+
this.outputs += node.confirm_actions.length;
|
|
257
464
|
}
|
|
258
|
-
|
|
259
|
-
const suspendOutput = 1;
|
|
260
|
-
const terminateOutput = 1;
|
|
261
|
-
this.outputs += suspendOutput + terminateOutput;
|
|
262
465
|
},
|
|
263
466
|
});
|
|
264
467
|
</script>
|
|
@@ -282,18 +485,48 @@
|
|
|
282
485
|
<h4>Action Configuration</h4>
|
|
283
486
|
<div class="form-row form-row-flex node-input-option-container-row" style="margin-bottom: 0px;width: 100%">
|
|
284
487
|
<label for="node-input-width" style="vertical-align:top"><i class="fa fa-list-alt"></i> Actions</label>
|
|
285
|
-
<div id="node-input-option-container-div" style="box-sizing:border-box; border-radius:5px; height:
|
|
286
|
-
<span id="valWarning" style="color: var(--red-ui-text-color-error, #910000)"><b>All
|
|
287
|
-
<
|
|
488
|
+
<div id="node-input-option-container-div" style="box-sizing:border-box; border-radius:5px; height:287px; padding:5px; border:1px solid var(--red-ui-form-input-border-color, #ccc); overflow-y:scroll; display:inline-block; width: 70%;">
|
|
489
|
+
<span id="valWarning" style="color: var(--red-ui-text-color-error, #910000); display: none;"><b>Duplicate labels found! All action labels must be unique.</b></span>
|
|
490
|
+
<table id="node-input-option-container" style="width: 100%; border-collapse: collapse; margin: 0;">
|
|
491
|
+
<thead>
|
|
492
|
+
<tr style="background: var(--red-ui-primary-background, #f3f3f3);">
|
|
493
|
+
<th style="padding: 5px; text-align: left; font-size: 11px; font-weight: bold; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc);">Label</th>
|
|
494
|
+
<th style="padding: 5px; text-align: left; font-size: 11px; font-weight: bold; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc);">Condition</th>
|
|
495
|
+
<th style="padding: 5px; text-align: left; font-size: 11px; font-weight: bold; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc);">Error Message</th>
|
|
496
|
+
<th style="padding: 5px; text-align: left; font-size: 11px; font-weight: bold; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc); width: 100px;">Align</th>
|
|
497
|
+
<th style="padding: 5px; text-align: left; font-size: 11px; font-weight: bold; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc); width: 120px;">Type</th>
|
|
498
|
+
<th style="padding: 5px; text-align: center; font-size: 11px; font-weight: bold; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc); width: 30px;"></th>
|
|
499
|
+
</tr>
|
|
500
|
+
</thead>
|
|
501
|
+
<tbody></tbody>
|
|
502
|
+
</table>
|
|
288
503
|
</div>
|
|
289
504
|
</div>
|
|
290
505
|
<div class="form-row">
|
|
291
|
-
<a href="#" class="editor-button editor-button-small" id="node-input-add-option" style="margin-top:4px; margin-left:
|
|
506
|
+
<a href="#" class="editor-button editor-button-small" id="node-input-add-option" style="margin-top:4px; margin-left:120px;"><i class="fa fa-plus"></i> <span>Add action</span></a>
|
|
292
507
|
</div>
|
|
293
|
-
|
|
294
|
-
|
|
508
|
+
|
|
509
|
+
<div class="form-row">
|
|
510
|
+
<label for="node-input-handle_confirmation_dialogs"><i class="fa fa-hand"></i>Handle confirmation dialogs</label>
|
|
295
511
|
<input type="checkbox" id="node-input-handle_confirmation_dialogs" title="Adds more outputs at this node for handling confirm/decline actions">
|
|
296
512
|
</div>
|
|
513
|
+
|
|
514
|
+
<div class="form-row form-row-flex node-input-confirm-option-container-row" id="confirm-actions-section" style="margin-bottom: 0px;width: 100%; display: none;">
|
|
515
|
+
<label for="node-input-confirm-width" style="vertical-align:top"><i class="fa fa-list-alt"></i> Confirm Actions</label>
|
|
516
|
+
<div id="node-input-confirm-option-container-div" style="box-sizing:border-box; border-radius:5px; height:150px; padding:5px; border:1px solid var(--red-ui-form-input-border-color, #ccc); overflow-y:auto; display:inline-block; width: 70%;">
|
|
517
|
+
<table id="node-input-confirm-option-container" style="width: 100%; border-collapse: collapse; margin: 0;">
|
|
518
|
+
<thead>
|
|
519
|
+
<tr style="background: var(--red-ui-primary-background, #f3f3f3);">
|
|
520
|
+
<th style="padding: 5px; text-align: left; font-size: 11px; font-weight: bold; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc); width: 150px;">Label</th>
|
|
521
|
+
<th style="padding: 5px; text-align: left; font-size: 11px; font-weight: bold; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc); width: 120px;">Align</th>
|
|
522
|
+
<th style="padding: 5px; text-align: left; font-size: 11px; font-weight: bold; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc); width: 140px;">Type</th>
|
|
523
|
+
</tr>
|
|
524
|
+
</thead>
|
|
525
|
+
<tbody></tbody>
|
|
526
|
+
</table>
|
|
527
|
+
</div>
|
|
528
|
+
</div>
|
|
529
|
+
|
|
297
530
|
<div class="form-row">
|
|
298
531
|
<label for="node-input-actions_inside_card"><i class="fa fa-hand"></i>Inside of card</label>
|
|
299
532
|
<input type="checkbox" id="node-input-actions_inside_card">
|
|
@@ -388,7 +621,7 @@
|
|
|
388
621
|
A Form can have any amount of actions. Each action is specified with a:
|
|
389
622
|
|
|
390
623
|
- **Label**: The buttons text.
|
|
391
|
-
- **Condition (optional)**: An expression that evaluates to true or false. It controls whether the action is
|
|
624
|
+
- **Condition (optional)**: An expression that evaluates to true or false. It controls whether the action is displayed and enabled.
|
|
392
625
|
- **Error message (optional)**: Will be displayed, when Condition evaluates to false.
|
|
393
626
|
- **Alignment**: Controls the buttons position. It can be placed on the left or right side of the form.
|
|
394
627
|
- **Action type**: Controls the styling of the button. There should always be one primary action.
|
|
@@ -404,28 +637,64 @@
|
|
|
404
637
|
Access to the form fields is available through the _fields_ object. A single form field can be accessed by selecting the field id as a key.
|
|
405
638
|
Example: _fields.field_01_
|
|
406
639
|
|
|
407
|
-
Access to the usertask object is available through _usertask_
|
|
640
|
+
Access to the usertask object is available through _usertask_. The usertask object includes a special property _usertask.isConfirmDialog_ that indicates whether the current form is displaying a confirmation dialog.
|
|
641
|
+
|
|
642
|
+
**Examples:**
|
|
643
|
+
|
|
644
|
+
- `!usertask.isConfirmDialog` - Show action only in normal forms, not in confirmation dialogs
|
|
645
|
+
- `usertask.isConfirmDialog` - Show action only in confirmation dialogs
|
|
646
|
+
- `fields.myField === 'someValue'` - Show action only when a specific field has a certain value
|
|
408
647
|
|
|
409
648
|
### Handles confirmation dialogs
|
|
410
649
|
|
|
411
|
-
When checked, this node will gain two additional outputs '
|
|
412
|
-
When a 'Confirm'-FormField is present and this option is enabled, only the confirmation buttons (Accept/Decline) will be displayed. The actions configured in the 'Actions' section will be hidden.
|
|
650
|
+
When checked, this node will gain two additional outputs 'Decline' and 'Confirm'. These are required when handling confirmation dialogs that may be defined in the Studio by setting a Form Field's type to 'Confirm'.
|
|
413
651
|
|
|
414
|
-
|
|
652
|
+
When a 'Confirm' FormField is present and this option is enabled, only the confirmation buttons (Decline/Confirm) will be displayed by default. Regular actions will only be shown if their condition evaluates to true in the confirmation dialog context.
|
|
415
653
|
|
|
416
|
-
|
|
654
|
+
The default condition `!usertask.isConfirmDialog` ensures that regular actions are hidden in confirmation dialogs but shown in normal forms. You can customize this behavior by modifying the condition for each action.
|
|
655
|
+
|
|
656
|
+
### Confirm Actions Configuration
|
|
657
|
+
|
|
658
|
+
When "Handle confirmation dialogs" is enabled, a dedicated configuration section appears for customizing the confirmation buttons. Unlike regular actions, confirm actions are automatically generated based on the UserTask's field configuration but can be styled and positioned according to your needs.
|
|
659
|
+
|
|
660
|
+
#### Confirm Actions Table
|
|
661
|
+
|
|
662
|
+
The confirm actions table provides configuration options for:
|
|
663
|
+
|
|
664
|
+
- **Label**: Display text for the button (read-only). This value comes directly from the UserTask's field configuration
|
|
665
|
+
- **Alignment**: Controls button positioning within the form
|
|
666
|
+
- **Type**: Controls the visual styling of the button
|
|
667
|
+
- Note: The label cannot be changed here, as it is sourced from the UserTask configuration
|
|
668
|
+
|
|
669
|
+
#### Default Confirm Action Configuration
|
|
417
670
|
|
|
418
|
-
|
|
671
|
+
When first enabled, the system creates two default confirm actions:
|
|
419
672
|
|
|
420
|
-
|
|
673
|
+
- **Confirm**: Primary button, right-aligned
|
|
674
|
+
- **Decline**: Primary button, right-aligned
|
|
421
675
|
|
|
422
|
-
|
|
676
|
+
#### Behavior with Confirmation Dialogs
|
|
423
677
|
|
|
424
|
-
|
|
678
|
+
When a UserTask contains a FormField with type 'Confirm':
|
|
425
679
|
|
|
426
|
-
|
|
680
|
+
1. The form automatically switches to confirmation dialog mode
|
|
681
|
+
2. Regular actions are filtered based on their conditions (using `usertask.isConfirmDialog`)
|
|
682
|
+
3. Only the configured confirm actions are displayed
|
|
683
|
+
4. Button labels are overridden by the UserTask's field configuration
|
|
684
|
+
5. The outputs route to "Decline (from UserTask)" and "Confirm (from UserTask)" respectively
|
|
427
685
|
|
|
428
|
-
|
|
686
|
+
#### Condition Interaction
|
|
687
|
+
|
|
688
|
+
Confirm actions work in conjunction with regular action conditions:
|
|
689
|
+
|
|
690
|
+
- Regular actions with empty conditions are shown in both normal and confirmation dialogs
|
|
691
|
+
- Actions with `!usertask.isConfirmDialog` are hidden in confirmation dialogs
|
|
692
|
+
- Actions with `usertask.isConfirmDialog` are only shown in confirmation dialogs
|
|
693
|
+
- This allows for flexible control over which actions appear in different contexts
|
|
694
|
+
|
|
695
|
+
### Inside of card
|
|
696
|
+
|
|
697
|
+
This property controls the positioning of the action buttons. They can be palced inside of the card, right below the FormFields, or below the whole Card containing the Form.
|
|
429
698
|
|
|
430
699
|
## Title Configuration
|
|
431
700
|
|
package/package.json
CHANGED