@pega/angular-sdk-overrides 25.1.12 → 26.1.10

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 (168) hide show
  1. package/lib/designSystemExtension/alert/alert.component.html +4 -1
  2. package/lib/designSystemExtension/alert/alert.component.scss +9 -10
  3. package/lib/designSystemExtension/alert/alert.component.ts +6 -2
  4. package/lib/designSystemExtension/field-group/field-group.component.ts +11 -3
  5. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +51 -36
  6. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +12 -0
  7. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +11 -0
  8. package/lib/designSystemExtension/operator/operator.component.html +5 -3
  9. package/lib/designSystemExtension/operator/operator.component.scss +7 -0
  10. package/lib/designSystemExtension/operator/operator.component.ts +2 -1
  11. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.html +100 -10
  12. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +141 -1
  13. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.spec.ts +1 -1
  14. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.ts +240 -72
  15. package/lib/field/auto-complete/auto-complete.component.html +46 -5
  16. package/lib/field/auto-complete/auto-complete.component.scss +92 -0
  17. package/lib/field/auto-complete/auto-complete.component.ts +350 -23
  18. package/lib/field/cancel-alert/cancel-alert.component.ts +38 -15
  19. package/lib/field/check-box/check-box.component.html +8 -6
  20. package/lib/field/check-box/check-box.component.ts +9 -2
  21. package/lib/field/currency/currency.component.html +2 -1
  22. package/lib/field/currency/currency.component.ts +10 -1
  23. package/lib/field/date/date.component.html +2 -1
  24. package/lib/field/date/date.component.ts +2 -0
  25. package/lib/field/date-time/date-time.component.html +2 -1
  26. package/lib/field/date-time/date-time.component.scss +46 -40
  27. package/lib/field/date-time/date-time.component.ts +29 -0
  28. package/lib/field/decimal/decimal.component.html +2 -1
  29. package/lib/field/decimal/decimal.component.ts +2 -0
  30. package/lib/field/dropdown/dropdown.component.html +4 -1
  31. package/lib/field/dropdown/dropdown.component.ts +18 -19
  32. package/lib/field/email/email.component.html +2 -1
  33. package/lib/field/email/email.component.ts +2 -2
  34. package/lib/field/embedded-data-multi/embedded-data-multi.component.html +3 -0
  35. package/lib/field/embedded-data-multi/embedded-data-multi.component.scss +0 -0
  36. package/lib/field/embedded-data-multi/embedded-data-multi.component.ts +173 -0
  37. package/lib/field/field.base.ts +27 -1
  38. package/lib/field/group/group.component.html +1 -1
  39. package/lib/field/group/group.component.ts +16 -7
  40. package/lib/field/integer/integer.component.html +2 -1
  41. package/lib/field/integer/integer.component.ts +4 -2
  42. package/lib/field/location/location.component.html +2 -1
  43. package/lib/field/location/location.component.ts +3 -1
  44. package/lib/field/multiselect/multiselect.component.html +1 -1
  45. package/lib/field/multiselect/multiselect.component.ts +23 -4
  46. package/lib/field/multiselect/utils.ts +5 -3
  47. package/lib/field/object-reference/object-reference.component.html +30 -15
  48. package/lib/field/object-reference/object-reference.component.ts +818 -94
  49. package/lib/field/percentage/percentage.component.html +2 -1
  50. package/lib/field/percentage/percentage.component.ts +10 -1
  51. package/lib/field/phone/phone.component.html +2 -1
  52. package/lib/field/phone/phone.component.ts +2 -1
  53. package/lib/field/radio-buttons/radio-buttons.component.html +2 -1
  54. package/lib/field/radio-buttons/radio-buttons.component.ts +10 -1
  55. package/lib/field/rich-text/rich-text.component.scss +1 -166
  56. package/lib/field/rich-text/rich-text.component.spec.ts +1 -1
  57. package/lib/field/rich-text/rich-text.component.ts +1 -1
  58. package/lib/field/selectable-card/selectable-card.component.html +1 -0
  59. package/lib/field/selectable-card/selectable-card.component.ts +31 -16
  60. package/lib/field/semantic-link/semantic-link.component.html +1 -1
  61. package/lib/field/semantic-link/semantic-link.component.scss +4 -0
  62. package/lib/field/semantic-link/semantic-link.component.ts +13 -7
  63. package/lib/field/text-area/text-area.component.html +2 -1
  64. package/lib/field/text-area/text-area.component.ts +2 -1
  65. package/lib/field/text-input/text-input.component.html +2 -1
  66. package/lib/field/text-input/text-input.component.ts +2 -1
  67. package/lib/field/time/time.component.html +2 -1
  68. package/lib/field/time/time.component.ts +2 -1
  69. package/lib/field/url/url.component.html +2 -1
  70. package/lib/field/url/url.component.ts +2 -1
  71. package/lib/field/user-reference/user-reference.component.html +4 -2
  72. package/lib/field/user-reference/user-reference.component.ts +11 -6
  73. package/lib/infra/Containers/flow-container/flow-container.component.html +2 -2
  74. package/lib/infra/Containers/flow-container/flow-container.component.ts +34 -42
  75. package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.html +12 -0
  76. package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.spec.ts +130 -0
  77. package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.ts +77 -0
  78. package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +35 -8
  79. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +185 -196
  80. package/lib/infra/Containers/view-container/view-container.component.html +1 -1
  81. package/lib/infra/Containers/view-container/view-container.component.ts +36 -43
  82. package/lib/infra/assignment/assignment.component.html +2 -1
  83. package/lib/infra/assignment/assignment.component.ts +44 -22
  84. package/lib/infra/assignment-card/assignment-card.component.html +1 -0
  85. package/lib/infra/assignment-card/assignment-card.component.ts +2 -8
  86. package/lib/infra/defer-load/defer-load.component.ts +7 -5
  87. package/lib/infra/multi-step/multi-step.component.html +25 -33
  88. package/lib/infra/multi-step/multi-step.component.scss +67 -125
  89. package/lib/infra/multi-step/multi-step.component.ts +11 -0
  90. package/lib/infra/navbar/navbar.component.ts +33 -36
  91. package/lib/infra/reference/reference.component.html +7 -1
  92. package/lib/infra/reference/reference.component.ts +63 -109
  93. package/lib/infra/region/region.component.ts +1 -3
  94. package/lib/infra/root-container/root-container.component.html +1 -0
  95. package/lib/infra/root-container/root-container.component.ts +34 -42
  96. package/lib/infra/view/view.component.ts +22 -46
  97. package/lib/template/advanced-search/advanced-search.component.ts +0 -1
  98. package/lib/template/advanced-search/search-groups/search-groups.component.ts +2 -3
  99. package/lib/template/app-shell/app-shell.component.ts +13 -13
  100. package/lib/template/banner-page/banner-page.component.ts +1 -2
  101. package/lib/template/base/details-template-base.ts +41 -14
  102. package/lib/template/base/form-template-base.ts +0 -2
  103. package/lib/template/case-summary/case-summary.component.ts +15 -7
  104. package/lib/template/case-view/case-view.component.html +14 -2
  105. package/lib/template/case-view/case-view.component.spec.ts +119 -10
  106. package/lib/template/case-view/case-view.component.ts +52 -3
  107. package/lib/template/data-reference/data-reference.component.ts +29 -22
  108. package/lib/template/data-reference/search-form/search-form.component.html +1 -1
  109. package/lib/template/data-reference/search-form/search-form.component.ts +9 -1
  110. package/lib/template/data-reference/search-form/tabsData.ts +0 -1
  111. package/lib/template/default-form/default-form.component.html +20 -4
  112. package/lib/template/default-form/default-form.component.ts +14 -5
  113. package/lib/template/default-page/default-page.component.ts +1 -2
  114. package/lib/template/details/details.component.html +23 -3
  115. package/lib/template/details/details.component.scss +9 -2
  116. package/lib/template/details/details.component.ts +3 -70
  117. package/lib/template/details-narrow-wide/details-narrow-wide.component.html +21 -2
  118. package/lib/template/details-narrow-wide/details-narrow-wide.component.scss +8 -1
  119. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +3 -39
  120. package/lib/template/details-one-column/details-one-column.component.html +23 -1
  121. package/lib/template/details-one-column/details-one-column.component.scss +14 -0
  122. package/lib/template/details-one-column/details-one-column.component.ts +3 -40
  123. package/lib/template/details-three-column/details-three-column.component.html +21 -2
  124. package/lib/template/details-three-column/details-three-column.component.scss +8 -1
  125. package/lib/template/details-three-column/details-three-column.component.ts +3 -48
  126. package/lib/template/details-two-column/details-two-column.component.html +21 -2
  127. package/lib/template/details-two-column/details-two-column.component.scss +8 -1
  128. package/lib/template/details-two-column/details-two-column.component.ts +3 -46
  129. package/lib/template/details-wide-narrow/details-wide-narrow.component.html +21 -2
  130. package/lib/template/details-wide-narrow/details-wide-narrow.component.scss +8 -1
  131. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +3 -43
  132. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +1 -0
  133. package/lib/template/field-group-template/field-group-template.component.ts +19 -6
  134. package/lib/template/field-value-list/field-value-list.component.scss +17 -0
  135. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -10
  136. package/lib/template/list-view/list-view.component.ts +47 -11
  137. package/lib/template/one-column/one-column.component.html +3 -0
  138. package/lib/template/one-column-tab/one-column-tab.component.html +1 -0
  139. package/lib/template/page/page.component.html +1 -0
  140. package/lib/template/self-service-case-view/self-service-case-view.component.html +13 -1
  141. package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +96 -11
  142. package/lib/template/self-service-case-view/self-service-case-view.component.ts +52 -3
  143. package/lib/template/simple-table/simple-table.component.ts +11 -1
  144. package/lib/template/simple-table-manual/helpers.ts +84 -16
  145. package/lib/template/simple-table-manual/simple-table-manual.component.html +30 -14
  146. package/lib/template/simple-table-manual/simple-table-manual.component.scss +8 -2
  147. package/lib/template/simple-table-manual/simple-table-manual.component.ts +142 -46
  148. package/lib/template/single-reference-readonly/single-reference-readonly.component.html +0 -0
  149. package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +2 -3
  150. package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +7 -8
  151. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +0 -3
  152. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +19 -21
  153. package/lib/widget/attachment/AttachmentUtils.ts +19 -11
  154. package/lib/widget/attachment/attachment.component.html +16 -6
  155. package/lib/widget/attachment/attachment.component.ts +14 -4
  156. package/lib/widget/case-history/case-history.component.ts +6 -2
  157. package/lib/widget/feed-container/feed-container.component.ts +1 -199
  158. package/lib/widget/file-utility/file-utility.component.ts +26 -30
  159. package/lib/widget/todo/todo.component.ts +7 -2
  160. package/package.json +2 -2
  161. package/lib/designSystemExtension/material-details/material-details.component.html +0 -40
  162. package/lib/designSystemExtension/material-details/material-details.component.scss +0 -116
  163. package/lib/designSystemExtension/material-details/material-details.component.spec.ts +0 -24
  164. package/lib/designSystemExtension/material-details/material-details.component.ts +0 -31
  165. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +0 -29
  166. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +0 -34
  167. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.spec.ts +0 -22
  168. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +0 -37
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, Input, NgZone, forwardRef, OnDestroy } from '@angular/core';
1
+ import { ChangeDetectorRef, Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { MatSnackBarModule, MatSnackBar } from '@angular/material/snack-bar';
4
4
  import { Subscription } from 'rxjs';
@@ -52,14 +52,14 @@ export class AppShellComponent implements OnInit, OnDestroy {
52
52
  bOkDisplayError = false;
53
53
  portalTemplate: string;
54
54
  links: any = [];
55
- imageURL: string | Blob;
55
+ imageURL: string | Blob | null;
56
56
  localizedVal = PCore.getLocaleUtils().getLocaleValue;
57
57
 
58
58
  constructor(
59
59
  private angularPConnect: AngularPConnectService,
60
60
  private erService: ErrorMessagesService,
61
61
  private snackBar: MatSnackBar,
62
- private ngZone: NgZone,
62
+ private cdRef: ChangeDetectorRef,
63
63
  private utils: Utils
64
64
  ) {}
65
65
 
@@ -89,7 +89,6 @@ export class AppShellComponent implements OnInit, OnDestroy {
89
89
  PCore.getEnvironmentInfo().setEnvironmentInfo({ ...PCore.getEnvironmentInfo().environmentInfoObject, pyPortalTemplate: 'wss' } as any);
90
90
  }
91
91
 
92
- // @ts-ignore - Property 'pyCaseTypesAvailableToCreateDP' does not exist on type pxApplication
93
92
  const caseTypesAvailableToCreateDP = PCore.getEnvironmentInfo().environmentInfoObject?.pxApplication?.pyCaseTypesAvailableToCreateDP;
94
93
  if (caseTypesAvailableToCreateDP) {
95
94
  const portalID = this.pConn$.getValue('.pyOwner');
@@ -152,17 +151,15 @@ export class AppShellComponent implements OnInit, OnDestroy {
152
151
  const portalClass = this.pConn$.getValue('.classID', ''); // 2nd arg empty string until typedef marked correctly
153
152
  const envPortalName = envInfo.getPortalName();
154
153
 
155
- this.ngZone.run(() => {
156
- // making a copy, so can add info
157
- this.pages$ = this.configProps$.pages;
154
+ // making a copy, so can add info
155
+ this.pages$ = this.configProps$.pages;
158
156
 
159
- if (this.pages$) {
160
- this.bShowAppShell$ = true;
161
- }
157
+ if (this.pages$) {
158
+ this.bShowAppShell$ = true;
159
+ }
162
160
 
163
- this.caseTypes$ = this.configProps$.caseTypes;
164
- this.arChildren$ = this.pConn$.getChildren();
165
- });
161
+ this.caseTypes$ = this.configProps$.caseTypes;
162
+ this.arChildren$ = this.pConn$.getChildren();
166
163
 
167
164
  const portalLogo = this.configProps$.portalLogo;
168
165
  // using the default icon then fetch it from the static folder (not auth involved)
@@ -181,12 +178,14 @@ export class AppShellComponent implements OnInit, OnDestroy {
181
178
  .getSvcImageUrl(portalLogo)
182
179
  .then(data => {
183
180
  this.imageURL = data;
181
+ this.cdRef.markForCheck();
184
182
  })
185
183
  .catch(() => {
186
184
  console.error(`${this.localizedVal('Unable to load the image for the portal logo/icon with the insName', 'AppShell')}:${portalLogo}`);
187
185
  });
188
186
  }
189
187
  this.appName$ = this.localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase());
188
+ this.cdRef.markForCheck();
190
189
  }
191
190
 
192
191
  // fpr show/hiding error messages in the SnackBar component
@@ -244,5 +243,6 @@ export class AppShellComponent implements OnInit, OnDestroy {
244
243
  default:
245
244
  break;
246
245
  }
246
+ this.cdRef.markForCheck();
247
247
  }
248
248
  }
