@pega/angular-sdk-overrides 0.23.5 → 0.23.7

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.
@@ -118,7 +118,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
118
118
 
119
119
  private _filter(value: string): string[] {
120
120
  const filterVal = (value || this.filterValue).toLowerCase();
121
- return this.options$?.filter(option => option.value.toLowerCase().includes(filterVal));
121
+ return this.options$?.filter(option => option.value?.toLowerCase().includes(filterVal));
122
122
  }
123
123
 
124
124
  // Callback passed when subscribing to store change
@@ -1,4 +1,4 @@
1
- <ng-container *ngIf="visibility$">
1
+ <ng-container *ngIf="visibility$ && arChildren$.length">
2
2
  <component-mapper
3
3
  name="FieldGroup"
4
4
  [props]="{
@@ -69,6 +69,10 @@ export class GroupComponent implements OnInit {
69
69
  this.instructions$ = this.configProps$.instructions;
70
70
  this.collapsible$ = this.configProps$.collapsible;
71
71
 
72
+ if (this.configProps$.visibility === undefined) {
73
+ this.visibility$ = this.pConn$.getComputedVisibility();
74
+ }
75
+
72
76
  if (this.configProps$.displayMode === 'LABELS_LEFT') {
73
77
  if (this.configProps$.visibility === undefined) this.visibility$ = true;
74
78
 
@@ -1,5 +1,5 @@
1
1
  <div *ngIf="displayMode$; else noDisplayMode">
2
- <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
2
+ <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$, isHtml$: true }"></component-mapper>
3
3
  </div>
4
4
  <ng-template #noDisplayMode>
5
5
  <div *ngIf="!bReadonly$; else noEdit">
@@ -12,6 +12,7 @@
12
12
  type="time"
13
13
  [value]="value$"
14
14
  [required]="bRequired$"
15
+ [attr.data-test-id]="testId"
15
16
  [formControl]="fieldControl"
16
17
  (change)="fieldOnChange($event)"
17
18
  (blur)="fieldOnBlur($event)"
@@ -36,6 +36,7 @@ export class TimeComponent implements OnInit, OnDestroy {
36
36
  bVisible$ = true;
37
37
  displayMode$?: string = '';
38
38
  controlName$: string;
39
+ testId = '';
39
40
  bHasForm$ = true;
40
41
  componentReference = '';
41
42
  helperText: string;
@@ -100,6 +101,7 @@ export class TimeComponent implements OnInit, OnDestroy {
100
101
  // moved this from ngOnInit() and call this from there instead...
101
102
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as TimeProps;
102
103
 
104
+ this.testId = this.configProps$.testId;
103
105
  this.label$ = this.configProps$.label;
104
106
  this.displayMode$ = this.configProps$.displayMode;
105
107
 
@@ -12,6 +12,7 @@
12
12
  type="url"
13
13
  [value]="value$"
14
14
  [required]="bRequired$"
15
+ [attr.data-test-id]="testId"
15
16
  [formControl]="fieldControl"
16
17
  (change)="fieldOnChange($event)"
17
18
  (blur)="fieldOnBlur($event)"
@@ -36,6 +36,7 @@ export class UrlComponent implements OnInit, OnDestroy {
36
36
  bVisible$ = true;
37
37
  displayMode$?: string = '';
38
38
  controlName$: string;
39
+ testId = '';
39
40
  bHasForm$ = true;
40
41
  componentReference = '';
41
42
  helperText: string;
@@ -106,6 +107,7 @@ export class UrlComponent implements OnInit, OnDestroy {
106
107
  this.value$ = this.configProps$.value;
107
108
  }
108
109
 
110
+ this.testId = this.configProps$.testId;
109
111
  this.label$ = this.configProps$.label;
110
112
  this.displayMode$ = this.configProps$.displayMode;
111
113
  this.helperText = this.configProps$.helperText;
@@ -163,6 +163,7 @@ mat-horizontal-stepper {
163
163
  .psdk-horizontal-stepper-header-container {
164
164
  white-space: nowrap;
165
165
  display: flex;
166
+ flex-wrap: wrap;
166
167
  align-items: center;
167
168
  text-align: left;
168
169
  }
@@ -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>
@@ -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;
@@ -680,10 +680,12 @@ export const readContextResponse = async (context, params) => {
680
680
  const dataViewName = PCore.getDataTypeUtils().getSavableDataPage(classID);
681
681
  const dataPageKeys = PCore.getDataTypeUtils().getDataPageKeys(dataViewName);
682
682
  dataPageKeys?.forEach(item => (item.isAlternateKeyStorage ? compositeKeys.push(item.linkedField) : compositeKeys.push(item.keyName)));
683
- if (compositeKeys.length) {
683
+ if (compositeKeys.length && otherContext) {
684
684
  otherContext.setCompositeKeys(compositeKeys);
685
685
  }
686
- otherContext.fetchRowActionDetails = null;
686
+ if (otherContext) {
687
+ otherContext.fetchRowActionDetails = null;
688
+ }
687
689
  }
688
690
 
689
691
  const presetArray = [];
@@ -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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.23.5",
3
+ "version": "0.23.7",
4
4
  "description": "Angular SDK - Code for overriding components",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"