@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
@@ -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,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
  }
@@ -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
  }
@@ -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
  }
@@ -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,
@@ -113,6 +116,9 @@ export class TextAreaComponent implements OnInit, OnDestroy {
113
116
  this.label$ = this.configProps$.label;
114
117
  this.helperText = this.configProps$.helperText;
115
118
 
119
+ this.actionsApi = this.pConn$.getActionsApi();
120
+ this.propName = this.pConn$.getStateProps().value;
121
+
116
122
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
117
123
  setTimeout(() => {
118
124
  if (this.configProps$.required != null) {
@@ -140,7 +146,7 @@ export class TextAreaComponent implements OnInit, OnDestroy {
140
146
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
141
147
  }
142
148
 
143
- this.componentReference = (this.pConn$.getStateProps() as any).value;
149
+ this.componentReference = this.pConn$.getStateProps().value;
144
150
 
145
151
  // trigger display of error message with field control
146
152
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -153,14 +159,15 @@ export class TextAreaComponent implements OnInit, OnDestroy {
153
159
  }
154
160
  }
155
161
 
156
- fieldOnChange(event: any) {
157
- // PConnect wants to use changeHandler for onChange
158
- this.angularPConnectData.actions?.onChange(this, event);
162
+ fieldOnChange() {
163
+ this.pConn$.clearErrorMessages({
164
+ property: this.propName
165
+ });
159
166
  }
160
167
 
161
168
  fieldOnBlur(event: any) {
162
- // PConnect wants to use eventHandler for onBlur
163
- this.angularPConnectData.actions?.onBlur(this, event);
169
+ const value = event?.target?.value;
170
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
164
171
  }
165
172
 
166
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">
@@ -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,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
@@ -43,6 +45,9 @@ export class TimeComponent implements OnInit, OnDestroy {
43
45
  placeholder: string;
44
46
 
45
47
  fieldControl = new FormControl('', null);
48
+ actionsApi: Object;
49
+ propName: string;
50
+ formattedValue$: any;
46
51
 
47
52
  constructor(
48
53
  private angularPConnect: AngularPConnectService,
@@ -111,6 +116,9 @@ export class TimeComponent implements OnInit, OnDestroy {
111
116
  this.helperText = this.configProps$.helperText;
112
117
  this.placeholder = this.configProps$.placeholder || '';
113
118
 
119
+ this.actionsApi = this.pConn$.getActionsApi();
120
+ this.propName = this.pConn$.getStateProps().value;
121
+
114
122
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
115
123
  setTimeout(() => {
116
124
  if (this.configProps$.required != null) {
@@ -119,6 +127,12 @@ export class TimeComponent implements OnInit, OnDestroy {
119
127
  this.cdRef.detectChanges();
120
128
  });
121
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
+
122
136
  if (this.configProps$.visibility != null) {
123
137
  this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
124
138
  }
@@ -138,7 +152,7 @@ export class TimeComponent implements OnInit, OnDestroy {
138
152
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
139
153
  }
140
154
 
141
- this.componentReference = (this.pConn$.getStateProps() as any).value;
155
+ this.componentReference = this.pConn$.getStateProps().value;
142
156
 
143
157
  // trigger display of error message with field control
144
158
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -151,15 +165,15 @@ export class TimeComponent implements OnInit, OnDestroy {
151
165
  }
152
166
  }
153
167
 
154
- fieldOnChange(event: any) {
155
- event.value = event.target.value;
156
- this.angularPConnectData.actions?.onChange(this, event);
168
+ fieldOnChange() {
169
+ this.pConn$.clearErrorMessages({
170
+ property: this.propName
171
+ });
157
172
  }
158
173
 
159
174
  fieldOnBlur(event: any) {
160
- // PConnect wants to use eventHandler for onBlur
161
- event.value = event.target.value;
162
- this.angularPConnectData.actions?.onBlur(this, event);
175
+ const value = event?.target?.value;
176
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
163
177
  }
164
178
 
165
179
  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 { 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 URLProps extends PConnFieldProps {
13
14
  // If any, enter additional props that only exist on URL here
@@ -43,6 +44,8 @@ export class UrlComponent 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,
@@ -113,6 +116,9 @@ export class UrlComponent implements OnInit, OnDestroy {
113
116
  this.helperText = this.configProps$.helperText;
114
117
  this.placeholder = this.configProps$.placeholder || '';
115
118
 
119
+ this.actionsApi = this.pConn$.getActionsApi();
120
+ this.propName = this.pConn$.getStateProps().value;
121
+
116
122
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
117
123
  setTimeout(() => {
118
124
  if (this.configProps$.required != null) {
@@ -140,7 +146,7 @@ export class UrlComponent implements OnInit, OnDestroy {
140
146
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
141
147
  }
142
148
 
143
- this.componentReference = (this.pConn$.getStateProps() as any).value;
149
+ this.componentReference = this.pConn$.getStateProps().value;
144
150
 
145
151
  // trigger display of error message with field control
146
152
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -153,13 +159,15 @@ export class UrlComponent implements OnInit, OnDestroy {
153
159
  }
154
160
  }
155
161
 
156
- fieldOnChange(event: any) {
157
- this.angularPConnectData.actions?.onChange(this, event);
162
+ fieldOnChange() {
163
+ this.pConn$.clearErrorMessages({
164
+ property: this.propName
165
+ });
158
166
  }
159
167
 
160
168
  fieldOnBlur(event: any) {
161
- // PConnect wants to use eventHandler for onBlur
162
- this.angularPConnectData.actions?.onBlur(this, event);
169
+ const value = event?.target?.value;
170
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
163
171
  }
164
172
 
165
173
  getErrorMessage() {
@@ -8,13 +8,7 @@
8
8
  </div>
9
9
  <div [formGroup]="formGroup$" *ngIf="type === 'dropdown'">
10
10
  <mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
11
- <mat-select
12
- [value]="value$"
13
- [required]="bRequired$"
14
- [formControl]="fieldControl"
15
- [attr.data-test-id]="testId"
16
- (selectionChange)="fieldOnChange($event)"
17
- >
11
+ <mat-select [required]="bRequired$" [formControl]="fieldControl" [attr.data-test-id]="testId" (selectionChange)="fieldOnChange($event)">
18
12
  <mat-option *ngFor="let opt of options$" [value]="opt.key">
19
13
  {{ opt.value }}
20
14
  </mat-option>
@@ -32,14 +26,12 @@
32
26
  matInput
33
27
  [placeholder]="placeholder"
34
28
  [formControl]="fieldControl"
35
- [value]="value$"
36
29
  [required]="bRequired$"
37
30
  [matAutocomplete]="auto"
38
31
  [attr.data-test-id]="testId"
39
- (change)="fieldOnChange($event)"
40
32
  (blur)="fieldOnBlur($event)"
41
33
  />
42
- <mat-autocomplete #auto="matAutocomplete">
34
+ <mat-autocomplete #auto="matAutocomplete" autoActiveFirstOption (optionSelected)="optionChanged($event)">
43
35
  <mat-option *ngFor="let opt of filteredOptions | async" [value]="opt.value">
44
36
  <span>{{ opt.value }}</span>
45
37
  </mat-option>
@@ -11,6 +11,7 @@ import { Utils } from '@pega/angular-sdk-components';
11
11
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
12
12
  import { PConnFieldProps } from '@pega/angular-sdk-components';
13
13
  import { map, Observable, startWith } from 'rxjs';
14
+ import { handleEvent } from '@pega/angular-sdk-components';
14
15
 
15
16
  const OPERATORS_DP = 'D_pyGetOperatorsForCurrentApplication';
16
17
  const DROPDOWN_LIST = 'Drop-down list';
@@ -22,6 +23,7 @@ interface UserReferenceProps extends Omit<PConnFieldProps, 'value'> {
22
23
  value?: any;
23
24
  showAsFormattedText?: boolean;
24
25
  additionalProps?: object;
26
+ onRecordChange?: any;
25
27
  }
26
28
 
27
29
  @Component({
@@ -63,6 +65,9 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
63
65
  filterValue = '';
64
66
 
65
67
  fieldControl = new FormControl('', null);
68
+ actionsApi: Object;
69
+ propName: string;
70
+ onRecordChange: any;
66
71
 
67
72
  constructor(
68
73
  private angularPConnect: AngularPConnectService,
@@ -80,11 +85,11 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
80
85
  if (this.formGroup$) {
81
86
  // add control to formGroup
82
87
  this.formGroup$.addControl(this.controlName$, this.fieldControl);
83
- this.fieldControl.setValue(this.value$);
88
+ this.fieldControl.setValue(this.getValue(this.value$));
84
89
  }
85
90
 
86
91
  this.filteredOptions = this.fieldControl.valueChanges.pipe(
87
- startWith(''),
92
+ startWith(this.getValue(this.value$) || ''),
88
93
  map(value => this._filter(value || ''))
89
94
  );
90
95
  }
@@ -123,6 +128,21 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
123
128
  return this.options$?.filter(option => option.value?.toLowerCase().includes(filterVal));
124
129
  }
125
130
 
131
+ isUserNameAvailable = user => {
132
+ return typeof user === 'object' && user !== null && user.userName;
133
+ };
134
+
135
+ getUserName = user => {
136
+ return user.userName;
137
+ };
138
+
139
+ getValue = user => {
140
+ if (this.displayAs$ === DROPDOWN_LIST) {
141
+ return this.utils.getUserId(user) || this.getUserName(user);
142
+ }
143
+ return this.isUserNameAvailable(user) ? this.getUserName(user) : this.utils.getUserId(user);
144
+ };
145
+
126
146
  async checkAndUpdate() {
127
147
  // Should always check the bridge to see if the component should
128
148
  // update itself (re-render)
@@ -137,6 +157,7 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
137
157
  async updateSelf() {
138
158
  const props = this.pConn$.getConfigProps() as UserReferenceProps;
139
159
  this.testId = props.testId;
160
+ this.onRecordChange = props?.onRecordChange;
140
161
 
141
162
  const { label, displayAs, value, showAsFormattedText, helperText, placeholder, displayMode } = props;
142
163
 
@@ -147,17 +168,18 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
147
168
  this.placeholder = placeholder || '';
148
169
  this.displayMode$ = displayMode;
149
170
 
171
+ this.value$ = this.pConn$.getConfigProps()?.value;
172
+
150
173
  const { readOnly, required } = props;
151
174
  [this.bReadonly$, this.bRequired$] = [readOnly, required].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
152
175
 
153
- const isUserNameAvailable = user => {
154
- return typeof user === 'object' && user !== null && user.userName;
155
- };
176
+ this.actionsApi = this.pConn$.getActionsApi();
177
+ this.propName = this.pConn$.getStateProps().value;
156
178
 
157
179
  this.userID$ = this.utils.getUserId(value);
158
180
 
159
181
  if (this.userID$ && this.bReadonly$ && this.showAsFormattedText$) {
160
- if (isUserNameAvailable(value)) {
182
+ if (this.isUserNameAvailable(value)) {
161
183
  this.userName$ = value.userName;
162
184
  } else {
163
185
  // if same user ref field is referred in view as editable & readonly formatted text
@@ -174,7 +196,7 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
174
196
  dataViewName: OPERATORS_DP
175
197
  };
176
198
  try {
177
- const resp: any = await PCore.getRestClient().invokeRestApi('getListData', { queryPayload } as any, ''); // 3rd arg empty string until typedef marked correctly
199
+ const resp = await PCore.getRestClient().invokeRestApi('getListData', { queryPayload }, ''); // 3rd arg empty string until typedef marked correctly
178
200
  if (resp?.data) {
179
201
  const ddDataSource = resp.data.data.map(listItem => ({
180
202
  key: listItem.pyUserIdentifier,
@@ -195,7 +217,13 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
195
217
  if (event?.target) {
196
218
  this.filterValue = (event.target as HTMLInputElement).value;
197
219
  }
198
- this.angularPConnectData.actions?.onChange(this, event);
220
+ const value = event?.value;
221
+ handleEvent(this.actionsApi, 'change', this.propName, value);
222
+ }
223
+
224
+ optionChanged(event: any) {
225
+ const value = event?.option?.value;
226
+ handleEvent(this.actionsApi, 'change', this.propName, value);
199
227
  }
200
228
 
201
229
  fieldOnBlur(event: any) {
@@ -204,12 +232,12 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
204
232
  const index = this.options$?.findIndex(element => element.value === event.target.value);
205
233
  key = index > -1 ? (key = this.options$[index].key) : event.target.value;
206
234
  }
207
-
208
- const eve = {
209
- value: key
210
- };
211
- // PConnect wants to use eventHandler for onBlur
212
- this.angularPConnectData.actions?.onChange(this, eve);
235
+ const value = key;
236
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
237
+ if (this.onRecordChange) {
238
+ event.target.value = value;
239
+ this.onRecordChange(event);
240
+ }
213
241
  }
214
242
 
215
243
  getErrorMessage() {
@@ -38,7 +38,7 @@
38
38
  </div>
39
39
  </mat-card>
40
40
  </div>
41
- <div *ngIf="bShowBanner && bShowConfirm">
41
+ <div *ngIf="bShowBanner && bShowConfirm && confirm_pconn">
42
42
  <component-mapper name="View" [props]="{ formGroup$, pConn$: confirm_pconn }"></component-mapper>
43
43
  </div>
44
44
  </div>