@pega/angular-sdk-overrides 0.24.9 → 0.242.2

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 (75) 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/operator/operator.component.ts +1 -1
  4. package/lib/designSystemExtension/pulse/pulse.component.ts +7 -7
  5. package/lib/field/auto-complete/auto-complete.component.ts +3 -3
  6. package/lib/field/check-box/check-box.component.ts +3 -3
  7. package/lib/field/currency/currency.component.ts +3 -3
  8. package/lib/field/date/date.component.ts +3 -3
  9. package/lib/field/date-time/date-time.component.ts +2 -2
  10. package/lib/field/decimal/decimal.component.ts +4 -4
  11. package/lib/field/dropdown/dropdown.component.ts +3 -3
  12. package/lib/field/email/email.component.ts +1 -1
  13. package/lib/field/group/group.component.ts +2 -2
  14. package/lib/field/integer/integer.component.ts +1 -1
  15. package/lib/field/multiselect/multiselect.component.ts +4 -2
  16. package/lib/field/percentage/percentage.component.ts +2 -2
  17. package/lib/field/phone/phone.component.ts +1 -1
  18. package/lib/field/radio-buttons/radio-buttons.component.ts +2 -2
  19. package/lib/field/rich-text/rich-text.component.ts +3 -3
  20. package/lib/field/scalar-list/scalar-list.component.ts +3 -4
  21. package/lib/field/text-area/text-area.component.ts +1 -1
  22. package/lib/field/text-input/text-input.component.ts +1 -1
  23. package/lib/field/time/time.component.ts +1 -1
  24. package/lib/field/url/url.component.ts +1 -1
  25. package/lib/field/user-reference/user-reference.component.ts +1 -1
  26. package/lib/infra/Containers/flow-container/flow-container.component.ts +9 -6
  27. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +1 -1
  28. package/lib/infra/Containers/preview-view-container/preview-view-container.component.ts +1 -1
  29. package/lib/infra/Containers/view-container/helper.ts +22 -0
  30. package/lib/infra/Containers/view-container/view-container.component.ts +5 -17
  31. package/lib/infra/assignment/assignment.component.ts +0 -1
  32. package/lib/infra/defer-load/defer-load.component.ts +4 -4
  33. package/lib/infra/navbar/navbar.component.ts +3 -3
  34. package/lib/infra/root-container/root-container.component.ts +3 -3
  35. package/lib/infra/view/view.component.html +6 -19
  36. package/lib/template/app-shell/app-shell.component.ts +20 -2
  37. package/lib/template/case-summary/case-summary.component.ts +1 -1
  38. package/lib/template/case-view/case-view.component.ts +1 -1
  39. package/lib/template/confirmation/confirmation.component.ts +1 -1
  40. package/lib/template/data-reference/data-reference.component.ts +36 -40
  41. package/lib/template/default-form/default-form.component.ts +7 -4
  42. package/lib/template/details/details.component.ts +2 -2
  43. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +1 -1
  44. package/lib/template/details-one-column/details-one-column.component.ts +2 -2
  45. package/lib/template/details-three-column/details-three-column.component.ts +2 -2
  46. package/lib/template/details-two-column/details-two-column.component.ts +2 -2
  47. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +2 -2
  48. package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +2 -2
  49. package/lib/template/field-group-template/field-group-template.component.ts +2 -4
  50. package/lib/template/field-value-list/field-value-list.component.html +1 -1
  51. package/lib/template/form-template-base/form-template-base.component.ts +10 -0
  52. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -2
  53. package/lib/template/list-view/list-view.component.ts +3 -3
  54. package/lib/template/list-view/listViewHelpers.ts +1 -1
  55. package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +1 -1
  56. package/lib/template/one-column/one-column.component.ts +4 -3
  57. package/lib/template/one-column-tab/one-column-tab.component.ts +1 -1
  58. package/lib/template/page/page.component.ts +1 -1
  59. package/lib/template/promoted-filters/promoted-filters.component.ts +1 -1
  60. package/lib/template/repeating-structures/repeating-structures.component.ts +1 -1
  61. package/lib/template/simple-table-manual/helpers.ts +1 -1
  62. package/lib/template/simple-table-manual/simple-table-manual.component.ts +15 -13
  63. package/lib/template/simple-table-select/simple-table-select.component.ts +3 -3
  64. package/lib/template/three-column/three-column.component.ts +4 -3
  65. package/lib/template/two-column/two-column.component.ts +4 -3
  66. package/lib/template/two-column-tab/two-column-tab.component.ts +1 -1
  67. package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +4 -3
  68. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +1 -1
  69. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +3 -3
  70. package/lib/widget/attachment/attachment.component.ts +7 -9
  71. package/lib/widget/feed-container/feed-container.component.ts +7 -7
  72. package/lib/widget/file-utility/file-utility.component.ts +2 -5
  73. package/lib/widget/todo/todo.component.html +2 -2
  74. package/lib/widget/todo/todo.component.ts +93 -83
  75. package/package.json +1 -1
