@5minds/node-red-dashboard-2-processcube-dynamic-form 2.0.4-feature-e6de27-mcerd06i → 2.0.4
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 +324 -325
- package/nodes/ui-dynamic-form.js +41 -31
- package/package.json +1 -1
- package/resources/ui-dynamic-form.umd.js +1 -1
- package/ui/components/UIDynamicForm.vue +545 -538
package/nodes/ui-dynamic-form.js
CHANGED
|
@@ -1,40 +1,50 @@
|
|
|
1
1
|
module.exports = function (RED) {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
function UIDynamicFormNode(config) {
|
|
3
|
+
RED.nodes.createNode(this, config);
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const group = RED.nodes.getNode(config.group);
|
|
7
|
-
const base = group.getBase();
|
|
5
|
+
const node = this;
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
beforeSend: function (msg) {
|
|
12
|
-
if (config.title_text_type && config.title_text_type !== 'str') {
|
|
13
|
-
msg.dynamicTitle = RED.util.evaluateNodeProperty(config.title_text, config.title_text_type, node, msg);
|
|
14
|
-
}
|
|
7
|
+
// which group are we rendering this widget
|
|
8
|
+
const group = RED.nodes.getNode(config.group);
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
onInput: function (msg, send, done) {
|
|
19
|
-
base.stores.data.save(base, node, msg);
|
|
10
|
+
const base = group.getBase();
|
|
20
11
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
// server-side event handlers
|
|
13
|
+
const evts = {
|
|
14
|
+
onAction: true,
|
|
15
|
+
onInput: function (msg, send, done) {
|
|
16
|
+
// store the latest value in our Node-RED datastore
|
|
17
|
+
base.stores.data.save(base, node, msg);
|
|
18
|
+
},
|
|
19
|
+
// TODO: mm - begin
|
|
20
|
+
// onSocket: {
|
|
21
|
+
// 'my-custom-event': function (conn, id, msg) {
|
|
22
|
+
// console.info('"my-custom-event" received:', conn.id, id, msg);
|
|
23
|
+
// console.info('conn.id:', conn.id);
|
|
24
|
+
// console.info('id:', id);
|
|
25
|
+
// console.info('msg:', msg);
|
|
26
|
+
// console.info('node.id:', node.id);
|
|
27
|
+
// // emit a msg in Node-RED from this node
|
|
28
|
+
// node.send(msg);
|
|
29
|
+
// },
|
|
30
|
+
//},
|
|
31
|
+
// TODO: mm - end
|
|
32
|
+
};
|
|
24
33
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
// inform the dashboard UI that we are adding this node
|
|
35
|
+
if (group) {
|
|
36
|
+
group.register(node, config, evts);
|
|
37
|
+
} else {
|
|
38
|
+
node.error('No group configured');
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
|
-
}
|
|
31
41
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
RED.nodes.registerType('ui-dynamic-form', UIDynamicFormNode, {
|
|
43
|
+
defaults: {
|
|
44
|
+
outputs: { value: 1 },
|
|
45
|
+
},
|
|
46
|
+
outputs: function (config) {
|
|
47
|
+
return config.outputs || 1;
|
|
48
|
+
},
|
|
49
|
+
});
|
|
40
50
|
};
|
package/package.json
CHANGED