@pega/angular-sdk-overrides 0.25.1 → 0.25.3

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 (160) hide show
  1. package/lib/designSystemExtension/alert/alert.component.scss +3 -3
  2. package/lib/designSystemExtension/banner/banner.component.scss +12 -2
  3. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +6 -3
  4. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +5 -34
  5. package/lib/designSystemExtension/material-details/material-details.component.scss +0 -5
  6. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +2 -2
  7. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +4 -3
  8. package/lib/designSystemExtension/material-summary-item/material-summary-item.component.scss +2 -17
  9. package/lib/designSystemExtension/material-utility/material-utility.component.scss +1 -2
  10. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.scss +1 -1
  11. package/lib/designSystemExtension/operator/operator.component.html +1 -1
  12. package/lib/designSystemExtension/operator/operator.component.scss +3 -10
  13. package/lib/designSystemExtension/operator/operator.component.ts +0 -1
  14. package/lib/designSystemExtension/pulse/pulse.component.scss +2 -2
  15. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +0 -1
  16. package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.scss +16 -8
  17. package/lib/field/auto-complete/auto-complete.component.html +0 -1
  18. package/lib/field/auto-complete/auto-complete.component.ts +35 -172
  19. package/lib/field/cancel-alert/cancel-alert.component.html +8 -12
  20. package/lib/field/cancel-alert/cancel-alert.component.scss +2 -3
  21. package/lib/field/cancel-alert/cancel-alert.component.ts +24 -36
  22. package/lib/field/check-box/check-box.component.html +0 -1
  23. package/lib/field/check-box/check-box.component.scss +0 -1
  24. package/lib/field/check-box/check-box.component.ts +19 -149
  25. package/lib/field/currency/currency.component.ts +36 -168
  26. package/lib/field/date/date.component.html +1 -1
  27. package/lib/field/date/date.component.ts +30 -150
  28. package/lib/field/date-time/date-time.component.ts +31 -149
  29. package/lib/field/decimal/decimal.component.ts +38 -163
  30. package/lib/field/dropdown/dropdown.component.ts +29 -151
  31. package/lib/field/email/email.component.ts +16 -155
  32. package/lib/field/field.base.ts +149 -0
  33. package/lib/field/group/group.component.ts +7 -4
  34. package/lib/field/integer/integer.component.ts +18 -157
  35. package/lib/field/location/location.component.ts +1 -1
  36. package/lib/field/multiselect/multiselect.component.ts +46 -148
  37. package/lib/field/multiselect/utils.ts +55 -47
  38. package/lib/field/object-reference/object-reference.component.html +17 -0
  39. package/lib/field/object-reference/object-reference.component.scss +0 -0
  40. package/lib/field/object-reference/object-reference.component.spec.ts +22 -0
  41. package/lib/field/object-reference/object-reference.component.ts +237 -0
  42. package/lib/field/percentage/percentage.component.ts +37 -154
  43. package/lib/field/phone/phone.component.ts +28 -142
  44. package/lib/field/radio-buttons/radio-buttons.component.scss +4 -2
  45. package/lib/field/radio-buttons/radio-buttons.component.ts +35 -161
  46. package/lib/field/rich-text/rich-text.component.ts +19 -90
  47. package/lib/field/scalar-list/scalar-list.component.ts +17 -72
  48. package/lib/field/selectable-card/selectable-card.component.html +54 -24
  49. package/lib/field/selectable-card/selectable-card.component.scss +11 -0
  50. package/lib/field/selectable-card/selectable-card.component.ts +16 -52
  51. package/lib/field/semantic-link/semantic-link.component.html +4 -8
  52. package/lib/field/semantic-link/semantic-link.component.scss +0 -13
  53. package/lib/field/semantic-link/semantic-link.component.ts +165 -5
  54. package/lib/field/text/text.component.scss +0 -1
  55. package/lib/field/text-area/text-area.component.ts +18 -152
  56. package/lib/field/text-input/text-input.component.ts +16 -155
  57. package/lib/field/time/time.component.ts +17 -151
  58. package/lib/field/url/url.component.ts +16 -154
  59. package/lib/field/user-reference/user-reference.component.scss +0 -1
  60. package/lib/field/user-reference/user-reference.component.ts +2 -3
  61. package/lib/infra/Containers/flow-container/flow-container.component.ts +5 -7
  62. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +5 -10
  63. package/lib/infra/Containers/view-container/helper.ts +35 -2
  64. package/lib/infra/Containers/view-container/view-container.component.ts +1 -1
  65. package/lib/infra/action-buttons/action-buttons.component.html +13 -8
  66. package/lib/infra/action-buttons/action-buttons.component.scss +23 -0
  67. package/lib/infra/action-buttons/action-buttons.component.ts +1 -2
  68. package/lib/infra/assignment/assignment.component.ts +8 -6
  69. package/lib/infra/assignment-card/assignment-card.component.html +1 -2
  70. package/lib/infra/assignment-card/assignment-card.component.scss +0 -4
  71. package/lib/infra/assignment-card/assignment-card.component.ts +21 -4
  72. package/lib/infra/defer-load/defer-load.component.html +6 -2
  73. package/lib/infra/defer-load/defer-load.component.ts +16 -10
  74. package/lib/infra/multi-step/multi-step.component.scss +1 -21
  75. package/lib/infra/navbar/navbar.component.html +25 -28
  76. package/lib/infra/navbar/navbar.component.scss +16 -4
  77. package/lib/infra/navbar/navbar.component.ts +8 -3
  78. package/lib/infra/root-container/root-container.component.scss +0 -1
  79. package/lib/infra/root-container/root-container.component.ts +1 -2
  80. package/lib/infra/stages/stages.component.html +2 -2
  81. package/lib/infra/stages/stages.component.scss +7 -35
  82. package/lib/infra/stages/stages.component.ts +4 -2
  83. package/lib/infra/view/view.component.html +1 -1
  84. package/lib/infra/view/view.component.ts +0 -2
  85. package/lib/template/advanced-search/advanced-search.component.html +12 -0
  86. package/lib/template/advanced-search/advanced-search.component.scss +0 -0
  87. package/lib/template/advanced-search/advanced-search.component.spec.ts +0 -0
  88. package/lib/template/advanced-search/advanced-search.component.ts +112 -0
  89. package/lib/template/advanced-search/advanced-search.service.ts +27 -0
  90. package/lib/template/advanced-search/search-group/persist-utils.ts +56 -0
  91. package/lib/template/advanced-search/search-groups/search-groups.component.html +32 -0
  92. package/lib/template/advanced-search/search-groups/search-groups.component.scss +0 -0
  93. package/lib/template/advanced-search/search-groups/search-groups.component.spec.ts +0 -0
  94. package/lib/template/advanced-search/search-groups/search-groups.component.ts +294 -0
  95. package/lib/template/advanced-search/search-groups/utils.ts +29 -0
  96. package/lib/template/app-shell/app-shell.component.html +4 -1
  97. package/lib/template/app-shell/app-shell.component.scss +0 -3
  98. package/lib/template/app-shell/app-shell.component.ts +46 -7
  99. package/lib/template/case-summary/case-summary.component.scss +0 -2
  100. package/lib/template/case-view/case-view.component.html +3 -3
  101. package/lib/template/case-view/case-view.component.scss +18 -10
  102. package/lib/template/case-view/case-view.component.ts +1 -1
  103. package/lib/template/data-reference/data-reference-advanced-search.service.ts +16 -0
  104. package/lib/template/data-reference/data-reference.component.html +11 -8
  105. package/lib/template/data-reference/data-reference.component.ts +346 -112
  106. package/lib/template/data-reference/search-form/search-form.component.html +39 -0
  107. package/lib/template/data-reference/search-form/search-form.component.scss +11 -0
  108. package/lib/template/data-reference/search-form/search-form.component.spec.ts +0 -0
  109. package/lib/template/data-reference/search-form/search-form.component.ts +167 -0
  110. package/lib/template/data-reference/search-form/tabsData.ts +160 -0
  111. package/lib/template/data-reference/utils.ts +92 -0
  112. package/lib/template/default-form/default-form.component.ts +10 -2
  113. package/lib/template/default-page/default-page.component.html +34 -0
  114. package/lib/template/default-page/default-page.component.scss +31 -0
  115. package/lib/template/default-page/default-page.component.spec.ts +24 -0
  116. package/lib/template/default-page/default-page.component.ts +64 -0
  117. package/lib/template/field-group-list/field-group-list.component.scss +0 -1
  118. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +1 -1
  119. package/lib/template/list-view/list-view.component.html +9 -4
  120. package/lib/template/list-view/list-view.component.scss +21 -21
  121. package/lib/template/list-view/list-view.component.ts +154 -84
  122. package/lib/template/list-view/utils.ts +25 -2
  123. package/lib/template/object-page/object-page.component.html +1 -0
  124. package/lib/template/object-page/object-page.component.scss +0 -0
  125. package/lib/template/object-page/object-page.component.spec.ts +22 -0
  126. package/lib/template/object-page/object-page.component.ts +14 -0
  127. package/lib/template/one-column-tab/one-column-tab.component.scss +1 -1
  128. package/lib/template/repeating-structures/repeating-structures.component.ts +0 -1
  129. package/lib/template/self-service-case-view/self-service-case-view.component.html +80 -0
  130. package/lib/template/self-service-case-view/self-service-case-view.component.scss +124 -0
  131. package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +24 -0
  132. package/lib/template/self-service-case-view/self-service-case-view.component.ts +216 -0
  133. package/lib/template/simple-table/simple-table.component.ts +0 -1
  134. package/lib/template/simple-table-manual/helpers.ts +2 -2
  135. package/lib/template/simple-table-manual/simple-table-manual.component.html +4 -4
  136. package/lib/template/simple-table-manual/simple-table-manual.component.scss +4 -14
  137. package/lib/template/simple-table-manual/simple-table-manual.component.ts +8 -4
  138. package/lib/template/single-reference-readonly/single-reference-readonly.component.html +4 -1
  139. package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +21 -0
  140. package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +104 -3
  141. package/lib/template/utils.ts +42 -0
  142. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +5 -4
  143. package/lib/template/wss-nav-bar/wss-nav-bar.component.scss +2 -8
  144. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +1 -8
  145. package/lib/widget/app-announcement/app-announcement.component.html +1 -2
  146. package/lib/widget/app-announcement/app-announcement.component.scss +2 -2
  147. package/lib/widget/attachment/Attachment.types.ts +92 -0
  148. package/lib/widget/attachment/AttachmentUtils.ts +287 -0
  149. package/lib/widget/attachment/attachment.component.html +3 -3
  150. package/lib/widget/attachment/attachment.component.scss +2 -5
  151. package/lib/widget/attachment/attachment.component.ts +255 -254
  152. package/lib/widget/feed-container/feed-container.component.scss +3 -9
  153. package/lib/widget/feed-container/feed-container.component.ts +2 -2
  154. package/lib/widget/file-utility/file-utility.component.html +3 -3
  155. package/lib/widget/file-utility/file-utility.component.scss +5 -16
  156. package/lib/widget/list-utility/list-utility.component.scss +3 -5
  157. package/lib/widget/todo/todo.component.html +8 -5
  158. package/lib/widget/todo/todo.component.scss +10 -11
  159. package/lib/widget/todo/todo.component.ts +6 -2
  160. package/package.json +1 -1
