@pega/angular-sdk-overrides 0.25.13 → 0.26.1

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 (55) hide show
  1. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +14 -2
  2. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +25 -1
  3. package/lib/field/check-box/check-box.component.html +1 -1
  4. package/lib/field/embedded-data-multi/embedded-data-multi.component.html +3 -0
  5. package/lib/field/embedded-data-multi/embedded-data-multi.component.scss +0 -0
  6. package/lib/field/embedded-data-multi/embedded-data-multi.component.ts +173 -0
  7. package/lib/field/group/group.component.ts +15 -4
  8. package/lib/field/multiselect/multiselect.component.ts +22 -3
  9. package/lib/field/multiselect/utils.ts +5 -3
  10. package/lib/field/object-reference/object-reference.component.html +30 -15
  11. package/lib/field/object-reference/object-reference.component.ts +816 -94
  12. package/lib/field/selectable-card/selectable-card.component.html +1 -0
  13. package/lib/field/selectable-card/selectable-card.component.ts +31 -16
  14. package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
  15. package/lib/infra/Containers/flow-container/flow-container.component.ts +2 -3
  16. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +1 -3
  17. package/lib/infra/Containers/view-container/view-container.component.html +1 -1
  18. package/lib/infra/Containers/view-container/view-container.component.ts +5 -9
  19. package/lib/infra/assignment/assignment.component.ts +2 -7
  20. package/lib/infra/assignment-card/assignment-card.component.html +1 -0
  21. package/lib/infra/assignment-card/assignment-card.component.ts +2 -8
  22. package/lib/infra/defer-load/defer-load.component.ts +1 -2
  23. package/lib/infra/reference/reference.component.html +7 -1
  24. package/lib/infra/reference/reference.component.ts +64 -109
  25. package/lib/infra/region/region.component.ts +1 -3
  26. package/lib/infra/root-container/root-container.component.html +1 -0
  27. package/lib/infra/root-container/root-container.component.ts +2 -5
  28. package/lib/infra/view/view.component.ts +5 -8
  29. package/lib/template/banner-page/banner-page.component.ts +1 -2
  30. package/lib/template/base/details-template-base.ts +45 -0
  31. package/lib/template/base/form-template-base.ts +0 -2
  32. package/lib/template/case-summary/case-summary.component.ts +0 -6
  33. package/lib/template/case-view/case-view.component.html +1 -1
  34. package/lib/template/data-reference/search-form/search-form.component.ts +7 -1
  35. package/lib/template/default-form/default-form.component.html +1 -1
  36. package/lib/template/default-form/default-form.component.ts +1 -2
  37. package/lib/template/default-page/default-page.component.ts +1 -2
  38. package/lib/template/details/details.component.ts +1 -39
  39. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +2 -4
  40. package/lib/template/details-one-column/details-one-column.component.ts +1 -3
  41. package/lib/template/details-three-column/details-three-column.component.ts +3 -5
  42. package/lib/template/details-two-column/details-two-column.component.ts +2 -4
  43. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +2 -4
  44. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +1 -0
  45. package/lib/template/field-group-template/field-group-template.component.ts +18 -4
  46. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -10
  47. package/lib/template/one-column/one-column.component.html +3 -0
  48. package/lib/template/one-column-tab/one-column-tab.component.html +1 -0
  49. package/lib/template/page/page.component.html +1 -0
  50. package/lib/template/simple-table/simple-table.component.ts +11 -1
  51. package/lib/template/simple-table-manual/helpers.ts +2 -2
  52. package/lib/template/simple-table-manual/simple-table-manual.component.scss +4 -2
  53. package/lib/template/simple-table-manual/simple-table-manual.component.ts +27 -19
  54. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +0 -3
  55. package/package.json +1 -1
@@ -17,6 +17,7 @@
17
17
  [checked]="cardContent.commonCardProps.selected"
18
18
  [disabled]="disabled || readOnly"
