@pega/angular-sdk-overrides 24.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 (104) 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-details-fields/material-details-fields.component.html +1 -1
  5. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +4 -1
  6. package/lib/designSystemExtension/operator/operator.component.ts +1 -1
  7. package/lib/designSystemExtension/pulse/pulse.component.ts +7 -7
  8. package/lib/field/auto-complete/auto-complete.component.ts +16 -13
  9. package/lib/field/check-box/check-box.component.ts +11 -10
  10. package/lib/field/currency/currency.component.html +4 -4
  11. package/lib/field/currency/currency.component.ts +32 -15
  12. package/lib/field/date/date.component.html +1 -6
  13. package/lib/field/date/date.component.ts +22 -39
  14. package/lib/field/date-time/date-time.component.html +1 -2
  15. package/lib/field/date-time/date-time.component.ts +18 -13
  16. package/lib/field/decimal/decimal.component.html +3 -3
  17. package/lib/field/decimal/decimal.component.ts +21 -18
  18. package/lib/field/dropdown/dropdown.component.ts +132 -18
  19. package/lib/field/email/email.component.ts +14 -4
  20. package/lib/field/group/group.component.ts +2 -2
  21. package/lib/field/integer/integer.component.html +1 -1
  22. package/lib/field/integer/integer.component.ts +13 -5
  23. package/lib/field/multiselect/multiselect.component.ts +15 -5
  24. package/lib/field/percentage/percentage.component.html +4 -4
  25. package/lib/field/percentage/percentage.component.ts +34 -19
  26. package/lib/field/phone/phone.component.html +1 -1
  27. package/lib/field/phone/phone.component.ts +11 -14
  28. package/lib/field/radio-buttons/radio-buttons.component.ts +9 -9
  29. package/lib/field/rich-text/rich-text.component.ts +8 -6
  30. package/lib/field/scalar-list/scalar-list.component.ts +3 -4
  31. package/lib/field/text/text.component.ts +2 -0
  32. package/lib/field/text-area/text-area.component.html +2 -1
  33. package/lib/field/text-area/text-area.component.ts +13 -6
  34. package/lib/field/text-input/text-input.component.html +1 -1
  35. package/lib/field/text-input/text-input.component.ts +13 -5
  36. package/lib/field/time/time.component.html +2 -2
  37. package/lib/field/time/time.component.ts +21 -7
  38. package/lib/field/url/url.component.html +1 -1
  39. package/lib/field/url/url.component.ts +13 -5
  40. package/lib/field/user-reference/user-reference.component.html +2 -10
  41. package/lib/field/user-reference/user-reference.component.ts +42 -14
  42. package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
  43. package/lib/infra/Containers/flow-container/flow-container.component.ts +10 -6
  44. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +1 -1
  45. package/lib/infra/Containers/preview-view-container/preview-view-container.component.ts +1 -1
  46. package/lib/infra/Containers/view-container/helper.ts +22 -0
  47. package/lib/infra/Containers/view-container/view-container.component.ts +5 -17
  48. package/lib/infra/assignment/assignment.component.ts +0 -1
  49. package/lib/infra/defer-load/defer-load.component.ts +4 -4
  50. package/lib/infra/navbar/navbar.component.ts +3 -3
  51. package/lib/infra/root-container/root-container.component.ts +3 -3
  52. package/lib/infra/stages/stages.component.scss +2 -2
  53. package/lib/infra/view/view.component.html +7 -20
  54. package/lib/infra/view/view.component.ts +20 -2
  55. package/lib/template/app-shell/app-shell.component.ts +20 -2
  56. package/lib/template/base/details-template-base.ts +67 -0
  57. package/lib/template/base/form-template-base.ts +10 -0
  58. package/lib/template/case-summary/case-summary.component.ts +1 -1
  59. package/lib/template/case-view/case-view.component.html +4 -4
  60. package/lib/template/case-view/case-view.component.ts +8 -13
  61. package/lib/template/confirmation/confirmation.component.ts +1 -1
  62. package/lib/template/data-reference/data-reference.component.ts +36 -40
  63. package/lib/template/default-form/default-form.component.html +0 -4
  64. package/lib/template/default-form/default-form.component.ts +7 -23
  65. package/lib/template/details/details.component.ts +7 -41
  66. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +6 -39
  67. package/lib/template/details-one-column/details-one-column.component.ts +7 -42
  68. package/lib/template/details-sub-tabs/details-sub-tabs.component.html +1 -2
  69. package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +5 -37
  70. package/lib/template/details-three-column/details-three-column.component.ts +7 -43
  71. package/lib/template/details-two-column/details-two-column.component.ts +8 -44
  72. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +7 -42
  73. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +3 -0
  74. package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +8 -3
  75. package/lib/template/field-group-template/field-group-template.component.ts +2 -4
  76. package/lib/template/field-value-list/field-value-list.component.html +1 -1
  77. package/lib/template/field-value-list/field-value-list.component.scss +2 -1
  78. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -2
  79. package/lib/template/list-view/list-view.component.html +3 -0
  80. package/lib/template/list-view/list-view.component.scss +11 -0
  81. package/lib/template/list-view/list-view.component.ts +24 -4
  82. package/lib/template/list-view/listViewHelpers.ts +1 -1
  83. package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +1 -1
  84. package/lib/template/one-column/one-column.component.ts +4 -3
  85. package/lib/template/one-column-tab/one-column-tab.component.ts +1 -1
  86. package/lib/template/page/page.component.ts +1 -1
  87. package/lib/template/promoted-filters/promoted-filters.component.ts +1 -1
  88. package/lib/template/repeating-structures/repeating-structures.component.ts +1 -1
  89. package/lib/template/simple-table-manual/helpers.ts +1 -1
  90. package/lib/template/simple-table-manual/simple-table-manual.component.scss +1 -0
  91. package/lib/template/simple-table-manual/simple-table-manual.component.ts +15 -13
  92. package/lib/template/simple-table-select/simple-table-select.component.ts +3 -3
  93. package/lib/template/three-column/three-column.component.ts +4 -3
  94. package/lib/template/two-column/two-column.component.ts +4 -3
  95. package/lib/template/two-column-tab/two-column-tab.component.ts +1 -1
  96. package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +4 -3
  97. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +1 -1
  98. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +3 -3
  99. package/lib/widget/attachment/attachment.component.ts +7 -9
  100. package/lib/widget/feed-container/feed-container.component.ts +7 -7
  101. package/lib/widget/file-utility/file-utility.component.ts +2 -5
  102. package/lib/widget/todo/todo.component.html +2 -2
  103. package/lib/widget/todo/todo.component.ts +93 -83
  104. 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 {
@@ -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
  }
