@5minds/node-red-dashboard-2-processcube-dynamic-form 2.0.3 → 2.0.4-feature-e6de27-mcerd06i

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.
@@ -1,50 +1,40 @@
1
1
  module.exports = function (RED) {
2
- function UIDynamicFormNode(config) {
3
- RED.nodes.createNode(this, config);
2
+ function UIDynamicFormNode(config) {
3
+ RED.nodes.createNode(this, config);
4
4
 
5
- const node = this;
5
+ const node = this;
6
+ const group = RED.nodes.getNode(config.group);
7
+ const base = group.getBase();
6
8
 
7
- // which group are we rendering this widget
8
- const group = RED.nodes.getNode(config.group);
9
+ const evts = {
10
+ onAction: true,
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
+ }
9
15
 
10
- const base = group.getBase();
16
+ return msg;
17
+ },
18
+ onInput: function (msg, send, done) {
19
+ base.stores.data.save(base, node, msg);
11
20
 
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
- };
21
+ if (done) done();
22
+ },
23
+ };
33
24
 
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
- }
25
+ if (group) {
26
+ group.register(node, config, evts);
27
+ } else {
28
+ node.error('No group configured');
40
29
  }
30
+ }
41
31
 
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
- });
32
+ RED.nodes.registerType('ui-dynamic-form', UIDynamicFormNode, {
33
+ defaults: {
34
+ outputs: { value: 1 },
35
+ },
36
+ outputs: function (config) {
37
+ return config.outputs || 1;
38
+ },
39
+ });
50
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-dashboard-2-processcube-dynamic-form",
3
- "version": "2.0.3",
3
+ "version": "2.0.4-feature-e6de27-mcerd06i",
4
4
  "description": "The ui component for the ProcessCube dynamic-form",
5
5
  "keywords": [
6
6
  "processcube",
@@ -54,8 +54,9 @@
54
54
  "lint:package:fix": "sort-package-json 'package.json'"
55
55
  },
56
56
  "dependencies": {
57
- "@formkit/themes": "^1.6.5",
58
- "@formkit/vue": "^1.6.5",
57
+ "@formkit/i18n": "^1.6.9",
58
+ "@formkit/themes": "^1.6.9",
59
+ "@formkit/vue": "^1.6.9",
59
60
  "to-title-case": "^1.0.0",
60
61
  "vue": "^3.3.8",
61
62
  "vuex": "^4.1.0"