@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,7 +1,6 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
2
- import { FormGroup } from '@angular/forms';
3
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
1
+ import { Component, forwardRef } from '@angular/core';
4
2
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
3
+ import { DetailsTemplateBase } from '@pega/angular-sdk-components';
5
4
 
6
5
  @Component({
7
6
  selector: 'app-details-three-column',
@@ -10,11 +9,8 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
10
9
  standalone: true,
11
10
  imports: [forwardRef(() => ComponentMapperComponent)]
12
11
  })
13
- export class DetailsThreeColumnComponent implements OnInit, OnDestroy {
14
- constructor(private angularPConnect: AngularPConnectService) {}
15
-
16
- @Input() pConn$: typeof PConnect;
17
- @Input() formGroup$: FormGroup;
12
+ export class DetailsThreeColumnComponent extends DetailsTemplateBase {
13
+ override pConn$: typeof PConnect;
18
14
 
19
15
  showHighlightedData: boolean;
20
16
  highlightedDataArr: any;
@@ -25,40 +21,8 @@ export class DetailsThreeColumnComponent implements OnInit, OnDestroy {
25
21
 
26
22
  propsToUse: any = {};
27
23
 
28
- // Used with AngularPConnect
29
- angularPConnectData: AngularPConnectData = {};
30
-
31
- ngOnInit(): void {
32
- // First thing in initialization is registering and subscribing to the AngularPConnect service
33
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
34
-
35
- // this.updateSelf();
36
- this.checkAndUpdate();
37
- }
38
-
39
- ngOnDestroy() {
40
- if (this.angularPConnectData.unsubscribeFn) {
41
- this.angularPConnectData.unsubscribeFn();
42
- }
43
- }
44
-
45
- onStateChange() {
46
- this.checkAndUpdate();
47
- }
48
-
49
- checkAndUpdate() {
50
- // Should always check the bridge to see if the component should
51
- // update itself (re-render)
52
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
53
-
54
- // ONLY call updateSelf when the component should update
55
- if (bUpdateSelf) {
56
- this.updateSelf();
57
- }
58
- }
59
-
60
- updateSelf() {
61
- const rawMetaData: any = this.pConn$.resolveConfigProps((this.pConn$.getRawMetadata() as any).config);
24
+ override updateSelf() {
25
+ const rawMetaData: any = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata()?.config);
62
26
  this.showHighlightedData = rawMetaData?.showHighlightedData;
63
27
 
64
28
  if (this.showHighlightedData) {
@@ -75,7 +39,7 @@ export class DetailsThreeColumnComponent implements OnInit, OnDestroy {
75
39
  });
76
40
  }
77
41
 
78
- this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT');
42
+ this.pConn$.setInheritedProp('displayMode', 'DISPLAY_ONLY');
79
43
  this.pConn$.setInheritedProp('readOnly', true);
80
44
 
81
45
  const kids = this.pConn$.getChildren() as any[];
@@ -1,7 +1,6 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
2
- import { FormGroup } from '@angular/forms';
3
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
1
+ import { Component, forwardRef } from '@angular/core';
4
2
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
3
+ import { DetailsTemplateBase } from '@pega/angular-sdk-components';
5
4
 
6
5
  @Component({
7
6
  selector: 'app-details-two-column',
@@ -10,11 +9,8 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
10
9
  standalone: true,
11
10
  imports: [forwardRef(() => ComponentMapperComponent)]
12
11
  })
13
- export class DetailsTwoColumnComponent implements OnInit, OnDestroy {
14
- constructor(private angularPConnect: AngularPConnectService) {}
15
-
16
- @Input() pConn$: typeof PConnect;
17
- @Input() formGroup$: FormGroup;
12
+ export class DetailsTwoColumnComponent extends DetailsTemplateBase {
13
+ override pConn$: typeof PConnect;
18
14
 
19
15
  showHighlightedData: boolean;
20
16
  highlightedDataArr: any;
@@ -25,45 +21,13 @@ export class DetailsTwoColumnComponent implements OnInit, OnDestroy {
25
21
 
26
22
  propsToUse: any = {};
27
23
 
28
- // Used with AngularPConnect
29
- angularPConnectData: AngularPConnectData = {};
30
-
31
- ngOnInit(): void {
32
- // First thing in initialization is registering and subscribing to the AngularPConnect service
33
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
34
-
35
- // this.updateSelf();
36
- this.checkAndUpdate();
37
- }
38
-
39
- ngOnDestroy() {
40
- if (this.angularPConnectData.unsubscribeFn) {
41
- this.angularPConnectData.unsubscribeFn();
42
- }
43
- }
44
-
45
- onStateChange() {
46
- this.checkAndUpdate();
47
- }
48
-
49
- checkAndUpdate() {
50
- // Should always check the bridge to see if the component should
51
- // update itself (re-render)
52
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
53
-
54
- // ONLY call updateSelf when the component should update
55
- if (bUpdateSelf) {
56
- this.updateSelf();
57
- }
58
- }
59
-
60
- updateSelf() {
61
- const rawMetaData: any = this.pConn$.resolveConfigProps((this.pConn$.getRawMetadata() as any).config);
24
+ override updateSelf() {
25
+ const rawMetaData: any = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata()?.config);
62
26
  this.showHighlightedData = rawMetaData?.showHighlightedData;
63
27
 
64
28
  if (this.showHighlightedData) {
65
29
  const highlightedData = rawMetaData?.highlightedData;
66
- this.highlightedDataArr = highlightedData.map(field => {
30
+ this.highlightedDataArr = highlightedData?.map(field => {
67
31
  field.config.displayMode = 'STACKED_LARGE_VAL';
68
32
 
69
33
  if (field.config.value === '@P .pyStatusWork') {
@@ -75,7 +39,7 @@ export class DetailsTwoColumnComponent implements OnInit, OnDestroy {
75
39
  });
76
40
  }
77
41
 
78
- this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT');
42
+ this.pConn$.setInheritedProp('displayMode', 'DISPLAY_ONLY');
79
43
  this.pConn$.setInheritedProp('readOnly', true);
80
44
 
81
45
  const kids = this.pConn$.getChildren() as any[];
@@ -1,7 +1,6 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
2
- import { FormGroup } from '@angular/forms';
3
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
1
+ import { Component, forwardRef } from '@angular/core';
4
2
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
3
+ import { DetailsTemplateBase } from '@pega/angular-sdk-components';
5
4
 
6
5
  @Component({
7
6
  selector: 'app-details-wide-narrow',
@@ -10,51 +9,17 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
10
9
  standalone: true,
11
10
  imports: [forwardRef(() => ComponentMapperComponent)]
12
11
  })
13
- export class DetailsWideNarrowComponent implements OnInit, OnDestroy {
14
- constructor(private angularPConnect: AngularPConnectService) {}
15
-
16
- @Input() pConn$: typeof PConnect;
17
- @Input() formGroup$: FormGroup;
12
+ export class DetailsWideNarrowComponent extends DetailsTemplateBase {
13
+ override pConn$: typeof PConnect;
18
14
 
19
15
  highlightedDataArr: any[] = [];
20
16
  showHighlightedData: boolean;
21
17
  arFields$: any[] = [];
22
18
  arFields2$: any[] = [];
23
19
  propsToUse: any = {};
24
- // Used with AngularPConnect
25
- angularPConnectData: AngularPConnectData = {};
26
-
27
- ngOnInit(): void {
28
- // First thing in initialization is registering and subscribing to the AngularPConnect service
29
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
30
-
31
- // this.updateSelf();
32
- this.checkAndUpdate();
33
- }
34
-
35
- ngOnDestroy() {
36
- if (this.angularPConnectData.unsubscribeFn) {
37
- this.angularPConnectData.unsubscribeFn();
38
- }
39
- }
40
-
41
- onStateChange() {
42
- this.checkAndUpdate();
43
- }
44
-
45
- checkAndUpdate() {
46
- // Should always check the bridge to see if the component should
47
- // update itself (re-render)
48
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
49
-
50
- // ONLY call updateSelf when the component should update
51
- if (bUpdateSelf) {
52
- this.updateSelf();
53
- }
54
- }
55
20
 
56
- updateSelf() {
57
- const rawMetaData: any = this.pConn$.resolveConfigProps((this.pConn$.getRawMetadata() as any).config);
21
+ override updateSelf() {
22
+ const rawMetaData: any = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata()?.config);
58
23
  this.showHighlightedData = rawMetaData?.showHighlightedData;
59
24
 
60
25
  if (this.showHighlightedData) {
@@ -71,7 +36,7 @@ export class DetailsWideNarrowComponent implements OnInit, OnDestroy {
71
36
  });
72
37
  }
73
38
 
74
- this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT');
39
+ this.pConn$.setInheritedProp('displayMode', 'DISPLAY_ONLY');
75
40
  this.pConn$.setInheritedProp('readOnly', true);
76
41
 
77
42
  const kids = this.pConn$.getChildren() as any[];
@@ -1,3 +1,6 @@
1
+ <div *ngIf="propsToUse.showLabel && propsToUse.label" class="template-title-container">
2
+ <span>{{ propsToUse.label }}</span>
3
+ </div>
1
4
  <mat-tab-group id="dynamic-tabs" mat-stretch-tabs="false" animationDuration="0">
2
5
  <mat-tab *ngFor="let tab of tabsItems" [label]="tab.name">
3
6
  <component-mapper name="View" [props]="{ pConn$: tab.content.getPConnect() }"></component-mapper>
@@ -9,6 +9,8 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
9
9
  interface DynamicTabsProps {
10
10
  referenceList: string;
11
11
  template: string;
12
+ label?: string;
13
+ showLabel?: boolean;
12
14
  }
13
15
 
14
16
  @Component({
@@ -24,6 +26,7 @@ export class DynamicTabsComponent implements OnInit, OnDestroy {
24
26
 
25
27
  angularPConnectData: AngularPConnectData = {};
26
28
  tabsItems: any[];
29
+ propsToUse: any;
27
30
 
28
31
  constructor(private angularPConnect: AngularPConnectService) {}
29
32
 
@@ -54,15 +57,17 @@ export class DynamicTabsComponent implements OnInit, OnDestroy {
54
57
  }
55
58
 
56
59
  updateSelf() {
57
- const { referenceList } = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as DynamicTabsProps;
60
+ const { referenceList, label, showLabel } = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as DynamicTabsProps;
61
+
62
+ this.propsToUse = { label, showLabel, ...this.pConn$.getInheritedProps() };
58
63
 
59
64
  const { tablabel } = this.pConn$.getComponentConfig();
60
65
  const tablabelProp = PCore.getAnnotationUtils().getPropertyName(tablabel);
61
66
 
62
- this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT');
67
+ this.pConn$.setInheritedProp('displayMode', 'DISPLAY_ONLY');
63
68
  this.pConn$.setInheritedProp('readOnly', true);
64
69
 
65
- const referenceListData: any = this.pConn$.getValue(`${referenceList}.pxResults`, ''); // 2nd arg empty string until typedefs properly allow optional
70
+ const referenceListData = this.pConn$.getValue(`${referenceList}.pxResults`, ''); // 2nd arg empty string until typedefs properly allow optional
66
71
 
67
72
  this.tabsItems =
68
73
  referenceListData?.map((item, i) => {
@@ -1,5 +1,5 @@
1
1
  <div id="field-group">
2
- <h3 *ngIf="showLabel$" className="label" style="font-weight: bold">
2
+ <h3 *ngIf="showLabel$" class="field-group-template-header" style="font-weight: bold">
3
3
  {{ label$ }}
4
4
  </h3>
5
5
  <div *ngIf="readonlyMode; else editable">
@@ -11,23 +11,23 @@
11
11
  </div>
12
12
  <ng-template #editable>
13
13
  <div *ngIf="children && children.length > 0">
14
- <div *ngFor="let kid of children; let i = index">
14
+ <div class="field-group-template-item" *ngFor="let child of children; let i = index">
15
15
  <div class="header-div">
16
16
  <div style="width: 80%">
17
- <b>{{ kid.name }}</b>
17
+ <b>{{ child.name }}</b>
18
18
  </div>
19
- <div *ngIf="allowAddEdit !== false" style="width: 20%; text-align: right">
19
+ <div *ngIf="allowDelete && child.allowRowDelete" style="width: 20%; text-align: right">
20
20
  <button id="delete-button" mat-icon-button (click)="deleteFieldGroupItem(i)">
21
21
  <img class="psdk-utility-card-action-svg-icon" src="{{ menuIconOverride$ }}" />
22
22
  </button>
23
23
  </div>
24
24
  </div>
25
25
 
26
- <div *ngIf="kid.children.getPConnect().getRawMetadata().type.toLowerCase() == 'region'">
27
- <component-mapper name="Region" [props]="{ pConn$: kid.children.getPConnect(), formGroup$ }"></component-mapper>
26
+ <div *ngIf="child.children.getPConnect().getRawMetadata().type.toLowerCase() == 'region'">
27
+ <component-mapper name="Region" [props]="{ pConn$: child.children.getPConnect(), formGroup$ }"></component-mapper>
28
28
  </div>
29
29
  </div>
30
- <button *ngIf="allowAddEdit !== false" mat-button color="primary" style="font-size: 16px" (click)="addFieldGroupItem()">+ Add</button>
31
30
  </div>
31
+ <button *ngIf="allowAdd" mat-button color="primary" style="font-size: 16px" (click)="addFieldGroupItem()">{{ getAddBtnLabel() }}</button>
32
32
  </ng-template>
33
33
  </div>
@@ -6,3 +6,11 @@
6
6
  display: flex;
7
7
  align-items: center;
8
8
  }
9
+
10
+ .field-group-template-header {
11
+ margin-left: 0;
12
+ }
13
+
14
+ .field-group-template-item {
15
+ padding-block: 1rem;
16
+ }
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy, OnChanges } from '@angular/core';
1
+ import { Component, OnInit, Input, forwardRef, OnDestroy, OnChanges, AfterViewInit } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
4
  import { MatButtonModule } from '@angular/material/button';
@@ -6,11 +6,14 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
6
6
  import { buildView, getReferenceList } from '@pega/angular-sdk-components';
7
7
  import { Utils } from '@pega/angular-sdk-components';
8
8
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
9
+ import { evaluateAllowRowAction } from '@pega/angular-sdk-components';
9
10
 
10
11
  interface FieldGroupTemplateProps {
11
12
  // If any, enter additional props that only exist on this component
12
13
  label?: string;
13
- showLabel?: boolean;
14
+ hideLabel?: boolean;
15
+ allowActions?: any;
16
+ allowRowDelete?: any;
14
17
  referenceList?: any[];
15
18
  contextClass: string;
16
19
  renderMode?: string;
@@ -19,6 +22,7 @@ interface FieldGroupTemplateProps {
19
22
  displayMode?: string;
20
23
  fieldHeader?: string;
21
24
  allowTableEdit: boolean;
25
+ targetClassLabel?: string;
22
26
  }
23
27
 
24
28
  @Component({
@@ -28,26 +32,27 @@ interface FieldGroupTemplateProps {
28
32
  standalone: true,
29
33
  imports: [CommonModule, MatButtonModule, forwardRef(() => ComponentMapperComponent)]
30
34
  })
31
- export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges {
35
+ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit {
32
36
  @Input() configProps$: FieldGroupTemplateProps;
33
37
  @Input() pConn$: typeof PConnect;
34
38
  @Input() formGroup$: FormGroup;
35
39
 
36
40
  angularPConnectData: AngularPConnectData = {};
37
- inheritedProps$: object;
41
+
38
42
  showLabel$?: boolean = true;
39
43
  label$?: string;
40
44
  readonlyMode: boolean;
41
45
  contextClass: any;
42
- referenceList: any;
43
- pageReference: any;
44
46
  heading: any;
45
47
  children: any;
46
48
  menuIconOverride$: any;
47
- prevRefLength: number;
48
- allowAddEdit: boolean;
49
+ referenceListLength: number;
49
50
  fieldHeader: any;
50
51
 
52
+ allowAdd = true;
53
+ allowEdit = true;
54
+ allowDelete = true;
55
+
51
56
  constructor(
52
57
  private angularPConnect: AngularPConnectService,
53
58
  private utils: Utils
@@ -58,9 +63,21 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
58
63
  this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
59
64
  this.updateSelf();
60
65
 
61
- const menuIconOverride$ = 'trash';
62
- if (menuIconOverride$) {
63
- this.menuIconOverride$ = this.utils.getImageSrc(menuIconOverride$, this.utils.getSDKStaticContentUrl());
66
+ this.menuIconOverride$ = this.utils.getImageSrc('trash', this.utils.getSDKStaticContentUrl());
67
+
68
+ const { allowActions, allowTableEdit, referenceList } = this.configProps$;
69
+
70
+ if (allowActions && Object.keys(allowActions).length > 0) {
71
+ this.allowAdd = allowActions.allowAdd ?? allowTableEdit ?? true;
72
+ this.allowEdit = allowActions.allowEdit ?? true;
73
+ this.allowDelete = allowActions.allowDelete ?? allowTableEdit ?? true;
74
+ } else {
75
+ this.allowAdd = allowTableEdit ?? true;
76
+ this.allowDelete = allowTableEdit ?? true;
77
+ }
78
+
79
+ if (referenceList?.length === 0 && (this.allowAdd || this.allowEdit)) {
80
+ this.pConn$.getListActions().insert({ classID: this.contextClass }, referenceList.length);
64
81
  }
65
82
  }
66
83
 
@@ -85,56 +102,57 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
85
102
  const props = changes.configProps$;
86
103
  if (props.currentValue !== props.previousValue) {
87
104
  this.configProps$ = props.currentValue;
105
+
88
106
  if (changes?.pConn$?.currentValue) {
89
107
  this.pConn$ = changes?.pConn$?.currentValue;
90
108
  }
109
+
91
110
  this.updateSelf();
92
111
  }
93
112
  }
94
113
  }
95
114
 
115
+ ngAfterViewInit() {
116
+ const resolvedList = getReferenceList(this.pConn$);
117
+ // @ts-ignore - Expected 3 arguments, but got 1
118
+ this.pConn$.getListActions().initDefaultPageInstructions(resolvedList);
119
+ }
120
+
96
121
  updateSelf() {
97
- this.inheritedProps$ = this.pConn$.getInheritedProps();
98
- this.label$ = this.configProps$.label;
99
- this.showLabel$ = this.configProps$.showLabel;
100
- // label & showLabel within inheritedProps takes precedence over configProps
101
- this.label$ = (this.inheritedProps$ as any).label || this.label$;
102
- this.showLabel$ = (this.inheritedProps$ as any).showLabel || this.showLabel$;
103
-
104
- this.allowAddEdit = this.configProps$.allowTableEdit;
105
-
106
- const renderMode = this.configProps$.renderMode;
107
- const displayMode = this.configProps$.displayMode;
108
- this.readonlyMode = renderMode === 'ReadOnly' || displayMode === 'LABELS_LEFT';
109
- this.contextClass = this.configProps$.contextClass;
110
- const lookForChildInConfig = this.configProps$.lookForChildInConfig;
111
- this.heading = this.configProps$.heading ?? 'Row';
112
- this.fieldHeader = this.configProps$.fieldHeader;
122
+ const inheritedProps: any = this.pConn$.getInheritedProps();
123
+
124
+ const { label, hideLabel, allowRowDelete, referenceList, fieldHeader, renderMode, displayMode, heading, contextClass, lookForChildInConfig } =
125
+ this.configProps$;
126
+
127
+ // label within inheritedProps takes precedence over configProps
128
+ this.label$ = inheritedProps.label || label;
129
+
130
+ this.showLabel$ = referenceList?.length === 0 || !hideLabel;
131
+
132
+ this.readonlyMode = renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY';
133
+
134
+ this.contextClass = contextClass;
135
+ this.heading = heading ?? 'Row';
136
+ this.fieldHeader = fieldHeader;
137
+
113
138
  const resolvedList = getReferenceList(this.pConn$);
114
- this.pageReference = `${this.pConn$.getPageReference()}${resolvedList}`;
115
139
  this.pConn$.setReferenceList(resolvedList);
140
+
116
141
  if (this.readonlyMode) {
117
- this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT');
142
+ this.pConn$.setInheritedProp('displayMode', 'DISPLAY_ONLY');
118
143
  }
119
- this.referenceList = this.configProps$.referenceList;
120
- if (this.prevRefLength != this.referenceList.length) {
121
- // eslint-disable-next-line sonarjs/no-collapsible-if
122
- if (!this.readonlyMode) {
123
- if (this.referenceList?.length === 0 && this.allowAddEdit !== false) {
124
- this.addFieldGroupItem();
125
- }
126
- }
127
- const children: any = [];
128
- this.referenceList?.forEach((item, index) => {
129
- children.push({
144
+
145
+ if (this.referenceListLength != referenceList?.length) {
146
+ this.children = referenceList?.map((item, index) => {
147
+ return {
130
148
  id: index,
131
149
  name: this.fieldHeader === 'propertyRef' ? this.getDynamicHeader(item, index) : this.getStaticHeader(this.heading, index),
132
- children: buildView(this.pConn$, index, lookForChildInConfig)
133
- });
150
+ children: buildView(this.pConn$, index, lookForChildInConfig),
151
+ allowRowDelete: evaluateAllowRowAction(allowRowDelete, item)
152
+ };
134
153
  });
135
- this.children = children;
136
154
  }
137
- this.prevRefLength = this.referenceList.length;
155
+ this.referenceListLength = referenceList?.length || 0;
138
156
  }
139
157
 
140
158
  getStaticHeader = (heading, index) => {
@@ -149,12 +167,15 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
149
167
  };
150
168
 
151
169
  addFieldGroupItem() {
152
- // @ts-ignore - second parameter "pageRef" is optional for insert method
153
- this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length);
170
+ this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceListLength);
154
171
  }
155
172
 
156
173
  deleteFieldGroupItem(index) {
157
- // @ts-ignore - second parameter "pageRef" is optional for deleteEntry method
158
174
  this.pConn$.getListActions().deleteEntry(index);
159
175
  }
176
+
177
+ getAddBtnLabel() {
178
+ const { targetClassLabel } = this.configProps$;
179
+ return targetClassLabel ? `+ Add ${targetClassLabel}` : '+ Add';
180
+ }
160
181
  }
@@ -1,5 +1,5 @@
1
- <div *ngIf="displayMode$ === 'LABELS_LEFT'; else STACKED_LARGE_VAL" class="psdk-container-labels-left">
2
- <div class="psdk-grid-label">{{ label$ }}</div>
1
+ <div *ngIf="displayMode$ === 'DISPLAY_ONLY'; else STACKED_LARGE_VAL" [ngClass]="label$ ? 'psdk-container-labels-left' : 'psdk-container-nolabels'">
2
+ <div *ngIf="label$" class="psdk-grid-label">{{ label$ }}</div>
3
3
  <div class="psdk-val-labels-left">
4
4
  <ng-container *ngTemplateOutlet="valueTemplate"></ng-container>
5
5
  </div>
@@ -4,6 +4,11 @@
4
4
  column-gap: calc(2 * 0.5rem);
5
5
  row-gap: calc(2 * 0.5rem);
6
6
  align-items: start;
7
+ padding-block: 8px;
8
+ }
9
+ .psdk-container-nolabels {
10
+ align-items: start;
11
+ padding-block: 8px;
7
12
  }
8
13
  .psdk-value {
9
14
  margin: 8px 0px;
@@ -14,5 +19,5 @@
14
19
  font-size: 1.25rem;
15
20
  }
16
21
  .psdk-val-labels-left {
17
- margin: 8px 0px;
22
+ white-space: break-spaces;
18
23
  }
@@ -45,8 +45,8 @@ export class InlineDashboardPageComponent implements OnInit, OnChanges {
45
45
 
46
46
  updateSelf() {
47
47
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as InlineDashboardPageProps;
48
- const arChildren$ = this.pConn$.getChildren() as any[];
49
- const allFilters = (this.pConn$.getRawMetadata() as any).children[1];
48
+ const arChildren$ = this.pConn$.getChildren();
49
+ const allFilters = this.pConn$.getRawMetadata()?.children[1];
50
50
  const filterComponents = buildFilterComponents(this.pConn$, allFilters);
51
51
  this.inlineProps = this.configProps$;
52
52
  this.children[0] = arChildren$[0];
@@ -1,5 +1,8 @@
1
1
  <div class="psdk-list-header">
2
2
  <div>
3
+ <h3 *ngIf="label" class="label" style="font-weight: bold">
4
+ {{ label }} <span class="results-count">{{ getResultsText() }}</span>
5
+ </h3>
3
6
  <mat-form-field class="psdk-search" *ngIf="bShowSearch$">
4
7
  <mat-label><img class="psdk-icon-search" src="{{ searchIcon$ }}" /> <span class="psdk-search-label">Search</span> </mat-label>
5
8
  <input matInput id="search" (keyup)="applySearch($event)" placeholder="" />
@@ -177,7 +180,9 @@
177
180
  <tr mat-header-row *matHeaderRowDef="displayedColumns$"></tr>
178
181
  </table>
179
182
  </div>
180
- <div class="psdk-no-records" *ngIf="repeatListData?.length === 0">No Records Found.</div>
183
+ <div class="psdk-no-records" *ngIf="repeatListData?.length === 0">
184
+ {{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
185
+ </div>
181
186
  </div>
182
187
  </div>
183
188
  </div>
@@ -165,3 +165,14 @@ tr.mat-mdc-row {
165
165
  background-color: transparent;
166
166
  align-items: center;
167
167
  }
168
+
169
+ .results-count {
170
+ opacity: 0.7;
171
+ font-size: 0.8rem;
172
+ font-weight: bold;
173
+ margin-inline-start: 0.625rem;
174
+ }
175
+
176
+ .label {
177
+ margin: 8px;
178
+ }