@pega/react-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 (169) hide show
  1. package/lib/designSystemExtension/Banner/Banner.css +1 -1
  2. package/lib/designSystemExtension/Banner/Banner.tsx +10 -7
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +53 -37
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -13
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +8 -9
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +9 -9
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +8 -9
  9. package/lib/designSystemExtension/Operator/Operator.tsx +21 -19
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +1 -1
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +32 -4
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +7 -14
  13. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +13 -2
  14. package/lib/field/AutoComplete/AutoComplete.tsx +1 -1
  15. package/lib/field/CancelAlert/CancelAlert.css +4 -4
  16. package/lib/field/CancelAlert/CancelAlert.tsx +7 -10
  17. package/lib/field/Checkbox/Checkbox.tsx +97 -4
  18. package/lib/field/Currency/Currency.tsx +10 -7
  19. package/lib/field/Currency/currency-utils.ts +1 -2
  20. package/lib/field/Date/Date.tsx +8 -8
  21. package/lib/field/DateTime/DateTime.tsx +16 -13
  22. package/lib/field/Decimal/Decimal.tsx +10 -7
  23. package/lib/field/Dropdown/Dropdown.tsx +30 -25
  24. package/lib/field/Email/Email.tsx +11 -13
  25. package/lib/field/Group/Group.tsx +10 -8
  26. package/lib/field/Integer/Integer.tsx +5 -7
  27. package/lib/field/Location/Location.css +4 -0
  28. package/lib/field/Location/Location.tsx +258 -0
  29. package/lib/field/Location/config-ext.json +8 -0
  30. package/lib/field/Location/index.tsx +1 -0
  31. package/lib/field/Multiselect/utils.ts +1 -1
  32. package/lib/field/ObjectReference/ObjectReference.tsx +235 -0
  33. package/lib/field/ObjectReference/index.tsx +1 -0
  34. package/lib/field/ObjectReference/utils.ts +111 -0
  35. package/lib/field/Percentage/Percentage.tsx +9 -9
  36. package/lib/field/Phone/Phone.tsx +7 -5
  37. package/lib/field/RadioButtons/RadioButtons.tsx +47 -5
  38. package/lib/field/RichText/RichText.css +79 -0
  39. package/lib/field/RichText/RichText.tsx +3 -1
  40. package/lib/field/ScalarList/ScalarList.tsx +2 -4
  41. package/lib/field/SelectableCard/SelectableCard.tsx +175 -0
  42. package/lib/field/SelectableCard/index.tsx +1 -0
  43. package/lib/field/SelectableCard/utils.tsx +223 -0
  44. package/lib/field/SemanticLink/SemanticLink.tsx +160 -28
  45. package/lib/field/SemanticLink/utils.ts +1 -1
  46. package/lib/field/TextArea/TextArea.tsx +5 -7
  47. package/lib/field/TextContent/TextContent.tsx +1 -2
  48. package/lib/field/TextInput/TextInput.tsx +5 -7
  49. package/lib/field/Time/Time.tsx +4 -8
  50. package/lib/field/URL/URL.tsx +5 -7
  51. package/lib/field/UserReference/UserReference.tsx +3 -6
  52. package/lib/helpers/attachmentShared.ts +6 -0
  53. package/lib/helpers/common-utils.ts +24 -2
  54. package/lib/helpers/data_page.ts +0 -1
  55. package/lib/helpers/field-group-utils.ts +1 -1
  56. package/lib/helpers/formatters/Currency.ts +20 -20
  57. package/lib/helpers/formatters/CurrencyMap.ts +0 -2
  58. package/lib/helpers/formatters/common.ts +2 -1
  59. package/lib/helpers/formatters/index.ts +2 -4
  60. package/lib/helpers/object-utils.ts +10 -0
  61. package/lib/helpers/simpleTableHelpers.ts +118 -6
  62. package/lib/helpers/utils.ts +8 -1
  63. package/lib/helpers/versionHelpers.ts +0 -1
  64. package/lib/infra/ActionButtons/ActionButtons.tsx +28 -21
  65. package/lib/infra/Assignment/Assignment.tsx +39 -36
  66. package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
  67. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +21 -113
  68. package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
  69. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +4 -3
  70. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +7 -6
  71. package/lib/infra/Containers/SimpleView/helper.ts +1 -1
  72. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +4 -5
  73. package/lib/infra/Containers/container-helpers.ts +52 -0
  74. package/lib/infra/DashboardFilter/DashboardFilter.tsx +5 -9
  75. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -6
  76. package/lib/infra/DeferLoad/DeferLoad.tsx +7 -9
  77. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -3
  78. package/lib/infra/MultiStep/MultiStep.css +48 -70
  79. package/lib/infra/MultiStep/MultiStep.tsx +27 -58
  80. package/lib/infra/NavBar/NavBar.css +1 -1
  81. package/lib/infra/NavBar/NavBar.tsx +43 -32
  82. package/lib/infra/Reference/Reference.tsx +3 -4
  83. package/lib/infra/Region/Region.tsx +1 -1
  84. package/lib/infra/RootContainer/RootContainer.tsx +3 -4
  85. package/lib/infra/Stages/Stages.tsx +3 -4
  86. package/lib/infra/View/View.tsx +4 -3
  87. package/lib/template/AdvancedSearch/AdvancedSearch.tsx +86 -0
  88. package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +52 -0
  89. package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +244 -0
  90. package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
  91. package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
  92. package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
  93. package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
  94. package/lib/template/AdvancedSearch/config-ext.json +9 -0
  95. package/lib/template/AdvancedSearch/index.tsx +1 -0
  96. package/lib/template/AppShell/AppShell.css +1 -1
  97. package/lib/template/AppShell/AppShell.tsx +22 -23
  98. package/lib/template/BannerPage/BannerPage.tsx +2 -2
  99. package/lib/template/CaseSummary/CaseSummary.tsx +28 -41
  100. package/lib/template/CaseView/CaseView.tsx +32 -38
  101. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +1 -1
  102. package/lib/template/Confirmation/Confirmation.tsx +3 -4
  103. package/lib/template/DataReference/DataReference.tsx +312 -106
  104. package/lib/template/DataReference/DataReferenceAdvancedSearchContext.ts +10 -0
  105. package/lib/template/DataReference/SearchForm.tsx +149 -0
  106. package/lib/template/DataReference/utils.ts +90 -0
  107. package/lib/template/DefaultForm/DefaultForm.tsx +3 -3
  108. package/lib/template/DefaultForm/utils/index.ts +1 -3
  109. package/lib/template/DefaultPage/DefaultPage.tsx +108 -0
  110. package/lib/template/DefaultPage/index.tsx +1 -0
  111. package/lib/template/Details/Details/Details.tsx +11 -11
  112. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +2 -2
  113. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +11 -11
  114. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +11 -11
  115. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +1 -2
  116. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +2 -5
  117. package/lib/template/InlineDashboard/InlineDashboard.tsx +14 -16
  118. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
  119. package/lib/template/ListPage/ListPage.tsx +1 -1
  120. package/lib/template/ListView/ListView.tsx +285 -204
  121. package/lib/template/ListView/hooks.ts +1 -5
  122. package/lib/template/ListView/utils.ts +38 -6
  123. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +1 -1
  124. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +5 -5
  125. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +11 -11
  126. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +2 -2
  127. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +2 -2
  128. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -7
  129. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
  130. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
  131. package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -3
  132. package/lib/template/SelfServiceCaseView/SelfServiceCaseView.tsx +145 -0
  133. package/lib/template/SelfServiceCaseView/index.tsx +1 -0
  134. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +2 -5
  135. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +99 -84
  136. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +3 -5
  137. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +10 -2
  138. package/lib/template/SubTabs/SubTabs.tsx +2 -2
  139. package/lib/template/SubTabs/tabUtils.ts +118 -1
  140. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +9 -10
  141. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
  142. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +9 -10
  143. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +5 -5
  144. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +11 -11
  145. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
  146. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
  147. package/lib/template/WssNavBar/WssNavBar.css +1 -1
  148. package/lib/template/WssNavBar/WssNavBar.tsx +6 -6
  149. package/lib/template/utils.tsx +58 -0
  150. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +1 -1
  151. package/lib/widget/Attachment/Attachment.css +7 -8
  152. package/lib/widget/Attachment/Attachment.tsx +304 -231
  153. package/lib/widget/Attachment/Attachment.types.ts +96 -0
  154. package/lib/widget/Attachment/AttachmentUtils.ts +316 -0
  155. package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
  156. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +0 -14
  157. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +3 -3
  158. package/lib/widget/FileUtility/FileUtility/FileUtility.css +7 -6
  159. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +30 -23
  160. package/lib/widget/Followers/Followers.tsx +2 -4
  161. package/lib/widget/QuickCreate/QuickCreate.tsx +1 -3
  162. package/lib/widget/SummaryItem/SummaryItem.css +9 -11
  163. package/lib/widget/SummaryItem/SummaryItem.tsx +3 -3
  164. package/lib/widget/SummaryList/SummaryList.tsx +1 -1
  165. package/lib/widget/ToDo/ToDo.css +1 -13
  166. package/lib/widget/ToDo/ToDo.tsx +38 -37
  167. package/package.json +1 -1
  168. package/lib/helpers/attachmentHelpers.ts +0 -76
  169. package/lib/infra/Containers/helpers.ts +0 -6
