@pega/angular-sdk-overrides 0.23.6 → 0.24.1

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.
Files changed (36) hide show
  1. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +5 -2
  2. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +3 -1
  3. package/lib/designSystemExtension/operator/operator.component.ts +6 -4
  4. package/lib/field/auto-complete/auto-complete.component.ts +1 -1
  5. package/lib/field/check-box/check-box.component.html +16 -15
  6. package/lib/field/check-box/check-box.component.scss +14 -1
  7. package/lib/field/check-box/check-box.component.ts +127 -44
  8. package/lib/field/group/group.component.html +1 -1
  9. package/lib/field/group/group.component.ts +4 -0
  10. package/lib/field/multiselect/multiselect.component.html +34 -0
  11. package/lib/field/multiselect/multiselect.component.scss +7 -0
  12. package/lib/field/multiselect/multiselect.component.spec.ts +21 -0
  13. package/lib/field/multiselect/multiselect.component.ts +363 -0
  14. package/lib/field/multiselect/utils.ts +209 -0
  15. package/lib/field/rich-text/rich-text.component.html +1 -1
  16. package/lib/field/time/time.component.html +1 -0
  17. package/lib/field/time/time.component.ts +2 -0
  18. package/lib/field/url/url.component.html +1 -0
  19. package/lib/field/url/url.component.ts +2 -0
  20. package/lib/infra/Containers/view-container/view-container.component.ts +7 -6
  21. package/lib/infra/multi-step/multi-step.component.scss +1 -0
  22. package/lib/infra/navbar/navbar.component.html +3 -3
  23. package/lib/infra/navbar/navbar.component.ts +4 -2
  24. package/lib/template/case-summary/case-summary.component.ts +37 -3
  25. package/lib/template/field-value-list/field-value-list.component.html +7 -2
  26. package/lib/template/field-value-list/field-value-list.component.ts +1 -0
  27. package/lib/template/list-view/list-view.component.html +4 -4
  28. package/lib/template/list-view/list-view.component.ts +21 -24
  29. package/lib/template/simple-table-manual/helpers.ts +1 -1
  30. package/lib/template/simple-table-manual/simple-table-manual.component.html +1 -1
  31. package/lib/template/simple-table-manual/simple-table-manual.component.ts +44 -7
  32. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +1 -1
  33. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +2 -1
  34. package/lib/widget/attachment/attachment.component.html +9 -1
  35. package/lib/widget/attachment/attachment.component.ts +4 -1
  36. package/package.json +1 -1
