@smartbit4all/ng-client 3.3.145 → 3.3.146

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.
Files changed (153) hide show
  1. package/esm2020/lib/session/api/api/session.service.mjs +1 -1
  2. package/esm2020/lib/session/api/encoder.mjs +1 -1
  3. package/esm2020/lib/session/api/model/accountInfo.mjs +1 -1
  4. package/esm2020/lib/session/api/model/apiError.mjs +1 -1
  5. package/esm2020/lib/session/api/model/authenticationProviderData.mjs +1 -1
  6. package/esm2020/lib/session/api/model/getAuthenticationProvidersResponse.mjs +1 -1
  7. package/esm2020/lib/session/api/model/models.mjs +1 -1
  8. package/esm2020/lib/session/api/model/refreshSessionRequest.mjs +1 -1
  9. package/esm2020/lib/session/api/model/session.mjs +1 -1
  10. package/esm2020/lib/session/api/model/sessionInfoData.mjs +1 -1
  11. package/esm2020/lib/session/api/model/userActivityLog.mjs +1 -1
  12. package/esm2020/lib/session/api/param.mjs +1 -1
  13. package/esm2020/lib/session/api/variables.mjs +1 -1
  14. package/esm2020/lib/smart-component-layout/api/api/api.mjs +1 -1
  15. package/esm2020/lib/smart-component-layout/api/api/default.service.mjs +1 -1
  16. package/esm2020/lib/smart-component-layout/api/api.module.mjs +1 -1
  17. package/esm2020/lib/smart-component-layout/api/configuration.mjs +1 -1
  18. package/esm2020/lib/smart-component-layout/api/encoder.mjs +1 -1
  19. package/esm2020/lib/smart-component-layout/api/index.mjs +1 -1
  20. package/esm2020/lib/smart-component-layout/api/model/componentType.mjs +1 -1
  21. package/esm2020/lib/smart-component-layout/api/model/componentWidgetType.mjs +1 -1
  22. package/esm2020/lib/smart-component-layout/api/model/layoutDirection.mjs +1 -1
  23. package/esm2020/lib/smart-component-layout/api/model/models.mjs +1 -1
  24. package/esm2020/lib/smart-component-layout/api/model/smartComponentLayoutDefinition.mjs +1 -1
  25. package/esm2020/lib/smart-component-layout/api/model/smartComponentWidgetDefinition.mjs +1 -1
  26. package/esm2020/lib/smart-component-layout/api/param.mjs +1 -1
  27. package/esm2020/lib/smart-component-layout/api/variables.mjs +1 -1
  28. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionBoolOperator.mjs +1 -1
  29. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionBuilderField.mjs +1 -1
  30. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionBuilderGroup.mjs +1 -1
  31. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionBuilderModel.mjs +1 -1
  32. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionData.mjs +1 -1
  33. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionDataType.mjs +1 -1
  34. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionField.mjs +1 -1
  35. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionFieldList.mjs +1 -1
  36. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionFieldWidgetType.mjs +1 -1
  37. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionList.mjs +1 -1
  38. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionOperandData.mjs +1 -1
  39. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionOperation.mjs +1 -1
  40. package/esm2020/lib/smart-filter/api/filter/model/filterExpressionOrderBy.mjs +1 -1
  41. package/esm2020/lib/smart-filter-editor/api/api/filter.service.mjs +1 -1
  42. package/esm2020/lib/smart-filter-editor/api/configuration.mjs +1 -1
  43. package/esm2020/lib/smart-filter-editor/api/encoder.mjs +1 -1
  44. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBoolOperator.mjs +1 -1
  45. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderApiConfig.mjs +1 -1
  46. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderField.mjs +1 -1
  47. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderGroup.mjs +1 -1
  48. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderModel.mjs +1 -1
  49. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderUiModel.mjs +1 -1
  50. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionData.mjs +1 -1
  51. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionDataType.mjs +1 -1
  52. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionField.mjs +1 -1
  53. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldEditor.mjs +1 -1
  54. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldList.mjs +1 -1
  55. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldWidgetType.mjs +1 -1
  56. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionList.mjs +1 -1
  57. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionOperandData.mjs +1 -1
  58. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionOperation.mjs +1 -1
  59. package/esm2020/lib/smart-filter-editor/api/model/smartFilterType.mjs +1 -1
  60. package/esm2020/lib/smart-filter-editor/api/param.mjs +1 -1
  61. package/esm2020/lib/smart-filter-editor/api/variables.mjs +1 -1
  62. package/esm2020/lib/smart-form/api/model/smartFormWidgetType.mjs +1 -1
  63. package/esm2020/lib/smart-form/api/model/valueChangeMode.mjs +1 -1
  64. package/esm2020/lib/smart-form/services/smartform.service.mjs +57 -36
  65. package/esm2020/lib/smart-form/smartform.component.mjs +3 -3
  66. package/esm2020/lib/smart-grid/api/grid-api/api/api.mjs +1 -1
  67. package/esm2020/lib/smart-grid/api/grid-api/api/grid.service.mjs +1 -1
  68. package/esm2020/lib/smart-grid/api/grid-api/api.module.mjs +1 -1
  69. package/esm2020/lib/smart-grid/api/grid-api/configuration.mjs +1 -1
  70. package/esm2020/lib/smart-grid/api/grid-api/encoder.mjs +1 -1
  71. package/esm2020/lib/smart-grid/api/grid-api/index.mjs +1 -1
  72. package/esm2020/lib/smart-grid/api/grid-api/model/gridColumnContentType.mjs +1 -1
  73. package/esm2020/lib/smart-grid/api/grid-api/model/gridColumnMeta.mjs +1 -1
  74. package/esm2020/lib/smart-grid/api/grid-api/model/gridDataAccessConfig.mjs +1 -1
  75. package/esm2020/lib/smart-grid/api/grid-api/model/gridModel.mjs +1 -1
  76. package/esm2020/lib/smart-grid/api/grid-api/model/gridPage.mjs +1 -1
  77. package/esm2020/lib/smart-grid/api/grid-api/model/gridRow.mjs +1 -1
  78. package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionChange.mjs +1 -1
  79. package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionMode.mjs +1 -1
  80. package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionType.mjs +1 -1
  81. package/esm2020/lib/smart-grid/api/grid-api/model/gridServerModel.mjs +1 -1
  82. package/esm2020/lib/smart-grid/api/grid-api/model/gridUpdateData.mjs +1 -1
  83. package/esm2020/lib/smart-grid/api/grid-api/model/gridView.mjs +1 -1
  84. package/esm2020/lib/smart-grid/api/grid-api/model/gridViewDescriptor.mjs +1 -1
  85. package/esm2020/lib/smart-grid/api/grid-api/model/models.mjs +1 -1
  86. package/esm2020/lib/smart-grid/api/grid-api/param.mjs +1 -1
  87. package/esm2020/lib/smart-grid/api/grid-api/variables.mjs +1 -1
  88. package/esm2020/lib/smart-tree/tree-api/api/tree.service.mjs +1 -1
  89. package/esm2020/lib/smart-tree/tree-api/configuration.mjs +1 -1
  90. package/esm2020/lib/smart-tree/tree-api/encoder.mjs +1 -1
  91. package/esm2020/lib/smart-tree/tree-api/param.mjs +1 -1
  92. package/esm2020/lib/smart-tree/tree-api/variables.mjs +1 -1
  93. package/esm2020/lib/view-context/api/api/api.mjs +1 -1
  94. package/esm2020/lib/view-context/api/api/view.service.mjs +1 -1
  95. package/esm2020/lib/view-context/api/api.module.mjs +1 -1
  96. package/esm2020/lib/view-context/api/configuration.mjs +1 -1
  97. package/esm2020/lib/view-context/api/encoder.mjs +1 -1
  98. package/esm2020/lib/view-context/api/index.mjs +1 -1
  99. package/esm2020/lib/view-context/api/model/closeResult.mjs +1 -1
  100. package/esm2020/lib/view-context/api/model/componentConstraint.mjs +1 -1
  101. package/esm2020/lib/view-context/api/model/componentModel.mjs +1 -1
  102. package/esm2020/lib/view-context/api/model/componentModelChange.mjs +1 -1
  103. package/esm2020/lib/view-context/api/model/dataChange.mjs +1 -1
  104. package/esm2020/lib/view-context/api/model/dataChangeEvent.mjs +1 -1
  105. package/esm2020/lib/view-context/api/model/dataChangeKind.mjs +1 -1
  106. package/esm2020/lib/view-context/api/model/downloadedFile.mjs +1 -1
  107. package/esm2020/lib/view-context/api/model/iconPosition.mjs +1 -1
  108. package/esm2020/lib/view-context/api/model/imageResource.mjs +1 -1
  109. package/esm2020/lib/view-context/api/model/link.mjs +1 -1
  110. package/esm2020/lib/view-context/api/model/messageData.mjs +1 -1
  111. package/esm2020/lib/view-context/api/model/messageOption.mjs +1 -1
  112. package/esm2020/lib/view-context/api/model/messageOptionType.mjs +1 -1
  113. package/esm2020/lib/view-context/api/model/messageResult.mjs +1 -1
  114. package/esm2020/lib/view-context/api/model/messageTextType.mjs +1 -1
  115. package/esm2020/lib/view-context/api/model/messageType.mjs +1 -1
  116. package/esm2020/lib/view-context/api/model/openPendingData.mjs +1 -1
  117. package/esm2020/lib/view-context/api/model/smartLinkData.mjs +1 -1
  118. package/esm2020/lib/view-context/api/model/style.mjs +1 -1
  119. package/esm2020/lib/view-context/api/model/uiActionButtonDescriptor.mjs +1 -1
  120. package/esm2020/lib/view-context/api/model/uiActionButtonType.mjs +1 -1
  121. package/esm2020/lib/view-context/api/model/uiActionConstraint.mjs +1 -1
  122. package/esm2020/lib/view-context/api/model/uiActionDescriptor.mjs +1 -1
  123. package/esm2020/lib/view-context/api/model/uiActionDialogDescriptor.mjs +1 -1
  124. package/esm2020/lib/view-context/api/model/uiActionFeedbackType.mjs +1 -1
  125. package/esm2020/lib/view-context/api/model/uiActionInputType.mjs +1 -1
  126. package/esm2020/lib/view-context/api/model/uiActionTooltip.mjs +1 -1
  127. package/esm2020/lib/view-context/api/model/uiActionUploadDescriptor.mjs +1 -1
  128. package/esm2020/lib/view-context/api/model/view.mjs +1 -1
  129. package/esm2020/lib/view-context/api/model/viewApiError.mjs +1 -1
  130. package/esm2020/lib/view-context/api/model/viewConstraint.mjs +1 -1
  131. package/esm2020/lib/view-context/api/model/viewContext.mjs +1 -1
  132. package/esm2020/lib/view-context/api/model/viewContextData.mjs +1 -1
  133. package/esm2020/lib/view-context/api/model/viewContextUpdate.mjs +1 -1
  134. package/esm2020/lib/view-context/api/model/viewData.mjs +1 -1
  135. package/esm2020/lib/view-context/api/model/viewState.mjs +1 -1
  136. package/esm2020/lib/view-context/api/model/viewStateUpdate.mjs +1 -1
  137. package/esm2020/lib/view-context/api/model/viewType.mjs +1 -1
  138. package/esm2020/lib/view-context/api/param.mjs +1 -1
  139. package/esm2020/lib/view-context/api/variables.mjs +1 -1
  140. package/fesm2015/smartbit4all-ng-client.mjs +60 -39
  141. package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
  142. package/fesm2020/smartbit4all-ng-client.mjs +58 -37
  143. package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
  144. package/lib/smart-form/services/smartform.service.d.ts +2 -2
  145. package/package.json +1 -1
  146. package/smartbit4all-ng-client-3.3.146.tgz +0 -0
  147. package/src/lib/session/api/README.md +226 -226
  148. package/src/lib/smart-component-layout/api/README.md +226 -226
  149. package/src/lib/smart-filter-editor/api/README.md +226 -226
  150. package/src/lib/smart-grid/api/grid-api/README.md +226 -226
  151. package/src/lib/smart-tree/tree-api/README.md +226 -226
  152. package/src/lib/view-context/api/README.md +226 -226
  153. package/smartbit4all-ng-client-3.3.145.tgz +0 -0
