@node-projects/web-component-designer-visualization-addons 0.1.48 → 0.1.50
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/dist/components/BindingsEditor.js +1 -1
- package/dist/components/EventAssignment.js +13 -10
- package/dist/components/SimpleScriptEditor.js +1 -1
- package/dist/helpers/BindingsHelper.js +9 -1
- package/dist/interfaces/IScriptMultiplexValue.d.ts +3 -2
- package/dist/interfaces/IScriptMultiplexValue.js +2 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
|
|
|
9
9
|
<div style="grid-column: 1/3">
|
|
10
10
|
<div style="display: flex; flex-direction: column;">
|
|
11
11
|
<div class="row">
|
|
12
|
-
<span style="cursor: pointer;" title="to use multiple objects, seprate them with semicolon (;). access
|
|
12
|
+
<span style="cursor: pointer;" title="to use multiple objects, seprate them with semicolon (;). access signal objects in properties via ?propertyName, access the propertyValue via ??propertyName. Bind to signal configurations via $objectId. You could also use signals inside of a Signal Name via {name}">objects</span>
|
|
13
13
|
</div>
|
|
14
14
|
<div style="display:flex;align-items: flex-end;">
|
|
15
15
|
<input id="objnm" class="row" value="{{?this.objectNames::change}}" style="flex-grow: 1;">
|
|
@@ -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 '" +
|
|
277
|
-
let data =
|
|
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
|
-
|
|
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 '" +
|
|
307
|
-
let data =
|
|
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
|
-
|
|
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
|
|
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 =
|
|
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 " +
|
|
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
|
-
|
|
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:
|
|
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();
|
|
@@ -61,8 +61,16 @@ export class IndirectSignal {
|
|
|
61
61
|
this.parseIndirectBinding(id);
|
|
62
62
|
this.values = new Array(this.signals.length);
|
|
63
63
|
for (let i = 0; i < this.signals.length; i++) {
|
|
64
|
+
let nm = this.signals[i];
|
|
65
|
+
if (nm[0] === '?' && nm[1] === '?') {
|
|
66
|
+
this.handleValueChanged(element[nm.substring(2)], i);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
else if (nm[0] === '?') {
|
|
70
|
+
nm = element[nm.substring(1)];
|
|
71
|
+
}
|
|
64
72
|
let cb = (id, value) => this.handleValueChanged(value.val, i);
|
|
65
|
-
this.unsubscribeList.push([cb, this.visualizationHandler.subscribeState(
|
|
73
|
+
this.unsubscribeList.push([cb, this.visualizationHandler.subscribeState(nm, cb)]);
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
76
|
parseIndirectBinding(id) {
|
|
@@ -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
|
|
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
|
|
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.
|
|
4
|
+
"version": "0.1.50",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|