@pega/angular-sdk-overrides 0.24.5 → 0.24.6

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.
@@ -45,8 +45,11 @@ export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
45
45
  }
46
46
  }
47
47
 
48
+ // eslint-disable-next-line @angular-eslint/no-empty-lifecycle-method
48
49
  ngOnDestroy(): void {
49
- this.renderer.destroy();
50
+ // Ref: https://medium.com/@kamil.galek/mythical-angular-component-styles-cleanup-in-angular-17-f799a08b2abc
51
+ // Commenting the below line as it is causing the Operator component's styles not getting applied.
52
+ // this.renderer.destroy();
50
53
  }
51
54
 
52
55
  updateSelf(): void {
@@ -13,11 +13,11 @@
13
13
  [placeholder]="placeholder"
14
14
  [formControl]="fieldControl"
15
15
  (blur)="fieldOnBlur($event)"
16
- (dateTimeChange)="fieldOnBlur($event)"
16
+ (dateTimeChange)="fieldOnDateChange($event)"
17
17
  [value]="value$"
18
18
  [required]="bRequired$"
19
19
  />
20
- <mat-datepicker-toggle matSuffix [for]="$any(dtPicker)" [owlDateTimeTrigger]="dtPicker"></mat-datepicker-toggle>
20
+ <mat-datepicker-toggle matSuffix [owlDateTimeTrigger]="dtPicker"></mat-datepicker-toggle>
21
21
  <owl-date-time #dtPicker></owl-date-time>
22
22
  <mat-error *ngIf="fieldControl?.invalid">{{ getErrorMessage() }}</mat-error>
23
23
  </mat-form-field>
@@ -168,6 +168,15 @@ export class DateTimeComponent implements OnInit, OnDestroy {
168
168
  }
169
169
  }
170
170
 
