@pega/angular-sdk-overrides 0.24.9 → 0.25.1

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 (172) hide show
  1. package/lib/designSystemExtension/alert/alert.component.ts +0 -1
  2. package/lib/designSystemExtension/alert-banner/alert-banner.component.ts +1 -2
  3. package/lib/designSystemExtension/banner/banner.component.ts +0 -1
  4. package/lib/designSystemExtension/case-create-stage/case-create-stage.component.ts +1 -2
  5. package/lib/designSystemExtension/field-group/field-group.component.ts +0 -1
  6. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +2 -1
  7. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -2
  8. package/lib/designSystemExtension/material-details/material-details.component.ts +0 -1
  9. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +2 -2
  10. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +10 -2
  11. package/lib/designSystemExtension/material-summary-item/material-summary-item.component.ts +0 -1
  12. package/lib/designSystemExtension/material-summary-list/material-summary-list.component.ts +0 -1
  13. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.ts +0 -1
  14. package/lib/designSystemExtension/operator/operator.component.html +1 -1
  15. package/lib/designSystemExtension/operator/operator.component.scss +10 -2
  16. package/lib/designSystemExtension/operator/operator.component.ts +5 -5
  17. package/lib/designSystemExtension/pulse/pulse.component.ts +7 -8
  18. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.ts +0 -1
  19. package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.ts +0 -1
  20. package/lib/field/auto-complete/auto-complete.component.html +0 -1
  21. package/lib/field/auto-complete/auto-complete.component.ts +31 -16
  22. package/lib/field/cancel-alert/cancel-alert.component.ts +0 -1
  23. package/lib/field/check-box/check-box.component.html +18 -6
  24. package/lib/field/check-box/check-box.component.ts +17 -12
  25. package/lib/field/currency/currency.component.html +4 -4
  26. package/lib/field/currency/currency.component.ts +42 -20
  27. package/lib/field/date/date.component.html +3 -7
  28. package/lib/field/date/date.component.ts +22 -40
  29. package/lib/field/date-time/date-time.component.html +3 -4
  30. package/lib/field/date-time/date-time.component.ts +35 -17
  31. package/lib/field/decimal/decimal.component.html +4 -3
  32. package/lib/field/decimal/decimal.component.ts +47 -22
  33. package/lib/field/dropdown/dropdown.component.html +1 -0
  34. package/lib/field/dropdown/dropdown.component.ts +146 -19
  35. package/lib/field/email/email.component.ts +24 -5
  36. package/lib/field/group/group.component.ts +2 -3
  37. package/lib/field/integer/integer.component.ts +22 -5
  38. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
  39. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +3 -3
  40. package/lib/field/location/config-ext.json +8 -0
  41. package/lib/field/location/location.component.html +45 -0
  42. package/lib/field/location/location.component.scss +18 -0
  43. package/lib/field/location/location.component.spec.ts +22 -0
  44. package/lib/field/location/location.component.ts +385 -0
  45. package/lib/field/multiselect/multiselect.component.ts +17 -10
  46. package/lib/field/percentage/percentage.component.html +3 -3
  47. package/lib/field/percentage/percentage.component.ts +45 -21
  48. package/lib/field/phone/config-ext.json +1 -1
  49. package/lib/field/phone/phone.component.html +9 -6
  50. package/lib/field/phone/phone.component.scss +9 -0
  51. package/lib/field/phone/phone.component.ts +30 -27
  52. package/lib/field/radio-buttons/radio-buttons.component.html +17 -12
  53. package/lib/field/radio-buttons/radio-buttons.component.ts +13 -10
  54. package/lib/field/rich-text/rich-text.component.ts +19 -9
  55. package/lib/field/scalar-list/scalar-list.component.ts +3 -5
  56. package/lib/field/selectable-card/selectable-card.component.html +40 -0
  57. package/lib/field/selectable-card/selectable-card.component.scss +0 -0
  58. package/lib/field/selectable-card/selectable-card.component.spec.ts +22 -0
  59. package/lib/field/selectable-card/selectable-card.component.ts +255 -0
  60. package/lib/field/semantic-link/semantic-link.component.ts +0 -1
  61. package/lib/field/text/text.component.ts +8 -5
  62. package/lib/field/text-area/text-area.component.html +4 -1
  63. package/lib/field/text-area/text-area.component.ts +22 -6
  64. package/lib/field/text-content/text-content.component.ts +0 -1
  65. package/lib/field/text-input/text-input.component.ts +22 -5
  66. package/lib/field/time/time.component.html +2 -2
  67. package/lib/field/time/time.component.ts +35 -7
  68. package/lib/field/url/url.component.ts +22 -5
  69. package/lib/field/user-reference/user-reference.component.html +40 -46
  70. package/lib/field/user-reference/user-reference.component.ts +111 -21
  71. package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
  72. package/lib/infra/Containers/flow-container/flow-container.component.ts +25 -48
  73. package/lib/infra/Containers/flow-container/helpers.ts +2 -2
  74. package/lib/infra/Containers/hybrid-view-container/hybrid-view-container.component.ts +0 -1
  75. package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
  76. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +1 -9
  77. package/lib/infra/Containers/preview-view-container/preview-view-container.component.ts +1 -1
  78. package/lib/infra/Containers/view-container/helper.ts +22 -0
  79. package/lib/infra/Containers/view-container/view-container.component.ts +5 -18
  80. package/lib/infra/action-buttons/action-buttons.component.html +1 -1
  81. package/lib/infra/action-buttons/action-buttons.component.ts +0 -1
  82. package/lib/infra/assignment/assignment.component.html +1 -1
  83. package/lib/infra/assignment/assignment.component.ts +82 -41
  84. package/lib/infra/assignment-card/assignment-card.component.html +1 -0
  85. package/lib/infra/assignment-card/assignment-card.component.ts +0 -1
  86. package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
  87. package/lib/infra/defer-load/defer-load.component.ts +8 -6
  88. package/lib/infra/error-boundary/error-boundary.component.ts +0 -1
  89. package/lib/infra/multi-step/multi-step.component.ts +0 -1
  90. package/lib/infra/navbar/navbar.component.ts +3 -6
  91. package/lib/infra/reference/reference.component.ts +77 -90
  92. package/lib/infra/region/region.component.ts +0 -1
  93. package/lib/infra/root-container/root-container.component.html +2 -15
  94. package/lib/infra/root-container/root-container.component.ts +27 -33
  95. package/lib/infra/stages/stages.component.scss +2 -2
  96. package/lib/infra/stages/stages.component.ts +0 -1
  97. package/lib/infra/view/view.component.html +7 -20
  98. package/lib/infra/view/view.component.ts +20 -3
  99. package/lib/template/app-shell/app-shell.component.ts +20 -3
  100. package/lib/template/banner-page/banner-page.component.ts +0 -1
  101. package/lib/template/base/details-template-base.ts +67 -0
  102. package/lib/template/base/form-template-base.ts +16 -0
  103. package/lib/template/case-summary/case-summary.component.ts +7 -23
  104. package/lib/template/case-view/case-view.component.html +4 -4
  105. package/lib/template/case-view/case-view.component.ts +8 -14
  106. package/lib/template/confirmation/confirmation.component.html +1 -1
  107. package/lib/template/confirmation/confirmation.component.ts +1 -2
  108. package/lib/template/data-reference/data-reference.component.ts +36 -41
  109. package/lib/template/default-form/default-form.component.html +0 -4
  110. package/lib/template/default-form/default-form.component.ts +41 -25
  111. package/lib/template/details/details.component.ts +7 -42
  112. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +6 -40
  113. package/lib/template/details-one-column/details-one-column.component.ts +7 -43
  114. package/lib/template/details-sub-tabs/details-sub-tabs.component.html +1 -2
  115. package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +5 -38
  116. package/lib/template/details-three-column/details-three-column.component.ts +7 -44
  117. package/lib/template/details-two-column/details-two-column.component.ts +8 -45
  118. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +7 -43
  119. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +3 -0
  120. package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +8 -4
  121. package/lib/template/field-group-list/field-group-list.component.ts +0 -1
  122. package/lib/template/field-group-template/field-group-template.component.html +7 -7
  123. package/lib/template/field-group-template/field-group-template.component.scss +8 -0
  124. package/lib/template/field-group-template/field-group-template.component.ts +68 -48
  125. package/lib/template/field-value-list/field-value-list.component.html +2 -2
  126. package/lib/template/field-value-list/field-value-list.component.scss +6 -1
  127. package/lib/template/field-value-list/field-value-list.component.ts +0 -1
  128. package/lib/template/inline-dashboard/inline-dashboard.component.ts +0 -1
  129. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -3
  130. package/lib/template/list-page/list-page.component.ts +0 -1
  131. package/lib/template/list-view/list-view.component.html +6 -1
  132. package/lib/template/list-view/list-view.component.scss +11 -0
  133. package/lib/template/list-view/list-view.component.ts +25 -11
  134. package/lib/template/list-view/listViewHelpers.ts +4 -10
  135. package/lib/template/list-view/utils.ts +2 -5
  136. package/lib/template/multi-reference-readonly/multi-reference-readonly.component.ts +0 -1
  137. package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +1 -2
  138. package/lib/template/one-column/one-column.component.ts +4 -4
  139. package/lib/template/one-column-page/one-column-page.component.ts +0 -1
  140. package/lib/template/one-column-tab/one-column-tab.component.ts +1 -2
  141. package/lib/template/page/page.component.ts +1 -2
  142. package/lib/template/promoted-filters/promoted-filters.component.ts +1 -2
  143. package/lib/template/repeating-structures/repeating-structures.component.ts +1 -2
  144. package/lib/template/simple-table/simple-table.component.ts +0 -1
  145. package/lib/template/simple-table-manual/helpers.ts +126 -10
  146. package/lib/template/simple-table-manual/simple-table-manual.component.html +25 -6
  147. package/lib/template/simple-table-manual/simple-table-manual.component.scss +12 -3
  148. package/lib/template/simple-table-manual/simple-table-manual.component.ts +110 -54
  149. package/lib/template/simple-table-select/simple-table-select.component.ts +3 -4
  150. package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +0 -1
  151. package/lib/template/sub-tabs/sub-tabs.component.ts +0 -1
  152. package/lib/template/three-column/three-column.component.ts +4 -4
  153. package/lib/template/three-column-page/three-column-page.component.ts +0 -1
  154. package/lib/template/two-column/two-column.component.ts +4 -4
  155. package/lib/template/two-column-page/two-column-page.component.ts +0 -1
  156. package/lib/template/two-column-tab/two-column-tab.component.ts +1 -2
  157. package/lib/template/utils.ts +16 -0
  158. package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +4 -4
  159. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +1 -2
  160. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +3 -4
  161. package/lib/widget/app-announcement/app-announcement.component.ts +0 -1
  162. package/lib/widget/attachment/attachment.component.ts +9 -13
  163. package/lib/widget/case-history/case-history.component.ts +0 -1
  164. package/lib/widget/feed-container/feed-container.component.ts +7 -10
  165. package/lib/widget/file-utility/file-utility.component.ts +2 -6
  166. package/lib/widget/list-utility/list-utility.component.ts +0 -1
  167. package/lib/widget/quick-create/quick-create.component.ts +0 -1
  168. package/lib/widget/todo/todo.component.html +5 -6
  169. package/lib/widget/todo/todo.component.scss +9 -0
  170. package/lib/widget/todo/todo.component.ts +95 -85
  171. package/lib/widget/utility/utility.component.ts +0 -1
  172. package/package.json +1 -1
