@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.
@@ -2788,6 +2788,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
2788
2788
 
2789
2789
  class SmartFormService {
2790
2790
  constructor() {
2791
+ this.emptyKey = '#empt%@*y';
2791
2792
  this.group = {};
2792
2793
  }
2793
2794
  getSmartFormWidgetByKey(key) {
@@ -2982,6 +2983,7 @@ class SmartFormService {
2982
2983
  value: value[valueSetData.keyProperty],
2983
2984
  };
2984
2985
  });
2986
+ this.addEmptyItemToValueList(widget);
2985
2987
  }
2986
2988
  else if (widget.selection.type === SelectionDefinition.TypeEnum.Object &&
2987
2989
  !widget.selection.mapping.length) {
@@ -2995,6 +2997,7 @@ class SmartFormService {
2995
2997
  value: value,
2996
2998
  };
2997
2999
  });
3000
+ this.addEmptyItemToValueList(widget);
2998
3001
  }
2999
3002
  }
3000
3003
  }
@@ -3181,6 +3184,7 @@ class SmartFormService {
3181
3184
  name: 'required',
3182
3185
  },
3183
3186
  ];
3187
+ this.removeEmptyItemFromValueList(widget);
3184
3188
  }
3185
3189
  }
3186
3190
  if (widget.type !== SmartFormWidgetType.INDICATOR &&
@@ -3209,6 +3213,29 @@ class SmartFormService {
3209
3213
  this.applyComponentConstraints(this.smartForm.widgets, (_c = this.smartForm.componentModel) === null || _c === void 0 ? void 0 : _c.constraints);
3210
3214
  }
3211
3215
  }
3216
+ addEmptyItemToValueList(widget) {
3217
+ var _a;
3218
+ if (widget.type == SmartFormWidgetType.SELECT ||
3219
+ widget.type == SmartFormWidgetType.SELECT_MULTIPLE) {
3220
+ (_a = widget.valueList) === null || _a === void 0 ? void 0 : _a.unshift({
3221
+ key: this.emptyKey,
3222
+ label: '',
3223
+ type: SmartFormWidgetType.ITEM,
3224
+ value: undefined,
3225
+ });
3226
+ }
3227
+ }
3228
+ removeEmptyItemFromValueList(widget) {
3229
+ var _a;
3230
+ if ('valueList' in widget) {
3231
+ if ((_a = widget.valueList) === null || _a === void 0 ? void 0 : _a.length) {
3232
+ let firstItem = widget.valueList[0];
3233
+ if ((firstItem === null || firstItem === void 0 ? void 0 : firstItem.key) === this.emptyKey) {
3234
+ widget.valueList.shift();
3235
+ }
3236
+ }
3237
+ }
3238
+ }
3212
3239
  filterWidgetsByVisibility(widgets) {
3213
3240
  return widgets.filter((widget) => widget.isVisible === undefined ? true : widget.isVisible);
3214
3241
  }
@@ -4249,13 +4276,6 @@ class SmartformwidgetComponent {
4249
4276
  }
4250
4277
  // calling this.truncateUri didn't work
4251
4278
  // TODO: use widget.selection.parameter for ignoreUriVersion / strictUriComparison;
4252
- if (this.widgetInstance) {
4253
- if (this.widgetInstance.type == SmartFormWidgetType.SELECT ||
4254
- this.widgetInstance.type == SmartFormWidgetType.SELECT_MULTIPLE) {
4255
- if (this.widgetInstance.selection && this.widgetInstance.selection.type == 'PROPERTY') {
4256
- }
4257
- }
4258
- }
4259
4279
  let v1 = convert(o1);
4260
4280
  let v2 = convert(o2);
4261
4281
  return v1 === v2;