@smartbit4all/ng-client 3.2.5 → 3.2.6

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 (90) hide show
  1. package/esm2020/lib/smart-client/smart-component-api-client.mjs +53 -25
  2. package/esm2020/lib/smart-filter-editor/api/api/filter.service.mjs +1 -1
  3. package/esm2020/lib/smart-filter-editor/api/configuration.mjs +1 -1
  4. package/esm2020/lib/smart-filter-editor/api/encoder.mjs +1 -1
  5. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBoolOperator.mjs +1 -1
  6. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderApiConfig.mjs +1 -1
  7. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderField.mjs +1 -1
  8. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderGroup.mjs +1 -1
  9. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderModel.mjs +1 -1
  10. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderUiModel.mjs +1 -1
  11. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionData.mjs +1 -1
  12. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionDataType.mjs +1 -1
  13. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionField.mjs +1 -1
  14. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldEditor.mjs +1 -1
  15. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldList.mjs +1 -1
  16. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldWidgetType.mjs +1 -1
  17. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionList.mjs +1 -1
  18. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionOperandData.mjs +1 -1
  19. package/esm2020/lib/smart-filter-editor/api/model/filterExpressionOperation.mjs +1 -1
  20. package/esm2020/lib/smart-filter-editor/api/param.mjs +1 -1
  21. package/esm2020/lib/smart-filter-editor/api/variables.mjs +1 -1
  22. package/esm2020/lib/smart-filter-editor/smart-filter-editor-content/smart-filter-editor-content.component.mjs +14 -9
  23. package/esm2020/lib/smart-form/api/model/models.mjs +1 -1
  24. package/esm2020/lib/smart-form/api/model/smartWidgetDefinition.mjs +1 -1
  25. package/esm2020/lib/smart-form/api/model/smartWidgetHint.mjs +1 -1
  26. package/esm2020/lib/smart-form/services/smartform.service.mjs +33 -30
  27. package/esm2020/lib/smart-grid/api/grid-api/api/api.mjs +1 -1
  28. package/esm2020/lib/smart-grid/api/grid-api/api/grid.service.mjs +1 -1
  29. package/esm2020/lib/smart-grid/api/grid-api/api.module.mjs +1 -1
  30. package/esm2020/lib/smart-grid/api/grid-api/configuration.mjs +1 -1
  31. package/esm2020/lib/smart-grid/api/grid-api/encoder.mjs +1 -1
  32. package/esm2020/lib/smart-grid/api/grid-api/index.mjs +1 -1
  33. package/esm2020/lib/smart-grid/api/grid-api/model/gridColumnContentType.mjs +1 -1
  34. package/esm2020/lib/smart-grid/api/grid-api/model/gridColumnMeta.mjs +1 -1
  35. package/esm2020/lib/smart-grid/api/grid-api/model/gridDataAccessConfig.mjs +1 -1
  36. package/esm2020/lib/smart-grid/api/grid-api/model/gridModel.mjs +1 -1
  37. package/esm2020/lib/smart-grid/api/grid-api/model/gridPage.mjs +1 -1
  38. package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionMode.mjs +1 -1
  39. package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionType.mjs +1 -1
  40. package/esm2020/lib/smart-grid/api/grid-api/model/gridServerModel.mjs +1 -1
  41. package/esm2020/lib/smart-grid/api/grid-api/model/gridUpdateData.mjs +1 -1
  42. package/esm2020/lib/smart-grid/api/grid-api/model/gridView.mjs +1 -1
  43. package/esm2020/lib/smart-grid/api/grid-api/model/models.mjs +1 -1
  44. package/esm2020/lib/smart-grid/api/grid-api/param.mjs +1 -1
  45. package/esm2020/lib/smart-grid/api/grid-api/variables.mjs +1 -1
  46. package/esm2020/lib/smart-tree/tree-api/api/tree.service.mjs +1 -1
  47. package/esm2020/lib/smart-tree/tree-api/configuration.mjs +1 -1
  48. package/esm2020/lib/smart-tree/tree-api/encoder.mjs +1 -1
  49. package/esm2020/lib/smart-tree/tree-api/param.mjs +1 -1
  50. package/esm2020/lib/smart-tree/tree-api/variables.mjs +1 -1
  51. package/esm2020/lib/view-context/api/api/view.service.mjs +1 -1
  52. package/esm2020/lib/view-context/api/model/uploadedFile.mjs +1 -1
  53. package/esm2020/lib/view-context/api/model/viewContextChange.mjs +1 -1
  54. package/esm2020/lib/view-context/api/model/viewEventHandler.mjs +1 -1
  55. package/esm2020/lib/view-context/smart-view-context.model.mjs +1 -1
  56. package/esm2020/lib/view-context/smart-view-context.service.mjs +48 -24
  57. package/esm2020/lib/view-context/value-api/api/api.mjs +1 -1
  58. package/esm2020/lib/view-context/value-api/api/value.service.mjs +1 -1
  59. package/esm2020/lib/view-context/value-api/api.module.mjs +1 -1
  60. package/esm2020/lib/view-context/value-api/configuration.mjs +1 -1
  61. package/esm2020/lib/view-context/value-api/encoder.mjs +1 -1
  62. package/esm2020/lib/view-context/value-api/index.mjs +1 -1
  63. package/esm2020/lib/view-context/value-api/model/genericValue.mjs +1 -1
  64. package/esm2020/lib/view-context/value-api/model/models.mjs +1 -1
  65. package/esm2020/lib/view-context/value-api/model/value.mjs +1 -1
  66. package/esm2020/lib/view-context/value-api/model/valueSetData.mjs +1 -1
  67. package/esm2020/lib/view-context/value-api/model/valueSetDefinition.mjs +1 -1
  68. package/esm2020/lib/view-context/value-api/model/valueSetDefinitionData.mjs +1 -1
  69. package/esm2020/lib/view-context/value-api/model/valueSetDefinitionIdentifier.mjs +1 -1
  70. package/esm2020/lib/view-context/value-api/model/valueSetDefinitionKind.mjs +1 -1
  71. package/esm2020/lib/view-context/value-api/model/valueSetExpression.mjs +1 -1
  72. package/esm2020/lib/view-context/value-api/model/valueSetOperand.mjs +1 -1
  73. package/esm2020/lib/view-context/value-api/model/valueSetOperation.mjs +1 -1
  74. package/esm2020/lib/view-context/value-api/param.mjs +1 -1
  75. package/esm2020/lib/view-context/value-api/variables.mjs +1 -1
  76. package/fesm2015/smartbit4all-ng-client.mjs +151 -91
  77. package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
  78. package/fesm2020/smartbit4all-ng-client.mjs +143 -82
  79. package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
  80. package/lib/smart-client/smart-component-api-client.d.ts +4 -2
  81. package/lib/smart-form/services/smartform.service.d.ts +1 -0
  82. package/lib/view-context/smart-view-context.model.d.ts +5 -4
  83. package/lib/view-context/smart-view-context.service.d.ts +9 -3
  84. package/package.json +1 -1
  85. package/smartbit4all-ng-client-3.2.6.tgz +0 -0
  86. package/src/lib/smart-filter-editor/api/README.md +226 -226
  87. package/src/lib/smart-grid/api/grid-api/README.md +226 -226
  88. package/src/lib/smart-tree/tree-api/README.md +226 -226
  89. package/src/lib/view-context/value-api/README.md +226 -226
  90. package/smartbit4all-ng-client-3.2.5.tgz +0 -0
