@node-projects/web-component-designer-visualization-addons 0.1.121 → 0.1.123

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.
@@ -28,10 +28,11 @@ export declare class BindingsEditor extends BaseCustomWebComponentConstructorApp
28
28
  key: string;
29
29
  value: any;
30
30
  }[];
31
+ convertersString: string;
31
32
  objectValueType: string;
32
33
  protected _property: IProperty;
33
34
  protected _binding: IBinding & {
34
- converter: Record<string, any>;
35
+ converter: Record<string, any> | string;
35
36
  };
36
37
  protected _bindingTarget: BindingTarget;
37
38
  protected _serviceContainer: ServiceContainer;
@@ -41,7 +42,9 @@ export declare class BindingsEditor extends BaseCustomWebComponentConstructorApp
41
42
  protected _objNmInput: HTMLInputElement;
42
43
  constructor(property: IProperty, binding: IBinding & {
43
44
  converter: Record<string, any>;
44
- }, bindingTarget: BindingTarget, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer, shell: VisualizationShell);
45
+ }, bindingTarget: BindingTarget, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer, shell: VisualizationShell, config?: {
46
+ namedConverters: boolean;
47
+ });
45
48
  ready(): void;
46
49
  _focusRow(index: number): void;
47
50
  _updatefocusedRow(): void;
@@ -56,8 +56,8 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
56
56
  </div>
57
57
  <div class="vertical-grid" style="margin-top: 10px;">
58
58
  <div>
59
- <div class="input-headline">
60
- <span>converter</span>:
59
+ <div class="input-headline" style="display: flex;align-items: center;">
60
+ <span>converter</span>:<input id="namedConverterInput" style="width: 100%; margin-left: 15px;" value="{{?this.convertersString::change}}">
61
61
  </div>
62
62
  </div>
63
63
  </div>
@@ -181,6 +181,7 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
181
181
  events = '';
182
182
  invert = false;
183
183
  converters = [];
184
+ convertersString;
184
185
  objectValueType;
185
186
  _property;
186
187
  _binding;
@@ -190,7 +191,7 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
190
191
  _shell;
191
192
  _activeRow = -1;
192
193
  _objNmInput;
193
- constructor(property, binding, bindingTarget, serviceContainer, instanceServiceContainer, shell) {
194
+ constructor(property, binding, bindingTarget, serviceContainer, instanceServiceContainer, shell, config = { namedConverters: true }) {
194
195
  super();
195
196
  super._restoreCachedInititalValues();
196
197
  this._objNmInput = this._getDomElement('objectName');
@@ -200,6 +201,9 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
200
201
  this._serviceContainer = serviceContainer;
201
202
  this._instanceServiceContainer = instanceServiceContainer;
202
203
  this._shell = shell;
204
+ if (!config?.namedConverters) {
205
+ this._getDomElement('namedConverterInput').style.display = 'none';
206
+ }
203
207
  }
204
208
  ready() {
205
209
  this._parseAttributesToProperties();
@@ -218,8 +222,13 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
218
222
  if (this._binding.bindableObjectNames)
219
223
  this.objectNames = this._binding.bindableObjectNames.join(';');
220
224
  if (this._binding.converter) {
221
- for (let c in this._binding.converter) {
222
- this.converters.push({ key: c, value: this._binding.converter[c] });
225
+ if (typeof this._binding.converter === 'string') {
226
+ this.convertersString = this._binding.converter;
227
+ }
228
+ else {
229
+ for (let c in this._binding.converter) {
230
+ this.converters.push({ key: c, value: this._binding.converter[c] });
231
+ }
223
232
  }
224
233
  }
225
234
  if (this._binding.changedEvents && this._binding.changedEvents.length)
@@ -757,7 +757,10 @@ export class BindingsHelper {
757
757
  else {
758
758
  const cb = (id, value) => this.handleValueChanged(element, binding, value.val, valuesObject, i, signalVars, false, relativeSignalPath);
759
759
  unsubscribeList.push([s, cb, this._visualizationHandler.subscribeState(s, cb)]);
760
- this._visualizationHandler.getState(s).then(x => this.handleValueChanged(element, binding, x?.val, valuesObject, i, signalVars, false, relativeSignalPath));
760
+ this._visualizationHandler.getState(s).then(x => {
761
+ if (x)
762
+ this.handleValueChanged(element, binding, x?.val, valuesObject, i, signalVars, false, relativeSignalPath);
763
+ });
761
764
  if (binding[1].twoWay && i == 0) {
762
765
  this.addTwoWayBinding(binding, element, v => this._visualizationHandler.setState(s, v));
763
766
  }
@@ -841,7 +844,7 @@ export class BindingsHelper {
841
844
  valuesObject[signalVarNames.length - 1] = v;
842
845
  }
843
846
  if (binding[1].converter) {
844
- if (binding[1].converter) {
847
+ if (typeof binding[1].converter === 'string') {
845
848
  v = this.namedConverterCallback(binding[1].converter, v, element, binding);
846
849
  }
847
850
  else {
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.121",
4
+ "version": "0.1.123",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",