@@ -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,4 +1,4 @@
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
4
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
@@ -30,7 +30,7 @@ interface DefaultFormProps {
30
30
  styleUrls: ['./default-form.component.scss'],
31
31
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
32
32
  })
33
- export class DefaultFormComponent extends FormTemplateBase implements OnInit {
33
+ export class DefaultFormComponent extends FormTemplateBase implements OnInit, OnChanges {
34
34
  @Input() override pConn$: typeof PConnect;
35
35
  @Input() formGroup$: FormGroup;
36
36
 
@@ -59,6 +59,14 @@ export class DefaultFormComponent extends FormTemplateBase implements OnInit {
59
59
  this.updateSelf();
60
60
  }
61
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
+
62
70
  updateSelf() {
63
71
  const configProps = this.pConn$.getConfigProps() as DefaultFormProps;
64
72
  const kids = this.pConn$.getChildren();
@@ -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
+ });
@@ -0,0 +1,64 @@
1
+ import { Component, OnInit, Input, forwardRef, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { ReferenceComponent } from '@pega/angular-sdk-components';
4
+ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
5
+
6
+ interface DefaultPageProps {
7
+ // If any, enter additional props that only exist on this component
8
+ layout?: string;
9
+ title?: string;
10
+ heading?: string;
11
+ message?: string;
12
+ backgroundImage?: string;
13
+ enableBanner?: boolean;
14
+ }
15
+
16
+ @Component({
17
+ selector: 'app-default-page',
18
+ templateUrl: './default-page.component.html',
19
+ styleUrls: ['./default-page.component.scss'],
20
+ imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
21
+ })
22
+ export class DefaultPageComponent implements OnInit, OnChanges {
23
+ @Input() pConn$: typeof PConnect;
24
+ @Input() formGroup$: any;
25
+
26
+ configProps$: DefaultPageProps;
27
+ arChildren$: any[];
28
+ title?: string;
29
+ heading: any;
30
+ message?: string;
31
+ backgroundImage?: string;
32
+ layout$?: string;
33
+ enableBanner$?: boolean;
34
+
35
+ constructor() {
36
+ this.backgroundImage = this.configProps$?.backgroundImage;
37
+ }
38
+
39
+ ngOnInit() {
40
+ this.backgroundImage = this.configProps$?.backgroundImage;
41
+ this.updateSelf();
42
+ }
43
+
44
+ ngOnChanges(changes: SimpleChanges): void {
45
+ const { pConn$ } = changes;
46
+ this.backgroundImage = this.configProps$?.backgroundImage;
47
+
48
+ if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) {
49
+ this.updateSelf();
50
+ }
51
+ }
52
+
53
+ updateSelf() {
54
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as DefaultPageProps;
55
+
56
+ this.layout$ = this.configProps$.layout;
57
+ this.heading = this.configProps$.heading;
58
+ this.message = this.configProps$.message;
59
+ this.backgroundImage = this.configProps$.backgroundImage;
60
+ this.enableBanner$ = this.configProps$.enableBanner;
61
+
62
+ this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
63
+ }
64
+ }
@@ -1,5 +1,4 @@
1
1
  .psdk-details-fields-label {
2
- color: var(--app-label-color);
3
2
  margin: 8px 0px;
4
3
  }
5
4
 
@@ -45,7 +45,7 @@ export class InlineDashboardPageComponent implements OnInit, OnChanges {
45
45
  updateSelf() {
46
46
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as InlineDashboardPageProps;
47
47
  const arChildren$ = this.pConn$.getChildren();
48
- const allFilters = this.pConn$.getRawMetadata()?.children[1];
48
+ const allFilters = this.pConn$.getRawMetadata()?.children?.[1];
49
49
  const filterComponents = buildFilterComponents(this.pConn$, allFilters);
50
50
  this.inlineProps = this.configProps$;
51
51
  this.children[0] = arChildren$[0];
@@ -173,15 +173,20 @@
173
173
  <tr mat-row *matRowDef="let row; columns: displayedColumns$"></tr>
174
174
  </table>
175
175
  <div *ngIf="repeatListData?.length === 0">
176
- <table id="list-view" *ngIf="repeatListData?.length === 0" mat-table [dataSource]="repeatList$">
177
- <ng-container *ngFor="let dCol of fields$" [matColumnDef]="dCol.config.name">
178
- <th mat-header-cell *matHeaderCellDef>{{ dCol.config.label }}</th>
176
+ <table id="list-view" mat-table [dataSource]="[]">
177
+ <!-- Define columns for headers -->
178
+ <ng-container *ngFor="let col of displayedColumns$" [matColumnDef]="col">
179
+ <th mat-header-cell *matHeaderCellDef>
180
+ {{ getValue(col) }}
181
+ </th>
179
182
  </ng-container>
183
+
184
+ <!-- Render only header row -->
180
185
  <tr mat-header-row *matHeaderRowDef="displayedColumns$"></tr>
181
186
  </table>
182
187
  </div>
183
188
  <div class="psdk-no-records" *ngIf="repeatListData?.length === 0">
184
- {{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
189
+ {{ utils.getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.') }}
185
190
  </div>
186
191
  </div>
187
192
  </div>