@pega/angular-sdk-overrides 23.1.10 → 24.2.10

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 (137) 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.html +7 -4
  4. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +2 -1
  5. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +3 -1
  6. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +1 -1
  7. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +4 -1
  8. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.html +1 -1
  9. package/lib/designSystemExtension/operator/operator.component.ts +11 -6
  10. package/lib/designSystemExtension/pulse/pulse.component.ts +7 -7
  11. package/lib/field/auto-complete/auto-complete.component.ts +17 -14
  12. package/lib/field/cancel-alert/cancel-alert.component.ts +0 -2
  13. package/lib/field/check-box/check-box.component.html +16 -15
  14. package/lib/field/check-box/check-box.component.scss +14 -1
  15. package/lib/field/check-box/check-box.component.ts +128 -45
  16. package/lib/field/currency/currency.component.html +16 -7
  17. package/lib/field/currency/currency.component.ts +55 -20
  18. package/lib/field/date/date.component.html +1 -6
  19. package/lib/field/date/date.component.ts +22 -39
  20. package/lib/field/date-time/date-time.component.html +6 -7
  21. package/lib/field/date-time/date-time.component.ts +28 -45
  22. package/lib/field/decimal/decimal.component.html +14 -4
  23. package/lib/field/decimal/decimal.component.ts +47 -7
  24. package/lib/field/dropdown/dropdown.component.ts +132 -21
  25. package/lib/field/email/email.component.ts +14 -4
  26. package/lib/field/group/group.component.html +1 -1
  27. package/lib/field/group/group.component.ts +6 -2
  28. package/lib/field/integer/integer.component.html +1 -1
  29. package/lib/field/integer/integer.component.ts +13 -5
  30. package/lib/field/multiselect/multiselect.component.html +33 -0
  31. package/lib/field/multiselect/multiselect.component.scss +7 -0
  32. package/lib/field/multiselect/multiselect.component.spec.ts +21 -0
  33. package/lib/field/multiselect/multiselect.component.ts +369 -0
  34. package/lib/field/multiselect/utils.ts +209 -0
  35. package/lib/field/percentage/percentage.component.html +17 -6
  36. package/lib/field/percentage/percentage.component.ts +51 -12
  37. package/lib/field/phone/phone.component.html +1 -1
  38. package/lib/field/phone/phone.component.ts +11 -14
  39. package/lib/field/radio-buttons/radio-buttons.component.ts +9 -12
  40. package/lib/field/rich-text/config-ext.json +10 -0
  41. package/lib/field/rich-text/rich-text.component.html +1 -1
  42. package/lib/field/rich-text/rich-text.component.ts +8 -6
  43. package/lib/field/scalar-list/scalar-list.component.ts +4 -4
  44. package/lib/field/text/text.component.ts +2 -0
  45. package/lib/field/text-area/text-area.component.html +2 -1
  46. package/lib/field/text-area/text-area.component.ts +13 -8
  47. package/lib/field/text-input/text-input.component.html +1 -1
  48. package/lib/field/text-input/text-input.component.ts +13 -5
  49. package/lib/field/time/time.component.html +3 -2
  50. package/lib/field/time/time.component.ts +23 -7
  51. package/lib/field/url/url.component.html +2 -1
  52. package/lib/field/url/url.component.ts +15 -5
  53. package/lib/field/user-reference/user-reference.component.html +42 -45
  54. package/lib/field/user-reference/user-reference.component.ts +73 -27
  55. package/lib/infra/Containers/base-components/flow-container-base.component.ts +22 -0
  56. package/lib/infra/Containers/base-components/helper.ts +89 -0
  57. package/lib/infra/Containers/flow-container/flow-container.component.html +9 -4
  58. package/lib/infra/Containers/flow-container/flow-container.component.ts +38 -33
  59. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +41 -9
  60. package/lib/infra/Containers/preview-view-container/preview-view-container.component.ts +1 -1
  61. package/lib/infra/Containers/view-container/helper.ts +22 -0
  62. package/lib/infra/Containers/view-container/view-container.component.ts +5 -18
  63. package/lib/infra/assignment/assignment.component.ts +37 -39
  64. package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
  65. package/lib/infra/defer-load/defer-load.component.ts +9 -12
  66. package/lib/infra/multi-step/multi-step.component.html +1 -1
  67. package/lib/infra/multi-step/multi-step.component.scss +1 -0
  68. package/lib/infra/navbar/navbar.component.html +4 -4
  69. package/lib/infra/navbar/navbar.component.ts +9 -6
  70. package/lib/infra/root-container/root-container.component.ts +3 -3
  71. package/lib/infra/stages/stages.component.scss +2 -2
  72. package/lib/infra/view/view.component.html +7 -20
  73. package/lib/infra/view/view.component.ts +21 -3
  74. package/lib/template/app-shell/app-shell.component.ts +20 -2
  75. package/lib/template/banner-page/config-ext.json +9 -0
  76. package/lib/template/base/details-template-base.ts +67 -0
  77. package/lib/template/base/form-template-base.ts +10 -0
  78. package/lib/template/case-summary/case-summary.component.ts +38 -4
  79. package/lib/template/case-view/case-view.component.html +7 -7
  80. package/lib/template/case-view/case-view.component.scss +2 -0
  81. package/lib/template/case-view/case-view.component.ts +8 -19
  82. package/lib/template/confirmation/confirmation.component.ts +1 -1
  83. package/lib/template/data-reference/data-reference.component.ts +37 -43
  84. package/lib/template/default-form/default-form.component.html +0 -4
  85. package/lib/template/default-form/default-form.component.ts +7 -23
  86. package/lib/template/details/details.component.ts +7 -41
  87. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +6 -39
  88. package/lib/template/details-one-column/details-one-column.component.ts +7 -42
  89. package/lib/template/details-sub-tabs/details-sub-tabs.component.html +1 -2
  90. package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +5 -37
  91. package/lib/template/details-three-column/details-three-column.component.ts +7 -43
  92. package/lib/template/details-two-column/details-two-column.component.ts +8 -44
  93. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +7 -42
  94. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +3 -0
  95. package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +8 -4
  96. package/lib/template/field-group-template/field-group-template.component.ts +4 -14
  97. package/lib/template/field-value-list/field-value-list.component.html +8 -3
  98. package/lib/template/field-value-list/field-value-list.component.scss +2 -1
  99. package/lib/template/field-value-list/field-value-list.component.ts +1 -0
  100. package/lib/template/inline-dashboard-page/config-ext.json +9 -0
  101. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -2
  102. package/lib/template/list-view/list-view.component.html +9 -6
  103. package/lib/template/list-view/list-view.component.scss +11 -0
  104. package/lib/template/list-view/list-view.component.ts +60 -32
  105. package/lib/template/list-view/listViewHelpers.ts +1 -2
  106. package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +1 -1
  107. package/lib/template/one-column/one-column.component.ts +4 -3
  108. package/lib/template/one-column-tab/one-column-tab.component.ts +1 -1
  109. package/lib/template/page/page.component.ts +1 -1
  110. package/lib/template/promoted-filters/promoted-filters.component.ts +1 -1
  111. package/lib/template/repeating-structures/repeating-structures.component.ts +2 -3
  112. package/lib/template/simple-table/simple-table.component.ts +0 -2
  113. package/lib/template/simple-table-manual/helpers.ts +2 -2
  114. package/lib/template/simple-table-manual/simple-table-manual.component.html +1 -1
  115. package/lib/template/simple-table-manual/simple-table-manual.component.scss +1 -0
  116. package/lib/template/simple-table-manual/simple-table-manual.component.ts +60 -28
  117. package/lib/template/simple-table-select/simple-table-select.component.ts +5 -7
  118. package/lib/template/three-column/three-column.component.ts +4 -3
  119. package/lib/template/two-column/two-column.component.ts +4 -3
  120. package/lib/template/two-column-tab/two-column-tab.component.ts +1 -1
  121. package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +4 -3
  122. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +1 -1
  123. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +1 -1
  124. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +5 -4
  125. package/lib/widget/attachment/attachment.component.html +50 -26
  126. package/lib/widget/attachment/attachment.component.scss +118 -0
  127. package/lib/widget/attachment/attachment.component.ts +256 -503
  128. package/lib/widget/case-history/case-history.component.ts +1 -2
  129. package/lib/widget/feed-container/feed-container.component.ts +7 -11
  130. package/lib/widget/file-utility/file-utility.component.html +2 -2
  131. package/lib/widget/file-utility/file-utility.component.ts +15 -22
  132. package/lib/widget/list-utility/list-utility.component.html +1 -1
  133. package/lib/widget/quick-create/config-ext.json +9 -0
  134. package/lib/widget/quick-create/quick-create.component.ts +1 -1
  135. package/lib/widget/todo/todo.component.html +8 -7
  136. package/lib/widget/todo/todo.component.ts +97 -86
  137. package/package.json +1 -1
