@pega/angular-sdk-overrides 23.1.10 → 24.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/lib/designSystemExtension/alert-banner/alert-banner.component.ts +1 -1
  2. package/lib/designSystemExtension/case-create-stage/case-create-stage.component.ts +1 -1
  3. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +7 -4
  4. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +2 -1
  5. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +3 -1
  6. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +1 -1
  7. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +4 -1
  8. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.html +1 -1
  9. package/lib/designSystemExtension/operator/operator.component.ts +11 -6
  10. package/lib/designSystemExtension/pulse/pulse.component.ts +7 -7
  11. package/lib/field/auto-complete/auto-complete.component.ts +17 -14
  12. package/lib/field/cancel-alert/cancel-alert.component.ts +0 -2
  13. package/lib/field/check-box/check-box.component.html +16 -15
  14. package/lib/field/check-box/check-box.component.scss +14 -1
  15. package/lib/field/check-box/check-box.component.ts +128 -45
  16. package/lib/field/currency/currency.component.html +16 -7
  17. package/lib/field/currency/currency.component.ts +55 -20
  18. package/lib/field/date/date.component.html +1 -6
  19. package/lib/field/date/date.component.ts +22 -39
  20. package/lib/field/date-time/date-time.component.html +6 -7
  21. package/lib/field/date-time/date-time.component.ts +28 -45
  22. package/lib/field/decimal/decimal.component.html +14 -4
  23. package/lib/field/decimal/decimal.component.ts +47 -7
  24. package/lib/field/dropdown/dropdown.component.ts +132 -21
  25. package/lib/field/email/email.component.ts +14 -4
  26. package/lib/field/group/group.component.html +1 -1
  27. package/lib/field/group/group.component.ts +6 -2
  28. package/lib/field/integer/integer.component.html +1 -1
  29. package/lib/field/integer/integer.component.ts +13 -5
  30. package/lib/field/multiselect/multiselect.component.html +33 -0
  31. package/lib/field/multiselect/multiselect.component.scss +7 -0
  32. package/lib/field/multiselect/multiselect.component.spec.ts +21 -0
  33. package/lib/field/multiselect/multiselect.component.ts +369 -0
  34. package/lib/field/multiselect/utils.ts +209 -0
  35. package/lib/field/percentage/percentage.component.html +17 -6
  36. package/lib/field/percentage/percentage.component.ts +51 -12
  37. package/lib/field/phone/phone.component.html +1 -1
  38. package/lib/field/phone/phone.component.ts +11 -14
  39. package/lib/field/radio-buttons/radio-buttons.component.ts +9 -12
  40. package/lib/field/rich-text/config-ext.json +10 -0
  41. package/lib/field/rich-text/rich-text.component.html +1 -1
  42. package/lib/field/rich-text/rich-text.component.ts +8 -6
  43. package/lib/field/scalar-list/scalar-list.component.ts +4 -4
  44. package/lib/field/text/text.component.ts +2 -0
  45. package/lib/field/text-area/text-area.component.html +2 -1
  46. package/lib/field/text-area/text-area.component.ts +13 -8
  47. package/lib/field/text-input/text-input.component.html +1 -1
  48. package/lib/field/text-input/text-input.component.ts +13 -5
  49. package/lib/field/time/time.component.html +3 -2
  50. package/lib/field/time/time.component.ts +23 -7
  51. package/lib/field/url/url.component.html +2 -1
  52. package/lib/field/url/url.component.ts +15 -5
  53. package/lib/field/user-reference/user-reference.component.html +42 -45
  54. package/lib/field/user-reference/user-reference.component.ts +73 -27
  55. package/lib/infra/Containers/base-components/flow-container-base.component.ts +22 -0
  56. package/lib/infra/Containers/base-components/helper.ts +89 -0
  57. package/lib/infra/Containers/flow-container/flow-container.component.html +9 -4
  58. package/lib/infra/Containers/flow-container/flow-container.component.ts +38 -33
  59. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +41 -9
  60. package/lib/infra/Containers/preview-view-container/preview-view-container.component.ts +1 -1
  61. package/lib/infra/Containers/view-container/helper.ts +22 -0
  62. package/lib/infra/Containers/view-container/view-container.component.ts +5 -18
  63. package/lib/infra/assignment/assignment.component.ts +37 -39
  64. package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
  65. package/lib/infra/defer-load/defer-load.component.ts +9 -12
  66. package/lib/infra/multi-step/multi-step.component.html +1 -1
  67. package/lib/infra/multi-step/multi-step.component.scss +1 -0
  68. package/lib/infra/navbar/navbar.component.html +4 -4
  69. package/lib/infra/navbar/navbar.component.ts +9 -6
  70. package/lib/infra/root-container/root-container.component.ts +3 -3
  71. package/lib/infra/stages/stages.component.scss +2 -2
  72. package/lib/infra/view/view.component.html +7 -20
  73. package/lib/infra/view/view.component.ts +21 -3
  74. package/lib/template/app-shell/app-shell.component.ts +20 -2
  75. package/lib/template/banner-page/config-ext.json +9 -0
  76. package/lib/template/base/details-template-base.ts +67 -0
  77. package/lib/template/base/form-template-base.ts +10 -0
  78. package/lib/template/case-summary/case-summary.component.ts +38 -4
  79. package/lib/template/case-view/case-view.component.html +7 -7
  80. package/lib/template/case-view/case-view.component.scss +2 -0
  81. package/lib/template/case-view/case-view.component.ts +8 -19
  82. package/lib/template/confirmation/confirmation.component.ts +1 -1
  83. package/lib/template/data-reference/data-reference.component.ts +37 -43
  84. package/lib/template/default-form/default-form.component.html +0 -4
  85. package/lib/template/default-form/default-form.component.ts +7 -23
  86. package/lib/template/details/details.component.ts +7 -41
  87. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +6 -39
  88. package/lib/template/details-one-column/details-one-column.component.ts +7 -42
  89. package/lib/template/details-sub-tabs/details-sub-tabs.component.html +1 -2
  90. package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +5 -37
  91. package/lib/template/details-three-column/details-three-column.component.ts +7 -43
  92. package/lib/template/details-two-column/details-two-column.component.ts +8 -44
  93. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +7 -42
  94. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +3 -0
  95. package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +8 -4
  96. package/lib/template/field-group-template/field-group-template.component.ts +4 -14
  97. package/lib/template/field-value-list/field-value-list.component.html +8 -3
  98. package/lib/template/field-value-list/field-value-list.component.scss +2 -1
  99. package/lib/template/field-value-list/field-value-list.component.ts +1 -0
  100. package/lib/template/inline-dashboard-page/config-ext.json +9 -0
  101. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -2
  102. package/lib/template/list-view/list-view.component.html +9 -6
  103. package/lib/template/list-view/list-view.component.scss +11 -0
  104. package/lib/template/list-view/list-view.component.ts +60 -32
  105. package/lib/template/list-view/listViewHelpers.ts +1 -2
  106. package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +1 -1
  107. package/lib/template/one-column/one-column.component.ts +4 -3
  108. package/lib/template/one-column-tab/one-column-tab.component.ts +1 -1
  109. package/lib/template/page/page.component.ts +1 -1
  110. package/lib/template/promoted-filters/promoted-filters.component.ts +1 -1
  111. package/lib/template/repeating-structures/repeating-structures.component.ts +2 -3
  112. package/lib/template/simple-table/simple-table.component.ts +0 -2
  113. package/lib/template/simple-table-manual/helpers.ts +2 -2
  114. package/lib/template/simple-table-manual/simple-table-manual.component.html +1 -1
  115. package/lib/template/simple-table-manual/simple-table-manual.component.scss +1 -0
  116. package/lib/template/simple-table-manual/simple-table-manual.component.ts +60 -28
  117. package/lib/template/simple-table-select/simple-table-select.component.ts +5 -7
  118. package/lib/template/three-column/three-column.component.ts +4 -3
  119. package/lib/template/two-column/two-column.component.ts +4 -3
  120. package/lib/template/two-column-tab/two-column-tab.component.ts +1 -1
  121. package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +4 -3
  122. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +1 -1
  123. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +1 -1
  124. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +5 -4
  125. package/lib/widget/attachment/attachment.component.html +50 -26
  126. package/lib/widget/attachment/attachment.component.scss +118 -0
  127. package/lib/widget/attachment/attachment.component.ts +256 -503
  128. package/lib/widget/case-history/case-history.component.ts +1 -2
  129. package/lib/widget/feed-container/feed-container.component.ts +7 -11
  130. package/lib/widget/file-utility/file-utility.component.html +2 -2
  131. package/lib/widget/file-utility/file-utility.component.ts +15 -22
  132. package/lib/widget/list-utility/list-utility.component.html +1 -1
  133. package/lib/widget/quick-create/config-ext.json +9 -0
  134. package/lib/widget/quick-create/quick-create.component.ts +1 -1
  135. package/lib/widget/todo/todo.component.html +8 -7
  136. package/lib/widget/todo/todo.component.ts +97 -86
  137. package/package.json +1 -1
