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

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.
@@ -8,7 +8,7 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
8
8
  <div style="grid-column: 1/3">
9
9
  <div style="display: flex; flex-direction: column;">
10
10
  <div class="row">
11
- <span style="cursor: pointer;" title="to use multiple objects, seprate them with semicolon (;).&#010;Access signal objects in properties via ?propertyName, access the propertyValue via ??propertyName.&#010;Access signal objects in properties of the target via #propertyName, access a propertyValue of the target via ##propertyName.&#010;Bind to signal configurations via $objectId.&#010;You could also use signals inside of a Signal Name via {name}">objects</span>
11
+ <span style="cursor: pointer;" title="to use multiple objects, seprate them with semicolon (;).&#010;Access signal objects in properties via ?propertyName, access the propertyValue via ??propertyName.&#010;Access signal objects in properties of the target via #propertyName, access a propertyValue of the target via ##propertyName.&#010;Bind to signal configurations via $objectId.&#010;Bind to special values via §name (if supported by your framework).&#010;You could also use signals inside of a Signal Name via {name}">objects</span>
12
12
  </div>
13
13
  <div id="groupObjectName" style="display:flex;align-items: flex-end;">
14
14
  <input id="objectName" class="row" value="{{?this.objectNames::change}}" style="flex-grow: 1;">
@@ -4,11 +4,11 @@ import { BindingTarget } from "@node-projects/web-component-designer/dist/elemen
4
4
  export type SpecialValueHandler = {
5
5
  valueProvider: (propertyName: string, context: {
6
6
  element: Element;
7
- binding: namedBinding;
7
+ binding?: namedBinding;
8
8
  relativeSignalPath: string;
9
9
  root: HTMLElement;
10
10
  [key: string]: any;
11
- }) => any;
11
+ }) => Promise<any> | any;
12
12
  valueChangedCallbacks: Map<string, (() => void)[]>;
13
13
  };
14
14
  export declare const bindingPrefixProperty = "bind-prop:";
