@pega/angular-sdk-overrides 0.24.9 → 0.25.2

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 (256) hide show
  1. package/lib/designSystemExtension/alert/alert.component.scss +3 -3
  2. package/lib/designSystemExtension/alert/alert.component.ts +0 -1
  3. package/lib/designSystemExtension/alert-banner/alert-banner.component.ts +1 -2
  4. package/lib/designSystemExtension/banner/banner.component.scss +12 -2
  5. package/lib/designSystemExtension/banner/banner.component.ts +0 -1
  6. package/lib/designSystemExtension/case-create-stage/case-create-stage.component.ts +1 -2
  7. package/lib/designSystemExtension/field-group/field-group.component.ts +0 -1
  8. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +6 -3
  9. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +7 -35
  10. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -2
  11. package/lib/designSystemExtension/material-details/material-details.component.scss +0 -5
  12. package/lib/designSystemExtension/material-details/material-details.component.ts +0 -1
  13. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +4 -4
  14. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +4 -3
  15. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +10 -2
  16. package/lib/designSystemExtension/material-summary-item/material-summary-item.component.scss +2 -17
  17. package/lib/designSystemExtension/material-summary-item/material-summary-item.component.ts +0 -1
  18. package/lib/designSystemExtension/material-summary-list/material-summary-list.component.ts +0 -1
  19. package/lib/designSystemExtension/material-utility/material-utility.component.scss +1 -2
  20. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.scss +1 -1
  21. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.ts +0 -1
  22. package/lib/designSystemExtension/operator/operator.component.html +2 -2
  23. package/lib/designSystemExtension/operator/operator.component.scss +13 -12
  24. package/lib/designSystemExtension/operator/operator.component.ts +5 -6
  25. package/lib/designSystemExtension/pulse/pulse.component.scss +2 -2
  26. package/lib/designSystemExtension/pulse/pulse.component.ts +7 -8
  27. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +0 -1
  28. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.ts +0 -1
  29. package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.scss +16 -8
  30. package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.ts +0 -1
  31. package/lib/field/auto-complete/auto-complete.component.html +0 -2
  32. package/lib/field/auto-complete/auto-complete.component.ts +56 -178
  33. package/lib/field/cancel-alert/cancel-alert.component.html +8 -12
  34. package/lib/field/cancel-alert/cancel-alert.component.scss +2 -3
  35. package/lib/field/cancel-alert/cancel-alert.component.ts +24 -37
  36. package/lib/field/check-box/check-box.component.html +17 -6
  37. package/lib/field/check-box/check-box.component.scss +0 -1
  38. package/lib/field/check-box/check-box.component.ts +32 -157
  39. package/lib/field/currency/currency.component.html +4 -4
  40. package/lib/field/currency/currency.component.ts +65 -175
  41. package/lib/field/date/date.component.html +4 -8
  42. package/lib/field/date/date.component.ts +39 -177
  43. package/lib/field/date-time/date-time.component.html +3 -4
  44. package/lib/field/date-time/date-time.component.ts +46 -146
  45. package/lib/field/decimal/decimal.component.html +4 -3
  46. package/lib/field/decimal/decimal.component.ts +66 -166
  47. package/lib/field/dropdown/dropdown.component.html +1 -0
  48. package/lib/field/dropdown/dropdown.component.ts +158 -153
  49. package/lib/field/email/email.component.ts +28 -148
  50. package/lib/field/field.base.ts +149 -0
  51. package/lib/field/group/group.component.ts +9 -7
  52. package/lib/field/integer/integer.component.ts +30 -152
  53. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
  54. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +3 -3
  55. package/lib/field/location/config-ext.json +8 -0
  56. package/lib/field/location/location.component.html +45 -0
  57. package/lib/field/location/location.component.scss +18 -0
  58. package/lib/field/location/location.component.spec.ts +22 -0
  59. package/lib/field/location/location.component.ts +385 -0
  60. package/lib/field/multiselect/multiselect.component.ts +56 -151
  61. package/lib/field/multiselect/utils.ts +55 -47
  62. package/lib/field/object-reference/object-reference.component.html +17 -0
  63. package/lib/field/object-reference/object-reference.component.scss +0 -0
  64. package/lib/field/object-reference/object-reference.component.spec.ts +22 -0
  65. package/lib/field/object-reference/object-reference.component.ts +237 -0
  66. package/lib/field/percentage/percentage.component.html +3 -3
  67. package/lib/field/percentage/percentage.component.ts +68 -161
  68. package/lib/field/phone/config-ext.json +1 -1
  69. package/lib/field/phone/phone.component.html +9 -6
  70. package/lib/field/phone/phone.component.scss +9 -0
  71. package/lib/field/phone/phone.component.ts +48 -159
  72. package/lib/field/radio-buttons/radio-buttons.component.html +17 -12
  73. package/lib/field/radio-buttons/radio-buttons.component.scss +4 -2
  74. package/lib/field/radio-buttons/radio-buttons.component.ts +39 -162
  75. package/lib/field/rich-text/rich-text.component.ts +32 -93
  76. package/lib/field/scalar-list/scalar-list.component.ts +20 -77
  77. package/lib/field/selectable-card/selectable-card.component.html +70 -0
  78. package/lib/field/selectable-card/selectable-card.component.scss +11 -0
  79. package/lib/field/selectable-card/selectable-card.component.spec.ts +22 -0
  80. package/lib/field/selectable-card/selectable-card.component.ts +219 -0
  81. package/lib/field/semantic-link/semantic-link.component.html +4 -8
  82. package/lib/field/semantic-link/semantic-link.component.scss +0 -13
  83. package/lib/field/semantic-link/semantic-link.component.ts +165 -6
  84. package/lib/field/text/text.component.scss +0 -1
  85. package/lib/field/text/text.component.ts +8 -5
  86. package/lib/field/text-area/text-area.component.html +4 -1
  87. package/lib/field/text-area/text-area.component.ts +30 -148
  88. package/lib/field/text-content/text-content.component.ts +0 -1
  89. package/lib/field/text-input/text-input.component.ts +28 -150
  90. package/lib/field/time/time.component.html +2 -2
  91. package/lib/field/time/time.component.ts +39 -145
  92. package/lib/field/url/url.component.ts +28 -149
  93. package/lib/field/user-reference/user-reference.component.html +40 -46
  94. package/lib/field/user-reference/user-reference.component.scss +0 -1
  95. package/lib/field/user-reference/user-reference.component.ts +110 -21
  96. package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
  97. package/lib/infra/Containers/flow-container/flow-container.component.ts +29 -54
  98. package/lib/infra/Containers/flow-container/helpers.ts +2 -2
  99. package/lib/infra/Containers/hybrid-view-container/hybrid-view-container.component.ts +0 -1
  100. package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
  101. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +6 -19
  102. package/lib/infra/Containers/preview-view-container/preview-view-container.component.ts +1 -1
  103. package/lib/infra/Containers/view-container/helper.ts +55 -0
  104. package/lib/infra/Containers/view-container/view-container.component.ts +6 -19
  105. package/lib/infra/action-buttons/action-buttons.component.html +13 -8
  106. package/lib/infra/action-buttons/action-buttons.component.scss +23 -0
  107. package/lib/infra/action-buttons/action-buttons.component.ts +1 -3
  108. package/lib/infra/assignment/assignment.component.html +1 -1
  109. package/lib/infra/assignment/assignment.component.ts +90 -47
  110. package/lib/infra/assignment-card/assignment-card.component.html +2 -2
  111. package/lib/infra/assignment-card/assignment-card.component.scss +0 -4
  112. package/lib/infra/assignment-card/assignment-card.component.ts +21 -5
  113. package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
  114. package/lib/infra/defer-load/defer-load.component.html +6 -2
  115. package/lib/infra/defer-load/defer-load.component.ts +24 -16
  116. package/lib/infra/error-boundary/error-boundary.component.ts +0 -1
  117. package/lib/infra/multi-step/multi-step.component.scss +1 -21
  118. package/lib/infra/multi-step/multi-step.component.ts +0 -1
  119. package/lib/infra/navbar/navbar.component.html +25 -28
  120. package/lib/infra/navbar/navbar.component.scss +16 -4
  121. package/lib/infra/navbar/navbar.component.ts +11 -9
  122. package/lib/infra/reference/reference.component.ts +77 -90
  123. package/lib/infra/region/region.component.ts +0 -1
  124. package/lib/infra/root-container/root-container.component.html +2 -15
  125. package/lib/infra/root-container/root-container.component.scss +0 -1
  126. package/lib/infra/root-container/root-container.component.ts +28 -35
  127. package/lib/infra/stages/stages.component.html +2 -2
  128. package/lib/infra/stages/stages.component.scss +9 -37
  129. package/lib/infra/stages/stages.component.ts +4 -3
  130. package/lib/infra/view/view.component.html +7 -20
  131. package/lib/infra/view/view.component.ts +20 -5
  132. package/lib/template/advanced-search/advanced-search.component.html +12 -0
  133. package/lib/template/advanced-search/advanced-search.component.scss +0 -0
  134. package/lib/template/advanced-search/advanced-search.component.spec.ts +0 -0
  135. package/lib/template/advanced-search/advanced-search.component.ts +112 -0
  136. package/lib/template/advanced-search/advanced-search.service.ts +27 -0
  137. package/lib/template/advanced-search/search-group/persist-utils.ts +56 -0
  138. package/lib/template/advanced-search/search-groups/search-groups.component.html +32 -0
  139. package/lib/template/advanced-search/search-groups/search-groups.component.scss +0 -0
  140. package/lib/template/advanced-search/search-groups/search-groups.component.spec.ts +0 -0
  141. package/lib/template/advanced-search/search-groups/search-groups.component.ts +294 -0
  142. package/lib/template/advanced-search/search-groups/utils.ts +29 -0
  143. package/lib/template/app-shell/app-shell.component.html +4 -1
  144. package/lib/template/app-shell/app-shell.component.scss +0 -3
  145. package/lib/template/app-shell/app-shell.component.ts +66 -10
  146. package/lib/template/banner-page/banner-page.component.ts +0 -1
  147. package/lib/template/base/details-template-base.ts +67 -0
  148. package/lib/template/base/form-template-base.ts +16 -0
  149. package/lib/template/case-summary/case-summary.component.scss +0 -2
  150. package/lib/template/case-summary/case-summary.component.ts +7 -23
  151. package/lib/template/case-view/case-view.component.html +7 -7
  152. package/lib/template/case-view/case-view.component.scss +18 -10
  153. package/lib/template/case-view/case-view.component.ts +9 -15
  154. package/lib/template/confirmation/confirmation.component.html +1 -1
  155. package/lib/template/confirmation/confirmation.component.ts +1 -2
  156. package/lib/template/data-reference/data-reference-advanced-search.service.ts +16 -0
  157. package/lib/template/data-reference/data-reference.component.html +11 -8
  158. package/lib/template/data-reference/data-reference.component.ts +377 -148
  159. package/lib/template/data-reference/search-form/search-form.component.html +39 -0
  160. package/lib/template/data-reference/search-form/search-form.component.scss +11 -0
  161. package/lib/template/data-reference/search-form/search-form.component.spec.ts +0 -0
  162. package/lib/template/data-reference/search-form/search-form.component.ts +167 -0
  163. package/lib/template/data-reference/search-form/tabsData.ts +160 -0
  164. package/lib/template/data-reference/utils.ts +92 -0
  165. package/lib/template/default-form/default-form.component.html +0 -4
  166. package/lib/template/default-form/default-form.component.ts +50 -26
  167. package/lib/template/default-page/default-page.component.html +34 -0
  168. package/lib/template/default-page/default-page.component.scss +31 -0
  169. package/lib/template/default-page/default-page.component.spec.ts +24 -0
  170. package/lib/template/default-page/default-page.component.ts +64 -0
  171. package/lib/template/details/details.component.ts +7 -42
  172. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +6 -40
  173. package/lib/template/details-one-column/details-one-column.component.ts +7 -43
  174. package/lib/template/details-sub-tabs/details-sub-tabs.component.html +1 -2
  175. package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +5 -38
  176. package/lib/template/details-three-column/details-three-column.component.ts +7 -44
  177. package/lib/template/details-two-column/details-two-column.component.ts +8 -45
  178. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +7 -43
  179. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +3 -0
  180. package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +8 -4
  181. package/lib/template/field-group-list/field-group-list.component.scss +0 -1
  182. package/lib/template/field-group-list/field-group-list.component.ts +0 -1
  183. package/lib/template/field-group-template/field-group-template.component.html +7 -7
  184. package/lib/template/field-group-template/field-group-template.component.scss +8 -0
  185. package/lib/template/field-group-template/field-group-template.component.ts +68 -48
  186. package/lib/template/field-value-list/field-value-list.component.html +2 -2
  187. package/lib/template/field-value-list/field-value-list.component.scss +6 -1
  188. package/lib/template/field-value-list/field-value-list.component.ts +0 -1
  189. package/lib/template/inline-dashboard/inline-dashboard.component.ts +0 -1
  190. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -3
  191. package/lib/template/list-page/list-page.component.ts +0 -1
  192. package/lib/template/list-view/list-view.component.html +14 -4
  193. package/lib/template/list-view/list-view.component.scss +30 -19
  194. package/lib/template/list-view/list-view.component.ts +179 -95
  195. package/lib/template/list-view/listViewHelpers.ts +4 -10
  196. package/lib/template/list-view/utils.ts +27 -7
  197. package/lib/template/multi-reference-readonly/multi-reference-readonly.component.ts +0 -1
  198. package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +1 -2
  199. package/lib/template/object-page/object-page.component.html +1 -0
  200. package/lib/template/object-page/object-page.component.scss +0 -0
  201. package/lib/template/object-page/object-page.component.spec.ts +22 -0
  202. package/lib/template/object-page/object-page.component.ts +14 -0
  203. package/lib/template/one-column/one-column.component.ts +4 -4
  204. package/lib/template/one-column-page/one-column-page.component.ts +0 -1
  205. package/lib/template/one-column-tab/one-column-tab.component.scss +1 -1
  206. package/lib/template/one-column-tab/one-column-tab.component.ts +1 -2
  207. package/lib/template/page/page.component.ts +1 -2
  208. package/lib/template/promoted-filters/promoted-filters.component.ts +1 -2
  209. package/lib/template/repeating-structures/repeating-structures.component.ts +1 -3
  210. package/lib/template/self-service-case-view/self-service-case-view.component.html +80 -0
  211. package/lib/template/self-service-case-view/self-service-case-view.component.scss +124 -0
  212. package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +24 -0
  213. package/lib/template/self-service-case-view/self-service-case-view.component.ts +216 -0
  214. package/lib/template/simple-table/simple-table.component.ts +0 -2
  215. package/lib/template/simple-table-manual/helpers.ts +127 -11
  216. package/lib/template/simple-table-manual/simple-table-manual.component.html +27 -8
  217. package/lib/template/simple-table-manual/simple-table-manual.component.scss +16 -17
  218. package/lib/template/simple-table-manual/simple-table-manual.component.ts +118 -58
  219. package/lib/template/simple-table-select/simple-table-select.component.ts +3 -4
  220. package/lib/template/single-reference-readonly/single-reference-readonly.component.html +4 -1
  221. package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +21 -0
  222. package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +104 -4
  223. package/lib/template/sub-tabs/sub-tabs.component.ts +0 -1
  224. package/lib/template/three-column/three-column.component.ts +4 -4
  225. package/lib/template/three-column-page/three-column-page.component.ts +0 -1
  226. package/lib/template/two-column/two-column.component.ts +4 -4
  227. package/lib/template/two-column-page/two-column-page.component.ts +0 -1
  228. package/lib/template/two-column-tab/two-column-tab.component.ts +1 -2
  229. package/lib/template/utils.ts +58 -0
  230. package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +4 -4
  231. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +1 -2
  232. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +5 -4
  233. package/lib/template/wss-nav-bar/wss-nav-bar.component.scss +2 -8
  234. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +3 -11
  235. package/lib/widget/app-announcement/app-announcement.component.html +1 -2
  236. package/lib/widget/app-announcement/app-announcement.component.scss +2 -2
  237. package/lib/widget/app-announcement/app-announcement.component.ts +0 -1
  238. package/lib/widget/attachment/Attachment.types.ts +92 -0
  239. package/lib/widget/attachment/AttachmentUtils.ts +287 -0
  240. package/lib/widget/attachment/attachment.component.html +3 -3
  241. package/lib/widget/attachment/attachment.component.scss +2 -5
  242. package/lib/widget/attachment/attachment.component.ts +256 -259
  243. package/lib/widget/case-history/case-history.component.ts +0 -1
  244. package/lib/widget/feed-container/feed-container.component.scss +3 -9
  245. package/lib/widget/feed-container/feed-container.component.ts +9 -12
  246. package/lib/widget/file-utility/file-utility.component.html +3 -3
  247. package/lib/widget/file-utility/file-utility.component.scss +5 -16
  248. package/lib/widget/file-utility/file-utility.component.ts +2 -6
  249. package/lib/widget/list-utility/list-utility.component.scss +3 -5
  250. package/lib/widget/list-utility/list-utility.component.ts +0 -1
  251. package/lib/widget/quick-create/quick-create.component.ts +0 -1
  252. package/lib/widget/todo/todo.component.html +13 -11
  253. package/lib/widget/todo/todo.component.scss +19 -11
  254. package/lib/widget/todo/todo.component.ts +101 -87
  255. package/lib/widget/utility/utility.component.ts +0 -1
  256. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, forwardRef } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