@@ -3931,17 +3931,20 @@ class SmartFormService {
3931
3931
  });
3932
3932
  return properties;
3933
3933
  }
3934
- setValuesFromModel() {
3934
+ setValuesFromModel(widgets) {
3935
3935
  const smartForm = this.smartForm;
3936
- const data = this.smartForm?.componentModel?.data;
3936
+ const data = smartForm.componentModel?.data;
3937
3937
  if (!data) {
3938
3938
  return;
3939
3939
  }
3940
- const keys = this.collectKeysFromSmartForm(smartForm.widgets, []);
3940
+ if (!widgets) {
3941
+ widgets = smartForm.widgets;
3942
+ }
3943
+ const keys = this.collectKeysFromSmartForm(widgets, []);
3941
3944
  let widget;
3942
3945
  for (const key of this.getPropertyNamesDeeply(data)) {
3943
3946
  if (keys.includes(key)) {
3944
- widget = this.findSmartFormWidgetByKey(smartForm.widgets, key);
3947
+ widget = this.findSmartFormWidgetByKey(widgets, key);
3945
3948
  if (widget) {
3946
3949
  let value = this.getValueDeeply(data, key);
3947
3950
  if (typeof value === 'boolean' && widget.type !== SmartFormWidgetType.TOGGLE) {
@@ -3975,7 +3978,7 @@ class SmartFormService {
3975
3978
  // In case of CheckBox2
3976
3979
  let splittedKeys = key.split('.');
3977
3980
  splittedKeys.splice(splittedKeys.length - 1, 1);
3978
- widget = this.findSmartFormWidgetByKey(smartForm.widgets, splittedKeys.join('.'));
3981
+ widget = this.findSmartFormWidgetByKey(widgets, splittedKeys.join('.'));
3979
3982
  if (widget && widget.type === SmartFormWidgetType.CHECK_BOX_2) {
3980
3983
  this.copyFromValueSetToValuesList(widget, smartForm.componentModel.valueSets);
3981
3984
  if (widget.valueList) {
@@ -4233,29 +4236,6 @@ class SmartFormService {
4233
4236
  else {
4234
4237
  widget.isVisible = constraint.visible;
4235
4238
  }
4236
- if (constraint.mandatory !== undefined && constraint.mandatory) {
4237
- if (widget.type !== SmartFormWidgetType.INDICATOR &&
4238
- widget.type !== SmartFormWidgetType.LABEL &&
4239
- widget.type !== SmartFormWidgetType.CONTAINER &&
4240
- widget.type !== SmartFormWidgetType.IMAGE &&
4241
- widget.type !== SmartFormWidgetType.SVG &&
4242
- widget.type !== SmartFormWidgetType.FILE_UPLOADER &&
4243
- widget.type !== SmartFormWidgetType.DIVIDER &&
4244
- widget.type !== SmartFormWidgetType.BUTTON &&
4245
- widget.type !== SmartFormWidgetType.COMPONENT &&
4246
- widget.type !== SmartFormWidgetType.YOUTUBE_PLAYER) {
4247
- widget.validators = [
4248
- ...(widget.validators ?? []),
4249
- {
4250
- validator: Validators.required,
4251
- isCustom: false,
4252
- errorMessage: '',
4253
- name: 'required',
4254
- },
4255
- ];
4256
- this.removeEmptyItemFromValueList(widget);
4257
- }
4258
- }
4259
4239
  if (widget.type !== SmartFormWidgetType.INDICATOR &&
4260
4240
  widget.type !== SmartFormWidgetType.LABEL &&
4261
4241
  widget.type !== SmartFormWidgetType.CONTAINER &&
@@ -4266,6 +4246,41 @@ class SmartFormService {
4266
4246
  widget.type !== SmartFormWidgetType.BUTTON &&
4267
4247
  widget.type !== SmartFormWidgetType.COMPONENT &&
4268
4248
  widget.type !== SmartFormWidgetType.YOUTUBE_PLAYER) {
4249
+ let validators = widget.validators ?? [];
4250
+ let requiredIndex = validators.findIndex((v) => v.validator === Validators.required);
4251
+ let wasMandatory = requiredIndex >= 0;
4252
+ let tobeMandatory = false;
4253
+ if (constraint.mandatory === undefined) {
4254
+ // not specified on server, use client state
4255
+ tobeMandatory = wasMandatory;
4256
+ }
4257
+ else {
4258
+ tobeMandatory = constraint.mandatory;
4259
+ }
4260
+ if (!wasMandatory && tobeMandatory) {
4261
+ // add required validator
4262
+ widget.validators = [
4263
+ ...validators,
4264
+ {
4265
+ validator: Validators.required,
4266
+ isCustom: false,
4267
+ errorMessage: '',
4268
+ name: 'required',
4269
+ },
4270
+ ];
4271
+ // remove empty item
4272
+ this.removeEmptyItemFromValueList(widget);
4273
+ }
4274
+ if (wasMandatory && !tobeMandatory) {
4275
+ // remove required validator
4276
+ widget.validators?.splice(requiredIndex, 1);
4277
+ // add empty item
4278
+ let emptyLabel = '';
4279
+ if ('selection' in widget) {
4280
+ emptyLabel = widget.selection?.emptyLabel ?? '';
4281
+ }
4282
+ this.addEmptyItemToValueList(widget, emptyLabel);
4283
+ }
4269
4284
  if (constraint.enabled === undefined) {
4270
4285
  if (widget.isDisabled === undefined) {
4271
4286
  widget.isDisabled = false;
@@ -4311,20 +4326,26 @@ class SmartFormService {
4311
4326
  // test the path against the generated regex
4312
4327
  return regex.test(path);
4313
4328
  }
4314
- applyConstraints() {
4329
+ applyConstraints(widgets) {
4315
4330
  if (this.smartForm.componentModel?.constraints &&
4316
4331
  this.smartForm.componentModel?.constraints.length) {
4332
+ if (!widgets) {
4333
+ widgets = this.smartForm.widgets;
4334
+ }
4317
4335
  this.applyComponentConstraints(this.smartForm.widgets, this.smartForm.componentModel?.constraints);
4318
4336
  }
4319
4337
  }
4320
4338
  addEmptyItemToValueList(widget, emptyLabel) {
4321
4339
  if (widget.type == SmartFormWidgetType.SELECT) {
4322
- widget.valueList?.unshift({
4323
- key: this.emptyKey,
4324
- label: emptyLabel ?? '',
4325
- type: SmartFormWidgetType.ITEM,
4326
- value: '', // this should be undefined, but FormControl cannot be null, from v14 it will
4327
- });
4340
+ const containsEmptyKey = widget.valueList.some((v) => v.key === this.emptyKey);
4341
+ if (!containsEmptyKey) {
4342
+ widget.valueList?.unshift({
4343
+ key: this.emptyKey,
4344
+ label: emptyLabel ?? '',
4345
+ type: SmartFormWidgetType.ITEM,
4346
+ value: '', // this should be undefined, but FormControl cannot be null, from v14 it will
4347
+ });
4348
+ }
4328
4349
  }
4329
4350
  }
4330
4351
  removeEmptyItemFromValueList(widget) {
@@ -6112,11 +6133,11 @@ class SmartformComponent {
6112
6133
  this.onValueChangeSubject = new SmartSubject(this._destroy$);
6113
6134
  }
6114
6135
  this.service.smartForm = this.smartForm;
6115
- this.service.setValuesFromModel();
6116
- this.service.applyConstraints();
6117
6136
  if (!this.originalWidgets || this.originalWidgets.length === 0) {
6118
6137
  this.originalWidgets = this.smartForm.widgets;
6119
6138
  }
6139
+ this.service.setValuesFromModel(this.originalWidgets);
6140
+ this.service.applyConstraints(this.originalWidgets);
6120
6141
  this.smartForm.widgets = this.service.filterWidgetsByVisibility(this.originalWidgets);
6121
6142
  this.form = this.service.toFormGroup();
6122
6143
  if (this.smartForm.translateService) {