19
19
  [attr.data-test-id]="testId + ':' + cardContent.commonCardProps.label"
20
+ (click)="$event.stopPropagation()"
20
21
  (change)="handleChangeMultiMode($event, cardContent.commonCardProps)"
21
22
  (blur)="fieldOnBlur()"
22
23
  >{{ cardContent.commonCardProps.label }}</mat-checkbox
@@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
3
3
  import { MatCardModule } from '@angular/material/card';
4
4
  import { MatRadioModule } from '@angular/material/radio';
5
5
  import { MatCheckboxModule } from '@angular/material/checkbox';
6
- import { deleteInstruction, insertInstruction } from '@pega/angular-sdk-components';
6
+ import { deleteInstruction, insertInstruction, updateNewInstructions } from '@pega/angular-sdk-components';
7
7
  import { handleEvent } from '@pega/angular-sdk-components';
8
8
  import { PConnFieldProps } from '@pega/angular-sdk-components';
9
9
  import { FieldBase } from '@pega/angular-sdk-components';
@@ -93,21 +93,9 @@ export class SelectableCardComponent extends FieldBase implements OnInit {
93
93
  const imagePosition = this.configProps$.imagePosition;
94
94
 
95
95
  // dynamic styling based on image position and readOnly option
96
- let imageWidth = '100%';
97
- this.cardStyle = { display: 'flex', flexDirection: 'column', height: '100%' };
98
- if (imagePosition && imagePosition !== 'block-start') {
99
- imageWidth = '30%';
100
- if (imagePosition === 'inline-start') {
101
- this.cardStyle = { display: 'flex', flexDirection: 'row', alignItems: this.readOnly ? 'center' : '' };
102
- } else if (imagePosition === 'inline-end') {
103
- this.cardStyle = {
104
- display: 'flex',
105
- flexDirection: 'row-reverse',
106
- justifyContent: this.readOnly ? 'space-between' : '',
107
- alignItems: this.readOnly ? 'center' : ''
108
- };
109
- }
110
- }
96
+ const { imageWidth, cardStyle } = this.resolveImageLayout(imagePosition);
97
+ this.cardStyle = cardStyle;
98
+
111
99
  if (this.type === 'radio') {
112
100
  const stateProps = this.pConn$.getStateProps();
113
101
  image = {
@@ -145,6 +133,12 @@ export class SelectableCardComponent extends FieldBase implements OnInit {
145
133
  this.selectedvalues = this.configProps$.readonlyContextList;
146
134
  this.showNoValue = this.readOnly && this.selectedvalues?.length === 0; // not used
147
135
  this.primaryField = this.configProps$.primaryField;
136
+
137
+ // Set reference list so getListActions() uses the correct path on every re-render
138
+ if (this.selectionList && !this.readOnly) {
139
+ this.pConn$.setReferenceList(this.selectionList);
140
+ updateNewInstructions(this.pConn$, this.selectionList);
141
+ }
148
142
  }
149
143
 
150
144
  this.commonProps = { hideFieldLabels, datasource, additionalProps, image, recordKey, cardLabel, radioBtnValue: this.radioBtnValue ?? '' };
@@ -182,6 +176,27 @@ export class SelectableCardComponent extends FieldBase implements OnInit {
182
176
  });
183
177
  }
184
178
 
179
+ private resolveImageLayout(imagePosition: string | undefined): { imageWidth: string; cardStyle: object } {
180
+ if (!imagePosition || imagePosition === 'block-start') {
181
+ return { imageWidth: '100%', cardStyle: { display: 'flex', flexDirection: 'column', height: '100%' } };
182
+ }
183
+ if (imagePosition === 'inline-start') {
184
+ return { imageWidth: '30%', cardStyle: { display: 'flex', flexDirection: 'row', alignItems: this.readOnly ? 'center' : '' } };
185
+ }
186
+ if (imagePosition === 'inline-end') {
187
+ return {
188
+ imageWidth: '30%',
189
+ cardStyle: {
190
+ display: 'flex',
191
+ flexDirection: 'row-reverse',
192
+ justifyContent: this.readOnly ? 'space-between' : '',
193
+ alignItems: this.readOnly ? 'center' : ''
194
+ }
195
+ };
196
+ }
197
+ return { imageWidth: '30%', cardStyle: { display: 'flex', flexDirection: 'column', height: '100%' } };
198
+ }
199
+
185
200
  fieldOnChange(value: any) {
186
201
  handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
187
202
  }
@@ -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,7 +4,6 @@ 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';
@@ -415,7 +414,7 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
415
414
  // let kid = this.pConn$.getChildren()[0];
416
415
 
417
416
  // kid.getPConnect() can be a Reference component. So normalize it just in case
418
- // let todoKid = ReferenceComponent.normalizePConn(kid.getPConnect()).getChildren()[0];
417
+ // let todoKid = kid.getPConnect().getChildren()[0];
419
418
 
420
419
  // this.todo_pConn$ = todoKid.getPConnect();
421
420
 
@@ -528,7 +527,7 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
528
527
  // the View if it is a Reference component. And need to pass in the getPConnect
529
528
  // to have normalize do a c11Env createComponent (that makes sure options.hasForm
530
529
  // is passed along to all the component's children)
531
- const normalizedConfigObject = ReferenceComponent.normalizePConn(configObject.getPConnect());
530
+ const normalizedConfigObject = configObject.getPConnect();
532
531
  // We want the children to be the PConnect itself, not the result of calling getPConnect(),
533
532
  // So need to get the PConnect of the normalized component we just created...
534
533
  const normalizedConfigObjectAsPConnect = normalizedConfigObject.getComponent();
@@ -6,7 +6,6 @@ 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
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.
@@ -238,8 +237,7 @@ export class ModalViewContainerComponent implements OnInit, OnDestroy {
238
237
  const bIsRefComponent = this.checkIfRefComponent(newComp);
239
238
 
240
239
  if (bIsRefComponent) {
241
- const newPConn = ReferenceComponent.normalizePConn(newComp);
242
- this.arChildren$ = ReferenceComponent.normalizePConnArray(newPConn.getChildren());
240
+ this.arChildren$ = [newComp.getComponent()];
243
241
  } else {
244
242
  // update children with new view's children
245
243
  this.arChildren$ = newComp.getChildren();
@@ -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,7 +3,6 @@ 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
 
@@ -73,8 +72,7 @@ export class ViewContainerComponent implements OnInit, OnDestroy {
73
72
  // Then, continue on with other initialization
74
73
 
75
74
  // this.configProps$ = this.pConn$.getConfigProps();
76
- // children may have a 'reference' so normalize the children array
77
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
75
+ this.arChildren$ = this.pConn$.getChildren();
78
76
 
79
77
  this.buildName$ = this.buildName();
80
78
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ViewContainerProps;
@@ -146,8 +144,7 @@ export class ViewContainerComponent implements OnInit, OnDestroy {
146
144
  // *** DON'T call updateSelf in ngInit!! ***
147
145
 
148
146
  if (this.arChildren$ == null) {
149
- // children may have a 'reference' so normalize the children array
150
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
147
+ this.arChildren$ = this.pConn$.getChildren();
151
148
  }
152
149
 
153
150
  // routingInfo was added as component prop in populateAdditionalProps
@@ -222,12 +219,12 @@ export class ViewContainerComponent implements OnInit, OnDestroy {
222
219
 
223
220
  /*
224
221
 
225
- const theDereferencedView = ReferenceComponent.normalizePConn(newComp);
222
+ const theDereferencedView = newComp;
226
223
  const newConfigProps = theDereferencedView.getConfigProps();
227
224
 
228
225
  // children may have a 'reference' so normalize the children arra
229
226
 
230
- const theDereferencedViewChildren = ReferenceComponent.normalizePConnArray(theDereferencedView.getChildren());
227
+ const theDereferencedViewChildren = theDereferencedView.getChildren();
231
228
  this.templateName$ = ('template' in newConfigProps) ? newConfigProps["template"] : "";
232
229
  this.title$ = ('title' in newConfigProps) ? newConfigProps["title"] : "";
233
230
  this.arChildren$ = theDereferencedViewChildren;
@@ -244,8 +241,7 @@ export class ViewContainerComponent implements OnInit, OnDestroy {
244
241
  this.templateName$ = newConfigProps.template || '';
245
242
  this.title$ = newConfigProps.title || '';
246
243
  // update children with new view's children
247
- // children may have a 'reference' so normalize the children array
248
- this.arChildren$ = ReferenceComponent.normalizePConnArray(newComp.getChildren());
244
+ this.arChildren$ = newComp.getChildren();
249
245
  }
250
246
  });
251
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
  }
@@ -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,7 +1,6 @@
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
 
@@ -127,7 +126,7 @@ export class DeferLoadComponent implements OnInit, OnDestroy, OnChanges {
127
126
  const configObject = PCore.createPConnect(config);
128
127
  configObject.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
129
128
 
130
- this.childComponentPConnect = ReferenceComponent.normalizePConn(configObject.getPConnect());
129
+ this.childComponentPConnect = configObject.getPConnect();
131
130
 
132
131
  if (this.deferLoadId) {
133
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,4 +1,7 @@
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
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.
@@ -9,45 +12,74 @@ import { Component } from '@angular/core';
9
12
  selector: 'app-reference',
10
13
  templateUrl: './reference.component.html',
11
14
  styleUrls: ['./reference.component.scss'],
12
- standalone: true
15
+ imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
13
16
  })
14
- export class ReferenceComponent {
15
- /* Used to toggle some class-wide logging */
16
- private static bLogging = false;
17
-
18
- /**
19
- * Creates a normalized PConn from a reference component.
20
- * Resolves the reference to its fully realized View with proper configuration.
21
- *
22
- * @param inPConn - The PConn object that represents a reference component
23
- * @returns The dereferenced PConnect object, or null if reference can't be resolved
24
- */
25
- static createFullReferencedViewFromRef(inPConn: any): any {
26
- // Validate that inPConn is a reference component
27
- if (inPConn.getComponentName() !== 'reference') {
28
- console.error(`Reference component: createFullReferencedViewFromRef inPConn is NOT a reference! ${inPConn.getComponentName()}`);
29
- 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();
30
55
  }
56
+ }
31
57
 
32
- // Get reference configuration and make a copy
33
- 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() };
34
71
 
35
- // Remove properties that should not be inherited by the referenced view
36
- // (Maintained from React SDK implementation)
37
72
  delete referenceConfig?.name;
38
73
  delete referenceConfig?.type;
39
74
  delete referenceConfig?.visibility;
40
75
 
41
- // Get the metadata for the referenced view
42
- const viewMetadata = inPConn.getReferencedView();
76
+ const viewMetadata: any = pConnect.getReferencedView();
43
77
 
44
- // Return null if view metadata is not found
45
78
  if (!viewMetadata) {
46
- console.log('View not found ', inPConn.getComponentConfig());
47
- return null;
79
+ this.viewComponentPConnect = null;
80
+ return;
48
81
  }
49
82
 
50
- // Create the view object by merging metadata with reference config
51
83
  const viewObject = {
52
84
  ...viewMetadata,
53
85
  config: {
@@ -56,101 +88,24 @@ export class ReferenceComponent {
56
88
  }
57
89
  };
58
90
 
59
- // Resolve configuration properties
60
- const resolvedConfigProps = inPConn.resolveConfigProps(inPConn.getConfigProps());
61
- const { visibility = true, context, readOnly = false, displayMode = '' } = resolvedConfigProps;
62
-
63
- // Log debug information if logging is enabled
64
- if (ReferenceComponent.bLogging) {
65
- console.log(`Reference: about to call createComponent with pageReference: context: ${inPConn.getContextName()}`);
66
- }
67
-
68
- // Create the component with the right context
69
- 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, {
70
93
  pageReference: context && context.startsWith('@CLASS') ? '' : context
71
94
  });
72
95
 
73
96
  if (referenceConfig.inheritedProps && referenceConfig.inheritedProps.length > 0) {
74
- const inheritedProps = inPConn.getInheritedProps();
97
+ const inheritedProps = pConnect.getInheritedProps();
75
98
  referenceConfig.inheritedProps = Object.keys(inheritedProps).map(prop => ({ prop, value: inheritedProps[prop] }));
76
99
  }
77
100
 
78
- // Get the PConnect object from the created component
79
101
  const newCompPConnect = viewComponent.getPConnect();
80
102
 
81
- // Set inherited configuration on the new component
82
103
  newCompPConnect.setInheritedConfig({
83
104
  ...referenceConfig,
84
105
  readOnly,
85
106
  displayMode
86
107
  });
87
108
 
88
- // Log debug information if logging is enabled
89
- if (ReferenceComponent.bLogging) {
90
- console.log(
91
- `Angular Reference component: createFullReferencedViewFromRef -> newCompPConnect configProps: ${JSON.stringify(
92
- newCompPConnect.getConfigProps()
93
- )}`
94
- );
95
- }
96
-
97
- // Return the component if it should be visible, otherwise null
98
- return visibility !== false ? newCompPConnect : null;
99
- }
100
-
101
- /**
102
- * Normalizes a PConn object that might be a 'reference'.
103
- * If the incoming PConn is a reference, returns its dereferenced View.
104
- * Otherwise, returns the passed in PConn unchanged.
105
- *
106
- * @param inPConn - A PConn object (ex: { getPConnect() } or direct PConnect)
107
- * @returns The normalized PConn object with references resolved
108
- */
109
- static normalizePConn(inPConn: any): any {
110
- // Early return for null or undefined input
111
- if (!inPConn) {
112
- return inPConn;
113
- }
114
-
115
- // Determine if we have an object with getPConnect method or direct PConnect
116
- const hasGetPConnectMethod = !!inPConn.getPConnect;
117
-
118
- // Get the component name in the appropriate way based on the object type
119
- const componentName = hasGetPConnectMethod ? inPConn.getPConnect().getComponentName() : inPConn.getComponentName();
120
-
121
- // Only process if this is a reference component
122
- if (componentName === 'reference') {
123
- if (hasGetPConnectMethod) {
124
- // For objects with getPConnect method, get the referenced view and its component
125
- const refViewPConn = this.createFullReferencedViewFromRef(inPConn.getPConnect());
126
- return refViewPConn?.getComponent();
127
- }
128
-
129
- // For direct PConnect objects, just create the referenced view
130
- return this.createFullReferencedViewFromRef(inPConn);
131
- }
132
-
133
- // Not a reference component, return unchanged
134
- return inPConn;
135
- }
136
-
137
- /**
138
- * Normalizes an array of PConn objects by replacing any 'reference' components
139
- * with their referenced views.
140
- *
141
- * @param inPConnArray - Array of PConn objects to normalize
142
- * @returns Normalized array with references resolved, or empty array if input is invalid
143
- */
144
- static normalizePConnArray(inPConnArray: any[]): any[] {
145
- // Handle null, undefined, or empty array case
146
- if (!inPConnArray?.length) {
147
- return inPConnArray || [];
148
- }
149
-
150
- // Process array: normalize each item and filter out any null/undefined results
151
- const normalizedArray = inPConnArray.map(child => ReferenceComponent.normalizePConn(child)).filter(Boolean);
152
-
153
- // Ensure we always return an array (even if filter removes all items)
154
- return normalizedArray || [];
109
+ this.viewComponentPConnect = visibility !== false ? newCompPConnect : null;
155
110
  }
156
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>
@@ -5,7 +5,6 @@ import { interval, Subscription } from 'rxjs';
5
5
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
6
6
  import { ServerConfigService } from '@pega/angular-sdk-components';
7
7
  import { ProgressSpinnerService } from '@pega/angular-sdk-components';
8
- import { ReferenceComponent } from '@pega/angular-sdk-components';
9
8
  import { PreviewViewContainerComponent } from '@pega/angular-sdk-components';
10
9
  import { ModalViewContainerComponent } from '@pega/angular-sdk-components';
11
10
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
@@ -39,7 +38,7 @@ export class RootContainerComponent implements OnInit, OnDestroy {
39
38
  // For interaction with AngularPConnect
40
39
  angularPConnectData: AngularPConnectData = {};
41
40
 
42
- componentName$ = '';
41
+ componentName$: any;
43
42
  bIsProgress$ = false;
44
43
 
45
44
  // preview and modalview pConn
@@ -140,9 +139,7 @@ export class RootContainerComponent implements OnInit, OnDestroy {
140
139
  setTimeout(() => {
141
140
  // makes sure Angular tracks these changes
142
141
  this.ngZone.run(() => {
143
- // the new rootObject may be a 'reference'. So,
144
- // normalize it to get the referencedView if that's the case
145
- const theNewPConn = ReferenceComponent.normalizePConn(rootObject.getPConnect());
142
+ const theNewPConn = rootObject.getPConnect();
146
143
  // update ComponentName$ before we update pConn$ to make sure they're in sync
147
144
  // when rendering...
148
145
  this.componentName$ = theNewPConn.getComponentName();
@@ -4,7 +4,6 @@ import { FormGroup } from '@angular/forms';
4
4
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
5
5
  import { Utils } from '@pega/angular-sdk-components';
6
6
  import { getAllFields } from '@pega/angular-sdk-components';
7
- import { ReferenceComponent } from '@pega/angular-sdk-components';
8
7
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
9
8
 
10
9
  const NO_HEADER_TEMPLATES = ['SubTabs', 'SimpleTable', 'Confirmation', 'DynamicTabs', 'DetailsSubTabs', 'ListView'];
@@ -145,12 +144,8 @@ export class ViewComponent implements OnInit, OnDestroy, OnChanges {
145
144
 
146
145
  // debugger;
147
146
 
148
- // normalize this.pConn$ in case it contains a 'reference'
149
- this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$);
150
-
151
147
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ViewProps;
152
148
  this.inheritedProps$ = this.pConn$.getInheritedProps();
153
-
154
149
  // NOTE: this.configProps$.visibility'] is used in view.component.ts such that
155
150
  // the View will only be rendered when this.configProps$.visibility'] is false.
156
151
  // It WILL render if true or undefined.
@@ -159,9 +154,11 @@ export class ViewComponent implements OnInit, OnDestroy, OnChanges {
159
154
  this.title$ = this.configProps$.title || '';
160
155
  // label & showLabel within inheritedProps takes precedence over configProps
161
156
  this.label$ = this.inheritedProps$.label || this.configProps$.label || '';
162
- this.showLabel$ = this.inheritedProps$.showLabel || this.configProps$.showLabel || isDetailsTemplate(this.templateName$);
163
- // children may have a 'reference' so normalize the children array
164
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
157
+ this.showLabel$ =
158
+ this.inheritedProps$.showLabel !== undefined
159
+ ? this.inheritedProps$.showLabel
160
+ : this.configProps$.showLabel || isDetailsTemplate(this.templateName$);
161
+ this.arChildren$ = this.pConn$.getChildren();
165
162
  this.visibility$ = this.configProps$.visibility ?? this.visibility$;
166
163
 
167
164
  /**
@@ -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
  }