Skip to content

Commit 2585365

Browse files
author
manasa
committed
Merge branch 'master' of https://github.com/pegasystems/angular-sdk-components into mod/dec/advanceSearch
2 parents 913530c + 5761d82 commit 2585365

22 files changed

+987
-36
lines changed

package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"@angular/compiler": "^19.2.14",
6262
"@angular/core": "^19.2.14",
6363
"@angular/forms": "^19.2.14",
64+
"@angular/google-maps": "^19.2.19",
6465
"@angular/material": "^19.2.19",
6566
"@angular/material-experimental": "^19.2.19",
6667
"@angular/material-moment-adapter": "^19.2.19",

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { EmailComponent } from '../../_components/field/email/email.component';
3030
import { GroupComponent } from '../../_components/field/group/group.component';
3131
import { IntegerComponent } from '../../_components/field/integer/integer.component';
3232
import { ListViewActionButtonsComponent } from '../../_components/field/list-view-action-buttons/list-view-action-buttons.component';
33+
import { LocationComponent } from '../../_components/field/location/location.component';
3334
import { PercentageComponent } from '../../_components/field/percentage/percentage.component';
3435
import { PhoneComponent } from '../../_components/field/phone/phone.component';
3536
import { RadioButtonsComponent } from '../../_components/field/radio-buttons/radio-buttons.component';
@@ -43,6 +44,7 @@ import { UrlComponent } from '../../_components/field/url/url.component';
4344
import { UserReferenceComponent } from '../../_components/field/user-reference/user-reference.component';
4445
import { ScalarListComponent } from '../../_components/field/scalar-list/scalar-list.component';
4546
import { SearchFormComponent } from '../../_components/template/data-reference/search-form/search-form.component';
47+
import { SelectableCardComponent } from '../../_components/field/selectable-card/selectable-card.component';
4648
import { RichTextComponent } from '../../_components/field/rich-text/rich-text.component';
4749

