@pega/angular-sdk-overrides 25.1.11 → 25.1.13

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 (45) hide show
  1. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +1 -1
  2. package/lib/field/date-time/date-time.component.html +1 -1
  3. package/lib/field/group/group.component.ts +1 -2
  4. package/lib/infra/Containers/flow-container/flow-container.component.html +2 -2
  5. package/lib/infra/Containers/flow-container/flow-container.component.ts +16 -10
  6. package/lib/infra/Containers/flow-container/helpers.ts +1 -1
  7. package/lib/infra/Containers/hybrid-view-container/hybrid-view-container.component.ts +2 -3
  8. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +3 -6
  9. package/lib/infra/Containers/preview-view-container/preview-view-container.component.ts +2 -3
  10. package/lib/infra/Containers/view-container/view-container.component.html +1 -1
  11. package/lib/infra/Containers/view-container/view-container.component.ts +7 -12
  12. package/lib/infra/assignment/assignment.component.ts +3 -8
  13. package/lib/infra/assignment-card/assignment-card.component.html +1 -0
  14. package/lib/infra/assignment-card/assignment-card.component.ts +2 -8
  15. package/lib/infra/defer-load/defer-load.component.ts +3 -5
  16. package/lib/infra/reference/reference.component.html +7 -1
  17. package/lib/infra/reference/reference.component.ts +66 -112
  18. package/lib/infra/region/region.component.ts +1 -3
  19. package/lib/infra/root-container/root-container.component.html +1 -0
  20. package/lib/infra/root-container/root-container.component.ts +4 -8
  21. package/lib/infra/view/view.component.ts +3 -9
  22. package/lib/template/banner-page/banner-page.component.ts +1 -2
  23. package/lib/template/base/form-template-base.ts +0 -2
  24. package/lib/template/case-summary/case-summary.component.ts +0 -6
  25. package/lib/template/case-view/case-view.component.html +1 -1
  26. package/lib/template/data-reference/data-reference.component.ts +27 -18
  27. package/lib/template/default-form/default-form.component.html +1 -1
  28. package/lib/template/default-form/default-form.component.ts +1 -2
  29. package/lib/template/default-page/default-page.component.ts +1 -2
  30. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +1 -0
  31. package/lib/template/field-group-template/field-group-template.component.html +1 -1
  32. package/lib/template/field-group-template/field-group-template.component.scss +1 -0
  33. package/lib/template/field-group-template/field-group-template.component.ts +24 -19
  34. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -10
  35. package/lib/template/list-view/list-view.component.html +2 -2
  36. package/lib/template/multi-reference-readonly/multi-reference-readonly.component.html +1 -1
  37. package/lib/template/multi-reference-readonly/multi-reference-readonly.component.ts +27 -0
  38. package/lib/template/one-column/one-column.component.html +3 -0
  39. package/lib/template/one-column-tab/one-column-tab.component.html +1 -0
  40. package/lib/template/page/page.component.html +1 -0
  41. package/lib/template/simple-table/simple-table.component.ts +5 -1
  42. package/lib/template/simple-table-manual/helpers.ts +1 -1
  43. package/lib/template/simple-table-manual/simple-table-manual.component.ts +13 -5
  44. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +0 -3
  45. package/package.json +1 -1
@@ -5,7 +5,7 @@
5
5
  </div>
6
6
  <ng-template #noGroup>
7
7
  <div *ngIf="field.type === 'reference'; else showDetails">
8
- <component-mapper name="View" [props]="{ pConn$: field.pConn }"></component-mapper>
8
+ <component-mapper name="reference" [props]="{ pConn$: field.pConn }"></component-mapper>
9
9
  </div>
10
10
  </ng-template>
11
11
 
@@ -18,7 +18,7 @@
18
18
  />
19
19
  <mat-datepicker-toggle matSuffix [owlDateTimeTrigger]="dtPicker"></mat-datepicker-toggle>
20
20
  <owl-date-time #dtPicker [disabled]="bDisabled$" [scrollStrategy]="scrollStrategy"></owl-date-time>
