@pega/angular-sdk-overrides 24.1.10 → 24.2.12

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 (125) hide show
  1. package/lib/designSystemExtension/alert-banner/alert-banner.component.ts +1 -1
  2. package/lib/designSystemExtension/case-create-stage/case-create-stage.component.ts +1 -1
  3. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +2 -1
  4. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -1
  5. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +2 -2
  6. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +10 -1
  7. package/lib/designSystemExtension/operator/operator.component.html +1 -1
  8. package/lib/designSystemExtension/operator/operator.component.scss +10 -2
  9. package/lib/designSystemExtension/operator/operator.component.ts +5 -4
  10. package/lib/designSystemExtension/pulse/pulse.component.ts +7 -7
  11. package/lib/field/auto-complete/auto-complete.component.html +0 -1
  12. package/lib/field/auto-complete/auto-complete.component.ts +31 -15
  13. package/lib/field/check-box/check-box.component.html +4 -0
  14. package/lib/field/check-box/check-box.component.ts +11 -10
  15. package/lib/field/currency/currency.component.html +4 -4
  16. package/lib/field/currency/currency.component.ts +42 -19
  17. package/lib/field/date/date.component.html +3 -7
  18. package/lib/field/date/date.component.ts +22 -39
  19. package/lib/field/date-time/date-time.component.html +3 -4
  20. package/lib/field/date-time/date-time.component.ts +35 -16
  21. package/lib/field/decimal/decimal.component.html +4 -3
  22. package/lib/field/decimal/decimal.component.ts +47 -21
  23. package/lib/field/dropdown/dropdown.component.html +1 -0
  24. package/lib/field/dropdown/dropdown.component.ts +146 -18
  25. package/lib/field/email/email.component.ts +24 -4
  26. package/lib/field/group/group.component.ts +2 -2
  27. package/lib/field/integer/integer.component.ts +22 -4
  28. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
  29. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +3 -2
  30. package/lib/field/multiselect/multiselect.component.ts +15 -5
  31. package/lib/field/percentage/percentage.component.html +3 -3
  32. package/lib/field/percentage/percentage.component.ts +45 -20
  33. package/lib/field/phone/config-ext.json +1 -1
  34. package/lib/field/phone/phone.component.html +4 -2
  35. package/lib/field/phone/phone.component.ts +16 -26
  36. package/lib/field/radio-buttons/radio-buttons.component.html +3 -6
  37. package/lib/field/radio-buttons/radio-buttons.component.ts +9 -9
  38. package/lib/field/rich-text/rich-text.component.ts +19 -8
  39. package/lib/field/scalar-list/scalar-list.component.ts +3 -4
  40. package/lib/field/text/text.component.ts +8 -4
  41. package/lib/field/text-area/text-area.component.html +4 -1
  42. package/lib/field/text-area/text-area.component.ts +22 -5
  43. package/lib/field/text-input/text-input.component.ts +22 -4
  44. package/lib/field/time/time.component.html +2 -2
  45. package/lib/field/time/time.component.ts +35 -6
  46. package/lib/field/url/url.component.ts +22 -4
  47. package/lib/field/user-reference/user-reference.component.html +40 -46
  48. package/lib/field/user-reference/user-reference.component.ts +111 -20
  49. package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
  50. package/lib/infra/Containers/flow-container/flow-container.component.ts +25 -47
  51. package/lib/infra/Containers/flow-container/helpers.ts +2 -2
  52. package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
  53. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +1 -8
  54. package/lib/infra/Containers/preview-view-container/preview-view-container.component.ts +1 -1
  55. package/lib/infra/Containers/view-container/helper.ts +22 -0
  56. package/lib/infra/Containers/view-container/view-container.component.ts +5 -17
  57. package/lib/infra/action-buttons/action-buttons.component.html +1 -1
  58. package/lib/infra/assignment/assignment.component.html +1 -1
  59. package/lib/infra/assignment/assignment.component.ts +82 -40
  60. package/lib/infra/assignment-card/assignment-card.component.html +1 -0
  61. package/lib/infra/defer-load/defer-load.component.ts +8 -5
  62. package/lib/infra/navbar/navbar.component.ts +3 -5
  63. package/lib/infra/reference/reference.component.ts +77 -90
  64. package/lib/infra/root-container/root-container.component.html +2 -15
  65. package/lib/infra/root-container/root-container.component.ts +27 -30
  66. package/lib/infra/stages/stages.component.scss +2 -2
  67. package/lib/infra/view/view.component.html +7 -20
  68. package/lib/infra/view/view.component.ts +20 -2
  69. package/lib/template/app-shell/app-shell.component.ts +20 -2
  70. package/lib/template/base/details-template-base.ts +67 -0
  71. package/lib/template/base/form-template-base.ts +16 -0
  72. package/lib/template/case-summary/case-summary.component.ts +1 -1
  73. package/lib/template/case-view/case-view.component.html +4 -4
  74. package/lib/template/case-view/case-view.component.ts +8 -13
  75. package/lib/template/confirmation/confirmation.component.html +1 -1
  76. package/lib/template/confirmation/confirmation.component.ts +1 -1
  77. package/lib/template/data-reference/data-reference.component.ts +36 -40
  78. package/lib/template/default-form/default-form.component.html +0 -4
  79. package/lib/template/default-form/default-form.component.ts +41 -24
  80. package/lib/template/details/details.component.ts +7 -41
  81. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +6 -39
  82. package/lib/template/details-one-column/details-one-column.component.ts +7 -42
  83. package/lib/template/details-sub-tabs/details-sub-tabs.component.html +1 -2
  84. package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +5 -37
  85. package/lib/template/details-three-column/details-three-column.component.ts +7 -43
  86. package/lib/template/details-two-column/details-two-column.component.ts +8 -44
  87. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +7 -42
  88. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +3 -0
  89. package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +8 -3
  90. package/lib/template/field-group-template/field-group-template.component.html +7 -7
  91. package/lib/template/field-group-template/field-group-template.component.scss +8 -0
  92. package/lib/template/field-group-template/field-group-template.component.ts +68 -47
  93. package/lib/template/field-value-list/field-value-list.component.html +2 -2
  94. package/lib/template/field-value-list/field-value-list.component.scss +6 -1
  95. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -2
  96. package/lib/template/list-view/list-view.component.html +6 -1
  97. package/lib/template/list-view/list-view.component.scss +11 -0
  98. package/lib/template/list-view/list-view.component.ts +25 -7
  99. package/lib/template/list-view/listViewHelpers.ts +3 -6
  100. package/lib/template/list-view/utils.ts +2 -5
  101. package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +1 -1
  102. package/lib/template/one-column/one-column.component.ts +4 -3
  103. package/lib/template/one-column-tab/one-column-tab.component.ts +1 -1
  104. package/lib/template/page/page.component.ts +1 -1
  105. package/lib/template/promoted-filters/promoted-filters.component.ts +1 -1
  106. package/lib/template/repeating-structures/repeating-structures.component.ts +1 -1
  107. package/lib/template/simple-table-manual/helpers.ts +10 -8
  108. package/lib/template/simple-table-manual/simple-table-manual.component.html +25 -6
  109. package/lib/template/simple-table-manual/simple-table-manual.component.scss +12 -3
  110. package/lib/template/simple-table-manual/simple-table-manual.component.ts +77 -37
  111. package/lib/template/simple-table-select/simple-table-select.component.ts +3 -3
  112. package/lib/template/three-column/three-column.component.ts +4 -3
  113. package/lib/template/two-column/two-column.component.ts +4 -3
  114. package/lib/template/two-column-tab/two-column-tab.component.ts +1 -1
  115. package/lib/template/utils.ts +16 -0
  116. package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +4 -3
  117. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +1 -1
  118. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +3 -3
  119. package/lib/widget/attachment/attachment.component.ts +7 -9
  120. package/lib/widget/feed-container/feed-container.component.ts +7 -9
  121. package/lib/widget/file-utility/file-utility.component.ts +2 -5
  122. package/lib/widget/todo/todo.component.html +5 -6
  123. package/lib/widget/todo/todo.component.scss +9 -0
  124. package/lib/widget/todo/todo.component.ts +95 -84
  125. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-classes-per-file */
