@pega/angular-sdk-overrides 0.25.14 → 0.25.16

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 (37) hide show
  1. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +13 -1
  2. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +25 -1
  3. package/lib/designSystemExtension/operator/operator.component.ts +2 -1
  4. package/lib/field/auto-complete/auto-complete.component.ts +6 -6
  5. package/lib/field/group/group.component.ts +14 -2
  6. package/lib/field/multiselect/multiselect.component.html +1 -1
  7. package/lib/infra/Containers/flow-container/flow-container.component.ts +39 -42
  8. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +46 -50
  9. package/lib/infra/Containers/view-container/view-container.component.ts +29 -30
  10. package/lib/infra/defer-load/defer-load.component.ts +6 -3
  11. package/lib/infra/navbar/navbar.component.ts +33 -35
  12. package/lib/infra/root-container/root-container.component.ts +33 -38
  13. package/lib/infra/view/view.component.ts +18 -37
  14. package/lib/template/app-shell/app-shell.component.ts +12 -11
  15. package/lib/template/base/details-template-base.ts +54 -0
  16. package/lib/template/case-summary/case-summary.component.ts +14 -0
  17. package/lib/template/data-reference/data-reference.component.ts +27 -18
  18. package/lib/template/details/details.component.html +11 -3
  19. package/lib/template/details/details.component.ts +2 -39
  20. package/lib/template/details-narrow-wide/details-narrow-wide.component.html +9 -2
  21. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +3 -4
  22. package/lib/template/details-one-column/details-one-column.component.html +11 -1
  23. package/lib/template/details-one-column/details-one-column.component.ts +2 -3
  24. package/lib/template/details-three-column/details-three-column.component.html +15 -2
  25. package/lib/template/details-three-column/details-three-column.component.ts +4 -7
  26. package/lib/template/details-two-column/details-two-column.component.html +9 -2
  27. package/lib/template/details-two-column/details-two-column.component.ts +3 -6
  28. package/lib/template/details-wide-narrow/details-wide-narrow.component.html +9 -2
  29. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +3 -6
  30. package/lib/template/field-group-template/field-group-template.component.ts +18 -4
  31. package/lib/template/simple-table-manual/simple-table-manual.component.ts +1 -1
  32. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +18 -20
  33. package/lib/widget/attachment/attachment.component.ts +5 -2
  34. package/lib/widget/case-history/case-history.component.ts +6 -2
  35. package/lib/widget/file-utility/file-utility.component.ts +25 -29
  36. package/lib/widget/todo/todo.component.ts +7 -2
  37. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, Input, ChangeDetectorRef, NgZone, OnDestroy } from '@angular/core';
1
+ import { Component, OnInit, Input, ChangeDetectorRef, OnDestroy } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { MatMenuModule } from '@angular/material/menu';
4
4
  import { MatListModule } from '@angular/material/list';
@@ -53,7 +53,6 @@ export class NavbarComponent implements OnInit, OnDestroy {
53
53
  private angularPConnect: AngularPConnectService,
54
54
  private chRef: ChangeDetectorRef,
55
55
  private psService: ProgressSpinnerService,
56
- private ngZone: NgZone,
57
56
  private utils: Utils
58
57
  ) {}
59
58
 
@@ -104,40 +103,39 @@ export class NavbarComponent implements OnInit, OnDestroy {
104
103
  }
105
104
 
