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