21
- <mat-error *ngIf="fieldControl?.invalid">{{ getErrorMessage() }}</mat-error>
21
+ <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
22
22
  </mat-form-field>
23
23
  </div>
24
24
  </div>
@@ -1,7 +1,6 @@
1
1
  import { CommonModule } from '@angular/common';
2
2
  import { Component, forwardRef, Input, OnInit } from '@angular/core';
3
3
  import { FormGroup } from '@angular/forms';
4
- import { ReferenceComponent } from '@pega/angular-sdk-components';
5
4
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
6
5
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
7
6
  import { PConnFieldProps } from '@pega/angular-sdk-components';
@@ -64,7 +63,7 @@ export class GroupComponent implements OnInit {
64
63
  */
65
64
  updateSelf(): void {
66
65
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as GroupProps;
67
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
66
+ this.arChildren$ = this.pConn$.getChildren();
68
67
  this.visibility$ = this.configProps$.visibility;
69
68
  this.showHeading$ = this.configProps$.showHeading;
70
69
  this.heading$ = this.configProps$.heading;
@@ -2,7 +2,7 @@
2
2
  <div *ngIf="!bShowConfirm">
3
3
  <div *ngIf="!todo_showTodo$">
4
4
  <h2 *ngIf="!isMultiStep">{{ containerName$ }}</h2>
5
- <div *ngIf="banners?.length">
5
+ <div *ngIf="banners.length">
6
6
  <component-mapper name="AlertBanner" [props]="{ banners }"></component-mapper>
7
7
  </div>
8
8
  </div>
@@ -39,6 +39,6 @@
39
39
  </mat-card>
40
40
  </div>
41
41
  <div *ngIf="bShowBanner && bShowConfirm && confirm_pconn">
42
- <component-mapper name="View" [props]="{ formGroup$, pConn$: confirm_pconn }"></component-mapper>
42
+ <component-mapper name="reference" [props]="{ formGroup$, pConn$: confirm_pconn }"></component-mapper>
43
43
  </div>
44
44
  </div>
@@ -4,16 +4,14 @@ import { FormBuilder, FormGroup } from '@angular/forms';
4
4
  import { MatCardModule } from '@angular/material/card';
5
5
  import { publicConstants } from '@pega/pcore-pconnect-typedefs/constants';
6
6
  import { ProgressSpinnerService } from '@pega/angular-sdk-components';
7
- import { ReferenceComponent } from '@pega/angular-sdk-components';
8
7
  import { Utils } from '@pega/angular-sdk-components';
9
8
  import { getToDoAssignments, hasAssignments, showBanner } from './helpers';
10
9
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
10
  import { FlowContainerBaseComponent } from '@pega/angular-sdk-components';
12
11
 
13
12
  /**
14
- * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
15
- * Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
16
- * is totally at your own risk.
13
+ * WARNING: This file is part of the infrastructure component responsible for working with Redux and managing the creation and update of Redux containers and PConnect.
14
+ * You may override Material components within this component if needed, but do not modify any container-related logic. Changing this logic can lead to unexpected behavior.
17
15
  */
18
16
 
19
17
  interface FlowContainerProps {
@@ -66,7 +64,7 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
66
64
  localizedVal: any;
67
65
  localeCategory = 'Messages';
68
66
  localeReference: any;
69
- banners: any[];
67
+ banners: any[] = [];
70
68
  // itemKey: string = ""; // JA - this is what Nebula/Constellation uses to pass to finishAssignment, navigateToStep
71
69
 
72
70
  pConnectOfActiveContainerItem;
@@ -281,8 +279,12 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
281
279
 
282
280
  // this.containerName$ = oWorkMeta["name"];
283
281
  if (bLoadChildren && oWorkData) {
284
- this.containerName$ = this.localizedVal(this.getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name, undefined, this.localeReference);
285
- this.isMultiStep = this.utils.getBooleanValue(oWorkData.caseInfo.assignments?.[0].isMultiStep);
282
+ this.containerName$ = this.localizedVal(
283
+ this.getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0]?.name,
284
+ undefined,
285
+ this.localeReference
286
+ );
287
+ this.isMultiStep = this.utils.getBooleanValue(oWorkData.caseInfo.assignments?.[0]?.isMultiStep);
286
288
  }
287
289
 
288
290
  // turn off spinner
@@ -416,7 +418,7 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
416
418
  // let kid = this.pConn$.getChildren()[0];
417
419
 
418
420
  // kid.getPConnect() can be a Reference component. So normalize it just in case
419
- // let todoKid = ReferenceComponent.normalizePConn(kid.getPConnect()).getChildren()[0];
421
+ // let todoKid = kid.getPConnect().getChildren()[0];
420
422
 
421
423
  // this.todo_pConn$ = todoKid.getPConnect();
422
424
 
@@ -529,7 +531,7 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
529
531
  // the View if it is a Reference component. And need to pass in the getPConnect
530
532
  // to have normalize do a c11Env createComponent (that makes sure options.hasForm
531
533
  // is passed along to all the component's children)
532
- const normalizedConfigObject = ReferenceComponent.normalizePConn(configObject.getPConnect());
534
+ const normalizedConfigObject = configObject.getPConnect();
533
535
  // We want the children to be the PConnect itself, not the result of calling getPConnect(),
534
536
  // So need to get the PConnect of the normalized component we just created...
535
537
  const normalizedConfigObjectAsPConnect = normalizedConfigObject.getComponent();
@@ -547,7 +549,11 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
547
549
  const oWorkItem = configObject.getPConnect();
548
550
  const oWorkData: any = oWorkItem.getDataObject();
549
551
 
550
- this.containerName$ = this.localizedVal(this.getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name, undefined, this.localeReference);
552
+ this.containerName$ = this.localizedVal(
553
+ this.getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0]?.name,
554
+ undefined,
555
+ this.localeReference
556
+ );
551
557
  });
