@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
@@ -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
  }
@@ -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 {
@@ -27,7 +27,6 @@ export class MaterialCaseSummaryComponent implements OnInit, OnChanges {
27
27
  this.updateLabelAndDate(this.secondaryFields$);
28
28
  }
29
29
 
30
- // eslint-disable-next-line sonarjs/no-identical-functions
31
30
  ngOnChanges() {
32
31
  this.updatePrimaryWithStatus();
33
32
  this.updateLabelAndDate(this.primaryFieldsWithStatus$);
@@ -10,7 +10,7 @@
10
10
  </ng-template>
11
11
 
12
12
  <ng-template #showDetails>
13
- <div class="psdk-grid-filter" *ngIf="field.config.label">
13
+ <div class="psdk-grid-filter" *ngIf="field.config.label && getVisibility(field.config)">
14
14
  <div class="psdk-details-fields-label">
15
15
  {{ field.config.label }}
16
16
  </div>
@@ -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
  }
@@ -26,4 +29,10 @@ export class MaterialDetailsFieldsComponent {
26
29
  _formatDate(dateValue: string, dateFormat: string): string {
27
30
  return this.utils.generateDate(dateValue, dateFormat);
28
31
  }
32
+
33
+ getVisibility(config): boolean {
34
+ const { visibility = true } = config;
35
+
36
+ return this.utils.getBooleanValue(visibility);
37
+ }
29
38
  }
@@ -1,4 +1,4 @@
1
- <div class="psdk-operator psdk-double">
1
+ <div class="psdk-operator psdk-double" [ngClass]="{ 'flex-row': displayLabel }">
2
2
  <div class="psdk-label">
3
3
  {{ label$ }}
4
4
  </div>
@@ -1,9 +1,18 @@
1
1
  .psdk-operator {
2
2
  display: flex;
3
- flex-direction: row;
3
+ flex-direction: column;
4
4
  font-size: 0.8rem;
5
5
  color: var(--app-neutral-color);
6
+ padding-left: 0.625rem;
7
+ margin: 16px 0 8px 0;
8
+ }
9
+
10
+ .psdk-operator.flex-row {
11
+ flex-direction: row;
6
12
  align-items: center;
13
+ text-align: center;
14
+ padding-left: 0;
15
+ margin: 0;
7
16
  }
8
17
 
9
18
  .psdk-operator-popover {
@@ -35,7 +44,6 @@
35
44
 
36
45
  .psdk-double {
37
46
  column-gap: 1rem;
38
- text-align: center;
39
47
  }
40
48
 
41
49
  .psdk-top-pad {
@@ -13,10 +13,11 @@ import { Utils } from '@pega/angular-sdk-components';
13
13
  export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
14
14
  @Input() pConn$: typeof PConnect;
15
15
  @Input() displayLabel;
16
+ @Input() name$?: string;
17
+
16
18
  fields$: any[] = [];
17
19
  bShowPopover$: boolean;
18
20
  date$: string;
19
- name$: string;
20
21
  label$: string;
21
22
  id$: string;
22
23
  constructor(
@@ -40,7 +41,7 @@ export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
40
41
 
41
42
  ngOnChanges(changes: SimpleChanges): void {
42
43
  const { pConn$ } = changes;
43
- if (pConn$.previousValue !== pConn$.currentValue) {
44
+ if (pConn$ && pConn$.previousValue !== pConn$.currentValue) {
44
45
  this.updateSelf();
45
46
  }
46
47
  }
@@ -53,7 +54,7 @@ export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
53
54
  }
54
55
 
55
56
  updateSelf(): void {
56
- const configProps$ = this.pConn$.getConfigProps() as any;
57
+ const configProps$ = this.pConn$.getConfigProps();
57
58
  this.displayLabel = this.displayLabel?.toLowerCase();
58
59
  const label = configProps$?.label?.toLowerCase();
59
60
  if (label === 'create operator' || this.displayLabel === 'create operator') {
@@ -69,7 +70,7 @@ export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
69
70
  this.id$ = configProps$.resolveOperator.userId;
70
71
  this.label$ = configProps$.resolveLabel;
71
72
  } else {
72
- this.name$ = configProps$?.value.userName;
73
+ this.name$ = this.name$ || configProps$?.value.userName;
73
74
  this.id$ = configProps$?.value.userId;
74
75
  this.label$ = configProps$.label;
75
76
  }
@@ -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
  }
@@ -11,7 +11,6 @@
11
11
  [placeholder]="placeholder"
12
12
  [formControl]="fieldControl"
13
13
  [attr.data-test-id]="testId"
14
- [value]="value$"
15
14
  [required]="bRequired$"
16
15
  [matAutocomplete]="auto"
17
16
  (input)="fieldOnChange($event)"
@@ -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';
@@ -14,6 +14,10 @@ import { DatapageService } from '@pega/angular-sdk-components';
14
14
  import { handleEvent } from '@pega/angular-sdk-components';
15
15
  import { PConnFieldProps } from '@pega/angular-sdk-components';
16
16
 
17
+ interface IOption {
18
+ key: string;
19
+ value: string;
20
+ }
17
21
  interface AutoCompleteProps extends PConnFieldProps {
18
22
  // If any, enter additional props that only exist on AutoComplete here
19
23
  deferDatasource?: boolean;
@@ -71,6 +75,8 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
71
75
  hideLabel: boolean;
72
76
  filteredOptions: Observable<any[]>;
73
77
  filterValue = '';
78
+ actionsApi: Object;
79
+ propName: string;
74
80
 
75
81
  constructor(
76
82
  private angularPConnect: AngularPConnectService,
@@ -102,10 +108,17 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
102
108
 
103
109
  this.filteredOptions = this.fieldControl.valueChanges.pipe(
104
110
  startWith(''),
105
- map(value => this._filter(value || ''))
111
+ map(value => this._filter((value as string) || ''))
106
112
  );
107
113
  }
108
114
 
115
+ setOptions(options: IOption[]) {
116
+ this.options$ = options;
117
+ const index = this.options$?.findIndex(element => element.key === this.configProps$.value);
118
+ this.value$ = index > -1 ? this.options$[index].value : this.configProps$.value;
119
+ this.fieldControl.setValue(this.value$);
120
+ }
121
+
109
122
  ngOnDestroy(): void {
110
123
  if (this.formGroup$) {
111
124
  this.formGroup$.removeControl(this.controlName$);
@@ -147,10 +160,14 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
147
160
  if (this.configProps$.value != undefined) {
148
161
  const index = this.options$?.findIndex(element => element.key === this.configProps$.value);
149
162
  this.value$ = index > -1 ? this.options$[index].value : this.configProps$.value;
163
+ this.fieldControl.setValue(this.value$);
150
164
  }
151
165
 
152
166
  this.setPropertyValuesFromProps();
153
167
 
168
+ this.actionsApi = this.pConn$.getActionsApi();
169
+ this.propName = this.pConn$.getStateProps().value;
170
+
154
171
  const context = this.pConn$.getContextName();
155
172
  const { columns, datasource } = this.generateColumnsAndDataSource();
156
173
 
@@ -184,9 +201,10 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
184
201
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
185
202
  }
186
203
 
187
- this.componentReference = (this.pConn$.getStateProps() as any).value;
204
+ this.componentReference = this.pConn$.getStateProps().value;
188
205
  if (this.listType === 'associated') {
189
- this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
206
+ const optionsList = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
207
+ this.setOptions(optionsList);
190
208
  }
191
209
 
192
210
  if (!this.displayMode$ && this.listType !== 'associated') {
@@ -220,7 +238,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
220
238
  let datasource = this.configProps$.datasource;
221
239
  let columns = this.configProps$.columns;
222
240
  // const { deferDatasource, datasourceMetadata } = this.configProps$;
223
- const { deferDatasource, datasourceMetadata }: any = this.pConn$.getConfigProps();
241
+ const { deferDatasource, datasourceMetadata } = this.pConn$.getConfigProps();
224
242
  // convert associated to datapage listtype and transform props
225
243
  // Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList
226
244
  if (deferDatasource && datasourceMetadata?.datasource?.name) {
@@ -258,7 +276,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
258
276
  };
259
277
  optionsData.push(obj);
260
278
  });
261
- this.options$ = optionsData;
279
+ this.setOptions(optionsData);
262
280
  }
263
281
 
264
282
  flattenParameters(params = {}) {
@@ -299,13 +317,14 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
299
317
  // this works - this.pConn$.setValue( this.componentReference, this.fieldControl.value);
300
318
  // PConnect wants to use changeHandler for onChange
301
319
  // this.angularPConnect.changeHandler( this, event);
302
- this.filterValue = (event.target as HTMLInputElement).value;
303
-
304
- this.angularPConnectData.actions?.onChange(this, event);
320
+ const value = (event.target as HTMLInputElement).value;
321
+ this.filterValue = value;
322
+ handleEvent(this.actionsApi, 'change', this.propName, value);
305
323
  }
306
324
 
307
- optionChanged(event: MatAutocompleteSelectedEvent) {
308
- this.angularPConnectData.actions?.onChange(this, event);
325
+ optionChanged(event: any) {
326
+ const value = event?.option?.value;
327
+ handleEvent(this.actionsApi, 'change', this.propName, value);
309
328
  }
310
329
 
311
330
  fieldOnBlur(event: Event) {
@@ -315,11 +334,8 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
315
334
  const index = this.options$?.findIndex(element => element.value === el.value);
316
335
  key = index > -1 ? (key = this.options$[index].key) : el.value;
317
336
  }
318
-
319
337
  const value = key;
320
- const actionsApi = this.pConn$?.getActionsApi();
321
- const propName = (this.pConn$?.getStateProps() as any).value;
322
- handleEvent(actionsApi, 'changeNblur', propName, value);
338
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
323
339
  if (this.configProps$?.onRecordChange) {
324
340
  el.value = value;
325
341
  this.configProps$.onRecordChange(event);
@@ -18,6 +18,8 @@
18
18
  <mat-checkbox
19
19
  [labelPosition]="'after'"
20
20
  [checked]="item.selected"
21
+ [disabled]="bDisabled$ || bReadonly$"
22
+ [required]="bRequired$"
21
23
  [attr.data-test-id]="testId + ':' + item.value"
22
24
  (change)="handleChangeMultiMode($event, item)"
23
25
  (blur)="fieldOnBlur($event)"
@@ -29,6 +31,8 @@
29
31
  <mat-checkbox
30
32
  [labelPosition]="'after'"
31
33
  [checked]="isChecked$"
34
+ [disabled]="bDisabled$ || bReadonly$"
35
+ [required]="bRequired$"
32
36
  [attr.data-test-id]="testId"
33
37
  [formControl]="fieldControl"
34
38
  (change)="fieldOnChange($event)"
@@ -69,8 +69,8 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
69
69
  selectedvalues: any;
70
70
  referenceList: string;
71
71
  listOfCheckboxes: any[] = [];
72
- actionsApi: any;
73
- propName: any;
72
+ actionsApi: Object;
73
+ propName: string;
74
74
 
75
75
  fieldControl = new FormControl('', null);
76
76
 
@@ -146,7 +146,7 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
146
146
  }
147
147
 
148
148
  this.actionsApi = this.pConn$.getActionsApi();
149
- this.propName = (this.pConn$.getStateProps() as any).value;
149
+ this.propName = this.pConn$.getStateProps().value;
150
150
 
151
151
  // multi case
152
152
  this.selectionMode = this.configProps$.selectionMode;
@@ -159,7 +159,7 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
159
159
  this.datasource = this.configProps$.datasource;
160
160
  this.selectionKey = this.configProps$.selectionKey;
161
161
  const listSourceItems = this.datasource?.source ?? [];
162
- const dataField: any = this.selectionKey?.split?.('.')[1];
162
+ const dataField = this.selectionKey?.split?.('.')[1] ?? '';
163
163
  const listToDisplay: any[] = [];
164
164
  listSourceItems.forEach(element => {
165
165
  element.selected = this.selectedvalues?.some?.(data => data[dataField] === element.key);
@@ -173,8 +173,8 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
173
173
 
174
174
  this.caption$ = this.configProps$.caption;
175
175
  this.helperText = this.configProps$.helperText;
176
- this.trueLabel$ = this.configProps$.trueLabel;
177
- this.falseLabel$ = this.configProps$.falseLabel;
176
+ this.trueLabel$ = this.configProps$.trueLabel || 'Yes';
177
+ this.falseLabel$ = this.configProps$.falseLabel || 'No';
178
178
 
179
179
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
180
180
  setTimeout(() => {
@@ -203,7 +203,7 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
203
203
  this.fieldControl.enable();
204
204
  }
205
205
 
206
- this.componentReference = (this.pConn$.getStateProps() as any).value;
206
+ this.componentReference = this.pConn$.getStateProps().value;
207
207
 
208
208
  // eslint-disable-next-line sonarjs/no-redundant-boolean
209
209
  if (this.value$ === 'true' || this.value$ == true) {
@@ -225,16 +225,17 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
225
225
 
226
226
  fieldOnChange(event: any) {
227
227
  event.value = event.checked;
228
-
229
228
  handleEvent(this.actionsApi, 'changeNblur', this.propName, event.checked);
229
+ this.pConn$.clearErrorMessages({
230
+ property: this.propName
231
+ });
230
232
  }
231
233
 
232
234
  fieldOnBlur(event: any) {
233
235
  if (this.selectionMode === 'multi') {
234
236
  this.pConn$.getValidationApi().validate(this.selectedvalues, this.selectionList);
235
237
  } else {
236
- event.value = event.checked;
237
- this.angularPConnectData.actions?.onBlur(this, event);
238
+ this.pConn$.getValidationApi().validate(event.target.checked);
238
239
  }
239
240
  }
240
241
 
@@ -1,5 +1,5 @@
1
1
  <div *ngIf="displayMode$; else noDisplayMode">
2
- <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
2
+ <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$: formattedValue, displayMode$ }"></component-mapper>
3
3
  </div>
4
4
  <ng-template #noDisplayMode>
5
5
  <div *ngIf="bHasForm$; else noEdit">
@@ -13,9 +13,9 @@
13
13
  matInput
14
14
  currencyMask
15
15
  [options]="{
16
- prefix: currSym,
17
- thousands: currSep,
18
- decimal: currDec,
16
+ prefix: currencySymbol,
17
+ thousands: thousandSeparator,
18
+ decimal: decimalSeparator,
19
19
  align: 'left',
20
20
  nullable: true,
21
21
  precision: decimalPrecision,
@@ -9,13 +9,15 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
9
9
  import { Utils } from '@pega/angular-sdk-components';
10
10
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
11
  import { handleEvent } from '@pega/angular-sdk-components';
12
- import { getCurrencyCharacters } from '@pega/angular-sdk-components';
12
+ import { getCurrencyCharacters, getCurrencyOptions } from '@pega/angular-sdk-components';
13
13
  import { PConnFieldProps } from '@pega/angular-sdk-components';
14
+ import { format } from '@pega/angular-sdk-components';
14
15
 
15
16
  interface CurrrencyProps extends PConnFieldProps {
16
17
  // If any, enter additional props that only exist on Currency here
17
18
  currencyISOCode?: string;
18
19
  allowDecimals: boolean;
20
+ formatter?: string;
19
21
  }
20
22
 
21
23
  @Component({
@@ -50,11 +52,13 @@ export class CurrencyComponent implements OnInit, OnDestroy {
50
52
  currencyOptions: Object = {};
51
53
 
52
54
  fieldControl = new FormControl<number | null>(null, { updateOn: 'blur' });
53
- currSym: string;
54
- currSep: string;
55
- currDec: string;
55
+ currencySymbol: string;
56
+ thousandSeparator: string;
57
+ decimalSeparator: string;
56
58
  inputMode: any;
57
59
  decimalPrecision: number | undefined;
60
+ formattedValue: string;
61
+ formatter;
58
62
 
59
63
  constructor(
60
64
  private angularPConnect: AngularPConnectService,
@@ -126,15 +130,26 @@ export class CurrencyComponent implements OnInit, OnDestroy {
126
130
  nValue = parseFloat(nValue);
127
131
  }
128
132
  this.value$ = nValue;
133
+ this.fieldControl.setValue(this.value$);
129
134
  }
130
135
  this.helperText = this.configProps$.helperText;
131
136
  this.placeholder = this.configProps$.placeholder || '';
132
- const currencyISOCode: any = this.configProps$?.currencyISOCode;
137
+ const currencyISOCode = this.configProps$?.currencyISOCode ?? '';
133
138
 
134
139
  const theSymbols = getCurrencyCharacters(currencyISOCode);
135
- this.currSym = theSymbols.theCurrencySymbol;
136
- this.currSep = theSymbols.theDigitGroupSeparator;
137
- this.currDec = theSymbols.theDecimalIndicator;
140
+ this.currencySymbol = theSymbols.theCurrencySymbol;
141
+ this.thousandSeparator = theSymbols.theDigitGroupSeparator;
142
+ this.decimalSeparator = theSymbols.theDecimalIndicator;
143
+ this.formatter = this.configProps$.formatter;
144
+
145
+ if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
146
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
147
+ if (this.formatter) {
148
+ this.formattedValue = format(this.value$, this.formatter.toLowerCase(), theCurrencyOptions);
149
+ } else {
150
+ this.formattedValue = format(this.value$, 'currency', theCurrencyOptions);
151
+ }
152
+ }
138
153
 
139
154
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
140
155
  setTimeout(() => {
@@ -169,7 +184,7 @@ export class CurrencyComponent implements OnInit, OnDestroy {
169
184
 
170
185
  this.decimalPrecision = this.configProps$?.allowDecimals ? 2 : 0;
171
186
 
172
- this.componentReference = (this.pConn$.getStateProps() as any).value;
187
+ this.componentReference = this.pConn$.getStateProps().value;
173
188
 
174
189
  // trigger display of error message with field control
175
190
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -183,17 +198,25 @@ export class CurrencyComponent implements OnInit, OnDestroy {
183
198
  }
184
199
 
185
200
  fieldOnBlur(event: any) {
186
- const actionsApi = this.pConn$?.getActionsApi();
187
- const propName = (this.pConn$?.getStateProps() as any).value;
188
- let value = event?.target?.value;
189
- value = value?.substring(1);
190
- if (this.currSep === ',') {
191
- value = value.replace(/,/g, '');
192
- } else {
193
- value = value?.replace(/\./g, '');
194
- value = value?.replace(/,/g, '.');
201
+ const oldVal = this.value$ ?? '';
202
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
203
+
204
+ if (isValueChanged) {
205
+ const actionsApi = this.pConn$?.getActionsApi();
206
+ const propName = this.pConn$?.getStateProps().value;
207
+ let value = event?.target?.value;
208
+ value = value?.substring(1);
209
+ // replacing thousand separator with empty string as not required in api call
210
+ const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
211
+ let regExp = new RegExp(String.raw`${thousandSep}`, 'g');
212
+ value = value?.replace(regExp, '');
213
+ // replacing decimal separator with '.'
214
+ if (this.decimalSeparator !== '.') {
215
+ regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
216
+ value = value.replace(regExp, '.');
217
+ }
218
+ handleEvent(actionsApi, 'changeNblur', propName, value);
195
219
  }
196
- handleEvent(actionsApi, 'changeNblur', propName, value);
197
220
  }
198
221
 
199
222
  getErrorMessage() {
@@ -1,9 +1,5 @@
1
1
  <div *ngIf="displayMode$; else noDisplayMode">
2
- <component-mapper
3
- *ngIf="bVisible$ !== false"
4
- name="FieldValueList"
5
- [props]="{ label$, value$: getFormattedValue(), displayMode$ }"
6
- ></component-mapper>
2
+ <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$: formattedValue$, displayMode$ }"></component-mapper>
7
3
  </div>
8
4
  <ng-template #noDisplayMode>
9
5
  <div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
@@ -19,11 +15,11 @@
19
15
  type="text"
20
16
  [value]="value$"
21
17
  [required]="bRequired$"
18
+ [disabled]="bDisabled$"
22
19
  [formControl]="fieldControl"
23
20
  (dateChange)="fieldOnDateChange($event)"
24
- (blur)="fieldOnBlur($event)"
25
21
  />
26
- <mat-datepicker-toggle matSuffix [for]="pegadate"></mat-datepicker-toggle>
22
+ <mat-datepicker-toggle matSuffix [for]="pegadate" [disabled]="bDisabled$"></mat-datepicker-toggle>
27
23
  <mat-datepicker #pegadate [startAt]="value$"></mat-datepicker>
28
24
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
29
25
  </mat-form-field>