- import { FormGroup, ReactiveFormsModule } from '@angular/forms';
4
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
5
- import { Utils } from '@pega/angular-sdk-components';
3
+ import { ReactiveFormsModule } from '@angular/forms';
4
+
5
+ import { FieldBase } from '@pega/angular-sdk-components';
6
6
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
7
7
  import { handleEvent } from '@pega/angular-sdk-components';
8
8
  import { PConnFieldProps } from '@pega/angular-sdk-components';
@@ -15,105 +15,42 @@ interface RichTextProps extends PConnFieldProps {
15
15
  selector: 'app-rich-text',
16
16
  templateUrl: './rich-text.component.html',
17
17
  styleUrls: ['./rich-text.component.scss'],
18
- standalone: true,
19
18
  imports: [CommonModule, ReactiveFormsModule, forwardRef(() => ComponentMapperComponent)]
20
19
  })
21
- export class RichTextComponent implements OnInit, OnDestroy {
22
- @Input() pConn$: typeof PConnect;
23
- @Input() formGroup$: FormGroup;
24
-
25
- // Used with AngularPConnect
26
- angularPConnectData: AngularPConnectData = {};
20
+ export class RichTextComponent extends FieldBase {
27
21
  configProps$: RichTextProps;
28
22
 
29
- label$ = '';
30
- value$ = '';
31
- bRequired$ = false;
32
- bReadonly$ = false;
33
- bDisabled$ = false;
34
- bVisible$ = true;
35
- displayMode$?: string = '';
36
- controlName$: string;
37
- testId: string;
38
- helperText: string;
39
- placeholder: any;
40
23
  info: any;
41
24
  error: boolean;
42
25
  status: any;
43
26
 
44
- constructor(
45
- private angularPConnect: AngularPConnectService,
46
- private utils: Utils
47
- ) {}
48
-
49
- ngOnInit(): void {
50
- // First thing in initialization is registering and subscribing to the AngularPConnect service
51
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
52
-
53
- // call updateSelf when initializing
54
- this.checkAndUpdate();
55
- }
56
-
57
- ngOnDestroy(): void {
58
- if (this.angularPConnectData.unsubscribeFn) {
59
- this.angularPConnectData.unsubscribeFn();
60
- }
61
- }
62
-
63
- // Callback passed when subscribing to store change
64
- onStateChange() {
65
- this.checkAndUpdate();
66
- }
67
-
68
- checkAndUpdate() {
69
- // Should always check the bridge to see if the component should
70
- // update itself (re-render)
71
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
72
-
73
- // ONLY call updateSelf when the component should update
74
- if (bUpdateSelf) {
75
- this.updateSelf();
76
- }
77
- }
78
-
79
- // updateSelf
80
- updateSelf(): void {
81
- // moved this from ngOnInit() and call this from there instead...
27
+ /**
28
+ * Updates the component when there are changes in the state.
29
+ */
30
+ override updateSelf(): void {
31
+ // Resolve config properties
82
32
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as RichTextProps;
83
- const stateProps: any = this.pConn$.getStateProps();
84
- this.status = stateProps?.status;
85
-
86
- if (this.configProps$.value != undefined) {
87
- this.value$ = this.configProps$.value;
88
- }
89
33
 
90
- this.testId = this.configProps$.testId;
91
- this.displayMode$ = this.configProps$.displayMode;
92
- this.label$ = this.configProps$.label;
93
- this.placeholder = this.configProps$.placeholder;
94
- this.info = stateProps?.validatemessage || this.configProps$.helperText;
95
- this.error = stateProps?.status === 'error';
34
+ // Update component common properties
35
+ this.updateComponentCommonProperties(this.configProps$);
96
36
 
97
- if (this.configProps$.required != null) {
98
- this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
99
- }
100
-
101
- if (this.configProps$.visibility != null) {
102
- this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
103
- }
37
+ // Extract and normalize the value property
38
+ const { value, helperText } = this.configProps$;
39
+ this.value$ = value;
104
40
 
105
- if (this.configProps$.disabled != undefined) {
106
- this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
107
- }
108
-
109
- if (this.configProps$.readOnly != null) {
110
- this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
111
- }
41
+ const { status, validatemessage } = this.pConn$.getStateProps();
42
+ this.status = status;
43
+ this.info = validatemessage || helperText;
44
+ this.error = status === 'error';
112
45
  }
113
46
 
114
- fieldOnChange() {
115
- if (this.status === 'error') {
116
- const property = (this.pConn$.getStateProps() as any).value;
47
+ fieldOnChange(editorValue: any) {
48
+ const oldVal = this.value$ ?? '';
49
+ const newVal = editorValue?.editor?.getBody()?.innerHTML ?? '';
50
+ const isValueChanged = newVal.toString() !== oldVal.toString();
51
+
52
+ if (isValueChanged || this.status === 'error') {
53
+ const property = this.propName;
117
54
  this.pConn$.clearErrorMessages({
118
55
  property,
119
56
  category: '',
@@ -123,9 +60,11 @@ export class RichTextComponent implements OnInit, OnDestroy {
123
60
  }
124
61
 
125
62
  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);
63
+ const oldVal = this.value$ ?? '';
64
+ const isValueChanged = editorValue.toString() !== oldVal.toString();
65
+
66
+ if (isValueChanged) {
67
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, editorValue);
68
+ }
130
69
  }
131
70
  }
@@ -1,7 +1,7 @@
1
1
  import { CommonModule } from '@angular/common';
2
- import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
3
- import { FormControl, FormGroup } from '@angular/forms';
4
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
2
+ import { Component, forwardRef } from '@angular/core';
3
+
4
+ import { FieldBase } from '@pega/angular-sdk-components';
5
5
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
6
6
  import { PConnFieldProps } from '@pega/angular-sdk-components';
7
7
 
@@ -17,104 +17,47 @@ interface ScalarListProps extends Omit<PConnFieldProps, 'value'> {
17
17
  selector: 'app-scalar-list',
18
18
  templateUrl: './scalar-list.component.html',
19
19
  styleUrls: ['./scalar-list.component.scss'],
20
- standalone: true,
21
20
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
22
21
  })
23
- export class ScalarListComponent implements OnInit, OnDestroy {
24
- @Input() pConn$: typeof PConnect;
25
- @Input() formGroup$: FormGroup;
26
-
27
- angularPConnectData: AngularPConnectData = {};
22
+ export class ScalarListComponent extends FieldBase {
28
23
  configProps$: ScalarListProps;
29
24
 
30
- label$ = '';
31
- value$: any;
32
- displayMode$?: string = '';
33
25
  items: any[];
34
26
  isDisplayModeEnabled = false;
35
- controlName$: string;
36
- fieldControl = new FormControl('', null);
37
- bHasForm$ = true;
38
- bReadonly$ = false;
39
-
40
- constructor(private angularPConnect: AngularPConnectService) {}
41
-
42
- ngOnInit(): void {
43
- // First thing in initialization is registering and subscribing to the AngularPConnect service
44
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
45
- this.controlName$ = this.angularPConnect.getComponentID(this);
46
- // Then, continue on with other initialization
47
-
48
- // call updateSelf when initializing
49
- // this.updateSelf();
50
- this.checkAndUpdate();
51
-
52
- if (this.formGroup$) {
53
- // add control to formGroup
54
- this.formGroup$.addControl(this.controlName$, this.fieldControl);
55
- this.fieldControl.setValue(this.value$);
56
- this.bHasForm$ = true;
57
- } else {
58
- this.bReadonly$ = true;
59
- this.bHasForm$ = false;
60
- }
61
- }
62
-
63
- ngOnDestroy(): void {
64
- if (this.formGroup$) {
65
- this.formGroup$.removeControl(this.controlName$);
66
- }
67
27
 
68
- if (this.angularPConnectData.unsubscribeFn) {
69
- this.angularPConnectData.unsubscribeFn();
70
- }
71
- }
72
-
73
- // Callback passed when subscribing to store change
74
- onStateChange() {
75
- this.checkAndUpdate();
76
- }
28
+ /**
29
+ * Updates the component when there are changes in the state.
30
+ */
31
+ override updateSelf(): void {
32
+ // Resolve config properties
33
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ScalarListProps;
77
34
 
78
- checkAndUpdate() {
79
- // Should always check the bridge to see if the component should
80
- // update itself (re-render)
81
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
35
+ // Extract properties from config props
36
+ const { componentType, displayMode = '', label, value, restProps } = this.configProps$;
82
37
 
83
- // ONLY call updateSelf when the component should update
84
- if (bUpdateSelf) {
85
- this.updateSelf();
86
- }
87
- }
38
+ // Update component properties
39
+ this.label$ = label;
40
+ this.displayMode$ = displayMode;
88
41
 
89
- // updateSelf
90
- updateSelf(): void {
91
- this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ScalarListProps;
92
- this.label$ = this.configProps$.label;
93
- const componentType = this.configProps$.componentType;
94
- const scalarValues = this.configProps$.value;
95
- this.displayMode$ = this.configProps$.displayMode;
96
- const restProps = this.configProps$.restProps;
97
- console.log('scalar values: ', scalarValues);
98
- this.items = scalarValues?.map(scalarValue => {
99
- console.log('scalar value: ', scalarValue);
42
+ this.items = value?.map(scalarValue => {
100
43
  return this.pConn$.createComponent(
101
44
  {
102
45
  type: componentType,
103
46
  config: {
104
- // @ts-ignore - Object literal may only specify known properties, and 'value' does not exist in type 'ComponentMetadataConfig'.
105
47
  value: scalarValue,
106
- displayMode: 'LABELS_LEFT',
48
+ displayMode: 'DISPLAY_ONLY',
107
49
  label: this.label$,
108
50
  ...restProps,
109
51
  readOnly: true
110
52
  }
111
53
  },
112
54
  '',
113
- '',
55
+ 0,
114
56
  {}
115
57
  ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
116
58
  });
117
- this.isDisplayModeEnabled = ['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(this.displayMode$ as string);
59
+
60
+ this.isDisplayModeEnabled = ['STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(this.displayMode$ as string);
118
61
  this.value$ = this.items;
119
62
  }
120
63
  }
@@ -0,0 +1,70 @@
1
+ <div
2
+ *ngIf="type === 'checkbox'"
3
+ style="display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); grid-auto-rows: 1fr; gap: 0.5rem"
4
+ >
5
+ <div *ngFor="let cardContent of contentList">
6
+ <mat-card [ngStyle]="cardStyle" appearance="outlined" (click)="cardSelect($event, cardContent.commonCardProps)">
7
+ <img
8
+ *ngIf="cardContent.cardImage"
9
+ mat-card-image
10
+ src="{{ cardContent.cardImage.src }}"
11
+ alt="{{ cardContent.cardImage.alt }}"
12
+ [ngStyle]="cardContent.cardImage.style"
13
+ />
14
+ <mat-card-content>
15
+ <mat-checkbox
16
+ [labelPosition]="'after'"
17
+ [checked]="cardContent.commonCardProps.selected"
18
+ [disabled]="disabled || readOnly"
19
+ [attr.data-test-id]="testId + ':' + cardContent.commonCardProps.label"
20
+ (change)="handleChangeMultiMode($event, cardContent.commonCardProps)"
21
+ (blur)="fieldOnBlur()"
22
+ >{{ cardContent.commonCardProps.label }}</mat-checkbox
23
+ >
24
+ <div
25
+ *ngFor="let field of cardContent.commonCardProps.fields"
26
+ [ngStyle]="field.type !== 'TextArea' ? (field.name ? defaultStyle : noLabelStyle) : specialStyle"
27
+ >
28
+ <div>{{ field.name }}</div>
29
+ <div>{{ field?.value?.getPConnect().getConfigProps().value ?? '--' }}</div>
30
+ </div>
31
+ </mat-card-content>
32
+ </mat-card>
33
+ </div>
34
+ </div>
35
+
36
+ <mat-radio-group
37
+ *ngIf="type === 'radio'"
38
+ style="display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); grid-auto-rows: 1fr; gap: 0.5rem"
39
+ [name]="propName"
40
+ [value]="radioBtnValue"
41
+ (change)="fieldOnChange($event.value)"
42
+ >
43
+ <div *ngFor="let cardContent of contentList">
44
+ <mat-card [ngStyle]="cardStyle" appearance="outlined" (click)="cardSelect($event, cardContent.commonCardProps)">
45
+ <img
46
+ *ngIf="cardContent.cardImage"
47
+ mat-card-image
48
+ src="{{ cardContent.cardImage.src }}"
49
+ alt="{{ cardContent.cardImage.alt }}"
50
+ [ngStyle]="cardContent.cardImage.style"
51
+ />
52
+ <mat-card-content>
53
+ <mat-radio-button
54
+ [checked]="radioBtnValue === cardContent?.commonCardProps?.key"
55
+ [disabled]="disabled"
56
+ [value]="cardContent.commonCardProps.key"
57
+ >
58
+ {{ cardContent.commonCardProps.label }}
59
+ </mat-radio-button>
60
+ <div
61
+ *ngFor="let field of cardContent.commonCardProps.fields"
62
+ [ngStyle]="field.type !== 'TextArea' ? (field.name ? defaultStyle : noLabelStyle) : specialStyle"
63
+ >
64
+ <div>{{ field.name }}</div>
65
+ <div>{{ field?.value?.getPConnect().getConfigProps().value ?? '--' }}</div>
66
+ </div>
67
+ </mat-card-content>
68
+ </mat-card>
69
+ </div>
70
+ </mat-radio-group>
@@ -0,0 +1,11 @@
1
+ ::ng-deep .mdc-label {
2
+ font-size: large;
3
+ }
4
+
5
+ .mat-mdc-card-content:last-child {
6
+ padding-bottom: 0;
7
+ }
8
+
9
+ .mat-mdc-card-content:first-child {
10
+ padding-top: 0;
11
+ }
@@ -0,0 +1,22 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { SelectableCardComponent } from './selectable-card.component';
4
+
5
+ describe('SelectableCardComponent', () => {
6
+ let component: SelectableCardComponent;
7
+ let fixture: ComponentFixture<SelectableCardComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [SelectableCardComponent]
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(SelectableCardComponent);
15
+ component = fixture.componentInstance;
16
+ fixture.detectChanges();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });
@@ -0,0 +1,219 @@
1
+ import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { MatCardModule } from '@angular/material/card';
4
+ import { MatRadioModule } from '@angular/material/radio';
5
+ import { MatCheckboxModule } from '@angular/material/checkbox';
6
+ import { deleteInstruction, insertInstruction } from '@pega/angular-sdk-components';
7
+ import { handleEvent } from '@pega/angular-sdk-components';
8
+ import { PConnFieldProps } from '@pega/angular-sdk-components';
9
+ import { FieldBase } from '@pega/angular-sdk-components';
10
+
11
+ interface SelectableCardProps extends PConnFieldProps {
12
+ selectionList: any;
13
+ readonlyContextList: any;
14
+ image: string;
15
+ primaryField: string;
16
+ selectionKey: string;
17
+ renderMode: string;
18
+ hideFieldLabels?: boolean;
19
+ additionalProps?: any;
20
+ imagePosition?: string;
21
+ imageSize?: string;
22
+ showImageDescription?: boolean;
23
+ datasource?: any;
24
+ }
25
+
26
+ @Component({
27
+ selector: 'lib-selectable-card',
28
+ imports: [MatCardModule, CommonModule, MatRadioModule, MatCheckboxModule],
29
+ templateUrl: './selectable-card.component.html',
30
+ styleUrl: './selectable-card.component.scss'
31
+ })
32
+ export class SelectableCardComponent extends FieldBase implements OnInit {
33
+ @Input() type: string;
34
+ @Output() valueChange: EventEmitter<any> = new EventEmitter();
35
+
36
+ configProps$: SelectableCardProps;
37
+ readOnly = false;
38
+ disabled = false;
39
+ radioBtnValue;
40
+ additionalProps;
41
+ showNoValue = false;
42
+ selectionKey?: string;
43
+ defaultStyle = {};
44
+ specialStyle = {};
45
+ cardStyle = {};
46
+ noLabelStyle: {};
47
+ selectedvalues: any;
48
+ selectionList: any;
49
+ primaryField: string;
50
+ commonProps: any = {};
51
+ contentList: [
52
+ {
53
+ commonCardProps: { id: string; key: string; fields: any; label: string; selected: boolean };
54
+ cardImage: { src: string; alt: string; style: any };
55
+ }
56
+ ];
57
+
58
+ override ngOnInit(): void {
59
+ super.ngOnInit();
60
+
61
+ // styles used in displaying common field props
62
+ this.defaultStyle = {
63
+ display: 'grid',
64
+ gridTemplateColumns: '1fr 1fr',
65
+ margin: '0.5rem',
66
+ wordBreak: 'break-word',
67
+ fontSize: '0.875rem'
68
+ };
69
+ this.specialStyle = {
70
+ margin: '0.5rem',
71
+ fontSize: '0.875rem'
72
+ };
73
+ this.noLabelStyle = {
74
+ alignItems: 'start',
75
+ marginLeft: '0.5rem'
76
+ };
77
+ }
78
+
79
+ override updateSelf(): void {
80
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as SelectableCardProps;
81
+
82
+ const hideFieldLabels = this.configProps$.hideFieldLabels;
83
+ const datasource: any = this.configProps$.datasource;
84
+ const additionalProps: any = this.configProps$.additionalProps;
85
+ const imageSize: string = this.configProps$.imageSize ?? ''; // not using
86
+ const showImageDescription: boolean = this.configProps$.showImageDescription ?? false;
87
+ let recordKey = '';
88
+ let cardLabel = '';
89
+ let image: any;
90
+
91
+ this.disabled = this.configProps$.disabled;
92
+ this.readOnly = this.configProps$.renderMode === 'ReadOnly' || this.displayMode$ === 'DISPLAY_ONLY' || this.configProps$.readOnly;
93
+ const imagePosition = this.configProps$.imagePosition;
94
+
95
+ // dynamic styling based on image position and readOnly option
96
+ let imageWidth = '100%';
97
+ this.cardStyle = { display: 'flex', flexDirection: 'column', height: '100%' };
98
+ if (imagePosition && imagePosition !== 'block-start') {
99
+ imageWidth = '30%';
100
+ if (imagePosition === 'inline-start') {
101
+ this.cardStyle = { display: 'flex', flexDirection: 'row', alignItems: this.readOnly ? 'center' : '' };
102
+ } else if (imagePosition === 'inline-end') {
103
+ this.cardStyle = {
104
+ display: 'flex',
105
+ flexDirection: 'row-reverse',
106
+ justifyContent: this.readOnly ? 'space-between' : '',
107
+ alignItems: this.readOnly ? 'center' : ''
108
+ };
109
+ }
110
+ }
111
+ if (this.type === 'radio') {
112
+ const stateProps = this.pConn$.getStateProps();
113
+ image = {
114
+ imagePosition,
115
+ imageSize,
116
+ showImageDescription,
117
+ imageField: stateProps.image?.split('.').pop(),
118
+ imageDescription: stateProps.imageDescription?.split('.').pop()
119
+ };
120
+
121
+ recordKey = stateProps.value?.split('.').pop() ?? '';
122
+ cardLabel = stateProps.primaryField?.split('.').pop() ?? '';
123
+
124
+ this.value$ = this.configProps$.value;
125
+ this.radioBtnValue = this.value$;
126
+ }
127
+
128
+ if (this.type === 'checkbox') {
129
+ this.testId = this.configProps$.testId;
130
+ this.displayMode$ = this.configProps$.displayMode ?? '';
131
+
132
+ this.selectionKey = this.configProps$.selectionKey;
133
+ recordKey = this.selectionKey?.split('.').pop() ?? '';
134
+ cardLabel = this.configProps$.primaryField.split('.').pop() ?? '';
135
+
136
+ image = {
137
+ imagePosition,
138
+ imageSize,
139
+ showImageDescription,
140
+ imageField: this.configProps$.image?.split('.').pop(),
141
+ imageDescription: (this.pConn$?.getRawMetadata()?.config as any).imageDescription?.split('.').pop()
142
+ };
143
+
144
+ this.selectionList = this.configProps$.selectionList;
145
+ this.selectedvalues = this.configProps$.readonlyContextList;
146
+ this.showNoValue = this.readOnly && this.selectedvalues?.length === 0; // not used
147
+ this.primaryField = this.configProps$.primaryField;
148
+ }
149
+
150
+ this.commonProps = { hideFieldLabels, datasource, additionalProps, image, recordKey, cardLabel, radioBtnValue: this.radioBtnValue ?? '' };
151
+ const imageDescriptionKey = this.commonProps?.image?.showImageDescription ? this.commonProps?.image?.imageDescription : undefined;
152
+ const cardDataSource = this.readOnly || this.displayMode$ == 'DISPLAY_ONLY' ? this.selectedvalues || [] : this.commonProps?.datasource?.source;
153
+
154
+ this.contentList = cardDataSource.map(item => {
155
+ const resolvedFields = this.utils.resolveReferenceFields(item, this.commonProps.hideFieldLabels, this.commonProps.recordKey, this.pConn$);
156
+ const commonCardProps = {
157
+ id: item[this.commonProps.recordKey],
158
+ key: item[this.commonProps.recordKey],
159
+ fields: resolvedFields,
160
+ label: item[this.commonProps.cardLabel],
161
+ selected: this.selectedvalues
162
+ ? this.selectedvalues?.some?.(data => data[this.commonProps.recordKey] === item[this.commonProps.recordKey])
163
+ : false
164
+ };
165
+ const cardImage = item[this.commonProps.image.imageField]
166
+ ? {
167
+ src: item[this.commonProps.image.imageField],
168
+ alt: this.commonProps.image.showImageDescription && imageDescriptionKey ? item[imageDescriptionKey] : '',
169
+ style: {
170
+ width: imageWidth,
171
+ backgroundColor: 'transparent',
172
+ aspectRatio: '16/9',
173
+ maxHeight: '100%',
174
+ objectFit: 'contain',
175
+ maxWidth: '100%',
176
+ height: this.readOnly && imagePosition !== 'block-start' ? '5rem' : ''
177
+ }
178
+ }
179
+ : undefined;
180
+
181
+ return { cardImage, commonCardProps };
182
+ });
183
+ }
184
+
185
+ fieldOnChange(value: any) {
186
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
187
+ }
188
+
189
+ fieldOnBlur() {
190
+ this.pConn$.getValidationApi().validate(this.selectedvalues, this.selectionList);
191
+ }
192
+
193
+ handleChangeMultiMode(event, element) {
194
+ if (!element.selected) {
195
+ insertInstruction(this.pConn$, this.selectionList, this.selectionKey, this.primaryField, {
196
+ id: element.id,
197
+ primary: element.label
198
+ });
199
+ } else {
200
+ deleteInstruction(this.pConn$, this.selectionList, this.selectionKey, {
201
+ id: element.key,
202
+ primary: element.label
203
+ });
204
+ }
205
+ this.pConn$.clearErrorMessages({
206
+ property: this.selectionList,
207
+ category: '',
208
+ context: ''
209
+ });
210
+ }
211
+
212
+ cardSelect(event, element) {
213
+ if (this.type === 'radio') {
214
+ this.fieldOnChange(element.key);
215
+ } else if (this.type === 'checkbox') {
216
+ this.handleChangeMultiMode(event, element);
217
+ }
218
+ }
219
+ }
@@ -1,10 +1,6 @@
1
- <div *ngIf="displayMode$; else noDisplayMode">
2
- <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
1
+ <div *ngIf="bVisible$ !== false">
2
+ <a *ngIf="!isLinkTextEmpty; else noLink" class="psdk-value" href="#" (click)="openLinkClick($event)">{{ value$ || '---' }}</a>
3
3
  </div>
4
-
5
- <ng-template #noDisplayMode>
6
- <div *ngIf="label$ !== undefined && bVisible$ !== false" class="psdk-grid-filter">
7
- <div class="psdk-grid-label">{{ label$ }}</div>
8
- <div class="psdk-value">{{ value$ || '---' }}</div>
9
- </div>
4
+ <ng-template #noLink>
5
+ <div class="psdk-value">{{ value$ || '---' }}</div>
10
6
  </ng-template>
@@ -1,16 +1,3 @@
1
- .psdk-grid-filter {
2
- display: grid;
3
- grid-template-columns: repeat(2, minmax(0, 1fr));
4
- column-gap: calc(2 * 0.5rem);
5
- row-gap: calc(2 * 0.5rem);
6
- align-items: start;
7
- }
8
-
9
- .psdk-label {
10
- color: var(--app-label-color);
11
- margin: 8px 0px;
12
- }
13
-
14
1
  .psdk-value {
15
2
  margin: 8px 0px;
16
3
  }