4850
// Template components
@@ -186,6 +188,7 @@ const pegaSdkComponentMap = {
186188
ListUtility: ListUtilityComponent,
187189
ListView: ListViewComponent,
188190
ListViewActionButtons: ListViewActionButtonsComponent,
191+
Location: LocationComponent,
189192
MaterialDetails: MaterialDetailsComponent,
190193
MaterialUtility: MaterialUtilityComponent,
191194
ModalViewContainer: ModalViewContainerComponent,
@@ -216,6 +219,7 @@ const pegaSdkComponentMap = {
216219
ScalarList: ScalarListComponent,
217220
SearchForm: SearchFormComponent,
218221
SearchGroups: SearchGroupsComponent,
222+
SelectableCard: SelectableCardComponent,
219223
SemanticLink: SemanticLinkComponent,
220224
SimpleTable: SimpleTableComponent,
221225
SimpleTableManual: SimpleTableManualComponent,

packages/angular-sdk-components/src/lib/_components/field/check-box/check-box.component.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
<div *ngIf="displayMode$; else noDisplayMode">
2-
<component-mapper
3-
*ngIf="bVisible$ !== false"
4-
name="FieldValueList"
5-
[props]="{ label$: caption$, value$: value$ ? trueLabel$ : falseLabel$, displayMode$ }"
6-
></component-mapper>
1+
<div *ngIf="variant !== 'card'; else cardMode">
2+
<div *ngIf="displayMode$; else noDisplayMode">
3+
<component-mapper
4+
*ngIf="bVisible$ !== false"
5+
name="FieldValueList"
6+
[props]="{ label$: caption$, value$: value$ ? trueLabel$ : falseLabel$, displayMode$ }"
7+
></component-mapper>
8+
</div>
79
</div>
810
<ng-template #noDisplayMode>
911
<div *ngIf="bHasForm$; else noEdit">
@@ -48,3 +50,9 @@
4850
<ng-template #noEdit>
4951
<component-mapper *ngIf="bVisible$ !== false" name="Text" [props]="{ pConn$, formatAs$: 'text' }"></component-mapper>
5052
</ng-template>
53+
<ng-template #cardMode>
54+
<h4>{{ label$ }}</h4>
55+
<div>
56+
<component-mapper name="SelectableCard" [props]="{ pConn$: pConn$, type: 'checkbox' }" [parent]="this"></component-mapper>
57+
</div>
58+
</ng-template>

packages/angular-sdk-components/src/lib/_components/field/check-box/check-box.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
2626
primaryField: string;
2727
readonlyContextList: any;
2828
referenceList: string;
29+
variant?: string;
30+
renderMode: string;
2931
}
3032

3133
@Component({
@@ -70,6 +72,7 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
7072
listOfCheckboxes: any[] = [];
7173
actionsApi: Object;
7274
propName: string;
75+
variant?: string;
7376

7477
fieldControl = new FormControl('', null);
7578

@@ -90,7 +93,7 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
9093
// this.updateSelf();
9194
this.checkAndUpdate();
9295

93-
if (this.selectionMode === 'multi' && this.referenceList?.length > 0) {
96+
if (this.selectionMode === 'multi' && this.referenceList?.length > 0 && !this.bReadonly$) {
9497
this.pConn$.setReferenceList(this.selectionList);
9598
updateNewInstructions(this.pConn$, this.selectionList);
9699
}
@@ -146,6 +149,7 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
146149

147150
this.actionsApi = this.pConn$.getActionsApi();
148151
this.propName = this.pConn$.getStateProps().value;
152+
this.variant = this.configProps$.variant;
149153

150154
// multi case
151155
this.selectionMode = this.configProps$.selectionMode;
@@ -154,6 +158,7 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
154158
this.selectionList = this.configProps$.selectionList;
155159
this.selectedvalues = this.configProps$.readonlyContextList;
156160
this.primaryField = this.configProps$.primaryField;
161+
this.bReadonly$ = this.configProps$.renderMode === 'ReadOnly' || this.displayMode$ === 'DISPLAY_ONLY' || this.configProps$.readOnly;
157162

158163
this.datasource = this.configProps$.datasource;
159164
this.selectionKey = this.configProps$.selectionKey;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "Location",
3+
"label": "Location",
4+
"description": "Location",
5+
"type": "Field",
6+
"subtype": "Location",
7+
"properties": []
8+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<div *ngIf="mapReady && bVisible$">
2+
<!-- Google suggestions -->
3+
<mat-form-field class="psdk-full-width" [hintLabel]="helperText">
4+
<mat-label>{{ label$ }}</mat-label>
5+
<input
6+
matInput
7+
type="text"
8+
[placeholder]="placeholder"
9+
[formControl]="searchControl"
10+
[required]="bRequired$"
11+
[matAutocomplete]="auto"
12+
[attr.data-test-id]="testId"
13+
(blur)="fieldOnBlur()"
14+
/>
15+
<mat-error *ngIf="searchControl.invalid">{{ getErrorMessage() }}</mat-error>
16+
<button
17+
mat-icon-button
18+
matSuffix
19+
type="button"
20+
(click)="locateMe()"
21+
[disabled]="isLocating || bDisabled$ || bReadonly$"
22+
aria-label="Use my location"
23+
>
24+
<ng-container *ngIf="!isLocating; else loadingSpinner">
25+
<mat-icon>location_on</mat-icon>
26+
</ng-container>
27+
<ng-template #loadingSpinner>
28+
<mat-progress-spinner diameter="24" mode="indeterminate" strokeWidth="3"></mat-progress-spinner>
29+
</ng-template>
30+
</button>
31+
32+
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="onOptionSelected($event)">
33+
<mat-option *ngFor="let option of filteredOptions" [value]="option">
34+
{{ option }}
35+
</mat-option>
36+
</mat-autocomplete>
37+
</mat-form-field>
38+
<!-- Google map -->
39+
<div *ngIf="showMap" class="map-wrapper">
40+
<google-map height="400px" width="100%" [center]="center" [zoom]="13" (mapClick)="onMapClick($event)">
41+
<map-marker *ngIf="markerPosition" [position]="markerPosition" [title]="'Selected Location'"></map-marker>
42+
</google-map>
43+
<div class="map-blocker" *ngIf="bDisabled$ || bReadonly$"></div>
44+
</div>
45+
</div>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.psdk-full-width {
2+
width: 100%;
3+
}
4+
5+
.map-wrapper {
6+
position: relative;
7+
}
8+
9+
.map-blocker {
10+
position: absolute;
11+
top: 0;
12+
left: 0;
13+
width: 100%;
14+
height: 100%;
15+
background: transparent;
16+
z-index: 10;
17+
cursor: not-allowed;
18+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { LocationComponent } from './location.component';
4+
5+
describe('LocationComponent', () => {
6+
let component: LocationComponent;
7+
let fixture: ComponentFixture<LocationComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [LocationComponent]
12+
}).compileComponents();
13+
14+
fixture = TestBed.createComponent(LocationComponent);
15+
component = fixture.componentInstance;
16+
fixture.detectChanges();
17+
});
18+
19+
it('should create', () => {
20+
expect(component).toBeTruthy();
21+
});
22+
});

0 commit comments

Comments
 (0)