@@ -53,7 +53,7 @@ export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
53
53
  }
54
54
 
55
55
  updateSelf(): void {
56
- const configProps$ = this.pConn$.getConfigProps() as any;
56
+ const configProps$ = this.pConn$.getConfigProps();
57
57
  this.displayLabel = this.displayLabel?.toLowerCase();
58
58
  const label = configProps$?.label?.toLowerCase();
59
59
  if (label === 'create operator' || this.displayLabel === 'create operator') {
@@ -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
 
@@ -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);
@@ -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,
@@ -129,12 +133,22 @@ export class CurrencyComponent implements OnInit, OnDestroy {
129
133
  }
130
134
  this.helperText = this.configProps$.helperText;
131
135
  this.placeholder = this.configProps$.placeholder || '';
132
- const currencyISOCode: any = this.configProps$?.currencyISOCode;
136
+ const currencyISOCode = this.configProps$?.currencyISOCode ?? '';
133
137
 
134
138
  const theSymbols = getCurrencyCharacters(currencyISOCode);
135
- this.currSym = theSymbols.theCurrencySymbol;
136
- this.currSep = theSymbols.theDigitGroupSeparator;
137
- this.currDec = theSymbols.theDecimalIndicator;
139
+ this.currencySymbol = theSymbols.theCurrencySymbol;
140
+ this.thousandSeparator = theSymbols.theDigitGroupSeparator;
141
+ this.decimalSeparator = theSymbols.theDecimalIndicator;
142
+ this.formatter = this.configProps$.formatter;
143
+
144
+ if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
145
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
146
+ if (this.formatter) {
147
+ this.formattedValue = format(this.value$, this.formatter.toLowerCase(), theCurrencyOptions);
148
+ } else {
149
+ this.formattedValue = format(this.value$, 'currency', theCurrencyOptions);
150
+ }
151
+ }
138
152
 
