@pega/angular-sdk-overrides 0.25.7 → 0.25.9

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.
@@ -62,6 +62,7 @@
62
62
  .psdk-utility-card-icon {
63
63
  flex-grow: 1;
64
64
  max-width: 2.813rem;
65
+ filter: var(--app-primary-color-filter);
65
66
  }
66
67
 
67
68
  .psdk-utility-card-svg-icon {
@@ -107,4 +108,5 @@
107
108
  width: 1.4rem;
108
109
  display: inline-block;
109
110
  vertical-align: bottom;
111
+ filter: var(--app-primary-color-filter);
110
112
  }
@@ -2,26 +2,24 @@
2
2
  <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
3
3
  </div>
4
4
  <ng-template #noDisplayMode>
5
- <div *ngIf="bHasForm$; else noEdit">
6
- <div #f="ngForm" [formGroup]="formGroup$" *ngIf="bVisible$">
7
- <mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText" floatLabel="always">
8
- <mat-tel-input
9
- [attr.data-test-id]="testId"
10
- [formControl]="fieldControl"
11
- [preferredCountries]="preferredCountries"
12
- [enablePlaceholder]="true"
13
- [enableSearch]="true"
14
- [placeholder]="placeholder"
15
- [required]="bRequired$"
16
- [disabled]="bDisabled$ || bReadonly$"
17
- (change)="fieldOnChange()"
18
- (blur)="fieldOnBlur()"
19
- >
20
- </mat-tel-input>
21
- <mat-label>{{ label$ }}</mat-label>
22
- <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
23
- </mat-form-field>
24
- </div>
5
+ <div *ngIf="bHasForm$ && bVisible$; else noEdit">
6
+ <mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText" floatLabel="always">
7
+ <mat-tel-input
8
+ [attr.data-test-id]="testId"
9
+ [formControl]="fieldControl"
10
+ [preferredCountries]="preferredCountries"
11
+ [enablePlaceholder]="true"
12
+ [enableSearch]="true"
13
+ [placeholder]="placeholder"
14
+ [required]="bRequired$"
15
+ [disabled]="bDisabled$ || bReadonly$"
16
+ (change)="fieldOnChange()"
17
+ (blur)="fieldOnBlur()"
18
+ >
19
+ </mat-tel-input>
20
+ <mat-label>{{ label$ }}</mat-label>
21
+ <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
22
+ </mat-form-field>
25
23
  </div>
26
24
  </ng-template>
27
25
  <ng-template #noEdit>
@@ -54,8 +54,7 @@ export class PhoneComponent extends FieldBase {
54
54
  const isValueChanged = newVal?.toString() !== oldVal.toString();
55
55
 
56
56
  if (isValueChanged) {
57
- const value = this.formGroup$.controls[this.controlName$].value;
58
- handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
57
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, newVal);
59
58
  }
60
59
  }
61
60
 
@@ -435,12 +435,13 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
435
435
  const finishPromise = this.finishAssignment(this.itemKey$); // JA - was itemID but Nebula/Constellation uses itemKey
436
436
  finishPromise
437
437
  .then(() => {
438
- this.psService.sendMessage(false);
439
438
  this.updateChanges();
440
439
  })
441
440
  .catch(() => {
442
- this.psService.sendMessage(false);
443
441
  this.snackBarRef = this.snackBar.open(`${this.localizedVal('Submit failed!', this.localeCategory)}`, 'Ok');
442
+ })
443
+ .finally(() => {
444
+ this.psService.sendMessage(false);
444
445
  });
445
446
  break;
446
447
 
@@ -450,8 +451,10 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
450
451
  approvePromise
451
452
  .then(() => {})
452
453
  .catch(() => {
453
- this.psService.sendMessage(false);
454
454
  this.snackBarRef = this.snackBar.open(`${this.localizedVal('Approve failed!', this.localeCategory)}`, 'Ok');
455
+ })
456
+ .finally(() => {
457
+ this.psService.sendMessage(false);
455
458
  });
456
459
 
457
460
  break;
@@ -58,7 +58,10 @@ export class DeferLoadComponent implements OnInit, OnDestroy, OnChanges {
58
58
  // update itself (re-render)
59
59
  const theRequestedAssignment = this.pConn$.getValue(PCore.getConstants().CASE_INFO.ASSIGNMENT_LABEL);
60
60
  const lastUpdateCaseTime = this.pConn$.getValue('caseInfo.lastUpdateTime');
61
- if (theRequestedAssignment !== this.currentLoadedAssignment || (lastUpdateCaseTime && lastUpdateCaseTime !== this.lastUpdateCaseTime)) {
61
+ if (
62
+ (theRequestedAssignment && theRequestedAssignment !== this.currentLoadedAssignment) ||
63
+ (lastUpdateCaseTime && lastUpdateCaseTime !== this.lastUpdateCaseTime)
64
+ ) {
62
65
  this.currentLoadedAssignment = theRequestedAssignment;
63
66
  this.lastUpdateCaseTime = lastUpdateCaseTime;
64
67
  this.updateSelf();
@@ -155,6 +158,8 @@ export class DeferLoadComponent implements OnInit, OnDestroy, OnChanges {
155
158
  console.error('Cannot load the defer loaded view without container information');
156
159
  }
157
160
  } else if (this.resourceType === this.PAGE) {
161
+ if (!this.loadViewCaseID) return;
162
+
158
163
  // Rendering defer loaded tabs in case/ page context
159
164
  this.pConn$
160
165
  .getActionsApi()
@@ -1,7 +1,8 @@
1
1
  <div class="psdk-stages-bar">
2
2
  <div class="psdk-stages-chevron" *ngFor="let stage of arStageResults$">
3
3
  <div *ngIf="stage.visited_status == 'completed'" class="psdk-stages-inner-past">
4
- <img class="psdk-stages-icon" src="{{ checkSvgIcon$ }}" />{{ PCore$.getLocaleUtils().getLocaleValue(stage.name, '', key) }}
4
+ <img class="psdk-stages-icon" src="{{ checkSvgIcon$ }}" />
5
+ <div>{{ PCore$.getLocaleUtils().getLocaleValue(stage.name, '', key) }}</div>
5
6
  </div>
6
7
  <div *ngIf="stage.visited_status == 'active'" class="psdk-stages-inner-present">
7
8
  {{ localizationService.getLocalizedText(stage.name) }}
@@ -21,9 +21,11 @@
21
21
  }
22
22
 
23
23
  .psdk-stages-icon {
24
- width: 1.4rem;
24
+ width: 18px;
25
25
  display: inline-block;
26
26
  vertical-align: top;
27
+ filter: var(--app-primary-color-filter);
28
+ margin-right: 2px;
27
29
  }
28
30
 
29
31
  .psdk-stages-bar {
@@ -66,6 +68,8 @@
66
68
  .psdk-stages-inner-past {
67
69
  color: var(--mat-sys-outline-variant);
68
70
  font-size: 1rem;
71
+ display: flex;
72
+ align-items: center;
69
73
  }
70
74
 
71
75
  .psdk-stages-inner-present {
@@ -73,7 +73,7 @@
73
73
  </div>
74
74
  </div>
75
75
 
76
- <div>
76
+ <div *ngIf="tabData$">
77
77
  <component-mapper name="DeferLoad" [props]="{ pConn$, name: tabData$?.config?.name }"></component-mapper>
78
78
  </div>
79
79
  </div>
@@ -49,7 +49,6 @@ export class CaseViewComponent implements OnInit, OnDestroy {
49
49
  caseSummaryPConn$: any;
50
50
  currentCaseID = '';
51
51
  editAction: boolean;
52
- bHasNewAttachments = false;
53
52
  localizedVal: any;
54
53
  localeCategory = 'CaseView';
55
54
  localeKey: string;
@@ -113,14 +112,6 @@ export class CaseViewComponent implements OnInit, OnDestroy {
113
112
 
114
113
  updateHeaderAndSummary() {
115
114
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as CaseViewProps;
116
- const hasNewAttachments = this.pConn$.getDataObject().caseInfo?.hasNewAttachments;
117
-
118
- if (hasNewAttachments !== this.bHasNewAttachments) {
119
- this.bHasNewAttachments = hasNewAttachments;
120
- if (this.bHasNewAttachments) {
121
- PCore.getPubSubUtils().publish(PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, true);
122
- }
123
- }
124
115
 
125
116
  const kids = this.pConn$.getChildren() as any[];
126
117
  for (const kid of kids) {
@@ -6,7 +6,7 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
6
6
  import { getMappedKey } from '@pega/angular-sdk-components';
7
7
  import { componentCachePersistUtils } from '@pega/angular-sdk-components';
8
8
  import { getFirstChildConfig } from '@pega/angular-sdk-components';
9
- import { DataReferenceAdvancedSearchService } from './data-reference-advanced-search.service';
9
+ import { DataReferenceAdvancedSearchService } from '@pega/angular-sdk-components';
10
10
 
11
11
  const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
12
12
 
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy, OnChanges, AfterViewInit } from '@angular/core';
1
+ import { Component, OnInit, Input, forwardRef, OnDestroy, OnChanges, signal } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
4
  import { MatButtonModule } from '@angular/material/button';
@@ -31,7 +31,7 @@ interface FieldGroupTemplateProps {
31
31
  styleUrls: ['./field-group-template.component.scss'],
32
32
  imports: [CommonModule, MatButtonModule, forwardRef(() => ComponentMapperComponent)]
33
33
  })
34
- export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit {
34
+ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges {
35
35
  @Input() configProps$: FieldGroupTemplateProps;
36
36
  @Input() pConn$: typeof PConnect;
37
37
  @Input() formGroup$: FormGroup;
@@ -45,7 +45,7 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
45
45
  heading: any;
46
46
  children: any;
47
47
  menuIconOverride$: any;
48
- referenceListLength: number;
48
+ referenceListLength = signal<number | null>(null);
49
49
  fieldHeader: any;
50
50
 
51
51
  allowAdd = true;
@@ -58,10 +58,6 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
58
58
  ) {}
59
59
 
60
60
  ngOnInit(): void {
61
- // First thing in initialization is registering and subscribing to the AngularPConnect service
62
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
63
- this.updateSelf();
64
-
65
61
  this.menuIconOverride$ = this.utils.getImageSrc('trash', this.utils.getSDKStaticContentUrl());
66
62
 
67
63
  const { allowActions, allowTableEdit, referenceList } = this.configProps$;
@@ -86,16 +82,6 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
86
82
  }
87
83
  }
88
84
 
89
- onStateChange() {
90
- // Should always check the bridge to see if the component should
91
- // update itself (re-render)
92
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
93
- // ONLY call updateSelf when the component should update
94
- if (bUpdateSelf) {
95
- this.updateSelf();
96
- }
97
- }
98
-
99
85
  ngOnChanges(changes) {
100
86
  if (changes && changes.configProps$) {
101
87
  const props = changes.configProps$;
@@ -107,16 +93,14 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
107
93
  }
108
94
 
109
95
  this.updateSelf();
96
+
97
+ setTimeout(() => {
98
+ this.angularPConnect.shouldComponentUpdate(this);
99
+ }, 100);
110
100
  }
111
101
  }
112
102
  }
113
103
 
114
- ngAfterViewInit() {
115
- const resolvedList = getReferenceList(this.pConn$);
116
- // @ts-ignore - Expected 3 arguments, but got 1
117
- this.pConn$.getListActions().initDefaultPageInstructions(resolvedList);
118
- }
119
-
120
104
  updateSelf() {
121
105
  const inheritedProps: any = this.pConn$.getInheritedProps();
122
106
 
@@ -141,7 +125,10 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
141
125
  this.pConn$.setInheritedProp('displayMode', 'DISPLAY_ONLY');
142
126
  }
143
127
 
144
- if (this.referenceListLength != referenceList?.length) {
128
+ if (this.referenceListLength() != referenceList?.length) {
129
+ // @ts-ignore - Expected 3 arguments, but got 1
130
+ this.pConn$.getListActions().initDefaultPageInstructions(resolvedList);
131
+
145
132
  this.children = referenceList?.map((item, index) => {
146
133
  return {
147
134
  id: index,
@@ -151,7 +138,7 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
151
138
  };
152
139
  });
153
140
  }
154
- this.referenceListLength = referenceList?.length || 0;
141
+ this.referenceListLength.set(referenceList?.length || 0);
155
142
  }
156
143
 
157
144
  getStaticHeader = (heading, index) => {
@@ -159,14 +146,14 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
159
146
  };
160
147
 
161
148
  getDynamicHeader = (item, index) => {
162
- if (this.fieldHeader === 'propertyRef' && this.heading && item[this.heading.substring(1)]) {
149
+ if (this.heading && item[this.heading.substring(1)]) {
163
150
  return item[this.heading.substring(1)];
164
151
  }
165
152
  return `Row ${index + 1}`;
166
153
  };
167
154
 
168
155
  addFieldGroupItem() {
169
- this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceListLength);
156
+ this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceListLength() as number);
170
157
  }
171
158
 
172
159
  deleteFieldGroupItem(index) {
@@ -49,7 +49,6 @@ export class SelfServiceCaseViewComponent implements OnInit, OnDestroy {
49
49
  caseSummaryPConn$: any;
50
50
  currentCaseID = '';
51
51
  editAction: boolean;
52
- bHasNewAttachments = false;
53
52
  localizedVal: any;
54
53
  localeCategory = 'CaseView';
55
54
  localeKey: any;
@@ -117,14 +116,6 @@ export class SelfServiceCaseViewComponent implements OnInit, OnDestroy {
117
116
 
118
117
  updateHeaderAndSummary() {
119
118
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as SelfServiceCaseViewProps;
120
- const hasNewAttachments = this.pConn$.getDataObject().caseInfo?.hasNewAttachments;
121
-
122
- if (hasNewAttachments !== this.bHasNewAttachments) {
123
- this.bHasNewAttachments = hasNewAttachments;
124
- if (this.bHasNewAttachments) {
125
- PCore.getPubSubUtils().publish(PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, true);
126
- }
127
- }
128
119
 
129
120
  const kids = this.pConn$.getChildren() as any[];
130
121
  for (const kid of kids) {
@@ -126,6 +126,7 @@
126
126
 
127
127
  .psdk-attachment-card-svg-icon {
128
128
  width: 2.5rem;
129
+ filter: var(--app-primary-color-filter);
129
130
  }
130
131
 
131
132
  .psdk-utility-button {
@@ -138,6 +139,7 @@
138
139
  .psdk-utility-card-action-svg-icon {
139
140
  width: 1.4rem;
140
141
  display: inline-block;
142
+ filter: var(--app-primary-color-filter);
141
143
  }
142
144
 
143
145
  .file-div {
@@ -156,8 +156,17 @@ export class AttachmentComponent implements OnInit, OnDestroy {
156
156
  this.displayMode = displayMode;
157
157
  this.isMultiAttachmentInInlineEditTable = isTableFormatter && allowMultiple && editMode === 'tableRows';
158
158
 
159
+ const rawValue = this.pConn$.getComponentConfig().value;
160
+ const isAttachmentAnnotationPresent = typeof rawValue === 'object' ? false : rawValue?.includes('@ATTACHMENT');
161
+ const { attachments, isOldAttachment } = isAttachmentAnnotationPresent ? value : PCore.getAttachmentUtils().prepareAttachmentData(value);
162
+ const isAttachmentsChanged = !PCore.isDeepEqual(this.attachments, attachments);
163
+ this.isOldAttachment = isOldAttachment;
164
+ this.attachments = attachments;
165
+
159
166
  // update the attachments shown in the UI
160
- this.updateAttachments();
167
+ if (isAttachmentsChanged) {
168
+ this.updateAttachments();
169
+ }
161
170
  }
162
171
 
163
172
  updateAttachments() {
@@ -245,7 +254,9 @@ export class AttachmentComponent implements OnInit, OnDestroy {
245
254
  }
246
255
  }
247
256
 
248
- this.fileInput.nativeElement.value = '';
257
+ if (this.fileInput?.nativeElement) {
258
+ this.fileInput.nativeElement.value = '';
259
+ }
249
260
  }
250
261
 
251
262
  onFileAdded(event) {
@@ -411,6 +422,7 @@ export class AttachmentComponent implements OnInit, OnDestroy {
411
422
  fileResponses[index].value.thumbnail = localFile.props.thumbnail;
412
423
  localFile.inProgress = false;
413
424
  localFile.ID = fileResponses[index].value.ID;
425
+ localFile.props.id = fileResponses[index].value.ID;
414
426
  localFile.props.meta = this.localizationService.getLocalizedText('Uploaded successfully');
415
427
  localFile.props.progress = 100;
416
428
  localFile.handle = fileResponses[index].value.ID;
@@ -437,12 +449,13 @@ export class AttachmentComponent implements OnInit, OnDestroy {
437
449
  if (this.filesWithError?.length === 0) {
438
450
  clearFieldErrorMessages(this.pConn$);
439
451
  }
440
-
441
- this.actionSequencer.deRegisterBlockingAction(this.contextName).catch(() => {});
442
452
  }
453
+
454
+ this.actionSequencer.deRegisterBlockingAction(this.contextName).catch(() => {});
443
455
  })
444
456
  .catch(error => {
445
457
  console.log(error);
458
+ this.actionSequencer.cancelDeferredActionsOnError(this.contextName);
446
459
  });
447
460
  }
448
461
 
@@ -63,6 +63,7 @@
63
63
  .psdk-utility-svg-icon {
64
64
  width: 1.4rem;
65
65
  display: inline-block;
66
+ filter: var(--app-primary-color-filter);
66
67
  }
67
68
 
68
69
  .psdk-settings-svg-icon {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.25.7",
3
+ "version": "0.25.9",
4
4
  "description": "Angular SDK - Code for overriding components",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,16 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { BehaviorSubject } from 'rxjs';
3
-
4
- @Injectable({ providedIn: 'root' })
5
- export class DataReferenceAdvancedSearchService {
6
- private configSubject = new BehaviorSubject(null);
7
- config$ = this.configSubject.asObservable();
8
-
9
- setConfig(config) {
10
- this.configSubject.next(config);
11
- }
12
-
13
- getConfig() {
14
- return this.configSubject.getValue();
15
- }
16
- }