@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
@@ -8,6 +8,7 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
8
8
  import { Utils } from '@pega/angular-sdk-components';
9
9
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
10
10
  import { PConnFieldProps } from '@pega/angular-sdk-components';
11
+ import { handleEvent } from '@pega/angular-sdk-components';
11
12
 
12
13
  interface EmailProps extends PConnFieldProps {
13
14
  // If any, enter additional props that only exist on Email here
@@ -43,6 +44,8 @@ export class EmailComponent implements OnInit, OnDestroy {
43
44
  placeholder: string;
44
45
 
45
46
  fieldControl = new FormControl('', null);
47
+ actionsApi: Object;
48
+ propName: string;
46
49
 
47
50
  constructor(
48
51
  private angularPConnect: AngularPConnectService,
@@ -139,7 +142,10 @@ export class EmailComponent implements OnInit, OnDestroy {
139
142
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
140
143
  }
141
144
 
142
- this.componentReference = (this.pConn$.getStateProps() as any).value;
145
+ this.actionsApi = this.pConn$.getActionsApi();
146
+ this.propName = this.pConn$.getStateProps().value;
147
+
148
+ this.componentReference = this.pConn$.getStateProps().value;
143
149
 
144
150
  // trigger display of error message with field control
145
151
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -153,12 +159,26 @@ export class EmailComponent implements OnInit, OnDestroy {
153
159
  }
154
160
 
155
161
  fieldOnChange(event: any) {
156
- this.angularPConnectData.actions?.onChange(this, event);
162
+ const oldVal = this.value$ ?? '';
163
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
164
+
165
+ if (isValueChanged) {
166
+ const value = event?.target?.value;
167
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
168
+ this.pConn$.clearErrorMessages({
169
+ property: this.propName
170
+ });
171
+ }
157
172
  }
158
173
 
159
174
  fieldOnBlur(event: any) {
160
- // PConnect wants to use eventHandler for onBlur
161
- this.angularPConnectData.actions?.onBlur(this, event);
175
+ const oldVal = this.value$ ?? '';
176
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
177
+
178
+ if (isValueChanged) {
179
+ const value = event?.target?.value;
180
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
181
+ }
162
182
  }
163
183
 
164
184
  getErrorMessage() {
@@ -73,12 +73,12 @@ export class GroupComponent implements OnInit {
73
73
  this.visibility$ = this.pConn$.getComputedVisibility();
74
74
  }
75
75
 
76
- if (this.configProps$.displayMode === 'LABELS_LEFT') {
76
+ if (this.configProps$.displayMode === 'DISPLAY_ONLY') {
77
77
  if (this.configProps$.visibility === undefined) this.visibility$ = true;
78
78
 
79
79
  this.arChildren$.forEach(child => {
80
80
  const pConn = child.getPConnect();
81
- pConn.setInheritedProp('displayMode', 'LABELS_LEFT');
81
+ pConn.setInheritedProp('displayMode', 'DISPLAY_ONLY');
82
82
  pConn.setInheritedProp('readOnly', true);
83
83
 
84
84
  return child;
@@ -8,6 +8,7 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
8
8
  import { Utils } from '@pega/angular-sdk-components';
9
9
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
10
10
  import { PConnFieldProps } from '@pega/angular-sdk-components';
11
+ import { handleEvent } from '@pega/angular-sdk-components';
11
12
 
12
13
  interface IntegerProps extends PConnFieldProps {
13
14
  // If any, enter additional props that only exist on Integer here
@@ -43,6 +44,8 @@ export class IntegerComponent implements OnInit, OnDestroy {
43
44
  placeholder: string;
44
45
 
45
46
  fieldControl = new FormControl<number | null>(null, null);
47
+ actionsApi: Object;
48
+ propName: string;
46
49
 
47
50
  constructor(
48
51
  private angularPConnect: AngularPConnectService,
@@ -115,6 +118,9 @@ export class IntegerComponent implements OnInit, OnDestroy {
115
118
  this.helperText = this.configProps$.helperText;
116
119
  this.placeholder = this.configProps$.placeholder || '';
117
120
 
121
+ this.actionsApi = this.pConn$.getActionsApi();
122
+ this.propName = this.pConn$.getStateProps().value;
123
+
118
124
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
119
125
  setTimeout(() => {
120
126
  if (this.configProps$.required != null) {
@@ -142,7 +148,7 @@ export class IntegerComponent implements OnInit, OnDestroy {
142
148
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
143
149
  }
144
150
 
145
- this.componentReference = (this.pConn$.getStateProps() as any).value;
151
+ this.componentReference = this.pConn$.getStateProps().value;
146
152
 
147
153
  // trigger display of error message with field control
148
154
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -156,12 +162,24 @@ export class IntegerComponent implements OnInit, OnDestroy {
156
162
  }
157
163
 
158
164
  fieldOnChange(event: any) {
159
- this.angularPConnectData.actions?.onChange(this, event);
165
+ const oldVal = this.value$ ?? '';
166
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
167
+
168
+ if (isValueChanged) {
169
+ this.pConn$.clearErrorMessages({
170
+ property: this.propName
171
+ });
172
+ }
160
173
  }
161
174
 
162
175
  fieldOnBlur(event: any) {
163
- // PConnect wants to use eventHandler for onBlur
164
- this.angularPConnectData.actions?.onBlur(this, event);
176
+ const oldVal = this.value$ ?? '';
177
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
178
+
179
+ if (isValueChanged) {
180
+ const value = event?.target?.value;
181
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
182
+ }
165
183
  }
166
184
 
167
185
  getErrorMessage() {
@@ -1,4 +1,4 @@
1
- <mat-grid-list cols="2" rowHeight="6.25rem">
1
+ <mat-grid-list cols="2" rowHeight="4.25rem">
2
2
  <mat-grid-tile>
3
3
  <button mat-raised-button variant="contained" color="secondary" (click)="onCancel()">
4
4
  {{ localizedVal('Cancel', localeCategory) }}
@@ -31,10 +31,11 @@ export class ListViewActionButtonsComponent {
31
31
  this.pConn$
32
32
  .getActionsApi()
33
33
  .submitEmbeddedDataModal(this.context$)
34
- .then(() => {})
34
+ .then(() => {
35
+ this.closeActionsDialog.emit();
36
+ })
35
37
  .finally(() => {
36
38
  this.isDisabled = false;
37
39
  });
38
- this.closeActionsDialog.emit();
39
40
  }
40
41
  }
@@ -1,7 +1,7 @@
1
1
  import { CommonModule } from '@angular/common';
2
2
  import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
3
3
  import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
4
- import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
4
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
5
5
  import { MatChipsModule } from '@angular/material/chips';
6
6
  import { MatCheckboxModule } from '@angular/material/checkbox';
7
7
  import { MatOptionModule } from '@angular/material/core';
@@ -13,6 +13,7 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
13
13
  import { Utils } from '@pega/angular-sdk-components';
14
14
  import { doSearch, getDisplayFieldsMetaData, getGroupDataForItemsTree, preProcessColumns } from './utils';
15
15
  import { deleteInstruction, insertInstruction } from '@pega/angular-sdk-components';
16
+ import { handleEvent } from '@pega/angular-sdk-components';
16
17
 
17
18
  @Component({
18
19
  selector: 'app-multiselect',
@@ -73,6 +74,8 @@ export class MultiselectComponent implements OnInit, OnDestroy {
73
74
  dataApiObj: any;
74
75
  itemsTree: any[] = [];
75
76
  trigger: any;
77
+ actionsApi: Object;
78
+ propName: string;
76
79
 
77
80
  constructor(
78
81
  private angularPConnect: AngularPConnectService,
@@ -181,7 +184,9 @@ export class MultiselectComponent implements OnInit, OnDestroy {
181
184
  listType: this.listType,
182
185
  maxResultsDisplay: this.maxResultsDisplay || '100',
183
186
  columns: preProcessColumns(columns),
184
- groupColumnsConfig: preProcessColumns(this.groupColumnsConfig)
187
+ groupColumnsConfig: preProcessColumns(this.groupColumnsConfig),
188
+ associationFilter: undefined,
189
+ ignoreCase: undefined
185
190
  };
186
191
 
187
192
  const groupsDisplayFieldMeta = this.listType !== 'associated' ? getDisplayFieldsMetaData(dataConfig.groupColumnsConfig) : null;
@@ -210,6 +215,9 @@ export class MultiselectComponent implements OnInit, OnDestroy {
210
215
  this.fieldControl.enable();
211
216
  }
212
217
 
218
+ this.actionsApi = this.pConn$.getActionsApi();
219
+ this.propName = this.pConn$.getStateProps().value;
220
+
213
221
  if (this.listType !== 'associated') {
214
222
  PCore.getDataApi()
215
223
  ?.init(dataConfig, contextName)
@@ -283,8 +291,10 @@ export class MultiselectComponent implements OnInit, OnDestroy {
283
291
  this.getCaseListBasedOnParams(this.value$, '', [...this.selectedItems], [...this.itemsTree], true);
284
292
  }
285
293
 
286
- optionChanged(event: MatAutocompleteSelectedEvent) {
287
- this.angularPConnectData.actions?.onChange(this, event);
294
+ optionChanged(event: any) {
295
+ let value = event?.target?.value;
296
+ value = value?.substring(1);
297
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
288
298
  }
289
299
 
290
300
  optionClicked = (event: Event, data: any): void => {
@@ -326,7 +336,7 @@ export class MultiselectComponent implements OnInit, OnDestroy {
326
336
 
327
337
  setSelectedItemsForReferenceList(data: any) {
328
338
  // Clear error messages if any
329
- const propName = (this.pConn$.getStateProps() as any).selectionList;
339
+ const propName = this.pConn$.getStateProps().selectionList;
330
340
  this.pConn$.clearErrorMessages({
331
341
  property: propName,
332
342
  category: '',
@@ -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,8 +13,8 @@
13
13
  [options]="{
14
14
  prefix: '',
15
15
  suffix: '%',
16
- thousands: currSep,
17
- decimal: currDec,
16
+ thousands: thousandSeparator,
17
+ decimal: decimalSeparator,
18
18
  align: 'left',
19
19
  nullable: true,
20
20
  precision: decimalPrecision,
@@ -11,10 +11,12 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
11
  import { handleEvent } from '@pega/angular-sdk-components';
12
12
  import { getCurrencyCharacters } 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 PercentageProps extends PConnFieldProps {
16
17
  showGroupSeparators?: string;
17
18
  decimalPrecision?: number;
19
+ currencyISOCode?: string;
18
20
  // If any, enter additional props that only exist on Percentage here
19
21
  }
20
22
 
@@ -46,11 +48,14 @@ export class PercentageComponent implements OnInit, OnDestroy {
46
48
  testId: string;
47
49
  helperText: string;
48
50
  placeholder: string;
49
- currDec: string;
50
- currSep: string;
51
+ decimalSeparator: string;
52
+ thousandSeparator: string;
51
53
  inputMode: any;
52
54
  decimalPrecision: number | undefined;
53
55
  fieldControl = new FormControl<number | null>(null, null);
56
+ actionsApi: Object;
57
+ propName: string;
58
+ formattedValue: string;
54
59
 
55
60
  constructor(
56
61
  private angularPConnect: AngularPConnectService,
@@ -113,20 +118,25 @@ export class PercentageComponent implements OnInit, OnDestroy {
113
118
  this.label$ = this.configProps$.label;
114
119
  this.displayMode$ = this.configProps$.displayMode;
115
120
  this.inputMode = NgxCurrencyInputMode.Natural;
116
- let nValue: any = this.configProps$.value;
121
+ const nValue: any = this.configProps$.value;
117
122
  if (nValue) {
118
- if (typeof nValue === 'string') {
119
- nValue = parseInt(nValue, 10);
120
- }
121
123
  this.value$ = nValue;
124
+ this.fieldControl.setValue(nValue);
122
125
  }
123
126
  this.helperText = this.configProps$.helperText;
124
127
  this.placeholder = this.configProps$.placeholder || '';
125
128
  const showGroupSeparators = this.configProps$.showGroupSeparators;
126
129
 
127
130
  const theSymbols = getCurrencyCharacters('');
128
- this.currDec = theSymbols.theDecimalIndicator || '2';
129
- this.currSep = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
131
+ this.decimalSeparator = theSymbols.theDecimalIndicator;
132
+ this.thousandSeparator = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
133
+
134
+ this.actionsApi = this.pConn$.getActionsApi();
135
+ this.propName = this.pConn$.getStateProps().value;
136
+
137
+ if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
138
+ this.formattedValue = nValue ? format(nValue, 'percentage') : '';
139
+ }
130
140
 
131
141
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
132
142
  setTimeout(() => {
@@ -157,7 +167,7 @@ export class PercentageComponent implements OnInit, OnDestroy {
157
167
 
158
168
  this.decimalPrecision = this.configProps$?.decimalPrecision ?? 2;
159
169
 
160
- this.componentReference = (this.pConn$.getStateProps() as any).value;
170
+ this.componentReference = this.pConn$.getStateProps().value;
161
171
 
162
172
  // trigger display of error message with field control
163
173
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -170,21 +180,36 @@ export class PercentageComponent implements OnInit, OnDestroy {
170
180
  }
171
181
 
172
182
  fieldOnChange(event: any) {
173
- this.angularPConnectData.actions?.onChange(this, event);
183
+ const oldVal = this.value$ ?? '';
184
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
185
+
186
+ if (isValueChanged) {
187
+ this.pConn$.clearErrorMessages({
188
+ property: this.propName
189
+ });
190
+ }
174
191
  }
175
192
 
176
193
  fieldOnBlur(event: any) {
177
- const actionsApi = this.pConn$?.getActionsApi();
178
- const propName = (this.pConn$?.getStateProps() as any).value;
179
- let value = event?.target?.value;
180
- value = value ? value.replace(/%/g, '') : '';
181
- if (this.currSep === ',') {
182
- value = value.replace(/,/g, '');
183
- } else {
184
- value = value?.replace(/\./g, '');
185
- value = value?.replace(/,/g, '.');
194
+ const oldVal = this.value$ ?? '';
195
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
196
+
197
+ if (isValueChanged) {
198
+ let value = event?.target?.value;
199
+ value = value ? value.replace(/%/g, '') : '';
200
+ // replacing thousand separator with empty string as not required in api call
201
+ if (this.configProps$.showGroupSeparators) {
202
+ const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
203
+ const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
204
+ value = value?.replace(regExp, '');
205
+ }
206
+ // replacing decimal separator with '.'
207
+ if (this.decimalSeparator !== '.') {
208
+ const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
209
+ value = value.replace(regExp, '.');
210
+ }
211
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
186
212
  }
187
- handleEvent(actionsApi, 'changeNblur', propName, value);
188
213
  }
189
214
 
190
215
  getErrorMessage() {
@@ -3,6 +3,6 @@
3
3
  "label": "Phone",
4
4
  "description": "Phone",
5
5
  "type": "Field",
6
- "subtype": "DATA_CAPTURE",
6
+ "subtype": "Text-Phone",
7
7
  "properties": []
8
8
  }
@@ -2,7 +2,7 @@
2
2
  <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
3
3
  </div>
4
4
  <ng-template #noDisplayMode>
5
- <div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
5
+ <div *ngIf="bHasForm$; else noEdit">
6
6
  <div #f="ngForm" [formGroup]="formGroup$" *ngIf="bVisible$">
7
7
  <mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
8
8
  <ngx-mat-intl-tel-input
@@ -11,8 +11,10 @@
11
11
  [preferredCountries]="['us']"
12
12
  [enablePlaceholder]="true"
13
13
  [enableSearch]="true"
14
+ [required]="bRequired$"
15
+ [disabled]="bDisabled$ || bReadonly$"
14
16
  (change)="fieldOnChange()"
15
- (blur)="fieldOnBlur($event)"
17
+ (blur)="fieldOnBlur()"
16
18
  >
17
19
  </ngx-mat-intl-tel-input>
18
20
  <mat-label>{{ label$ }}</mat-label>
@@ -38,17 +38,13 @@ export class PhoneComponent implements OnInit, OnDestroy {
38
38
  displayMode$?: string = '';
39
39
  controlName$: string;
40
40
  bHasForm$ = true;
41
- componentReference = '';
42
41
  testId: string;
43
- separateDialCode = false;
44
- afterBlur: boolean;
45
42
  helperText: string;
46
43
 
47
44
  fieldControl = new FormControl('', null);
48
45
 
49
- phoneForm = new FormGroup({
50
- phone: new FormControl<string | null>(null)
51
- });
46
+ actionsApi: Object;
47
+ propName: string;
52
48
 
53
49
  constructor(
54
50
  private angularPConnect: AngularPConnectService,
@@ -114,9 +110,13 @@ export class PhoneComponent implements OnInit, OnDestroy {
114
110
  this.testId = this.configProps$.testId;
115
111
  if (this.configProps$.value != undefined) {
116
112
  this.value$ = this.configProps$.value;
113
+ this.fieldControl.setValue(this.value$);
117
114
  }
118
115
  this.helperText = this.configProps$.helperText;
119
116
 
117
+ this.actionsApi = this.pConn$.getActionsApi();
118
+ this.propName = this.pConn$.getStateProps().value;
119
+
120
120
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
121
121
  setTimeout(() => {
122
122
  if (this.configProps$.required != null) {
@@ -144,10 +144,6 @@ export class PhoneComponent implements OnInit, OnDestroy {
144
144
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
145
145
  }
146
146
 
147
- if (this.bReadonly$) {
148
- this.phoneForm.setValue({ phone: this.value$ });
149
- }
150
-
151
147
  // trigger display of error message with field control
152
148
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
153
149
  const timer = interval(100).subscribe(() => {
@@ -159,27 +155,21 @@ export class PhoneComponent implements OnInit, OnDestroy {
159
155
  }
160
156
  }
161
157
 
158
+ fieldOnBlur() {
159
+ // 'blur' isn't getting fired
160
+ }
161
+
162
162
  fieldOnChange() {
163
- if (this.formGroup$.controls[this.controlName$].value) {
164
- const actionsApi = this.pConn$?.getActionsApi();
165
- const propName = (this.pConn$?.getStateProps() as any).value;
163
+ const oldVal = this.value$ ?? '';
164
+ const newVal = this.formGroup$.controls[this.controlName$].value;
165
+ const isValueChanged = newVal?.toString() !== oldVal.toString();
166
+
167
+ if (isValueChanged && newVal) {
166
168
  const value = this.formGroup$.controls[this.controlName$].value;
167
- const eventObj = {
168
- target: {
169
- value
170
- }
171
- };
172
- this.afterBlur = true;
173
- this.angularPConnectData.actions?.onChange(this, eventObj);
174
- handleEvent(actionsApi, 'blur', propName, value);
169
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
175
170
  }
176
171
  }
177
172
 
178
- fieldOnBlur(event: any) {
179
- // PConnect wants to use eventHandler for onBlur
180
- this.angularPConnectData.actions?.onBlur(this, event);
181
- }
182
-
183
173
  getErrorMessage() {
184
174
  let errMessage = '';
185
175
 
@@ -8,11 +8,8 @@
8
8
  <ng-template #noDisplayMode>
9
9
  <div [formGroup]="formGroup$" *ngIf="bVisible$">
10
10
  <mat-form-field class="psdk-radio-form" subscriptSizing="dynamic" [hintLabel]="helperText">
11
- <span class="psdk-label-wrapper-readonly">
12
- <label class="psdk-label-readonly">{{ label$ }}</label>
13
- </span>
14
- <!-- <mat-label>{{label$}}</mat-label> -->
15
- <input matInput [placeholder]="placeholder" style="display: none" />
11
+ <mat-label>{{ label$ }}</mat-label>
12
+ <input matInput [placeholder]="placeholder" style="display: none" [required]="bRequired$" />
16
13
  <mat-radio-group
17
14
  [value]="value$"
18
15
  [required]="bRequired$"
@@ -24,7 +21,7 @@
24
21
  <mat-radio-button
25
22
  *ngFor="let opt of options$"
26
23
  [checked]="isSelected(opt.key)"
27
- [disabled]="bReadonly$"
24
+ [disabled]="bDisabled$ || bReadonly$"
28
25
  [value]="opt.key"
29
26
  class="psdk-radio-button"
30
27
  >
@@ -9,6 +9,7 @@ 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 { PConnFieldProps } from '@pega/angular-sdk-components';
12
+ import { handleEvent } from '@pega/angular-sdk-components';
12
13
 
13
14
  interface IOption {
14
15
  key: string;
@@ -60,6 +61,8 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
60
61
  localeName = '';
61
62
  localePath = '';
62
63
  localizedValue = '';
64
+ actionsApi: Object;
65
+ propName: string;
63
66
 
64
67
  constructor(
65
68
  private angularPConnect: AngularPConnectService,
@@ -164,13 +167,15 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
164
167
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
165
168
  }
166
169
 
167
- this.componentReference = (this.pConn$.getStateProps() as any).value;
170
+ this.componentReference = this.pConn$.getStateProps().value;
168
171
 
169
172
  this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject());
170
173
 
171
- const propName = (this.pConn$.getStateProps() as any).value;
174
+ this.actionsApi = this.pConn$.getActionsApi();
175
+ this.propName = this.pConn$.getStateProps().value;
176
+
172
177
  const className = this.pConn$.getCaseInfo().getClassName();
173
- const refName = propName?.slice(propName.lastIndexOf('.') + 1);
178
+ const refName = this.propName?.slice(this.propName.lastIndexOf('.') + 1);
174
179
 
175
180
  this.fieldMetadata = this.configProps$.fieldMetadata;
176
181
  const metaData = Array.isArray(this.fieldMetadata) ? this.fieldMetadata.filter(field => field?.classID === className)[0] : this.fieldMetadata;
@@ -203,12 +208,7 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
203
208
  }
204
209
 
205
210
  fieldOnChange(event: any) {
206
- this.angularPConnectData.actions?.onChange(this, event);
207
- }
208
-
209
- fieldOnBlur(event: any) {
210
- // PConnect wants to use eventHandler for onBlur
211
- this.angularPConnectData.actions?.onBlur(this, event);
211
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
212
212
  }
213
213
 
214
214
  getLocalizedOptionValue(opt: IOption) {
@@ -40,6 +40,8 @@ export class RichTextComponent implements OnInit, OnDestroy {
40
40
  info: any;
41
41
  error: boolean;
42
42
  status: any;
43
+ actionsApi: Object;
44
+ propName: string;
43
45
 
44
46
  constructor(
45
47
  private angularPConnect: AngularPConnectService,
@@ -80,7 +82,7 @@ export class RichTextComponent implements OnInit, OnDestroy {
80
82
  updateSelf(): void {
81
83
  // moved this from ngOnInit() and call this from there instead...
82
84
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as RichTextProps;
83
- const stateProps: any = this.pConn$.getStateProps();
85
+ const stateProps = this.pConn$.getStateProps();
84
86
  this.status = stateProps?.status;
85
87
 
86
88
  if (this.configProps$.value != undefined) {
@@ -94,6 +96,9 @@ export class RichTextComponent implements OnInit, OnDestroy {
94
96
  this.info = stateProps?.validatemessage || this.configProps$.helperText;
95
97
  this.error = stateProps?.status === 'error';
96
98
 
99
+ this.actionsApi = this.pConn$.getActionsApi();
100
+ this.propName = this.pConn$.getStateProps().value;
101
+
97
102
  if (this.configProps$.required != null) {
98
103
  this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
99
104
  }
@@ -111,9 +116,13 @@ export class RichTextComponent implements OnInit, OnDestroy {
111
116
  }
112
117
  }
113
118
 
114
- fieldOnChange() {
115
- if (this.status === 'error') {
116
- const property = (this.pConn$.getStateProps() as any).value;
119
+ fieldOnChange(editorValue: any) {
120
+ const oldVal = this.value$ ?? '';
121
+ const newVal = editorValue?.editor?.getBody()?.innerHTML ?? '';
122
+ const isValueChanged = newVal.toString() !== oldVal.toString();
123
+
124
+ if (isValueChanged || this.status === 'error') {
125
+ const property = this.propName;
117
126
  this.pConn$.clearErrorMessages({
118
127
  property,
119
128
  category: '',
@@ -123,9 +132,11 @@ export class RichTextComponent implements OnInit, OnDestroy {
123
132
  }
124
133
 
125
134
  fieldOnBlur(editorValue: any) {
126
- // PConnect wants to use eventHandler for onBlur
127
- const actionsApi = this.pConn$?.getActionsApi();
128
- const propName = (this.pConn$?.getStateProps() as any).value;
129
- handleEvent(actionsApi, 'changeNblur', propName, editorValue);
135
+ const oldVal = this.value$ ?? '';
136
+ const isValueChanged = editorValue.toString() !== oldVal.toString();
137
+
138
+ if (isValueChanged) {
139
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, editorValue);
140
+ }
130
141
  }
131
142
  }
@@ -101,20 +101,19 @@ export class ScalarListComponent implements OnInit, OnDestroy {
101
101
  {
102
102
  type: componentType,
103
103
  config: {
104
- // @ts-ignore - Object literal may only specify known properties, and 'value' does not exist in type 'ComponentMetadataConfig'.
105
104
  value: scalarValue,
106
- displayMode: 'LABELS_LEFT',
105
+ displayMode: 'DISPLAY_ONLY',
107
106
  label: this.label$,
108
107
  ...restProps,
109
108
  readOnly: true
110
109
  }
111
110
  },
112
111
  '',
113
- '',
112
+ 0,
114
113
  {}
115
114
  ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
116
115
  });
117
- this.isDisplayModeEnabled = ['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(this.displayMode$ as string);
116
+ this.isDisplayModeEnabled = ['STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(this.displayMode$ as string);
118
117
  this.value$ = this.items;
119
118
  }
120
119
  }