@@ -51,7 +51,8 @@ export class NavbarComponent implements OnInit, OnDestroy {
51
51
  navIcon$: string;
52
52
  localizedVal: any;
53
53
  localeCategory = 'AppShell';
54
-
54
+ localeUtils = PCore.getLocaleUtils();
55
+ localeReference: any;
55
56
  constructor(
56
57
  private angularPConnect: AngularPConnectService,
57
58
  private chRef: ChangeDetectorRef,
@@ -119,7 +120,8 @@ export class NavbarComponent implements OnInit, OnDestroy {
119
120
  this.navPages$.forEach(page => {
120
121
  page.iconName = this.utils.getImageSrc(page.pxPageViewIcon, this.utils.getSDKStaticContentUrl());
121
122
  });
122
-
123
+ // @ts-ignore - second parameter pageReference for getValue method should be optional
124
+ this.localeReference = this.pConn$.getValue('.pyLocaleReference');
123
125
  this.actionsAPI = this.pConn$.getActionsApi();
124
126
  this.createWork = this.actionsAPI.createWork.bind(this.actionsAPI);
125
127
  this.showPage = this.actionsAPI.showPage.bind(this.actionsAPI);
@@ -92,9 +92,43 @@ export class CaseSummaryComponent implements OnInit, OnDestroy, OnChanges {
92
92
  this.primaryFields$.push(kid.resolveConfigProps(kid.getRawMetadata()));
93
93
  }
94
94
 
95
- for (const oField of this.arChildren$[1].getPConnect().getChildren()) {
95
+ const secondarySummaryFields = this.prepareCaseSummaryData(this.arChildren$[1].getPConnect());
96
+ const secondaryChildren = this.arChildren$[1].getPConnect().getChildren();
97
+ secondaryChildren.forEach((oField, index) => {
96
98
  const kid = oField.getPConnect();
97
- this.secondaryFields$.push({ ...kid.resolveConfigProps(kid.getRawMetadata()), kid });
98
- }
99
+ const displayLabel = secondarySummaryFields[index].value.getPConnect().getConfigProps().label;
100
+ this.secondaryFields$.push({ ...kid.resolveConfigProps(kid.getRawMetadata()), kid, displayLabel });
101
+ });
102
+ }
103
+
104
+ prepareComponentInCaseSummary(pConnectMeta, getPConnect) {
105
+ const { config, children } = pConnectMeta;
106
+ const pConnect = getPConnect();
107
+
108
+ const caseSummaryComponentObject: any = {};
109
+
110
+ const { type } = pConnectMeta;
111
+ const createdComponent = pConnect.createComponent({
112
+ type,
113
+ children: children ? [...children] : [],
114
+ config: {
115
+ ...config
116
+ }
117
+ });
118
+
119
+ caseSummaryComponentObject.value = createdComponent;
120
+ return caseSummaryComponentObject;
121
+ }
122
+
123
+ prepareCaseSummaryData(summaryFieldChildren) {
124
+ const convertChildrenToSummaryData = kid => {
125
+ return kid?.map((childItem, index) => {
126
+ const childMeta = childItem.getPConnect().meta;
127
+ const caseSummaryComponentObject = this.prepareComponentInCaseSummary(childMeta, childItem.getPConnect);
128
+ caseSummaryComponentObject.id = index + 1;
129
+ return caseSummaryComponentObject;
130
+ });
131
+ };
132
+ return summaryFieldChildren ? convertChildrenToSummaryData(summaryFieldChildren?.getChildren()) : undefined;
99
133
  }
100
134
  }
@@ -1,7 +1,7 @@
1
1
  <div *ngIf="displayMode$ === 'LABELS_LEFT'; else STACKED_LARGE_VAL" class="psdk-container-labels-left">
2
2
  <div class="psdk-grid-label">{{ label$ }}</div>
3
3
  <div class="psdk-val-labels-left">
4
- {{ value$ || '---' }}
4
+ <ng-container *ngTemplateOutlet="valueTemplate"></ng-container>
5
5
  </div>
6
6
  </div>
7
7
 
@@ -9,7 +9,12 @@
9
9
  <div *ngIf="displayMode$ === 'STACKED_LARGE_VAL'" class="psdk-container-stacked-large-val">
10
10
  <div class="psdk-grid-label">{{ label$ }}</div>
11
11
  <div class="psdk-val-stacked">
12
- {{ value$ || '---' }}
12
+ <ng-container *ngTemplateOutlet="valueTemplate"></ng-container>
13
13
  </div>
14
14
  </div>
15
15
  </ng-template>
16
+
17
+ <ng-template #valueTemplate>
18
+ <div *ngIf="isHtml$; else valueOnly" id="instruction-text" [innerHTML]="value$ || '---'"></div>
19
+ <ng-template #valueOnly>{{ value$ || '---' }}</ng-template>
20
+ </ng-template>
@@ -12,4 +12,5 @@ export class FieldValueListComponent {
12
12
  @Input() label$: any;
13
13
  @Input() value$: any;
14
14
  @Input() displayMode$: any;
15
+ @Input() isHtml$ = false;
15
16
  }
@@ -50,7 +50,7 @@
50
50
  color="primary"
51
51
  (click)="_listViewClick(dCol.config, element)"
52
52
  >
53
- {{ element[dCol.config.name] }}
53
+ {{ element[dCol.config.name] || '---' }}
54
54
  </button>
55
55
  <ng-template #regular>
56
56
  {{ element[dCol.config.name] || '---' }}
@@ -114,10 +114,10 @@
114
114
  color="primary"
115
115
  (click)="_listViewClick(dCol.config, element)"
116
116
  >
117
- {{ element[dCol.config.name] }}
117
+ {{ element[dCol.config.name] || '---' }}
118
118
  </button>
119
119
  <ng-template #regular>
120
- {{ element[dCol.config.name] }}
120
+ {{ element[dCol.config.name] || '---' }}
121
121
  </ng-template>
122
122
  </td>
123
123
  </ng-container>
@@ -163,7 +163,7 @@
163
163
  <th mat-header-cell *matHeaderCellDef mat-sort-header (click)="_headerSortClick($event, dCol)" arrowPosition="before">
164
164
  {{ dCol.config.label }}
165
165
  </th>
166
- <td mat-cell *matCellDef="let element">{{ element[dCol.config.name] }}</td>
166
+ <td mat-cell *matCellDef="let element">{{ element[dCol.config.name] || '---' }}</td>
167
167
  </ng-container>
168
168
 
169
169
  <tr mat-header-row *matHeaderRowDef="displayedColumns$"></tr>
@@ -169,7 +169,7 @@ export class ListViewComponent implements OnInit, OnDestroy {
169
169
  /** If compositeKeys is defined, use dynamic value, else fallback to pyID or pyGUID. */
170
170
  this.compositeKeys = this.configProps$?.compositeKeys;
171
171
  this.rowID = this.compositeKeys && this.compositeKeys?.length === 1 ? this.compositeKeys[0] : defRowID;
172
- this.bShowSearch$ = this.utils.getBooleanValue(this.configProps$.globalSearch ? this.configProps$.globalSearch : this.payload.globalSearch);
172
+ this.bShowSearch$ = this.utils.getBooleanValue(this.configProps$.globalSearch ? this.configProps$.globalSearch : this.payload?.globalSearch);
173
173
  this.bColumnReorder$ = this.utils.getBooleanValue(this.configProps$.reorderFields);
174
174
  this.bGrouping$ = this.utils.getBooleanValue(this.configProps$.grouping);
175
175
  this.showDynamicFields = this.configProps$?.showDynamicFields;
@@ -619,10 +619,6 @@ export class ListViewComponent implements OnInit, OnDestroy {
619
619
  }
620
620
  }
621
621
 
622
- compare(a: number | string, b: number | string, isAsc: boolean) {
623
- return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
624
- }
625
-
626
622
  _headerSortClick(event, columnData) {
627
623
  // images 0 - filter, 1 - arrow, 2 - more
628
624
 
@@ -655,21 +651,22 @@ export class ListViewComponent implements OnInit, OnDestroy {
655
651
  this.filterSortGroupBy();
656
652
  }
657
653
 
658
- clearOutArrows(event, columnData) {
659
- const arImages = event.srcElement.parentElement.getElementsByTagName('img');
660
-
661
- for (const theImage of arImages) {
662
- // let theImage = arImages[i]
663
- const arrow = theImage.getAttribute('arrow');
664
- if (arrow) {
665
- const arrowId = theImage.getAttribute('arrowid');
666
- if (arrow != 'none' && arrowId != columnData.config.name) {
667
- theImage.setAttribute('arrow', 'none');
668
- theImage.src = '';
669
- }
670
- }
671
- }
672
- }
654
+ // Commenting below method, since the code which is using it, is already commented
655
+ // clearOutArrows(event, columnData) {
656
+ // const arImages = event.srcElement.parentElement.getElementsByTagName('img');
657
+
658
+ // for (const theImage of arImages) {
659
+ // // let theImage = arImages[i]
660
+ // const arrow = theImage.getAttribute('arrow');
661
+ // if (arrow) {
662
+ // const arrowId = theImage.getAttribute('arrowid');
663
+ // if (arrow != 'none' && arrowId != columnData.config.name) {
664
+ // theImage.setAttribute('arrow', 'none');
665
+ // theImage.src = '';
666
+ // }
667
+ // }
668
+ // }
669
+ // }
673
670
 
674
671
  sortCompare(a, b): number {
675
672
  let aValue = a[this.compareRef];
@@ -689,18 +686,18 @@ export class ListViewComponent implements OnInit, OnDestroy {
689
686
 
690
687
  switch (this.arrowDirection) {
691
688
  case 'up':
692
- if (aValue < bValue) {
689
+ if (!aValue || aValue < bValue) {
693
690
  return -1;
694
691
  }
695
- if (aValue > bValue) {
692
+ if (!bValue || aValue > bValue) {
696
693
  return 1;
697
694
  }
698
695
  break;
699
696
  case 'down':
700
- if (aValue > bValue) {
697
+ if (!bValue || aValue > bValue) {
701
698
  return -1;
702
699
  }
703
- if (aValue < bValue) {
700
+ if (!aValue || aValue < bValue) {
704
701
  return 1;
705
702
  }
706
703
  break;
@@ -130,7 +130,7 @@ export const buildFieldsForTable = (configFields, fields, showDeleteButton) => {
130
130
  type: 'text',
131
131
  label: fields[index].config.label || fields[index].config.caption,
132
132
  fillAvailableSpace: !!field.config.fillAvailableSpace,
133
- id: index,
133
+ id: `${index}`,
134
134
  name: field.config.value.substr(4),
135
135
  cellRenderer: TABLE_CELL,
136
136
  sort: false,
@@ -27,7 +27,7 @@
27
27
  </mat-menu>
28
28
  </div>
29
29
  </th>
30
- <td mat-cell *matCellDef="let element">{{ element[dCol.config.name] }}</td>
30
+ <td mat-cell *matCellDef="let element">{{ element[dCol.config.name] || '---' }}</td>
31
31
  </ng-container>
32
32
  <ng-container matColumnDef="DeleteIcon">
33
33
  <div *ngIf="allowEditingInModal">
@@ -157,6 +157,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
157
157
  editView: any;
158
158
  settingsSvgIcon$: string;
159
159
 
160
+ isInitialized = false;
161
+
160
162
  constructor(
161
163
  private angularPConnect: AngularPConnectService,
162
164
  private utils: Utils,
@@ -164,6 +166,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
164
166
  ) {}
165
167
 
166
168
  ngOnInit(): void {
169
+ this.isInitialized = true;
167
170
  // First thing in initialization is registering and subscribing to the AngularPConnect service
168
171
  this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
169
172
  this.configProps$ = this.pConn$.getConfigProps() as SimpleTableManualProps;
@@ -300,6 +303,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
300
303
  // Nebula and we may not end up using it all.
301
304
  this.fieldDefs = buildFieldsForTable(rawFields, resolvedFields, showDeleteButton);
302
305
 
306
+ this.initializeDefaultPageInstructions();
307
+
303
308
  // end of from Nebula
304
309
 
305
310
  // Here, we use the "name" field in fieldDefs since that has the assoicated property
@@ -348,6 +353,21 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
348
353
  // ties the 3 data structures together.
349
354
  }
350
355
 
356
+ initializeDefaultPageInstructions() {
357
+ if (this.isInitialized) {
358
+ this.isInitialized = false;
359
+ if (this.allowEditingInModal) {
360
+ this.pConn$.getListActions().initDefaultPageInstructions(
361
+ this.pConn$.getReferenceList(),
362
+ this.fieldDefs.filter(item => item.name).map(item => item.name)
363
+ );
364
+ } else {
365
+ // @ts-ignore - An argument for 'fields' was not provided
366
+ this.pConn$.getListActions().initDefaultPageInstructions(this.pConn$.getReferenceList());
367
+ }
368
+ }
369
+ }
370
+
351
371
  getResultsText() {
352
372
  const recordsCount = this.readOnlyMode ? this.rowData?.data.length : this.referenceList?.length;
353
373
  return `${recordsCount} result${recordsCount > 1 ? 's' : ''}`;
@@ -369,13 +389,28 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
369
389
  }
370
390
  }
371
391
 
372
- if (aValue === bValue) {
373
- return 0;
392
+ //
393
+ switch (this.arrowDirection) {
394
+ case 'up':
395
+ if (!aValue || aValue < bValue) {
396
+ return -1;
397
+ }
398
+ if (!bValue || aValue > bValue) {
399
+ return 1;
400
+ }
401
+ break;
402
+ case 'down':
403
+ if (!bValue || aValue > bValue) {
404
+ return -1;
405
+ }
406
+ if (!aValue || aValue < bValue) {
407
+ return 1;
408
+ }
409
+ break;
410
+ default:
411
+ break;
374
412
  }
375
413
 
376
- if (this.arrowDirection === 'up') return aValue - bValue;
377
- if (this.arrowDirection === 'down') return bValue - aValue;
378
-
379
414
  return 0;
380
415
  }
381
416
 
@@ -889,12 +924,14 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
889
924
  this.referenceList.length,
890
925
  PCore.getConstants().RESOURCE_STATUS.CREATE
891
926
  );
892
- } else if (PCore.getPCoreVersion()?.includes('8.7')) {
893
- this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length, this.pageReference);
894
927
  } else {
895
928
  // @ts-ignore - second parameter "pageRef" is optional for insert method
896
929
  this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length);
897
930
  }
931
+
932
+ this.pConn$.clearErrorMessages({
933
+ property: (this.pConn$.getStateProps() as any)?.referenceList?.substring(1)
934
+ } as any);
898
935
  }
899
936
 
900
937
  editRecord(data, index) {
@@ -25,7 +25,7 @@
25
25
  </mat-list-item>
26
26
  <mat-menu #menu="matMenu">
27
27
  <button mat-menu-item>Profile</button>
28
- <button mat-menu-item (click)="navPanelLogoutClick()">Logoff</button>
28
+ <button mat-menu-item (click)="navPanelLogoutClick()">{{ localizedVal('Log off', localeCategory) }}</button>
29
29
  </mat-menu>
30
30
  </mat-list>
31
31
  </mat-toolbar-row>
@@ -50,7 +50,8 @@ export class WssNavBarComponent implements OnInit, OnDestroy {
50
50
  logout: any;
51
51
 
52
52
  navIcon$: string;
53
-
53
+ localizedVal = PCore.getLocaleUtils().getLocaleValue;
54
+ localeCategory = 'AppShell';
54
55
  constructor(
55
56
  private angularPConnect: AngularPConnectService,
56
57
  private cdRef: ChangeDetectorRef,
@@ -11,7 +11,15 @@
11
11
  <input hidden type="file" [required]="bRequired$" #uploader [id]="att_valueRef" [multiple]="allowMultiple$" (change)="uploadMyFiles($event)" />
12
12
 
13
13
  <button mat-stroked-button color="primary" [disabled]="bDisabled$" (click)="uploader.click()">
14
- {{ allowMultiple$ ? 'Upload files' : 'Upload file' }}
14
+ {{
15
+ allowMultiple$
16
+ ? uploadMultipleFilesLabel === 'file_upload_text_multiple'
17
+ ? 'Choose files'
18
+ : uploadMultipleFilesLabel
19
+ : uploadSingleFileLabel === 'file_upload_text_one'
20
+ ? 'Choose a file'
21
+ : uploadSingleFileLabel
22
+ }}
15
23
  </button>
16
24
  </div>
17
25
  <span *ngIf="validateMessage" class="file-error">{{ validateMessage }}</span>
@@ -55,7 +55,10 @@ export class AttachmentComponent implements OnInit, OnDestroy {
55
55
  validateMessage: string | undefined = '';
56
56
  valueRef: string;
57
57
  imagePath$: string;
58
-
58
+ localizedVal = PCore.getLocaleUtils().getLocaleValue;
59
+ localeCategory = 'CosmosFields';
60
+ uploadMultipleFilesLabel = this.localizedVal('file_upload_text_multiple', this.localeCategory);
61
+ uploadSingleFileLabel = this.localizedVal('file_upload_text_one', this.localeCategory);
59
62
  constructor(
60
63
  private angularPConnect: AngularPConnectService,
61
64
  private utils: Utils,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.23.6",
3
+ "version": "0.24.1",
4
4
  "description": "Angular SDK - Code for overriding components",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"