Skip to content

Commit 284eced

Browse files
mohas22mohas22
authored andcommitted
updated to work with data reference case
1 parent f8e4354 commit 284eced

File tree

7 files changed

+25
-14
lines changed

7 files changed

+25
-14
lines changed

packages/angular-sdk-components/src/lib/_bridge/helpers/sdk-pega-component-map.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ const pegaSdkComponentMap = {
201201
NarrowWideForm: NarrowWideFormComponent,
202202
// 'NarrowWidePage': NarrowWidePage,
203203
NavBar: NavbarComponent,
204+
ObjectPage: CaseViewComponent,
204205
ObjectReference: ObjectReferenceComponent,
205206
OneColumn: OneColumnComponent,
206207
OneColumnPage: OneColumnPageComponent,

packages/angular-sdk-components/src/lib/_components/infra/defer-load/defer-load.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class DeferLoadComponent implements OnInit, OnDestroy, OnChanges {
9797

9898
getViewOptions = () => ({
9999
viewContext: this.resourceType,
100-
pageClass: this.loadViewCaseID ? '' : this.pConn$.getDataObject().pyPortal.classID,
100+
pageClass: this.loadViewCaseID ? '' : this.pConn$.getDataObject()?.pyPortal?.classID,
101101
container: this.isContainerPreview ? 'preview' : undefined,
102102
containerName: this.isContainerPreview ? 'preview' : undefined,
103103
updateData: this.isContainerPreview

packages/angular-sdk-components/src/lib/_components/template/case-view/case-view.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="psdk-case-view" id="case-view">
22
<div class="psdk-case-view-info">
33
<mat-toolbar color="primary" class="psdk-case-view-toolbar">
4-
<mat-toolbar-row style="padding-left: 1rem">
4+
<mat-toolbar-row class="psdk-case-view-toolbar-row">
55
<div class="psdk-case-icon-div">
66
<img class="psdk-case-svg-icon" src="{{ svgCase$ }}" />
77
</div>

packages/angular-sdk-components/src/lib/_components/template/case-view/case-view.component.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,9 @@ h1 {
105105
button {
106106
margin: 0rem 0.3125rem;
107107
}
108+
109+
.psdk-case-view-toolbar-row {
110+
padding-left: 1rem;
111+
white-space: normal;
112+
height: auto;
113+
}

packages/angular-sdk-components/src/lib/_components/template/data-reference/data-reference.component.html

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
<component-mapper name="SearchForm" [props]="{ pConn$: pConn$, formGroup$, searchSelectCacheKey: '' }"></component-mapper>
33
</div>
44
<ng-template #notadvancedSearch>
5-
<div *ngIf="childrenToRender && childrenToRender.length > 0">
6-
<div *ngIf="!displayMultiRef">
7-
<div *ngFor="let kid of childrenToRender">
8-
<component-mapper [name]="kid?.getPConnect().getComponentName()" [props]="{ pConn$: kid.getPConnect(), formGroup$ }"></component-mapper>
9-
</div>
10-
</div>
11-
<div *ngIf="displaySingleRef">
12-
<component-mapper name="SingleReferenceReadOnly" [props]="{ pConn$: firstChildPConnect() }"></component-mapper>
13-
</div>
14-
<div *ngIf="displayMultiRef">
15-
<component-mapper name="MultiReferenceReadOnly" [props]="{ pConn$: firstChildPConnect() }"></component-mapper>
5+
<div *ngIf="displaySingleRef">
6+
<component-mapper name="SingleReferenceReadOnly" [props]="{ pConn$: firstChildPConnect(), dataRelationshipContext }"></component-mapper>
7+
</div>
8+
<div *ngIf="displayMultiRef">
9+
<component-mapper name="MultiReferenceReadOnly" [props]="{ pConn$: firstChildPConnect() }"></component-mapper>
10+
</div>
11+
<div *ngIf="displayChild && childrenToRender && childrenToRender.length > 0">
12+
<div *ngFor="let kid of childrenToRender">
13+
<component-mapper [name]="kid?.getPConnect().getComponentName()" [props]="{ pConn$: kid.getPConnect(), formGroup$ }"></component-mapper>
1614
</div>
1715
</div>
1816
</ng-template>

packages/angular-sdk-components/src/lib/_components/template/data-reference/data-reference.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
5454
showAdvancedSearch: boolean;
5555
pyID: any;
5656
allowImplicitRefresh: any;
57+
displayChild = false;
58+
dataRelationshipContext: any;
5759

5860
constructor(
5961
private angularPConnect: AngularPConnectService,
@@ -135,6 +137,8 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
135137
this.viewName = this.rawViewMetadata.name;
136138
this.firstChildMeta = this.rawViewMetadata.children[0];
137139
this.refList = this.rawViewMetadata.config.referenceList;
140+
this.dataRelationshipContext =
141+
this.rawViewMetadata.config.contextClass && this.rawViewMetadata.config.name ? this.rawViewMetadata.config.name : null;
138142
this.canBeChangedInReviewMode = theConfigProps.allowAndPersistChangesInReviewMode && (displayAs === 'autocomplete' || displayAs === 'dropdown');
139143
// this.childrenToRender = this.children;
140144
this.isDisplayModeEnabled = ['DISPLAY_ONLY', 'STACKED_LARGE_VAL'].includes(displayMode);
@@ -177,6 +181,7 @@ export class DataReferenceComponent implements OnInit, OnDestroy {
177181
}
178182

179183
this.generateChildrenToRender();
184+
this.displayChild = !(this.displaySingleRef || this.displayMultiRef);
180185
}
181186
}
182187

packages/angular-sdk-components/src/lib/_components/template/single-reference-readonly/single-reference-readonly.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { CommonModule } from '@angular/common';
1414
export class SingleReferenceReadonlyComponent implements OnInit, OnDestroy {
1515
@Input() pConn$: typeof PConnect;
1616
@Input() formGroup$: FormGroup;
17+
@Input() dataRelationshipContext?: any;
1718

1819
angularPConnectData: AngularPConnectData = {};
1920
configProps: any;
@@ -64,7 +65,7 @@ export class SingleReferenceReadonlyComponent implements OnInit, OnDestroy {
6465
const displayAs = this.configProps.displayAs ?? 'readonly';
6566
const dataRelationshipContext = (rawViewMetadata?.config as any)?.displayField
6667
? getDataRelationshipContextFromKey((rawViewMetadata?.config as any)?.displayField)
67-
: null;
68+
: this.dataRelationshipContext;
6869
this.label = propsToUse.label;
6970

7071
const editableComponents = ['AutoComplete', 'SimpleTableSelect', 'Dropdown', 'RadioButtons'];

0 commit comments

Comments
 (0)