171
+ fieldOnDateChange(event: any) {
172
+ // this comes from the date pop up
173
+ if (typeof event.value === 'object') {
174
+ // convert date to pega "date" format
175
+ event.value = event.value?.toISOString();
176
+ }
177
+ this.angularPConnectData.actions?.onChange(this, { value: event.value });
178
+ }
179
+
171
180
  fieldOnBlur(event: any) {
172
181
  if (typeof event.value === 'object') {
173
182
  // convert date to pega "date" format
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "RichText",
3
+ "label": "Rich text editor",
4
+ "description": "Text (paragraph)",
5
+ "type": "Field",
6
+ "subtype": "Text-Paragraph",
7
+ "icon": "images/pz-text-area-active.svg",
8
+ "properties": [],
9
+ "defaultConfig": {}
10
+ }
@@ -0,0 +1,22 @@
1
+ import { Injector } from '@angular/core';
2
+ import { AngularPConnectData, AngularPConnectService } from 'packages/angular-sdk-components/src/public-api';
3
+ import { getPConnectOfActiveContainerItem } from './helper';
4
+
5
+ export class FlowContainerBaseComponent {
6
+ // For interaction with AngularPConnect
7
+ protected angularPConnectData: AngularPConnectData = {};
8
+ protected angularPConnect;
9
+
10
+ constructor(injector: Injector) {
11
+ this.angularPConnect = injector.get(AngularPConnectService);
12
+ }
13
+
14
+ getPConnectOfActiveContainerItem(parentPConnect) {
15
+ const routingInfo = this.angularPConnect.getComponentProp(this, 'routingInfo');
16
+ const isAssignmentView = this.angularPConnect.getComponentProp(this, 'isAssignmentView');
17
+ return getPConnectOfActiveContainerItem(routingInfo, {
18
+ isAssignmentView,
19
+ parentPConnect
20
+ });
21
+ }
22
+ }
@@ -0,0 +1,89 @@
1
+ const processRootViewDetails = (rootView, containerItem, options) => {
2
+ const {
3
+ config: { context: viewContext, name: viewName }
4
+ } = rootView;
5
+ const { context: containerContext } = containerItem;
6
+ const { parentPConnect } = options;
7
+ let resolvedViewName = viewName;
8
+ let resolvedViewContext = viewContext;
9
+
10
+ const isAnnotedViewName = PCore.getAnnotationUtils().isProperty(viewName);
11
+ const isAnnotedViewContext = PCore.getAnnotationUtils().isProperty(viewContext);
12
+
13
+ // resolving annoted view context
14
+ if (isAnnotedViewContext) {
15
+ const viewContextProperty = PCore.getAnnotationUtils().getPropertyName(viewContext);
16
+ resolvedViewContext = PCore.getStoreValue(
17
+ `.${viewContextProperty}`,
18
+ viewContextProperty.startsWith('.') ? parentPConnect.getPageReference() : '',
19
+ containerContext
20
+ );
21
+ }
22
+
23
+ if (!resolvedViewContext) {
24
+ resolvedViewContext = parentPConnect.getPageReference();
25
+ }
26
+
27
+ // resolving annoted view name
28
+ if (isAnnotedViewName) {
29
+ const viewNameProperty = PCore.getAnnotationUtils().getPropertyName(viewName);
30
+ resolvedViewName = PCore.getStoreValue(`.${viewNameProperty}`, resolvedViewContext, containerContext);
31
+ }
32
+
33
+ /* Special case where context and viewname are dynamic values
34
+ Use case - split for each shape
35
+ Ex - (caseInfo.content.SCRequestWorkQueues[1]):context --> .pyViewName:viewName
36
+ */
37
+ if (isAnnotedViewName && isAnnotedViewContext && resolvedViewName !== '') {
38
+ /* Allow context processor to resolve view and context when both are dynamic */
39
+ resolvedViewName = viewName;
40
+ resolvedViewContext = viewContext;
41
+ }
42
+
43
+ return {
44
+ viewName: resolvedViewName,
45
+ viewContext: resolvedViewContext
46
+ };
47
+ };
48
+
49
+ export const getPConnectOfActiveContainerItem = (containerInfo, options) => {
50
+ const { accessedOrder, items } = containerInfo;
51
+ const { isAssignmentView = false, parentPConnect } = options;
52
+ const containerName = parentPConnect.getContainerName();
53
+ const { CONTAINER_NAMES } = PCore.getContainerUtils();
54
+ const { CREATE_DETAILS_VIEW_NAME } = PCore.getConstants();
55
+
56
+ if (accessedOrder && items) {
57
+ const activeContainerItemKey = accessedOrder[accessedOrder.length - 1];
58
+
59
+ if (items[activeContainerItemKey] && items[activeContainerItemKey].view && Object.keys(items[activeContainerItemKey].view).length > 0) {
60
+ const activeContainerItem = items[activeContainerItemKey];
61
+ const target = activeContainerItemKey.substring(0, activeContainerItemKey.lastIndexOf('_'));
62
+
63
+ const { view: rootView, context } = activeContainerItem;
64
+ const { viewName, viewContext } = processRootViewDetails(rootView, activeContainerItem, { parentPConnect });
65
+
66
+ if (!viewName) return null;
67
+
68
+ const config = {
69
+ meta: rootView,
70
+ options: {
71
+ context,
72
+ pageReference: viewContext || parentPConnect.getPageReference(),
73
+ containerName,
74
+ containerItemID: activeContainerItemKey,
75
+ parentPageReference: parentPConnect.getPageReference(),
76
+ hasForm:
77
+ isAssignmentView ||
78
+ containerName === CONTAINER_NAMES.WORKAREA ||
79
+ containerName === CONTAINER_NAMES.MODAL ||
80
+ viewName === CREATE_DETAILS_VIEW_NAME,
81
+ target
82
+ }
83
+ };
84
+
85
+ return PCore.createPConnect(config).getPConnect();
86
+ }
87
+ }
88
+ return null;
89
+ };
@@ -8,9 +8,10 @@
8
8
  </div>
9
9
  <div *ngIf="todo_showTodo$">
10
10
  <component-mapper
11
+ *ngIf="pConnectOfActiveContainerItem"
11
12
  name="Todo"
12
13
  [props]="{
13
- pConn$: todo_pConn$,
14
+ pConn$: pConnectOfActiveContainerItem,
14
15
  caseInfoID$: todo_caseInfoID$,
15
16
  datasource$: todo_datasource$,
16
17
  showTodoList$: todo_showTodoList$,
@@ -22,7 +23,11 @@
22
23
  ></component-mapper>
23
24
  </div>
24
25
  <div *ngIf="!todo_showTodo$">
25
- <component-mapper name="Assignment" [props]="{ pConn$, formGroup$, arChildren$, itemKey$ }"></component-mapper>
26
+ <component-mapper
27
+ *ngIf="pConnectOfActiveContainerItem"
28
+ name="Assignment"
29
+ [props]="{ pConn$: pConnectOfActiveContainerItem, formGroup$, arChildren$, itemKey$ }"
30
+ ></component-mapper>
26
31
  </div>
27
32
  </div>
28
33
  <div *ngIf="bHasCaseMessages$">
@@ -1,14 +1,14 @@
1
- import { Component, OnInit, Input, ChangeDetectorRef, NgZone, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, OnInit, Input, ChangeDetectorRef, NgZone, forwardRef, OnDestroy, Injector } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormBuilder, FormGroup } from '@angular/forms';
4
4
  import { MatCardModule } from '@angular/material/card';