2
1
  import { Component, OnInit, Input, ViewChild, forwardRef, OnDestroy } from '@angular/core';
3
2
  import { CommonModule } from '@angular/common';
4
3
  import { MatDatepickerModule } from '@angular/material/datepicker';
@@ -22,13 +21,13 @@ import { getCurrencyOptions } from '@pega/angular-sdk-components';
22
21
  import { getLocale, getSeconds } from '@pega/angular-sdk-components';
23
22
  import { formatters } from '@pega/angular-sdk-components';
24
23
 
25
- import { useInit } from './listViewHelpers';
26
-
27
- declare const window: any;
24
+ import { init } from './listViewHelpers';
28
25
 
29
26
  const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
30
27
 
31
28
  interface ListViewProps {
29
+ inheritedProps: any;
30
+ title: string | undefined;
32
31
  // If any, enter additional props that only exist on this component
33
32
  globalSearch?: boolean;
34
33
  referenceList?: any;
@@ -42,6 +41,7 @@ interface ListViewProps {
42
41
  grouping: string | boolean;
43
42
  value: any;
44
43
  readonlyContextList: any;
44
+ label?: string;
45
45
  }
46
46
 
47
47
  export class Group {
@@ -159,10 +159,11 @@ export class ListViewComponent implements OnInit, OnDestroy {
159
159
  xRayApis = PCore.getDebugger().getXRayRuntime();
160
160
  xRayUid = this.xRayApis.startXRay();
161
161
  checkBoxValue: string;
162
+ label?: string = '';
162
163
 
163
164
  constructor(
164
165
  private psService: ProgressSpinnerService,
165
- private utils: Utils
166
+ public utils: Utils
166
167
  ) {}
167
168
 
168
169
  ngOnInit(): void {
@@ -192,6 +193,18 @@ export class ListViewComponent implements OnInit, OnDestroy {
192
193
  this.arFilterMainButtons$.push({ actionID: 'submit', jsAction: 'submit', name: 'Submit' });
193
194
  this.arFilterSecondaryButtons$.push({ actionID: 'cancel', jsAction: 'cancel', name: 'Cancel' });
194
195
 
196
+ let title = this.configProps$?.title || this.configProps$?.label || 'List';
197
+ const inheritedProps = this.configProps$?.inheritedProps;
198
+ if (title === 'List' && inheritedProps) {
199
+ for (const inheritedProp of inheritedProps) {
200
+ if (inheritedProp?.prop === 'label') {
201
+ title = inheritedProp?.value;
202
+ break;
203
+ }
204
+ }
205
+ }
206
+ this.label = title;
207
+
195
208
  this.searchIcon$ = this.utils.getImageSrc('search', this.utils.getSDKStaticContentUrl());
196
209
  setTimeout(() => {
197
210
  PCore.getPubSubUtils().subscribe(
@@ -218,7 +231,7 @@ export class ListViewComponent implements OnInit, OnDestroy {
218
231
  if (!this.payload) {
219
232
  this.payload = { referenceList: this.configProps$.referenceList };
220
233
  }
221
- useInit({
234
+ init({
222
235
  pConn$: this.pConn$,
223
236
  bInForm$: this.bInForm$,
224
237
  ...this.payload,
@@ -961,7 +974,7 @@ export class ListViewComponent implements OnInit, OnDestroy {
961
974
 
962
975
  filterDataWithDate(item, filterObj, filterValue) {
963
976
  let bKeep;
964
- let value = item[filterObj.ref] != null ?? item[filterObj.ref] != '' ? getSeconds(item[filterObj.ref]) : null;
977
+ let value = item[filterObj.ref] != null || item[filterObj.ref] != '' ? getSeconds(item[filterObj.ref]) : null;
965
978
  filterValue = filterObj.containsFilterValue != null && filterObj.containsFilterValue != '' ? getSeconds(filterObj.containsFilterValue) : null;
966
979
 
967
980
  switch (filterObj.containsFilter) {
@@ -1380,6 +1393,11 @@ export class ListViewComponent implements OnInit, OnDestroy {
1380
1393
  return listFields;
1381
1394
  }
1382
1395
 
1396
+ getResultsText() {
1397
+ const recordsCount = this.repeatList$?.paginator?.length || 0;
1398
+ return `${recordsCount || 0} result${recordsCount > 1 ? 's' : ''}`;
1399
+ }
1400
+
1383
1401
  getField(fieldDefs, columnId) {
1384
1402
  const fieldsMap = this.getFieldsMap(fieldDefs);
1385
1403
  return fieldsMap.get(columnId);
@@ -1,9 +1,6 @@
1
1
  import { getContext, readContextResponse } from './utils';
2
2
 
3
- // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
4
- declare const PCore: any;
5
-
6
- export function useInit(props) {
3
+ export function init(props) {
7
4
  const {
8
5
  referenceList,
9
6
  pConn$,
@@ -25,9 +22,9 @@ export function useInit(props) {
25
22
  let selectionCountThreshold;
26
23
 
27
24
  // promise to fetch metadata
28
- const metaDataPromise = PCore.getAnalyticsUtils().getDataViewMetadata(referenceList, showDynamicFields);
25
+ const metaDataPromise = PCore.getAnalyticsUtils().getDataViewMetadata(referenceList, showDynamicFields, null);
29
26
 
30
- const promisesArray = [metaDataPromise];
27
+ const promisesArray: any = [metaDataPromise];
31
28
 
32
29
  // promise to fetch report configured columns
33
30
  const reportColumnsPromise = PCore.getAnalyticsUtils()
@@ -1,8 +1,5 @@
1
1
  import { getDefaultViewMeta } from './DefaultViewMeta';
2
2
 
3
- // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 5 errors)
4
- declare const PCore: any;
5
-
6
3
  const USER_REFERENCE = 'UserReference';
7
4
  const PAGE = '!P!';
8
5
  const PAGELIST = '!PL!';
@@ -121,7 +118,7 @@ export const isPageListInPath = (propertyName, currentClassID) => {
121
118
  return false;
122
119
  }
123
120
  const [first, ...rest] = propertyName.split('.');
124
- const metadata = PCore.getMetadataUtils().getPropertyMetadata(first, currentClassID);
121
+ const metadata: any = PCore.getMetadataUtils().getPropertyMetadata(first, currentClassID);
125
122
  if (metadata?.type === 'Page List') {
126
123
  return true;
127
124
  }
@@ -205,7 +202,7 @@ export function getConfigEmbeddedFieldsMeta(configFields, classID) {
205
202
  if (value.includes('[')) {
206
203
  value = value.substring(0, value.indexOf('[')) + value.substring(value.indexOf(']') + 1);
207
204
  }
208
- const meta = PCore.getMetadataUtils().getEmbeddedPropertyMetadata(value, classID);
205
+ const meta: any = PCore.getMetadataUtils().getEmbeddedPropertyMetadata(value, classID);
209
206
  meta.fieldID = field;
210
207
  configEmbeddedFieldsMeta.push(meta);
211
208
  }
@@ -29,6 +29,6 @@ export class NarrowWideFormComponent implements OnInit, OnChanges {
29
29
  }
30
30
 
31
31
  updateSelf() {
32
- this.arChildren$ = this.pConn$.getChildren() as any[];
32
+ this.arChildren$ = this.pConn$.getChildren();
33
33
  }
34
34
  }
@@ -2,6 +2,7 @@ import { Component, OnInit, Input, forwardRef, OnChanges, SimpleChanges } from '
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
4
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
5
+ import { FormTemplateBase } from '@pega/angular-sdk-components';
5
6
 
6
7
  @Component({
7
8
  selector: 'app-one-column',
@@ -10,8 +11,8 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
10
11
  standalone: true,
11
12
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
12
13
  })
13
- export class OneColumnComponent implements OnInit, OnChanges {
14
- @Input() pConn$: typeof PConnect;
14
+ export class OneColumnComponent extends FormTemplateBase implements OnInit, OnChanges {
15
+ @Input() override pConn$: typeof PConnect;
15
16
  @Input() formGroup$: FormGroup;
16
17
 
17
18
  arChildren$: any[];
@@ -29,6 +30,6 @@ export class OneColumnComponent implements OnInit, OnChanges {
29
30
  }
30
31
 
31
32
  updateSelf() {
32
- this.arChildren$ = this.pConn$.getChildren() as any[];
33
+ this.arChildren$ = this.pConn$.getChildren();
33
34
  }
34
35
  }
@@ -29,6 +29,6 @@ export class OneColumnTabComponent implements OnInit, OnChanges {
29
29
  }
30
30
 
31
31
  updateSelf() {
32
- this.arChildren$ = this.pConn$.getChildren() as any[];
32
+ this.arChildren$ = this.pConn$.getChildren();
33
33
  }
34
34
  }
@@ -34,7 +34,7 @@ export class PageComponent implements OnInit, OnDestroy {
34
34
  this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
35
35
 
36
36
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as PageProps;
37
- this.arChildren$ = this.pConn$.getChildren() as any[];
37
+ this.arChildren$ = this.pConn$.getChildren();
38
38
 
39
39
  this.title$ = this.configProps$.title;
40
40
  const operator = this.configProps$.operator;
@@ -81,7 +81,7 @@ export class PromotedFiltersComponent implements OnInit, OnDestroy {
81
81
  });
82
82
 
83
83
  const filtersWithClassID = { ...this.filtersProperties, classID: this.pageClass };
84
- this.transientItemID = (this.pConn$.getContainerManager() as any).addTransientItem({ id: this.viewName, data: filtersWithClassID });
84
+ this.transientItemID = this.pConn$.getContainerManager().addTransientItem({ id: this.viewName, data: filtersWithClassID });
85
85
  this.processedFilters = [];
86
86
  this.filters.forEach(filter => {
87
87
  const filterClone = { ...filter };
@@ -107,7 +107,7 @@ export class RepeatingStructuresComponent implements OnInit, AfterViewInit {
107
107
  openAssignment(row) {
108
108
  const { pxRefObjectClass, pzInsKey } = row;
109
109
  const sTarget = this.pConn$.getContainerName();
110
- const options: any = { containerName: sTarget };
110
+ const options = { containerName: sTarget };
111
111
  this.pConn$
112
112
  .getActionsApi()
113
113
  .openAssignment(pzInsKey, pxRefObjectClass, options)
@@ -44,18 +44,20 @@ function getFieldWidth(field, label) {
44
44
  export const getContext = thePConn => {
45
45
  const contextName = thePConn.getContextName();
46
46
  const pageReference = thePConn.getPageReference();
47
- // 8.7 change = referenceList may now be in top-level of state props,
48
- // not always in config of state props
49
- let { referenceList } = thePConn.getStateProps()?.config || thePConn.getStateProps();
47
+ const { readonlyContextList, referenceList = readonlyContextList } = thePConn.getStateProps()?.config || thePConn.getStateProps();
48
+
50
49
  const pageReferenceForRows = referenceList.startsWith('.') ? `${pageReference}.${referenceList.substring(1)}` : referenceList;
50
+ const viewName = thePConn.viewName;
51
51
 
52
52
  // removing "caseInfo.content" prefix to avoid setting it as a target while preparing pageInstructions
53
- referenceList = pageReferenceForRows.replace(PCore.getConstants().CASE_INFO.CASE_INFO_CONTENT, '');
53
+ // skipping the removal as StateMachine itself is removing this case info prefix while preparing pageInstructions
54
+ // referenceList = pageReferenceForRows.replace(PCore.getConstants().CASE_INFO.CASE_INFO_CONTENT, '');
54
55
 
55
56
  return {
56
57
  contextName,
57
58
  referenceListStr: referenceList,
58
- pageReferenceForRows
59
+ pageReferenceForRows,
60
+ viewName
59
61
  };
60
62
  };
61
63
 
@@ -189,8 +191,8 @@ export const createMetaForTable = (fields, renderMode) => {
189
191
  };
190
192
 
191
193
  export const filterDataByDate = (item, filterObj) => {
192
- let bKeep;
193
- let value = item[filterObj.ref] != null ?? item[filterObj.ref] != '' ? getSeconds(item[filterObj.ref]) : null;
194
+ let bKeep = true;
195
+ let value = item[filterObj.ref] != null || item[filterObj.ref] != '' ? getSeconds(item[filterObj.ref]) : null;
194
196
  let filterValue = filterObj.containsFilterValue != null && filterObj.containsFilterValue != '' ? getSeconds(filterObj.containsFilterValue) : null;
195
197
 
196
198
  switch (filterObj.containsFilter) {
@@ -237,7 +239,7 @@ export const filterDataByDate = (item, filterObj) => {
237
239
  };
238
240
 
239
241
  export const filterDataByCommonFields = (item, filterObj) => {
240
- let bKeep;
242
+ let bKeep = true;
241
243
  const value = item[filterObj.ref].toLowerCase();
242
244
  const filterValue = filterObj.containsFilterValue.toLowerCase();
243
245
 
@@ -3,8 +3,8 @@
3
3
  <h3 *ngIf="label" className="label" style="font-weight: bold">
4
4
  {{ label }} <span class="results-count">{{ getResultsText() }}</span>
5
5
  </h3>
6
- <table *ngIf="readOnlyMode || allowEditingInModal" mat-table [dataSource]="rowData" class="mat-elevation-z8" id="readonly-table" matSort>
7
- <ng-container *ngFor="let dCol of processedFields" [matColumnDef]="dCol.config.name">
6
+ <table *ngIf="readOnlyMode || allowEditingInModal" mat-table [dataSource]="elementsData" class="mat-elevation-z8" id="readonly-table" matSort>
7
+ <ng-container *ngFor="let dCol of processedFields; let i = index" [matColumnDef]="dCol.config.name">
8
8
  <th mat-header-cell *matHeaderCellDef mat-sort-header (click)="_headerSortClick($event, dCol)" arrowPosition="before">
9
9
  <div>{{ dCol.config.label }}</div>
10
10
  <div class="psdk-mat-header-filter">
@@ -27,7 +27,16 @@
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">
31
+ <component-mapper
32
+ [name]="element[i].getPConnect().getComponentName()"
33
+ [props]="{
34
+ pConn$: element[i].getPConnect(),
35
+ formGroup$: formGroup$
36
+ }"
37
+ errorMsg="Table wants component not yet available: {{ element[i].getPConnect().getComponentName() }}"
38
+ ></component-mapper>
39
+ </td>
31
40
  </ng-container>
32
41
  <ng-container matColumnDef="DeleteIcon">
33
42
  <div *ngIf="allowEditingInModal">
@@ -47,6 +56,11 @@
47
56
  </ng-container>
48
57
  <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
49
58
  <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
59
+ <tr class="mat-row psdk-no-records" *matNoDataRow>
60
+ <td id="no-records" class="mat-cell" [attr.colspan]="displayedColumns.length">
61
+ {{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
62
+ </td>
63
+ </tr>
50
64
  </table>
51
65
  <table *ngIf="editableMode && !allowEditingInModal" mat-table [dataSource]="elementsData" class="mat-elevation-z8" id="editable-table">
52
66
  <ng-container *ngFor="let dCol of fieldDefs; let i = index">
@@ -74,11 +88,16 @@
74
88
  </ng-container>
75
89
  <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
76
90
  <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
91
+ <tr class="mat-row psdk-no-records" *matNoDataRow>
92
+ <td id="no-records" class="mat-cell" [attr.colspan]="displayedColumns.length">
93
+ {{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
94
+ </td>
95
+ </tr>
77
96
  </table>
78
- <div class="psdk-no-records" id="no-records" *ngIf="editableMode && referenceList?.length === 0">No Records Found.</div>
79
- <div class="psdk-no-records" id="no-records" *ngIf="readOnlyMode && rowData?.data?.length === 0">No Records Found.</div>
80
97
  </div>
81
- <button *ngIf="showAddRowButton" mat-button color="primary" style="font-size: 16px" (click)="addRecord()">+ Add</button>
98
+ <button *ngIf="showAddRowButton" mat-button color="primary" style="font-size: 16px" (click)="addRecord()">
99
+ + {{ localizedVal('Add', localeCategory) }}
100
+ </button>
82
101
  </ng-container>
83
102
 
84
103
  <!-- pop overs for filters-->
@@ -4,6 +4,11 @@
4
4
  width: 100%;
5
5
  margin-top: 0.5rem;
6
6
  margin-bottom: 0.5rem;
7
+ overflow-y: auto;
8
+ box-shadow:
9
+ 0px 2px 1px -1px rgba(0, 0, 0, 0.2),
10
+ 0px 1px 1px 0px rgba(0, 0, 0, 0.14),
11
+ 0px 1px 3px 0px rgba(0, 0, 0, 0.12);
7
12
  }
8
13
 
9
14
  table {
@@ -23,6 +28,12 @@ td.mat-mdc-cell,
23
28
  td.mat-mdc-footer-cell {
24
29
  border-right: 1px solid var(--app-neutral-light-color);
25
30
  padding: 8px !important;
31
+ min-width: 10rem;
32
+ }
33
+
34
+ ::ng-deep th.mat-mdc-header-cell:last-child,
35
+ td.mat-mdc-cell:last-child {
36
+ min-width: 2rem;
26
37
  }
27
38
 
28
39
  ::ng-deep .mat-mdc-button {
@@ -159,9 +170,7 @@ tr.mat-mdc-header-row {
159
170
 
160
171
  .psdk-no-records {
161
172
  height: 56px;
162
- justify-content: center;
163
- display: flex;
164
- align-items: center;
173
+ text-align: center;
165
174
  border: 1px solid var(--app-neutral-light-color);
166
175
  border-top: none;
167
176
  background: var(--app-form-color);
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-classes-per-file */
2
1
  import { Component, OnInit, Input, ViewChild, forwardRef, OnDestroy } from '@angular/core';
3
2
  import { CommonModule } from '@angular/common';
4
3
  import { FormGroup } from '@angular/forms';
@@ -18,11 +17,10 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
18
17
  import { DatapageService } from '@pega/angular-sdk-components';
19
18
  import { getReferenceList } from '@pega/angular-sdk-components';
20
19
  import { buildFieldsForTable, filterDataByCommonFields, filterDataByDate, getContext } from './helpers';
20
+ import { evaluateAllowRowAction } from '@pega/angular-sdk-components';
21
21
  import { Utils } from '@pega/angular-sdk-components';
22
22
  import { getSeconds } from '@pega/angular-sdk-components';
23
23
 
24
- declare const window: any;
25
-
26
24
  interface SimpleTableManualProps {
27
25
  // If any, enter additional props that only exist on this component
28
26
  visibility?: boolean;
@@ -37,7 +35,9 @@ interface SimpleTableManualProps {
37
35
  contextClass?: string;
38
36
  propertyLabel?: string;
39
37
  fieldMetadata?: any;
38
+ allowActions?: any;
40
39
  allowTableEdit?: boolean;
40
+ allowRowDelete?: any;
41
41
  editMode?: string;
42
42
  addAndEditRowsWithin?: any;
43
43
  viewForAddAndEditModal?: any;
@@ -45,6 +45,7 @@ interface SimpleTableManualProps {
45
45
  displayMode?: string;
46
46
  useSeparateViewForEdit: any;
47
47
  viewForEditModal: any;
48
+ targetClassLabel: string;
48
49
  }
49
50
 
50
51
  class Group {
@@ -103,6 +104,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
103
104
  showAddRowButton: boolean;
104
105
  prevReferenceList: any[] = [];
105
106
  elementsData: MatTableDataSource<any>;
107
+ originalElementsData: MatTableDataSource<any>;
106
108
  rawFields: any;
107
109
  label?: string = '';
108
110
  searchIcon$: string;
@@ -158,14 +160,17 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
158
160
  settingsSvgIcon$: string;
159
161
 
160
162
  isInitialized = false;
161
-
163
+ targetClassLabel: string;
164
+ localizedVal = PCore.getLocaleUtils().getLocaleValue;
165
+ localeCategory = 'SimpleTable';
162
166
  constructor(
163
167
  private angularPConnect: AngularPConnectService,
164
- private utils: Utils,
168
+ public utils: Utils,
165
169
  private dataPageService: DatapageService
166
170
  ) {}
167
171
 
168
172
  ngOnInit(): void {
173
+ this.elementsData = new MatTableDataSource<any>([]);
169
174
  this.isInitialized = true;
170
175
  // First thing in initialization is registering and subscribing to the AngularPConnect service
171
176
  this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
@@ -219,7 +224,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
219
224
  // but getRawMetadata() has each child.config with datasource and value showing their unresolved values (ex: "@P thePropName")
220
225
  // We need to use the prop name as the "glue" to tie the Angular Material table dataSource, displayColumns and data together.
221
226
  // So, in the code below, we'll use the unresolved config.value (but replacing the space with an underscore to keep things happy)
222
- const rawMetadata: any = this.pConn$.getRawMetadata();
227
+ const rawMetadata = this.pConn$.getRawMetadata();
223
228
 
224
229
  // Adapted from Nebula
225
230
  const {
@@ -227,7 +232,9 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
227
232
  renderMode,
228
233
  children, // destructure children into an array var: "resolvedFields"
229
234
  presets,
235
+ allowActions,
230
236
  allowTableEdit,
237
+ allowRowDelete,
231
238
  label: labelProp,
232
239
  propertyLabel,
233
240
  fieldMetadata,
@@ -237,15 +244,26 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
237
244
  editModeConfig,
238
245
  displayMode,
239
246
  useSeparateViewForEdit,
240
- viewForEditModal
247
+ viewForEditModal,
248
+ targetClassLabel
241
249
  } = this.configProps$;
242
250
 
251
+ const simpleTableManualProps: any = {};
252
+ if (this.checkIfAllowActionsOrRowEditingExist(allowActions) && editMode) {
253
+ simpleTableManualProps.hideAddRow = allowActions?.allowAdd === false;
254
+ simpleTableManualProps.hideDeleteRow = allowActions?.allowDelete === false;
255
+ simpleTableManualProps.hideEditRow = allowActions?.allowEdit === false;
256
+ simpleTableManualProps.disableDragDrop = allowActions?.allowDragDrop === false;
257
+ } else if (allowTableEdit === false) {
258
+ simpleTableManualProps.hideAddRow = true;
259
+ simpleTableManualProps.hideDeleteRow = true;
260
+ simpleTableManualProps.disableDragDrop = true;
261
+ }
262
+
243
263
  this.referenceListStr = getContext(this.pConn$).referenceListStr;
244
264
  this.label = labelProp || propertyLabel;
245
265
  this.parameters = fieldMetadata?.datasource?.parameters;
246
-
247
- const hideAddRow = allowTableEdit === false;
248
- const hideDeleteRow = allowTableEdit === false;
266
+ this.targetClassLabel = targetClassLabel;
249
267
  let { contextClass } = this.configProps$;
250
268
  this.referenceList = referenceList;
251
269
  if (!contextClass) {
@@ -262,7 +280,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
262
280
  // config.value (ex: "@P .DeclarantChoice") or
263
281
  // config.datasource (ex: "@ASSOCIATED .DeclarantChoice")
264
282
  // Neither of these appear in the resolved (this.configProps$)
265
- const rawConfig = rawMetadata?.config;
283
+ const rawConfig: any = rawMetadata?.config;
266
284
  const rawFields = rawConfig?.children?.[0]?.children || rawConfig?.presets?.[0].children?.[0]?.children;
267
285
  this.rawFields = rawFields;
268
286
  // At this point, fields has resolvedFields and rawFields we can use
@@ -282,10 +300,10 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
282
300
  this.readOnlyMode = renderMode === 'ReadOnly';
283
301
  this.editableMode = renderMode === 'Editable';
284
302
  const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
285
- this.showAddRowButton = !this.readOnlyMode && !hideAddRow;
303
+ this.showAddRowButton = !this.readOnlyMode && !simpleTableManualProps.hideAddRow;
286
304
  this.allowEditingInModal =
287
305
  (editMode ? editMode === 'modal' : addAndEditRowsWithin === 'modal') && !(renderMode === 'ReadOnly' || isDisplayModeEnabled);
288
- const showDeleteButton = this.editableMode && !hideDeleteRow;
306
+ const showDeleteButton = this.editableMode && !simpleTableManualProps.hideDeleteRow && evaluateAllowRowAction(allowRowDelete, this.rowData);
289
307
  this.defaultView = editModeConfig ? editModeConfig.defaultView : viewForAddAndEditModal;
290
308
  this.bUseSeparateViewForEdit = editModeConfig ? editModeConfig.useSeparateViewForEdit : useSeparateViewForEdit;
291
309
  this.editView = editModeConfig ? editModeConfig.editView : viewForEditModal;
@@ -324,7 +342,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
324
342
  });
325
343
 
326
344
  // for adding rows to table when editable and not modal view
327
- if (this.prevReferenceList.length !== this.referenceList.length && this.editableMode && !this.allowEditingInModal) {
345
+ if (this.prevReferenceList.length !== this.referenceList.length) {
328
346
  this.buildElementsForTable();
329
347
  }
330
348
 
@@ -351,11 +369,14 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
351
369
  // ties the 3 data structures together.
352
370
  }
353
371
 
372
+ checkIfAllowActionsOrRowEditingExist(newflagobject) {
373
+ return (newflagobject && Object.keys(newflagobject).length > 0) || this.pConn$.getComponentConfig().allowRowEdit;
374
+ }
375
+
354
376
  initializeDefaultPageInstructions() {
355
377
  if (this.isInitialized) {
356
378
  this.isInitialized = false;
357
379
  if (this.allowEditingInModal) {
358
- // @ts-ignore - An argument for 'uniqueField' was not provided.
359
380
  this.pConn$.getListActions().initDefaultPageInstructions(
360
381
  this.pConn$.getReferenceList(),
361
382
  this.fieldDefs.filter(item => item.name).map(item => item.name)
@@ -373,8 +394,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
373
394
  }
374
395
 
375
396
  sortCompare(a, b): number {
376
- let aValue = a[this.compareRef];
377
- let bValue = b[this.compareRef];
397
+ let aValue = a[0][this.compareRef];
398
+ let bValue = b[0][this.compareRef];
378
399
 
379
400
  if (this.compareType == 'Date' || this.compareType == 'DateTime') {
380
401
  aValue = getSeconds(aValue);
@@ -497,17 +518,20 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
497
518
  // run through list of elements in path, if menu not in th path, then want to
498
519
  // hide (toggle) the menu
499
520
  const eventPath = event.path;
500
- for (let eventIndex = 0; eventIndex < eventPath.length; eventIndex++) {
501
- if (
502
- eventPath[eventIndex].className == 'psdk-modal-file-top' ||
503
- eventPath[eventIndex].tagName == 'BUTTON' ||
504
- eventPath[eventIndex].tagName == 'MAT-OPTION' ||
505
- eventPath[eventIndex].tagName == 'MAT-INPUT'
506
- ) {
507
- bInPopUp = true;
508
- break;
521
+ if (eventPath) {
522
+ for (let eventIndex = 0; eventIndex < eventPath.length; eventIndex++) {
523
+ if (
524
+ eventPath[eventIndex].className == 'psdk-modal-file-top' ||
525
+ eventPath[eventIndex].tagName == 'BUTTON' ||
526
+ eventPath[eventIndex].tagName == 'MAT-OPTION' ||
527
+ eventPath[eventIndex].tagName == 'MAT-INPUT'
528
+ ) {
529
+ bInPopUp = true;
530
+ break;
531
+ }
509
532
  }
510
533
  }
534
+
511
535
  if (!bInPopUp) {
512
536
  // this.bShowFilterPopover$ = false;
513
537
 
@@ -626,7 +650,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
626
650
  }
627
651
  }
628
652
 
629
- filterData(item: any) {
653
+ filterData(element: any) {
654
+ const item = element[0];
630
655
  let bKeep = true;
631
656
  for (const filterObj of this.filterByColumns) {
632
657
  if (filterObj.containsFilterValue != '' || filterObj.containsFilter == 'null' || filterObj.containsFilter == 'notnull') {
@@ -640,6 +665,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
640
665
  bKeep = filterDataByCommonFields(item, filterObj);
641
666
  break;
642
667
  }
668
+ } else if (filterObj.containsFilterValue === '') {
669
+ bKeep = true;
643
670
  }
644
671
 
645
672
  // if don't keep stop filtering
@@ -652,14 +679,22 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
652
679
  }
653
680
 
654
681
  filterSortGroupBy() {
655
- let theData = this.originalData.slice();
682
+ let theData = this.originalData.slice().map((item, index) => {
683
+ return [item, index];
684
+ });
656
685
 
657
686
  // last filter config data is global
658
687
  theData = theData.filter(this.filterData.bind(this));
659
688
 
660
689
  // last sort config data is global
661
690
  theData.sort(this.sortCompare.bind(this));
662
- this.rowData.data = theData;
691
+ this.rowData.data = theData.map(item => item[0]);
692
+
693
+ const newElements: any = new Array(this.rowData.data.length);
694
+ theData.forEach((item, index) => {
695
+ newElements[index] = this.originalElementsData[item[1]];
696
+ });
697
+ this.elementsData = newElements;
663
698
  }
664
699
 
665
700
  _headerSortClick(event, columnData) {
@@ -918,19 +953,19 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
918
953
  .getActionsApi()
919
954
  .openEmbeddedDataModal(
920
955
  this.defaultView,
921
- this.pConn$,
956
+ this.pConn$ as any,
922
957
  this.referenceListStr,
923
958
  this.referenceList.length,
924
- PCore.getConstants().RESOURCE_STATUS.CREATE
959
+ PCore.getConstants().RESOURCE_STATUS.CREATE,
960
+ this.targetClassLabel
925
961
  );
926
962
  } else {
927
- // @ts-ignore - second parameter "pageRef" is optional for insert method
928
963
  this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length);
929
964
  }
930
965
 
931
966
  this.pConn$.clearErrorMessages({
932
- property: (this.pConn$.getStateProps() as any)?.referenceList?.substring(1)
933
- } as any);
967
+ property: this.pConn$.getStateProps()?.referenceList?.substring(1)
968
+ });
934
969
  }
935
970
 
936
971
  editRecord(data, index) {
@@ -939,16 +974,16 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
939
974
  .getActionsApi()
940
975
  .openEmbeddedDataModal(
941
976
  this.bUseSeparateViewForEdit ? this.editView : this.defaultView,
942
- this.pConn$,
977
+ this.pConn$ as any,
943
978
  this.referenceListStr,
944
979
  index,
945
- PCore.getConstants().RESOURCE_STATUS.UPDATE
980
+ PCore.getConstants().RESOURCE_STATUS.UPDATE,
981
+ this.targetClassLabel
946
982
  );
947
983
  }
948
984
  }
949
985
 
950
986
  deleteRecord(index) {
951
- // @ts-ignore - second parameter "pageRef" is optional for deleteEntry method
952
987
  this.pConn$.getListActions().deleteEntry(index);
953
988
  }
954
989
 
@@ -958,6 +993,10 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
958
993
  this.referenceList.forEach((element, index) => {
959
994
  const data: any = [];
960
995
  this.rawFields?.forEach(item => {
996
+ item = {
997
+ ...item,
998
+ config: { ...item.config, label: '', displayMode: this.readOnlyMode || this.allowEditingInModal ? 'DISPLAY_ONLY' : undefined }
999
+ };
961
1000
  const referenceListData = getReferenceList(this.pConn$);
962
1001
  const isDatapage = referenceListData.startsWith('D_');
963
1002
  const pageReferenceValue = isDatapage ? `${referenceListData}[${index}]` : `${this.pConn$.getPageReference()}${referenceListData}[${index}]`;
@@ -975,6 +1014,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
975
1014
  });
976
1015
  eleData.push(data);
977
1016
  });
1017
+ this.originalElementsData = eleData;
978
1018
  this.elementsData = eleData;
979
1019
  }
980
1020
  }