106
105
  initComponent() {
107
- this.ngZone.run(() => {
108
- this.navIcon$ = this.utils.getSDKStaticContentUrl().concat('assets/pzpega-logo-mark.svg');
109
- this.navExpandCollapse$ = this.utils.getImageSrc('plus', this.utils.getSDKStaticContentUrl());
110
-
111
- // Then, continue on with other initialization
112
-
113
- // making a copy, so can add info
114
- this.navPages$ = JSON.parse(JSON.stringify(this.pages$));
115
- // @ts-ignore
116
- const localeReference = PCore.getLocaleUtils().getPortalLocaleReference() || this.pConn$.getValue('.pyLocaleReference');
117
- this.navPages$.forEach(page => {
118
- const destinationObject: any = {};
119
- this.pConn$.resolveConfigProps(
120
- { defaultHeading: page.pyDefaultHeading || page.pyLabel, localeReference: page.pyLocalizationReference },
121
- destinationObject
122
- );
123
- page.name = this.localeUtils.getLocaleValue(destinationObject.defaultHeading, '', destinationObject.localeReference || localeReference);
124
- page.iconName = this.utils.getImageSrc(page.pxPageViewIcon, this.utils.getSDKStaticContentUrl());
125
- });
126
- this.actionsAPI = this.pConn$.getActionsApi();
127
- this.createWork = this.actionsAPI.createWork.bind(this.actionsAPI);
128
- this.showPage = this.actionsAPI.showPage.bind(this.actionsAPI);
129
- this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as NavBarProps;
130
- this.logout = this.actionsAPI.logout.bind(this.actionsAPI);
131
-
132
- // const oData = this.pConn$.getDataObject();
133
-
134
- this.portalLogoImage$ = this.utils.getSDKStaticContentUrl().concat('assets/pzpega-logo-mark.svg');
135
- this.portalOperator$ = PCore.getEnvironmentInfo().getOperatorName();
136
- this.portalOperatorInitials$ = this.utils.getInitials(this.portalOperator$ ?? '');
137
- this.showAppName$ = this.configProps$.showAppName;
138
-
139
- this.portalApp$ = PCore.getEnvironmentInfo().getApplicationLabel();
106
+ this.navIcon$ = this.utils.getSDKStaticContentUrl().concat('assets/pzpega-logo-mark.svg');
107
+ this.navExpandCollapse$ = this.utils.getImageSrc('plus', this.utils.getSDKStaticContentUrl());
108
+
109
+ // Then, continue on with other initialization
110
+
111
+ // making a copy, so can add info
112
+ this.navPages$ = JSON.parse(JSON.stringify(this.pages$));
113
+ // @ts-ignore
114
+ const localeReference = PCore.getLocaleUtils().getPortalLocaleReference() || this.pConn$.getValue('.pyLocaleReference');
115
+ this.navPages$.forEach(page => {
116
+ const destinationObject: any = {};
117
+ this.pConn$.resolveConfigProps(
118
+ { defaultHeading: page.pyDefaultHeading || page.pyLabel, localeReference: page.pyLocalizationReference },
119
+ destinationObject
120
+ );
121
+ page.name = this.localeUtils.getLocaleValue(destinationObject.defaultHeading, '', destinationObject.localeReference || localeReference);
122
+ page.iconName = this.utils.getImageSrc(page.pxPageViewIcon, this.utils.getSDKStaticContentUrl());
140
123
  });
124
+ this.actionsAPI = this.pConn$.getActionsApi();
125
+ this.createWork = this.actionsAPI.createWork.bind(this.actionsAPI);
126
+ this.showPage = this.actionsAPI.showPage.bind(this.actionsAPI);
127
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as NavBarProps;
128
+ this.logout = this.actionsAPI.logout.bind(this.actionsAPI);
129
+
130
+ // const oData = this.pConn$.getDataObject();
131
+
132
+ this.portalLogoImage$ = this.utils.getSDKStaticContentUrl().concat('assets/pzpega-logo-mark.svg');
133
+ this.portalOperator$ = PCore.getEnvironmentInfo().getOperatorName();
134
+ this.portalOperatorInitials$ = this.utils.getInitials(this.portalOperator$ ?? '');
135
+ this.showAppName$ = this.configProps$.showAppName;
136
+
137
+ this.portalApp$ = PCore.getEnvironmentInfo().getApplicationLabel();
138
+ this.chRef.markForCheck();
141
139
  }
142
140
 
143
141
  navPanelButtonClick(oPageData: any) {
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, Input, NgZone, forwardRef, OnDestroy, inject } from '@angular/core';
1
+ import { ChangeDetectorRef, Component, OnInit, Input, forwardRef, OnDestroy, inject } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
4
4
  import { interval, Subscription } from 'rxjs';
@@ -56,7 +56,7 @@ export class RootContainerComponent implements OnInit, OnDestroy {
56
56
  constructor(
57
57
  private angularPConnect: AngularPConnectService,
58
58
  private psService: ProgressSpinnerService,
59
- private ngZone: NgZone
59
+ private cdRef: ChangeDetectorRef
60
60
  ) {}
61
61
 
62
62
  ngOnInit(): void {
@@ -137,18 +137,16 @@ export class RootContainerComponent implements OnInit, OnDestroy {
137
137
  });
138
138
 
139
139
  setTimeout(() => {
140
- // makes sure Angular tracks these changes
141
- this.ngZone.run(() => {
142
- const theNewPConn = rootObject.getPConnect();
143
- // update ComponentName$ before we update pConn$ to make sure they're in sync
144
- // when rendering...
145
- this.componentName$ = theNewPConn.getComponentName();
146
-
147
- this.pConn$ = theNewPConn;
148
- // this.pConn$ = rootObject.getPConnect();
149
-
150
- console.log(`RootContainer updated pConn$ to be: ${this.componentName$}`);
151
- });
140
+ const theNewPConn = rootObject.getPConnect();
141
+ // update ComponentName$ before we update pConn$ to make sure they're in sync
142
+ // when rendering...
143
+ this.componentName$ = theNewPConn.getComponentName();
144
+
145
+ this.pConn$ = theNewPConn;
146
+ // this.pConn$ = rootObject.getPConnect();
147
+
148
+ console.log(`RootContainer updated pConn$ to be: ${this.componentName$}`);
149
+ this.cdRef.markForCheck();
152
150
  });
153
151
  }
154
152
  }
@@ -187,24 +185,23 @@ export class RootContainerComponent implements OnInit, OnDestroy {
187
185
  if (arChildren && arChildren.length == 1) {
188
186
  // have to have a quick timeout or get an "expressions changed" angular error
189
187
  setTimeout(() => {
190
- this.ngZone.run(() => {
191
- const localPConn = arChildren[0].getPConnect();
192
-
193
- this.componentName$ = localPConn.getComponentName();
194
- if (this.componentName$ === 'ViewContainer') {
195
- const configProps = this.pConn$.getConfigProps();
196
- const viewContConfig = {
197
- meta: {
198
- type: 'ViewContainer',
199
- config: configProps
200
- },
201
- options
202
- };
203
-
204
- this.viewContainerPConn$ = PCore.createPConnect(viewContConfig).getPConnect();
205
- }
206
- this.bShowRoot$ = true;
207
- });
188
+ const localPConn = arChildren[0].getPConnect();
189
+
190
+ this.componentName$ = localPConn.getComponentName();
191
+ if (this.componentName$ === 'ViewContainer') {
192
+ const configProps = this.pConn$.getConfigProps();
193
+ const viewContConfig = {
194
+ meta: {
195
+ type: 'ViewContainer',
196
+ config: configProps
197
+ },
198
+ options
199
+ };
200
+
201
+ this.viewContainerPConn$ = PCore.createPConnect(viewContConfig).getPConnect();
202
+ }
203
+ this.bShowRoot$ = true;
204
+ this.cdRef.markForCheck();
208
205
  });
209
206
  }
210
207
  }
@@ -222,9 +219,8 @@ export class RootContainerComponent implements OnInit, OnDestroy {
222
219
  console.log(ex);
223
220
  }
224
221
 
225
- this.ngZone.run(() => {
226
- this.bIsProgress$ = true;
227
- });
222
+ this.bIsProgress$ = true;
223
+ this.cdRef.markForCheck();
228
224
  });
