Skip to content

Commit 18e89be

Browse files
samhere06mohas22tumms2021389
authored
Updated DataReference and Semantic Link to display as label and value (#337)
* Updated DataReference and Semantic Link to display as label and value * Handling label in single reference component --------- Co-authored-by: mohas22 <[email protected]> Co-authored-by: tumms2021389 <[email protected]>
1 parent 7a6d75d commit 18e89be

File tree

5 files changed

+37
-24
lines changed

5 files changed

+37
-24
lines changed

packages/angular-sdk-components/src/lib/_components/field/semantic-link/semantic-link.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<div *ngIf="bVisible$ !== false" [ngClass]="label$.length > 0 ? 'psdk-grid-filter' : 'psdk-container-nolabels'">
2-
<div class="psdk-grid-label">{{ label$ }}</div>
1+
<div *ngIf="bVisible$ !== false">
32
<a *ngIf="!isLinkTextEmpty; else noLink" class="psdk-value" href="#" (click)="openLinkClick($event)">{{ value$ || '---' }}</a>
43
</div>
54
<ng-template #noLink>
Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
.psdk-grid-filter {
2-
display: grid;
3-
grid-template-columns: repeat(2, minmax(0, 1fr));
4-
column-gap: calc(2 * 0.5rem);
5-
row-gap: calc(2 * 0.5rem);
6-
align-items: start;
7-
}
8-
9-
.psdk-container-nolabels {
10-
align-items: start;
11-
padding-block: 8px;
12-
}
13-
14-
.psdk-label {
15-
margin: 8px 0px;
16-
}
17-
181
.psdk-value {
192
margin: 8px 0px;
203
}
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
<component-mapper name="SemanticLink" [props]="{ pConn$: newPconn, formGroup$ }"></component-mapper>
1+
<div [ngClass]="displayMode ? 'psdk-grid-display' : 'psdk-grid-nondisplay'">
2+
<div *ngIf="label" class="psdk-grid-label">{{ label }}</div>
3+
<component-mapper name="SemanticLink" [props]="{ pConn$: newPconn, formGroup$ }"></component-mapper>
4+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.psdk-grid-display {
2+
display: grid;
3+
grid-template-columns: repeat(2, minmax(0, 1fr));
4+
column-gap: calc(2 * 0.5rem);
5+
row-gap: calc(2 * 0.5rem);
6+
align-items: center;
7+
margin-top: 1rem;
8+
}
9+
10+
.psdk-grid-nondisplay {
11+
margin-top: 1rem;
12+
}
13+
14+
.psdk-label {
15+
color: var(--app-label-color);
16+
margin: 8px 0px;
17+
}
18+
19+
.psdk-value {
20+
margin: 8px 0px;
21+
}

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class SingleReferenceReadonlyComponent implements OnInit, OnDestroy {
2121
component: any;
2222
label: string;
2323
newPconn: typeof PConnect;
24+
displayMode: string;
2425

2526
constructor(private angularPConnect: AngularPConnectService) {}
2627

@@ -55,9 +56,11 @@ export class SingleReferenceReadonlyComponent implements OnInit, OnDestroy {
5556
updateSelf() {
5657
this.configProps = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps());
5758
const rawViewMetadata = this.pConn$.getRawMetadata();
58-
const propsToUse = { ...this.pConn$.getInheritedProps(), ...this.configProps };
59+
const label = this.configProps.label;
60+
const showLabel = this.configProps.showLabel;
61+
const propsToUse = { label, showLabel, ...this.pConn$.getInheritedProps() };
5962
const type = (rawViewMetadata?.config as any)?.componentType;
60-
const displayMode = this.configProps.displayMode;
63+
this.displayMode = this.configProps.displayMode;
6164
const targetObjectType = this.configProps.targetObjectType;
6265
const referenceType = targetObjectType === 'case' ? 'Case' : 'Data';
6366
const hideLabel = this.configProps.hideLabel;
@@ -66,12 +69,16 @@ export class SingleReferenceReadonlyComponent implements OnInit, OnDestroy {
6669
const dataRelationshipContext = (rawViewMetadata?.config as any)?.displayField
6770
? getDataRelationshipContextFromKey((rawViewMetadata?.config as any)?.displayField)
6871
: this.dataRelationshipContext;
72+
if (propsToUse.showLabel === false) {
73+
propsToUse.label = '';
74+
}
6975
this.label = propsToUse.label;
7076

7177
const editableComponents = ['AutoComplete', 'SimpleTableSelect', 'Dropdown', 'RadioButtons'];
7278
const config: any = {
7379
...rawViewMetadata?.config,
74-
primaryField: (rawViewMetadata?.config as any)?.displayField
80+
primaryField: (rawViewMetadata?.config as any)?.displayField,
81+
label: this.label
7582
};
7683

7784
const activeViewRuleClass = (rawViewMetadata?.config as any)?.targetObjectClass;
@@ -93,7 +100,7 @@ export class SingleReferenceReadonlyComponent implements OnInit, OnDestroy {
93100
type: 'SemanticLink',
94101
config: {
95102
...config,
96-
displayMode,
103+
displayMode: this.displayMode,
97104
referenceType,
98105
hideLabel,
99106
dataRelationshipContext

0 commit comments

Comments
 (0)