@pega/angular-sdk-overrides 0.242.7 → 0.242.9

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 (53) hide show
  1. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -1
  2. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +1 -1
  3. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +6 -0
  4. package/lib/designSystemExtension/operator/operator.component.html +1 -1
  5. package/lib/designSystemExtension/operator/operator.component.scss +10 -2
  6. package/lib/designSystemExtension/operator/operator.component.ts +4 -3
  7. package/lib/field/auto-complete/auto-complete.component.html +0 -1
  8. package/lib/field/auto-complete/auto-complete.component.ts +15 -2
  9. package/lib/field/currency/currency.component.ts +19 -13
  10. package/lib/field/date-time/date-time.component.html +0 -1
  11. package/lib/field/date-time/date-time.component.ts +17 -3
  12. package/lib/field/decimal/decimal.component.html +1 -0
  13. package/lib/field/decimal/decimal.component.ts +38 -15
  14. package/lib/field/dropdown/dropdown.component.ts +18 -4
  15. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
  16. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +3 -2
  17. package/lib/field/percentage/percentage.component.html +1 -1
  18. package/lib/field/percentage/percentage.component.ts +27 -17
  19. package/lib/field/phone/config-ext.json +1 -1
  20. package/lib/field/phone/phone.component.ts +6 -13
  21. package/lib/field/rich-text/rich-text.component.ts +12 -3
  22. package/lib/field/text/text.component.ts +2 -2
  23. package/lib/field/text-input/text-input.component.ts +1 -1
  24. package/lib/field/time/time.component.html +1 -1
  25. package/lib/field/time/time.component.ts +21 -6
  26. package/lib/field/user-reference/user-reference.component.html +40 -38
  27. package/lib/field/user-reference/user-reference.component.ts +70 -7
  28. package/lib/infra/Containers/flow-container/flow-container.component.ts +7 -2
  29. package/lib/infra/Containers/flow-container/helpers.ts +1 -1
  30. package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
  31. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +0 -1
  32. package/lib/infra/action-buttons/action-buttons.component.html +1 -1
  33. package/lib/infra/assignment/assignment.component.ts +2 -4
  34. package/lib/infra/assignment-card/assignment-card.component.ts +4 -32
  35. package/lib/infra/defer-load/defer-load.component.ts +4 -1
  36. package/lib/infra/reference/reference.component.ts +70 -86
  37. package/lib/infra/root-container/root-container.component.ts +24 -17
  38. package/lib/template/default-form/default-form.component.ts +5 -7
  39. package/lib/template/field-group-template/field-group-template.component.html +7 -7
  40. package/lib/template/field-group-template/field-group-template.component.scss +8 -0
  41. package/lib/template/field-group-template/field-group-template.component.ts +64 -41
  42. package/lib/template/field-group-template/utils.ts +9 -0
  43. package/lib/template/field-value-list/field-value-list.component.html +2 -2
  44. package/lib/template/field-value-list/field-value-list.component.scss +4 -0
  45. package/lib/template/list-view/list-view.component.html +3 -1
  46. package/lib/template/list-view/list-view.component.ts +1 -1
  47. package/lib/template/simple-table-manual/helpers.ts +18 -2
  48. package/lib/template/simple-table-manual/simple-table-manual.component.html +25 -6
  49. package/lib/template/simple-table-manual/simple-table-manual.component.scss +11 -3
  50. package/lib/template/simple-table-manual/simple-table-manual.component.ts +62 -22
  51. package/lib/widget/todo/todo.component.html +0 -1
  52. package/lib/widget/todo/todo.component.scss +2 -0
  53. package/package.json +1 -1
@@ -16,7 +16,7 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
16
16
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
17
17
  import { DatapageService } from '@pega/angular-sdk-components';
18
18
  import { getReferenceList } from '@pega/angular-sdk-components';
19
- import { buildFieldsForTable, filterDataByCommonFields, filterDataByDate, getContext } from './helpers';
19
+ import { buildFieldsForTable, evaluateAllowRowAction, filterDataByCommonFields, filterDataByDate, getContext } from './helpers';
20
20
  import { Utils } from '@pega/angular-sdk-components';
21
21
  import { getSeconds } from '@pega/angular-sdk-components';
22
22
 
