@5minds/node-red-dashboard-2-processcube-dynamic-form 1.1.2 → 2.0.0-develop-5015e2-madmxd10
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 +238 -30
- package/package.json +1 -1
- package/resources/ui-dynamic-form.umd.js +2 -2
- package/ui/components/FooterActions.vue +55 -0
- package/ui/components/TitleText.vue +56 -0
- package/ui/components/UIDynamicForm.vue +818 -736
- package/ui/stylesheets/ui-dynamic-form.css +137 -41
|
@@ -21,6 +21,39 @@
|
|
|
21
21
|
waiting_info: {
|
|
22
22
|
value: 'Der Usertask wird automatisch angezeigt, wenn ein entsprechender Task vorhanden ist.',
|
|
23
23
|
},
|
|
24
|
+
form_columns: {
|
|
25
|
+
value: 1,
|
|
26
|
+
},
|
|
27
|
+
readonly: {
|
|
28
|
+
value: false,
|
|
29
|
+
},
|
|
30
|
+
collapsible: {
|
|
31
|
+
value: false,
|
|
32
|
+
},
|
|
33
|
+
collapse_when_finished: {
|
|
34
|
+
value: false,
|
|
35
|
+
},
|
|
36
|
+
actions_inside_card: {
|
|
37
|
+
value: true,
|
|
38
|
+
},
|
|
39
|
+
card_size_styling: {
|
|
40
|
+
value: "",
|
|
41
|
+
},
|
|
42
|
+
title_text: {
|
|
43
|
+
value: "",
|
|
44
|
+
},
|
|
45
|
+
title_style: {
|
|
46
|
+
value: "default",
|
|
47
|
+
},
|
|
48
|
+
title_custom_text_styling: {
|
|
49
|
+
value: "",
|
|
50
|
+
},
|
|
51
|
+
title_icon: {
|
|
52
|
+
value: "",
|
|
53
|
+
},
|
|
54
|
+
trigger_on_change: {
|
|
55
|
+
value: false,
|
|
56
|
+
},
|
|
24
57
|
width: {
|
|
25
58
|
value: 0,
|
|
26
59
|
validate: function (v) {
|
|
@@ -36,9 +69,9 @@
|
|
|
36
69
|
outputs: { value: 1 },
|
|
37
70
|
},
|
|
38
71
|
inputs: 1,
|
|
39
|
-
outputs:
|
|
72
|
+
outputs: 0,
|
|
40
73
|
outputLabels: function (index) {
|
|
41
|
-
return this.options[index].label;
|
|
74
|
+
return index < this.options.length ? this.options[index].label : 'Triggered on change';
|
|
42
75
|
},
|
|
43
76
|
icon: 'ui_dynamic_form.svg',
|
|
44
77
|
label: function () {
|
|
@@ -50,6 +83,18 @@
|
|
|
50
83
|
height: '#node-input-height',
|
|
51
84
|
group: '#node-input-group',
|
|
52
85
|
});
|
|
86
|
+
$('#node-input-title_style').typedInput({
|
|
87
|
+
types: [
|
|
88
|
+
{
|
|
89
|
+
value: 'title_style',
|
|
90
|
+
options: [
|
|
91
|
+
{ value: 'default', label: 'Default' },
|
|
92
|
+
{ value: 'minimal', label: 'Minimal' },
|
|
93
|
+
{ value: 'outside', label: 'Outside of card' },
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
})
|
|
53
98
|
|
|
54
99
|
function generateOption(i, option) {
|
|
55
100
|
const container = $('<li/>', {
|
|
@@ -65,11 +110,7 @@
|
|
|
65
110
|
placeholder: 'Label',
|
|
66
111
|
value: option.label,
|
|
67
112
|
})
|
|
68
|
-
.appendTo(row)
|
|
69
|
-
.typedInput({
|
|
70
|
-
type: 'str',
|
|
71
|
-
types: ['str'],
|
|
72
|
-
});
|
|
113
|
+
.appendTo(row);
|
|
73
114
|
|
|
74
115
|
$('<input/>', {
|
|
75
116
|
class: 'node-input-option-condition',
|
|
@@ -78,11 +119,7 @@
|
|
|
78
119
|
placeholder: 'Condition',
|
|
79
120
|
value: option.condition,
|
|
80
121
|
})
|
|
81
|
-
.appendTo(row)
|
|
82
|
-
.typedInput({
|
|
83
|
-
type: 'str',
|
|
84
|
-
types: ['str'],
|
|
85
|
-
});
|
|
122
|
+
.appendTo(row);
|
|
86
123
|
|
|
87
124
|
$('<input/>', {
|
|
88
125
|
class: 'node-input-option-error',
|
|
@@ -90,11 +127,47 @@
|
|
|
90
127
|
style: 'margin-left:7px; width:calc(29%);',
|
|
91
128
|
placeholder: 'Error message',
|
|
92
129
|
value: option.errorMessage,
|
|
130
|
+
})
|
|
131
|
+
.appendTo(row);
|
|
132
|
+
|
|
133
|
+
$('<input/>', {
|
|
134
|
+
class: 'node-input-option-alignment',
|
|
135
|
+
type: 'text',
|
|
136
|
+
style: 'margin-left:7px; width:calc(29%);',
|
|
137
|
+
placeholder: 'Alignment',
|
|
138
|
+
value: option.alignment
|
|
93
139
|
})
|
|
94
140
|
.appendTo(row)
|
|
95
141
|
.typedInput({
|
|
96
|
-
|
|
97
|
-
|
|
142
|
+
types: [
|
|
143
|
+
{
|
|
144
|
+
value: 'alignment',
|
|
145
|
+
options: [
|
|
146
|
+
{ value: 'left', label: 'Align left' },
|
|
147
|
+
{ value: 'right', label: 'Align right' },
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
$('<input/>', {
|
|
154
|
+
class: 'node-input-option-primary',
|
|
155
|
+
type: 'text',
|
|
156
|
+
style: 'margin-left:7px; width:calc(29%);',
|
|
157
|
+
placeholder: 'Action type',
|
|
158
|
+
value: option.primary,
|
|
159
|
+
})
|
|
160
|
+
.appendTo(row)
|
|
161
|
+
.typedInput({
|
|
162
|
+
types: [
|
|
163
|
+
{
|
|
164
|
+
value: 'primary',
|
|
165
|
+
options: [
|
|
166
|
+
{ value: 'false', label: 'Secondary action'},
|
|
167
|
+
{ value: 'true', label: 'Primary action'},
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
]
|
|
98
171
|
});
|
|
99
172
|
|
|
100
173
|
// Create delete button for the option
|
|
@@ -148,12 +221,18 @@
|
|
|
148
221
|
label: option.find('.node-input-option-label').val(),
|
|
149
222
|
condition: option.find('.node-input-option-condition').val(),
|
|
150
223
|
errorMessage: option.find('.node-input-option-error').val(),
|
|
224
|
+
alignment: option.find('.node-input-option-alignment').val(),
|
|
225
|
+
primary: option.find('.node-input-option-primary').val(),
|
|
151
226
|
};
|
|
152
227
|
|
|
153
228
|
node.options.push(o);
|
|
154
229
|
});
|
|
155
230
|
|
|
156
|
-
this.outputs = node.options.length ||
|
|
231
|
+
this.outputs = node.options.length || 0;
|
|
232
|
+
|
|
233
|
+
if ($('#node-input-trigger_on_change').is(':checked')) {
|
|
234
|
+
this.outputs++;
|
|
235
|
+
}
|
|
157
236
|
},
|
|
158
237
|
});
|
|
159
238
|
</script>
|
|
@@ -174,6 +253,7 @@
|
|
|
174
253
|
<button class="editor-button" id="node-input-size"></button>
|
|
175
254
|
</div>
|
|
176
255
|
|
|
256
|
+
<h4>Action Configuration</h4>
|
|
177
257
|
<div class="form-row form-row-flex node-input-option-container-row" style="margin-bottom: 0px;width: 100%">
|
|
178
258
|
<label for="node-input-width" style="vertical-align:top"><i class="fa fa-list-alt"></i> Actions</label>
|
|
179
259
|
<div id="node-input-option-container-div" style="box-sizing:border-box; border-radius:5px; height:257px; padding:5px; border:1px solid var(--red-ui-form-input-border-color, #ccc); overflow-y:scroll; display:inline-block; width: 70%;">
|
|
@@ -192,45 +272,173 @@
|
|
|
192
272
|
<div class="form-row">
|
|
193
273
|
<a href="#" class="editor-button editor-button-small" id="node-input-add-option" style="margin-top:4px; margin-left:103px;"><i class="fa fa-plus"></i> <span>action</span></a>
|
|
194
274
|
</div>
|
|
275
|
+
<div class="form-row">
|
|
276
|
+
<label for="node-input-readonly"><i class="fa fa-hand"></i>Inside of card</label>
|
|
277
|
+
<input type="checkbox" id="node-input-actions_inside_card">
|
|
278
|
+
</div>
|
|
279
|
+
<hr />
|
|
195
280
|
|
|
281
|
+
<h4>Title Configuration</h4>
|
|
282
|
+
<div class="form-row">
|
|
283
|
+
<label for="node-input-title_text"><i class="fa fa-hand"></i>Title text</label>
|
|
284
|
+
<input type="text" id="node-input-title_text" title="Enter the text to show as a title.">
|
|
285
|
+
</div>
|
|
286
|
+
<div class="form-row">
|
|
287
|
+
<label for="node-input-title_style"><i class="fa fa-hand"></i>Style</label>
|
|
288
|
+
<input type="text" id="node-input-title_style" title="Select the base styling layout for your title.">
|
|
289
|
+
</div>
|
|
290
|
+
<div class="form-row">
|
|
291
|
+
<label for="node-input-title_custom_text_styling"><i class="fa fa-hand"></i>Custom text styling</label>
|
|
292
|
+
<input type="text" id="node-input-title_custom_text_styling" title="Use CSS properties like font-size, color or padding to influence the appearance of the title">
|
|
293
|
+
</div>
|
|
294
|
+
<div class="form-row">
|
|
295
|
+
<label for="node-input-title_icon"><i class="fa fa-hand"></i>Title icon</label>
|
|
296
|
+
<input type="text" id="node-input-title_icon" title="Enter an URL to fetch an icon from. Use a dataurl for images, that are not available online. This value will be used as a HTML <img>'s src value.">
|
|
297
|
+
</div>
|
|
298
|
+
<hr />
|
|
299
|
+
|
|
300
|
+
<h4>Appearance</h4>
|
|
301
|
+
<div class="form-row">
|
|
302
|
+
<label for="node-input-form_columns"><i class="fa fa-hand"></i>Card size styling</label>
|
|
303
|
+
<input type="text" id="node-input-card_size_styling" title="Use CSS properties like margin, padding or max-width to influence sizing and positioning of the component">
|
|
304
|
+
</div>
|
|
196
305
|
<div class="form-row">
|
|
197
|
-
|
|
198
|
-
|
|
306
|
+
<label for="node-input-form_columns"><i class="fa fa-hand"></i>Columns in form</label>
|
|
307
|
+
<input type="number" min="1" id="node-input-form_columns" title="Control the amount of columns, that your form fields should be placed in.">
|
|
199
308
|
</div>
|
|
200
309
|
<div class="form-row">
|
|
201
|
-
|
|
202
|
-
|
|
310
|
+
<label for="node-input-readonly"><i class="fa fa-hand"></i>Readonly</label>
|
|
311
|
+
<input type="checkbox" id="node-input-readonly" title="Makes all form fields read only.">
|
|
312
|
+
</div>
|
|
313
|
+
<div class="form-row">
|
|
314
|
+
<label for="node-input-collapsible"><i class="fa fa-hand"></i>Collapsible</label>
|
|
315
|
+
<input type="checkbox" id="node-input-collapsible" title="When checked, the card can be folded at any time.">
|
|
316
|
+
</div>
|
|
317
|
+
<div class="form-row">
|
|
318
|
+
<label for="node-input-collapse_when_finished"><i class="fa fa-hand"></i>Collapsible when finished</label>
|
|
319
|
+
<input type="checkbox" id="node-input-collapse_when_finished" title="When checked, the card will automatically collapse after finishing the form.">
|
|
320
|
+
</div>
|
|
321
|
+
<div class="form-row">
|
|
322
|
+
<label for="node-input-waiting_title"><i class="fa fa-hand"></i>Title for waiting text</label>
|
|
323
|
+
<input type="text" id="node-input-waiting_title" title="Displayed while no UserTask is present.">
|
|
324
|
+
</div>
|
|
325
|
+
<div class="form-row">
|
|
326
|
+
<label for="node-input-waiting_info"><i class="fa fa-hand"></i>Text for waiting text</label>
|
|
327
|
+
<input type="text" id="node-input-waiting_info" title="Displayed while no UserTask is present.">
|
|
328
|
+
</div>
|
|
329
|
+
<hr />
|
|
330
|
+
<h4>Other</h4>
|
|
331
|
+
<div class="form-row">
|
|
332
|
+
<label for="node-input-trigger_on_change"><i class="fa fa-hand"></i>Trigger on change</label>
|
|
333
|
+
<input type="checkbox" id="node-input-trigger_on_change" title="A new output will be added. Each time a value inside the form changes, this output will be triggered.">
|
|
203
334
|
</div>
|
|
204
335
|
</script>
|
|
205
336
|
|
|
206
337
|
|
|
207
338
|
<script type="text/markdown" data-help-name="ui-dynamic-form">
|
|
208
|
-
A UI-Node to display
|
|
339
|
+
A UI-Node to display Forms for UserTasks from the ProcessCube Engine.
|
|
340
|
+
|
|
341
|
+
## States
|
|
342
|
+
|
|
343
|
+
This component can have one of three states. `Waiting`, `active` and `finished`.
|
|
344
|
+
- `Waiting` is the initial state. This node will either display the waiting text and waiting title, or nothing. This dependes on your configuration. This state can be set at any time by passing a message with an empty payload into this node.
|
|
345
|
+
- `Active` will display a dynamic form for a UserTask. This state can be set by passing the result of the `usertask-input` or `wait-for-usertask` node into it.
|
|
346
|
+
- `Finished` will display the last filled form in a disabled mode. This state can be set by passing the result of the `dynamic-form` node into itself.
|
|
209
347
|
|
|
210
348
|
## Usage
|
|
211
349
|
|
|
212
|
-
Connect the
|
|
350
|
+
Connect the input to the `usertask-input` or `wait-for-usertask` node. It will use the UserTasks FormFields configuration to display a dynamically generated Form inside a Card.
|
|
351
|
+
After configuring an action, connect it's output to an `usertask-output` node.
|
|
352
|
+
In case you want to display the `finished` state, place a `link in` and a `link out` node to pipe the `dynamic-form` nodes output into its input.
|
|
353
|
+
In case you want to clear the node and set it back into `waiting` state, place a `function` node that clears the `payload` object. The pipe the `dynamic-form` nodes output into the `function` node and the `function` nodes output into th e`dynamic-form` nodes input.
|
|
213
354
|
|
|
214
|
-
##
|
|
355
|
+
## Action Configuration
|
|
215
356
|
|
|
216
|
-
|
|
357
|
+
Actions are buttons displayed at the bottom of the Form.
|
|
217
358
|
|
|
218
|
-
|
|
359
|
+
### Actions
|
|
219
360
|
|
|
220
|
-
|
|
361
|
+
A Form can have any amount of actions. Each action is specified with a:
|
|
362
|
+
|
|
363
|
+
- **Label**: The buttons text.
|
|
364
|
+
- **Condition (optional)**: An expression that evaluates to true or false. It controls whether the action is enabled or not.
|
|
365
|
+
- **Error message (optional)**: Will be displayed, when Condition evaluates to false.
|
|
366
|
+
- **Alignment**: Controls the buttons position. It can be placed on the left or right side of the form.
|
|
367
|
+
- **Action type**: Controls the styling of the button. There should always be one primary action.
|
|
368
|
+
|
|
369
|
+
For each action configured, the node will gain a new output, that is named as the linked action.
|
|
370
|
+
|
|
371
|
+
#### Condition
|
|
372
|
+
|
|
373
|
+
Various values can be accessed inside the condition through following constants:
|
|
374
|
+
|
|
375
|
+
Access to the message object is available through _msg_
|
|
221
376
|
|
|
222
377
|
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.
|
|
223
378
|
Example: _fields.field_01_
|
|
224
379
|
|
|
225
|
-
### usertask
|
|
226
|
-
|
|
227
380
|
Access to the usertask object is available through _usertask_
|
|
228
381
|
|
|
229
|
-
|
|
382
|
+
### Inside of card
|
|
383
|
+
|
|
384
|
+
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.
|
|
385
|
+
|
|
386
|
+
## Title Configuration
|
|
387
|
+
|
|
388
|
+
### Title
|
|
389
|
+
|
|
390
|
+
The text displayed above the FormFields in the Cards header. When left empty, there will be no header in the Card.
|
|
391
|
+
|
|
392
|
+
### Style
|
|
393
|
+
|
|
394
|
+
Controls the headers styling. `Default` is the recommended 5Minds theming. `Minimal` might be used to apply custom stylings and `Outside of card` places the title right above the card.
|
|
395
|
+
|
|
396
|
+
### Custom text styling
|
|
397
|
+
|
|
398
|
+
Enter custom css rules to modifiy how the title text is displayed. This can be used particulary well together with the style `Minimal`.
|
|
399
|
+
|
|
400
|
+
### Title icon
|
|
401
|
+
|
|
402
|
+
An URL for an image, that should be displayed before the text. This will be used as the `src`-Property of a HTML `img`-Element. Therefore DataURLs can be used to add images/svgs etc., that are not available online.
|
|
403
|
+
|
|
404
|
+
## Appearance
|
|
405
|
+
|
|
406
|
+
### Card size styling
|
|
407
|
+
|
|
408
|
+
Enter custom css rules to control the size and placement of the whole card. It can be used to set a `max-width` for the Card, apply a `margin` etc.
|
|
409
|
+
|
|
410
|
+
### Columns in form
|
|
411
|
+
|
|
412
|
+
This value controls the amount of columns the card will have. It can be used to place multiple FormFields in one row.
|
|
413
|
+
Configure `hidden` FormFields in your UserTask configuration to leave spaces open between FormFields. FormFields with type `heading` will always take up a whole line regardless of the `Columns in Form` value.
|
|
414
|
+
|
|
415
|
+
### Readonly
|
|
416
|
+
|
|
417
|
+
When checked, all fields in the Form will not be editable. To mark single FormFields as readOnly, add the custom property `readOnly` with the value `true` to the FormField configuration of the UserTask.
|
|
418
|
+
|
|
419
|
+
### Collapsible
|
|
420
|
+
|
|
421
|
+
When checked, the card will have a collapse icon and can be folded at any.
|
|
422
|
+
|
|
423
|
+
### Collapsible when finished
|
|
424
|
+
|
|
425
|
+
When checked, the card will gain a collapse icon and automatically fold, after the node entered `finished` state. This is independed to `Collapsible`.
|
|
426
|
+
|
|
427
|
+
### Title for waiting text
|
|
428
|
+
|
|
429
|
+
While no UserTask is present, this text will be displayed.
|
|
430
|
+
|
|
431
|
+
### Text for waiting text
|
|
432
|
+
|
|
433
|
+
While no UserTask is present, this text will be displayed.
|
|
434
|
+
|
|
435
|
+
## Other
|
|
436
|
+
|
|
437
|
+
### Trigger on change
|
|
230
438
|
|
|
231
|
-
|
|
439
|
+
Adds a new output to the node. This output will be triggered each time a FormFields value changes. This can be used for live, server-side validation or for Forms without action buttons.
|
|
232
440
|
|
|
233
|
-
|
|
441
|
+
## References
|
|
234
442
|
|
|
235
443
|
- [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube© Plattform
|
|
236
444
|
- [Node-RED Integration in ProcessCube©](https://processcube.io/docs/node-red) - Node-RED Integration in ProcessCube©
|
package/package.json
CHANGED