@smartbit4all/ng-client 3.0.25 → 3.0.27

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.
@@ -2908,6 +2908,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
2908
2908
 
2909
2909
  class SmartFormService {
2910
2910
  constructor() {
2911
+ this.emptyKey = '#empt%@*y';
2911
2912
  this.group = {};
2912
2913
  }
2913
2914
  getSmartFormWidgetByKey(key) {
@@ -3097,6 +3098,7 @@ class SmartFormService {
3097
3098
  value: value[valueSetData.keyProperty],
3098
3099
  };
3099
3100
  });
3101
+ this.addEmptyItemToValueList(widget);
3100
3102
  }
3101
3103
  else if (widget.selection.type === SelectionDefinition.TypeEnum.Object &&
3102
3104
  !widget.selection.mapping.length) {
@@ -3109,6 +3111,7 @@ class SmartFormService {
3109
3111
  value: value,
3110
3112
  };
3111
3113
  });
3114
+ this.addEmptyItemToValueList(widget);
3112
3115
  }
3113
3116
  }
3114
3117
  }
@@ -3288,6 +3291,7 @@ class SmartFormService {
3288
3291
  name: 'required',
3289
3292
  },
3290
3293
  ];
3294
+ this.removeEmptyItemFromValueList(widget);
3291
3295
  }
3292
3296
  }
3293
3297
  if (widget.type !== SmartFormWidgetType.INDICATOR &&
@@ -3315,6 +3319,27 @@ class SmartFormService {
3315
3319
  this.applyComponentConstraints(this.smartForm.widgets, this.smartForm.componentModel?.constraints);
3316
3320
  }
3317
3321
  }
3322
+ addEmptyItemToValueList(widget) {
3323
+ if (widget.type == SmartFormWidgetType.SELECT ||
3324
+ widget.type == SmartFormWidgetType.SELECT_MULTIPLE) {
3325
+ widget.valueList?.unshift({
3326
+ key: this.emptyKey,
3327
+ label: '',
3328
+ type: SmartFormWidgetType.ITEM,
3329
+ value: undefined,
3330
+ });
3331
+ }
3332
+ }
3333
+ removeEmptyItemFromValueList(widget) {
3334
+ if ('valueList' in widget) {
3335
+ if (widget.valueList?.length) {
3336
+ let firstItem = widget.valueList[0];
3337
+ if (firstItem?.key === this.emptyKey) {
3338
+ widget.valueList.shift();
3339
+ }
3340
+ }
3341
+ }
3342
+ }
3318
3343
  filterWidgetsByVisibility(widgets) {
3319
3344
  return widgets.filter((widget) => widget.isVisible === undefined ? true : widget.isVisible);
3320
3345
  }
@@ -4336,13 +4361,6 @@ class SmartformwidgetComponent {
4336
4361
  }
4337
4362
  // calling this.truncateUri didn't work
4338
4363
  // TODO: use widget.selection.parameter for ignoreUriVersion / strictUriComparison;
4339
- if (this.widgetInstance) {
4340
- if (this.widgetInstance.type == SmartFormWidgetType.SELECT ||
4341
- this.widgetInstance.type == SmartFormWidgetType.SELECT_MULTIPLE) {
4342
- if (this.widgetInstance.selection && this.widgetInstance.selection.type == 'PROPERTY') {
4343
- }
4344
- }
4345
- }
4346
4364
  let v1 = convert(o1);
4347
4365
  let v2 = convert(o2);
4348
4366
  return v1 === v2;