@@ -57,7 +57,7 @@ class IndirectSignal {
57
57
  visualizationHandler;
58
58
  element;
59
59
  relativeSignalPath;
60
- constructor(bindingsHelper, visualizationHandler, id, valueChangedCb, element, relativeSignalPath, root) {
60
+ constructor(bindingsHelper, visualizationHandler, id, valueChangedCb, element, relativeSignalPath, root, specialValueHandler) {
61
61
  this.visualizationHandler = visualizationHandler;
62
62
  this.valueChangedCb = valueChangedCb;
63
63
  this.element = element;
@@ -96,6 +96,28 @@ class IndirectSignal {
96
96
  }
97
97
  continue;
98
98
  }
99
+ else if (nm[0] === '§') {
100
+ const mS = nm.substring(1);
101
+ const value = specialValueHandler.valueProvider(mS, { element, relativeSignalPath, root });
102
+ if (value instanceof Promise)
103
+ value.then(v => this.handleValueChanged(v, i));
104
+ else
105
+ this.handleValueChanged(value, i);
106
+ if (!specialValueHandler.valueChangedCallbacks)
107
+ specialValueHandler.valueChangedCallbacks = new Map();
108
+ let changeList = specialValueHandler.valueChangedCallbacks.get(mS);
109
+ if (changeList == null) {
110
+ changeList = [];
111
+ specialValueHandler.valueChangedCallbacks.set(mS, changeList);
112
+ }
113
+ changeList.push(() => {
114
+ const value = specialValueHandler.valueProvider(mS, { element, relativeSignalPath, root });
115
+ if (value instanceof Promise)
116
+ value.then(v => this.handleValueChanged(v, i));
117
+ else
118
+ this.handleValueChanged(value, i);
119
+ });
120
+ }
99
121
  else if (nm[0] === '?') {
100
122
  //TODO: react to changes of signal name in prop
101
123
  if (!nm.includes('.')) {
@@ -731,7 +753,10 @@ export class BindingsHelper {
731
753
  else if (s[0] === '§') {
732
754
  const mS = s.substring(1);
733
755
  const value = specialValueHandler.valueProvider(mS, { element, binding, relativeSignalPath, root });
734
- this.handleValueChanged(element, binding, value, valuesObject, i, signalVars, true, relativeSignalPath);
756
+ if (value instanceof Promise)
757
+ value.then(v => this.handleValueChanged(element, binding, v, valuesObject, i, signalVars, true, relativeSignalPath));
758
+ else
759
+ this.handleValueChanged(element, binding, value, valuesObject, i, signalVars, true, relativeSignalPath);
735
760
  if (!specialValueHandler.valueChangedCallbacks)
736
761
  specialValueHandler.valueChangedCallbacks = new Map();
737
762
  let changeList = specialValueHandler.valueChangedCallbacks.get(mS);
@@ -741,12 +766,15 @@ export class BindingsHelper {
741
766
  }
742
767
  changeList.push(() => {
743
768
  const value = specialValueHandler.valueProvider(mS, { element, binding, relativeSignalPath, root });
744
- this.handleValueChanged(element, binding, value, valuesObject, i, signalVars, true, relativeSignalPath);
769
+ if (value instanceof Promise)
770
+ value.then(v => this.handleValueChanged(element, binding, v, valuesObject, i, signalVars, true, relativeSignalPath));
771
+ else
772
+ this.handleValueChanged(element, binding, value, valuesObject, i, signalVars, true, relativeSignalPath);
745
773
  });
746
774
  }
747
775
  else {
748
776
  if (s.includes('{')) {
749
- let indirectSignal = new IndirectSignal(this, this._visualizationHandler, s, (value) => this.handleValueChanged(element, binding, value.val, valuesObject, i, signalVars, false, relativeSignalPath), element, relativeSignalPath, root);
777
+ let indirectSignal = new IndirectSignal(this, this._visualizationHandler, s, (value) => this.handleValueChanged(element, binding, value.val, valuesObject, i, signalVars, false, relativeSignalPath), element, relativeSignalPath, root, specialValueHandler);
750
778
  if (!cleanupCalls)
751
779
  cleanupCalls = [];
752
780
  cleanupCalls.push(() => indirectSignal.dispose());
package/dist/index.d.ts CHANGED
@@ -9,11 +9,11 @@ export * from './components/VisualizationPropertyGrid.js';
9
9
  export * from './components/ParameterEditor.js';
10
10
  export * from './components/EventAssignment.js';
11
11
  export * from './helpers/BindingsHelper.js';
12
- export * from './interfaces/IScriptMultiplexValue.js';
13
- export * from './interfaces/VisualisationElementScript.js';
14
- export * from './interfaces/VisualizationBinding.js';
15
- export * from './interfaces/VisualizationHandler.js';
16
- export * from './interfaces/VisualizationShell.js';
12
+ export type * from './interfaces/IScriptMultiplexValue.js';
13
+ export type * from './interfaces/VisualisationElementScript.js';
14
+ export type * from './interfaces/VisualizationBinding.js';
15
+ export type * from './interfaces/VisualizationHandler.js';
16
+ export type * from './interfaces/VisualizationShell.js';
17
17
  export * from './scripting/Script.js';
18
18
  export * from './scripting/ScriptCommands.js';
19
19
  export * from './scripting/ScriptSystem.js';
package/dist/index.js CHANGED
@@ -9,11 +9,6 @@ export * from './components/VisualizationPropertyGrid.js';
9
9
  export * from './components/ParameterEditor.js';
10
10
  export * from './components/EventAssignment.js';
11
11
  export * from './helpers/BindingsHelper.js';
12
- export * from './interfaces/IScriptMultiplexValue.js';
13
- export * from './interfaces/VisualisationElementScript.js';
14
- export * from './interfaces/VisualizationBinding.js';
15
- export * from './interfaces/VisualizationHandler.js';
16
- export * from './interfaces/VisualizationShell.js';
17
12
  export * from './scripting/Script.js';
18
13
  export * from './scripting/ScriptCommands.js';
19
14
  export * from './scripting/ScriptSystem.js';
@@ -1,4 +1,4 @@
1
- export declare class IScriptMultiplexValue {
1
+ 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)
@@ -1,20 +1 @@
1
- export class IScriptMultiplexValue {
2
- /**
3
- * signal - read the value from a Signal
4
- * property - read the value from a property of the customControl (not usable in screens)
5
- * event - read the value of a property of the event object
6
- * parameter - a parameter you hand over
7
- * context - a value of the context
8
- * complexString - a string with signals (contained in {})
9
- * complexSignal - read the value from a signal wich name is build here (it can contain other signals in {})
10
- * expression - js expression, 'ctx' is context object
11
- * elementProperty - a property defined on the element raising the event
12
- */
13
- source;
14
- /**
15
- * Name of the signal, the property of the component or the parameter of the script
16
- * or for example in a event : srcElement.value to get the value of a input wich raises the event
17
- * @TJS-format signal
18
- */
19
- name;
20
- }
1
+ export {};
@@ -364,7 +364,7 @@ export interface Condition {
364
364
  */
365
365
  value1: any;
366
366
  value2?: any;
367
- comparisonType: '==null' | '!=null' | '==true' | '==false' | '==' | '!=' | '>' | '<' | '>=' | '<=';
367
+ comparisonType: '==null' | '!=null' | '==true' | '==false' | '==' | '!=' | '>' | '<' | '>=' | '<=' | '&&' | '||';
368
368
  /**
369
369
  * Name of the label to jumpe to when condition is true
370
370
  */
@@ -57,6 +57,12 @@ export class ScriptSystem {
57
57
  case '<=':
58
58
  res = value1 <= value2;
59
59
  break;
60
+ case '&&':
61
+ res = value1 && value2;
62
+ break;
63
+ case '||':
64
+ res = value1 || value2;
65
+ break;
60
66
  }
61
67
  if (res) {
62
68
  await this.runExternalScript(await this.getValue(c.trueScriptName, outerContext), await this.getValue(c.trueScriptType, outerContext));
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.128",
4
+ "version": "0.1.129",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",