@@ -5,12 +5,47 @@ import { MatOptionModule } from '@angular/material/core';
5
5
  import { MatSelectModule } from '@angular/material/select';
6
6
  import { MatFormFieldModule } from '@angular/material/form-field';
7
7
  import { interval } from 'rxjs';
8
+ import isEqual from 'fast-deep-equal';
8
9
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
10
+ import { DatapageService } from '@pega/angular-sdk-components';
9
11
  import { Utils } from '@pega/angular-sdk-components';
10
12
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
13
  import { handleEvent } from '@pega/angular-sdk-components';
12
14
  import { PConnFieldProps } from '@pega/angular-sdk-components';
13
15
 
16
+ function flattenParameters(params = {}) {
17
+ const flatParams = {};
18
+ Object.keys(params).forEach(key => {
19
+ const { name, value: theVal } = params[key];
20
+ flatParams[name] = theVal;
21
+ });
22
+
23
+ return flatParams;
24
+ }
25
+
26
+ function preProcessColumns(columnList) {
27
+ return columnList.map(col => {
28
+ const tempColObj = { ...col };
29
+ tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
30
+ return tempColObj;
31
+ });
32
+ }
33
+
34
+ function getDisplayFieldsMetaData(columnList) {
35
+ const displayColumns = columnList.filter(col => col.display === 'true');
36
+ const metaDataObj: any = { key: '', primary: '', secondary: [] };
37
+ const keyCol = columnList.filter(col => col.key === 'true');
38
+ metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
39
+ for (let index = 0; index < displayColumns.length; index += 1) {
40
+ if (displayColumns[index].primary === 'true') {
41
+ metaDataObj.primary = displayColumns[index].value;
42
+ } else {
43
+ metaDataObj.secondary.push(displayColumns[index].value);
44
+ }
45
+ }
46
+ return metaDataObj;
47
+ }
48
+
14
49
  interface IOption {
15
50
  key: string;
16
51
  value: string;
@@ -22,13 +57,17 @@ interface DropdownProps extends PConnFieldProps {
22
57
  datasource?: any[];
23
58
  onRecordChange?: any;
24
59
  fieldMetadata?: any;
60
+ listType?: string;
61
+ columns?: any[];
62
+ deferDatasource?: boolean;
63
+ datasourceMetadata?: any;
64
+ parameters?: any;
25
65
  }
26
66
 
27
67
  @Component({
28
68
  selector: 'app-dropdown',
29
69
  templateUrl: './dropdown.component.html',
30
70
  styleUrls: ['./dropdown.component.scss'],
31
- standalone: true,
32
71
  imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatSelectModule, MatOptionModule, forwardRef(() => ComponentMapperComponent)]
33
72
  })