@@ -22,6 +22,6 @@ export class AlertBannerComponent {
22
22
  onAlertClose(config) {
23
23
  const { PAGE, type, target } = config;
24
24
  const { clearMessages } = PCore.getMessageManager();
25
- clearMessages({ category: PAGE, type, context: target } as any);
25
+ clearMessages({ category: PAGE, type, context: target });
26
26
  }
27
27
  }
@@ -53,6 +53,6 @@ export class CaseCreateStageComponent implements OnInit, OnDestroy {
53
53
  }
54
54
 
55
55
  updateSelf() {
56
- this.arChildren$ = this.pConn$.getChildren() as any[];
56
+ this.arChildren$ = this.pConn$.getChildren();
57
57
  }
58
58
  }
@@ -2,7 +2,7 @@
2
2
  <dl class="psdk-case-summary-fields-primary">
3
3
  <div *ngFor="let field of primaryFieldsWithStatus$" class="psdk-csf-primary-field">
4
4
  <dt class="psdk-csf-primary-field-header">
5
- {{ field.config.label }}
5
+ {{ field.config?.label }}
6
6
  </dt>
7
7
  <dd *ngIf="field.config.value === ''; else hasValue" class="psdk-csf-primary-field-data">
8
8
  <ng-container [ngSwitch]="field.type.toLowerCase()">
