@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
@@ -0,0 +1,39 @@
1
+ <div class="search-form" style="display: flex; flex-direction: column">
2
+ <h5>{{ propsToUse.label }}</h5>
3
+ <div *ngIf="searchCategoriesComp === 'dropdown'">
4
+ <mat-form-field class="psdk-full-width">
5
+ <mat-select [value]="currentTabId" (selectionChange)="handleTabClick($event.value)">
6
+ <mat-option *ngFor="let tab of tabItems" [value]="tab.id">{{ tab.name }}</mat-option>
7
+ </mat-select>
8
+ </mat-form-field>
9
+ </div>
10
+ <div *ngIf="searchCategoriesComp === 'radio'">
11
+ <mat-radio-group [value]="currentTabId">
12
+ <mat-radio-button *ngFor="let tab of tabItems" [value]="tab.id" (click)="handleTabClick($event)">{{ tab.name }}</mat-radio-button>
13
+ </mat-radio-group>
14
+ </div>
15
+
16
+ <!-- Tab Content -->
17
+ <div>
18
+ <div *ngFor="let tab of tabItems; let index = index">
19
+ <div *ngIf="tab.id === currentTabId" class="psdk-sub-tabs">
20
+ <component-mapper
21
+ *ngIf="tab.content?.getPConnect() as tabPConn"
22
+ [name]="tabPConn.getComponentName()"
23
+ [props]="{ pConn$: tabPConn, formGroup$ }"
24
+ ></component-mapper>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ <!-- Dialog -->
29
+ <ng-template #dialogTemplate>
30
+ <h2 mat-dialog-title>Discard selections?</h2>
31
+ <mat-dialog-content>
32
+ <p>When changing search categories, any previous selections will be lost.</p>
33
+ </mat-dialog-content>
34
+ <mat-dialog-actions>
35
+ <button mat-stroked-button type="button" (click)="onDialogClose()">Go back</button>
36
+ <button mat-raised-button color="primary" (click)="clearSelectionAndSwitchTab()">Discard</button>
37
+ </mat-dialog-actions>
38
+ </ng-template>
39
+ </div>
@@ -0,0 +1,11 @@
1
+ .psdk-full-width {
2
+ width: 100%;
3
+ }
4
+
5
+ ::ng-deep {
6
+ mat-tab-group {
7
+ .mat-mdc-tab-header .mat-mdc-tab-label-container .mat-mdc-tab-list {
8
+ display: none;
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,167 @@
1
+ import { Component, forwardRef, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
2
+ import { FormGroup, ReactiveFormsModule } from '@angular/forms';
3
+ import { getFirstVisibleTabId, getActiveTabId, searchtabsClick } from '@pega/angular-sdk-components';
4
+ import { MatRadioModule } from '@angular/material/radio';
5
+ import { CommonModule } from '@angular/common';
6
+ import { MatFormFieldModule } from '@angular/material/form-field';
7
+ import { MatOptionModule } from '@angular/material/core';
8
+ import { MatSelectModule } from '@angular/material/select';
9
+ import { MatTabsModule } from '@angular/material/tabs';
10
+ import { MatButtonModule } from '@angular/material/button';
11
+ import { MatDialog, MatDialogModule, MatDialogActions, MatDialogContent, MatDialogTitle } from '@angular/material/dialog';
12
+ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
13
+ import { getTabCountSources, getData } from './tabsData';
14
+ import { getFieldMeta } from '@pega/angular-sdk-components';
15
+
16
+ @Component({
17
+ selector: 'app-search-form',
18
+ templateUrl: './search-form.component.html',
19
+ styleUrls: ['./search-form.component.scss'],
20
+ imports: [
21
+ CommonModule,
22
+ ReactiveFormsModule,
23
+ MatFormFieldModule,
24
+ MatRadioModule,
25
+ MatOptionModule,
26
+ MatSelectModule,
27
+ MatTabsModule,
28
+ MatDialogModule,
29
+ MatDialogActions,
30
+ MatDialogContent,
31
+ MatDialogTitle,
32
+ MatButtonModule,
33
+ forwardRef(() => ComponentMapperComponent)
34
+ ]
35
+ })
36
+ export class SearchFormComponent implements OnInit, OnChanges {
37
+ @Input() pConn$: typeof PConnect;
38
+ @Input() formGroup$: FormGroup;
39
+ @Input() searchSelectCacheKey;
40
+
41
+ configProps$: any;
42
+ isInitialized = false;
43
+
44
+ currentTabId: string;
45
+ nextTabId: string;
46
+ openDialog = false;
47
+ tabItems: any[] = [];
48
+ searchCategoriesComp: any;
49
+ propsToUse: any;
50
+ tabData: any = [];
51
+ tabCountSources: any;
52
+ deferLoadedTabs: any;
53
+ @ViewChild('dialogTemplate') dialogTemplate!: TemplateRef<any>;
54
+ dialogRef: any;
55
+ constructor(private dialog: MatDialog) {}
56
+
57
+ ngOnInit(): void {
58
+ this.isInitialized = true;
59
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps());
60
+ this.propsToUse = { ...this.pConn$.getInheritedProps() };
61
+ this.deferLoadedTabs = this.pConn$.getChildren()[2];
62
+ const cache: any = PCore.getNavigationUtils().getComponentCache(this.searchSelectCacheKey) ?? {};
63
+ const { selectedCategory } = cache;
64
+ const firstTabId = getFirstVisibleTabId(this.deferLoadedTabs, selectedCategory);
65
+ this.currentTabId = getActiveTabId(this.deferLoadedTabs.getPConnect().getChildren(), firstTabId);
66
+ this.updateSelf();
67
+ }
68
+
69
+ ngOnChanges() {
70
+ if (this.isInitialized) {
71
+ this.updateSelf();
72
+ }
73
+ }
74
+
75
+ // updateSelf
76
+ updateSelf(): void {
77
+ this.tabCountSources = getTabCountSources(this.deferLoadedTabs);
78
+ this.tabData = getData(this.deferLoadedTabs, this.tabCountSources, this.currentTabId, this.tabData);
79
+ this.tabItems = this.tabData?.filter(tab => tab.visibility()) || [];
80
+ this.initializeSearchCategories();
81
+ }
82
+
83
+ initializeSearchCategories(): void {
84
+ if (this.tabItems.length >= 3) {
85
+ this.searchCategoriesComp = 'dropdown';
86
+ } else if (this.tabItems.length > 1) {
87
+ this.searchCategoriesComp = 'radio';
88
+ }
89
+ }
90
+
91
+ handleTabClick(event) {
92
+ const tabId = event.target.value;
93
+ const viewName = this.tabData
94
+ .find((tab: any) => tab.id === this.currentTabId)
95
+ ?.getPConnect()
96
+ .getConfigProps().name;
97
+
98
+ if (this.checkIfSelectionsExist(this.pConn$)) {
99
+ event.preventDefault();
100
+ this.nextTabId = tabId;
101
+ this.dialogRef = this.dialog.open(this.dialogTemplate, {
102
+ width: '400px'
103
+ });
104
+ } else {
105
+ // @ts-ignore
106
+ this.publishEvent({ viewName, tabId });
107
+ this.currentTabId = tabId;
108
+ this.tabData = getData(this.deferLoadedTabs, this.tabCountSources, this.currentTabId, this.tabData);
109
+ this.tabItems = this.tabData?.filter(tab => tab.visibility()) || [];
110
+ }
111
+ }
112
+
113
+ clearSelectionAndSwitchTab(): void {
114
+ const viewName = this.tabItems
115
+ .find((tab: any) => tab.id === this.currentTabId)
116
+ .getPConnect()
117
+ .getConfigProps().name;
118
+
119
+ this.publishEvent({ clearSelections: true, viewName });
120
+ searchtabsClick(this.nextTabId, this.tabData, this.currentTabId);
121
+ this.onDialogClose();
122
+ this.currentTabId = this.nextTabId;
123
+ this.tabData = getData(this.deferLoadedTabs, this.tabCountSources, this.currentTabId, this.tabData);
124
+ this.tabItems = this.tabData?.filter(tab => tab.visibility()) || [];
125
+ }
126
+
127
+ onDialogClose(): void {
128
+ this.dialogRef.close();
129
+ }
130
+
131
+ publishEvent({ clearSelections, viewName }) {
132
+ const payload: any = {};
133
+
134
+ if (clearSelections) {
135
+ payload.clearSelections = clearSelections;
136
+ }
137
+
138
+ if (viewName) {
139
+ payload.viewName = viewName;
140
+ }
141
+
142
+ PCore.getPubSubUtils().publish('update-advanced-search-selections', payload);
143
+ }
144
+
145
+ get activeTabPConnect() {
146
+ const tabData = this.tabItems.find(tab => tab.id === this.currentTabId);
147
+ return tabData.content?.getPConnect();
148
+ }
149
+
150
+ checkIfSelectionsExist(getPConnect) {
151
+ const { MULTI } = PCore.getConstants().LIST_SELECTION_MODE;
152
+ const { selectionMode, readonlyContextList, contextPage, contextClass, name } = getPConnect.getConfigProps();
153
+ const isMultiSelectMode = selectionMode === MULTI;
154
+
155
+ const dataRelationshipContext = contextClass && name ? name : null;
156
+
157
+ const { compositeKeys } = getFieldMeta(getPConnect, dataRelationshipContext);
158
+
159
+ let selectionsExist = false;
160
+ if (isMultiSelectMode) {
161
+ selectionsExist = readonlyContextList?.length > 0;
162
+ } else if (contextPage) {
163
+ selectionsExist = compositeKeys?.filter(key => !['', null, undefined].includes(contextPage[key]))?.length > 0;
164
+ }
165
+ return selectionsExist;
166
+ }
167
+ }
@@ -0,0 +1,160 @@
1
+ import { getTabLabel } from '@pega/angular-sdk-components';
2
+
3
+ export function getTabCountSources(deferLoadedTabs) {
4
+ const availableTabs = deferLoadedTabs.getPConnect().getChildren() || [];
5
+ const viewName = deferLoadedTabs?.getPConnect()?.options?.viewName || null;
6
+ return availableTabs.reduce(
7
+ (prev, tab, index) => {
8
+ const config = tab.getPConnect().getConfigProps();
9
+ const { value: showTabCount } = config.inheritedProps?.find(item => item.prop === 'showTabCount') || {};
10
+ const { value } = config.inheritedProps?.find(item => item.prop === 'count') || {};
11
+ const tabCountSource = config.inheritedProps?.find(item => item.prop === 'tabCount');
12
+ const name = getTabLabel(tab.getPConnect());
13
+ const tabId = `${viewName}-${config.name || name}-${index}`;
14
+ if (showTabCount) {
15
+ if (tabCountSource?.value?.fields?.count) {
16
+ const isPrefixedByDot = tabCountSource.value.fields.count.substring(0, 1) === '.';
17
+ return {
18
+ ...prev,
19
+ dataPageSources: [
20
+ ...prev.dataPageSources,
21
+ {
22
+ dataPageName: tabCountSource.value.source,
23
+ tabId,
24
+ tabCountProp: isPrefixedByDot ? tabCountSource.value.fields.count.substring(1) : tabCountSource.value.fields.count,
25
+ dataViewParameters: tabCountSource.value?.parameters || {}
26
+ }
27
+ ]
28
+ };
29
+ }
30
+ if (Number.isInteger(value) && value % 1 === 0) {
31
+ return {
32
+ ...prev,
33
+ calculatedFields: [
34
+ ...prev.calculatedFields,
35
+ {
36
+ count: value,
37
+ context: tab.getPConnect().getContextName(),
38
+ tabId
39
+ }
40
+ ]
41
+ };
42
+ }
43
+ if (value?.isDeferred) {
44
+ return {
45
+ ...prev,
46
+ calculatedFields: [
47
+ ...prev.calculatedFields,
48
+ {
49
+ propertyName: value.propertyName,
50
+ context: 'content',
51
+ tabId
52
+ }
53
+ ]
54
+ };
55
+ }
56
+ }
57
+ return prev;
58
+ },
59
+ {
60
+ dataPageSources: [],
61
+ calculatedFields: []
62
+ }
63
+ );
64
+ }
65
+
66
+ function tabContent(id, index, overideTabContent, tab, data, currentTabId, template) {
67
+ if (id === currentTabId || template === 'HierarchicalForm') {
68
+ if (overideTabContent) {
69
+ return tab.getPConnect().getComponent();
70
+ }
71
+ if (data[index]?.content) {
72
+ return data[index]?.content;
73
+ }
74
+ return tab.getPConnect().getComponent();
75
+ }
76
+ if (template !== 'HierarchicalForm') {
77
+ return overideTabContent ? null : data[index]?.content;
78
+ }
79
+ }
80
+
81
+ function getTabsData(deferLoadedTabs, countMetadata, currentTabId, data) {
82
+ const availableTabs = deferLoadedTabs.getPConnect().getChildren() || [];
83
+ const viewName = deferLoadedTabs?.getPConnect()?.options?.viewName || null;
84
+ return availableTabs.map((tab, index) => {
85
+ const config = tab.getPConnect().getConfigProps();
86
+ const name = getTabLabel(tab.getPConnect());
87
+ const tabId = `${viewName}-${config.name || name}-${index}`;
88
+ const count = countMetadata.find(item => item.tabId === tabId)?.count;
89
+
90
+ return {
91
+ name,
92
+ id: tabId,
93
+ getPConnect: tab.getPConnect,
94
+ content: tabContent(tabId, index, '', tab, data, currentTabId, ''),
95
+ loaded: tabId === currentTabId || Boolean(data[index]?.content),
96
+ visibility: () => {
97
+ const tabConfig = tab.getPConnect().getConfigProps();
98
+ const isVisible = !('visibility' in tabConfig) || tabConfig.visibility === true;
99
+ if (!isVisible) {
100
+ tab.getPConnect().removeNode();
101
+ }
102
+ return isVisible;
103
+ },
104
+ count
105
+ };
106
+ });
107
+ }
108
+
109
+ export function getData(deferLoadedTabs, tabCountSources, currentTabId, data) {
110
+ let countMetadata;
111
+ let tabData;
112
+ const pConn = deferLoadedTabs.getPConnect();
113
+ const { dataPageSources, calculatedFields } = tabCountSources;
114
+ const calculatedFieldsWithoutValue = calculatedFields.filter(item => item.propertyName);
115
+ if (dataPageSources.length) {
116
+ Promise.all(dataPageSources.map(item => PCore.getDataPageUtils().getPageDataAsync(item.dataPageName, '', item.dataViewParameters)))
117
+ .then(res => {
118
+ const temp = res.map((r, index) => ({
119
+ ...dataPageSources[index],
120
+ count: r[dataPageSources[index].tabCountProp]
121
+ }));
122
+ countMetadata = temp;
123
+ tabData = getTabsData(deferLoadedTabs, countMetadata, currentTabId, data);
124
+ })
125
+ .catch(err => {
126
+ console.log(err);
127
+ });
128
+ } else if (calculatedFieldsWithoutValue.length) {
129
+ PCore.getViewRuleApi()
130
+ // @ts-ignore
131
+ .getCalculatedFields(
132
+ pConn.getCaseInfo().getKey(),
133
+ pConn.getCurrentView(),
134
+ calculatedFieldsWithoutValue.map(({ propertyName, context }) => ({
135
+ name: propertyName,
136
+ context
137
+ }))
138
+ )
139
+ .then(res => {
140
+ const values = (res?.data as any)?.caseInfo?.content || {};
141
+ const temp = calculatedFields.map(field => ({
142
+ ...field,
143
+ count: values[field.propertyName?.substring(1)] || field.count
144
+ }));
145
+ countMetadata = temp;
146
+ tabData = getTabsData(deferLoadedTabs, countMetadata, currentTabId, data);
147
+ })
148
+ .catch(err => {
149
+ console.log(err);
150
+ });
151
+ } else {
152
+ countMetadata = calculatedFields.map(field => ({
153
+ ...field,
154
+ count: field.count
155
+ }));
156
+ tabData = getTabsData(deferLoadedTabs, countMetadata, currentTabId, data);
157
+ }
158
+
159
+ return tabData;
160
+ }
@@ -0,0 +1,92 @@
1
+ const isSelfReferencedProperty = (param, referenceProp) => {
2
+ const [, parentPropName] = param.split('.');
3
+ const referencePropParent = referenceProp?.split('.').pop();
4
+ return parentPropName === referencePropParent;
5
+ };
6
+
7
+ export function getFieldMeta(getPConnect, dataRelationshipContext) {
8
+ const pConn = getPConnect;
9
+ const { selectionMode, selectionList } = pConn.getConfigProps();
10
+ const { MULTI } = PCore.getConstants().LIST_SELECTION_MODE;
11
+
12
+ const isMultiSelectMode = selectionMode === MULTI;
13
+
14
+ const pageReference = pConn.getPageReference();
15
+ let referenceProp = isMultiSelectMode ? selectionList.substring(1) : pageReference.substring(pageReference.lastIndexOf('.') + 1);
16
+ // Replace here to use the context name instead
17
+ let contextPageReference = null;
18
+ if (dataRelationshipContext !== null && selectionMode === 'single') {
19
+ referenceProp = dataRelationshipContext;
20
+ contextPageReference = pageReference.concat('.').concat(referenceProp);
21
+ }
22
+
23
+ const fieldMetadata =
24
+ (isMultiSelectMode ? pConn.getFieldMetadata(`${referenceProp}`) : pConn.getCurrentPageFieldMetadata(contextPageReference)) ?? {};
25
+ const { datasource: { parameters: fieldParameters = {} } = {} } = fieldMetadata;
26
+ const compositeKeys: any = [];
27
+ Object.values(fieldParameters).forEach((param: any) => {
28
+ if (isSelfReferencedProperty(param, referenceProp)) {
29
+ compositeKeys.push(param.substring(param.lastIndexOf('.') + 1));
30
+ }
31
+ });
32
+
33
+ return { compositeKeys, fieldMetadata };
34
+ }
35
+
36
+ /**
37
+ * returns array of self-referenced properties of the datasource
38
+ * Ex: returns ["@P .DataRef.pyGUID", "@P .DataRef.customerID"]
39
+ */
40
+ const getCompositeKeys = (pConnect, property) => {
41
+ const fieldMetadata = pConnect.getFieldMetadata(property) || {};
42
+ const { datasource: { parameters: fieldParameters = {} } = {} } = fieldMetadata;
43
+ const compositeKeys: any = [];
44
+ Object.values(fieldParameters).forEach(param => {
45
+ if (isSelfReferencedProperty(param, property)) {
46
+ compositeKeys.push(param);
47
+ }
48
+ });
49
+ return compositeKeys;
50
+ };
51
+
52
+ export const getFirstChildConfig = ({
53
+ firstChildMeta,
54
+ getPConnect,
55
+ rawViewMetadata,
56
+ contextClass,
57
+ dataReferenceConfigToChild,
58
+ isCreateNewReferenceEnabled,
59
+ disableStartingFieldsForReference,
60
+ pyID
61
+ }) => {
62
+ const config = {
63
+ ...firstChildMeta.config,
64
+ ...dataReferenceConfigToChild
65
+ };
66
+ const compositeKeys = getCompositeKeys(getPConnect, dataReferenceConfigToChild?.dataRelationshipContext);
67
+ return {
68
+ ...config,
69
+ viewName: getPConnect.getCurrentView(),
70
+ referenceList: config.referenceList ?? rawViewMetadata.config.referenceList,
71
+ parameters: rawViewMetadata.config.parameters,
72
+ localeReference: rawViewMetadata.config.localeReference,
73
+ contextClass: config.contextClass || rawViewMetadata?.config?.contextClass || rawViewMetadata?.config?.targetObjectClass,
74
+ allowAddingNewRecords: firstChildMeta.type === 'SimpleTableSelect' && isCreateNewReferenceEnabled ? true : undefined,
75
+ actions: firstChildMeta.type === 'SimpleTableSelect' &&
76
+ isCreateNewReferenceEnabled && [
77
+ {
78
+ action: 'ADD_CASE',
79
+ config: {
80
+ label: '@L Add',
81
+ caseType: contextClass,
82
+ inputFields: disableStartingFieldsForReference
83
+ ? {}
84
+ : {
85
+ [`.pyAddCaseContextPage.${pyID}`]: `@P .${pyID}`
86
+ }
87
+ }
88
+ }
89
+ ],
90
+ compositeKeys
91
+ };
92
+ };
@@ -1,11 +1,23 @@
1
- import { Component, OnInit, Input, forwardRef } from '@angular/core';
1
+ import { Component, OnInit, Input, forwardRef, OnChanges } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
+ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
4
5
  import { ReferenceComponent } from '@pega/angular-sdk-components';
5
6
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
6
7
  import { TemplateUtils } from '@pega/angular-sdk-components';
7
8
  import { FormTemplateBase } from '@pega/angular-sdk-components';
8
9
 
10
+ function areViewsChanged(oldViews: any[], newViews: any[]): boolean {
11
+ if (oldViews?.length !== newViews?.length) {
12
+ return true;
13
+ }
14
+
15
+ return !oldViews?.every((oldView, index) => {
16
+ const newView = newViews[index];
17
+ return oldView.getPConnect().viewName === newView.getPConnect().viewName;
18
+ });
19
+ }
20
+
9
21
  interface DefaultFormProps {
10
22
  // If any, enter additional props that only exist on this component
11
23
  NumCols: string;
@@ -16,22 +28,46 @@ interface DefaultFormProps {
16
28
  selector: 'app-default-form',
17
29
  templateUrl: './default-form.component.html',
18
30
  styleUrls: ['./default-form.component.scss'],
19
- standalone: true,
20
31
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
21
32
  })
22
- export class DefaultFormComponent extends FormTemplateBase implements OnInit {
33
+ export class DefaultFormComponent extends FormTemplateBase implements OnInit, OnChanges {
23
34
  @Input() override pConn$: typeof PConnect;
24
35
  @Input() formGroup$: FormGroup;
25
36
 
37
+ // Used with AngularPConnect
38
+ override angularPConnectData: AngularPConnectData = {};
39
+
26
40
  arChildren$: any[];
27
41
  divClass$: string;
28
42
  instructions: string;
29
43
 
30
- constructor(private templateUtils: TemplateUtils) {
44
+ constructor(
45
+ private angularPConnect: AngularPConnectService,
46
+ private templateUtils: TemplateUtils
47
+ ) {
31
48
  super();
32
49
  }
33
50
 
34
51
  ngOnInit(): void {
52
+ // First thing in initialization is registering and subscribing to the AngularPConnect service
53
+ this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
54
+
55
+ this.updateSelf();
56
+ }
57
+
58
+ onStateChange() {
59
+ this.updateSelf();
60
+ }
61
+
62
+ ngOnChanges(changes) {
63
+ const { pConn$ } = changes;
64
+
65
+ if (pConn$.previousValue && !PCore.isDeepEqual(pConn$.previousValue.getConfigProps(), pConn$.currentValue.getConfigProps())) {
66
+ this.updateSelf();
67
+ }
68
+ }
69
+
70
+ updateSelf() {
35
71
  const configProps = this.pConn$.getConfigProps() as DefaultFormProps;
36
72
  const kids = this.pConn$.getChildren();
37
73
  this.instructions = this.templateUtils.getInstructions(this.pConn$, configProps?.instructions);
@@ -55,6 +91,10 @@ export class DefaultFormComponent extends FormTemplateBase implements OnInit {
55
91
  // repoint children before getting templateArray
56
92
  // Children may contain 'reference' component, so we need to
57
93
  // normalize them
58
- this.arChildren$ = ReferenceComponent.normalizePConnArray(kids[0].getPConnect().getChildren());
94
+ const children = ReferenceComponent.normalizePConnArray(kids[0].getPConnect().getChildren());
95
+
96
+ if (areViewsChanged(this.arChildren$, children)) {
97
+ this.arChildren$ = children;
98
+ }
59
99
  }
60
100
  }
@@ -0,0 +1,34 @@
1
+ <div *ngIf="enableBanner$; else nonBannerMode">
2
+ <component-mapper
3
+ name="Banner"
4
+ [props]="{
5
+ configProps$,
6
+ arChildren$,
7
+ title: heading,
8
+ message,
9
+ backgroundImage,
10
+ layout$
11
+ }"
12
+ ></component-mapper>
13
+ </div>
14
+
15
+ <ng-template #nonBannerMode>
16
+ <div>
17
+ <h1 *ngIf="title">{{ title }}</h1>
18
+ <p *ngIf="heading">{{ heading }}</p>
19
+ <div
20
+ [ngClass]="{
21
+ 'psdk-grid-filter-1': this.layout$ === 'one-column',
22
+ 'psdk-grid-filter-2': this.layout$ === 'two-column',
23
+ 'psdk-grid-filter-wide-narrow': this.layout$ === 'wide-narrow',
24
+ 'psdk-grid-filter-narrow-wide': this.layout$ === 'narrow-wide'
25
+ }"
26
+ >
27
+ <component-mapper
28
+ *ngFor="let child of arChildren$"
29
+ [name]="child.getPConnect().getComponentName()"
30
+ [props]="{ pConn$: child.getPConnect() }"
31
+ ></component-mapper>
32
+ </div>
33
+ </div>
34
+ </ng-template>
@@ -0,0 +1,31 @@
1
+ .psdk-grid-filter-1 {
2
+ display: grid;
3
+ grid-template-columns: repeat(1, 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-grid-filter-2 {
10
+ display: grid;
11
+ grid-template-columns: repeat(2, minmax(0, 1fr));
12
+ column-gap: calc(2 * 0.5rem);
13
+ row-gap: calc(2 * 0.5rem);
14
+ align-items: start;
15
+ }
16
+
17
+ .psdk-grid-filter-wide-narrow {
18
+ display: grid;
19
+ grid-template-columns: 7fr 3fr;
20
+ column-gap: calc(2 * 0.5rem);
21
+ row-gap: calc(2 * 0.5rem);
22
+ align-items: start;
23
+ }
24
+
25
+ .psdk-grid-filter-narrow-wide {
26
+ display: grid;
27
+ grid-template-columns: 3fr 7fr;
28
+ column-gap: calc(2 * 0.5rem);
29
+ row-gap: calc(2 * 0.5rem);
30
+ align-items: start;
31
+ }
@@ -0,0 +1,24 @@
1
+ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
+
3
+ import { DefaultPageComponent } from './default-page.component';
4
+
5
+ describe('DefaultPageComponent', () => {
6
+ let component: DefaultPageComponent;
7
+ let fixture: ComponentFixture<DefaultPageComponent>;
8
+
9
+ beforeEach(waitForAsync(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [DefaultPageComponent]
12
+ }).compileComponents();
13
+ }));
14
+
15
+ beforeEach(() => {
16
+ fixture = TestBed.createComponent(DefaultPageComponent);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ });
20
+
21
+ it('should create', () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });