@pega/angular-sdk-overrides 0.25.8 → 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.
@@ -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,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) {
@@ -159,11 +159,12 @@ export class AttachmentComponent implements OnInit, OnDestroy {
159
159
  const rawValue = this.pConn$.getComponentConfig().value;
160
160
  const isAttachmentAnnotationPresent = typeof rawValue === 'object' ? false : rawValue?.includes('@ATTACHMENT');
161
161
  const { attachments, isOldAttachment } = isAttachmentAnnotationPresent ? value : PCore.getAttachmentUtils().prepareAttachmentData(value);
162
+ const isAttachmentsChanged = !PCore.isDeepEqual(this.attachments, attachments);
162
163
  this.isOldAttachment = isOldAttachment;
163
164
  this.attachments = attachments;
164
165
 
165
166
  // update the attachments shown in the UI
166
- if (this.attachments.length) {
167
+ if (isAttachmentsChanged) {
167
168
  this.updateAttachments();
168
169
  }
169
170
  }
@@ -421,6 +422,7 @@ export class AttachmentComponent implements OnInit, OnDestroy {
421
422
  fileResponses[index].value.thumbnail = localFile.props.thumbnail;
422
423
  localFile.inProgress = false;
423
424
  localFile.ID = fileResponses[index].value.ID;
425
+ localFile.props.id = fileResponses[index].value.ID;
424
426
  localFile.props.meta = this.localizationService.getLocalizedText('Uploaded successfully');
425
427
  localFile.props.progress = 100;
426
428
  localFile.handle = fileResponses[index].value.ID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.25.8",
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"