552
558
  }
553
559
 
@@ -33,7 +33,7 @@ export function hasAssignments(pConnect) {
33
33
  const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS);
34
34
  const childCasesAssignments = getChildCaseAssignments(pConnect);
35
35
 
36
- return assignments || childCasesAssignments?.length || isCaseWideLocalAction(pConnect);
36
+ return assignments?.length || childCasesAssignments?.length || isCaseWideLocalAction(pConnect);
37
37
  }
38
38
 
39
39
  export const showBanner = getPConnect => {
@@ -3,9 +3,8 @@ import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
4
 
5
5
  /**
6
- * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
7
- * Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
8
- * is totally at your own risk.
6
+ * WARNING: This file is part of the infrastructure component responsible for working with Redux and managing the creation and update of Redux containers and PConnect.
7
+ * You may override Material components within this component if needed, but do not modify any container-related logic. Changing this logic can lead to unexpected behavior.
9
8
  */
10
9
 
11
10
  // Right this is a skeleton, as Hybrid ViewContainer hasn't been implemented
@@ -6,12 +6,10 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
6
6
  import { ProgressSpinnerService } from '@pega/angular-sdk-components';
7
7
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
8
8
  import { getBanners } from '@pega/angular-sdk-components';
9
- import { ReferenceComponent } from '@pega/angular-sdk-components';
10
9
 
11
10
  /**
12
- * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
13
- * Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
14
- * is totally at your own risk.
11
+ * WARNING: This file is part of the infrastructure component responsible for working with Redux and managing the creation and update of Redux containers and PConnect.
12
+ * You may override Material components within this component if needed, but do not modify any container-related logic. Changing this logic can lead to unexpected behavior.
15
13
  */
16
14
 
17
15
  @Component({
@@ -239,8 +237,7 @@ export class ModalViewContainerComponent implements OnInit, OnDestroy {
239
237
  const bIsRefComponent = this.checkIfRefComponent(newComp);
240
238
 
241
239
  if (bIsRefComponent) {
242
- const newPConn = ReferenceComponent.normalizePConn(newComp);
243
- this.arChildren$ = ReferenceComponent.normalizePConnArray(newPConn.getChildren());
240
+ this.arChildren$ = [newComp.getComponent()];
244
241
  } else {
245
242
  // update children with new view's children
246
243
  this.arChildren$ = newComp.getChildren();
@@ -1,9 +1,8 @@
1
1
  import { Component, OnInit, Input } from '@angular/core';
2
2
 
3
3
  /**
4
- * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
5
- * Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
6
- * is totally at your own risk.
4
+ * WARNING: This file is part of the infrastructure component responsible for working with Redux and managing the creation and update of Redux containers and PConnect.
5
+ * You may override Material components within this component if needed, but do not modify any container-related logic. Changing this logic can lead to unexpected behavior.
7
6
  */
8
7
 
9
8
  // Right this is a skeleton, as Preview hasn't been implemented
@@ -26,6 +26,6 @@
26
26
  </ng-template>
27
27
  </div>
28
28
  <ng-template #isReference>
29
- <component-mapper name="View" [props]="{ pConn$: viewPConn$, displayOnlyFA$ }"></component-mapper>
29
+ <component-mapper name="reference" [props]="{ pConn$: viewPConn$, formGroup$, displayOnlyFA$ }"></component-mapper>
30
30
  </ng-template>
31
31
  </div>
@@ -3,14 +3,12 @@ import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
4
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
5
5
  import { ProgressSpinnerService } from '@pega/angular-sdk-components';
6
- import { ReferenceComponent } from '@pega/angular-sdk-components';
7
6
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
8
7
  import { configureBrowserBookmark } from './helper';
9
8
 
10
9
  /**
11
- * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
12
- * Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
13
- * is totally at your own risk.
10
+ * WARNING: This file is part of the infrastructure component responsible for working with Redux and managing the creation and update of Redux containers and PConnect.
11
+ * You may override Material components within this component if needed, but do not modify any container-related logic. Changing this logic can lead to unexpected behavior.
14
12
  */
15
13
 
16
14
  interface ViewContainerProps {
@@ -74,8 +72,7 @@ export class ViewContainerComponent implements OnInit, OnDestroy {
74
72
  // Then, continue on with other initialization
75
73
 
76
74
  // this.configProps$ = this.pConn$.getConfigProps();
77
- // children may have a 'reference' so normalize the children array
78
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
75
+ this.arChildren$ = this.pConn$.getChildren();
79
76
 
80
77
  this.buildName$ = this.buildName();
81
78
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ViewContainerProps;
@@ -147,8 +144,7 @@ export class ViewContainerComponent implements OnInit, OnDestroy {
147
144
  // *** DON'T call updateSelf in ngInit!! ***
148
145
 
149
146
  if (this.arChildren$ == null) {
150
- // children may have a 'reference' so normalize the children array
151
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
147
+ this.arChildren$ = this.pConn$.getChildren();
152
148
  }
153
149
 
154
150
  // routingInfo was added as component prop in populateAdditionalProps
@@ -223,12 +219,12 @@ export class ViewContainerComponent implements OnInit, OnDestroy {
223
219
 
224
220
  /*
225
221
 
226
- const theDereferencedView = ReferenceComponent.normalizePConn(newComp);
222
+ const theDereferencedView = newComp;
227
223
  const newConfigProps = theDereferencedView.getConfigProps();
228
224
 
229
225
  // children may have a 'reference' so normalize the children arra
230
226
 
231
- const theDereferencedViewChildren = ReferenceComponent.normalizePConnArray(theDereferencedView.getChildren());
227
+ const theDereferencedViewChildren = theDereferencedView.getChildren();
232
228
  this.templateName$ = ('template' in newConfigProps) ? newConfigProps["template"] : "";
233
229
  this.title$ = ('title' in newConfigProps) ? newConfigProps["title"] : "";
234
230
  this.arChildren$ = theDereferencedViewChildren;
@@ -245,8 +241,7 @@ export class ViewContainerComponent implements OnInit, OnDestroy {
245
241
  this.templateName$ = newConfigProps.template || '';
246
242
  this.title$ = newConfigProps.title || '';
247
243
  // update children with new view's children
248
- // children may have a 'reference' so normalize the children array
249
- this.arChildren$ = ReferenceComponent.normalizePConnArray(newComp.getChildren());
244
+ this.arChildren$ = newComp.getChildren();
250
245
  }
251
246
  });
252
247
  }
@@ -7,7 +7,6 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
7
7
  import { ErrorMessagesService } from '@pega/angular-sdk-components';
8
8
  import { ProgressSpinnerService } from '@pega/angular-sdk-components';
9
9
  import { BannerService } from '@pega/angular-sdk-components';
10
- import { ReferenceComponent } from '@pega/angular-sdk-components';
11
10
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
12
11
 
13
12
  function getRefreshProps(refreshConditions) {
@@ -149,8 +148,7 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
149
148
 
150
149
  this.registerForRefresh();
151
150
 
152
- // pConn$ may be a 'reference' component, so normalize it
153
- this.newPConn$ = ReferenceComponent.normalizePConn(this.pConn$);
151
+ this.newPConn$ = this.pConn$;
154
152
 
155
153
  if (this.arChildren$) {
156
154
  this.createButtons();
@@ -158,9 +156,7 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
158
156
  }
159
157
 
160
158
  initComponent() {
161
- // pConn$ may be a 'reference' component, so normalize it
162
- // this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$);
163
- this.newPConn$ = ReferenceComponent.normalizePConn(this.pConn$);
159
+ this.newPConn$ = this.pConn$;
164
160
 
165
161
  // prevent re-intializing with flowContainer update unless an action is taken
166
162
  this.bReInit = false;
@@ -203,7 +199,6 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
203
199
  this.cancelCreateStageAssignment = actionsAPI.cancelCreateStageAssignment.bind(actionsAPI);
204
200
  this.approveCase = actionsAPI.approveCase?.bind(actionsAPI);
205
201
  this.rejectCase = actionsAPI.rejectCase?.bind(actionsAPI);
206
-
207
202
  if (this.arChildren$) {
208
203
  this.createButtons();
209
204
  }
@@ -225,7 +220,7 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
225
220
  // this.containerName$ = oWorkMeta["name"];
226
221
 
227
222
  if (oWorkData.caseInfo && oWorkData.caseInfo.assignments !== null) {
228
- this.containerName$ = oWorkData.caseInfo.assignments?.[0].name;
223
+ this.containerName$ = oWorkData.caseInfo.assignments?.[0]?.name;
229
224
 
230
225
  // get caseInfo
231
226
  const oCaseInfo = oData.caseInfo;
@@ -2,6 +2,7 @@
2
2
  <div *ngFor="let kid of childrenArray" class="psdk-assignment-card-child">
3
3
  <div [ngSwitch]="kid.getPConnect().getComponentName()">
4
4
  <component-mapper *ngSwitchCase="'View'" name="View" [props]="{ formGroup$, pConn$: kid.getPConnect() }"></component-mapper>
5
+ <component-mapper *ngSwitchCase="'reference'" name="reference" [props]="{ formGroup$, pConn$: kid.getPConnect() }"></component-mapper>
5
6
  <component-mapper
6
7
  *ngSwitchCase="'CaseCreateStage'"
7
8
  name="CaseCreateStage"
@@ -1,7 +1,6 @@
1
1
  import { Component, OnInit, Input, Output, EventEmitter, forwardRef, OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup, ReactiveFormsModule } from '@angular/forms';
4
- import { ReferenceComponent } from '@pega/angular-sdk-components';
5
4
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
6
5
 
7
6
  function isChildrenUpdated(children) {
@@ -34,18 +33,13 @@ export class AssignmentCardComponent implements OnInit, OnChanges {
34
33
  @Output() actionButtonClick: EventEmitter<any> = new EventEmitter();
35
34
 
36
35
  ngOnInit(): void {
37
- // Children may contain 'reference' component, so we need to
38
- // normalize them
39
- this.childrenArray = ReferenceComponent.normalizePConnArray(this.arChildren$);
36
+ this.childrenArray = this.arChildren$;
40
37
  }
41
38
 
42
39
  ngOnChanges(changes: SimpleChanges) {
43
- // Children may contain 'reference' component, so we need to
44
- // normalize them
45
-
46
40
  const { arChildren$ } = changes;
47
41
  if (isChildrenUpdated(arChildren$)) {
48
- this.childrenArray = ReferenceComponent.normalizePConnArray(this.arChildren$);
42
+ this.childrenArray = this.arChildren$;
49
43
  }
50
44
  }
51
45
 
@@ -1,14 +1,12 @@
1
1
  import { Component, OnInit, Input, forwardRef, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { publicConstants } from '@pega/pcore-pconnect-typedefs/constants';
4
- import { ReferenceComponent } from '@pega/angular-sdk-components';
5
4
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
6
5
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
7
6
 
8
7
  /**
9
- * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
10
- * Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
11
- * is totally at your own risk.
8
+ * WARNING: This file is part of the infrastructure component responsible for working with Redux and managing the creation and update of Redux containers and PConnect.
9
+ * You may override Material components within this component if needed, but do not modify any container-related logic. Changing this logic can lead to unexpected behavior.
12
10
  */
13
11
 
14
12
  @Component({
@@ -128,7 +126,7 @@ export class DeferLoadComponent implements OnInit, OnDestroy, OnChanges {
128
126
  const configObject = PCore.createPConnect(config);
129
127
  configObject.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
130
128
 
131
- this.childComponentPConnect = ReferenceComponent.normalizePConn(configObject.getPConnect());
129
+ this.childComponentPConnect = configObject.getPConnect();
132
130
 
133
131
  if (this.deferLoadId) {
134
132
  PCore.getDeferLoadManager().stop(this.deferLoadId, this.pConn$.getContextName());
@@ -1 +1,7 @@
1
- <!-- Reference component is all static methods so .html not used -->
1
+ <div *ngIf="viewComponentPConnect">
2
+ <component-mapper
3
+ [name]="viewComponentPConnect.getComponentName()"
4
+ [props]="{ pConn$: viewComponentPConnect, formGroup$ }"
5
+ errorMsg="Reference Missing: {{ viewComponentPConnect.getComponentName() }}"
6
+ ></component-mapper>
7
+ </div>
@@ -1,54 +1,85 @@
1
- import { Component } from '@angular/core';
1
+ import { Component, OnInit, Input, forwardRef, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
4
+ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
2
5
 
3
6
  /**
4
- * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
5
- * Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
6
- * is totally at your own risk.
7
+ * WARNING: This file is part of the infrastructure component responsible for working with Redux and managing the creation and update of Redux containers and PConnect.
8
+ * You may override Material components within this component if needed, but do not modify any container-related logic. Changing this logic can lead to unexpected behavior.
7
9
  */
8
10
 
9
11
  @Component({
10
12
  selector: 'app-reference',
11
13
  templateUrl: './reference.component.html',
12
14
  styleUrls: ['./reference.component.scss'],
13
- standalone: true
15
+ imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
14
16
  })
15
- export class ReferenceComponent {
16
- /* Used to toggle some class-wide logging */
17
- private static bLogging = false;
18
-
19
- /**
20
- * Creates a normalized PConn from a reference component.
21
- * Resolves the reference to its fully realized View with proper configuration.
22
- *
23
- * @param inPConn - The PConn object that represents a reference component
24
- * @returns The dereferenced PConnect object, or null if reference can't be resolved
25
- */
26
- static createFullReferencedViewFromRef(inPConn: any): any {
27
- // Validate that inPConn is a reference component
28
- if (inPConn.getComponentName() !== 'reference') {
29
- console.error(`Reference component: createFullReferencedViewFromRef inPConn is NOT a reference! ${inPConn.getComponentName()}`);
30
- return null;
17
+ export class ReferenceComponent implements OnInit, OnDestroy, OnChanges {
18
+ @Input() pConn$: typeof PConnect;
19
+ @Input() formGroup$: any;
20
+
21
+ angularPConnectData: AngularPConnectData = {};
22
+ viewComponentPConnect: typeof PConnect | null = null;
23
+
24
+ constructor(private angularPConnect: AngularPConnectService) {}
25
+
26
+ ngOnInit(): void {
27
+ this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
28
+ this.updateSelf();
29
+ }
30
+
31
+ ngOnDestroy(): void {
32
+ if (this.angularPConnectData.unsubscribeFn) {
33
+ this.angularPConnectData.unsubscribeFn();
34
+ }
35
+ }
36
+
37
+ ngOnChanges(changes: SimpleChanges) {
38
+ const { pConn$ } = changes;
39
+ if (!pConn$.firstChange && pConn$.previousValue !== pConn$.currentValue) {
40
+ this.checkAndUpdate();
41
+ }
42
+ }
43
+
44
+ onStateChange() {
45
+ this.checkAndUpdate();
46
+ }
47
+
48
+ // Should always check the bridge to see if the component should update itself (re-render)
49
+ checkAndUpdate() {
50
+ const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
51
+
52
+ // ONLY call updateSelf when the component should update
53
+ if (bUpdateSelf) {
54
+ this.updateSelf();
31
55
  }
56
+ }
32
57
 
33
- // Get reference configuration and make a copy
34
- const referenceConfig = { ...inPConn.getComponentConfig() };
58
+ updateSelf() {
59
+ const pConnect = this.pConn$;
60
+
61
+ const resolvedConfigProps = pConnect.resolveConfigProps(pConnect.getConfigProps()) as {
62
+ visibility?: boolean;
63
+ context?: string;
64
+ readOnly?: boolean;
65
+ displayMode?: string;
66
+ };
67
+
68
+ const { visibility = true, context = '', readOnly = false, displayMode = '' } = resolvedConfigProps;
69
+
70
+ const referenceConfig = { ...pConnect.getComponentConfig() };
35
71
 
36
- // Remove properties that should not be inherited by the referenced view
37
- // (Maintained from React SDK implementation)
38
72
  delete referenceConfig?.name;
39
73
  delete referenceConfig?.type;
40
74
  delete referenceConfig?.visibility;
41
75
 
42
- // Get the metadata for the referenced view
43
- const viewMetadata = inPConn.getReferencedView();
76
+ const viewMetadata: any = pConnect.getReferencedView();
44
77
 
45
- // Return null if view metadata is not found
46
78
  if (!viewMetadata) {
47
- console.log('View not found ', inPConn.getComponentConfig());
48
- return null;
79
+ this.viewComponentPConnect = null;
80
+ return;
49
81
  }
50
82
 
51
- // Create the view object by merging metadata with reference config
52
83
  const viewObject = {
53
84
  ...viewMetadata,
54
85
  config: {
@@ -57,101 +88,24 @@ export class ReferenceComponent {
57
88
  }
58
89
  };
59
90
 
60
- // Resolve configuration properties
61
- const resolvedConfigProps = inPConn.resolveConfigProps(inPConn.getConfigProps());
62
- const { visibility = true, context, readOnly = false, displayMode = '' } = resolvedConfigProps;
63
-
64
- // Log debug information if logging is enabled
65
- if (ReferenceComponent.bLogging) {
66
- console.log(`Reference: about to call createComponent with pageReference: context: ${inPConn.getContextName()}`);
67
- }
68
-
69
- // Create the component with the right context
70
- const viewComponent = inPConn.createComponent(viewObject, null, null, {
91
+ // @ts-expect-error - createComponent expects string but null is passed for unused parameters (matches React SDK pattern)
92
+ const viewComponent: any = pConnect.createComponent(viewObject, null, null, {
71
93
  pageReference: context && context.startsWith('@CLASS') ? '' : context
72
94
  });
73
95
 
74
96
  if (referenceConfig.inheritedProps && referenceConfig.inheritedProps.length > 0) {
75
- const inheritedProps = inPConn.getInheritedProps();
97
+ const inheritedProps = pConnect.getInheritedProps();
76
98
  referenceConfig.inheritedProps = Object.keys(inheritedProps).map(prop => ({ prop, value: inheritedProps[prop] }));
77
99
  }
78
100
 
79
- // Get the PConnect object from the created component
80
101
  const newCompPConnect = viewComponent.getPConnect();
81
102
 
82
- // Set inherited configuration on the new component
83
103
  newCompPConnect.setInheritedConfig({
84
104
  ...referenceConfig,
85
105
  readOnly,
86
106
  displayMode
87
107
  });
88
108
 
89
- // Log debug information if logging is enabled
90
- if (ReferenceComponent.bLogging) {
91
- console.log(
92
- `Angular Reference component: createFullReferencedViewFromRef -> newCompPConnect configProps: ${JSON.stringify(
93
- newCompPConnect.getConfigProps()
94
- )}`
95
- );
96
- }
97
-
98
- // Return the component if it should be visible, otherwise null
99
- return visibility !== false ? newCompPConnect : null;
100
- }
101
-
102
- /**
103
- * Normalizes a PConn object that might be a 'reference'.
104
- * If the incoming PConn is a reference, returns its dereferenced View.
105
- * Otherwise, returns the passed in PConn unchanged.
106
- *
107
- * @param inPConn - A PConn object (ex: { getPConnect() } or direct PConnect)
108
- * @returns The normalized PConn object with references resolved
109
- */
110
- static normalizePConn(inPConn: any): any {
111
- // Early return for null or undefined input
112
- if (!inPConn) {
113
- return inPConn;
114
- }
115
-
116
- // Determine if we have an object with getPConnect method or direct PConnect
117
- const hasGetPConnectMethod = !!inPConn.getPConnect;
118
-
119
- // Get the component name in the appropriate way based on the object type
120
- const componentName = hasGetPConnectMethod ? inPConn.getPConnect().getComponentName() : inPConn.getComponentName();
121
-
122
- // Only process if this is a reference component
123
- if (componentName === 'reference') {
124
- if (hasGetPConnectMethod) {
125
- // For objects with getPConnect method, get the referenced view and its component
126
- const refViewPConn = this.createFullReferencedViewFromRef(inPConn.getPConnect());
127
- return refViewPConn?.getComponent();
128
- }
129
-
130
- // For direct PConnect objects, just create the referenced view
131
- return this.createFullReferencedViewFromRef(inPConn);
132
- }
133
-
134
- // Not a reference component, return unchanged
135
- return inPConn;
136
- }
137
-
138
- /**
139
- * Normalizes an array of PConn objects by replacing any 'reference' components
140
- * with their referenced views.
141
- *
142
- * @param inPConnArray - Array of PConn objects to normalize
143
- * @returns Normalized array with references resolved, or empty array if input is invalid
144
- */
145
- static normalizePConnArray(inPConnArray: any[]): any[] {
146
- // Handle null, undefined, or empty array case
147
- if (!inPConnArray?.length) {
148
- return inPConnArray || [];
149
- }
150
-
151
- // Process array: normalize each item and filter out any null/undefined results
152
- const normalizedArray = inPConnArray.map(child => ReferenceComponent.normalizePConn(child)).filter(Boolean);
153
-
154
- // Ensure we always return an array (even if filter removes all items)
155
- return normalizedArray || [];
109
+ this.viewComponentPConnect = visibility !== false ? newCompPConnect : null;
156
110
  }
157
111
  }
@@ -1,7 +1,6 @@
1
1
  import { Component, OnInit, Input, forwardRef, OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
- import { ReferenceComponent } from '@pega/angular-sdk-components';
5
4
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
6
5
 
7
6
  @Component({
@@ -30,7 +29,6 @@ export class RegionComponent implements OnInit, OnChanges {
30
29
  }
31
30
 
32
31
  updateSelf() {
33
- // The children may contain 'reference' components, so normalize the children...
34
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
32
+ this.arChildren$ = this.pConn$.getChildren();
35
33
  }
36
34
  }
@@ -10,6 +10,7 @@
10
10
  name="ViewContainer"
11
11
  [props]="{ pConn$: viewContainerPConn$, displayOnlyFA$ }"
12
12
  ></component-mapper>
13
+ <component-mapper *ngSwitchCase="'reference'" name="reference" [props]="{ pConn$ }"></component-mapper>
13
14
  <div *ngSwitchDefault>{{ localizedVal('RootContainer Missing: ' + componentName$, localeCategory) }}.</div>
14
15
  </div>
15
16
  </div>