229
225
  }
230
226
  }
@@ -236,9 +232,8 @@ export class RootContainerComponent implements OnInit, OnDestroy {
236
232
  // don't touch bIsProgress$ unless differnent
237
233
  if (bShow != this.bIsProgress$) {
238
234
  // makes sure Angular tracks these changes
239
- this.ngZone.run(() => {
240
- this.bIsProgress$ = bShow;
241
- });
235
+ this.bIsProgress$ = bShow;
236
+ this.cdRef.markForCheck();
242
237
  }
243
238
  }
244
239
  }
@@ -3,10 +3,22 @@ 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 { Utils } from '@pega/angular-sdk-components';
6
- import { getAllFields } from '@pega/angular-sdk-components';
7
6
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
8
7
 
9
- const NO_HEADER_TEMPLATES = ['SubTabs', 'SimpleTable', 'Confirmation', 'DynamicTabs', 'DetailsSubTabs', 'ListView'];
8
+ const NO_HEADER_TEMPLATES = [
9
+ 'SubTabs',
10
+ 'SimpleTable',
11
+ 'Details',
12
+ 'DetailsTwoColumn',
13
+ 'DetailsThreeColumn',
14
+ 'NarrowWideDetails',
15
+ 'WideNarrowDetails',
16
+ 'Confirmation',
17
+ 'DynamicTabs',
18
+ 'DetailsSubTabs',
19
+ 'ListView'
20
+ ];
21
+
10
22
  const DETAILS_TEMPLATES = [
11
23
  'Details',
12
24
  'DetailsFields',
@@ -146,7 +158,6 @@ export class ViewComponent implements OnInit, OnDestroy, OnChanges {
146
158
 
147
159
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ViewProps;
148
160
  this.inheritedProps$ = this.pConn$.getInheritedProps();
149
-
150
161
  // NOTE: this.configProps$.visibility'] is used in view.component.ts such that
151
162
  // the View will only be rendered when this.configProps$.visibility'] is false.
152
163
  // It WILL render if true or undefined.
@@ -155,7 +166,10 @@ export class ViewComponent implements OnInit, OnDestroy, OnChanges {
155
166
  this.title$ = this.configProps$.title || '';
156
167
  // label & showLabel within inheritedProps takes precedence over configProps
157
168
  this.label$ = this.inheritedProps$.label || this.configProps$.label || '';
158
- this.showLabel$ = this.inheritedProps$.showLabel || this.configProps$.showLabel || isDetailsTemplate(this.templateName$);
169
+ this.showLabel$ =
170
+ this.inheritedProps$.showLabel !== undefined
171
+ ? this.inheritedProps$.showLabel
172
+ : (this.configProps$.showLabel ?? isDetailsTemplate(this.templateName$));
159
173
  this.arChildren$ = this.pConn$.getChildren();
160
174
  this.visibility$ = this.configProps$.visibility ?? this.visibility$;
161
175
 
@@ -181,39 +195,6 @@ export class ViewComponent implements OnInit, OnDestroy, OnChanges {
181
195
  // console.log("-->view update: " + this.angularPConnect.getComponentID(this) + ", template: " + this.templateName$ + ", kids: " + kidList);
182
196
  }
183
197
 
184
- // JA - adapting additionalProps from Nebula/Constellation version which uses static methods
185
- // on the component classes stored in PComponents (that Angular doesn't have)...
186
- additionalProps(state: any, getPConnect: any) {
187
- let propObj = {};
188
-
189
- // We already have the template name in this.templateName$
190
- if (this.templateName$ !== '') {
191
- let allFields = {};
192
-
193
- // These uses are adapted from Nebula/Constellation CaseSummary.additionalProps
194
- switch (this.templateName$) {
195
- case 'CaseSummary':
196
- allFields = getAllFields(getPConnect);
197
- // eslint-disable-next-line no-case-declarations
198
- const unresFields = {
199
- primaryFields: allFields[0],
200
- secondaryFields: allFields[1]
201
- };
202
- propObj = getPConnect.resolveConfigProps(unresFields);
203
- break;
204
-
205
- case 'Details':
206
- allFields = getAllFields(getPConnect);
207
- propObj = { fields: allFields[0] };
208
- break;
209
- default:
210
- break;
211
- }
212
- }
213
-
214
- return propObj;
215
- }
216
-
217
198
  ngOnDestroy(): void {
218
199
  if (this.angularPConnectData.unsubscribeFn) {
219
200
  this.angularPConnectData.unsubscribeFn();
@@ -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';
@@ -59,7 +59,7 @@ export class AppShellComponent implements OnInit, OnDestroy {
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
 
@@ -152,17 +152,15 @@ export class AppShellComponent implements OnInit, OnDestroy {
152
152
  const portalClass = this.pConn$.getValue('.classID', ''); // 2nd arg empty string until typedef marked correctly
153
153
  const envPortalName = envInfo.getPortalName();
154
154
 
155
- this.ngZone.run(() => {
156
- // making a copy, so can add info
157
- this.pages$ = this.configProps$.pages;
155
+ // making a copy, so can add info
156
+ this.pages$ = this.configProps$.pages;
158
157
 
159
- if (this.pages$) {
160
- this.bShowAppShell$ = true;
161
- }
158
+ if (this.pages$) {
159
+ this.bShowAppShell$ = true;
160
+ }
162
161
 
163
- this.caseTypes$ = this.configProps$.caseTypes;
164
- this.arChildren$ = this.pConn$.getChildren();
165
- });
162
+ this.caseTypes$ = this.configProps$.caseTypes;
163
+ this.arChildren$ = this.pConn$.getChildren();
166
164
 
167
165
  const portalLogo = this.configProps$.portalLogo;
168
166
  // using the default icon then fetch it from the static folder (not auth involved)
@@ -181,12 +179,14 @@ export class AppShellComponent implements OnInit, OnDestroy {
181
179
  .getSvcImageUrl(portalLogo)
182
180
  .then(data => {
183
181
  this.imageURL = data;
182
+ this.cdRef.markForCheck();
184
183
  })
185
184
  .catch(() => {
186
185
  console.error(`${this.localizedVal('Unable to load the image for the portal logo/icon with the insName', 'AppShell')}:${portalLogo}`);
187
186
  });
188
187
  }
189
188
  this.appName$ = this.localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase());
189
+ this.cdRef.markForCheck();
190
190
  }
191
191
 
192
192
  // fpr show/hiding error messages in the SnackBar component
@@ -244,5 +244,6 @@ export class AppShellComponent implements OnInit, OnDestroy {
244
244
  default:
245
245
  break;
246
246
  }
247
+ this.cdRef.markForCheck();
247
248
  }
248
249
  }
@@ -1,13 +1,16 @@
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;
13
+ propsToUse: any = {};
11
14
 
12
15
  childrenMetadataOld;
13
16
 
@@ -64,4 +67,55 @@ export class DetailsTemplateBase implements OnInit, OnDestroy {
64
67
  return pConnect.resolveConfigProps(pConnect.getRawMetadata());
65
68
  });
66
69
  }
70
+
71
+ updateDetailsProps() {
72
+ const { label, showLabel } = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps());
73
+ this.propsToUse = { label, showLabel, ...this.pConn$.getInheritedProps() };
74
+ }
75
+
76
+ processDetailFields(kid: any): any[] {
77
+ const pKid = kid.getPConnect();
78
+ const fields = pKid.getChildren();
79
+ const processedFields: any[] = [];
80
+
81
+ fields?.forEach(field => {
82
+ const thePConn = field.getPConnect();
83
+ const theCompType = thePConn.getComponentName().toLowerCase();
84
+ if (theCompType === 'reference' || theCompType === 'group') {
85
+ const configProps = thePConn.getConfigProps();
86
+ configProps.readOnly = true;
87
+ configProps.displayMode = 'DISPLAY_ONLY';
88
+ const propToUse = { ...thePConn.getInheritedProps() };
89
+ configProps.label = propToUse?.label;
90
+ const options = {
91
+ context: thePConn.getContextName(),
92
+ pageReference: thePConn.getPageReference(),
93
+ referenceList: thePConn.getReferenceList()
94
+ };
95
+ const viewContConfig = {
96
+ meta: {
97
+ ...thePConn.getMetadata(),
98
+ type: theCompType,
99
+ config: configProps
100
+ },
101
+ options
102
+ };
103
+ const theViewCont = PCore.createPConnect(viewContConfig);
104
+ processedFields.push({
105
+ type: theCompType,
106
+ pConn: theViewCont?.getPConnect()
107
+ });
108
+ } else {
109
+ thePConn.setInheritedProp('displayMode', 'DISPLAY_ONLY');
110
+ thePConn.setInheritedProp('readOnly', true);
111
+ processedFields.push({
112
+ type: theCompType,
113
+ config: thePConn.getConfigProps(),
114
+ pConn: thePConn
115
+ });
116
+ }
117
+ });
118
+
119
+ return processedFields;
120
+ }
67
121
  }