@@ -28,16 +28,19 @@
28
28
  <dl *ngFor="let field of secondaryFields$" class="psdk-case-summary-fields-secondary">
29
29
  <div
30
30
  *ngIf="
31
- field.config?.label?.toLowerCase() == 'create operator' || field.config?.label?.toLowerCase() == 'update operator';
31
+ field?.config?.label?.toLowerCase() == 'create operator' ||
32
+ field?.displayLabel?.toLowerCase() == 'create operator' ||
33
+ field?.config?.label?.toLowerCase() == 'update operator' ||
34
+ field?.displayLabel?.toLowerCase() == 'update operator';
32
35
  else hasSecondaryValue
33
36
  "
34
37
  >
35
- <component-mapper name="Operator" [props]="{ pConn$: field?.kid }"></component-mapper>
38
+ <component-mapper name="Operator" [props]="{ pConn$: field?.kid, displayLabel: field?.displayLabel }"></component-mapper>
36
39
  </div>
37
40
  <ng-template #hasSecondaryValue>
38
41
  <div class="psdk-csf-secondary-field">
39
42
  <dt class="psdk-csf-secondary-field-header">
40
- {{ field.config.displayLabel || field.config.label }}
43
+ {{ field.config?.displayLabel || field.config?.label }}
41
44
  </dt>
42
45
  <dd class="psdk-csf-secondary-field-data">
43
46
  <div [ngSwitch]="field.type">
@@ -49,7 +49,7 @@
49
49
  }
50
50
 
51
51
  .psdk-case-summary-fields {
52
- padding: calc(2 * 0.5rem);
52
+ // padding: calc(2 * 0.5rem);
53
53
  display: grid;
54
54
  grid-row-gap: calc(2 * 0.5rem);
55
55
  }
@@ -90,6 +90,7 @@
90
90
  grid-template-columns: 1fr;
91
91
  grid-column-gap: calc(2 * 0.5rem);
92
92
  grid-row-gap: calc(1 * 0.5rem);
93
+ margin: 0;
93
94
  }
94
95
 