@@ -1,6 +1,5 @@
1
1
  import { Component, Input, OnChanges, OnInit, SimpleChanges, forwardRef } from '@angular/core';
2
2
 
3
- import { ReferenceComponent } from '@pega/angular-sdk-components';
4
3
  import { CommonModule } from '@angular/common';
5
4
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
6
5
 
@@ -59,6 +58,6 @@ export class BannerPageComponent implements OnInit, OnChanges {
59
58
  this.backgroundImage = this.configProps$.backgroundImage;
60
59
 
61
60
  // The children may contain 'reference' components, so normalize the children...
62
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
61
+ this.arChildren$ = this.pConn$.getChildren();
63
62
  }
64
63
  }
@@ -1,15 +1,20 @@
1
1
  import { Directive, OnInit, OnDestroy, Injector, Input } from '@angular/core';
2
+ import { FormGroup } from '@angular/forms';
2
3
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
3
4
 
4
5
  @Directive()
5
6
  export class DetailsTemplateBase implements OnInit, OnDestroy {
6
7
  @Input() pConn$: typeof PConnect;
8
+ @Input() formGroup$: FormGroup;
7
9
 
8
10
  // For interaction with AngularPConnect
9
11
  protected angularPConnectData: AngularPConnectData = {};
10
12
  protected angularPConnect;
11
13
 
12
- childrenMetadataOld;
14
+ children: any[] = [];
15
+ propsToUse: any = {};
16
+ showHighlightedData: boolean;
17
+ highlightedDataArr: any = [];
13
18
 
14
19
  constructor(injector: Injector) {
15
20
  this.angularPConnect = injector.get(AngularPConnectService);
@@ -37,23 +42,13 @@ export class DetailsTemplateBase implements OnInit, OnDestroy {
37
42
  const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
38
43
 
39
44
  // Only call updateSelf when the component should update
40
- if (bUpdateSelf || this.hasRawMetadataChanged()) {
45
+ if (bUpdateSelf) {
41
46
  this.updateSelf();
42
47
  }
43
48
  }
44
49
 
45
- // this method will get overriden by the child component
46
- updateSelf() {}
47
-
48
- hasRawMetadataChanged(): boolean {
49
- const newChildrenMetadata = this.fetchChildrenMetadata();
50
-
51
- if (!PCore.isDeepEqual(newChildrenMetadata, this.childrenMetadataOld)) {
52
- this.childrenMetadataOld = newChildrenMetadata;
53
- return true;
54
- }
55
-
56
- return false;
50
+ updateSelf() {
51
+ this.updateDetailsProps();
57
52
  }
58
53
 
59
54
  fetchChildrenMetadata() {
@@ -64,4 +59,36 @@ export class DetailsTemplateBase implements OnInit, OnDestroy {
64
59
  return pConnect.resolveConfigProps(pConnect.getRawMetadata());
65
60
  });
66
61
  }
62
+
63
+ updateDetailsProps() {
64
+ const { label, showLabel, showHighlightedData } = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps());
65
+ this.propsToUse = { label, showLabel, ...this.pConn$.getInheritedProps() };
66
+ this.showHighlightedData = showHighlightedData;
67
+
68
+ this.pConn$.setInheritedProp('displayMode', 'DISPLAY_ONLY');
69
+ this.pConn$.setInheritedProp('readOnly', true);
70
+
71
+ this.children = this.pConn$.getChildren() as any[];
72
+
73
+ // Process highlighted fields for display in the highlighted section
74
+ this.highlightedDataArr = this.processHighlightedFields();
75
+ }
76
+
77
+ processHighlightedFields(): any[] {
78
+ if (!this.showHighlightedData) return [];
79
+
80
+ const { highlightedData = [] } = (this.pConn$.getRawMetadata() as any).config;
81
+
82
+ return (highlightedData ?? []).map(field => {
83
+ field.config.displayMode = 'STACKED_LARGE_VAL';
84
+ field.config.readOnly = true;
85
+
86
+ if (field.config.value === '@P .pyStatusWork') {
87
+ field.type = 'TextInput';
88
+ field.config.displayAsStatus = true;
89
+ }
90
+
91
+ return this.pConn$.createComponent(field, '', 0, {}).getPConnect();
92
+ });
93
+ }
67
94
  }
@@ -7,8 +7,6 @@ export class FormTemplateBase implements OnDestroy {
7
7
  angularPConnectData: AngularPConnectData;
8
8
 
9
9
  ngOnDestroy(): void {
10
- PCore.getContextTreeManager().removeContextTreeNode(this.pConn$.getContextName());
11
-
12
10
  if (this.angularPConnectData?.unsubscribeFn) {
13
11
  this.angularPConnectData.unsubscribeFn();
14
12
  }
@@ -1,9 +1,9 @@
1
1
  import { Component, OnInit, Input, forwardRef, OnDestroy, OnChanges } from '@angular/core';
2
2
  import { FormGroup } from '@angular/forms';
3
3
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
4
- import { ReferenceComponent } from '@pega/angular-sdk-components';
5
4
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
6
5
  import { Utils } from '@pega/angular-sdk-components';
6
+ import { getAllFields } from '@pega/angular-sdk-components';
7
7
 
8
8
  interface CaseSummaryProps {
9
9
  // If any, enter additional props that only exist on this component
@@ -52,11 +52,6 @@ export class CaseSummaryComponent implements OnInit, OnDestroy, OnChanges {
52
52
  }
53
53
 
54
54
  initComponent() {
55
- // dereference the View in case the incoming pConn$ is a 'reference'
56
- this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$);
57
-
58
- // Then, continue on with other initialization
59
-
60
55
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as CaseSummaryProps;
61
56
  this.arChildren$ = this.pConn$.getChildren();
62
57
 
@@ -79,7 +74,20 @@ export class CaseSummaryComponent implements OnInit, OnDestroy, OnChanges {
79
74
  }
80
75
 
81
76
  updateSelf() {
77
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as CaseSummaryProps;
82
78
  this.generatePrimaryAndSecondaryFields();
79
+ this.status$ = this.configProps$.status;
80
+ this.bShowStatus$ = this.configProps$.showStatus;
81
+ }
82
+
83
+ additionalProps() {
84
+ const allFields = getAllFields(this.pConn$);
85
+ const fields = {
86
+ primaryFields: allFields[0],
87
+ secondaryFields: allFields[1]
88
+ };
89
+
90
+ return this.pConn$.resolveConfigProps(fields);
83
91
  }
84
92
 
85
93
  ngOnChanges() {
@@ -92,7 +100,7 @@ export class CaseSummaryComponent implements OnInit, OnDestroy, OnChanges {
92
100
 
93
101
  for (const oField of this.arChildren$[0].getPConnect().getChildren()) {
94
102
  const kid = oField.getPConnect();
95
- this.primaryFields$.push(kid.resolveConfigProps(kid.getRawMetadata()));
103
+ this.primaryFields$.push({ ...kid.resolveConfigProps(kid.getRawMetadata()), kid });
96
104
  }
97
105
 
98
106
  const secondarySummaryFields = this.prepareCaseSummaryData(this.arChildren$[1].getPConnect());
@@ -17,7 +17,9 @@
17
17
 
18
18
  <div class="psdk-case-view-buttons">
19
19
  <button *ngIf="editAction" mat-raised-button color="secondary" (click)="_editClick()">{{ localizedVal('Edit', localeCategory) }}</button>
20
- <button mat-raised-button color="secondary" [matMenuTriggerFor]="actionMenu">{{ localizedVal('Actions...', localeCategory) }}</button>
20
+ <button mat-raised-button color="secondary" [matMenuTriggerFor]="actionMenu" [disabled]="bActionsMenuDisabled$">
21
+ {{ localizedVal('Actions...', localeCategory) }}
22
+ </button>
21
23
  <mat-menu #actionMenu="matMenu" overlapTrigger="false">
22
24
  <ng-container *ngFor="let action of arAvailableActions$">
23
25
  <button mat-menu-item (click)="_menuActionClick(action)">
@@ -29,13 +31,23 @@
29
31
  {{ process.name }}
30
32
  </button>
31
33
  </ng-container>
34
+ <ng-container *ngFor="let action of arDataObjectActions$">
35
+ <button mat-menu-item (click)="_menuDataObjectActionClick(action)">
36
+ {{ localizedVal(action.name, '', localeKey) }}
37
+ </button>
38
+ </ng-container>
39
+ <ng-container *ngFor="let action of arCreateCaseActions$">
40
+ <button mat-menu-item (click)="_menuCreateCaseActionClick(action)">
41
+ {{ localizedVal(action.name, '', localeKey) }}
42
+ </button>
43
+ </ng-container>
32
44
  </mat-menu>
33
45
  </div>
34
46
 
35
47
  <div class="psdk-case-view-divider"></div>
36
48
 
37
49
  <div class="psdk-case-view-summary">
38
- <component-mapper name="CaseSummary" [props]="{ pConn$: caseSummaryPConn$ }"></component-mapper>
50
+ <component-mapper name="reference" [props]="{ pConn$: caseSummaryPConn$ }"></component-mapper>
39
51
  </div>
40
52
 
41
53
  <component-mapper
@@ -1,24 +1,133 @@
1
- import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
1
+ import { ChangeDetectorRef } from '@angular/core';
2
2
 
3
3
  import { CaseViewComponent } from './case-view.component';
4
4
 
5
5
  describe('CaseViewComponent', () => {
6
6
  let component: CaseViewComponent;
7
- let fixture: ComponentFixture<CaseViewComponent>;
7
+ let actionsApi: { openDataObjectAction: jasmine.Spy; createWork: jasmine.Spy };
8
+ let dataInfoActions: any;
9
+ let dataRecord: any;
10
+ let caseInfo: any;
8
11
 
9
- beforeEach(waitForAsync(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [CaseViewComponent]
12
- }).compileComponents();
13
- }));
12
+ const tabsChild = {
13
+ getPConnect: () => ({
14
+ getRawMetadata: () => ({ type: 'region', name: 'Tabs' }),
15
+ getChildren: () => []
16
+ })
17
+ };
14
18
 
15
19
  beforeEach(() => {
16
- fixture = TestBed.createComponent(CaseViewComponent);
17
- component = fixture.componentInstance;
18
- fixture.detectChanges();
20
+ (globalThis as any).PCore = {
21
+ getLocaleUtils: () => ({ getLocaleValue: (value: string) => value })
22
+ };
23
+
24
+ actionsApi = {
25
+ openDataObjectAction: jasmine.createSpy('openDataObjectAction'),
26
+ createWork: jasmine.createSpy('createWork')
27
+ };
28
+ dataInfoActions = undefined;
29
+ dataRecord = { PlanID: 'P-1', CustomerID: 'C-9' };
30
+ caseInfo = { ID: 'C-1', availableActions: [], availableProcesses: [] };
31
+
32
+ const cdRef = { detectChanges: () => {}, markForCheck: () => {} } as unknown as ChangeDetectorRef;
33
+ const utils = { getImageSrc: () => '', getSDKStaticContentUrl: () => '' } as any;
34
+
35
+ component = new CaseViewComponent(cdRef, {} as any, utils);
36
+ component.pConn$ = {
37
+ resolveConfigProps: (props: any) => props,
38
+ getConfigProps: () => ({ icon: 'case', header: 'Header', subheader: 'ID-1' }),
39
+ getCaseInfo: () => ({ getClassName: () => 'My-Class', getName: () => 'My Case' }),
40
+ getChildren: () => [tabsChild],
41
+ getLocalizationService: () => ({ getLocalizedText: (value: string) => value }),
42
+ getDataObject: () => ({ caseInfo }),
43
+ getValue: (prop: string, context?: string) => {
44
+ if (prop === '.actions' && context === 'dataInfo') return dataInfoActions;
45
+ if (prop === '.content' && context === 'dataInfo') return dataRecord;
46
+ if (prop === '.classID' && context === 'dataInfo.content') return 'My-Data-Class';
47
+ if (context === '') return dataRecord[prop.slice(1)];
48
+ return undefined;
49
+ },
50
+ getActionsApi: () => actionsApi
51
+ } as any;
52
+ component.localizedVal = (value: string) => value;
19
53
  });
20
54
 
21
55
  it('should create', () => {
22
56
  expect(component).toBeTruthy();
23
57
  });
58
+
59
+ it('lists data object actions published under dataInfo', () => {
60
+ dataInfoActions = {
61
+ availableActions: [{ ID: 'Edit', name: 'Edit' }],
62
+ availableCreateCaseActions: [{ ID: 'My-Work-Class', name: 'Request Plan Change' }]
63
+ };
64
+
65
+ component.fullUpdate();
66
+
67
+ expect(component.arDataObjectActions$.length).toBe(1);
68
+ expect(component.arCreateCaseActions$.length).toBe(1);
69
+ });
70
+
71
+ it('falls back to empty arrays when the dataInfo context is absent', () => {
72
+ dataInfoActions = undefined;
73
+
74
+ component.fullUpdate();
75
+
76
+ expect(component.arDataObjectActions$).toEqual([]);
77
+ expect(component.arCreateCaseActions$).toEqual([]);
78
+ });
79
+
80
+ it('disables the actions menu when no action of any kind is available', () => {
81
+ component.fullUpdate();
82
+
83
+ expect(component.bActionsMenuDisabled$).toBeTrue();
84
+ });
85
+
86
+ it('enables the actions menu when only data object actions are available', () => {
87
+ dataInfoActions = { availableActions: [{ ID: 'Edit', name: 'Edit' }] };
88
+
89
+ component.fullUpdate();
90
+
91
+ expect(component.bActionsMenuDisabled$).toBeFalse();
92
+ });
93
+
94
+ it('picks up case actions that arrive after the first update, without a case ID change', () => {
95
+ component.fullUpdate();
96
+ expect(component.bActionsMenuDisabled$).toBeTrue();
97
+ expect(component.editAction).toBeUndefined();
98
+
99
+ caseInfo.availableActions = [{ ID: 'pyUpdateCaseDetails', name: 'Edit details' }];
100
+ component.updateCaseActions();
101
+
102
+ expect(component.arAvailableActions$.length).toBe(1);
103
+ expect(component.editAction).toBeTruthy();
104
+ expect(component.bActionsMenuDisabled$).toBeFalse();
105
+ });
106
+
107
+ it('opens a data object action with the record class and content', () => {
108
+ component._menuDataObjectActionClick({ ID: 'updateCVV', name: 'Update CVV' });
109
+
110
+ expect(actionsApi.openDataObjectAction).toHaveBeenCalledWith('My-Data-Class', dataRecord, 'updateCVV', 'Update CVV');
111
+ });
112
+
113
+ it('starts a new case with starting fields nested under the target reference field', () => {
114
+ component._menuCreateCaseActionClick({
115
+ ID: 'My-Work-Class',
116
+ name: 'Request Plan Change',
117
+ targetDataReferenceField: {
118
+ field: 'PlanRef',
119
+ inputs: [{ linkedField: 'PlanID' }, { linkedField: 'CustomerID' }]
120
+ }
121
+ });
122
+
123
+ expect(actionsApi.createWork).toHaveBeenCalledWith('My-Work-Class', {
124
+ startingFields: { PlanRef: { PlanID: 'P-1', CustomerID: 'C-9' } }
125
+ });
126
+ });
127
+
128
+ it('starts a new case with no starting fields when the action declares no inputs', () => {
129
+ component._menuCreateCaseActionClick({ ID: 'My-Work-Class', name: 'Request Plan Change' });
130
+
131
+ expect(actionsApi.createWork).toHaveBeenCalledWith('My-Work-Class', { startingFields: {} });
132
+ });
24
133
  });
@@ -8,6 +8,7 @@ import { interval } from 'rxjs';
8
8
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
9
9
  import { Utils } from '@pega/angular-sdk-components';
10
10
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
+ import { CreateCaseAction, DataObjectAction, DataObjectActions } from '@pega/angular-sdk-components';
11
12
 
12
13
  interface CaseViewProps {
13
14
  // If any, enter additional props that only exist on this component
@@ -45,6 +46,9 @@ export class CaseViewComponent implements OnInit, OnDestroy {
45
46
 
46
47
  arAvailableActions$: any[] = [];
47
48
  arAvailabeProcesses$: any[] = [];
49
+ arDataObjectActions$: DataObjectAction[] = [];
50
+ arCreateCaseActions$: CreateCaseAction[] = [];
51
+ bActionsMenuDisabled$ = true;
48
52
 
49
53
  caseSummaryPConn$: any;
50
54
  currentCaseID = '';
@@ -98,10 +102,31 @@ export class CaseViewComponent implements OnInit, OnDestroy {
98
102
  sessionStorage.setItem('okToInitFlowContainer', 'true');
99
103
  } else {
100
104
  this.updateHeaderAndSummary();
105
+ this.updateCaseActions();
101
106
  }
102
107
  }
103
108
  }
104
109
 
110
+ // React re-reads every action source on each render. Here fullUpdate is gated on a case ID
111
+ // change and so runs once, while actions (and a data object's `dataInfo.actions`) arrive
112
+ // later, so they are all refreshed on every store update instead.
113
+ updateCaseActions() {
114
+ const caseInfo = this.pConn$.getDataObject()?.caseInfo ?? {};
115
+ this.arAvailableActions$ = caseInfo.availableActions ?? [];
116
+ this.arAvailabeProcesses$ = caseInfo.availableProcesses ?? [];
117
+ this.editAction = this.arAvailableActions$.find(action => action.ID === 'pyUpdateCaseDetails');
118
+
119
+ const dataInfoActions: DataObjectActions = this.pConn$.getValue('.actions', 'dataInfo') ?? {};
120
+ this.arDataObjectActions$ = dataInfoActions.availableActions ?? [];
121
+ this.arCreateCaseActions$ = dataInfoActions.availableCreateCaseActions ?? [];
122
+
123
+ this.bActionsMenuDisabled$ =
124
+ this.arAvailableActions$.length === 0 &&
125
+ this.arAvailabeProcesses$.length === 0 &&
126
+ this.arDataObjectActions$.length === 0 &&
127
+ this.arCreateCaseActions$.length === 0;
128
+ }
129
+
105
130
  hasCaseIDChanged(): boolean {
106
131
  if (this.currentCaseID !== this.pConn$.getDataObject().caseInfo.ID) {
107
132
  this.currentCaseID = this.pConn$.getDataObject().caseInfo.ID;
@@ -144,9 +169,8 @@ export class CaseViewComponent implements OnInit, OnDestroy {
144
169
 
145
170
  const caseInfo = this.pConn$.getDataObject().caseInfo;
146
171
  this.currentCaseID = caseInfo.ID;
147
- this.arAvailableActions$ = caseInfo?.availableActions ? caseInfo.availableActions : [];
148
- this.editAction = this.arAvailableActions$.find(action => action.ID === 'pyUpdateCaseDetails');
149
- this.arAvailabeProcesses$ = caseInfo?.availableProcesses ? caseInfo.availableProcesses : [];
172
+
173
+ this.updateCaseActions();
150
174
 
151
175
  this.svgCase$ = this.utils.getImageSrc(this.configProps$.icon, this.utils.getSDKStaticContentUrl());
152
176
 
@@ -218,4 +242,29 @@ export class CaseViewComponent implements OnInit, OnDestroy {
218
242
 
219
243
  openProcessAction(data.ID, { ...data });
220
244
  }
245
+
246
+ _menuDataObjectActionClick(action: DataObjectAction) {
247
+ const actionsAPI = this.pConn$.getActionsApi();
248
+ const openDataObjectAction = actionsAPI.openDataObjectAction.bind(actionsAPI);
249
+ const classID = this.pConn$.getValue('.classID', 'dataInfo.content');
250
+ const dataRecord = this.pConn$.getValue('.content', 'dataInfo');
251
+
252
+ openDataObjectAction(classID, dataRecord, action.ID, this.localizedVal(action.name, '', this.localeKey));
253
+ }
254
+
255
+ _menuCreateCaseActionClick(action: CreateCaseAction) {
256
+ const actionsAPI = this.pConn$.getActionsApi();
257
+ const createWork = actionsAPI.createWork.bind(actionsAPI);
258
+ const { field, inputs } = action.targetDataReferenceField ?? {};
259
+ const startingFields: Record<string, any> = {};
260
+
261
+ // The engine expects the linked values nested under the target reference field.
262
+ if (field) {
263
+ inputs?.forEach(input => {
264
+ startingFields[field] = { ...startingFields[field], [input.linkedField]: this.pConn$.getValue(`.${input.linkedField}`, '') };
265
+ });
266
+ }
267
+
268
+ createWork(action.ID, { startingFields });
269
+ }
221
270
  }
@@ -58,6 +58,7 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
58
58
  dataRelationshipContext: any;
59
59
  imagePosition: any;
60
60
  showImageDescription: any;
61
+ private isUpdatingFromDataCallback = false;
61
62
 
62
63
  constructor(
63
64
  private angularPConnect: AngularPConnectService,
@@ -69,7 +70,30 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
69
70
  this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
70
71
  this.children = this.pConn$.getChildren();
71
72
  this.updateSelf();
73
+ }
74
+
75
+ ngOnDestroy(): void {
76
+ if (this.angularPConnectData.unsubscribeFn) {
77
+ this.angularPConnectData.unsubscribeFn();
78
+ }
79
+ }
80
+
81
+ // Callback passed when subscribing to store change
82
+ onStateChange() {
83
+ // Should always check the bridge to see if the component should
84
+ // update itself (re-render)
85
+ const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
86
+
87
+ // ONLY call updateSelf when the component should update
88
+ if (bUpdateSelf) {
89
+ this.updateSelf();
90
+ }
91
+ }
72
92
 
93
+ getData() {
94
+ if (this.isUpdatingFromDataCallback) {
95
+ return;
96
+ }
73
97
  if (
74
98
  this.rawViewMetadata.config?.parameters &&
75
99
  !this.isDDSourceDeferred &&
@@ -94,7 +118,9 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
94
118
  }))
95
119
  .filter(item => item.key); // Filtering out undefined entries
96
120
  this.dropDownDataSource = ddDataSource;
121
+ this.isUpdatingFromDataCallback = true;
97
122
  this.updateSelf();
123
+ this.isUpdatingFromDataCallback = false;
98
124
  } else {
99
125
  const ddDataSource: any = [];
100
126
  this.dropDownDataSource = ddDataSource;
@@ -110,24 +136,6 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
110
136
  }
111
137
  }
112
138
 
113
- ngOnDestroy(): void {
114
- if (this.angularPConnectData.unsubscribeFn) {
115
- this.angularPConnectData.unsubscribeFn();
116
- }
117
- }
118
-
119
- // Callback passed when subscribing to store change
120
- onStateChange() {
121
- // Should always check the bridge to see if the component should
122
- // update itself (re-render)
123
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
124
-
125
- // ONLY call updateSelf when the component should update
126
- if (bUpdateSelf) {
127
- this.updateSelf();
128
- }
129
- }
130
-
131
139
  updateSelf() {
132
140
  // Update properties based on configProps
133
141
  const theConfigProps = this.pConn$.getConfigProps();
@@ -144,8 +152,7 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
144
152
  this.isDisplayModeEnabled = ['DISPLAY_ONLY', 'STACKED_LARGE_VAL'].includes(displayMode);
145
153
  this.refFieldMetadata = this.pConn$.getFieldMetadata(this.rawViewMetadata?.config?.authorContext);
146
154
  this.pyID = getMappedKey('pyID');
147
- // @ts-ignore
148
- const { allowImplicitRefresh } = PCore.getFieldDefaultUtils().fieldDefaults?.DataReference || {};
155
+ const { allowImplicitRefresh } = PCore.getFieldDefaultUtils().fieldDefaults?.['DataReference'] || {};
149
156
 
150
157
  this.allowImplicitRefresh = allowImplicitRefresh;
151
158
  this.isDDSourceDeferred =
@@ -186,6 +193,7 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
186
193
 
187
194
  this.generateChildrenToRender();
188
195
  this.displayChild = !(this.displaySingleRef || this.displayMultiRef);
196
+ this.getData();
189
197
  }
190
198
 
191
199
  updatePropertiesFromProps(theConfigProps) {
@@ -256,7 +264,7 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
256
264
  if (this.pConn$.getContextName().includes('modal') || this.pConn$.getContextName().includes('workarea')) {
257
265
  if (hasAssociatedViewConfigured || this.allowImplicitRefresh) {
258
266
  const pageReference = this.pConn$.getPageReference();
259
- let pgRef: any = null;
267
+ let pgRef: string;
260
268
  if (pageReference.startsWith('objectInfo')) {
261
269
  pgRef = pageReference.replace('objectInfo.content', '');
262
270
  } else {
@@ -389,7 +397,6 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
389
397
  if (['Dropdown', 'Checkbox', 'RadioButtons'].includes(type) && !config.deferDatasource && config.datasource) {
390
398
  const isCardVariant = config.variant === 'card';
391
399
  const hasParameters = this.rawViewMetadata.config?.parameters;
392
- // @ts-ignore
393
400
  const isDeferDataPageCallEnabled = isCardVariant && hasParameters && !this.firstChildPConnect()?.getSharedDataPageForReferenceList();
394
401
 
395
402
  const useDropDownDataSource = (isCardVariant && (this.dropDownDataSource || isDeferDataPageCallEnabled)) || (!isCardVariant && hasParameters);
@@ -1,5 +1,5 @@
1
1
  <div class="search-form" style="display: flex; flex-direction: column">
2
- <h5>{{ propsToUse.label }}</h5>
2
+ <h3>{{ label$ }}</h3>
3
3
  <div *ngIf="searchCategoriesComp === 'dropdown'">
4
4
  <mat-form-field class="psdk-full-width">
5
5
  <mat-select [value]="currentTabId" (selectionChange)="handleTabClick($event.value)">
@@ -37,6 +37,7 @@ export class SearchFormComponent implements OnInit, OnChanges {
37
37
  @Input() pConn$: typeof PConnect;
38
38
  @Input() formGroup$: FormGroup;
39
39
  @Input() searchSelectCacheKey;
40
+ @Input() type: string;
40
41
 
41
42
  configProps$: any;
42
43
  isInitialized = false;
@@ -47,6 +48,7 @@ export class SearchFormComponent implements OnInit, OnChanges {
47
48
  tabItems: any[] = [];
48
49
  searchCategoriesComp: any;
49
50
  propsToUse: any;
51
+ label$: string;
50
52
  tabData: any = [];
51
53
  tabCountSources: any;
52
54
  deferLoadedTabs: any;
@@ -58,7 +60,13 @@ export class SearchFormComponent implements OnInit, OnChanges {
58
60
  this.isInitialized = true;
59
61
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps());
60
62
  this.propsToUse = { ...this.pConn$.getInheritedProps() };
61
- this.deferLoadedTabs = this.pConn$.getChildren()[2];
63
+ this.label$ = this.configProps$?.label || this.propsToUse.label;
64
+ // When called from ObjectReference, pConn$ itself acts as deferLoadedTabs (no children[2])
65
+ if (this.type === 'ObjectReference') {
66
+ this.deferLoadedTabs = { getPConnect: () => this.pConn$ };
67
+ } else {
68
+ this.deferLoadedTabs = this.pConn$.getChildren()[2];
69
+ }
62
70
  const cache: any = PCore.getNavigationUtils().getComponentCache(this.searchSelectCacheKey) ?? {};
63
71
  const { selectedCategory } = cache;
64
72
  const firstTabId = getFirstVisibleTabId(this.deferLoadedTabs, selectedCategory);
@@ -127,7 +127,6 @@ export function getData(deferLoadedTabs, tabCountSources, currentTabId, data) {
127
127
  });
128
128
  } else if (calculatedFieldsWithoutValue.length) {
129
129
  PCore.getViewRuleApi()
130
- // @ts-ignore
131
130
  .getCalculatedFields(
132
131
  pConn.getCaseInfo().getKey(),
133
132
  pConn.getCurrentView(),