34
73
  export class DropdownComponent implements OnInit, OnDestroy {
@@ -53,7 +92,7 @@ export class DropdownComponent implements OnInit, OnDestroy {
53
92
  testId = '';
54
93
  helperText: string;
55
94
  hideLabel: any;
56
-
95
+ theDatasource: any[] | null;
57
96
  fieldControl = new FormControl('', null);
58
97
  fieldMetadata: any[];
59
98
  localeContext = '';
@@ -61,11 +100,14 @@ export class DropdownComponent implements OnInit, OnDestroy {
61
100
  localeName = '';
62
101
  localePath = '';
63
102
  localizedValue = '';
103
+ actionsApi: Object;
104
+ propName: string;
64
105
 
65
106
  constructor(
66
107
  private angularPConnect: AngularPConnectService,
67
108
  private cdRef: ChangeDetectorRef,
68
- private utils: Utils
109
+ private utils: Utils,
110
+ private dataPageService: DatapageService
69
111
  ) {}
70
112
 
71
113
  ngOnInit(): void {
@@ -76,8 +118,8 @@ export class DropdownComponent implements OnInit, OnDestroy {
76
118
  // Then, continue on with other initialization
77
119
 
78
120
  // call updateSelf when initializing
79
- // this.updateSelf();
80
121
  this.checkAndUpdate();
122
+ // this should get called afer checkAndUpdate
81
123
 
82
124
  if (this.formGroup$) {
83
125
  // add control to formGroup
@@ -90,6 +132,18 @@ export class DropdownComponent implements OnInit, OnDestroy {
90
132
  }
91
133
  }
92
134
 
135
+ set options(options: IOption[]) {
136
+ this.options$ = options;
137
+ if (this.displayMode$) {
138
+ this.value$ = this.options$?.find(option => option.key === this.value$)?.value || this.value$;
139
+ this.localizedValue = this.pConn$.getLocalizedValue(
140
+ this.value$ === 'Select...' ? '' : this.value$,
141
+ this.localePath,
142
+ this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
143
+ );
144
+ }
145
+ }
146
+
93
147
  ngOnDestroy(): void {
94
148
  if (this.formGroup$) {
95
149
  this.formGroup$.removeControl(this.controlName$);
@@ -120,7 +174,6 @@ export class DropdownComponent implements OnInit, OnDestroy {
120
174
  updateSelf(): void {
121
175
  // moved this from ngOnInit() and call this from there instead...
122
176
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as DropdownProps;
123
-
124
177
  if (this.configProps$.value != undefined) {
125
178
  this.value$ = this.configProps$.value;
126
179
  }
@@ -130,6 +183,7 @@ export class DropdownComponent implements OnInit, OnDestroy {
130
183
  this.label$ = this.configProps$.label;
131
184
  this.helperText = this.configProps$.helperText;
132
185
  this.hideLabel = this.configProps$.hideLabel;
186
+ const datasource = this.configProps$.datasource;
133
187
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
134
188
  setTimeout(() => {
135
189
  if (this.configProps$.required != null) {
@@ -138,6 +192,11 @@ export class DropdownComponent implements OnInit, OnDestroy {
138
192
  this.cdRef.detectChanges();
139
193
  });
140
194
 
195
+ if (!isEqual(datasource, this.theDatasource)) {
196
+ // inbound datasource is different, so update theDatasource
197
+ this.theDatasource = datasource || null;
198
+ }
199
+
141
200
  if (this.configProps$.visibility != null) {
142
201
  this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
143
202
  }
@@ -157,18 +216,23 @@ export class DropdownComponent implements OnInit, OnDestroy {
157
216
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
158
217
  }
159
218
 
160
- this.componentReference = (this.pConn$.getStateProps() as any).value;
219
+ this.componentReference = this.pConn$.getStateProps().value;
161
220
 
162
- const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
163
- optionsList?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
164
- this.options$ = optionsList;
165
221
  if (this.value$ === '' && !this.bReadonly$) {
166
222
  this.value$ = 'Select';
167
223
  }
168
224
 
169
- const propName = (this.pConn$.getStateProps() as any).value;
225
+ if (this.theDatasource) {
226
+ const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
227
+ optionsList?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
228
+ this.options = optionsList;
229
+ }
230
+
231
+ this.actionsApi = this.pConn$.getActionsApi();
232
+
233
+ this.propName = this.pConn$.getStateProps().value;
170
234
  const className = this.pConn$.getCaseInfo().getClassName();
171
- const refName = propName?.slice(propName.lastIndexOf('.') + 1);
235
+ const refName = this.propName?.slice(this.propName.lastIndexOf('.') + 1);
172
236
 
173
237
  this.fieldMetadata = this.configProps$.fieldMetadata;
174
238
  const metaData = Array.isArray(this.fieldMetadata) ? this.fieldMetadata.filter(field => field?.classID === className)[0] : this.fieldMetadata;
@@ -185,6 +249,9 @@ export class DropdownComponent implements OnInit, OnDestroy {
185
249
  this.localePath,
186
250
  this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
187
251
  );
252
+
253
+ this.localizedValue = this.options$?.find(opt => opt.key === this.value$)?.value || this.localizedValue;
254
+ this.getDatapageData();
188
255
  // trigger display of error message with field control
189
256
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
190
257
  const timer = interval(100).subscribe(() => {
@@ -196,6 +263,70 @@ export class DropdownComponent implements OnInit, OnDestroy {
196
263
  }
197
264
  }
198
265
 
266
+ getDatapageData() {
267
+ const configProps = this.pConn$.getConfigProps() as DropdownProps;
268
+ let { listType, parameters, datasource = [], columns = [] } = configProps;
269
+ const { deferDatasource, datasourceMetadata } = configProps;
270
+ const context = this.pConn$.getContextName();
271
+ if (deferDatasource && datasourceMetadata?.datasource?.name) {
272
+ listType = 'datapage';
273
+ datasource = datasourceMetadata.datasource.name;
274
+ const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;
275
+ parameters = flattenParameters(dataSourceParameters);
276
+ const displayProp = propertyForDisplayText?.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;
277
+ const valueProp = propertyForValue?.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;
278
+ columns = [
279
+ {
280
+ key: 'true',
281
+ setProperty: 'Associated property',
282
+ value: valueProp
283
+ },
284
+ {
285
+ display: 'true',
286
+ primary: 'true',
287
+ useForSearch: true,
288
+ value: displayProp
289
+ }
290
+ ];
291
+ }
292
+
293
+ columns = preProcessColumns(columns) || [];
294
+ if (listType !== 'associated' && typeof datasource === 'string') {
295
+ this.getData(datasource, parameters, columns, context, listType);
296
+ }
297
+ }
298
+
299
+ getData(dataSource, parameters, columns, context, listType) {
300
+ const dataConfig: any = {
301
+ columns,
302
+ dataSource,
303
+ deferDatasource: true,
304
+ listType,
305
+ parameters,
306
+ matchPosition: 'contains',
307
+ maxResultsDisplay: '5000',
308
+ cacheLifeSpan: 'form'
309
+ };
310
+ PCore.getDataApi()
311
+ .init(dataConfig, context)
312
+ .then((dataApiObj: any) => {
313
+ const optionsData: any[] = [];
314
+ const displayColumn = getDisplayFieldsMetaData(columns);
315
+ dataApiObj?.fetchData('').then(response => {
316
+ response.data?.forEach(element => {
317
+ const val = element[displayColumn.primary]?.toString();
318
+ const obj = {
319
+ key: element[displayColumn.key] || element.pyGUID,
320
+ value: val
321
+ };
322
+ optionsData.push(obj);
323
+ });
324
+ optionsData?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
325
+ this.options = optionsData;
326
+ });
327
+ });
328
+ }
329
+
199
330
  isSelected(buttonValue: string): boolean {
200
331
  return this.value$ === buttonValue;
201
332
  }
@@ -204,17 +335,13 @@ export class DropdownComponent implements OnInit, OnDestroy {
204
335
  if (event?.value === 'Select') {
205
336
  event.value = '';
206
337
  }
207
- const actionsApi = this.pConn$?.getActionsApi();
208
- const propName = (this.pConn$?.getStateProps() as any).value;
209
- handleEvent(actionsApi, 'changeNblur', propName, event.value);
338
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
210
339
  if (this.configProps$?.onRecordChange) {
211
340
  this.configProps$.onRecordChange(event);
212
341
  }
213
- }
214
-
215
- fieldOnBlur(event: any) {
216
- // PConnect wants to use eventHandler for onBlur
217
- this.angularPConnectData.actions?.onBlur(this, event);
342
+ this.pConn$.clearErrorMessages({
343
+ property: this.propName
344
+ });
218
345
  }
219
346
 
220
347
  getLocalizedOptionValue(opt: IOption) {
@@ -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
@@ -17,7 +18,6 @@ interface EmailProps extends PConnFieldProps {
17
18
  selector: 'app-email',
18
19
  templateUrl: './email.component.html',
19
20
  styleUrls: ['./email.component.scss'],
20
- standalone: true,
21
21
  imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)]
22
22
  })
23
23
  export class EmailComponent implements OnInit, OnDestroy {
@@ -43,6 +43,8 @@ export class EmailComponent implements OnInit, OnDestroy {
43
43
  placeholder: string;
44
44
 
45
45
  fieldControl = new FormControl('', null);
46
+ actionsApi: Object;
47
+ propName: string;
46
48
 
47
49
  constructor(
48
50
  private angularPConnect: AngularPConnectService,
@@ -139,7 +141,10 @@ export class EmailComponent implements OnInit, OnDestroy {
139
141
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
140
142
  }
141
143
 
142
- this.componentReference = (this.pConn$.getStateProps() as any).value;
144
+ this.actionsApi = this.pConn$.getActionsApi();
145
+ this.propName = this.pConn$.getStateProps().value;
146
+
147
+ this.componentReference = this.pConn$.getStateProps().value;
143
148
 
144
149
  // trigger display of error message with field control
145
150
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -153,12 +158,26 @@ export class EmailComponent implements OnInit, OnDestroy {
153
158
  }
154
159
 
155
160
  fieldOnChange(event: any) {
156
- this.angularPConnectData.actions?.onChange(this, event);
161
+ const oldVal = this.value$ ?? '';
162
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
163
+
164
+ if (isValueChanged) {
165
+ const value = event?.target?.value;
166
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
167
+ this.pConn$.clearErrorMessages({
168
+ property: this.propName
169
+ });
170
+ }
157
171
  }
158
172
 
159
173
  fieldOnBlur(event: any) {
160
- // PConnect wants to use eventHandler for onBlur
161
- this.angularPConnectData.actions?.onBlur(this, event);
174
+ const oldVal = this.value$ ?? '';
175
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
176
+
177
+ if (isValueChanged) {
178
+ const value = event?.target?.value;
179
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
180
+ }
162
181
  }
163
182
 
164
183
  getErrorMessage() {
@@ -18,7 +18,6 @@ interface GroupProps extends PConnFieldProps {
18
18
  selector: 'app-group',
19
19
  templateUrl: './group.component.html',
20
20
  styleUrls: ['./group.component.scss'],
21
- standalone: true,
22
21
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
23
22
  })
24
23
  export class GroupComponent implements OnInit {
@@ -73,12 +72,12 @@ export class GroupComponent implements OnInit {
73
72
  this.visibility$ = this.pConn$.getComputedVisibility();
74
73
  }
75
74
 
76
- if (this.configProps$.displayMode === 'LABELS_LEFT') {
75
+ if (this.configProps$.displayMode === 'DISPLAY_ONLY') {
77
76
  if (this.configProps$.visibility === undefined) this.visibility$ = true;
78
77
 
79
78
  this.arChildren$.forEach(child => {
80
79
  const pConn = child.getPConnect();
81
- pConn.setInheritedProp('displayMode', 'LABELS_LEFT');
80
+ pConn.setInheritedProp('displayMode', 'DISPLAY_ONLY');
82
81
  pConn.setInheritedProp('readOnly', true);
83
82
 
84
83
  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
@@ -17,7 +18,6 @@ interface IntegerProps extends PConnFieldProps {
17
18
  selector: 'app-integer',
18
19
  templateUrl: './integer.component.html',
19
20
  styleUrls: ['./integer.component.scss'],
20
- standalone: true,
21
21
  imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)]
22
22
  })
23
23
  export class IntegerComponent implements OnInit, OnDestroy {
@@ -43,6 +43,8 @@ export class IntegerComponent implements OnInit, OnDestroy {
43
43
  placeholder: string;
44
44
 
45
45
  fieldControl = new FormControl<number | null>(null, null);
46
+ actionsApi: Object;
47
+ propName: string;
46
48
 
47
49
  constructor(
48
50
  private angularPConnect: AngularPConnectService,
@@ -115,6 +117,9 @@ export class IntegerComponent implements OnInit, OnDestroy {
115
117
  this.helperText = this.configProps$.helperText;
116
118
  this.placeholder = this.configProps$.placeholder || '';
117
119
 
120
+ this.actionsApi = this.pConn$.getActionsApi();
121
+ this.propName = this.pConn$.getStateProps().value;
122
+
118
123
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
119
124
  setTimeout(() => {
120
125
  if (this.configProps$.required != null) {
@@ -142,7 +147,7 @@ export class IntegerComponent implements OnInit, OnDestroy {
142
147
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
143
148
  }
144
149
 
145
- this.componentReference = (this.pConn$.getStateProps() as any).value;
150
+ this.componentReference = this.pConn$.getStateProps().value;
146
151
 
147
152
  // trigger display of error message with field control
148
153
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
@@ -156,12 +161,24 @@ export class IntegerComponent implements OnInit, OnDestroy {
156
161
  }
157
162
 
158
163
  fieldOnChange(event: any) {
159
- this.angularPConnectData.actions?.onChange(this, event);
164
+ const oldVal = this.value$ ?? '';
165
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
166
+
167
+ if (isValueChanged) {
168
+ this.pConn$.clearErrorMessages({
169
+ property: this.propName
170
+ });
171
+ }
160
172
  }
161
173
 
162
174
  fieldOnBlur(event: any) {
163
- // PConnect wants to use eventHandler for onBlur
164
- 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
+ }
165
182
  }
166
183
 
167
184
  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) }}
@@ -7,7 +7,6 @@ import { MatGridListModule } from '@angular/material/grid-list';
7
7
  selector: 'app-list-view-action-buttons',
8
8
  templateUrl: './list-view-action-buttons.component.html',
9
9
  styleUrls: ['./list-view-action-buttons.component.scss'],
10
- standalone: true,
11
10
  imports: [CommonModule, MatGridListModule, MatButtonModule]
12
11
  })
13
12
  export class ListViewActionButtonsComponent {
@@ -31,10 +30,11 @@ export class ListViewActionButtonsComponent {
31
30
  this.pConn$
32
31
  .getActionsApi()
33
32
  .submitEmbeddedDataModal(this.context$)
34
- .then(() => {})
33
+ .then(() => {
34
+ this.closeActionsDialog.emit();
35
+ })
35
36
  .finally(() => {
36
37
  this.isDisabled = false;
37
38
  });
38
- this.closeActionsDialog.emit();
39
39
  }
40
40
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "Location",
3
+ "label": "Location",
4
+ "description": "Location",
5
+ "type": "Field",
6
+ "subtype": "Location",
7
+ "properties": []
8
+ }
@@ -0,0 +1,45 @@
1
+ <div *ngIf="mapReady && bVisible$">
2
+ <!-- Google suggestions -->
3
+ <mat-form-field class="psdk-full-width" [hintLabel]="helperText">
4
+ <mat-label>{{ label$ }}</mat-label>
5
+ <input
6
+ matInput
7
+ type="text"
8
+ [placeholder]="placeholder"
9
+ [formControl]="searchControl"
10
+ [required]="bRequired$"
11
+ [matAutocomplete]="auto"
12
+ [attr.data-test-id]="testId"
13
+ (blur)="fieldOnBlur()"
14
+ />
15
+ <mat-error *ngIf="searchControl.invalid">{{ getErrorMessage() }}</mat-error>
16
+ <button
17
+ mat-icon-button
18
+ matSuffix
19
+ type="button"
20
+ (click)="locateMe()"
21
+ [disabled]="isLocating || bDisabled$ || bReadonly$"
22
+ aria-label="Use my location"
23
+ >
24
+ <ng-container *ngIf="!isLocating; else loadingSpinner">
25
+ <mat-icon>location_on</mat-icon>
26
+ </ng-container>
27
+ <ng-template #loadingSpinner>
28
+ <mat-progress-spinner diameter="24" mode="indeterminate" strokeWidth="3"></mat-progress-spinner>
29
+ </ng-template>
30
+ </button>
31
+
32
+ <mat-autocomplete #auto="matAutocomplete" (optionSelected)="onOptionSelected($event)">
33
+ <mat-option *ngFor="let option of filteredOptions" [value]="option">
34
+ {{ option }}
35
+ </mat-option>
36
+ </mat-autocomplete>
37
+ </mat-form-field>
38
+ <!-- Google map -->
39
+ <div *ngIf="showMap" class="map-wrapper">
40
+ <google-map height="400px" width="100%" [center]="center" [zoom]="13" (mapClick)="onMapClick($event)">
41
+ <map-marker *ngIf="markerPosition" [position]="markerPosition" [title]="'Selected Location'"></map-marker>
42
+ </google-map>
43
+ <div class="map-blocker" *ngIf="bDisabled$ || bReadonly$"></div>
44
+ </div>
45
+ </div>
@@ -0,0 +1,18 @@
1
+ .psdk-full-width {
2
+ width: 100%;
3
+ }
4
+
5
+ .map-wrapper {
6
+ position: relative;
7
+ }
8
+
9
+ .map-blocker {
10
+ position: absolute;
11
+ top: 0;
12
+ left: 0;
13
+ width: 100%;
14
+ height: 100%;
15
+ background: transparent;
16
+ z-index: 10;
17
+ cursor: not-allowed;
18
+ }
@@ -0,0 +1,22 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { LocationComponent } from './location.component';
4
+
5
+ describe('LocationComponent', () => {
6
+ let component: LocationComponent;
7
+ let fixture: ComponentFixture<LocationComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [LocationComponent]
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(LocationComponent);
15
+ component = fixture.componentInstance;
16
+ fixture.detectChanges();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });