@node-projects/web-component-designer-visualization-addons 0.1.129 → 0.1.130

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.
@@ -2,6 +2,7 @@ export interface IScriptMultiplexValue {
2
2
  /**
3
3
  * signal - read the value from a Signal
4
4
  * property - read the value from a property of the customControl (not usable in screens)
5
+ * signalInProperty - read the value from a Signal (wich name is in the Property)
5
6
  * event - read the value of a property of the event object
6
7
  * parameter - a parameter you hand over
7
8
  * context - a value of the context
@@ -10,7 +11,7 @@ export interface IScriptMultiplexValue {
10
11
  * expression - js expression, 'ctx' is context object
11
12
  * elementProperty - a property defined on the element raising the event
12
13
  */
13
- source: 'signal' | 'property' | 'event' | 'parameter' | 'complexString' | 'complexSignal' | 'expression' | 'context' | 'elementProperty';
14
+ source: 'signal' | 'property' | 'signalInProperty' | 'event' | 'parameter' | 'complexString' | 'complexSignal' | 'expression' | 'context' | 'elementProperty';
14
15
  /**
15
16
  * Name of the signal, the property of the component or the parameter of the script
16
17
  * or for example in a event : srcElement.value to get the value of a input wich raises the event
@@ -1,5 +1,5 @@
1
1
  export declare type ScriptCommands = RunnableScriptCommands | Comment | Condition | Exit | Label | Goto;
2
- export declare type RunnableScriptCommands = OpenScreen | OpenUrl | OpenDialog | CloseDialog | ToggleSignalValue | SetSignalValue | IncrementSignalValue | DecrementSignalValue | SetBitInSignal | ClearBitInSignal | ToggleBitInSignal | Console | CalculateSignalValue | Javascript | SetElementProperty | Delay | SwitchLanguage | Login | Logout | SubscribeSignal | UnsubscribeSignal | WriteSignalsInGroup | ClearSignalsInGroup | RunScript | CopySignalValuesFromFolder | ShowMessageBox | ExportSignalValuesAsJson | ImportSignalValuesFromJson;
2
+ export declare type RunnableScriptCommands = OpenScreen | OpenUrl | OpenDialog | CloseDialog | ToggleSignalValue | ToggleSignalValueFromList | SetSignalValue | IncrementSignalValue | DecrementSignalValue | SetBitInSignal | ClearBitInSignal | ToggleBitInSignal | Console | CalculateSignalValue | Javascript | SetElementProperty | Delay | SwitchLanguage | Login | Logout | SubscribeSignal | UnsubscribeSignal | WriteSignalsInGroup | ClearSignalsInGroup | RunScript | CopySignalValuesFromFolder | ShowMessageBox | ExportSignalValuesAsJson | ImportSignalValuesFromJson;
3
3
  /**
4
4
  * signal - a signal (the default)
5
5
  * property - a property defined in the current screen/control
@@ -114,6 +114,17 @@ export interface ToggleSignalValue {
114
114
  target: signalTarget;
115
115
  additionalData?: string;
116
116
  }
117
+ export interface ToggleSignalValueFromList {
118
+ type: 'ToggleSignalValueThroughList';
119
+ valueList: (string | number | boolean)[];
120
+ /**
121
+ * Name of the signal
122
+ * @TJS-format signal
123
+ */
124
+ signal: string;
125
+ target: signalTarget;
126
+ additionalData?: string;
127
+ }
117
128
  export interface IncrementSignalValue {
118
129
  type: 'IncrementSignalValue';
119
130
  /**
@@ -145,6 +145,18 @@ export class ScriptSystem {
145
145
  await this._visualizationHandler.setState(this.getSignalName(signal, context), !state);
146
146
  break;
147
147
  }
148
+ case 'ToggleSignalValueThroughList': {
149
+ const valueList = await this.getValue(command.valueList, context);
150
+ const signal = await this.getValue(command.signal, context);
151
+ const target = await this.getValue(command.target, context);
152
+ let state = await this.getValueFromTarget(target, signal, context);
153
+ let nextIdx = valueList.indexOf(state) + 1;
154
+ if (nextIdx >= valueList.length)
155
+ nextIdx = 0;
156
+ const newState = valueList[nextIdx];
157
+ await this._visualizationHandler.setState(this.getSignalName(signal, context), newState);
158
+ break;
159
+ }
148
160
  case 'SetSignalValue': {
149
161
  const signal = await this.getValue(command.signal, context);
150
162
  const target = await this.getValue(command.target, context);
@@ -364,6 +376,11 @@ export class ScriptSystem {
364
376
  let sng = await this._visualizationHandler.getState(this.getSignalName(value.name, outerContext));
365
377
  return sng.val;
366
378
  }
379
+ case 'signalInProperty': {
380
+ const sngName = deepValue(outerContext.root, value.name);
381
+ let sng = await this._visualizationHandler.getState(this.getSignalName(sngName, outerContext));
382
+ return sng.val;
383
+ }
367
384
  case 'event': {
368
385
  let obj = outerContext.event;
369
386
  if (value.name)
@@ -408,11 +425,11 @@ export class ScriptSystem {
408
425
  var ctx = context;
409
426
  return eval('ctx.' + name.substring(1));
410
427
  }
411
- else if (name[0] === '?' && name[1] === '??') {
428
+ else if (name[0] === '?' && name[1] === '?') {
412
429
  return context.root[name.substring(2)];
413
430
  }
414
431
  else if (name[0] === '?') {
415
- return await this._visualizationHandler.getState(this.getSignalName(context.root[name.substring(2)], context));
432
+ return await this._visualizationHandler.getState(this.getSignalName(context.root[name.substring(1)], context));
416
433
  }
417
434
  return await this._visualizationHandler.getState(this.getSignalName(name, context));
418
435
  }
@@ -1,5 +1,5 @@
1
1
  import { ScriptCommands, SetElementProperty } from "./ScriptCommands";
2
2
  export declare class ScriptUpgrades {
3
- static upgradeScriptCommand(scriptCommand: ScriptCommands): SetElementProperty | import("./ScriptCommands").OpenScreen | import("./ScriptCommands").OpenUrl | import("./ScriptCommands").OpenDialog | import("./ScriptCommands").CloseDialog | import("./ScriptCommands").ToggleSignalValue | import("./ScriptCommands").SetSignalValue | import("./ScriptCommands").IncrementSignalValue | import("./ScriptCommands").DecrementSignalValue | import("./ScriptCommands").SetBitInSignal | import("./ScriptCommands").ClearBitInSignal | import("./ScriptCommands").ToggleBitInSignal | import("./ScriptCommands").Console | import("./ScriptCommands").CalculateSignalValue | import("./ScriptCommands").Javascript | import("./ScriptCommands").Delay | import("./ScriptCommands").SwitchLanguage | import("./ScriptCommands").Login | import("./ScriptCommands").Logout | import("./ScriptCommands").SubscribeSignal | import("./ScriptCommands").UnsubscribeSignal | import("./ScriptCommands").WriteSignalsInGroup | import("./ScriptCommands").ClearSignalsInGroup | import("./ScriptCommands").RunScript | import("./ScriptCommands").CopySignalValuesFromFolder | import("./ScriptCommands").ShowMessageBox | import("./ScriptCommands").ExportSignalValuesAsJson | import("./ScriptCommands").ImportSignalValuesFromJson | import("./ScriptCommands").Comment | import("./ScriptCommands").Condition | import("./ScriptCommands").Exit | import("./ScriptCommands").Label | import("./ScriptCommands").Goto;
3
+ static upgradeScriptCommand(scriptCommand: ScriptCommands): SetElementProperty | import("./ScriptCommands").OpenScreen | import("./ScriptCommands").OpenUrl | import("./ScriptCommands").OpenDialog | import("./ScriptCommands").CloseDialog | import("./ScriptCommands").ToggleSignalValue | import("./ScriptCommands").ToggleSignalValueFromList | import("./ScriptCommands").SetSignalValue | import("./ScriptCommands").IncrementSignalValue | import("./ScriptCommands").DecrementSignalValue | import("./ScriptCommands").SetBitInSignal | import("./ScriptCommands").ClearBitInSignal | import("./ScriptCommands").ToggleBitInSignal | import("./ScriptCommands").Console | import("./ScriptCommands").CalculateSignalValue | import("./ScriptCommands").Javascript | import("./ScriptCommands").Delay | import("./ScriptCommands").SwitchLanguage | import("./ScriptCommands").Login | import("./ScriptCommands").Logout | import("./ScriptCommands").SubscribeSignal | import("./ScriptCommands").UnsubscribeSignal | import("./ScriptCommands").WriteSignalsInGroup | import("./ScriptCommands").ClearSignalsInGroup | import("./ScriptCommands").RunScript | import("./ScriptCommands").CopySignalValuesFromFolder | import("./ScriptCommands").ShowMessageBox | import("./ScriptCommands").ExportSignalValuesAsJson | import("./ScriptCommands").ImportSignalValuesFromJson | import("./ScriptCommands").Comment | import("./ScriptCommands").Condition | import("./ScriptCommands").Exit | import("./ScriptCommands").Label | import("./ScriptCommands").Goto;
4
4
  static upgradeSetElementProperty(scriptCommand: SetElementProperty): SetElementProperty;
5
5
  }
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.129",
4
+ "version": "0.1.130",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",