95
96
  .psdk-csf-secondary-field {
@@ -19,7 +19,8 @@ export class MaterialCaseSummaryComponent implements OnInit, OnChanges {
19
19
  primaryFieldsWithStatus$: any[];
20
20
 
21
21
  constructor(private utils: Utils) {}
22
-
22
+ localizedVal = PCore.getLocaleUtils().getLocaleValue;
23
+ localeCategory = 'ModalContainer';
23
24
  ngOnInit(): void {
24
25
  this.updatePrimaryWithStatus();
25
26
  this.updateLabelAndDate(this.primaryFieldsWithStatus$);
@@ -63,6 +64,7 @@ export class MaterialCaseSummaryComponent implements OnInit, OnChanges {
63
64
  updatePrimaryWithStatus() {
64
65
  this.primaryFieldsWithStatus$ = [];
65
66
  for (const prim of this.primaryFields$) {
67
+ prim.config.value = this.localizedVal(prim.config.value, this.localeCategory);
66
68
  this.primaryFieldsWithStatus$.push(prim);
67
69
  }
68
70
 
@@ -21,7 +21,7 @@
21
21
  <a *ngSwitchCase="'email'" href="mailto: {{ field.config.value }}">{{ _getValue(field.config.value) }}</a>
22
22
  <span *ngSwitchCase="'date'" class="psdk-details-text-style">{{ _formatDate(field.config.value, field.type) }}</span>
23
23
  <span *ngSwitchCase="'caseoperator'"></span>
24
- <span *ngSwitchDefault>{{ _getValue(field.config.value) }}</span>
24
+ <span *ngSwitchDefault>{{ _getValue(field.config.value, field) }}</span>
25
25
  </div>
26
26
  </div>
27
27
  </ng-template>
@@ -16,7 +16,10 @@ export class MaterialDetailsFieldsComponent {
16
16
  @Input() arFields$: any[];
17
17
  @Input() arHighlightedFields: any[];
18
18
 
19
- _getValue(configValue) {
19
+ _getValue(configValue, field: any = {}) {
20
+ if (field?.type === 'userreference') {
21
+ return configValue.userName;
22
+ }
20
23
  if (configValue && configValue != '') {
21
24
  return configValue;
22
25
  }
@@ -1,5 +1,5 @@
1
1
  <div>
2
- <mat-button-toggle-group vertical (change)="onChange($event.value)" [value]="selectedTabId$" aria-label="Tabs">
2
+ <mat-button-toggle-group vertical hideSingleSelectionIndicator (change)="onChange($event.value)" [value]="selectedTabId$" aria-label="Tabs">
3
3
  <mat-button-toggle *ngFor="let tab of tabConfig$" [value]="tab.id" style="text-align: left">
4
4
  <div style="display: flex">
5
5
  <div style="flex-grow: 10">{{ tab.name }}</div>
@@ -12,7 +12,7 @@ import { Utils } from '@pega/angular-sdk-components';
12
12
  })
13
13
  export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
14
14
  @Input() pConn$: typeof PConnect;
15
-
15
+ @Input() displayLabel;
16
16
  fields$: any[] = [];
17
17
  bShowPopover$: boolean;
18
18
  date$: string;
@@ -45,21 +45,26 @@ export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
45
45
  }
46
46
  }
47
47
 
48
+ // eslint-disable-next-line @angular-eslint/no-empty-lifecycle-method
48
49
  ngOnDestroy(): void {
49
- this.renderer.destroy();
50
+ // Ref: https://medium.com/@kamil.galek/mythical-angular-component-styles-cleanup-in-angular-17-f799a08b2abc
51
+ // Commenting the below line as it is causing the Operator component's styles not getting applied.
52
+ // this.renderer.destroy();
50
53
  }
51
54
 
52
55
  updateSelf(): void {
53
- const configProps$ = this.pConn$.getConfigProps() as any;
54
- if (configProps$?.label?.toLowerCase() == 'create operator') {
56
+ const configProps$ = this.pConn$.getConfigProps();
57
+ this.displayLabel = this.displayLabel?.toLowerCase();
58
+ const label = configProps$?.label?.toLowerCase();
59
+ if (label === 'create operator' || this.displayLabel === 'create operator') {
55
60
  this.name$ = configProps$.createOperator.userName;
56
61
  this.id$ = configProps$.createOperator.userId;
57
62
  this.label$ = configProps$.createLabel;
58
- } else if (configProps$?.label?.toLowerCase() == 'update operator') {
63
+ } else if (label === 'update operator' || this.displayLabel === 'update operator') {
59
64
  this.name$ = configProps$.updateOperator.userName;
60
65
  this.id$ = configProps$.updateOperator.userId;
61
66
  this.label$ = configProps$.updateLabel;
62
- } else if (configProps$?.label?.toLowerCase() == 'resolve operator') {
67
+ } else if (label === 'resolve operator' || this.displayLabel === 'resolve operator') {
63
68
  this.name$ = configProps$.resolveOperator.userName;
64
69
  this.id$ = configProps$.resolveOperator.userId;
65
70
  this.label$ = configProps$.resolveLabel;
@@ -17,8 +17,8 @@ export class PulseComponent implements OnInit {
17
17
  @Input() pConn$: typeof PConnect;
18
18
 
19
19
  configProps$: PulseProps;
20
- currentUser$: string;
21
- currentUserInitials$ = '--';
20
+ currentUser$: string | undefined;
21
+ currentUserInitials$: string | undefined = '--';
22
22
 
23
23
  ngOnInit() {
24
24
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps());
@@ -26,13 +26,13 @@ export class PulseComponent implements OnInit {
26
26
  this.currentUser$ = PCore.getEnvironmentInfo().getOperatorName();
27
27
 
28
28
  if (this.currentUser$ != '') {
29
- this.currentUserInitials$ = this.currentUser$.charAt(0);
29
+ this.currentUserInitials$ = this.currentUser$?.charAt(0);
30
30
 
31
- if (this.currentUser$.lastIndexOf(' ') > 0) {
32
- const lastName = this.currentUser$.substring(this.currentUser$.lastIndexOf(' ') + 1);
31
+ if (this.currentUser$ && this.currentUser$.lastIndexOf(' ') > 0) {
32
+ const lastName = this.currentUser$?.substring(this.currentUser$.lastIndexOf(' ') + 1);
33
33
  this.currentUserInitials$ += lastName.charAt(0);
34
- } else if (this.currentUser$.lastIndexOf('.') > 0) {
35
- const lastName = this.currentUser$.substring(this.currentUser$.lastIndexOf('.') + 1);
34
+ } else if (this.currentUser$ && this.currentUser$.lastIndexOf('.') > 0) {
35
+ const lastName = this.currentUser$?.substring(this.currentUser$.lastIndexOf('.') + 1);
36
36
  this.currentUserInitials$ += lastName.charAt(0);
37
37
  }
38
38
  }
@@ -2,7 +2,7 @@ import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } fr
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatOptionModule } from '@angular/material/core';
5
- import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
5
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
6
6
  import { MatInputModule } from '@angular/material/input';
7
7
  import { MatFormFieldModule } from '@angular/material/form-field';
8
8
  import { interval, Observable } from 'rxjs';
@@ -71,6 +71,8 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
71
71
  hideLabel: boolean;
72
72
  filteredOptions: Observable<any[]>;
73
73
  filterValue = '';
74
+ actionsApi: Object;
75
+ propName: string;
74
76
 
75
77
  constructor(
76
78
  private angularPConnect: AngularPConnectService,
@@ -102,7 +104,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
102
104
 
103
105
  this.filteredOptions = this.fieldControl.valueChanges.pipe(
104
106
  startWith(''),
105
- map(value => this._filter(value || ''))
107
+ map(value => this._filter((value as string) || ''))
106
108
  );
107
109
  }
108
110
 
@@ -118,7 +120,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
118
120
 
119
121
  private _filter(value: string): string[] {
120
122
  const filterVal = (value || this.filterValue).toLowerCase();
121
- return this.options$?.filter(option => option.value.toLowerCase().includes(filterVal));
123
+ return this.options$?.filter(option => option.value?.toLowerCase().includes(filterVal));
122
124
  }
123
125
 
124
126
  // Callback passed when subscribing to store change
@@ -151,6 +153,9 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
151
153
 
152
154
  this.setPropertyValuesFromProps();
153
155
 
156
+ this.actionsApi = this.pConn$.getActionsApi();
157
+ this.propName = this.pConn$.getStateProps().value;
158
+
154
159
  const context = this.pConn$.getContextName();
155
160
  const { columns, datasource } = this.generateColumnsAndDataSource();
156
161
 
@@ -184,7 +189,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
184
189
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
185
190
  }
186
191
 
187
- this.componentReference = (this.pConn$.getStateProps() as any).value;
192
+ this.componentReference = this.pConn$.getStateProps().value;
188
193
  if (this.listType === 'associated') {
189
194
  this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
190
195
  }
@@ -220,7 +225,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
220
225
  let datasource = this.configProps$.datasource;
221
226
  let columns = this.configProps$.columns;
222
227
  // const { deferDatasource, datasourceMetadata } = this.configProps$;
223
- const { deferDatasource, datasourceMetadata }: any = this.pConn$.getConfigProps();
228
+ const { deferDatasource, datasourceMetadata } = this.pConn$.getConfigProps();
224
229
  // convert associated to datapage listtype and transform props
225
230
  // Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList
226
231
  if (deferDatasource && datasourceMetadata?.datasource?.name) {
@@ -299,13 +304,14 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
299
304
  // this works - this.pConn$.setValue( this.componentReference, this.fieldControl.value);
300
305
  // PConnect wants to use changeHandler for onChange
301
306
  // this.angularPConnect.changeHandler( this, event);
302
- this.filterValue = (event.target as HTMLInputElement).value;
303
-
304
- this.angularPConnectData.actions?.onChange(this, event);
307
+ const value = (event.target as HTMLInputElement).value;
308
+ this.filterValue = value;
309
+ handleEvent(this.actionsApi, 'change', this.propName, value);
305
310
  }
306
311
 
307
- optionChanged(event: MatAutocompleteSelectedEvent) {
308
- this.angularPConnectData.actions?.onChange(this, event);
312
+ optionChanged(event: any) {
313
+ const value = event?.option?.value;
314
+ handleEvent(this.actionsApi, 'change', this.propName, value);
309
315
  }
310
316
 
311
317
  fieldOnBlur(event: Event) {
@@ -315,11 +321,8 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
315
321
  const index = this.options$?.findIndex(element => element.value === el.value);
316
322
  key = index > -1 ? (key = this.options$[index].key) : el.value;
317
323
  }
318
-
319
324
  const value = key;
320
- const actionsApi = this.pConn$?.getActionsApi();
321
- const propName = (this.pConn$?.getStateProps() as any).value;
322
- handleEvent(actionsApi, 'changeNblur', propName, value);
325
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
323
326
  if (this.configProps$?.onRecordChange) {
324
327
  el.value = value;
325
328
  this.configProps$.onRecordChange(event);
@@ -71,7 +71,6 @@ export class CancelAlertComponent implements OnChanges {
71
71
  this.psService.sendMessage(false);
72
72
  this.dismissAlert();
73
73
 
74
- // @ts-ignore - second parameter “payload” for publish method should be optional
75
74
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED);
76
75
  })
77
76
  .catch(() => {
@@ -92,7 +91,6 @@ export class CancelAlertComponent implements OnChanges {
92
91
  .then(() => {
93
92
  this.psService.sendMessage(false);
94
93
  this.dismissAlert();
95
- // @ts-ignore - second parameter “payload” for publish method should be optional
96
94
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
97
95
  })
98
96
  .catch(() => {
@@ -6,36 +6,37 @@
6
6
  ></component-mapper>
7
7
  </div>
8
8
  <ng-template #noDisplayMode>
9
- <div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
9
+ <div *ngIf="bHasForm$; else noEdit">
10
10
  <div [formGroup]="formGroup$" *ngIf="bVisible$">
11
11
  <div class="mat-form-field-infix" *ngIf="showLabel$">
12
12
  <span>
13
13
  <label class="mat-form-field-label psdk-label-readonly">{{ label$ }}</label>
14
14
  </span>
15
- <mat-checkbox
16
- [labelPosition]="'after'"
17
- [checked]="isChecked$"
18
- [disabled]="bDisabled$"
19
- [attr.data-test-id]="testId"
20
- [formControl]="fieldControl"
21
- (change)="fieldOnChange($event)"
22
- (blur)="fieldOnBlur($event)"
23
- >{{ caption$ }}</mat-checkbox
24
- >
25
15
  </div>
26
- <div class="mat-form-field-infix" *ngIf="!bReadonly$ && !showLabel$">
16
+ <div *ngIf="selectionMode === 'multi'; else single">
17
+ <mat-option *ngFor="let item of listOfCheckboxes" (click)="handleChangeMultiMode($event, item)">
18
+ <mat-checkbox
19
+ [labelPosition]="'after'"
20
+ [checked]="item.selected"
21
+ [attr.data-test-id]="testId + ':' + item.value"
22
+ (change)="handleChangeMultiMode($event, item)"
23
+ (blur)="fieldOnBlur($event)"
24
+ >{{ item.text ?? item.value }}
25
+ </mat-checkbox>
26
+ </mat-option>
27
+ </div>
28
+ <ng-template #single>
27
29
  <mat-checkbox
28
30
  [labelPosition]="'after'"
29
31
  [checked]="isChecked$"
30
- [disabled]="bDisabled$"
31
32
  [attr.data-test-id]="testId"
32
33
  [formControl]="fieldControl"
33
34
  (change)="fieldOnChange($event)"
34
35
  (blur)="fieldOnBlur($event)"
35
36
  >{{ caption$ }}</mat-checkbox
36
37
  >
37
- </div>
38
- <mat-hint *ngIf="helperText">{{ helperText }}</mat-hint>
38
+ <p *ngIf="helperText">{{ helperText }}</p>
39
+ </ng-template>
39
40
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
40
41
  </div>
41
42
  </div>
@@ -8,10 +8,10 @@
8
8
  top: 0rem;
9
9
  margin-top: 0.625rem;
10
10
  font-size: 0.875rem;
11
- display: block;
12
11
  transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px);
13
12
  -ms-transform: translateY(-1.28125em) scale(0.75);
14
13
  width: 133.33333%;
14
+ color: rgba(0, 0, 0, 0.6);
15
15
  }
16
16
 
17
17
  .psdk-data-readonly {
@@ -22,3 +22,16 @@
22
22
  ::ng-deep .mat-mdc-form-field-infix {
23
23
  width: auto;
24
24
  }
25
+
26
+ p {
27
+ font-size: 0.75rem;
28
+ color: rgba(0, 0, 0, 0.58);
29
+ }
30
+
31
+ mat-checkbox {
32
+ margin-left: -11px;
33
+ }
34
+
35
+ .mat-mdc-option {
36
+ margin-left: -16px;
37
+ }
@@ -3,10 +3,14 @@ import { CommonModule } from '@angular/common';
3
3
  import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatCheckboxModule } from '@angular/material/checkbox';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
+ import { MatOptionModule } from '@angular/material/core';
7
+ import { interval } from 'rxjs';
6
8
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
7
9
  import { Utils } from '@pega/angular-sdk-components';
8
10
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
9
11
  import { PConnFieldProps } from '@pega/angular-sdk-components';
12
+ import { deleteInstruction, insertInstruction, updateNewInstructions } from '@pega/angular-sdk-components';
13
+ import { handleEvent } from '@pega/angular-sdk-components';
10
14
 
11
15
  interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
12
16
  // If any, enter additional props that only exist on Checkbox here
@@ -15,6 +19,13 @@ interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
15
19
  caption?: string;
16
20
  trueLabel?: string;
17
21
  falseLabel?: string;
22
+ selectionMode?: string;
23
+ datasource?: any;
24
+ selectionKey?: string;
25
+ selectionList?: any;
26
+ primaryField: string;
27
+ readonlyContextList: any;
28
+ referenceList: string;
18
29
  }
19
30
 
20
31
  @Component({
@@ -22,7 +33,7 @@ interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
22
33
  templateUrl: './check-box.component.html',
23
34
  styleUrls: ['./check-box.component.scss'],
24
35
  standalone: true,
25
- imports: [CommonModule, ReactiveFormsModule, MatCheckboxModule, MatFormFieldModule, forwardRef(() => ComponentMapperComponent)]
36
+ imports: [CommonModule, ReactiveFormsModule, MatCheckboxModule, MatFormFieldModule, MatOptionModule, forwardRef(() => ComponentMapperComponent)]
26
37
  })
27
38
  export class CheckBoxComponent implements OnInit, OnDestroy {
28
39
  @Input() pConn$: typeof PConnect;
@@ -50,6 +61,17 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
50
61
  trueLabel$?: string;
51
62
  falseLabel$?: string;
52
63
 
64
+ selectionMode?: string;
65
+ datasource?: any;
66
+ selectionKey?: string;
67
+ selectionList?: any;
68
+ primaryField: string;
69
+ selectedvalues: any;
70
+ referenceList: string;
71
+ listOfCheckboxes: any[] = [];
72
+ actionsApi: Object;
73
+ propName: string;
74
+
53
75
  fieldControl = new FormControl('', null);
54
76
 
55
77
  constructor(
@@ -69,6 +91,11 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
69
91
  // this.updateSelf();
70
92
  this.checkAndUpdate();
71
93
 
94
+ if (this.selectionMode === 'multi' && this.referenceList?.length > 0) {
95
+ this.pConn$.setReferenceList(this.selectionList);
96
+ updateNewInstructions(this.pConn$, this.selectionList);
97
+ }
98
+
72
99
  if (this.formGroup$) {
73
100
  // add control to formGroup
74
101
  this.formGroup$.addControl(this.controlName$, this.fieldControl);
@@ -111,68 +138,124 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
111
138
  // moved this from ngOnInit() and call this from there instead...
112
139
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as CheckboxProps;
113
140
 
114
- if (this.configProps$.value != undefined) {
115
- this.value$ = this.configProps$.value;
116
- }
117
141
  this.testId = this.configProps$.testId;
118
- this.label$ = this.configProps$.label;
119
142
  this.displayMode$ = this.configProps$.displayMode;
143
+ this.label$ = this.configProps$.label;
144
+ if (this.label$ != '') {
145
+ this.showLabel$ = true;
146
+ }
120
147
 
121
- this.caption$ = this.configProps$.caption;
122
- this.helperText = this.configProps$.helperText;
123
- this.trueLabel$ = this.configProps$.trueLabel;
124
- this.falseLabel$ = this.configProps$.falseLabel;
125
-
126
- // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
127
- setTimeout(() => {
128
- if (this.configProps$.required != null) {
129
- this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
148
+ this.actionsApi = this.pConn$.getActionsApi();
149
+ this.propName = this.pConn$.getStateProps().value;
150
+
151
+ // multi case
152
+ this.selectionMode = this.configProps$.selectionMode;
153
+ if (this.selectionMode === 'multi') {
154
+ this.referenceList = this.configProps$.referenceList;
155
+ this.selectionList = this.configProps$.selectionList;
156
+ this.selectedvalues = this.configProps$.readonlyContextList;
157
+ this.primaryField = this.configProps$.primaryField;
158
+
159
+ this.datasource = this.configProps$.datasource;
160
+ this.selectionKey = this.configProps$.selectionKey;
161
+ const listSourceItems = this.datasource?.source ?? [];
162
+ const dataField = this.selectionKey?.split?.('.')[1] ?? '';
163
+ const listToDisplay: any[] = [];
164
+ listSourceItems.forEach(element => {
165
+ element.selected = this.selectedvalues?.some?.(data => data[dataField] === element.key);
166
+ listToDisplay.push(element);
167
+ });
168
+ this.listOfCheckboxes = listToDisplay;
169
+ } else {
170
+ if (this.configProps$.value != undefined) {
171
+ this.value$ = this.configProps$.value;
130
172
  }
131
- this.cdRef.detectChanges();
132
- });
133
173
 
134
- if (this.configProps$.visibility != null) {
135
- this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
136
- }
137
-
138
- // disabled
139
- if (this.configProps$.disabled != undefined) {
140
- this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
141
- }
174
+ this.caption$ = this.configProps$.caption;
175
+ this.helperText = this.configProps$.helperText;
176
+ this.trueLabel$ = this.configProps$.trueLabel || 'Yes';
177
+ this.falseLabel$ = this.configProps$.falseLabel || 'No';
178
+
179
+ // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
180
+ setTimeout(() => {
181
+ if (this.configProps$.required != null) {
182
+ this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
183
+ }
184
+ this.cdRef.detectChanges();
185
+ });
186
+
187
+ if (this.configProps$.visibility != null) {
188
+ this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
189
+ }
142
190
 
143
- if (this.bDisabled$) {
144
- this.fieldControl.disable();
145
- } else {
146
- this.fieldControl.enable();
147
- }
191
+ // disabled
192
+ if (this.configProps$.disabled != undefined) {
193
+ this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
194
+ }
148
195
 
149
- if (this.configProps$.readOnly != null) {
150
- this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
151
- }
196
+ if (this.configProps$.readOnly != null) {
197
+ this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
198
+ }
152
199
 
153
- this.componentReference = (this.pConn$.getStateProps() as any).value;
200
+ if (this.bDisabled$ || this.bReadonly$) {
201
+ this.fieldControl.disable();
202
+ } else {
203
+ this.fieldControl.enable();
204
+ }
154
205
 
155
- if (this.label$ != '') {
156
- this.showLabel$ = true;
157
- }
206
+ this.componentReference = this.pConn$.getStateProps().value;
158
207
 
159
- // eslint-disable-next-line sonarjs/no-redundant-boolean
160
- if (this.value$ === 'true' || this.value$ == true) {
161
- this.isChecked$ = true;
162
- } else {
163
- this.isChecked$ = false;
208
+ // eslint-disable-next-line sonarjs/no-redundant-boolean
209
+ if (this.value$ === 'true' || this.value$ == true) {
210
+ this.isChecked$ = true;
211
+ } else {
212
+ this.isChecked$ = false;
213
+ }
214
+ // trigger display of error message with field control
215
+ if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
216
+ const timer = interval(100).subscribe(() => {
217
+ this.fieldControl.setErrors({ message: true });
218
+ this.fieldControl.markAsTouched();
219
+
220
+ timer.unsubscribe();
221
+ });
222
+ }
164
223
  }
165
224
  }
166
225
 
167
226
  fieldOnChange(event: any) {
168
227
  event.value = event.checked;
169
-
170
- this.angularPConnectData.actions?.onChange(this, event);
228
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, event.checked);
229
+ this.pConn$.clearErrorMessages({
230
+ property: this.propName
231
+ });
171
232
  }
172
233
 
173
234
  fieldOnBlur(event: any) {
174
- event.value = event.checked;
175
- this.angularPConnectData.actions?.onBlur(this, event);
235
+ if (this.selectionMode === 'multi') {
236
+ this.pConn$.getValidationApi().validate(this.selectedvalues, this.selectionList);
237
+ } else {
238
+ this.pConn$.getValidationApi().validate(event.target.checked);
239
+ }
240
+ }
241
+
242
+ handleChangeMultiMode(event, element) {
243
+ if (!element.selected) {
244
+ insertInstruction(this.pConn$, this.selectionList, this.selectionKey, this.primaryField, {
245
+ id: element.key,
246
+ primary: element.text ?? element.value
247
+ });
248
+ } else {
249
+ deleteInstruction(this.pConn$, this.selectionList, this.selectionKey, {
250
+ id: element.key,
251
+ primary: element.text ?? element.value
252
+ });
253
+ }
254
+ this.pConn$.clearErrorMessages({
255
+ property: this.selectionList,
256
+ category: '',
257
+ context: ''
258
+ });
176
259
  }
177
260
 
178
261
  getErrorMessage() {