@@ -4,12 +4,19 @@ import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
6
  import { interval } from 'rxjs';
7
+ import { NgxCurrencyDirective, NgxCurrencyInputMode } from 'ngx-currency';
7
8
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
8
9
  import { Utils } from '@pega/angular-sdk-components';
9
10
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
+ import { handleEvent } from '@pega/angular-sdk-components';
12
+ import { getCurrencyCharacters } from '@pega/angular-sdk-components';
10
13
  import { PConnFieldProps } from '@pega/angular-sdk-components';
14
+ import { format } from '@pega/angular-sdk-components';
11
15
 
12
16
  interface PercentageProps extends PConnFieldProps {
17
+ showGroupSeparators?: string;
18
+ decimalPrecision?: number;
19
+ currencyISOCode?: string;
13
20
  // If any, enter additional props that only exist on Percentage here
14
21
  }
15
22
 
@@ -18,7 +25,7 @@ interface PercentageProps extends PConnFieldProps {
18
25
  templateUrl: './percentage.component.html',
19
26
  styleUrls: ['./percentage.component.scss'],
20
27
  standalone: true,
21
- imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)]
28
+ imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, NgxCurrencyDirective, forwardRef(() => ComponentMapperComponent)]
22
29
  })
23
30
  export class PercentageComponent implements OnInit, OnDestroy {
24
31
  @Input() pConn$: typeof PConnect;
@@ -41,8 +48,14 @@ export class PercentageComponent implements OnInit, OnDestroy {
41
48
  testId: string;
42
49
  helperText: string;
43
50
  placeholder: string;
44
-
51
+ decimalSeparator: string;
52
+ thousandSeparator: string;
53
+ inputMode: any;
54
+ decimalPrecision: number | undefined;
45
55
  fieldControl = new FormControl<number | null>(null, null);
56
+ actionsApi: Object;
57
+ propName: string;
58
+ formattedValue: string;
46
59
 
47
60
  constructor(
48
61
  private angularPConnect: AngularPConnectService,
@@ -104,15 +117,26 @@ export class PercentageComponent implements OnInit, OnDestroy {
104
117
  this.testId = this.configProps$.testId;
105
118
  this.label$ = this.configProps$.label;
106
119
  this.displayMode$ = this.configProps$.displayMode;
107
- let nValue: any = this.configProps$.value;
120
+ this.inputMode = NgxCurrencyInputMode.Natural;
121
+ const nValue: any = this.configProps$.value;
108
122
  if (nValue) {
109
- if (typeof nValue === 'string') {
110
- nValue = parseInt(nValue, 10);
111
- }
112
123
  this.value$ = nValue;
124
+ this.fieldControl.setValue(nValue);
113
125
  }
114
126
  this.helperText = this.configProps$.helperText;
115
127
  this.placeholder = this.configProps$.placeholder || '';
128
+ const showGroupSeparators = this.configProps$.showGroupSeparators;
129
+
130
+ const theSymbols = getCurrencyCharacters('');
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
+ }
116
140
 
117
141
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
118
142
  setTimeout(() => {
@@ -141,7 +165,9 @@ export class PercentageComponent implements OnInit, OnDestroy {
141
165
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
142
166
  }
143
167
 
144
- this.componentReference = (this.pConn$.getStateProps() as any).value;
168
+ this.decimalPrecision = this.configProps$?.decimalPrecision ?? 2;
169
+
170
+ this.componentReference = this.pConn$.getStateProps().value;
145
171
 
146
172
  // trigger display of error message with field control
147
173
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -153,14 +179,27 @@ export class PercentageComponent implements OnInit, OnDestroy {
153
179
  }
154
180
  }
155
181
 
156
- fieldOnChange(event: any) {
157
- this.angularPConnectData.actions?.onChange(this, event);
182
+ fieldOnChange() {
183
+ this.pConn$.clearErrorMessages({
184
+ property: this.propName
185
+ });
158
186
  }
159
187
 
160
188
  fieldOnBlur(event: any) {
161
- // PConnect wants to use eventHandler for onBlur
162
-
163
- this.angularPConnectData.actions?.onBlur(this, event);
189
+ let value = event?.target?.value;
190
+ value = value ? value.replace(/%/g, '') : '';
191
+ // replacing thousand separator with empty string as not required in api call
192
+ if (this.configProps$.showGroupSeparators) {
193
+ const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
194
+ const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
195
+ value = value?.replace(regExp, '');
196
+ }
197
+ // replacing decimal separator with '.'
198
+ if (this.decimalSeparator !== '.') {
199
+ const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
200
+ value = value.replace(regExp, '.');
201
+ }
202
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
164
203
  }
165
204
 
166
205
  getErrorMessage() {
@@ -12,7 +12,7 @@
12
12
  [enablePlaceholder]="true"
13
13
  [enableSearch]="true"
14
14
  (change)="fieldOnChange()"
15
- (blur)="fieldOnBlur($event)"
15
+ (blur)="fieldOnBlur()"
16
16
  >
17
17
  </ngx-mat-intl-tel-input>
18
18
  <mat-label>{{ label$ }}</mat-label>
@@ -50,6 +50,9 @@ export class PhoneComponent implements OnInit, OnDestroy {
50
50
  phone: new FormControl<string | null>(null)
51
51
  });
52
52
 
53
+ actionsApi: Object;
54
+ propName: string;
55
+
53
56
  constructor(
54
57
  private angularPConnect: AngularPConnectService,
55
58
  private cdRef: ChangeDetectorRef,
@@ -117,6 +120,9 @@ export class PhoneComponent implements OnInit, OnDestroy {
117
120
  }
118
121
  this.helperText = this.configProps$.helperText;
119
122
 
123
+ this.actionsApi = this.pConn$.getActionsApi();
124
+ this.propName = this.pConn$.getStateProps().value;
125
+
120
126
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
121
127
  setTimeout(() => {
122
128
  if (this.configProps$.required != null) {
@@ -159,27 +165,18 @@ export class PhoneComponent implements OnInit, OnDestroy {
159
165
  }
160
166
  }
161
167
 
168
+ fieldOnBlur() {
169
+ // 'blur' isn't getting fired
170
+ }
171
+
162
172
  fieldOnChange() {
163
173
  if (this.formGroup$.controls[this.controlName$].value) {
164
- const actionsApi = this.pConn$?.getActionsApi();
165
- const propName = (this.pConn$?.getStateProps() as any).value;
166
174
  const value = this.formGroup$.controls[this.controlName$].value;
167
- const eventObj = {
168
- target: {
169
- value
170
- }
171
- };
172
175
  this.afterBlur = true;
173
- this.angularPConnectData.actions?.onChange(this, eventObj);
174
- handleEvent(actionsApi, 'blur', propName, value);
176
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
175
177
  }
176
178
  }
177
179
 
178
- fieldOnBlur(event: any) {
179
- // PConnect wants to use eventHandler for onBlur
180
- this.angularPConnectData.actions?.onBlur(this, event);
181
- }
182
-
183
180
  getErrorMessage() {
184
181
  let errMessage = '';
185
182
 
@@ -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,14 +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
- // @ts-ignore - parameter “contextName” for getDataObject method should be optional
170
172
  this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject());
171
173
 
172
- const propName = (this.pConn$.getStateProps() as any).value;
174
+ this.actionsApi = this.pConn$.getActionsApi();
175
+ this.propName = this.pConn$.getStateProps().value;
176
+
173
177
  const className = this.pConn$.getCaseInfo().getClassName();
174
- const refName = propName?.slice(propName.lastIndexOf('.') + 1);
178
+ const refName = this.propName?.slice(this.propName.lastIndexOf('.') + 1);
175
179
 
176
180
  this.fieldMetadata = this.configProps$.fieldMetadata;
177
181
  const metaData = Array.isArray(this.fieldMetadata) ? this.fieldMetadata.filter(field => field?.classID === className)[0] : this.fieldMetadata;
@@ -186,7 +190,6 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
186
190
  this.localizedValue = this.pConn$.getLocalizedValue(
187
191
  this.value$,
188
192
  this.localePath,
189
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
190
193
  this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
191
194
  );
192
195
  // trigger display of error message with field control
@@ -205,19 +208,13 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
205
208
  }
206
209
 
207
210
  fieldOnChange(event: any) {
208
- this.angularPConnectData.actions?.onChange(this, event);
209
- }
210
-
211
- fieldOnBlur(event: any) {
212
- // PConnect wants to use eventHandler for onBlur
213
- this.angularPConnectData.actions?.onBlur(this, event);
211
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
214
212
  }
215
213
 
216
214
  getLocalizedOptionValue(opt: IOption) {
217
215
  return this.pConn$.getLocalizedValue(
218
216
  opt.value,
219
217
  this.localePath,
220
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
221
218
  this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
222
219
  );
223
220
  }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "RichText",
3
+ "label": "Rich text editor",
4
+ "description": "Text (paragraph)",
5
+ "type": "Field",
6
+ "subtype": "Text-Paragraph",
7
+ "icon": "images/pz-text-area-active.svg",
8
+ "properties": [],
9
+ "defaultConfig": {}
10
+ }
@@ -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$, displayMode$, isHtml$: true }"></component-mapper>
3
3
  </div>
4
4
  <ng-template #noDisplayMode>
5
5
  <div *ngIf="!bReadonly$; else noEdit">
@@ -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
  }
@@ -113,7 +118,7 @@ export class RichTextComponent implements OnInit, OnDestroy {
113
118
 
114
119
  fieldOnChange() {
115
120
  if (this.status === 'error') {
116
- const property = (this.pConn$.getStateProps() as any).value;
121
+ const property = this.propName;
117
122
  this.pConn$.clearErrorMessages({
118
123
  property,
119
124
  category: '',
@@ -123,9 +128,6 @@ export class RichTextComponent implements OnInit, OnDestroy {
123
128
  }
124
129
 
125
130
  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);
131
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, editorValue);
130
132
  }
131
133
  }
@@ -102,18 +102,18 @@ export class ScalarListComponent implements OnInit, OnDestroy {
102
102
  type: componentType,
103
103
  config: {
104
104
  value: scalarValue,
105
- displayMode: 'LABELS_LEFT',
105
+ displayMode: 'DISPLAY_ONLY',
106
106
  label: this.label$,
107
107
  ...restProps,
108
- readOnly: 'true'
108
+ readOnly: true
109
109
  }
110
110
  },
111
111
  '',
112
- '',
112
+ 0,
113
113
  {}
114
114
  ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
115
115
  });
116
- 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);
117
117
  this.value$ = this.items;
118
118
  }
119
119
  }