@@ -1,4 +1,4 @@
1
- import { createElement, ReactElement } from 'react';
1
+ import { createElement, type ReactElement } from 'react';
2
2
 
3
3
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
4
 
@@ -1,14 +1,15 @@
1
1
  import { getLocale } from './common';
2
2
  import CurrencyMap from './CurrencyMap';
3
3
 
4
+ const isValidValue = value => {
5
+ return value !== null && value !== undefined && value !== '';
6
+ };
7
+
4
8
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
5
9
  function NumberFormatter(value, { locale = 'en-US', decPlaces = 2, style = '', currency = 'USD' } = {}): string {
6
10
  const currentLocale: string | undefined = getLocale(locale);
7
- if (value !== null && value !== undefined) {
8
- return Number(value).toLocaleString(currentLocale, {
9
- minimumFractionDigits: decPlaces,
10
- maximumFractionDigits: decPlaces
11
- });
11
+ if (isValidValue(value)) {
12
+ return Number(value).toLocaleString(currentLocale, { minimumFractionDigits: decPlaces, maximumFractionDigits: decPlaces });
12
13
  }
13
14
  return value;
14
15
  }
@@ -19,15 +20,17 @@ function CurrencyFormatter(
19
20
  ): string {
20
21
  const currentLocale: string | undefined = getLocale(locale);
21
22
  let formattedValue: string = value;
22
- if (value !== null && value !== undefined && value !== '') {
23
- formattedValue = NumberFormatter(value, {
24
- locale: currentLocale,
25
- decPlaces,
26
- style,
27
- currency
28
- });
23
+ if (isValidValue(value)) {
24
+ formattedValue = NumberFormatter(value, { locale: currentLocale, decPlaces, style, currency });
29
25
 
30
- let countryCode: string | undefined = currentLocale?.split('-')[1].toUpperCase();
26
+ // For currency other than EUR, we need to determine the country code from currency code
27
+ // If currency is EUR, we use the locale to determine the country code
28
+ let countryCode: string | undefined;
29
+ if (currency !== 'EUR') {
30
+ countryCode = currency.substring(0, 2);
31
+ } else {
32
+ countryCode = currentLocale?.split('-')[1].toUpperCase();
33
+ }
31
34
 
32
35
  // If countryCode is still undefined, setting it as US
33
36
  if (!countryCode) {
@@ -56,7 +59,7 @@ function CurrencyFormatter(
56
59
 
57
60
  function SymbolFormatter(value, { symbol = '$', suffix = true, locale = 'en-US' } = {}): string {
58
61
  let formattedValue: string = value;
59
- if (value !== null && value !== undefined) {
62
+ if (isValidValue(value)) {
60
63
  formattedValue = NumberFormatter(value, { locale });
61
64
  return suffix ? `${formattedValue}${symbol}` : `${symbol}${formattedValue}`;
62
65
  }
@@ -67,11 +70,8 @@ export default {
67
70
  Currency: (value, options) => CurrencyFormatter(value, options),
68
71
  'Currency-Code': (value, options) => CurrencyFormatter(value, { ...options, symbol: false }),
69
72
  Decimal: (value, options) => NumberFormatter(value, options),
70
- 'Decimal-Auto': (value, options) =>
71
- NumberFormatter(value, {
72
- ...options,
73
- decPlaces: Number.isInteger(value) ? 0 : 2
74
- }),
73
+ 'Decimal-Auto': (value, options) => NumberFormatter(value, { ...options, decPlaces: Number.isInteger(value) ? 0 : 2 }),
75
74
  Integer: (value, options) => NumberFormatter(value, { ...options, decPlaces: 0 }),
76
- Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' })
75
+ Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' }),
76
+ isValidValue
77
77
  };
@@ -1,5 +1,3 @@
1
- /* eslint-disable no-template-curly-in-string */
2
-
3
1
  type CurrencyMapType = {
4
2
  name: string;
5
3
  symbolFormat: string;
@@ -7,7 +7,8 @@ export function getLocale(locale: string = '') {
7
7
  return Intl.DateTimeFormat().resolvedOptions().locale;
8
8
  }
9
9
 
10
- export function getCurrentTimezone(timezone: string = 'America/New_York') {
10
+ export function getCurrentTimezone(timezone?: string) {
11
+ // use timezone if specified
11
12
  if (timezone) return timezone;
12
13
  return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
13
14
  }
@@ -18,10 +18,8 @@ function getDateObject(text): Date {
18
18
  const day = parseInt(timeStamp.substr(6, 2), 10);
19
19
 
20
20
  const date = new Date();
21
-
22
- date.setDate(day);
23
- date.setMonth(month);
24
- date.setFullYear(year);
21
+ // Fix to handle all the dates, raised via https://github.com/pegasystems/react-sdk-components/issues/442
22
+ date.setFullYear(year, month, day);
25
23
 
26
24
  if (isDateTime) {
27
25
  const hours = parseInt(timeStamp.substr(9, 2), 10);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns the value of the key from objectInfo/caseInfo
3
+ * Added fallback to retrieve from caseInfo if objectInfo not present.
4
+ * @param pConnect
5
+ * @param key
6
+ * @returns the value of key
7
+ */
8
+ export const getResolvedConstantValue = (pConnect: typeof PConnect, key: string) => {
9
+ return pConnect.getValue(PCore.getResolvedConstantValue(key)) || pConnect.getValue(key);
10
+ };
@@ -89,6 +89,51 @@ export const getApiContext = (processedData, pConnect, reorderCB) => {
89
89
  };
90
90
  };
91
91
 
92
+ const PRIMARY_FIELDS = 'pyPrimaryFields';
93
+ const SUPPORTED_FIELD_TYPES = [
94
+ 'Address',
95
+ 'TextArea',
96
+ 'TextInput',
97
+ 'Phone',
98
+ 'Email',
99
+ 'Time',
100
+ 'URL',
101
+ 'Percentage',
102
+ 'Integer',
103
+ 'Decimal',
104
+ 'Date',
105
+ 'DateTime',
106
+ 'Currency',
107
+ 'Checkbox',
108
+ 'Dropdown',
109
+ 'AutoComplete',
110
+ 'UserReference',
111
+ 'RichText'
112
+ ];
113
+
114
+ export const getConfigFields = (rawFields, contextClass, primaryFieldsViewIndex) => {
115
+ let primaryFields: any = [];
116
+ let configFields: any = [];
117
+
118
+ if (primaryFieldsViewIndex > -1) {
119
+ let primaryFieldVMD: any = PCore.getMetadataUtils().resolveView(PRIMARY_FIELDS);
120
+ if (Array.isArray(primaryFieldVMD)) {
121
+ primaryFieldVMD = primaryFieldVMD.find(primaryFieldView => primaryFieldView.classID === contextClass);
122
+ primaryFields = primaryFieldVMD?.children?.[0]?.children || [];
123
+ } else if (primaryFieldVMD?.classID === contextClass) {
124
+ primaryFields = primaryFieldVMD?.children?.[0]?.children || [];
125
+ }
126
+
127
+ if (primaryFields.length) {
128
+ primaryFields = primaryFields.filter(primaryField => SUPPORTED_FIELD_TYPES.includes(primaryField.type));
129
+ }
130
+ }
131
+
132
+ configFields = [...rawFields.slice(0, primaryFieldsViewIndex), ...primaryFields, ...rawFields.slice(primaryFieldsViewIndex + 1)];
133
+ // filter duplicate fields after combining raw fields and primary fields
134
+ return configFields.filter((field, index) => configFields.findIndex(_field => field.config?.value === _field.config?.value) === index);
135
+ };
136
+
92
137
  export const buildMetaForListView = (fieldMetadata, fields, type, ruleClass, name, propertyLabel, isDataObject, parameters) => {
93
138
  return {
94
139
  name,
@@ -126,11 +171,80 @@ export const buildMetaForListView = (fieldMetadata, fields, type, ruleClass, nam
126
171
  };
127
172
  };
128
173
 
129
- export const buildFieldsForTable = (configFields, fields, showDeleteButton) => {
174
+ export function isFLProperty(label) {
175
+ return label?.startsWith('@FL');
176
+ }
177
+
178
+ /**
179
+ * [getFieldLabel]
180
+ * Description - A utility that returns resolved field label for "@FL" annotation i.e from data model.
181
+ * @param {Object} fieldConfig
182
+ * @returns {string} resolved label string
183
+ *
184
+ * example:
185
+ * fieldConfig = {label: "@FL .pyID", classID: "TestCase-Work"};
186
+ * return "Case ID"
187
+ */
188
+ export function getFieldLabel(fieldConfig) {
189
+ const { label, classID, caption } = fieldConfig;
190
+ let fieldLabel = (label ?? caption)?.substring(4);
191
+ const labelSplit = fieldLabel?.split('.');
192
+ const propertyName = labelSplit?.pop();
193
+ const fieldMetaData: any = PCore.getMetadataUtils().getPropertyMetadata(propertyName, classID) ?? {};
194
+ fieldLabel = fieldMetaData.label ?? fieldMetaData.caption ?? propertyName;
195
+ return fieldLabel;
196
+ }
197
+
198
+ export const updateFieldLabels = (fields, configFields, primaryFieldsViewIndex, pConnect, options) => {
199
+ const labelsOfFields: any = [];
200
+ const { columnsRawConfig = [] } = options;
201
+ fields.forEach((field, idx) => {
202
+ const rawColumnConfig = columnsRawConfig[idx]?.config;
203
+ if (field.config.value === PRIMARY_FIELDS) {
204
+ labelsOfFields.push('');
205
+ } else if (isFLProperty(rawColumnConfig?.label ?? rawColumnConfig?.caption)) {
206
+ labelsOfFields.push(getFieldLabel(rawColumnConfig) || field.config.label || field.config.caption);
207
+ } else {
208
+ labelsOfFields.push(field.config.label || field.config.caption);
209
+ }
210
+ });
211
+
212
+ if (primaryFieldsViewIndex > -1) {
213
+ const totalPrimaryFieldsColumns = configFields.length - fields.length + 1;
214
+ if (totalPrimaryFieldsColumns) {
215
+ const primaryFieldLabels: any = [];
216
+ for (let i = primaryFieldsViewIndex; i < primaryFieldsViewIndex + totalPrimaryFieldsColumns; i += 1) {
217
+ let label = configFields[i].config?.label;
218
+ if (isFLProperty(label)) {
219
+ label = getFieldLabel(configFields[i].config);
220
+ } else if (label.startsWith('@')) {
221
+ label = label.substring(3);
222
+ }
223
+ if (pConnect) {
224
+ label = pConnect.getLocalizedValue(label);
225
+ }
226
+ primaryFieldLabels.push(label);
227
+ }
228
+ labelsOfFields.splice(primaryFieldsViewIndex, 1, ...primaryFieldLabels);
229
+ } else {
230
+ labelsOfFields.splice(primaryFieldsViewIndex, 1);
231
+ }
232
+ }
233
+ return labelsOfFields;
234
+ };
235
+
236
+ export const buildFieldsForTable = (configFields, pConnect, showDeleteButton, options) => {
237
+ const { primaryFieldsViewIndex, fields } = options;
238
+
239
+ // get resolved field labels for primary fields raw config included in configFields
240
+ const fieldsLabels = updateFieldLabels(fields, configFields, primaryFieldsViewIndex, pConnect, {
241
+ columnsRawConfig: pConnect.getRawConfigProps()?.children?.find(item => item?.name === 'Columns')?.children
242
+ });
243
+
130
244
  const fieldDefs = configFields.map((field, index) => {
131
245
  return {
132
246
  type: 'text',
133
- label: fields[index].config.label || fields[index].config.caption,
247
+ label: fieldsLabels[index],
134
248
  fillAvailableSpace: !!field.config.fillAvailableSpace,
135
249
  id: `${index}`,
136
250
  name: field.config.value.substr(4),
@@ -213,7 +327,7 @@ export function createPConnect(contextName, referenceList, pageReference): any {
213
327
  };
214
328
 
215
329
  // create PConnect object
216
- const config = { meta: {}, options };
330
+ const config: any = { meta: {}, options };
217
331
  const { getPConnect } = PCore.createPConnect(config);
218
332
 
219
333
  return getPConnect();
@@ -231,11 +345,10 @@ export const filterData = filterByColumns => {
231
345
  case 'Date':
232
346
  case 'DateTime':
233
347
  case 'Time':
234
- value = (item[filterObj.ref] !== null ?? item[filterObj.ref] !== '') ? Utils.getSeconds(item[filterObj.ref]) : null;
348
+ value = item[filterObj.ref] !== null || item[filterObj.ref] !== '' ? Utils.getSeconds(item[filterObj.ref]) : null;
235
349
  filterValue =
236
350
  filterObj.containsFilterValue !== null && filterObj.containsFilterValue !== '' ? Utils.getSeconds(filterObj.containsFilterValue) : null;
237
351
 
238
- // eslint-disable-next-line sonarjs/no-nested-switch
239
352
  switch (filterObj.containsFilter) {
240
353
  case 'notequal':
241
354
  // becasue filterValue is in minutes, need to have a range of less than 60 secons
@@ -302,7 +415,6 @@ export const filterData = filterByColumns => {
302
415
  value = item[filterObj.ref].toLowerCase();
303
416
  filterValue = filterObj.containsFilterValue.toLowerCase();
304
417
 
305
- // eslint-disable-next-line sonarjs/no-nested-switch
306
418
  switch (filterObj.containsFilter) {
307
419
  case 'contains':
308
420
  if (value.indexOf(filterValue) < 0) {
@@ -48,7 +48,6 @@ export class Utils {
48
48
  // eslint-disable-next-line no-case-declarations
49
49
  const dataPage = configProps.datasource;
50
50
  if (typeof dataPage === 'string' && dataObject[dataPage]) {
51
- // eslint-disable-next-line no-alert
52
51
  alert('need to handle data page');
53
52
  } else {
54
53
  let listSourceItems = configProps.listOutput;
@@ -337,6 +336,14 @@ export class Utils {
337
336
  static isObject(objValue) {
338
337
  return objValue && typeof objValue === 'object' && objValue.constructor === Object;
339
338
  }
339
+
340
+ static getMappedKey(key) {
341
+ const mappedKey = PCore.getEnvironmentInfo().getKeyMapping(key);
342
+ if (!mappedKey) {
343
+ return key;
344
+ }
345
+ return mappedKey;
346
+ }
340
347
  }
341
348
 
342
349
  export default Utils;
@@ -10,6 +10,5 @@ export const sdkVersion = '8.7';
10
10
  export function compareSdkPCoreVersions() {
11
11
  // const theConstellationVersion = PCore.getPCoreVersion();
12
12
 
13
- // eslint-disable-next-line no-console
14
13
  console.warn(`Using Constellation version ${PCore.getPCoreVersion()}. Ensure this is the same version as your Infinity server.`);
15
14
  }
@@ -1,6 +1,6 @@
1
1
  import makeStyles from '@mui/styles/makeStyles';
2
2
  import Button from '@mui/material/Button';
3
- import { Grid, Divider } from '@mui/material';
3
+ import { Grid2, Divider } from '@mui/material';
4
4
 
5
5
  // ActionButtons does NOT have getPConnect. So, no need to extend from PConnProps
6
6
  interface ActionButtonsProps {
@@ -10,13 +10,18 @@ interface ActionButtonsProps {
10
10
  onButtonPress: any;
11
11
  }
12
12
 
13
- const useStyles = makeStyles((/* theme */) => ({
14
- button: {
15
- padding: '0px 5px'
16
- },
13
+ const useStyles = makeStyles(theme => ({
17
14
  divider: {
18
15
  marginTop: '10px',
19
16
  marginBottom: '10px'
17
+ },
18
+ secondaryButton: {
19
+ backgroundColor: theme.actionButtons.secondary.backgroundColor,
20
+ color: theme.actionButtons.secondary.color
21
+ },
22
+ primaryButton: {
23
+ backgroundColor: theme.actionButtons.primary.backgroundColor,
24
+ color: theme.actionButtons.primary.color
20
25
  }
21
26
  }));
22
27
 
@@ -33,42 +38,44 @@ export default function ActionButtons(props: ActionButtonsProps) {
33
38
  return (
34
39
  <>
35
40
  <Divider className={classes.divider} />
36
- <Grid container spacing={4} justifyContent='space-between'>
37
- <Grid item>
38
- <Grid container spacing={1}>
41
+ <Grid2 container spacing={4} justifyContent='space-between'>
42
+ <Grid2>
43
+ <Grid2 container spacing={1}>
39
44
  {arSecondaryButtons.map(sButton => (
40
- <Grid item key={sButton.name}>
45
+ <Grid2 key={sButton.name}>
41
46
  <Button
42
- variant='contained'
47
+ className={classes.secondaryButton}
43
48
  color='secondary'
49
+ variant='contained'
44
50
  onClick={() => {
45
51
  _onButtonPress(sButton.jsAction, 'secondary');
46
52
  }}
47
53
  >
48
54
  {localizedVal(sButton.name, localeCategory)}
49
55
  </Button>
50
- </Grid>
56
+ </Grid2>
51
57
  ))}
52
- </Grid>
53
- </Grid>
54
- <Grid item>
55
- <Grid container spacing={1}>
58
+ </Grid2>
59
+ </Grid2>
60
+ <Grid2>
61
+ <Grid2 container spacing={1}>
56
62
  {arMainButtons.map(mButton => (
57
- <Grid item key={mButton.name}>
63
+ <Grid2 key={mButton.name}>
58
64
  <Button
59
- variant='contained'
65
+ className={classes.primaryButton}
60
66
  color='primary'
67
+ variant='contained'
61
68
  onClick={() => {
62
69
  _onButtonPress(mButton.jsAction, 'primary');
63
70
  }}
64
71
  >
65
72
  {localizedVal(mButton.name, localeCategory)}
66
73
  </Button>
67
- </Grid>
74
+ </Grid2>
68
75
  ))}
69
- </Grid>
70
- </Grid>
71
- </Grid>
76
+ </Grid2>
77
+ </Grid2>
78
+ </Grid2>
72
79
  </>
73
80
  );
74
81
  }
@@ -1,4 +1,4 @@
1
- import React, { PropsWithChildren, useEffect, useState } from 'react';
1
+ import React, { type PropsWithChildren, useEffect, useState } from 'react';
2
2
  import Snackbar from '@mui/material/Snackbar';
3
3
  import IconButton from '@mui/material/IconButton';
4
4
  import CloseIcon from '@mui/icons-material/Close';
@@ -6,14 +6,14 @@ import CloseIcon from '@mui/icons-material/Close';
6
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
7
  import { useFocusFirstField, useScrolltoTop } from '@pega/react-sdk-components/lib/hooks';
8
8
 
9
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
10
 
11
11
  interface AssignmentProps extends PConnProps {
12
12
  // If any, enter additional props that only exist on this component
13
13
  itemKey: string;
14
14
  isInModal: boolean;
15
15
  banners: any[];
16
- // eslint-disable-next-line react/no-unused-prop-types
16
+
17
17
  actionButtons: any[];
18
18
  }
19
19
 
@@ -33,8 +33,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
33
33
 
34
34
  const actionsAPI = thePConn.getActionsApi();
35
35
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
36
+ const localizationService = thePConn.getLocalizationService();
36
37
  const localeCategory = 'Assignment';
37
- const localeReference = `${getPConnect().getCaseInfo().getClassName()}!CASE!${getPConnect().getCaseInfo().getName()}`.toUpperCase();
38
38
 
39
39
  // store off bound functions to above pointers
40
40
  const finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI);
@@ -76,7 +76,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
76
76
  function getStepsInfo(steps, formedSteps: any = []) {
77
77
  steps.forEach(step => {
78
78
  if (step.name) {
79
- step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
79
+ step.name = localizationService.getLocalizedText(step.name);
80
80
  }
81
81
  if (step.steps) {
82
82
  formedSteps = getStepsInfo(step.steps, formedSteps);
@@ -97,43 +97,50 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
97
97
  const oWorkItem = firstChild.props.getPConnect();
98
98
  const oWorkData = oWorkItem.getDataObject();
99
99
  const oData: any = thePConn.getDataObject(''); // 1st arg empty string until typedefs allow it to be optional
100
+ const caseInfo = oData?.caseInfo;
101
+ if (!oWorkData?.caseInfo || oWorkData.caseInfo.assignments === null || !caseInfo) {
102
+ return;
103
+ }
100
104
 
101
- if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
102
- const oCaseInfo = oData?.caseInfo;
105
+ // Set action buttons
106
+ if (caseInfo.actionButtons) {
107
+ setActionButtons(caseInfo.actionButtons);
108
+ }
103
109
 
104
- if (oCaseInfo && oCaseInfo.actionButtons) {
105
- setActionButtons(oCaseInfo.actionButtons);
106
- }
110
+ // Handle navigation setup
111
+ const navigation = caseInfo.navigation;
112
+ if (!navigation) {
113
+ setHasNavigation(false);
114
+ return;
115
+ }
107
116
 
108
- if (oCaseInfo?.navigation /* was oCaseInfo.navigation != null */) {
109
- setHasNavigation(true);
117
+ const isStandardTemplate = navigation.template?.toLowerCase() === 'standard';
118
+ const hasSingleStep = navigation.steps?.length === 1;
119
+ const shouldHideNavigation = isStandardTemplate || hasSingleStep;
110
120
 
111
- if (
112
- (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'standard') ||
113
- oCaseInfo?.navigation?.steps?.length === 1
114
- ) {
115
- setHasNavigation(false);
116
- } else if (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'vertical') {
117
- setIsVertical(true);
118
- } else {
119
- setIsVertical(false);
120
- }
121
+ setHasNavigation(!shouldHideNavigation);
121
122
 
122
- if (oCaseInfo?.navigation?.steps) {
123
- const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
124
- const formedSteps = getStepsInfo(steps);
125
- setArNavigationSteps(formedSteps);
126
- }
123
+ if (shouldHideNavigation) {
124
+ return;
125
+ }
127
126
 
128
- setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
129
- }
127
+ // set vertical navigation
128
+ const isVerticalTemplate = navigation.template?.toLowerCase() === 'vertical';
129
+ setIsVertical(isVerticalTemplate);
130
+
131
+ if (navigation.steps) {
132
+ const steps = JSON.parse(JSON.stringify(navigation.steps));
133
+ const formedSteps = getStepsInfo(steps);
134
+ setArNavigationSteps(formedSteps);
130
135
  }
136
+
137
+ setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
131
138
  }
132
139
  }, [children]);
133
140
 
134
141
  function showToast(message: string) {
135
142
  const theMessage = `Assignment: ${message}`;
136
- // eslint-disable-next-line no-console
143
+
137
144
  console.error(theMessage);
138
145
  setSnackbarMessage(message);
139
146
  setShowSnackbar(true);
@@ -147,7 +154,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
147
154
  }
148
155
 
149
156
  function onSaveActionSuccess(data) {
150
- actionsAPI.cancelAssignment(itemKey).then(() => {
157
+ actionsAPI.cancelAssignment(itemKey, false).then(() => {
151
158
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
152
159
  });
153
160
  }
@@ -174,7 +181,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
174
181
 
175
182
  savePromise
176
183
  .then(() => {
177
- // @ts-ignore - Property 'c11nEnv' is private and only accessible within class 'CaseInfo'.
178
184
  const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
179
185
  onSaveActionSuccess({ caseType, caseID, assignmentID });
180
186
  })
@@ -189,10 +195,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
189
195
  // check if create stage (modal)
190
196
  const { PUB_SUB_EVENTS } = PCore.getConstants();
191
197
  const { publish } = PCore.getPubSubUtils();
192
- // @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
193
198
  const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
194
199
  const isLocalAction =
195
- // @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
196
200
  thePConn.getCaseInfo().isLocalAction() ||
197
201
  (PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
198
202
  if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
@@ -206,7 +210,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
206
210
  showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
207
211
  });
208
212
  } else {
209
- const cancelPromise = cancelAssignment(itemKey);
213
+ const cancelPromise = cancelAssignment(itemKey, false);
210
214
 
211
215
  cancelPromise
212
216
  .then(data => {
@@ -275,7 +279,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
275
279
  }
276
280
 
277
281
  // expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
278
- // @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
279
282
  const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
280
283
  const context = thePConn.getContextName();
281
284
  const pageReference = thePConn.getPageReference();
@@ -1,6 +1,6 @@
1
- import { PropsWithChildren, useEffect, useState } from 'react';
1
+ import { type PropsWithChildren, useEffect, useState } from 'react';
2
2
 
3
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
5
 
6
6
  interface AssignmentCardProps extends PConnProps {