@pega/angular-sdk-overrides 24.2.10 → 25.1.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 (257) 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 +0 -1
  4. package/lib/designSystemExtension/banner/banner.component.html +1 -1
  5. package/lib/designSystemExtension/banner/banner.component.scss +17 -3
  6. package/lib/designSystemExtension/banner/banner.component.ts +0 -1
  7. package/lib/designSystemExtension/case-create-stage/case-create-stage.component.ts +0 -1
  8. package/lib/designSystemExtension/field-group/field-group.component.ts +0 -1
  9. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +6 -3
  10. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +5 -34
  11. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -2
  12. package/lib/designSystemExtension/material-details/material-details.component.scss +0 -5
  13. package/lib/designSystemExtension/material-details/material-details.component.ts +0 -1
  14. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +3 -3
  15. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +4 -3
  16. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +6 -1
  17. package/lib/designSystemExtension/material-summary-item/material-summary-item.component.scss +4 -17
  18. package/lib/designSystemExtension/material-summary-item/material-summary-item.component.ts +0 -1
  19. package/lib/designSystemExtension/material-summary-list/material-summary-list.component.ts +0 -1
  20. package/lib/designSystemExtension/material-utility/material-utility.component.scss +1 -2
  21. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.scss +1 -1
  22. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.ts +0 -1
  23. package/lib/designSystemExtension/operator/operator.component.html +2 -2
  24. package/lib/designSystemExtension/operator/operator.component.scss +13 -12
  25. package/lib/designSystemExtension/operator/operator.component.ts +4 -5
  26. package/lib/designSystemExtension/pulse/pulse.component.scss +2 -2
  27. package/lib/designSystemExtension/pulse/pulse.component.ts +0 -1
  28. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.html +4 -17
  29. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +0 -1
  30. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.ts +30 -1
  31. package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.scss +16 -9
  32. package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.ts +0 -1
  33. package/lib/field/auto-complete/auto-complete.component.html +0 -2
  34. package/lib/field/auto-complete/auto-complete.component.ts +48 -173
  35. package/lib/field/cancel-alert/cancel-alert.component.html +8 -12
  36. package/lib/field/cancel-alert/cancel-alert.component.scss +2 -3
  37. package/lib/field/cancel-alert/cancel-alert.component.ts +24 -37
  38. package/lib/field/check-box/check-box.component.html +17 -6
  39. package/lib/field/check-box/check-box.component.scss +0 -1
  40. package/lib/field/check-box/check-box.component.ts +25 -151
  41. package/lib/field/currency/currency.component.ts +54 -181
  42. package/lib/field/date/date.component.html +4 -3
  43. package/lib/field/date/date.component.ts +30 -151
  44. package/lib/field/date-time/date-time.component.html +2 -2
  45. package/lib/field/date-time/date-time.component.ts +47 -148
  46. package/lib/field/decimal/decimal.component.html +1 -0
  47. package/lib/field/decimal/decimal.component.ts +61 -164
  48. package/lib/field/dropdown/dropdown.component.html +1 -0
  49. package/lib/field/dropdown/dropdown.component.ts +43 -152
  50. package/lib/field/email/email.component.ts +28 -158
  51. package/lib/field/field.base.ts +149 -0
  52. package/lib/field/group/group.component.ts +7 -5
  53. package/lib/field/integer/integer.component.html +1 -1
  54. package/lib/field/integer/integer.component.ts +30 -160
  55. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
  56. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +3 -3
  57. package/lib/field/location/config-ext.json +8 -0
  58. package/lib/field/location/location.component.html +45 -0
  59. package/lib/field/location/location.component.scss +18 -0
  60. package/lib/field/location/location.component.spec.ts +22 -0
  61. package/lib/field/location/location.component.ts +280 -0
  62. package/lib/field/multiselect/multiselect.component.ts +47 -152
  63. package/lib/field/multiselect/utils.ts +55 -47
  64. package/lib/field/object-reference/object-reference.component.html +17 -0
  65. package/lib/field/object-reference/object-reference.component.scss +0 -0
  66. package/lib/field/object-reference/object-reference.component.spec.ts +22 -0
  67. package/lib/field/object-reference/object-reference.component.ts +237 -0
  68. package/lib/field/percentage/percentage.component.html +1 -1
  69. package/lib/field/percentage/percentage.component.ts +62 -170
  70. package/lib/field/phone/config-ext.json +1 -1
  71. package/lib/field/phone/phone.component.html +18 -17
  72. package/lib/field/phone/phone.component.scss +4 -0
  73. package/lib/field/phone/phone.component.ts +47 -156
  74. package/lib/field/radio-buttons/radio-buttons.component.html +17 -12
  75. package/lib/field/radio-buttons/radio-buttons.component.scss +4 -2
  76. package/lib/field/radio-buttons/radio-buttons.component.ts +37 -160
  77. package/lib/field/rich-text/rich-text.component.html +2 -0
  78. package/lib/field/rich-text/rich-text.component.scss +172 -0
  79. package/lib/field/rich-text/rich-text.component.ts +32 -93
  80. package/lib/field/scalar-list/scalar-list.component.ts +17 -73
  81. package/lib/field/selectable-card/selectable-card.component.html +70 -0
  82. package/lib/field/selectable-card/selectable-card.component.scss +11 -0
  83. package/lib/field/selectable-card/selectable-card.component.spec.ts +22 -0
  84. package/lib/field/selectable-card/selectable-card.component.ts +219 -0
  85. package/lib/field/semantic-link/semantic-link.component.html +4 -8
  86. package/lib/field/semantic-link/semantic-link.component.scss +0 -13
  87. package/lib/field/semantic-link/semantic-link.component.ts +165 -6
  88. package/lib/field/text/text.component.scss +0 -1
  89. package/lib/field/text/text.component.ts +6 -5
  90. package/lib/field/text-area/text-area.component.html +4 -2
  91. package/lib/field/text-area/text-area.component.ts +30 -155
  92. package/lib/field/text-content/text-content.component.ts +0 -1
  93. package/lib/field/text-input/text-input.component.html +1 -1
  94. package/lib/field/text-input/text-input.component.ts +28 -158
  95. package/lib/field/time/time.component.html +2 -2
  96. package/lib/field/time/time.component.ts +34 -154
  97. package/lib/field/url/url.component.html +1 -1
  98. package/lib/field/url/url.component.ts +28 -157
  99. package/lib/field/user-reference/user-reference.component.html +40 -38
  100. package/lib/field/user-reference/user-reference.component.scss +0 -1
  101. package/lib/field/user-reference/user-reference.component.ts +70 -9
  102. package/lib/infra/Containers/flow-container/flow-container.component.html +2 -2
  103. package/lib/infra/Containers/flow-container/flow-container.component.ts +24 -51
  104. package/lib/infra/Containers/flow-container/helpers.ts +2 -2
  105. package/lib/infra/Containers/hybrid-view-container/hybrid-view-container.component.ts +0 -1
  106. package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
  107. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +5 -18
  108. package/lib/infra/Containers/view-container/helper.ts +35 -2
  109. package/lib/infra/Containers/view-container/view-container.component.ts +1 -2
  110. package/lib/infra/action-buttons/action-buttons.component.html +13 -8
  111. package/lib/infra/action-buttons/action-buttons.component.scss +23 -0
  112. package/lib/infra/action-buttons/action-buttons.component.ts +1 -3
  113. package/lib/infra/assignment/assignment.component.html +1 -1
  114. package/lib/infra/assignment/assignment.component.ts +100 -46
  115. package/lib/infra/assignment-card/assignment-card.component.html +2 -2
  116. package/lib/infra/assignment-card/assignment-card.component.scss +0 -4
  117. package/lib/infra/assignment-card/assignment-card.component.ts +21 -5
  118. package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
  119. package/lib/infra/defer-load/defer-load.component.html +6 -2
  120. package/lib/infra/defer-load/defer-load.component.ts +25 -12
  121. package/lib/infra/error-boundary/error-boundary.component.ts +0 -1
  122. package/lib/infra/multi-step/multi-step.component.html +22 -38
  123. package/lib/infra/multi-step/multi-step.component.scss +14 -27
  124. package/lib/infra/multi-step/multi-step.component.ts +0 -1
  125. package/lib/infra/navbar/navbar.component.html +36 -41
  126. package/lib/infra/navbar/navbar.component.scss +22 -4
  127. package/lib/infra/navbar/navbar.component.ts +8 -6
  128. package/lib/infra/reference/reference.component.ts +82 -90
  129. package/lib/infra/region/region.component.ts +0 -1
  130. package/lib/infra/root-container/root-container.component.html +2 -15
  131. package/lib/infra/root-container/root-container.component.scss +0 -1
  132. package/lib/infra/root-container/root-container.component.ts +25 -32
  133. package/lib/infra/stages/stages.component.html +4 -3
  134. package/lib/infra/stages/stages.component.scss +12 -36
  135. package/lib/infra/stages/stages.component.ts +4 -3
  136. package/lib/infra/view/view.component.html +1 -1
  137. package/lib/infra/view/view.component.ts +3 -7
  138. package/lib/template/advanced-search/advanced-search.component.html +12 -0
  139. package/lib/template/advanced-search/advanced-search.component.scss +0 -0
  140. package/lib/template/advanced-search/advanced-search.component.spec.ts +0 -0
  141. package/lib/template/advanced-search/advanced-search.component.ts +112 -0
  142. package/lib/template/advanced-search/advanced-search.service.ts +27 -0
  143. package/lib/template/advanced-search/search-group/persist-utils.ts +56 -0
  144. package/lib/template/advanced-search/search-groups/search-groups.component.html +32 -0
  145. package/lib/template/advanced-search/search-groups/search-groups.component.scss +0 -0
  146. package/lib/template/advanced-search/search-groups/search-groups.component.spec.ts +0 -0
  147. package/lib/template/advanced-search/search-groups/search-groups.component.ts +294 -0
  148. package/lib/template/advanced-search/search-groups/utils.ts +29 -0
  149. package/lib/template/app-shell/app-shell.component.html +4 -1
  150. package/lib/template/app-shell/app-shell.component.scss +0 -3
  151. package/lib/template/app-shell/app-shell.component.ts +46 -8
  152. package/lib/template/banner-page/banner-page.component.ts +0 -1
  153. package/lib/template/base/form-template-base.ts +6 -0
  154. package/lib/template/case-summary/case-summary.component.scss +0 -2
  155. package/lib/template/case-summary/case-summary.component.ts +6 -22
  156. package/lib/template/case-view/case-view.component.html +4 -4
  157. package/lib/template/case-view/case-view.component.scss +18 -10
  158. package/lib/template/case-view/case-view.component.ts +1 -11
  159. package/lib/template/confirmation/confirmation.component.html +2 -2
  160. package/lib/template/confirmation/confirmation.component.ts +0 -1
  161. package/lib/template/data-reference/data-reference.component.html +11 -8
  162. package/lib/template/data-reference/data-reference.component.ts +346 -113
  163. package/lib/template/data-reference/search-form/search-form.component.html +39 -0
  164. package/lib/template/data-reference/search-form/search-form.component.scss +11 -0
  165. package/lib/template/data-reference/search-form/search-form.component.spec.ts +0 -0
  166. package/lib/template/data-reference/search-form/search-form.component.ts +167 -0
  167. package/lib/template/data-reference/search-form/tabsData.ts +160 -0
  168. package/lib/template/data-reference/utils.ts +92 -0
  169. package/lib/template/default-form/default-form.component.ts +45 -5
  170. package/lib/template/default-page/default-page.component.html +34 -0
  171. package/lib/template/default-page/default-page.component.scss +31 -0
  172. package/lib/template/default-page/default-page.component.spec.ts +24 -0
  173. package/lib/template/default-page/default-page.component.ts +64 -0
  174. package/lib/template/details/details.component.ts +0 -1
  175. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +0 -1
  176. package/lib/template/details-one-column/details-one-column.component.ts +0 -1
  177. package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +0 -1
  178. package/lib/template/details-three-column/details-three-column.component.ts +0 -1
  179. package/lib/template/details-two-column/details-two-column.component.ts +0 -1
  180. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +0 -1
  181. package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +0 -1
  182. package/lib/template/field-group-list/field-group-list.component.scss +0 -1
  183. package/lib/template/field-group-list/field-group-list.component.ts +0 -1
  184. package/lib/template/field-group-template/field-group-template.component.html +7 -7
  185. package/lib/template/field-group-template/field-group-template.component.scss +8 -0
  186. package/lib/template/field-group-template/field-group-template.component.ts +64 -55
  187. package/lib/template/field-value-list/field-value-list.component.html +2 -2
  188. package/lib/template/field-value-list/field-value-list.component.scss +4 -0
  189. package/lib/template/field-value-list/field-value-list.component.ts +0 -1
  190. package/lib/template/inline-dashboard/inline-dashboard.component.ts +0 -1
  191. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +1 -2
  192. package/lib/template/list-page/list-page.component.ts +0 -1
  193. package/lib/template/list-view/list-view.component.html +170 -160
  194. package/lib/template/list-view/list-view.component.scss +25 -21
  195. package/lib/template/list-view/list-view.component.ts +208 -122
  196. package/lib/template/list-view/listViewHelpers.ts +3 -9
  197. package/lib/template/list-view/utils.ts +27 -7
  198. package/lib/template/multi-reference-readonly/multi-reference-readonly.component.ts +0 -1
  199. package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +0 -1
  200. package/lib/template/object-page/object-page.component.html +1 -0
  201. package/lib/template/object-page/object-page.component.scss +0 -0
  202. package/lib/template/object-page/object-page.component.spec.ts +22 -0
  203. package/lib/template/object-page/object-page.component.ts +14 -0
  204. package/lib/template/one-column/one-column.component.ts +0 -1
  205. package/lib/template/one-column-page/one-column-page.component.ts +0 -1
  206. package/lib/template/one-column-tab/one-column-tab.component.scss +1 -1
  207. package/lib/template/one-column-tab/one-column-tab.component.ts +0 -1
  208. package/lib/template/page/page.component.ts +0 -1
  209. package/lib/template/promoted-filters/promoted-filters.component.ts +0 -1
  210. package/lib/template/repeating-structures/repeating-structures.component.ts +0 -2
  211. package/lib/template/self-service-case-view/self-service-case-view.component.html +78 -0
  212. package/lib/template/self-service-case-view/self-service-case-view.component.scss +132 -0
  213. package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +24 -0
  214. package/lib/template/self-service-case-view/self-service-case-view.component.ts +207 -0
  215. package/lib/template/simple-table/simple-table.component.ts +0 -2
  216. package/lib/template/simple-table-manual/helpers.ts +126 -10
  217. package/lib/template/simple-table-manual/simple-table-manual.component.html +27 -8
  218. package/lib/template/simple-table-manual/simple-table-manual.component.scss +15 -17
  219. package/lib/template/simple-table-manual/simple-table-manual.component.ts +103 -45
  220. package/lib/template/simple-table-select/simple-table-select.component.ts +0 -1
  221. package/lib/template/single-reference-readonly/single-reference-readonly.component.html +4 -1
  222. package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +21 -0
  223. package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +104 -4
  224. package/lib/template/sub-tabs/sub-tabs.component.ts +0 -1
  225. package/lib/template/three-column/three-column.component.ts +0 -1
  226. package/lib/template/three-column-page/three-column-page.component.ts +0 -1
  227. package/lib/template/two-column/two-column.component.ts +0 -1
  228. package/lib/template/two-column-page/two-column-page.component.ts +0 -1
  229. package/lib/template/two-column-tab/two-column-tab.component.ts +0 -1
  230. package/lib/template/utils.ts +58 -0
  231. package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +0 -1
  232. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +0 -1
  233. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +6 -5
  234. package/lib/template/wss-nav-bar/wss-nav-bar.component.scss +8 -17
  235. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +1 -9
  236. package/lib/widget/app-announcement/app-announcement.component.html +1 -2
  237. package/lib/widget/app-announcement/app-announcement.component.scss +2 -2
  238. package/lib/widget/app-announcement/app-announcement.component.ts +0 -1
  239. package/lib/widget/attachment/Attachment.types.ts +92 -0
  240. package/lib/widget/attachment/AttachmentUtils.ts +287 -0
  241. package/lib/widget/attachment/attachment.component.html +3 -3
  242. package/lib/widget/attachment/attachment.component.scss +9 -12
  243. package/lib/widget/attachment/attachment.component.ts +267 -254
  244. package/lib/widget/case-history/case-history.component.ts +0 -1
  245. package/lib/widget/feed-container/feed-container.component.scss +3 -9
  246. package/lib/widget/feed-container/feed-container.component.ts +2 -5
  247. package/lib/widget/file-utility/file-utility.component.html +3 -3
  248. package/lib/widget/file-utility/file-utility.component.scss +6 -17
  249. package/lib/widget/file-utility/file-utility.component.ts +24 -9
  250. package/lib/widget/list-utility/list-utility.component.scss +4 -5
  251. package/lib/widget/list-utility/list-utility.component.ts +0 -1
  252. package/lib/widget/quick-create/quick-create.component.ts +41 -23
  253. package/lib/widget/todo/todo.component.html +12 -10
  254. package/lib/widget/todo/todo.component.scss +20 -10
  255. package/lib/widget/todo/todo.component.ts +11 -7
  256. package/lib/widget/utility/utility.component.ts +0 -1
  257. package/package.json +1 -1
