Skip to content

Commit 5de061d

Browse files
4manasamanasatumms2021389
authored
Fixed the issue UserReference value not displaying in Details template (#292)
* Fixed the issue UserReference value not displaying in Details template --------- Co-authored-by: manasa <manasa.mashetty@in.pega.com> Co-authored-by: Siva Rama Krishna <sivaramakrishna.tumma@in.pega.com>
1 parent f50e6e7 commit 5de061d

File tree

3 files changed

+42
-40
lines changed

3 files changed

+42
-40
lines changed
Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,47 @@
1-
<div class="psdk-user-reference">
1+
<div>
22
<div *ngIf="displayMode$; else noDisplayMode">
33
<component-mapper name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
44
</div>
55
<ng-template #noDisplayMode>
6-
<div *ngIf="type === 'operator'">
7-
<component-mapper name="Operator" [props]="{ pConn$ }"></component-mapper>
8-
</div>
9-
<div [formGroup]="formGroup$" *ngIf="type === 'dropdown'">
10-
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
11-
<mat-select [required]="bRequired$" [formControl]="fieldControl" [attr.data-test-id]="testId" (selectionChange)="fieldOnChange($event)">
12-
<mat-option *ngFor="let opt of options$" [value]="opt.key">
13-
{{ opt.value }}
14-
</mat-option>
15-
</mat-select>
16-
<mat-label>{{ label$ }}</mat-label>
17-
<mat-error *ngIf="fieldControl.invalid">
18-
{{ getErrorMessage() }}
19-
</mat-error>
20-
</mat-form-field>
21-
</div>
22-
<div [formGroup]="formGroup$" *ngIf="type === 'searchbox'">
23-
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
24-
<mat-label>{{ label$ }}</mat-label>
25-
<input
26-
matInput
27-
[placeholder]="placeholder"
28-
[formControl]="fieldControl"
29-
[required]="bRequired$"
30-
[matAutocomplete]="auto"
31-
[attr.data-test-id]="testId"
32-
(blur)="fieldOnBlur($event)"
33-
/>
34-
<mat-autocomplete #auto="matAutocomplete" autoActiveFirstOption (optionSelected)="optionChanged($event)">
35-
<mat-option *ngFor="let opt of filteredOptions | async" [value]="opt.value">
36-
<span>{{ opt.value }}</span>
37-
</mat-option>
38-
</mat-autocomplete>
39-
<mat-error *ngIf="fieldControl.invalid">
40-
{{ getErrorMessage() }}
41-
</mat-error>
42-
</mat-form-field>
6+
<div class="psdk-user-reference">
7+
<div *ngIf="type === 'operator'">
8+
<component-mapper name="Operator" [props]="{ pConn$ }"></component-mapper>
9+
</div>
10+
<div [formGroup]="formGroup$" *ngIf="type === 'dropdown'">
11+
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
12+
<mat-select [required]="bRequired$" [formControl]="fieldControl" [attr.data-test-id]="testId" (selectionChange)="fieldOnChange($event)">
13+
<mat-option *ngFor="let opt of options$" [value]="opt.key">
14+
{{ opt.value }}
15+
</mat-option>
16+
</mat-select>
17+
<mat-label>{{ label$ }}</mat-label>
18+
<mat-error *ngIf="fieldControl.invalid">
19+
{{ getErrorMessage() }}
20+
</mat-error>
21+
</mat-form-field>
22+
</div>
23+
<div [formGroup]="formGroup$" *ngIf="type === 'searchbox'">
24+
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
25+
<mat-label>{{ label$ }}</mat-label>
26+
<input
27+
matInput
28+
[placeholder]="placeholder"
29+
[formControl]="fieldControl"
30+
[required]="bRequired$"
31+
[matAutocomplete]="auto"
32+
[attr.data-test-id]="testId"
33+
(blur)="fieldOnBlur($event)"
34+
/>
35+
<mat-autocomplete #auto="matAutocomplete" autoActiveFirstOption (optionSelected)="optionChanged($event)">
36+
<mat-option *ngFor="let opt of filteredOptions | async" [value]="opt.value">
37+
<span>{{ opt.value }}</span>
38+
</mat-option>
39+
</mat-autocomplete>
40+
<mat-error *ngIf="fieldControl.invalid">
41+
{{ getErrorMessage() }}
42+
</mat-error>
43+
</mat-form-field>
44+
</div>
4345
</div>
4446
</ng-template>
4547
</div>

packages/angular-sdk-components/src/lib/_components/field/user-reference/user-reference.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
168168
this.placeholder = placeholder || '';
169169
this.displayMode$ = displayMode;
170170

171-
this.value$ = this.pConn$.getConfigProps()?.value;
171+
this.value$ = value && typeof value === 'object' && value.userName ? value.userName : value ?? '';
172172

173173
const { readOnly, required } = props;
174174
[this.bReadonly$, this.bRequired$] = [readOnly, required].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));

packages/angular-sdk-components/src/lib/_components/template/field-value-list/field-value-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div *ngIf="displayMode$ === 'DISPLAY_ONLY'; else STACKED_LARGE_VAL" class="${label$ ? 'psdk-container-labels-left' : 'psdk-container-nolabels'}">
1+
<div *ngIf="displayMode$ === 'DISPLAY_ONLY'; else STACKED_LARGE_VAL" [ngClass]="label$ ? 'psdk-container-labels-left' : 'psdk-container-nolabels'">
22
<div *ngIf="label$" class="psdk-grid-label">{{ label$ }}</div>
33
<div class="psdk-val-labels-left">
44
<ng-container *ngTemplateOutlet="valueTemplate"></ng-container>

0 commit comments

Comments
 (0)