@node-projects/web-component-designer-visualization-addons 0.1.48 → 0.1.49

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.
@@ -271,10 +271,11 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
271
271
  }
272
272
  }
273
273
  async _editParameter(e, eventItem) {
274
+ let selectedItem = this.selectedItems[0];
274
275
  const edt = new ParameterEditor();
275
276
  let existingParameter = {};
276
- edt.title = "ParameterEditor for '" + eventItem.name + "' of '" + this._selectedItems[0].name + "'";
277
- let data = this._selectedItems[0].getAttribute('@' + eventItem.name);
277
+ edt.title = "ParameterEditor for '" + eventItem.name + "' of '" + selectedItem.name + "'";
278
+ let data = selectedItem.getAttribute('@' + eventItem.name);
278
279
  if (data && data[0] == '{') {
279
280
  try {
280
281
  const parsed = JSON.parse(data);
@@ -297,14 +298,15 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
297
298
  if (par == null)
298
299
  delete newObj.parameters;
299
300
  const newData = JSON.stringify(newObj);
300
- this._selectedItems[0].setAttribute('@' + eventItem.name, newData);
301
+ selectedItem.setAttribute('@' + eventItem.name, newData);
301
302
  this._bindingsRefresh();
302
303
  }
303
304
  }
304
305
  async _editBlockly(e, eventItem) {
306
+ let selectedItem = this.selectedItems[0];
305
307
  const edt = new BlocklyScriptEditor();
306
- edt.title = "Blockly Script for '" + eventItem.name + "' of '" + this._selectedItems[0].name + "'";
307
- let data = this._selectedItems[0].getAttribute('@' + eventItem.name);
308
+ edt.title = "Blockly Script for '" + eventItem.name + "' of '" + selectedItem.name + "'";
309
+ let data = selectedItem.getAttribute('@' + eventItem.name);
308
310
  let parameters = null;
309
311
  let relativeSignalsPath = null;
310
312
  if (data) {
@@ -322,7 +324,7 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
322
324
  if (relativeSignalsPath) {
323
325
  blockObj.relativeSignalsPath = relativeSignalsPath;
324
326
  }
325
- this._selectedItems[0].setAttribute('@' + eventItem.name, JSON.stringify(blockObj));
327
+ selectedItem.setAttribute('@' + eventItem.name, JSON.stringify(blockObj));
326
328
  this._bindingsRefresh();
327
329
  }
328
330
  }
@@ -330,7 +332,8 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
330
332
  // todo ?
331
333
  }
332
334
  async _editSimpleScript(e, eventItem) {
333
- let scriptString = this.selectedItems[0].getAttribute('@' + eventItem.name);
335
+ let selectedItem = this.selectedItems[0];
336
+ let scriptString = selectedItem.getAttribute('@' + eventItem.name);
334
337
  if (!scriptString || scriptString.startsWith('{')) {
335
338
  let script = { commands: [] };
336
339
  let parameters = null;
@@ -343,13 +346,13 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
343
346
  relativeSignalsPath = script.relativeSignalsPath;
344
347
  }
345
348
  let sc = new SimpleScriptEditor();
346
- sc.serviceContainer = this.selectedItems[0].serviceContainer;
349
+ sc.serviceContainer = selectedItem.serviceContainer;
347
350
  sc.scriptCommandsTypeInfo = this._scriptCommandsTypeInfo;
348
351
  sc.propertiesTypeInfo = this._propertiesTypeInfo;
349
352
  sc.visualizationShell = this._visualizationShell;
350
353
  sc.visualizationHandler = this._visualizationHandler;
351
354
  sc.loadScript(script);
352
- sc.title = "Script '" + eventItem.name + "' on " + this.selectedItems[0].name;
355
+ sc.title = "Script '" + eventItem.name + "' on " + selectedItem.name;
353
356
  let res = await this._visualizationShell.openConfirmation(sc, { x: 100, y: 100, width: 600, height: 500 });
354
357
  if (res) {
355
358
  let scriptCommands = sc.getScriptCommands();
@@ -364,7 +367,7 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
364
367
  sc.relativeSignalsPath = relativeSignalsPath;
365
368
  }
366
369
  let json = JSON.stringify(sc);
367
- this.selectedItems[0].setAttribute('@' + eventItem.name, json);
370
+ selectedItem.setAttribute('@' + eventItem.name, json);
368
371
  this._bindingsRefresh();
369
372
  }
370
373
  }
@@ -89,7 +89,7 @@ export class SimpleScriptEditor extends BaseCustomWebComponentConstructorAppend
89
89
  pg.selectedObject = data.value ?? {};
90
90
  else
91
91
  pg.selectedObject = {};
92
- let res = await this.visualizationShell.openConfirmation(pg, { x: 100, y: 100, width: 300, height: 300, parent: this });
92
+ let res = await this.visualizationShell.openConfirmation(pg, { x: 100, y: 100, width: 400, height: 400, parent: this });
93
93
  if (res) {
94
94
  this._propertygrid.setPropertyValue(data.propertyPath, pg.selectedObject);
95
95
  this._propertygrid.refresh();
@@ -6,10 +6,11 @@ export declare class IScriptMultiplexValue {
6
6
  * parameter - a parameter you hand over
7
7
  * complexString - a string with signals (contained in {})
8
8
  * complexSignal - read the value from a signal wich name is build here (it can contain other signals in {})
9
+ * not yet implemented: expression - js expression, member access needs to be defined {event, parameter, component/this, signals??? - async? }
9
10
  */
10
- source: 'signal' | 'property' | 'event' | 'parameter' | 'complexString' | 'complexSignal';
11
+ source: 'signal' | 'property' | 'event' | 'parameter' | 'complexString' | 'complexSignal' | 'expression';
11
12
  /**
12
- * Name of the ioBroker object or the property of the component or the parameter of the script
13
+ * Name of the signal, the property of the component or the parameter of the script
13
14
  * or for example in a event : srcElement.value to get the value of a input wich raises the event
14
15
  * @TJS-format signal
15
16
  */
@@ -6,10 +6,11 @@ export class IScriptMultiplexValue {
6
6
  * parameter - a parameter you hand over
7
7
  * complexString - a string with signals (contained in {})
8
8
  * complexSignal - read the value from a signal wich name is build here (it can contain other signals in {})
9
+ * not yet implemented: expression - js expression, member access needs to be defined {event, parameter, component/this, signals??? - async? }
9
10
  */
10
11
  source;
11
12
  /**
12
- * Name of the ioBroker object or the property of the component or the parameter of the script
13
+ * Name of the signal, the property of the component or the parameter of the script
13
14
  * or for example in a event : srcElement.value to get the value of a input wich raises the event
14
15
  * @TJS-format signal
15
16
  */
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.48",
4
+ "version": "0.1.49",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",