139
153
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
140
154
  setTimeout(() => {
@@ -169,7 +183,7 @@ export class CurrencyComponent implements OnInit, OnDestroy {
169
183
 
170
184
  this.decimalPrecision = this.configProps$?.allowDecimals ? 2 : 0;
171
185
 
172
- this.componentReference = (this.pConn$.getStateProps() as any).value;
186
+ this.componentReference = this.pConn$.getStateProps().value;
173
187
 
174
188
  // trigger display of error message with field control
175
189
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -184,14 +198,17 @@ export class CurrencyComponent implements OnInit, OnDestroy {
184
198
 
185
199
  fieldOnBlur(event: any) {
186
200
  const actionsApi = this.pConn$?.getActionsApi();
187
- const propName = (this.pConn$?.getStateProps() as any).value;
201
+ const propName = this.pConn$?.getStateProps().value;
188
202
  let value = event?.target?.value;
189
203
  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, '.');
204
+ // replacing thousand separator with empty string as not required in api call
205
+ const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
206
+ let regExp = new RegExp(String.raw`${thousandSep}`, 'g');
207
+ value = value?.replace(regExp, '');
208
+ // replacing decimal separator with '.'
209
+ if (this.decimalSeparator !== '.') {
210
+ regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
211
+ value = value.replace(regExp, '.');
195
212
  }
196
213
  handleEvent(actionsApi, 'changeNblur', propName, value);
197
214
  }
@@ -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">
@@ -21,7 +17,6 @@
21
17
  [required]="bRequired$"
22
18
  [formControl]="fieldControl"
23
19
  (dateChange)="fieldOnDateChange($event)"
24
- (blur)="fieldOnBlur($event)"
25
20
  />
26
21
  <mat-datepicker-toggle matSuffix [for]="pegadate"></mat-datepicker-toggle>
27
22
  <mat-datepicker #pegadate [startAt]="value$"></mat-datepicker>
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-classes-per-file */
2
1
  import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, Inject, OnDestroy } from '@angular/core';
3
2
  import { CommonModule } from '@angular/common';
4
3
  import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
@@ -15,13 +14,14 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
15
14
  import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/angular-sdk-components';
16
15
  import { PConnFieldProps } from '@pega/angular-sdk-components';
17
16
  import { format } from '@pega/angular-sdk-components';
17
+ import { handleEvent } from '@pega/angular-sdk-components';
18
18
 
19
19
  interface DateProps extends PConnFieldProps {
20
20
  // If any, enter additional props that only exist on Date here
21
21
  }
22
22
 
23
23
  class MyFormat {
24
- theDateFormat: any = getDateFormatInfo();
24
+ theDateFormat = getDateFormatInfo();
25
25
 
26
26
  get display() {
27
27
  return {
@@ -83,7 +83,10 @@ export class DateComponent implements OnInit, OnDestroy {
83
83
  // Start with default dateFormatInfo
84
84
  dateFormatInfo = dateFormatInfoDefault;
85
85
  // and then update, as needed, based on locale, etc.
86
- theDateFormat: any = getDateFormatInfo();
86
+ theDateFormat = getDateFormatInfo();
87
+ actionsApi: Object;
88
+ propName: string;
89
+ formattedValue$: any;
87
90
 
88
91
  constructor(
89
92
  private angularPConnect: AngularPConnectService,
@@ -146,27 +149,16 @@ export class DateComponent implements OnInit, OnDestroy {
146
149
  // moved this from ngOnInit() and call this from there instead...
147
150
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as DateProps;
148
151
 
149
- if (this.configProps$.value != undefined) {
150
- let sDateValue: any = '';
151
- sDateValue = this.configProps$.value;
152
-
153
- if (sDateValue != '') {
154
- if (typeof sDateValue === 'object') {
155
- sDateValue = sDateValue.toISOString();
156
- } else if (sDateValue.indexOf('/') < 0) {
157
- // if we have the "pega" format, then for display, convert to standard format (US)
158
- // sDateValue = this.formatDate(sDateValue);
159
- sDateValue = this.utils.generateDate(sDateValue, 'Date-Long-Custom-YYYY');
160
- }
161
- this.value$ = new Date(sDateValue);
162
- }
163
- }
152
+ this.value$ = this.configProps$.value;
164
153
  this.testId = this.configProps$.testId;
165
154
  this.label$ = this.configProps$.label;
166
155
  this.displayMode$ = this.configProps$.displayMode;
167
156
  this.helperText = this.configProps$.helperText;
168
157
  this.placeholder = this.configProps$.placeholder || '';
169
158
 
159
+ this.actionsApi = this.pConn$.getActionsApi();
160
+ this.propName = this.pConn$.getStateProps().value;
161
+
170
162
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
171
163
  setTimeout(() => {
172
164
  if (this.configProps$.required != null) {
@@ -175,6 +167,12 @@ export class DateComponent implements OnInit, OnDestroy {
175
167
  this.cdRef.detectChanges();
176
168
  });
177
169
 
170
+ if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
171
+ this.formattedValue$ = format(this.value$, 'date', {
172
+ format: this.theDateFormat.dateFormatString
173
+ });
174
+ }
175
+
178
176
  if (this.configProps$.visibility != null) {
179
177
  this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
180
178
  }
@@ -194,7 +192,7 @@ export class DateComponent implements OnInit, OnDestroy {
194
192
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
195
193
  }
196
194
 
197
- this.componentReference = (this.pConn$.getStateProps() as any).value;
195
+ this.componentReference = this.pConn$.getStateProps().value;
198
196
 
199
197
  // trigger display of error message with field control
200
198
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -209,20 +207,11 @@ export class DateComponent implements OnInit, OnDestroy {
209
207
 
210
208
  fieldOnDateChange(event: any) {
211
209
  // this comes from the date pop up
212
- if (typeof event.value === 'object') {
213
- // convert date to pega "date" format
214
- event.value = event.value?.toISOString();
215
- }
216
- this.angularPConnectData.actions?.onChange(this, { value: event.value });
217
- }
218
-
219
- fieldOnBlur(event: any) {
220
- // PConnect wants to use eventHandler for onBlur
221
- if (typeof event.value === 'object') {
222
- // convert date to pega "date" format
223
- event.value = event.value?.toISOString();
224
- }
225
- this.angularPConnectData.actions?.onBlur(this, { value: event.value });
210
+ const value = event?.target?.value.format('YYYY-MM-DD');
211
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
212
+ this.pConn$.clearErrorMessages({
213
+ property: this.propName
214
+ });
226
215
  }
227
216
 
228
217
  hasErrors() {
@@ -243,10 +232,4 @@ export class DateComponent implements OnInit, OnDestroy {
243
232
  }
244
233
  return errMessage;
245
234
  }
246
-
247
- getFormattedValue() {
248
- return format(this.value$, 'date', {
249
- format: this.theDateFormat.dateFormatString
250
- });
251
- }
252
235
  }
@@ -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="!bReadonly$ && bHasForm$; else noEdit">
@@ -12,7 +12,6 @@
12
12
  [attr.data-test-id]="testId"
13
13
  [placeholder]="placeholder"
14
14
  [formControl]="fieldControl"
15
- (blur)="fieldOnBlur($event)"
16
15
  (dateTimeChange)="fieldOnDateChange($event)"
17
16
  [value]="value$"
18
17
  [required]="bRequired$"
@@ -11,6 +11,8 @@ import { Utils } from '@pega/angular-sdk-components';
11
11
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
12
12
  import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/angular-sdk-components';
13
13
  import { PConnFieldProps } from '@pega/angular-sdk-components';
14
+ import { handleEvent } from '@pega/angular-sdk-components';
15
+ import { format } from '@pega/angular-sdk-components';
14
16
 
15
17
  interface DateTimeProps extends PConnFieldProps {
16
18
  // If any, enter additional props that only exist on DateTime here
@@ -61,8 +63,11 @@ export class DateTimeComponent implements OnInit, OnDestroy {
61
63
  // Start with default dateFormatInfo
62
64
  dateFormatInfo = dateFormatInfoDefault;
63
65
  // and then update, as needed, based on locale, etc.
64
- theDateFormat: any = getDateFormatInfo();
66
+ theDateFormat = getDateFormatInfo();
65
67
  placeholder: string;
68
+ actionsApi: Object;
69
+ propName: string;
70
+ formattedValue$: any;
66
71
 
67
72
  constructor(
68
73
  private angularPConnect: AngularPConnectService,
@@ -71,7 +76,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
71
76
  ) {}
72
77
 
73
78
  ngOnInit(): void {
74
- this.placeholder = `${this.theDateFormat.dateFormatStringLC}, hh:mm a`;
79
+ this.placeholder = `${this.theDateFormat.dateFormatStringLC}, hh:mm A`;
75
80
  // First thing in initialization is registering and subscribing to the AngularPConnect service
76
81
  this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
77
82
  this.controlName$ = this.angularPConnect.getComponentID(this);
@@ -136,6 +141,12 @@ export class DateTimeComponent implements OnInit, OnDestroy {
136
141
  this.cdRef.detectChanges();
137
142
  });
138
143
 
144
+ if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
145
+ this.formattedValue$ = format(this.value$, 'datetime', {
146
+ format: `${this.theDateFormat.dateFormatString} hh:mm A`
147
+ });
148
+ }
149
+
139
150
  if (this.configProps$.visibility != null) {
140
151
  this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
141
152
  }
@@ -155,7 +166,10 @@ export class DateTimeComponent implements OnInit, OnDestroy {
155
166
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
156
167
  }
157
168
 
158
- this.componentReference = (this.pConn$.getStateProps() as any).value;
169
+ this.componentReference = this.pConn$.getStateProps().value;
170
+
171
+ this.actionsApi = this.pConn$.getActionsApi();
172
+ this.propName = this.pConn$.getStateProps().value;
159
173
 
160
174
  // trigger display of error message with field control
161
175
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -174,16 +188,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
174
188
  // convert date to pega "date" format
175
189
  event.value = event.value?.toISOString();
176
190
  }
177
- this.angularPConnectData.actions?.onChange(this, { value: event.value });
178
- }
179
-
180
- fieldOnBlur(event: any) {
181
- if (typeof event.value === 'object') {
182
- // convert date to pega "date" format
183
- event.value = event.value?.toISOString();
184
- }
185
-
186
- this.angularPConnectData.actions?.onBlur(this, event);
191
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
187
192
  }
188
193
 
189
194
  getErrorMessage() {
@@ -11,9 +11,9 @@
11
11
  matInput
12
12
  currencyMask
13
13
  [options]="{
14
- prefix: bReadonly$ && formatter === 'Currency' ? currSym : '',
15
- thousands: currSep,
16
- decimal: currDec,
14
+ prefix: currencySymbol,
15
+ thousands: thousandSeparator,
16
+ decimal: decimalSeparator,
17
17
  align: 'left',
18
18
  nullable: true,
19
19
  precision: decimalPrecision,