@@ -1,10 +1,54 @@
1
- import { Component, OnInit, Input, NgZone, OnDestroy, OnChanges } from '@angular/core';
1
+ import { Component, OnInit, Input, OnDestroy } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { MatButtonModule } from '@angular/material/button';
4
4
  import { publicConstants } from '@pega/pcore-pconnect-typedefs/constants';
5
5
  import { ProgressSpinnerService } from '@pega/angular-sdk-components';
6
6
  import { ErrorMessagesService } from '@pega/angular-sdk-components';
7
7
  import { Utils } from '@pega/angular-sdk-components';
8
+ import { updateWorkList } from '@pega/angular-sdk-components';
9
+
10
+ const fetchMyWorkList = (datapage, fields, numberOfRecords, includeTotalCount, context) => {
11
+ return PCore.getDataPageUtils()
12
+ .getDataAsync(
13
+ datapage,
14
+ context,
15
+ {},
16
+ {
17
+ pageNumber: 1,
18
+ pageSize: numberOfRecords
19
+ },
20
+ {
21
+ select: Object.keys(fields).map(key => ({ field: PCore.getAnnotationUtils().getPropertyName(fields[key]) })),
22
+ sortBy: [
23
+ { field: 'pxUrgencyAssign', type: 'DESC' },
24
+ { field: 'pxDeadlineTime', type: 'ASC' },
25
+ { field: 'pxCreateDateTime', type: 'DESC' }
26
+ ]
27
+ },
28
+ {
29
+ invalidateCache: true,
30
+ additionalApiParams: {
31
+ includeTotalCount
32
+ }
33
+ }
34
+ )
35
+ .then(response => {
36
+ return {
37
+ ...response,
38
+ data: (Array.isArray(response?.data) ? response.data : []).map(row =>
39
+ Object.keys(fields).reduce((obj, key) => {
40
+ obj[key] = row[PCore.getAnnotationUtils().getPropertyName(fields[key])];
41
+ return obj;
42
+ }, {})
43
+ )
44
+ };
45
+ });
46
+ };
47
+
48
+ const getMappedValue = value => {
49
+ const mappedValue = PCore.getEnvironmentInfo().getKeyMapping(value);
50
+ return mappedValue === null ? value : mappedValue;
51
+ };
8
52
 
9
53
  interface ToDoProps {
10
54
  // If any, enter additional props that only exist on this component
@@ -23,7 +67,7 @@ interface ToDoProps {
23
67
  standalone: true,
24
68
  imports: [CommonModule, MatButtonModule]
25
69
  })
