@node-projects/web-component-designer-visualization-addons 0.1.132 → 0.1.133

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.
@@ -123,7 +123,10 @@ export class SimpleScriptEditor extends BaseCustomWebComponentConstructorAppend
123
123
  if (!property.specialAllreadyAdded) {
124
124
  //@ts-ignore
125
125
  property.specialAllreadyAdded = true;
126
- if ((typeof currentValue === 'object' && currentValue !== null) || property.format === 'complex') {
126
+ if (property.format === 'collection') {
127
+ //TODO: create a collection edt. in property grid control used
128
+ }
129
+ else if ((typeof currentValue === 'object' && currentValue !== null) || property.format === 'complex') {
127
130
  let rB = document.createElement('button');
128
131
  rB.style.height = 'calc(100% - 6px)';
129
132
  rB.style.position = 'relative';
@@ -897,37 +897,62 @@ export class BindingsHelper {
897
897
  else {
898
898
  const stringValue = (v != null ? v.toString() : v);
899
899
  if (stringValue in binding[1].converter) {
900
- v = new Function(signalVarNames, 'return `' + binding[1].converter[stringValue] + '`')(...valuesObject);
900
+ const cvVal = binding[1].converter[stringValue];
901
+ if (typeof cvVal === 'string')
902
+ v = new Function(signalVarNames, 'return `' + binding[1].converter[stringValue] + '`')(...valuesObject);
903
+ else
904
+ v = cvVal;
901
905
  }
902
906
  else {
907
+ let endedWithBreak = false;
903
908
  //@ts-ignore
904
909
  const nr = parseFloat(v);
905
910
  for (let c in binding[1].converter) {
906
911
  if (c.length > 2 && c[0] === '>' && c[1] === '=') {
907
912
  const wr = parseFloat(c.substring(2));
908
913
  if (nr >= wr) {
909
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
914
+ const cvVal = binding[1].converter[c];
915
+ if (typeof cvVal === 'string')
916
+ v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
917
+ else
918
+ v = cvVal;
919
+ endedWithBreak = true;
910
920
  break;
911
921
  }
912
922
  }
913
923
  else if (c.length > 2 && c[0] === '<' && c[1] === '=') {
914
924
  const wr = parseFloat(c.substring(2));
915
925
  if (nr <= wr) {
916
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
926
+ const cvVal = binding[1].converter[c];
927
+ if (typeof cvVal === 'string')
928
+ v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
929
+ else
930
+ v = cvVal;
931
+ endedWithBreak = true;
917
932
  break;
918
933
  }
919
934
  }
920
935
  else if (c.length > 1 && c[0] === '>') {
921
936
  const wr = parseFloat(c.substring(1));
922
937
  if (nr > wr) {
923
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
938
+ const cvVal = binding[1].converter[c];
939
+ if (typeof cvVal === 'string')
940
+ v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
941
+ else
942
+ v = cvVal;
943
+ endedWithBreak = true;
924
944
  break;
925
945
  }
926
946
  }
927
947
  else if (c.length > 1 && c[0] === '<') {
928
948
  const wr = parseFloat(c.substring(1));
929
949
  if (nr < wr) {
930
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
950
+ const cvVal = binding[1].converter[c];
951
+ if (typeof cvVal === 'string')
952
+ v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
953
+ else
954
+ v = cvVal;
955
+ endedWithBreak = true;
931
956
  break;
932
957
  }
933
958
  }
@@ -935,12 +960,19 @@ export class BindingsHelper {
935
960
  const sp = c.split('-');
936
961
  if (sp.length > 1) {
937
962
  if ((sp[0] === '' || nr >= parseFloat(sp[0])) && (sp[1] === '' || parseFloat(sp[1]) >= nr)) {
938
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
963
+ const cvVal = binding[1].converter[c];
964
+ if (typeof cvVal === 'string')
965
+ v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
966
+ else
967
+ v = cvVal;
968
+ endedWithBreak = true;
939
969
  break;
940
970
  }
941
971
  }
942
972
  }
943
973
  }
974
+ if (!endedWithBreak && binding[1].converterDefault !== undefined)
975
+ v = binding[1].converterDefault;
944
976
  }
945
977
  }
946
978
  }
@@ -7,6 +7,7 @@ export interface VisualizationBinding {
7
7
  events?: string[];
8
8
  target: BindingTarget;
9
9
  converter?: Record<string, any>;
10
+ converterDefault?: any;
10
11
  expression?: string;
11
12
  expressionTwoWay?: string;
12
13
  compiledExpression?: Function;
@@ -116,6 +116,10 @@ export interface ToggleSignalValue {
116
116
  }
117
117
  export interface ToggleSignalValueThroughList {
118
118
  type: 'ToggleSignalValueThroughList';
119
+ /**
120
+ * List of values wich can be toggled through
121
+ * @TJS-format collection
122
+ */
119
123
  valueList: (string | number | boolean)[];
120
124
  /**
121
125
  * Name of the signal
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.132",
4
+ "version": "0.1.133",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",