@@ -36,7 +36,9 @@ interface SimpleTableManualProps {
36
36
  contextClass?: string;
37
37
  propertyLabel?: string;
38
38
  fieldMetadata?: any;
39
+ allowActions?: any;
39
40
  allowTableEdit?: boolean;
41
+ allowRowDelete?: any;
40
42
  editMode?: string;
41
43
  addAndEditRowsWithin?: any;
42
44
  viewForAddAndEditModal?: any;
@@ -103,6 +105,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
103
105
  showAddRowButton: boolean;
104
106
  prevReferenceList: any[] = [];
105
107
  elementsData: MatTableDataSource<any>;
108
+ originalElementsData: MatTableDataSource<any>;
106
109
  rawFields: any;
107
110
  label?: string = '';
108
111
  searchIcon$: string;
@@ -159,14 +162,16 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
159
162
 
160
163
  isInitialized = false;
161
164
  targetClassLabel: string;
162
-
165
+ localizedVal = PCore.getLocaleUtils().getLocaleValue;
166
+ localeCategory = 'SimpleTable';
163
167
  constructor(
164
168
  private angularPConnect: AngularPConnectService,
165
- private utils: Utils,
169
+ public utils: Utils,
166
170
  private dataPageService: DatapageService
167
171
  ) {}
168
172
 
169
173
  ngOnInit(): void {
174
+ this.elementsData = new MatTableDataSource<any>([]);
170
175
  this.isInitialized = true;
171
176
  // First thing in initialization is registering and subscribing to the AngularPConnect service
172
177
  this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
@@ -228,7 +233,9 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
228
233
  renderMode,
229
234
  children, // destructure children into an array var: "resolvedFields"
230
235
  presets,
236
+ allowActions,
231
237
  allowTableEdit,
238
+ allowRowDelete,
232
239
  label: labelProp,
233
240
  propertyLabel,
234
241
  fieldMetadata,
@@ -242,12 +249,22 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
242
249
  targetClassLabel
243
250
  } = this.configProps$;
244
251
 
252
+ const simpleTableManualProps: any = {};
253
+ if (this.checkIfAllowActionsOrRowEditingExist(allowActions) && editMode) {
254
+ simpleTableManualProps.hideAddRow = allowActions?.allowAdd === false;
255
+ simpleTableManualProps.hideDeleteRow = allowActions?.allowDelete === false;
256
+ simpleTableManualProps.hideEditRow = allowActions?.allowEdit === false;
257
+ simpleTableManualProps.disableDragDrop = allowActions?.allowDragDrop === false;
258
+ } else if (allowTableEdit === false) {
259
+ simpleTableManualProps.hideAddRow = true;
260
+ simpleTableManualProps.hideDeleteRow = true;
261
+ simpleTableManualProps.disableDragDrop = true;
262
+ }
263
+
245
264
  this.referenceListStr = getContext(this.pConn$).referenceListStr;
246
265
  this.label = labelProp || propertyLabel;
247
266
  this.parameters = fieldMetadata?.datasource?.parameters;
248
267
  this.targetClassLabel = targetClassLabel;
249
- const hideAddRow = allowTableEdit === false;
250
- const hideDeleteRow = allowTableEdit === false;
251
268
  let { contextClass } = this.configProps$;
252
269
  this.referenceList = referenceList;
253
270
  if (!contextClass) {
@@ -284,10 +301,10 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
284
301
  this.readOnlyMode = renderMode === 'ReadOnly';
285
302
  this.editableMode = renderMode === 'Editable';
286
303
  const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
287
- this.showAddRowButton = !this.readOnlyMode && !hideAddRow;
304
+ this.showAddRowButton = !this.readOnlyMode && !simpleTableManualProps.hideAddRow;
288
305
  this.allowEditingInModal =
289
306
  (editMode ? editMode === 'modal' : addAndEditRowsWithin === 'modal') && !(renderMode === 'ReadOnly' || isDisplayModeEnabled);
290
- const showDeleteButton = this.editableMode && !hideDeleteRow;
307
+ const showDeleteButton = this.editableMode && !simpleTableManualProps.hideDeleteRow && evaluateAllowRowAction(allowRowDelete, this.rowData);
291
308
  this.defaultView = editModeConfig ? editModeConfig.defaultView : viewForAddAndEditModal;
292
309
  this.bUseSeparateViewForEdit = editModeConfig ? editModeConfig.useSeparateViewForEdit : useSeparateViewForEdit;
293
310
  this.editView = editModeConfig ? editModeConfig.editView : viewForEditModal;
@@ -326,7 +343,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
326
343
  });
327
344
 
328
345
  // for adding rows to table when editable and not modal view
329
- if (this.prevReferenceList.length !== this.referenceList.length && this.editableMode && !this.allowEditingInModal) {
346
+ if (this.prevReferenceList.length !== this.referenceList.length) {
330
347
  this.buildElementsForTable();
331
348
  }
332
349
 
@@ -353,6 +370,10 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
353
370
  // ties the 3 data structures together.
354
371
  }
355
372
 
373
+ checkIfAllowActionsOrRowEditingExist(newflagobject) {
374
+ return (newflagobject && Object.keys(newflagobject).length > 0) || this.pConn$.getComponentConfig().allowRowEdit;
375
+ }
376
+
356
377
  initializeDefaultPageInstructions() {
357
378
  if (this.isInitialized) {
358
379
  this.isInitialized = false;
@@ -374,8 +395,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
374
395
  }
375
396
 
376
397
  sortCompare(a, b): number {
377
- let aValue = a[this.compareRef];
378
- let bValue = b[this.compareRef];
398
+ let aValue = a[0][this.compareRef];
399
+ let bValue = b[0][this.compareRef];
379
400
 
380
401
  if (this.compareType == 'Date' || this.compareType == 'DateTime') {
381
402
  aValue = getSeconds(aValue);
@@ -498,17 +519,20 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
498
519
  // run through list of elements in path, if menu not in th path, then want to
499
520
  // hide (toggle) the menu
500
521
  const eventPath = event.path;
501
- for (let eventIndex = 0; eventIndex < eventPath.length; eventIndex++) {
502
- if (
503
- eventPath[eventIndex].className == 'psdk-modal-file-top' ||
504
- eventPath[eventIndex].tagName == 'BUTTON' ||
505
- eventPath[eventIndex].tagName == 'MAT-OPTION' ||
506
- eventPath[eventIndex].tagName == 'MAT-INPUT'
507
- ) {
508
- bInPopUp = true;
509
- break;
522
+ if (eventPath) {
523
+ for (let eventIndex = 0; eventIndex < eventPath.length; eventIndex++) {
524
+ if (
525
+ eventPath[eventIndex].className == 'psdk-modal-file-top' ||
526
+ eventPath[eventIndex].tagName == 'BUTTON' ||
527
+ eventPath[eventIndex].tagName == 'MAT-OPTION' ||
528
+ eventPath[eventIndex].tagName == 'MAT-INPUT'
529
+ ) {
530
+ bInPopUp = true;
531
+ break;
532
+ }
510
533
  }
511
534
  }
535
+
512
536
  if (!bInPopUp) {
513
537
  // this.bShowFilterPopover$ = false;
514
538
 
@@ -627,7 +651,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
627
651
  }
628
652
  }
629
653
 
630
- filterData(item: any) {
654
+ filterData(element: any) {
655
+ const item = element[0];
631
656
  let bKeep = true;
632
657
  for (const filterObj of this.filterByColumns) {
633
658
  if (filterObj.containsFilterValue != '' || filterObj.containsFilter == 'null' || filterObj.containsFilter == 'notnull') {
@@ -641,6 +666,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
641
666
  bKeep = filterDataByCommonFields(item, filterObj);
642
667
  break;
643
668
  }
669
+ } else if (filterObj.containsFilterValue === '') {
670
+ bKeep = true;
644
671
  }
645
672
 
646
673
  // if don't keep stop filtering
@@ -653,14 +680,22 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
653
680
  }
654
681
 
655
682
  filterSortGroupBy() {
656
- let theData = this.originalData.slice();
683
+ let theData = this.originalData.slice().map((item, index) => {
684
+ return [item, index];
685
+ });
657
686
 
658
687
  // last filter config data is global
659
688
  theData = theData.filter(this.filterData.bind(this));
660
689
 
661
690
  // last sort config data is global
662
691
  theData.sort(this.sortCompare.bind(this));
663
- this.rowData.data = theData;
692
+ this.rowData.data = theData.map(item => item[0]);
693
+
694
+ const newElements: any = new Array(this.rowData.data.length);
695
+ theData.forEach((item, index) => {
696
+ newElements[index] = this.originalElementsData[item[1]];
697
+ });
698
+ this.elementsData = newElements;
664
699
  }
665
700
 
666
701
  _headerSortClick(event, columnData) {
@@ -959,6 +994,10 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
959
994
  this.referenceList.forEach((element, index) => {
960
995
  const data: any = [];
961
996
  this.rawFields?.forEach(item => {
997
+ item = {
998
+ ...item,
999
+ config: { ...item.config, label: '', displayMode: this.readOnlyMode || this.allowEditingInModal ? 'DISPLAY_ONLY' : undefined }
1000
+ };
962
1001
  const referenceListData = getReferenceList(this.pConn$);
963
1002
  const isDatapage = referenceListData.startsWith('D_');
964
1003
  const pageReferenceValue = isDatapage ? `${referenceListData}[${index}]` : `${this.pConn$.getPageReference()}${referenceListData}[${index}]`;
@@ -976,6 +1015,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
976
1015
  });
977
1016
  eleData.push(data);
978
1017
  });
1018
+ this.originalElementsData = eleData;
979
1019
  this.elementsData = eleData;
980
1020
  }
981
1021
  }
@@ -4,7 +4,6 @@
4
4
  <div id="worklist" class="psdk-todo-text">{{ headerText$ }}</div>
5
5
  <div class="psdk-assignment-count">{{ count }}</div>
6
6
  </div>
7
- <br /><br />
8
7
  <div *ngIf="showTodoList$" class="psdk-display-divider"></div>
9
8
 
10
9
  <div class="psdk-todo-assignments">
@@ -19,6 +19,7 @@
19
19
 
20
20
  .psdk-todo-header {
21
21
  display: inline-flex;
22
+ margin-bottom: 1rem;
22
23
  }
23
24
 
24
25
  .psdk-todo-text {
@@ -65,6 +66,7 @@
65
66
  display: inline-flex;
66
67
  width: 100%;
67
68
  padding: 0.625rem 0rem;
69
+ align-items: center;
68
70
  }
69
71
 
70
72
  .psdk-todo-assignment-data {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.242.7",
3
+ "version": "0.242.9",
4
4
  "description": "Angular SDK - Code for overriding components",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"