5
5
  import { publicConstants } from '@pega/pcore-pconnect-typedefs/constants';
6
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
7
6
  import { ProgressSpinnerService } from '@pega/angular-sdk-components';
8
7
  import { ReferenceComponent } from '@pega/angular-sdk-components';
9
8
  import { Utils } from '@pega/angular-sdk-components';
10
9
  import { getToDoAssignments, showBanner } from './helpers';
11
10
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
+ import { FlowContainerBaseComponent } from '@pega/angular-sdk-components';
12
12
 
13
13
  /**
14
14
  * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
@@ -32,11 +32,9 @@ interface FlowContainerProps {
32
32
  standalone: true,
33
33
  imports: [CommonModule, MatCardModule, forwardRef(() => ComponentMapperComponent)]
34
34
  })
35
- export class FlowContainerComponent implements OnInit, OnDestroy {
35
+ export class FlowContainerComponent extends FlowContainerBaseComponent implements OnInit, OnDestroy {
36
36
  @Input() pConn$: typeof PConnect;
37
37
 
38
- // For interaction with AngularPConnect
39
- angularPConnectData: AngularPConnectData = {};
40
38
  pCoreConstants: typeof publicConstants;
41
39
  configProps$: FlowContainerProps;
42
40
 
@@ -72,14 +70,17 @@ export class FlowContainerComponent implements OnInit, OnDestroy {
72
70
  banners: any[];
73
71
  // itemKey: string = ""; // JA - this is what Nebula/Constellation uses to pass to finishAssignment, navigateToStep
74
72
 
73
+ pConnectOfActiveContainerItem;
74
+
75
75
  constructor(
76
- private angularPConnect: AngularPConnectService,
76
+ injector: Injector,
77
77
  private cdRef: ChangeDetectorRef,
78
78
  private psService: ProgressSpinnerService,
79
79
  private fb: FormBuilder,
80
80
  private ngZone: NgZone,
81
81
  private utils: Utils
82
82
  ) {
83
+ super(injector);
83
84
  // create the formGroup
84
85
  this.formGroup$ = this.fb.group({ hideRequired: false });
85
86
  }
@@ -148,10 +149,14 @@ export class FlowContainerComponent implements OnInit, OnDestroy {
148
149
  // Should always check the bridge to see if the component should update itself (re-render)
149
150
  const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
150
151
 
152
+ const pConn = this.pConnectOfActiveContainerItem || this.pConn$;
153
+ const caseViewModeFromProps = this.angularPConnect.getComponentProp(this, 'caseViewMode');
154
+ const caseViewModeFromRedux = pConn.getValue('context_data.caseViewMode', '');
155
+
151
156
  // ONLY call updateSelf when the component should update
152
157
  // AND removing the "gate" that was put there since shouldComponentUpdate
153
158
  // should be the real "gate"
154
- if (bUpdateSelf) {
159
+ if (bUpdateSelf || caseViewModeFromProps !== caseViewModeFromRedux) {
155
160
  // don't want to redraw the flow container when there are page messages, because
156
161
  // the redraw causes us to loose the errors on the elements
157
162
  const completeProps = this.angularPConnect.getCurrentCompleteProps(this) as FlowContainerProps;
@@ -369,7 +374,9 @@ export class FlowContainerComponent implements OnInit, OnDestroy {
369
374
  // const { getPConnect } = this.arChildren$[0].getPConnect();
370
375
  const localPConn = this.arChildren$[0].getPConnect();
371
376
 
372
- const caseViewMode = this.pConn$.getValue('context_data.caseViewMode');
377
+ this.pConnectOfActiveContainerItem = this.getPConnectOfActiveContainerItem(this.pConn$) || this.pConn$;
378
+
379
+ const caseViewMode = this.pConnectOfActiveContainerItem.getValue('context_data.caseViewMode');
373
380
  this.bShowBanner = showBanner(this.pConn$);
374
381
 
375
382
  if (caseViewMode && caseViewMode == 'review') {
@@ -6,6 +6,7 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
6
6
  import { ProgressSpinnerService } from '@pega/angular-sdk-components';
7
7
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
8
8
  import { getBanners } from '@pega/angular-sdk-components';
9
+ import { ReferenceComponent } from '@pega/angular-sdk-components';
9
10
 
10
11
  /**
11
12
  * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
@@ -200,7 +201,7 @@ export class ModalViewContainerComponent implements OnInit, OnDestroy {
200
201
  }
201
202
 
202
203
  createView(routingInfo, currentItem, latestItem, key) {
203
- const configObject = this.getConfigObject(currentItem, this.pConn$);
204
+ const configObject = this.getConfigObject(currentItem, null, false);
204
205
  const newComp = configObject?.getPConnect();
205
206
  // const newCompName = newComp.getComponentName();
206
207
  const caseInfo = newComp && newComp.getDataObject() && newComp.getDataObject().caseInfo ? newComp.getDataObject().caseInfo : null;
@@ -247,8 +248,17 @@ export class ModalViewContainerComponent implements OnInit, OnDestroy {
247
248
  ID,
248
249
  `${theNewCaseInfo?.getClassName()}!CASE!${theNewCaseInfo.getName()}`.toUpperCase()
249
250
  );
250
- // // update children with new view's children
251
- this.arChildren$ = newComp.getChildren() as any[];
251
+
252
+ const bIsRefComponent = this.checkIfRefComponent(newComp);
253
+
254
+ if (bIsRefComponent) {
255
+ const newPConn = ReferenceComponent.normalizePConn(newComp);
256
+ this.arChildren$ = ReferenceComponent.normalizePConnArray(newPConn.getChildren());
257
+ } else {
258
+ // update children with new view's children
259
+ this.arChildren$ = newComp.getChildren();
260
+ }
261
+
252
262
  this.bShowModal$ = true;
253
263
 
254
264
  // for when non modal
@@ -279,16 +289,30 @@ export class ModalViewContainerComponent implements OnInit, OnDestroy {
279
289
  });
280
290
  }
281
291
 
282
- getConfigObject(item, pConnect) {
292
+ getConfigObject(item, pConnect, isReverseCoexistence = false) {
293
+ let config;
294
+ if (isReverseCoexistence) {
295
+ config = {
296
+ options: {
297
+ pageReference: pConnect?.getPageReference(),
298
+ hasForm: true,
299
+ containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL
300
+ }
301
+ };
302
+ return PCore.createPConnect(config);
303
+ }
283
304
  if (item) {
284
- const { context, view } = item;
285
- const config = {
305
+ const { context, view, isBulkAction } = item;
306
+ const target = PCore.getContainerUtils().getTargetFromContainerItemID(context);
307
+ config = {
286
308
  meta: view,
287
309
  options: {
288
310
  context,
289
311
  pageReference: view.config.context || pConnect.getPageReference(),
290
312
  hasForm: true,
291
- containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL
313
+ ...(isBulkAction && { isBulkAction }),
314
+ containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL,
315
+ target
292
316
  }
293
317
  };
294
318
  return PCore.createPConnect(config);
@@ -296,6 +320,15 @@ export class ModalViewContainerComponent implements OnInit, OnDestroy {
296
320
  return null;
297
321
  }
298
322
 
323
+ checkIfRefComponent(thePConn: any): boolean {
324
+ let bReturn = false;
325
+ if (thePConn && thePConn.getComponentName() == 'reference') {
326
+ bReturn = true;
327
+ }
328
+
329
+ return bReturn;
330
+ }
331
+
299
332
  onAlertState(bData: boolean) {
300
333
  this.bAlertState = bData;
301
334
  this.bShowCancelAlert$ = false;
@@ -38,7 +38,6 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
38
38
  newPConn$: any;
39
39
  containerName$: string;
40
40
 
41
- bIsRefComponent = false;
42
41
  bInitialized = false;
43
42
 
44
43
  templateName$: string;
@@ -129,45 +128,19 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
129
128
  }
130
129
 
131
130
  updateChanges() {
132
- this.bIsRefComponent = this.checkIfRefComponent(this.pConn$);
133
-
134
- this.ngZone.run(() => {
135
- // pConn$ may be a 'reference' component, so normalize it
136
- // this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$);
137
- this.newPConn$ = ReferenceComponent.normalizePConn(this.pConn$);
138
-
139
- // If 'reference' so we need to get the children of the normalized pConn
140
- if (this.bIsRefComponent) {
141
- // this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
142
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.newPConn$.getChildren());
143
- }
144
- });
145
-
146
- this.createButtons();
147
- }
131
+ // pConn$ may be a 'reference' component, so normalize it
132
+ this.newPConn$ = ReferenceComponent.normalizePConn(this.pConn$);
148
133
 
149
- checkIfRefComponent(thePConn: any): boolean {
150
- let bReturn = false;
151
- if (thePConn && thePConn.getComponentName() == 'reference') {
152
- bReturn = true;
134
+ if (this.arChildren$) {
135
+ this.createButtons();
153
136
  }
154
-
155
- return bReturn;
156
137
  }
157
138
 
158
139
  initComponent() {
159
- this.bIsRefComponent = this.checkIfRefComponent(this.pConn$);
160
-
161
140
  // pConn$ may be a 'reference' component, so normalize it
162
141
  // this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$);
163
142
  this.newPConn$ = ReferenceComponent.normalizePConn(this.pConn$);
164
143
 
165
- // If 'reference' so we need to get the children of the normalized pConn
166
- if (this.bIsRefComponent) {
167
- // this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
168
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.newPConn$.getChildren());
169
- }
170
-
171
144
  // prevent re-intializing with flowContainer update unless an action is taken
172
145
  this.bReInit = false;
173
146
  this.bHasNavigation$ = false;
@@ -210,7 +183,9 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
210
183
  this.approveCase = actionsAPI.approveCase?.bind(actionsAPI);
211
184
  this.rejectCase = actionsAPI.rejectCase?.bind(actionsAPI);
212
185
 
213
- this.createButtons();
186
+ if (this.arChildren$) {
187
+ this.createButtons();
188
+ }
214
189
  }
215
190
 
216
191
  createButtons() {
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "BannerPage",
3
+ "label": "Banner",
4
+ "description": "Banner Page Template",
5
+ "type": "Template",
6
+ "subtype": "PAGE",
7
+ "icon": "BannerPage.svg",
8
+ "properties": []
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "InlineDashboardPage",
3
+ "label": "Inline Dashboard",
4
+ "description": "Inline Dashboard Page Template",
5
+ "type": "Template",
6
+ "subtype": "PAGE",
7
+ "icon": "InlineDashboardPage.svg",
8
+ "properties": []
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "QuickCreate",
3
+ "label": "Quick create",
4
+ "description": "Quick create widget",
5
+ "type": "Widget",
6
+ "subtype": "PAGE",
7
+ "properties": [],
8
+ "defaultConfig": {}
9
+ }
@@ -16,9 +16,10 @@
16
16
  <div class="psdk-todo-assignment-data">
17
17
  <div class="psdk-todo-assignment-task">
18
18
  {{ localizedVal('Task in', localeCategory) }}
19
- <button class="psdk-todo-id" style="cursor: pointer" (click)="clickGo(assignment)">
19
+ <button class="psdk-todo-id" style="cursor: pointer" (click)="clickGo(assignment)" *ngIf="!isConfirm || canPerform; else readOnlyText">
20
20
  {{ assignment.name }} {{ getID(assignment) }}
21
21
  </button>
22
+ <ng-template #readOnlyText> {{ assignment.name }} {{ getID(assignment) }} </ng-template>
22
23
  <span *ngIf="assignment.status != undefined">
23
24
  &bull; <span class="psdk-todo-assignment-status">{{ assignment?.status }}</span>
24
25
  </span>
@@ -231,7 +231,7 @@ export class TodoComponent implements OnInit, OnDestroy, OnChanges {
231
231
  const sTarget = this.pConn$.getContainerName();
232
232
  const sTargetContainerName = sTarget;
233
233
 
234
- const options: any = { containerName: sTargetContainerName };
234
+ const options: any = { containerName: sTargetContainerName, channelName: '' };
235
235
 
236
236
  if (classname === null || classname === '') {
237
237
  classname = this.pConn$.getCaseInfo().getClassName();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.24.5",
3
+ "version": "0.24.6",
4
4
  "description": "Angular SDK - Code for overriding components",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"