@@ -1,5 +1,6 @@
1
1
  import { Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
+ import { FormGroup } from '@angular/forms';
3
4
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
4
5
  import { Utils } from '@pega/angular-sdk-components';
5
6
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
@@ -18,6 +19,7 @@ interface TextProps extends PConnFieldProps {
18
19
  })
19
20
  export class TextComponent implements OnInit, OnDestroy {
20
21
  @Input() pConn$: typeof PConnect;
22
+ @Input() formGroup$: FormGroup;
21
23
  @Input() formatAs$: string;
22
24
 
23
25
  // Used with AngularPConnect
@@ -16,7 +16,8 @@
16
16
  [required]="bRequired$"
17
17
  [disabled]="bDisabled$"
18
18
  [formControl]="fieldControl"
19
- (change)="fieldOnChange($event)"
19
+ (change)="fieldOnChange()"
20
+ (blur)="fieldOnBlur($event)"
20
21
  ></textarea>
21
22
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
22
23
  </mat-form-field>
@@ -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 TextAreaProps extends PConnFieldProps {
13
14
  // If any, enter additional props that only exist on TextArea here
@@ -44,6 +45,8 @@ export class TextAreaComponent implements OnInit, OnDestroy {
44
45
  helperText: string;
45
46
 
46
47
  fieldControl = new FormControl('', null);
48
+ actionsApi: Object;
49
+ propName: string;
47
50
 
48
51
  constructor(
49
52
  private angularPConnect: AngularPConnectService,
@@ -107,14 +110,15 @@ export class TextAreaComponent implements OnInit, OnDestroy {
107
110
  if (this.configProps$.value != undefined) {
108
111
  this.value$ = this.configProps$.value;
109
112
  }
110
- // @ts-ignore - Property 'getFieldMetadata' is private and only accessible within class 'C11nEnv'.
111
- // @ts-ignore - Property 'getRawConfigProps' is private and only accessible within class 'C11nEnv'
112
113
  this.nMaxLength$ = this.pConn$.getFieldMetadata(this.pConn$.getRawConfigProps()?.value)?.maxLength || 100;
113
114
  this.testId = this.configProps$.testId;
114
115
  this.displayMode$ = this.configProps$.displayMode;
115
116
  this.label$ = this.configProps$.label;
116
117
  this.helperText = this.configProps$.helperText;
117
118
 
119
+ this.actionsApi = this.pConn$.getActionsApi();
120
+ this.propName = this.pConn$.getStateProps().value;
121
+
118
122
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
119
123
  setTimeout(() => {
120
124
  if (this.configProps$.required != null) {
@@ -142,7 +146,7 @@ export class TextAreaComponent implements OnInit, OnDestroy {
142
146
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
143
147
  }
144
148
 
145
- this.componentReference = (this.pConn$.getStateProps() as any).value;
149
+ this.componentReference = this.pConn$.getStateProps().value;
146
150
 
147
151
  // trigger display of error message with field control
148
152
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -155,14 +159,15 @@ export class TextAreaComponent implements OnInit, OnDestroy {
155
159
  }
156
160
  }
157
161
 
158
- fieldOnChange(event: any) {
159
- // PConnect wants to use changeHandler for onChange
160
- this.angularPConnectData.actions?.onChange(this, event);
162
+ fieldOnChange() {
163
+ this.pConn$.clearErrorMessages({
164
+ property: this.propName
165
+ });
161
166
  }
162
167
 
163
168
  fieldOnBlur(event: any) {
164
- // PConnect wants to use eventHandler for onBlur
165
- this.angularPConnectData.actions?.onBlur(this, event);
169
+ const value = event?.target?.value;
170
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
166
171
  }
167
172
 
168
173
  getErrorMessage() {
@@ -14,7 +14,7 @@
14
14
  [required]="bRequired$"
15
15
  [attr.data-test-id]="testId"
16
16
  [formControl]="fieldControl"
17
- (change)="fieldOnChange($event)"
17
+ (change)="fieldOnChange()"
18
18
  (blur)="fieldOnBlur($event)"
19
19
  />
20
20
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
@@ -8,6 +8,7 @@ import { AngularPConnectService, AngularPConnectData } 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 TextInputProps extends PConnFieldProps {
13
14
  // If any, enter additional props that only exist on TextInput here
@@ -44,6 +45,8 @@ export class TextInputComponent implements OnInit, OnDestroy {
44
45
  placeholder: string;
45
46
 
46
47
  fieldControl = new FormControl('', null);
48
+ actionsApi: Object;
49
+ propName: string;
47
50
 
48
51
  constructor(
49
52
  private angularPConnect: AngularPConnectService,
@@ -113,7 +116,10 @@ export class TextInputComponent implements OnInit, OnDestroy {
113
116
  this.label$ = this.configProps$.label;
114
117
  this.displayMode$ = this.configProps$.displayMode;
115
118
 
116
- this.componentReference = (this.pConn$.getStateProps() as any).value;
119
+ this.componentReference = this.pConn$.getStateProps().value;
120
+
121
+ this.actionsApi = this.pConn$.getActionsApi();
122
+ this.propName = this.pConn$.getStateProps().value;
117
123
 
118
124
  if (this.configProps$.visibility != null) {
119
125
  this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
@@ -155,13 +161,15 @@ export class TextInputComponent implements OnInit, OnDestroy {
155
161
  }
156
162
  }
157
163
 
158
- fieldOnChange(event: any) {
159
- this.angularPConnectData.actions?.onChange(this, event);
164
+ fieldOnChange() {
165
+ this.pConn$.clearErrorMessages({
166
+ property: this.propName
167
+ });
160
168
  }
161
169
 
162
170
  fieldOnBlur(event: any) {
163
- // PConnect wants to use eventHandler for onBlur
164
- this.angularPConnectData.actions?.onBlur(this, event);
171
+ const value = event?.target?.value;
172
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
165
173
  }
166
174
 
167
175
  getErrorMessage() {
@@ -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,8 +12,9 @@
12
12
  type="time"
13
13
  [value]="value$"
14
14
  [required]="bRequired$"
15
+ [attr.data-test-id]="testId"
15
16
  [formControl]="fieldControl"
16
- (change)="fieldOnChange($event)"
17
+ (change)="fieldOnChange()"
17
18
  (blur)="fieldOnBlur($event)"
18
19
  />
19
20
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
@@ -8,6 +8,8 @@ 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';
12
+ import { format } from '@pega/angular-sdk-components';
11
13
 
12
14
  interface TimeProps extends PConnFieldProps {
13
15
  // If any, enter additional props that only exist on Time here
@@ -36,12 +38,16 @@ export class TimeComponent implements OnInit, OnDestroy {
36
38
  bVisible$ = true;
37
39
  displayMode$?: string = '';
38
40
  controlName$: string;
41
+ testId = '';
39
42
  bHasForm$ = true;
40
43
  componentReference = '';
41
44
  helperText: string;
42
45
  placeholder: string;
43
46
 
44
47
  fieldControl = new FormControl('', null);
48
+ actionsApi: Object;
49
+ propName: string;
50
+ formattedValue$: any;
45
51
 
46
52
  constructor(
47
53
  private angularPConnect: AngularPConnectService,
@@ -100,6 +106,7 @@ export class TimeComponent implements OnInit, OnDestroy {
100
106
  // moved this from ngOnInit() and call this from there instead...
101
107
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as TimeProps;
102
108
 
109
+ this.testId = this.configProps$.testId;
103
110
  this.label$ = this.configProps$.label;
104
111
  this.displayMode$ = this.configProps$.displayMode;
105
112
 
@@ -109,6 +116,9 @@ export class TimeComponent implements OnInit, OnDestroy {
109
116
  this.helperText = this.configProps$.helperText;
110
117
  this.placeholder = this.configProps$.placeholder || '';
111
118
 
119
+ this.actionsApi = this.pConn$.getActionsApi();
120
+ this.propName = this.pConn$.getStateProps().value;
121
+
112
122
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
113
123
  setTimeout(() => {
114
124
  if (this.configProps$.required != null) {
@@ -117,6 +127,12 @@ export class TimeComponent implements OnInit, OnDestroy {
117
127
  this.cdRef.detectChanges();
118
128
  });
119
129
 
130
+ if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
131
+ this.formattedValue$ = format(this.value$, 'timeonly', {
132
+ format: 'hh:mm A'
133
+ });
134
+ }
135
+
120
136
  if (this.configProps$.visibility != null) {
121
137
  this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
122
138
  }
@@ -136,7 +152,7 @@ export class TimeComponent implements OnInit, OnDestroy {
136
152
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
137
153
  }
138
154
 
139
- this.componentReference = (this.pConn$.getStateProps() as any).value;
155
+ this.componentReference = this.pConn$.getStateProps().value;
140
156
 
141
157
  // trigger display of error message with field control
142
158
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -149,15 +165,15 @@ export class TimeComponent implements OnInit, OnDestroy {
149
165
  }
150
166
  }
151
167
 
152
- fieldOnChange(event: any) {
153
- event.value = event.target.value;
154
- this.angularPConnectData.actions?.onChange(this, event);
168
+ fieldOnChange() {
169
+ this.pConn$.clearErrorMessages({
170
+ property: this.propName
171
+ });
155
172
  }
156
173
 
157
174
  fieldOnBlur(event: any) {
158
- // PConnect wants to use eventHandler for onBlur
159
- event.value = event.target.value;
160
- this.angularPConnectData.actions?.onBlur(this, event);
175
+ const value = event?.target?.value;
176
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
161
177
  }
162
178
 
163
179
  getErrorMessage() {
@@ -12,8 +12,9 @@
12
12
  type="url"
13
13
  [value]="value$"
14
14
  [required]="bRequired$"
15
+ [attr.data-test-id]="testId"
15
16
  [formControl]="fieldControl"
16
- (change)="fieldOnChange($event)"
17
+ (change)="fieldOnChange()"
17
18
  (blur)="fieldOnBlur($event)"
18
19
  />
19
20
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>