@@ -73,7 +73,6 @@ import { MatToolbarModule } from '@angular/material/toolbar';
73
73
  import { MatBadgeModule } from '@angular/material/badge';
74
74
  import * as i3$4 from '@angular/material/tabs';
75
75
  import { MatTabsModule } from '@angular/material/tabs';
76
- import { __decorate, __param } from 'tslib';
77
76
 
78
77
  class SmartSubject extends Subject {
79
78
  constructor(unsubscribe$) {
@@ -2592,8 +2591,10 @@ class SmartViewContextService {
2592
2591
  this.dialog = dialog;
2593
2592
  this.apiQueueService = apiQueueService;
2594
2593
  this.inject = inject;
2595
- this.tabIdName = 'viewContextUuid';
2596
- this.tabIdhttpHeaderName = 'viewContextUuid';
2594
+ this.viewContextUuidName = 'viewContextUuid';
2595
+ this.viewContextUuidHeaderName = 'viewContextUuid';
2596
+ this.pageNamePrefix = 'page.';
2597
+ this.componentNamePrefix = 'component.';
2597
2598
  this.viewHandlers = new Array();
2598
2599
  this.openedViewUuids = new Array();
2599
2600
  this.openedViewData = new Array();
@@ -2658,7 +2659,7 @@ class SmartViewContextService {
2658
2659
  }
2659
2660
  async getAndSyncViewContext(uuid) {
2660
2661
  if (!uuid) {
2661
- uuid = this.getUuidOfPage(this.tabIdName);
2662
+ uuid = this.getViewContextUuid();
2662
2663
  }
2663
2664
  await this.getViewContext(uuid).then(() => {
2664
2665
  this.syncView();
@@ -2673,11 +2674,7 @@ class SmartViewContextService {
2673
2674
  }
2674
2675
  async getViewContextDataByPageName(pageName) {
2675
2676
  if (!this.viewContext) {
2676
- let viewContextUuid = sessionStorage.getItem(this.tabIdName);
2677
- if (!viewContextUuid) {
2678
- throw new Error('View context is not initialized!');
2679
- }
2680
- await this.getViewContext(viewContextUuid);
2677
+ await this.getViewContext(this.getViewContextUuid());
2681
2678
  }
2682
2679
  let pageUuid = this.getUuidOfPage(pageName);
2683
2680
  let viewContextByPageName = this.viewContext?.views.find((view) => view.uuid === pageUuid);
@@ -2695,13 +2692,6 @@ class SmartViewContextService {
2695
2692
  this.openedViewData = [];
2696
2693
  this.openedViewUuids = [];
2697
2694
  }
2698
- setTabId(tabId) {
2699
- sessionStorage.setItem(this.tabIdName, tabId);
2700
- this.session.addHeaderParam({
2701
- headerName: this.tabIdhttpHeaderName,
2702
- value: tabId,
2703
- });
2704
- }
2705
2695
  async startViewContext() {
2706
2696
  this.clearSessionStorage();
2707
2697
  let newViewContext = await this.view
@@ -2711,7 +2701,7 @@ class SmartViewContextService {
2711
2701
  throw new Error('No ViewContext was created');
2712
2702
  }
2713
2703
  this.viewContext = newViewContext;
2714
- this.setTabId(newViewContext.uuid);
2704
+ this.setViewContextUuid(newViewContext.uuid);
2715
2705
  return this.viewContext;
2716
2706
  }
2717
2707
  async initialize(uuid) {
@@ -2728,7 +2718,7 @@ class SmartViewContextService {
2728
2718
  throw new Error('The messageDialogName provided by the backend has not been set.');
2729
2719
  }
2730
2720
  if (uuid) {
2731
- this.setTabId(uuid);
2721
+ this.setViewContextUuid(uuid);
2732
2722
  try {
2733
2723
  await this.getViewContext(uuid);
2734
2724
  }
@@ -2766,7 +2756,7 @@ class SmartViewContextService {
2766
2756
  try {
2767
2757
  this.openedViewUuids.push(view.uuid);
2768
2758
  this.openedViewData.push(view);
2769
- sessionStorage.setItem(view.viewName, view.uuid);
2759
+ this.setUuidOfPage(view.viewName, view.uuid, viewHandler.componentName);
2770
2760
  dialogRef = this.dialog.openComponentAsDialog(viewHandler.component, viewHandler.name);
2771
2761
  }
2772
2762
  finally {
@@ -2774,9 +2764,9 @@ class SmartViewContextService {
2774
2764
  if (index >= 0) {
2775
2765
  this.openedViewUuids.splice(index, 1);
2776
2766
  this.openedViewData.splice(index, 1);
2777
- sessionStorage.removeItem(view.viewName);
2767
+ this.clearUuidOfPage(view.viewName, viewHandler.componentName);
2778
2768
  }
2779
- sessionStorage.setItem(view.viewName, view.uuid);
2769
+ this.setUuidOfPage(view.viewName, view.uuid, viewHandler.componentName);
2780
2770
  }
2781
2771
  let dialogDisableClose = true;
2782
2772
  let isMessageDialog = view.viewName === this.messageDialogname;
@@ -2819,7 +2809,7 @@ class SmartViewContextService {
2819
2809
  view.state = ViewState.Opened;
2820
2810
  this.openedViewUuids.push(view.uuid);
2821
2811
  this.openedViewData.push(view);
2822
- sessionStorage.setItem(view.viewName, view.uuid);
2812
+ this.setUuidOfPage(view.viewName, view.uuid, viewHandler.componentName);
2823
2813
  this.uuidOfPageHasBeenChanged.next(view.viewName);
2824
2814
  this.updateViewContext({
2825
2815
  updates: [
@@ -2859,7 +2849,7 @@ class SmartViewContextService {
2859
2849
  if (index >= 0) {
2860
2850
  this.openedViewUuids.splice(index, 1);
2861
2851
  this.openedViewData.splice(index, 1);
2862
- sessionStorage.removeItem(view.viewName);
2852
+ this.clearUuidOfPage(view.viewName, viewHandler.componentName);
2863
2853
  }
2864
2854
  this.updateViewContext({
2865
2855
  updates: [
@@ -2943,13 +2933,46 @@ class SmartViewContextService {
2943
2933
  });
2944
2934
  this.viewContextHasBeenSynced.next();
2945
2935
  }
2936
+ setViewContextUuid(uuid) {
2937
+ sessionStorage.setItem(this.viewContextUuidName, uuid);
2938
+ this.session.addHeaderParam({
2939
+ headerName: this.viewContextUuidHeaderName,
2940
+ value: uuid,
2941
+ });
2942
+ }
2943
+ getViewContextUuid() {
2944
+ let viewContextUuid = sessionStorage.getItem(this.viewContextUuidName);
2945
+ if (!viewContextUuid) {
2946
+ throw new Error('View context is not initialized!');
2947
+ }
2948
+ return viewContextUuid;
2949
+ }
2950
+ setUuidOfPage(pageName, uuid, componentName) {
2951
+ sessionStorage.setItem(this.pageNamePrefix + pageName, uuid);
2952
+ if (componentName) {
2953
+ sessionStorage.setItem(this.componentNamePrefix + componentName, pageName);
2954
+ }
2955
+ }
2956
+ clearUuidOfPage(pageName, componentName) {
2957
+ sessionStorage.removeItem(this.pageNamePrefix + pageName);
2958
+ if (componentName) {
2959
+ sessionStorage.removeItem(this.componentNamePrefix + componentName);
2960
+ }
2961
+ }
2946
2962
  getUuidOfPage(pageName) {
2947
- let uuid = sessionStorage.getItem(pageName);
2963
+ let uuid = sessionStorage.getItem(this.pageNamePrefix + pageName);
2948
2964
  if (!uuid) {
2949
2965
  throw new Error(`The uuid of ${pageName} is not available.`);
2950
2966
  }
2951
2967
  return uuid;
2952
2968
  }
2969
+ getPageNameOfComponent(componentName) {
2970
+ let pageName = sessionStorage.getItem(this.componentNamePrefix + componentName);
2971
+ if (!pageName) {
2972
+ throw new Error(`The pageName of ${componentName} is not available.`);
2973
+ }
2974
+ return pageName;
2975
+ }
2953
2976
  async message(messageData, messageResult) {
2954
2977
  return await this.handlePerformActionResponse(await this.view
2955
2978
  .message(messageData.viewUuid ?? '', messageData.uuid, messageResult)
@@ -3877,11 +3900,12 @@ class SmartFormService {
3877
3900
  }
3878
3901
  toFormGroup() {
3879
3902
  this.createFormControls(this.smartForm.widgets);
3880
- // if (this.formGroup) {
3881
- // this.formGroup.controls = this.group;
3882
- // } else {
3883
- // }
3884
- this.formGroup = new FormGroup(this.group);
3903
+ if (this.formGroup) {
3904
+ this.formGroup.controls = this.group;
3905
+ }
3906
+ else {
3907
+ this.formGroup = new FormGroup(this.group);
3908
+ }
3885
3909
  if (this.smartForm.validators && this.smartForm.validators.length) {
3886
3910
  this.formGroup.setValidators(this.smartForm.validators.map((validator) => {
3887
3911
  return validator.validator;
@@ -3903,14 +3927,7 @@ class SmartFormService {
3903
3927
  widget.type !== SmartFormWidgetType.COMPONENT &&
3904
3928
  widget.type !== SmartFormWidgetType.MATRIX &&
3905
3929
  widget.type !== SmartFormWidgetType.YOUTUBE_PLAYER) {
3906
- // let formControl = this.group[`${widget.key}`];
3907
- let formControl = new FormControl(widget.value || '', widget.validators?.map((validator) => {
3908
- return validator.validator;
3909
- }));
3910
- if (widget.isDisabled) {
3911
- formControl.disable();
3912
- }
3913
- this.group[`${widget.key}`] = formControl;
3930
+ this.createFormControl(`${widget.key}`, widget.value, widget.isDisabled, widget.validators);
3914
3931
  }
3915
3932
  if (widget.type === SmartFormWidgetType.MATRIX) {
3916
3933
  if (widget.isMultiple) {
@@ -3918,31 +3935,19 @@ class SmartFormService {
3918
3935
  let itemKeys = widget.value.columns.map((value) => value.code);
3919
3936
  dataKeys.forEach((key) => {
3920
3937
  itemKeys.forEach((item) => {
3921
- let formControl = new FormControl(widget.value.data[key][item], widget.validators?.map((validator) => {
3922
- return validator.validator;
3923
- }));
3924
- this.group[`${widget.key}.data.${key}.${item}`] = formControl;
3938
+ this.createFormControl(`${widget.key}.data.${key}.${item}`, widget.value.data[key][item], undefined, // TODO really we don't pass widget.isDisabled?
3939
+ widget.validators);
3925
3940
  });
3926
3941
  });
3927
3942
  }
3928
3943
  else {
3929
3944
  Object.keys(widget.value.data).map((key) => {
3930
- let formControl = new FormControl(widget.isMultiple ? widget.value.data[key] : widget.value.data[key][0] || '', widget.validators?.map((validator) => {
3931
- return validator.validator;
3932
- }));
3933
- if (widget.isDisabled) {
3934
- formControl.disable();
3935
- }
3936
- this.group[`${widget.key}.${key}`] = formControl;
3945
+ this.createFormControl(`${widget.key}.${key}`, widget.isMultiple ? widget.value.data[key] : widget.value.data[key][0], widget.isDisabled, widget.validators);
3937
3946
  });
3938
3947
  }
3939
3948
  }
3940
3949
  if (widget.type === SmartFormWidgetType.ITEM && parentKey) {
3941
- let formControl = new FormControl(widget.value);
3942
- if (widget.isDisabled) {
3943
- formControl.disable();
3944
- }
3945
- this.group[`${parentKey}.${widget.key}`] = formControl;
3950
+ this.createFormControl(`${parentKey}.${widget.key}`, widget.value, widget.isDisabled, undefined);
3946
3951
  }
3947
3952
  if (widget.type === SmartFormWidgetType.CONTAINER && widget.valueList?.length) {
3948
3953
  this.createFormControls(widget.valueList);
@@ -3955,6 +3960,27 @@ class SmartFormService {
3955
3960
  isValidatorInList(validator, list) {
3956
3961
  return list !== undefined && list.length > 0 && list.some((v) => v === validator);
3957
3962
  }
3963
+ createFormControl(key, value, isDisabled, validators) {
3964
+ let formControl = this.group[key];
3965
+ if (!formControl) {
3966
+ formControl = new FormControl();
3967
+ this.group[key] = formControl;
3968
+ }
3969
+ formControl.setValue(value || '');
3970
+ formControl.clearValidators();
3971
+ validators?.map((validator) => {
3972
+ formControl.addValidators(validator.validator);
3973
+ });
3974
+ if (isDisabled !== undefined) {
3975
+ if (isDisabled) {
3976
+ formControl.disable();
3977
+ }
3978
+ else {
3979
+ formControl.enable();
3980
+ }
3981
+ }
3982
+ return formControl;
3983
+ }
3958
3984
  copyValueFromFormToWidgetBeans(widgets, group) {
3959
3985
  widgets.forEach((widget) => {
3960
3986
  if (widget.type === SmartFormWidgetType.CONTAINER && widget.valueList?.length) {
@@ -13275,38 +13301,41 @@ class SmartFilterEditorContentComponent {
13275
13301
  model[index] = filterExpressionField;
13276
13302
  if (filterExpressionField.widgetType === 'SELECT_MULTIPLE') {
13277
13303
  key = index + '.expressionData.operand2.selectedValues';
13278
- widgets.push(this.constructFormWidget(key, filterExpressionField.label2, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues));
13304
+ widgets.push(this.constructFormWidget(key, filterExpressionField.label2, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues, filterExpressionField.expressionData?.operand2?.valueAsString ?? ''));
13279
13305
  return;
13280
13306
  }
13281
13307
  if (filterExpressionField.expressionData?.currentOperation === 'BETWEEN') {
13282
13308
  key = index + '.expressionData.operand2.valueAsString';
13283
- widgets.push(this.constructFormWidget(key, filterExpressionField.label2, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues));
13309
+ widgets.push(this.constructFormWidget(key, filterExpressionField.label2, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues, filterExpressionField.expressionData?.operand2?.valueAsString ?? ''));
13284
13310
  key = index + '.expressionData.operand3.valueAsString';
13285
- widgets.push(this.constructFormWidget(key, filterExpressionField.label2, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues));
13311
+ widgets.push(this.constructFormWidget(key, filterExpressionField.label2, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues, filterExpressionField.expressionData?.operand3?.valueAsString ?? ''));
13286
13312
  return;
13287
13313
  }
13288
13314
  if (filterExpressionField.expressionData?.operand2) {
13289
13315
  if (key !== index + '.expressionData.operand2.selectedValues') {
13290
13316
  key = index + '.expressionData.operand2.valueAsString';
13291
13317
  }
13292
- widgets.push(this.constructFormWidget(key, filterExpressionField.label2, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues));
13318
+ widgets.push(this.constructFormWidget(key, filterExpressionField.label2, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues, filterExpressionField.expressionData?.operand2?.valueAsString ?? ''));
13293
13319
  return;
13294
13320
  }
13295
13321
  if (filterExpressionField?.expressionData?.operand3) {
13296
13322
  if (key !== index + '.selectedValues') {
13297
13323
  key = index + '.expressionData.operand3.valueAsString';
13298
13324
  }
13299
- widgets.push(this.constructFormWidget(key, filterExpressionField.label3, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues));
13325
+ widgets.push(this.constructFormWidget(key, filterExpressionField.label3, filterExpressionField.widgetType ?? FilterExpressionFieldWidgetType.TextField, filterExpressionField.possibleValues, filterExpressionField.expressionData?.operand3?.valueAsString ?? ''));
13300
13326
  return;
13301
13327
  }
13302
13328
  });
13303
- this.simpleFilterForm = {
13329
+ let smartForm = {
13304
13330
  direction: SmartFormWidgetDirection.ROW,
13305
13331
  componentModel: { data: model },
13306
13332
  useOnValueChangeEvent: true,
13307
13333
  useOnBlurEvent: true,
13308
13334
  widgets,
13309
13335
  };
13336
+ if (!deepEqual(smartForm, this.simpleFilterForm)) {
13337
+ this.simpleFilterForm = smartForm;
13338
+ }
13310
13339
  }
13311
13340
  extractFilterFieldFromFormModel() {
13312
13341
  let simpleFilter = this.simpleFilterFormChildren?.first?.submitForm(false).componentModel.data;
@@ -13393,7 +13422,7 @@ class SmartFilterEditorContentComponent {
13393
13422
  },
13394
13423
  });
13395
13424
  }
13396
- constructFormWidget(key, label, widgetType, possibleValues) {
13425
+ constructFormWidget(key, label, widgetType, possibleValues, value) {
13397
13426
  let type = widgetType;
13398
13427
  if (type === FilterExpressionFieldWidgetType.Date) {
13399
13428
  type = SmartFormWidgetType.DATE_PICKER;
@@ -13402,10 +13431,11 @@ class SmartFilterEditorContentComponent {
13402
13431
  type = SmartFormWidgetType.DATE_TIME_PICKER;
13403
13432
  }
13404
13433
  let widget = {
13434
+ error: undefined,
13405
13435
  key,
13406
13436
  label,
13407
13437
  type,
13408
- value: '',
13438
+ value,
13409
13439
  showLabel: true,
13410
13440
  valueList: possibleValues.map((value) => {
13411
13441
  return {
@@ -14014,11 +14044,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
14014
14044
  type: Injectable
14015
14045
  }], ctorParameters: function () { return [{ type: FilterService }]; } });
14016
14046
 
14017
- let SmartComponentApiClient = class SmartComponentApiClient {
14018
- constructor(inject, auth, pageName) {
14047
+ class SmartComponentApiClient {
14048
+ constructor(inject, auth, pageName, componentName) {
14019
14049
  this.inject = inject;
14020
14050
  this.auth = auth;
14021
14051
  this.pageName = pageName;
14052
+ this.componentName = componentName;
14022
14053
  this._destroy$ = new Subject();
14023
14054
  this.detectChange = new SmartSubject(this._destroy$);
14024
14055
  this.uiActionModels = [];
@@ -14027,10 +14058,24 @@ let SmartComponentApiClient = class SmartComponentApiClient {
14027
14058
  this.widgets = new WidgetMap();
14028
14059
  this.formWidgets = new WidgetMap();
14029
14060
  this.useQueryLists = false;
14061
+ // check and calculate pageName
14062
+ if (!this.pageName && !this.componentName) {
14063
+ throw new Error('pageName or componentName must be specified!');
14064
+ }
14065
+ this.viewContext = inject.get(SmartViewContextService);
14066
+ if (this.componentName) {
14067
+ let pageNameForComponent = this.viewContext.getPageNameOfComponent(this.componentName);
14068
+ if (!this.pageName) {
14069
+ this.pageName = pageNameForComponent;
14070
+ }
14071
+ else if (this.pageName !== pageNameForComponent) {
14072
+ throw new Error(`pageName (${pageName}) and componentName (${componentName}) doesn't match!`);
14073
+ }
14074
+ }
14075
+ // from this point we have this.pageName
14030
14076
  this.detectChange.subscribe((change) => {
14031
14077
  this.handleChanges(change);
14032
14078
  });
14033
- this.viewContext = inject.get(SmartViewContextService);
14034
14079
  this.uiActionService = inject.get(UiActionService);
14035
14080
  this.uiActionDescriptorService = inject.get(UiActionDescriptorService);
14036
14081
  }
@@ -14104,23 +14149,42 @@ let SmartComponentApiClient = class SmartComponentApiClient {
14104
14149
  if (this.useQueryLists) {
14105
14150
  if (!this.getSmartComponentLayoutsQL()) {
14106
14151
  console.warn('SmartComponentLayoutsQL not available!');
14107
- return;
14108
14152
  }
14109
- // TODO maybe we should set comp.parent, not comp.smartComponentLayout.parentComponent..
14110
- this.getSmartComponentLayoutsQL().forEach((comp) => {
14111
- if (comp.smartComponentLayout) {
14112
- SmartComponentLayoutUtility.setParent(comp.smartComponentLayout, this);
14113
- }
14114
- });
14115
- this.getSmartComponentLayoutsQL()
14116
- .changes.pipe(takeUntil(this._destroy$))
14117
- .subscribe((list) => list.forEach((comp) => {
14118
- if (comp.smartComponentLayout) {
14119
- SmartComponentLayoutUtility.setParent(comp.smartComponentLayout, this);
14120
- }
14121
- }));
14153
+ else {
14154
+ this.handleQueryList(this.getSmartComponentLayoutsQL(), (comp) => {
14155
+ if (comp.smartComponentLayout) {
14156
+ // TODO maybe we should set comp.parent, not comp.smartComponentLayout.parentComponent..
14157
+ SmartComponentLayoutUtility.setParent(comp.smartComponentLayout, this);
14158
+ }
14159
+ if (this.uuid && this.uuid !== comp.uuid)
14160
+ comp.uuid = this.uuid;
14161
+ });
14162
+ }
14163
+ if (!this.getSmartGridsQL()) {
14164
+ console.warn('SmartGridsQL not available!');
14165
+ }
14166
+ else {
14167
+ this.handleQueryList(this.getSmartGridsQL(), (grid) => {
14168
+ if (grid) {
14169
+ if (grid.smartGrid) {
14170
+ grid.smartGrid.uiActionService = this.uiActionService;
14171
+ grid.smartGrid.uiActionDescriptorService = this.uiActionDescriptorService;
14172
+ grid.smartGrid.serviceToUse = this;
14173
+ grid.smartGrid.viewContextService = this.viewContext;
14174
+ }
14175
+ if (this.uuid && this.uuid !== grid.uuid)
14176
+ grid.uuid = this.uuid;
14177
+ }
14178
+ });
14179
+ }
14122
14180
  }
14123
14181
  }
14182
+ handleQueryList(ql, handler) {
14183
+ ql.forEach((el) => handler(el));
14184
+ this.getSmartComponentLayoutsQL()
14185
+ .changes.pipe(takeUntil(this._destroy$))
14186
+ .subscribe((list) => list.forEach((el) => handler(el)));
14187
+ }
14124
14188
  getWidgets() {
14125
14189
  if (this.useQueryLists) {
14126
14190
  let widgets = new WidgetMap();
@@ -14501,10 +14565,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
14501
14565
  handleConstraintChange(changes, changeKey) {
14502
14566
  this.model.constraints = changes[changeKey];
14503
14567
  }
14504
- };
14505
- SmartComponentApiClient = __decorate([
14506
- __param(2, Inject('pageName'))
14507
- ], SmartComponentApiClient);
14568
+ }
14508
14569
  class WidgetMap {
14509
14570
  constructor() {
14510
14571
  this._widgets = new Map();