@node-projects/web-component-designer-visualization-addons 0.1.84 → 0.1.86

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.
@@ -14,60 +14,85 @@ export class ScriptRefactorService {
14
14
  const cp = c[p];
15
15
  if (cp != null && typeof cp === 'object') {
16
16
  let mp = cp;
17
- if (mp.source == 'signal') {
18
- refactorings.push({ name: mp.name, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p, refactor: newValue => mp.name = newValue });
17
+ if (mp.source === 'signal') {
18
+ refactorings.push({ name: mp.name, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p + '[property]', refactor: newValue => mp.name = newValue });
19
+ }
20
+ else if (mp.source === 'property') {
21
+ refactorings.push({ name: mp.name, itemType: 'property', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p + '[signal]', refactor: newValue => mp.name = newValue });
22
+ }
23
+ else if (mp.source === 'complexString') {
24
+ for (let m of mp.name.matchAll(/\{(.*?)\}/g)) {
25
+ let full = m[0];
26
+ let nm = m[1];
27
+ if (nm[0] === '?') {
28
+ let prefix = '?';
29
+ nm = nm.substring(1);
30
+ if (nm[0] === '?') {
31
+ prefix = '??';
32
+ nm = nm.substring(1);
33
+ }
34
+ refactorings.push({ name: nm, itemType: 'property', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p + '[complexString]->property', refactor: newValue => mp.name = mp.name.replace(full, '{' + prefix + newValue + '}') });
35
+ }
36
+ else {
37
+ refactorings.push({ name: nm, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p + '[complexString]->signal', refactor: newValue => mp.name = mp.name.replace(full, '{' + newValue + '}') });
38
+ }
39
+ }
19
40
  }
20
41
  }
21
42
  }
22
43
  switch (c.type) {
23
44
  case 'SetSignalValue':
24
- if (c.signal)
45
+ if (c.signal && typeof c.signal === 'string')
25
46
  refactorings.push({ name: c.signal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.signal = newValue });
26
47
  break;
27
48
  case 'ToggleSignalValue':
28
- if (c.signal)
49
+ if (c.signal && typeof c.signal === 'string')
29
50
  refactorings.push({ name: c.signal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.signal = newValue });
30
51
  break;
31
52
  case 'IncrementSignalValue':
32
- if (c.signal)
53
+ if (c.signal && typeof c.signal === 'string')
33
54
  refactorings.push({ name: c.signal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.signal = newValue });
34
55
  break;
35
56
  case 'DecrementSignalValue':
36
- if (c.signal)
57
+ if (c.signal && typeof c.signal === 'string')
37
58
  refactorings.push({ name: c.signal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.signal = newValue });
38
59
  break;
39
60
  case 'SetBitInSignal':
40
- if (c.signal)
61
+ if (c.signal && typeof c.signal === 'string')
41
62
  refactorings.push({ name: c.signal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.signal = newValue });
42
63
  break;
43
64
  case 'ClearBitInSignal':
44
- if (c.signal)
65
+ if (c.signal && typeof c.signal === 'string')
45
66
  refactorings.push({ name: c.signal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.signal = newValue });
46
67
  break;
47
68
  case 'ToggleBitInSignal':
48
- if (c.signal)
69
+ if (c.signal && typeof c.signal === 'string')
49
70
  refactorings.push({ name: c.signal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.signal = newValue });
50
71
  break;
51
72
  case 'OpenScreen':
52
- if (c.screen)
73
+ if (c.screen && typeof c.screen === 'string')
53
74
  refactorings.push({ name: c.screen, itemType: 'screenName', target: BindingTarget.event, targetName: a[0], display: c.type + '/screen', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.screen = newValue });
54
75
  break;
55
76
  case 'OpenDialog':
56
- if (c.screen)
77
+ if (c.screen && typeof c.screen === 'string')
57
78
  refactorings.push({ name: c.screen, itemType: 'screenName', target: BindingTarget.event, targetName: a[0], display: c.type + '/screen', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.screen = newValue });
58
79
  break;
59
80
  case 'CalculateSignalValue':
60
- if (c.targetSignal)
61
- refactorings.push({ name: c.targetSignal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.targetSignal = newValue });
81
+ if (c.targetSignal && typeof c.targetSignal === 'string')
82
+ refactorings.push({ name: c.targetSignal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/targetSignal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.targetSignal = newValue });
62
83
  break;
63
84
  case 'SubscribeSignal':
64
- if (c.signal)
85
+ if (c.signal && typeof c.signal === 'string')
65
86
  refactorings.push({ name: c.signal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.signal = newValue });
66
87
  break;
67
88
  case 'UnsubscribeSignal':
68
- if (c.signal)
89
+ if (c.signal && typeof c.signal === 'string')
69
90
  refactorings.push({ name: c.signal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/signal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.signal = newValue });
70
91
  break;
92
+ case 'ShowMessageBox':
93
+ if (c.resultSignal && typeof c.resultSignal === 'string')
94
+ refactorings.push({ name: c.resultSignal, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], display: c.type + '/resultSignal', service: this, designItem: d, type: 'script', sourceObject: script, refactor: newValue => c.resultSignal = newValue });
95
+ break;
71
96
  }
72
97
  }
73
98
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "web-component-designer addon for visualizations",
3
3
  "name": "@node-projects/web-component-designer-visualization-addons",
4
- "version": "0.1.84",
4
+ "version": "0.1.86",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",