26
- export class TodoComponent implements OnInit, OnDestroy, OnChanges {
70
+ export class TodoComponent implements OnInit, OnDestroy {
27
71
  @Input() pConn$: typeof PConnect;
28
72
  @Input() caseInfoID$: string;
29
73
  @Input() datasource$: any;
@@ -36,9 +80,8 @@ export class TodoComponent implements OnInit, OnDestroy, OnChanges {
36
80
  @Input() isConfirm;
37
81
 
38
82
  configProps$: ToDoProps;
39
- currentUser$: string;
83
+ currentUser$: string | undefined;
40
84
  currentUserInitials$ = '--';
41
- assignmentCount$: number;
42
85
  bShowMore$ = true;
43
86
  arAssignments$: any[];
44
87
  assignmentsSource$: any;
@@ -49,99 +92,62 @@ export class TodoComponent implements OnInit, OnDestroy, OnChanges {
49
92
  showlessLocalizedValue = this.localizedVal('show_less', 'CosmosFields');
50
93
  showMoreLocalizedValue = this.localizedVal('show_more', 'CosmosFields');
51
94
  canPerform: boolean;
95
+ count: number;
52
96
 
53
97
  constructor(
54
98
  private psService: ProgressSpinnerService,
55
99
  private erService: ErrorMessagesService,
56
- private ngZone: NgZone,
57
100
  private utils: Utils
58
101
  ) {}
59
102
 
60
103
  ngOnInit() {
61
104
  this.CONSTS = PCore.getConstants();
62
- const { CREATE_STAGE_SAVED, CREATE_STAGE_DELETED }: any = PCore.getEvents().getCaseEvent();
63
-
64
- PCore.getPubSubUtils().subscribe(
65
- PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL,
66
- () => {
67
- this.updateToDo();
68
- },
69
- 'updateToDo'
70
- );
71
-
72
- PCore.getPubSubUtils().subscribe(
73
- CREATE_STAGE_SAVED,
74
- () => {
75
- this.updateList();
76
- },
77
- CREATE_STAGE_SAVED
78
- );
105
+ const { CREATE_STAGE_SAVED, CREATE_STAGE_DELETED } = PCore.getEvents().getCaseEvent();
79
106
 
80
- PCore.getPubSubUtils().subscribe(
81
- CREATE_STAGE_DELETED,
82
- () => {
83
- this.updateList();
84
- },
85
- CREATE_STAGE_DELETED
86
- );
107
+ PCore.getPubSubUtils().subscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, () => this.updateToDo(), 'updateToDo');
108
+ PCore.getPubSubUtils().subscribe(CREATE_STAGE_SAVED, () => this.updateList(), CREATE_STAGE_SAVED);
109
+ PCore.getPubSubUtils().subscribe(CREATE_STAGE_DELETED, () => this.updateList(), CREATE_STAGE_DELETED);
87
110
 
88
111
  this.updateToDo();
89
112
  }
90
113
 
91
114
  ngOnDestroy() {
92
- const { CREATE_STAGE_SAVED, CREATE_STAGE_DELETED }: any = PCore.getEvents().getCaseEvent();
115
+ const { CREATE_STAGE_SAVED, CREATE_STAGE_DELETED } = PCore.getEvents().getCaseEvent();
93
116
 
94
117
  PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, 'updateToDo');
95
-
96
118
  PCore.getPubSubUtils().unsubscribe(CREATE_STAGE_SAVED, CREATE_STAGE_SAVED);
97
-
98
119
  PCore.getPubSubUtils().unsubscribe(CREATE_STAGE_DELETED, CREATE_STAGE_DELETED);
99
120
  }
100
121
 
101
- ngOnChanges() {
102
- // don't update until we'va had an init
103
- if (PCore) {
104
- this.updateToDo();
105
- }
106
- }
107
-
108
- updateWorkList(key) {
109
- PCore.getDataApiUtils()
110
- // @ts-ignore - 2nd parameter "payload" and 3rd parameter "context" should be optional in getData method
111
- .getData(key)
112
- .then(responseData => {
113
- const dataObject = {};
114
- dataObject[key] = {
115
- pxResults: responseData.data.data
116
- };
117
-
118
- this.pConn$.updateState(dataObject);
119
- this.updateToDo();
120
- })
121
- .catch(err => {
122
- console.error(err?.stack);
123
- });
124
- }
125
-
126
122
  updateList() {
127
- this.updateWorkList('D_pyMyWorkList');
123
+ const {
124
+ WORK_BASKET: {
125
+ DATA_PAGES: { D__PY_MY_WORK_LIST }
126
+ }
127
+ } = PCore.getConstants();
128
+ updateWorkList(getPConnect, getMappedValue(D__PY_MY_WORK_LIST));
128
129
  }
129
130
 
130
131
  updateToDo() {
131
132
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ToDoProps;
132
133
 
133
- if (this.headerText$ == undefined) {
134
- this.headerText$ = this.configProps$.headerText;
135
- }
136
-
137
- this.datasource$ = this.configProps$.datasource ? this.configProps$.datasource : this.datasource$;
138
- this.myWorkList$ = this.configProps$.myWorkList ? this.configProps$.myWorkList : this.myWorkList$;
134
+ this.headerText$ = this.headerText$ || this.configProps$.headerText;
135
+ this.datasource$ = this.datasource$ || this.configProps$.datasource;
136
+ this.myWorkList$ = this.myWorkList$ || this.configProps$.myWorkList;
139
137
 
140
138
  this.assignmentsSource$ = this.datasource$?.source || this.myWorkList$?.source;
141
139
 
142
140
  if (this.showTodoList$) {
143
- this.assignmentCount$ = this.assignmentsSource$ != null ? this.assignmentsSource$.length : 0;
144
- this.arAssignments$ = this.topThreeAssignments(this.assignmentsSource$);
141
+ if (this.assignmentsSource$) {
142
+ this.count = this.assignmentsSource$ ? this.assignmentsSource$.length : 0;
143
+ this.arAssignments$ = this.topThreeAssignments(this.assignmentsSource$);
144
+ } else if (this.myWorkList$.datapage) {
145
+ fetchMyWorkList(this.myWorkList$.datapage, this.pConn$.getComponentConfig()?.myWorkList.fields, 3, true, this.context$).then(responseData => {
146
+ this.deferLoadWorklistItems(responseData);
147
+ });
148
+ } else {
149
+ this.arAssignments$ = [];
150
+ }
145
151
  } else {
146
152
  // get caseInfoId assignment.
147
153
  // eslint-disable-next-line no-lonely-if
@@ -153,7 +159,12 @@ export class TodoComponent implements OnInit, OnDestroy, OnChanges {
153
159
  this.canPerform = this.arAssignments$?.[0]?.canPerform === 'true' || this.arAssignments$?.[0]?.canPerform === true;
154
160
 
155
161
  this.currentUser$ = PCore.getEnvironmentInfo().getOperatorName();
156
- this.currentUserInitials$ = this.utils.getInitials(this.currentUser$);
162
+ this.currentUserInitials$ = this.utils.getInitials(this.currentUser$ ?? '');
163
+ }
164
+
165
+ deferLoadWorklistItems(responseData) {
166
+ this.count = responseData.totalCount;
167
+ this.arAssignments$ = responseData.data;
157
168
  }
158
169
 
159
170
  getID(assignment: any) {
@@ -182,15 +193,6 @@ export class TodoComponent implements OnInit, OnDestroy, OnChanges {
182
193
  return this.type$ === this.CONSTS.TODO ? assignment.name : assignment.stepName;
183
194
  }
184
195
 
185
- initAssignments(): any[] {
186
- if (this.assignmentsSource$) {
187
- this.assignmentCount$ = this.assignmentsSource$.length;
188
- return this.topThreeAssignments(this.assignmentsSource$);
189
- }
190
- // turn off todolist
191
- return [];
192
- }
193
-
194
196
  getCaseInfoAssignment(assignmentsSource: any[], caseInfoID: string) {
195
197
  const result: any[] = [];
196
198
  for (const source of assignmentsSource) {
@@ -207,18 +209,26 @@ export class TodoComponent implements OnInit, OnDestroy, OnChanges {
207
209
  }
208
210
 
209
211
  _showMore() {
210
- this.ngZone.run(() => {
211
- this.bShowMore$ = false;
212
+ this.bShowMore$ = false;
213
+
214
+ const { WORKLIST } = PCore.getConstants();
215
+
216
+ if (this.type$ === WORKLIST && this.count && this.count > this.arAssignments$.length && !this.assignmentsSource$) {
217
+ fetchMyWorkList(this.myWorkList$.datapage, this.pConn$.getComponentConfig()?.myWorkList.fields, this.count, false, this.context$).then(
218
+ response => {
219
+ this.arAssignments$ = response.data;
220
+ }
221
+ );
222
+ } else {
212
223
  this.arAssignments$ = this.assignmentsSource$;
213
- });
224
+ }
214
225
  }
215
226
 
216
227
  _showLess() {
217
- this.ngZone.run(() => {
218
- this.bShowMore$ = true;
228
+ this.bShowMore$ = true;
229
+ const { WORKLIST } = PCore.getConstants();
219
230
 
220
- this.arAssignments$ = this.topThreeAssignments(this.assignmentsSource$);
221
- });
231
+ this.arAssignments$ = this.type$ === WORKLIST ? this.arAssignments$.slice(0, 3) : this.topThreeAssignments(this.assignmentsSource$);
222
232
  }
223
233
 
224
234
  isChildCase(assignment) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.24.9",
3
+ "version": "0.242.2",
4
4
  "description": "Angular SDK - Code for overriding components",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"