@pega/angular-sdk-overrides 0.25.4 → 0.25.5
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.
- package/lib/field/date-time/date-time.component.ts +0 -2
- package/lib/field/location/location.component.html +2 -2
- package/lib/field/location/location.component.ts +20 -125
- package/lib/infra/navbar/navbar.component.html +11 -13
- package/lib/infra/navbar/navbar.component.scss +5 -0
- package/lib/infra/reference/reference.component.ts +5 -0
- package/lib/template/list-view/list-view.component.ts +2 -0
- package/lib/widget/file-utility/file-utility.component.scss +1 -1
- package/package.json +1 -1
|
@@ -4,9 +4,7 @@ import { ReactiveFormsModule } from '@angular/forms';
|
|
|
4
4
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
5
5
|
import { MatInputModule } from '@angular/material/input';
|
|
6
6
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
-
|
|
8
7
|
import { ScrollStrategyOptions } from '@angular/cdk/overlay';
|
|
9
|
-
|
|
10
8
|
import { OwlDateTimeModule, OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker';
|
|
11
9
|
import dayjs from 'dayjs';
|
|
12
10
|
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
matInput
|
|
7
7
|
type="text"
|
|
8
8
|
[placeholder]="placeholder"
|
|
9
|
-
[formControl]="
|
|
9
|
+
[formControl]="fieldControl"
|
|
10
10
|
[required]="bRequired$"
|
|
11
11
|
[matAutocomplete]="auto"
|
|
12
12
|
[attr.data-test-id]="testId"
|
|
13
13
|
(blur)="fieldOnBlur()"
|
|
14
14
|
/>
|
|
15
|
-
<mat-error *ngIf="
|
|
15
|
+
<mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
|
|
16
16
|
<button
|
|
17
17
|
mat-icon-button
|
|
18
18
|
matSuffix
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component, inject } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
3
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
5
|
import { MatInputModule } from '@angular/material/input';
|
|
6
6
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
@@ -8,12 +8,10 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
|
8
8
|
import { MatIconModule } from '@angular/material/icon';
|
|
9
9
|
import { MatButtonModule } from '@angular/material/button';
|
|
10
10
|
import { GoogleMapsModule } from '@angular/google-maps';
|
|
11
|
+
import { debounceTime, from, of, switchMap } from 'rxjs';
|
|
11
12
|
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
13
|
+
import { FieldBase } from '@pega/angular-sdk-components';
|
|
15
14
|
import { GoogleMapsLoaderService } from '@pega/angular-sdk-components';
|
|
16
|
-
import { Utils } from '@pega/angular-sdk-components';
|
|
17
15
|
import { handleEvent } from '@pega/angular-sdk-components';
|
|
18
16
|
|
|
19
17
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
@@ -41,9 +39,8 @@ interface LocationProps extends PConnFieldProps {
|
|
|
41
39
|
templateUrl: './location.component.html',
|
|
42
40
|
styleUrl: './location.component.scss'
|
|
43
41
|
})
|
|
44
|
-
export class LocationComponent
|
|
45
|
-
|
|
46
|
-
@Input() formGroup$: FormGroup;
|
|
42
|
+
export class LocationComponent extends FieldBase {
|
|
43
|
+
private loader = inject(GoogleMapsLoaderService);
|
|
47
44
|
|
|
48
45
|
private autocompleteService!: google.maps.places.AutocompleteService;
|
|
49
46
|
private geocoder!: google.maps.Geocoder;
|
|
@@ -51,137 +48,52 @@ export class LocationComponent implements OnInit, OnDestroy {
|
|
|
51
48
|
// Dom variables
|
|
52
49
|
mapReady = false;
|
|
53
50
|
isLocating = false;
|
|
54
|
-
searchControl = new FormControl('');
|
|
55
51
|
showMap = true;
|
|
56
52
|
filteredOptions: string[] = [];
|
|
57
53
|
center: google.maps.LatLngLiteral;
|
|
58
54
|
markerPosition: google.maps.LatLngLiteral | null = null;
|
|
59
55
|
|
|
60
|
-
// Used with AngularPConnect
|
|
61
|
-
angularPConnectData: AngularPConnectData = {};
|
|
62
56
|
configProps$: LocationProps;
|
|
63
|
-
label$ = '';
|
|
64
57
|
onlyCoordinates: boolean;
|
|
65
58
|
coordinates: string;
|
|
66
|
-
bRequired$ = false;
|
|
67
|
-
bReadonly$ = false;
|
|
68
59
|
showMapReadOnly$: boolean;
|
|
69
|
-
bDisabled$ = false;
|
|
70
|
-
bVisible$ = true;
|
|
71
|
-
controlName$: string;
|
|
72
|
-
bHasForm$ = true;
|
|
73
|
-
testId = '';
|
|
74
|
-
helperText: string;
|
|
75
|
-
placeholder: string;
|
|
76
|
-
actionsApi: object;
|
|
77
60
|
valueProp: string;
|
|
78
61
|
coordinatesProp: string;
|
|
79
62
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
private angularPConnect: AngularPConnectService,
|
|
83
|
-
private utils: Utils,
|
|
84
|
-
private cdRef: ChangeDetectorRef
|
|
85
|
-
) {}
|
|
63
|
+
override async ngOnInit() {
|
|
64
|
+
super.ngOnInit();
|
|
86
65
|
|
|
87
|
-
async ngOnInit() {
|
|
88
66
|
// Loading map
|
|
89
67
|
const apiKey = this.pConn$.getGoogleMapsAPIKey();
|
|
90
68
|
await this.loader.load(apiKey);
|
|
91
69
|
this.mapReady = true;
|
|
92
70
|
this.initializeGoogleServices();
|
|
93
71
|
this.getPlacePredictions();
|
|
94
|
-
|
|
95
|
-
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
96
|
-
this.controlName$ = this.angularPConnect.getComponentID(this);
|
|
97
|
-
this.checkAndUpdate();
|
|
98
|
-
|
|
99
|
-
if (this.formGroup$) {
|
|
100
|
-
// add control to formGroup
|
|
101
|
-
this.formGroup$.addControl(this.controlName$, this.searchControl);
|
|
102
|
-
this.bHasForm$ = true;
|
|
103
|
-
} else {
|
|
104
|
-
this.bReadonly$ = true;
|
|
105
|
-
this.bHasForm$ = false;
|
|
106
|
-
}
|
|
107
72
|
}
|
|
108
73
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
this.angularPConnectData.unsubscribeFn();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
checkAndUpdate() {
|
|
120
|
-
const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
|
|
121
|
-
if (bUpdateSelf) {
|
|
122
|
-
this.updateSelf();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
74
|
+
/**
|
|
75
|
+
* Updates the component when there are changes in the state.
|
|
76
|
+
*/
|
|
77
|
+
override updateSelf(): void {
|
|
78
|
+
// Resolve configuration properties
|
|
79
|
+
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as LocationProps;
|
|
125
80
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
this.checkAndUpdate();
|
|
129
|
-
}, 0);
|
|
130
|
-
}
|
|
81
|
+
// Update component common properties
|
|
82
|
+
this.updateComponentCommonProperties(this.configProps$);
|
|
131
83
|
|
|
132
|
-
updateSelf(): void {
|
|
133
|
-
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as LocationProps;
|
|
134
|
-
if (this.configProps$.visibility != null) {
|
|
135
|
-
this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
|
|
136
|
-
}
|
|
137
84
|
this.onlyCoordinates = !!this.configProps$.onlyCoordinates;
|
|
138
|
-
this.label$ = this.configProps$.label;
|
|
139
|
-
this.testId = this.configProps$.testId;
|
|
140
|
-
|
|
141
|
-
this.helperText = this.configProps$.helperText || '';
|
|
142
|
-
this.placeholder = this.configProps$.placeholder || '';
|
|
143
85
|
this.showMapReadOnly$ = !!this.configProps$.showMapReadOnly;
|
|
144
|
-
if (this.configProps$.readOnly != null) {
|
|
145
|
-
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
146
|
-
}
|
|
147
86
|
this.showMap = this.bReadonly$ ? this.showMapReadOnly$ : !!this.configProps$.showMap;
|
|
87
|
+
|
|
148
88
|
if (this.configProps$.coordinates) {
|
|
149
89
|
const latAndLong: number[] = this.configProps$.coordinates.split(',').map(Number);
|
|
150
90
|
const latitude = Number(latAndLong[0]);
|
|
151
91
|
const longitude = Number(latAndLong[1]);
|
|
152
92
|
this.updateMap(latitude, longitude, this.configProps$.value);
|
|
153
93
|
}
|
|
154
|
-
// // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
155
|
-
setTimeout(() => {
|
|
156
|
-
if (this.configProps$.required != null) {
|
|
157
|
-
this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
|
|
158
|
-
}
|
|
159
|
-
this.cdRef.detectChanges();
|
|
160
|
-
});
|
|
161
|
-
// // disabled
|
|
162
|
-
if (this.configProps$.disabled != undefined) {
|
|
163
|
-
this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
|
|
164
|
-
}
|
|
165
94
|
|
|
166
|
-
if (this.bDisabled$ || this.bReadonly$) {
|
|
167
|
-
this.searchControl.disable();
|
|
168
|
-
} else {
|
|
169
|
-
this.searchControl.enable();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
this.actionsApi = this.pConn$.getActionsApi();
|
|
173
95
|
this.valueProp = this.pConn$.getStateProps().value;
|
|
174
96
|
this.coordinatesProp = this.pConn$.getStateProps().coordinates;
|
|
175
|
-
|
|
176
|
-
// // trigger display of error message with field control
|
|
177
|
-
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
178
|
-
const timer = interval(100).subscribe(() => {
|
|
179
|
-
this.searchControl.setErrors({ message: true });
|
|
180
|
-
this.searchControl.markAsTouched();
|
|
181
|
-
|
|
182
|
-
timer.unsubscribe();
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
97
|
}
|
|
186
98
|
|
|
187
99
|
onOptionSelected(event: any) {
|
|
@@ -236,23 +148,6 @@ export class LocationComponent implements OnInit, OnDestroy {
|
|
|
236
148
|
}
|
|
237
149
|
}
|
|
238
150
|
|
|
239
|
-
getErrorMessage() {
|
|
240
|
-
let errMessage = '';
|
|
241
|
-
|
|
242
|
-
// look for validation messages for json, pre-defined or just an error pushed from workitem (400)
|
|
243
|
-
if (this.searchControl.hasError('message')) {
|
|
244
|
-
errMessage = this.angularPConnectData.validateMessage ?? '';
|
|
245
|
-
return errMessage;
|
|
246
|
-
}
|
|
247
|
-
if (this.searchControl.hasError('required')) {
|
|
248
|
-
errMessage = 'You must enter a value';
|
|
249
|
-
} else if (this.searchControl.errors) {
|
|
250
|
-
errMessage = this.searchControl.errors.toString();
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return errMessage;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
151
|
private tryGetLocation(retryCount: number) {
|
|
257
152
|
navigator.geolocation.getCurrentPosition(
|
|
258
153
|
position => {
|
|
@@ -312,7 +207,7 @@ export class LocationComponent implements OnInit, OnDestroy {
|
|
|
312
207
|
}
|
|
313
208
|
|
|
314
209
|
private getPlacePredictions() {
|
|
315
|
-
this.
|
|
210
|
+
this.fieldControl.valueChanges
|
|
316
211
|
.pipe(
|
|
317
212
|
debounceTime(300),
|
|
318
213
|
switchMap(value => this.getSuggestions(value || ''))
|
|
@@ -371,7 +266,7 @@ export class LocationComponent implements OnInit, OnDestroy {
|
|
|
371
266
|
}
|
|
372
267
|
|
|
373
268
|
private updateProps() {
|
|
374
|
-
handleEvent(this.actionsApi, 'change', this.valueProp, this.
|
|
269
|
+
handleEvent(this.actionsApi, 'change', this.valueProp, this.fieldControl.value);
|
|
375
270
|
handleEvent(this.actionsApi, 'change', this.coordinatesProp, this.coordinates);
|
|
376
271
|
}
|
|
377
272
|
|
|
@@ -380,6 +275,6 @@ export class LocationComponent implements OnInit, OnDestroy {
|
|
|
380
275
|
}
|
|
381
276
|
|
|
382
277
|
private setLocationValue(value: string) {
|
|
383
|
-
this.
|
|
278
|
+
this.fieldControl.setValue(value, { emitEvent: false });
|
|
384
279
|
}
|
|
385
280
|
}
|
|
@@ -36,17 +36,15 @@
|
|
|
36
36
|
</mat-list-item>
|
|
37
37
|
</mat-list>
|
|
38
38
|
<div class="psdk-nav-divider"></div>
|
|
39
|
-
<
|
|
40
|
-
<mat-list
|
|
41
|
-
<
|
|
42
|
-
<div class="
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<mat-menu
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</mat-list>
|
|
51
|
-
</div>
|
|
39
|
+
<mat-list id="profile" class="psdk-logout-button">
|
|
40
|
+
<mat-list-item [matMenuTriggerFor]="menu" class="psdk-profile-list-item">
|
|
41
|
+
<div class="flex-box">
|
|
42
|
+
<div class="psdk-nav-oper-avatar">{{ portalOperatorInitials$ }}</div>
|
|
43
|
+
<span class="psdk-nav-button-span">{{ portalOperator$ }}</span>
|
|
44
|
+
</div>
|
|
45
|
+
</mat-list-item>
|
|
46
|
+
<mat-menu #menu="matMenu">
|
|
47
|
+
<button mat-menu-item (click)="navPanelLogoutClick()">{{ localizedVal('Log off', localeCategory) }}</button>
|
|
48
|
+
</mat-menu>
|
|
49
|
+
</mat-list>
|
|
52
50
|
</div>
|
|
@@ -71,6 +71,11 @@ export class ReferenceComponent {
|
|
|
71
71
|
pageReference: context && context.startsWith('@CLASS') ? '' : context
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
+
if (referenceConfig.inheritedProps && referenceConfig.inheritedProps.length > 0) {
|
|
75
|
+
const inheritedProps = inPConn.getInheritedProps();
|
|
76
|
+
referenceConfig.inheritedProps = Object.keys(inheritedProps).map(prop => ({ prop, value: inheritedProps[prop] }));
|
|
77
|
+
}
|
|
78
|
+
|
|
74
79
|
// Get the PConnect object from the created component
|
|
75
80
|
const newCompPConnect = viewComponent.getPConnect();
|
|
76
81
|
|
|
@@ -46,6 +46,7 @@ interface ListViewProps {
|
|
|
46
46
|
displayAs?: string;
|
|
47
47
|
showRecords: boolean;
|
|
48
48
|
viewName?: string;
|
|
49
|
+
localeReference?: any;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
export class Group {
|
|
@@ -516,6 +517,7 @@ export class ListViewComponent implements OnInit, OnDestroy {
|
|
|
516
517
|
const arReturn = arFields;
|
|
517
518
|
arReturn.forEach((field, i) => {
|
|
518
519
|
field.config = { ...field.config, ...fields[i], name: fields[i].id };
|
|
520
|
+
field.config.label = PCore.getLocaleUtils().getLocaleValue(field.config.label, this.configProps$.localeReference);
|
|
519
521
|
});
|
|
520
522
|
return arReturn;
|
|
521
523
|
}
|