@@ -3,6 +3,7 @@ import { FormGroup } from '@angular/forms';
3
3
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
4
4
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
5
5
  import { Utils } from '@pega/angular-sdk-components';
6
+ import { getAllFields } from '@pega/angular-sdk-components';
6
7
 
7
8
  interface CaseSummaryProps {
8
9
  // If any, enter additional props that only exist on this component
@@ -73,7 +74,20 @@ export class CaseSummaryComponent implements OnInit, OnDestroy, OnChanges {
73
74
  }
74
75
 
75
76
  updateSelf() {
77
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as CaseSummaryProps;
76
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);
77
91
  }
78
92
 
79
93
  ngOnChanges() {
@@ -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();
@@ -186,6 +194,7 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
186
194
 
187
195
  this.generateChildrenToRender();
188
196
  this.displayChild = !(this.displaySingleRef || this.displayMultiRef);
197
+ this.getData();
189
198
  }
190
199
 
191
200
  updatePropertiesFromProps(theConfigProps) {
@@ -1,3 +1,11 @@
1
- <div>
2
- <component-mapper name="MaterialDetails" [props]="{ arFields$, arHighlightedFields: highlightedDataArr, layout: 'one-column' }"></component-mapper>
3
- </div>
1
+ <component-mapper
2
+ name="FieldGroup"
3
+ [props]="{ name: propsToUse.showLabel ? propsToUse.label : '', childrenTemplate: detailsContent }"
4
+ ></component-mapper>
5
+
6
+ <ng-template #detailsContent>
7
+ <component-mapper
8
+ name="MaterialDetails"
9
+ [props]="{ arFields$: arFields$, arHighlightedFields: highlightedDataArr, layout: 'one-column' }"
10
+ ></component-mapper>
11
+ </ng-template>
@@ -16,6 +16,7 @@ export class DetailsComponent extends DetailsTemplateBase {
16
16
  arFields$: any[] = [];
17
17
 
18
18
  override updateSelf() {
19
+ this.updateDetailsProps();
19
20
  const rawMetaData: any = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata()?.config);
20
21
  this.showHighlightedData = rawMetaData?.showHighlightedData;
21
22
 
@@ -35,45 +36,7 @@ export class DetailsComponent extends DetailsTemplateBase {
35
36
 
36
37
  const kids = this.pConn$.getChildren() as any[];
37
38
  for (const kid of kids) {
38
- this.arFields$ = [];
39
- const pKid = kid.getPConnect();
40
- const fields = pKid.getChildren();
41
- fields?.forEach(field => {
42
- const thePConn = field.getPConnect();
43
- const theCompType = thePConn.getComponentName().toLowerCase();
44
- if (theCompType === 'reference' || theCompType === 'group') {
45
- const configProps = thePConn.getConfigProps();
46
- configProps.readOnly = true;
47
- configProps.displayMode = 'DISPLAY_ONLY';
48
- const propToUse = { ...thePConn.getInheritedProps() };
49
- configProps.label = propToUse?.label;
50
- const options = {
51
- context: thePConn.getContextName(),
52
- pageReference: thePConn.getPageReference(),
53
- referenceList: thePConn.getReferenceList()
54
- };
55
- const viewContConfig = {
56
- meta: {
57
- ...thePConn.getMetadata(),
58
- type: theCompType,
59
- config: configProps
60
- },
61
- options
62
- };
63
- const theViewCont = PCore.createPConnect(viewContConfig);
64
- const data = {
65
- type: theCompType,
66
- pConn: theViewCont?.getPConnect()
67
- };
68
- this.arFields$.push(data);
69
- } else {
70
- const data = {
71
- type: theCompType,
72
- config: thePConn.getConfigProps()
73
- };
74
- this.arFields$.push(data);
75
- }
76
- });
39
+ this.arFields$ = this.processDetailFields(kid);
77
40
  }
78
41
  }
79
42
  }
@@ -1,4 +1,11 @@
1
1
  <component-mapper
2
- name="MaterialDetails"
3
- [props]="{ arFields$, arFields2$, arHighlightedFields: highlightedDataArr, layout: 'narrow-wide' }"
2
+ name="FieldGroup"
3
+ [props]="{ name: propsToUse.showLabel ? propsToUse.label : '', childrenTemplate: detailsContent }"
4
4
  ></component-mapper>
5
+
6
+ <ng-template #detailsContent>
7
+ <component-mapper
8
+ name="MaterialDetails"
9
+ [props]="{ arFields$: arFields$, arFields2$: arFields2$, arHighlightedFields: highlightedDataArr, layout: 'narrow-wide' }"
10
+ ></component-mapper>
11
+ </ng-template>
@@ -17,6 +17,7 @@ export class DetailsNarrowWideComponent extends DetailsTemplateBase {
17
17
  showHighlightedData: boolean;
18
18
 
19
19
  override updateSelf() {
20
+ this.updateDetailsProps();
20
21
  const rawMetaData: any = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata()?.config);
21
22
  this.showHighlightedData = rawMetaData?.showHighlightedData;
22
23
 
@@ -36,12 +37,10 @@ export class DetailsNarrowWideComponent extends DetailsTemplateBase {
36
37
 
37
38
  const kids = this.pConn$.getChildren() as any[];
38
39
  for (const kid of kids) {
39
- const pKid = kid.getPConnect();
40
- const pKidData = pKid.resolveConfigProps(pKid.getRawMetadata());
41
40
  if (kids.indexOf(kid) == 0) {
42
- this.arFields$ = pKidData.children;
41
+ this.arFields$ = this.processDetailFields(kid);
43
42
  } else {
44
- this.arFields2$ = pKidData.children;
43
+ this.arFields2$ = this.processDetailFields(kid);
45
44
  }
46
45
  }
47
46
  }
@@ -1 +1,11 @@
1
- <component-mapper name="MaterialDetails" [props]="{ arFields$, arHighlightedFields: highlightedDataArr, layout: 'one-column' }"></component-mapper>
1
+ <component-mapper
2
+ name="FieldGroup"
3
+ [props]="{ name: propsToUse.showLabel ? propsToUse.label : '', childrenTemplate: detailsContent }"
4
+ ></component-mapper>
5
+
6
+ <ng-template #detailsContent>
7
+ <component-mapper
8
+ name="MaterialDetails"
9
+ [props]="{ arFields$: arFields$, arHighlightedFields: highlightedDataArr, layout: 'one-column' }"
10
+ ></component-mapper>
11
+ </ng-template>
@@ -17,6 +17,7 @@ export class DetailsOneColumnComponent extends DetailsTemplateBase {
17
17
  arFields$: any[] = [];
18
18
 
19
19
  override updateSelf() {
20
+ this.updateDetailsProps();
20
21
  const rawMetaData: any = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata()?.config);
21
22
  this.showHighlightedData = rawMetaData?.showHighlightedData;
22
23
 
@@ -39,10 +40,8 @@ export class DetailsOneColumnComponent extends DetailsTemplateBase {
39
40
 
40
41
  const kids = this.pConn$.getChildren() as any[];
41
42
  for (const kid of kids) {
42
- const pKid = kid.getPConnect();
43
- const pKidData = pKid.resolveConfigProps(pKid.getRawMetadata());
44
43
  if (kids.indexOf(kid) == 0) {
45
- this.arFields$ = pKidData.children;
44
+ this.arFields$ = this.processDetailFields(kid);
46
45
  }
47
46
  }
48
47
  }