@@ -1,19 +1,19 @@
1
- import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, forwardRef } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
- import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
3
+ import { FormControl, ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
- import { interval } from 'rxjs';
7
6
  import { NgxCurrencyDirective, NgxCurrencyInputMode } from 'ngx-currency';
8
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
9
- import { Utils } from '@pega/angular-sdk-components';
7
+
8
+ import { FieldBase } from '@pega/angular-sdk-components';
10
9
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
10
  import { handleEvent } from '@pega/angular-sdk-components';
12
11
  import { getCurrencyCharacters } from '@pega/angular-sdk-components';
13
- import { PConnFieldProps } from '@pega/angular-sdk-components';
14
12
  import { format } from '@pega/angular-sdk-components';
13
+ import { PConnFieldProps } from '@pega/angular-sdk-components';
15
14
 
16
- interface PercentageProps extends PConnFieldProps {
15
+ interface PercentageProps extends Omit<PConnFieldProps, 'value'> {
16
+ value?: number;
17
17
  showGroupSeparators?: string;
18
18
  decimalPrecision?: number;
19
19
  currencyISOCode?: string;
@@ -24,197 +24,89 @@ interface PercentageProps extends PConnFieldProps {
24
24
  selector: 'app-percentage',
25
25
  templateUrl: './percentage.component.html',
26
26
  styleUrls: ['./percentage.component.scss'],
27
- standalone: true,
28
27
  imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, NgxCurrencyDirective, forwardRef(() => ComponentMapperComponent)]
29
28
  })
30
- export class PercentageComponent implements OnInit, OnDestroy {
31
- @Input() pConn$: typeof PConnect;
32
- @Input() formGroup$: FormGroup;
33
-
34
- // Used with AngularPConnect
35
- angularPConnectData: AngularPConnectData = {};
29
+ export class PercentageComponent extends FieldBase {
36
30
  configProps$: PercentageProps;
31
+ override fieldControl = new FormControl<number | null>(null, null);
37
32
 
38
- label$ = '';
39
- value$: number;
40
- bRequired$ = false;
41
- bReadonly$ = false;
42
- bDisabled$ = false;
43
- bVisible$ = true;
44
- displayMode$?: string = '';
45
- controlName$: string;
46
- bHasForm$ = true;
47
- componentReference = '';
48
- testId: string;
49
- helperText: string;
50
- placeholder: string;
51
33
  decimalSeparator: string;
52
34
  thousandSeparator: string;
53
- inputMode: any;
35
+ inputMode: any = NgxCurrencyInputMode.Natural;
54
36
  decimalPrecision: number | undefined;
55
- fieldControl = new FormControl<number | null>(null, null);
56
- actionsApi: Object;
57
- propName: string;
58
37
  formattedValue: string;
59
38
 
60
- constructor(
61
- private angularPConnect: AngularPConnectService,
62
- private cdRef: ChangeDetectorRef,
63
- private utils: Utils
64
- ) {}
65
-
66
- ngOnInit(): void {
67
- // First thing in initialization is registering and subscribing to the AngularPConnect service
68
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
69
- this.controlName$ = this.angularPConnect.getComponentID(this);
70
-
71
- // Then, continue on with other initialization
72
- // call updateSelf when initializing
73
- // this.updateSelf();
74
- this.checkAndUpdate();
75
-
76
- if (this.formGroup$) {
77
- // add control to formGroup
78
- this.formGroup$.addControl(this.controlName$, this.fieldControl);
79
- this.fieldControl.setValue(this.value$);
80
- this.bHasForm$ = true;
81
- } else {
82
- this.bReadonly$ = true;
83
- this.bHasForm$ = false;
84
- }
85
- }
39
+ /**
40
+ * Updates the component when there are changes in the state.
41
+ */
42
+ override updateSelf(): void {
43
+ // Resolve configuration properties
44
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as PercentageProps;
86
45
 
87
- ngOnDestroy(): void {
88
- if (this.formGroup$) {
89
- this.formGroup$.removeControl(this.controlName$);
90
- }
46
+ // Update component common properties
47
+ this.updateComponentCommonProperties(this.configProps$);
91
48
 
92
- if (this.angularPConnectData.unsubscribeFn) {
93
- this.angularPConnectData.unsubscribeFn();
49
+ // Set component specific properties
50
+ const { value } = this.configProps$;
51
+ if (value) {
52
+ this.value$ = value;
53
+ this.fieldControl.setValue(value);
94
54
  }
95
- }
96
-
97
- // Callback passed when subscribing to store change
98
- onStateChange() {
99
- this.checkAndUpdate();
100
- }
101
-
102
- checkAndUpdate() {
103
- // Should always check the bridge to see if the component should
104
- // update itself (re-render)
105
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
106
55
 
107
- // ONLY call updateSelf when the component should update
108
- if (bUpdateSelf) {
109
- this.updateSelf();
110
- }
56
+ // update percentage properties
57
+ this.updatePercentageProperties(this.configProps$);
111
58
  }
112
59
 
113
- // updateSelf
114
- updateSelf(): void {
115
- // moved this from ngOnInit() and call this from there instead...
116
- this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as PercentageProps;
117
- this.testId = this.configProps$.testId;
118
- this.label$ = this.configProps$.label;
119
- this.displayMode$ = this.configProps$.displayMode;
120
- this.inputMode = NgxCurrencyInputMode.Natural;
121
- const nValue: any = this.configProps$.value;
122
- if (nValue) {
123
- this.value$ = nValue;
124
- this.fieldControl.setValue(nValue);
125
- }
126
- this.helperText = this.configProps$.helperText;
127
- this.placeholder = this.configProps$.placeholder || '';
128
- const showGroupSeparators = this.configProps$.showGroupSeparators;
60
+ /**
61
+ * Updates the percentage properties
62
+ *
63
+ * @param {Object} configProps - Configuration properties.
64
+ * @param {boolean} configProps.showGroupSeparators - Whether to show group separators.
65
+ * @param {number} configProps.decimalPrecision - The number of decimal places to display.
66
+ */
67
+ updatePercentageProperties(configProps): void {
68
+ const { showGroupSeparators, decimalPrecision } = configProps;
129
69
 
130
70
  const theSymbols = getCurrencyCharacters('');
131
71
  this.decimalSeparator = theSymbols.theDecimalIndicator;
132
72
  this.thousandSeparator = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
73
+ this.decimalPrecision = decimalPrecision ?? 2;
133
74
 
134
- this.actionsApi = this.pConn$.getActionsApi();
135
- this.propName = this.pConn$.getStateProps().value;
136
-
137
- if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
138
- this.formattedValue = nValue ? format(nValue, 'percentage') : '';
139
- }
140
-
141
- // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
142
- setTimeout(() => {
143
- if (this.configProps$.required != null) {
144
- this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
145
- }
146
- this.cdRef.detectChanges();
147
- });
148
-
149
- if (this.configProps$.visibility != null) {
150
- this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
151
- }
152
-
153
- // disabled
154
- if (this.configProps$.disabled != undefined) {
155
- this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
75
+ if (['DISPLAY_ONLY', 'STACKED_LARGE_VAL'].includes(this.displayMode$)) {
76
+ this.formattedValue = this.value$ ? format(this.value$, 'percentage') : '';
156
77
  }
78
+ }
157
79
 
158
- if (this.bDisabled$) {
159
- this.fieldControl.disable();
160
- } else {
161
- this.fieldControl.enable();
162
- }
163
-
164
- if (this.configProps$.readOnly != null) {
165
- this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
166
- }
167
-
168
- this.decimalPrecision = this.configProps$?.decimalPrecision ?? 2;
169
-
170
- this.componentReference = this.pConn$.getStateProps().value;
80
+ fieldOnChange(event: any) {
81
+ const oldVal = this.value$ ?? '';
82
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
171
83
 
172
- // trigger display of error message with field control
173
- if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
174
- const timer = interval(100).subscribe(() => {
175
- this.fieldControl.setErrors({ message: true });
176
- this.fieldControl.markAsTouched();
177
- timer.unsubscribe();
84
+ if (isValueChanged) {
85
+ this.pConn$.clearErrorMessages({
86
+ property: this.propName
178
87
  });
179
88
  }
180
89
  }
181
90
 
182
- fieldOnChange() {
183
- this.pConn$.clearErrorMessages({
184
- property: this.propName
185
- });
186
- }
187
-
188
91
  fieldOnBlur(event: any) {
189
- let value = event?.target?.value;
190
- value = value ? value.replace(/%/g, '') : '';
191
- // replacing thousand separator with empty string as not required in api call
192
- if (this.configProps$.showGroupSeparators) {
193
- const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
194
- const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
195
- value = value?.replace(regExp, '');
196
- }
197
- // replacing decimal separator with '.'
198
- if (this.decimalSeparator !== '.') {
199
- const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
200
- value = value.replace(regExp, '.');
201
- }
202
- handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
203
- }
204
-
205
- getErrorMessage() {
206
- // field control gets error message from here
207
- let errMessage = '';
208
- // look for validation messages for json, pre-defined or just an error pushed from workitem (400)
209
- if (this.fieldControl.hasError('message')) {
210
- errMessage = this.angularPConnectData.validateMessage ?? '';
211
- return errMessage;
212
- }
213
- if (this.fieldControl.hasError('required')) {
214
- errMessage = 'You must enter a value';
215
- } else if (this.fieldControl.errors) {
216
- errMessage = this.fieldControl.errors.toString();
92
+ const oldVal = this.value$ ?? '';
93
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
94
+
95
+ if (isValueChanged) {
96
+ let value = event?.target?.value;
97
+ value = value ? value.replace(/%/g, '') : '';
98
+ // replacing thousand separator with empty string as not required in api call
99
+ if (this.configProps$.showGroupSeparators) {
100
+ const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
101
+ const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
102
+ value = value?.replace(regExp, '');
103
+ }
104
+ // replacing decimal separator with '.'
105
+ if (this.decimalSeparator !== '.') {
106
+ const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
107
+ value = value.replace(regExp, '.');
108
+ }
109
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
217
110
  }
218
- return errMessage;
219
111
  }
220
112
  }
@@ -3,6 +3,6 @@
3
3
  "label": "Phone",
4
4
  "description": "Phone",
5
5
  "type": "Field",
6
- "subtype": "DATA_CAPTURE",
6
+ "subtype": "Text-Phone",
7
7
  "properties": []
8
8
  }
@@ -2,23 +2,24 @@
2
2
  <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
3
3
  </div>
4
4
  <ng-template #noDisplayMode>
5
- <div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
6
- <div #f="ngForm" [formGroup]="formGroup$" *ngIf="bVisible$">
7
- <mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
8
- <ngx-mat-intl-tel-input
9
- [attr.data-test-id]="testId"
10
- [formControl]="fieldControl"
11
- [preferredCountries]="['us']"
12
- [enablePlaceholder]="true"
13
- [enableSearch]="true"
14
- (change)="fieldOnChange()"
15
- (blur)="fieldOnBlur()"
16
- >
17
- </ngx-mat-intl-tel-input>
18
- <mat-label>{{ label$ }}</mat-label>
19
- <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
20
- </mat-form-field>
21
- </div>
5
+ <div *ngIf="bHasForm$ && bVisible$; else noEdit">
6
+ <mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText" floatLabel="always">
7
+ <mat-tel-input
8
+ [attr.data-test-id]="testId"
9
+ [formControl]="fieldControl"
10
+ [preferredCountries]="preferredCountries"
11
+ [enablePlaceholder]="true"
12
+ [enableSearch]="true"
13
+ [placeholder]="placeholder"
14
+ [required]="bRequired$"
15
+ [disabled]="bDisabled$ || bReadonly$"
16
+ (change)="fieldOnChange()"
17
+ (blur)="fieldOnBlur()"
18
+ >
19
+ </mat-tel-input>
20
+ <mat-label>{{ label$ }}</mat-label>
21
+ <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
22
+ </mat-form-field>
22
23
  </div>
23
24
  </ng-template>
24
25
  <ng-template #noEdit>
@@ -24,6 +24,10 @@
24
24
  font-size: 0.7rem;
25
25
  }
26
26
 
27
+ ::ng-deep .mat-mdc-menu-panel {
28
+ max-width: 20rem;
29
+ }
30
+
27
31
  // ::ng-deep .iti {
28
32
  // display: block !important;
29
33
  // margin-bottom: 20px;
@@ -1,13 +1,13 @@
1
- import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, forwardRef } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
- import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
3
+ import { ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatFormFieldModule } from '@angular/material/form-field';
5
- import { interval } from 'rxjs';
6
- import { NgxMatIntlTelInputComponent } from 'ngx-mat-intl-tel-input';
7
- import { Utils } from '@pega/angular-sdk-components';
8
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
9
- import { handleEvent } from '@pega/angular-sdk-components';
5
+ import { MatTelInput } from 'mat-tel-input';
6
+ import { parsePhoneNumberFromString } from 'libphonenumber-js';
7
+
8
+ import { FieldBase } from '@pega/angular-sdk-components';
10
9
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
10
+ import { handleEvent } from '@pega/angular-sdk-components';
11
11
  import { PConnFieldProps } from '@pega/angular-sdk-components';
12
12
 
13
13
  interface PhoneProps extends PConnFieldProps {
@@ -18,150 +18,29 @@ interface PhoneProps extends PConnFieldProps {
18
18
  selector: 'app-phone',
19
19
  templateUrl: './phone.component.html',
20
20
  styleUrls: ['./phone.component.scss'],
21
- standalone: true,
22
- imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, NgxMatIntlTelInputComponent, forwardRef(() => ComponentMapperComponent)]
21
+ imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatTelInput, forwardRef(() => ComponentMapperComponent)]
23
22
  })
24
- export class PhoneComponent implements OnInit, OnDestroy {
25
- @Input() pConn$: typeof PConnect;
26
- @Input() formGroup$: FormGroup;
27
-
28
- // Used with AngularPConnect
29
- angularPConnectData: AngularPConnectData = {};
23
+ export class PhoneComponent extends FieldBase {
30
24
  configProps$: PhoneProps;
31
25
 
32
- label$ = '';
33
- value$: string;
34
- bRequired$ = false;
35
- bReadonly$ = false;
36
- bDisabled$ = false;
37
- bVisible$ = true;
38
- displayMode$?: string = '';
39
- controlName$: string;
40
- bHasForm$ = true;
41
- componentReference = '';
42
- testId: string;
43
- separateDialCode = false;
44
- afterBlur: boolean;
45
- helperText: string;
46
-
47
- fieldControl = new FormControl('', null);
48
-
49
- phoneForm = new FormGroup({
50
- phone: new FormControl<string | null>(null)
51
- });
52
-
53
- actionsApi: Object;
54
- propName: string;
55
-
56
- constructor(
57
- private angularPConnect: AngularPConnectService,
58
- private cdRef: ChangeDetectorRef,
59
- private utils: Utils
60
- ) {}
61
-
62
- ngOnInit(): void {
63
- // First thing in initialization is registering and subscribing to the AngularPConnect service
64
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
65
- this.controlName$ = this.angularPConnect.getComponentID(this);
66
-
67
- // Then, continue on with other initialization
68
-
69
- // call updateSelf when initializing
70
- // this.updateSelf();
71
- this.checkAndUpdate();
72
-
73
- if (this.formGroup$) {
74
- // add control to formGroup
75
- this.formGroup$.addControl(this.controlName$, this.fieldControl);
76
- this.fieldControl.setValue(this.value$);
77
- this.bHasForm$ = true;
78
- } else {
79
- this.bReadonly$ = true;
80
- this.bHasForm$ = false;
81
- }
82
- }
83
-
84
- ngOnDestroy(): void {
85
- if (this.formGroup$) {
86
- this.formGroup$.removeControl(this.controlName$);
87
- }
88
-
89
- if (this.angularPConnectData.unsubscribeFn) {
90
- this.angularPConnectData.unsubscribeFn();
91
- }
92
- }
93
-
94
- // Callback passed when subscribing to store change
95
- onStateChange() {
96
- this.checkAndUpdate();
97
- }
98
-
99
- checkAndUpdate() {
100
- // Should always check the bridge to see if the component should
101
- // update itself (re-render)
102
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
26
+ preferredCountries: string[] = ['us'];
103
27
 
104
- // ONLY call updateSelf when the component should update
105
- if (bUpdateSelf) {
106
- this.updateSelf();
107
- }
108
- }
109
-
110
- // updateSelf
111
- updateSelf(): void {
112
- // moved this from ngOnInit() and call this from there instead...
28
+ /**
29
+ * Updates the component when there are changes in the state.
30
+ */
31
+ override updateSelf(): void {
32
+ // Resolve config properties
113
33
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as PhoneProps;
114
34
 
115
- this.label$ = this.configProps$.label;
116
- this.displayMode$ = this.configProps$.displayMode;
117
- this.testId = this.configProps$.testId;
118
- if (this.configProps$.value != undefined) {
119
- this.value$ = this.configProps$.value;
120
- }
121
- this.helperText = this.configProps$.helperText;
122
-
123
- this.actionsApi = this.pConn$.getActionsApi();
124
- this.propName = this.pConn$.getStateProps().value;
125
-
126
- // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
127
- setTimeout(() => {
128
- if (this.configProps$.required != null) {
129
- this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
130
- }
131
- this.cdRef.detectChanges();
132
- });
133
-
134
- if (this.configProps$.visibility != null) {
135
- this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
136
- }
137
-
138
- // disabled
139
- if (this.configProps$.disabled != undefined) {
140
- this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
141
- }
35
+ // Update component common properties
36
+ this.updateComponentCommonProperties(this.configProps$);
142
37
 
143
- if (this.bDisabled$) {
144
- this.fieldControl.disable();
145
- } else {
146
- this.fieldControl.enable();
147
- }
148
-
149
- if (this.configProps$.readOnly != null) {
150
- this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
151
- }
152
-
153
- if (this.bReadonly$) {
154
- this.phoneForm.setValue({ phone: this.value$ });
155
- }
156
-
157
- // trigger display of error message with field control
158
- if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
159
- const timer = interval(100).subscribe(() => {
160
- this.fieldControl.setErrors({ message: true });
161
- this.fieldControl.markAsTouched();
162
-
163
- timer.unsubscribe();
164
- });
38
+ // Extract and normalize the value property
39
+ const { value } = this.configProps$;
40
+ if (value) {
41
+ this.value$ = value;
42
+ this.fieldControl.setValue(this.value$);
43
+ this.updatePreferredCountries();
165
44
  }
166
45
  }
167
46
 
@@ -170,27 +49,39 @@ export class PhoneComponent implements OnInit, OnDestroy {
170
49
  }
171
50
 
172
51
  fieldOnChange() {
173
- if (this.formGroup$.controls[this.controlName$].value) {
174
- const value = this.formGroup$.controls[this.controlName$].value;
175
- this.afterBlur = true;
176
- handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
52
+ const oldVal = this.value$ ?? '';
53
+ const newVal = this.formGroup$.controls[this.controlName$].value;
54
+ const isValueChanged = newVal?.toString() !== oldVal.toString();
55
+
56
+ if (isValueChanged) {
57
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, newVal);
177
58
  }
178
59
  }
179
60
 
180
- getErrorMessage() {
181
- let errMessage = '';
61
+ updatePreferredCountries() {
62
+ if (this.value$ && typeof this.value$ === 'string') {
63
+ const phoneNumber = parsePhoneNumberFromString(this.value$);
64
+ this.preferredCountries =
65
+ phoneNumber?.country && !this.preferredCountries.includes(phoneNumber?.country.toLowerCase())
66
+ ? [phoneNumber?.country?.toLowerCase(), ...this.preferredCountries]
67
+ : this.preferredCountries;
68
+ }
69
+ }
182
70
 
71
+ override getErrorMessage() {
183
72
  // look for validation messages for json, pre-defined or just an error pushed from workitem (400)
184
73
  if (this.fieldControl.hasError('message')) {
185
- errMessage = this.angularPConnectData.validateMessage ?? '';
186
- return errMessage;
74
+ return this.angularPConnectData.validateMessage ?? '';
187
75
  }
76
+
188
77
  if (this.fieldControl.hasError('required')) {
189
- errMessage = 'You must enter a value';
190
- } else if (this.fieldControl.errors) {
191
- errMessage = 'Invalid Phone';
78
+ return 'You must enter a value';
79
+ }
80
+
81
+ if (this.fieldControl.errors) {
82
+ return 'Invalid Phone';
192
83
  }
193
84
 
194
- return errMessage;
85
+ return '';
195
86
  }
196
87
  }
@@ -1,18 +1,17 @@
1
- <div *ngIf="displayMode$; else noDisplayMode">
2
- <component-mapper
3
- *ngIf="bVisible$ !== false"
4
- name="FieldValueList"
5
- [props]="{ label$, value$: this.localizedValue, displayMode$ }"
6
- ></component-mapper>
1
+ <div *ngIf="variant !== 'card'; else cardMode">
2
+ <div *ngIf="displayMode$; else noDisplayMode">
3
+ <component-mapper
4
+ *ngIf="bVisible$ !== false"
5
+ name="FieldValueList"
6
+ [props]="{ label$, value$: this.localizedValue, displayMode$ }"
7
+ ></component-mapper>
8
+ </div>
7
9
  </div>
8
10
  <ng-template #noDisplayMode>
9
11
  <div [formGroup]="formGroup$" *ngIf="bVisible$">
10
12
  <mat-form-field class="psdk-radio-form" subscriptSizing="dynamic" [hintLabel]="helperText">
11
- <span class="psdk-label-wrapper-readonly">
12
- <label class="psdk-label-readonly">{{ label$ }}</label>
13
- </span>
14
- <!-- <mat-label>{{label$}}</mat-label> -->
15
- <input matInput [placeholder]="placeholder" style="display: none" />
13
+ <mat-label>{{ label$ }}</mat-label>
14
+ <input matInput [placeholder]="placeholder" style="display: none" [required]="bRequired$" />
16
15
  <mat-radio-group
17
16
  [value]="value$"
18
17
  [required]="bRequired$"
@@ -24,7 +23,7 @@
24
23
  <mat-radio-button
25
24
  *ngFor="let opt of options$"
26
25
  [checked]="isSelected(opt.key)"
27
- [disabled]="bReadonly$"
26
+ [disabled]="bDisabled$ || bReadonly$"
28
27
  [value]="opt.key"
29
28
  class="psdk-radio-button"
30
29
  >
@@ -35,3 +34,9 @@
35
34
  </mat-form-field>
36
35
  </div>
37
36
  </ng-template>
37
+ <ng-template #cardMode>
38
+ <h4>{{ label$ }}</h4>
39
+ <div>
40
+ <component-mapper name="SelectableCard" [props]="{ pConn$: pConn$, type: 'radio' }" [parent]="this"></component-mapper>
41
+ </div>
42
+ </ng-template>
@@ -15,11 +15,13 @@
15
15
  .psdk-radio-horizontal {
16
16
  display: flex;
17
17
  flex-direction: row;
18
+ margin-top: 1rem;
18
19
  }
19
20
 
20
21
  .psdk-radio-vertical {
21
22
  display: flex;
22
23
  flex-direction: column;
24
+ margin-top: 1rem;
23
25
  }
24
26
 
25
27
  .psdk-radio-button {
@@ -30,8 +32,8 @@
30
32
  width: 100%;
31
33
  }
32
34
 
33
- .psdk-radio-form ::ng-deep .mat-form-field-underline {
34
- background-color: transparent;
35
+ .psdk-radio-form ::ng-deep .mdc-line-ripple {
36
+ display: none;
35
37
  }
36
38
 
37
39
  .psdk-radio-form ::ng-deep .mat-form-field-label {