@pega/react-sdk-overrides 24.2.11 → 25.1.11

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 (173) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.css +46 -0
  2. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +37 -20
  3. package/lib/designSystemExtension/Banner/Banner.css +1 -1
  4. package/lib/designSystemExtension/Banner/Banner.tsx +10 -7
  5. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  6. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +53 -37
  7. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -13
  8. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +8 -9
  9. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +9 -9
  10. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +7 -8
  11. package/lib/designSystemExtension/Operator/Operator.tsx +21 -19
  12. package/lib/designSystemExtension/Pulse/Pulse.tsx +1 -1
  13. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +32 -4
  14. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +7 -14
  15. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +13 -2
  16. package/lib/field/AutoComplete/AutoComplete.tsx +1 -1
  17. package/lib/field/CancelAlert/CancelAlert.css +4 -4
  18. package/lib/field/CancelAlert/CancelAlert.tsx +6 -6
  19. package/lib/field/Checkbox/Checkbox.tsx +97 -4
  20. package/lib/field/Currency/Currency.tsx +3 -3
  21. package/lib/field/Currency/currency-utils.ts +1 -2
  22. package/lib/field/Date/Date.tsx +3 -7
  23. package/lib/field/DateTime/DateTime.tsx +3 -8
  24. package/lib/field/Decimal/Decimal.tsx +3 -5
  25. package/lib/field/Dropdown/Dropdown.tsx +5 -7
  26. package/lib/field/Email/Email.tsx +11 -13
  27. package/lib/field/Group/Group.tsx +10 -8
  28. package/lib/field/Integer/Integer.tsx +5 -7
  29. package/lib/field/Location/Location.css +4 -0
  30. package/lib/field/Location/Location.tsx +258 -0
  31. package/lib/field/Location/config-ext.json +8 -0
  32. package/lib/field/Location/index.tsx +1 -0
  33. package/lib/field/Multiselect/utils.ts +1 -1
  34. package/lib/field/ObjectReference/ObjectReference.tsx +235 -0
  35. package/lib/field/ObjectReference/index.tsx +1 -0
  36. package/lib/field/ObjectReference/utils.ts +111 -0
  37. package/lib/field/Percentage/Percentage.tsx +3 -7
  38. package/lib/field/Phone/Phone.tsx +7 -5
  39. package/lib/field/RadioButtons/RadioButtons.tsx +47 -2
  40. package/lib/field/RichText/RichText.css +79 -0
  41. package/lib/field/RichText/RichText.tsx +3 -1
  42. package/lib/field/ScalarList/ScalarList.tsx +2 -3
  43. package/lib/field/SelectableCard/SelectableCard.tsx +189 -0
  44. package/lib/field/SelectableCard/index.tsx +1 -0
  45. package/lib/field/SelectableCard/utils.tsx +223 -0
  46. package/lib/field/SemanticLink/SemanticLink.tsx +160 -28
  47. package/lib/field/SemanticLink/utils.ts +1 -1
  48. package/lib/field/TextArea/TextArea.tsx +5 -7
  49. package/lib/field/TextContent/TextContent.tsx +1 -2
  50. package/lib/field/TextInput/TextInput.tsx +5 -7
  51. package/lib/field/Time/Time.tsx +3 -7
  52. package/lib/field/URL/URL.tsx +5 -7
  53. package/lib/field/UserReference/UserReference.tsx +2 -3
  54. package/lib/helpers/attachmentShared.ts +6 -0
  55. package/lib/helpers/common-utils.ts +3 -4
  56. package/lib/helpers/data_page.ts +0 -1
  57. package/lib/helpers/field-group-utils.ts +1 -1
  58. package/lib/helpers/formatters/Currency.ts +9 -4
  59. package/lib/helpers/formatters/CurrencyMap.ts +0 -2
  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 +47 -31
  66. package/lib/infra/Assignment/useValidationBanner.ts +29 -0
  67. package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
  68. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +22 -102
  69. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +1 -2
  70. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +12 -6
  71. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +8 -13
  72. package/lib/infra/Containers/container-helpers.ts +47 -1
  73. package/lib/infra/DashboardFilter/DashboardFilter.tsx +3 -6
  74. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
  75. package/lib/infra/DeferLoad/DeferLoad.tsx +26 -13
  76. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -3
  77. package/lib/infra/MultiStep/MultiStep.css +48 -70
  78. package/lib/infra/MultiStep/MultiStep.tsx +27 -53
  79. package/lib/infra/NavBar/NavBar.css +1 -1
  80. package/lib/infra/NavBar/NavBar.tsx +49 -34
  81. package/lib/infra/Reference/Reference.tsx +8 -4
  82. package/lib/infra/Region/Region.tsx +1 -1
  83. package/lib/infra/RootContainer/RootContainer.tsx +6 -8
  84. package/lib/infra/Stages/Stages.tsx +3 -4
  85. package/lib/infra/View/View.tsx +9 -9
  86. package/lib/template/AdvancedSearch/AdvancedSearch.tsx +86 -0
  87. package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +52 -0
  88. package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +244 -0
  89. package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
  90. package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
  91. package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
  92. package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
  93. package/lib/template/AdvancedSearch/config-ext.json +9 -0
  94. package/lib/template/AdvancedSearch/index.tsx +1 -0
  95. package/lib/template/AppShell/AppShell.css +1 -5
  96. package/lib/template/AppShell/AppShell.tsx +16 -17
  97. package/lib/template/BannerPage/BannerPage.tsx +2 -2
  98. package/lib/template/CaseSummary/CaseSummary.tsx +25 -43
  99. package/lib/template/CaseView/CaseView.tsx +28 -35
  100. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +1 -1
  101. package/lib/template/Confirmation/Confirmation.tsx +2 -3
  102. package/lib/template/DataReference/DataReference.tsx +312 -106
  103. package/lib/template/DataReference/DataReferenceAdvancedSearchContext.ts +10 -0
  104. package/lib/template/DataReference/SearchForm.tsx +149 -0
  105. package/lib/template/DataReference/utils.ts +90 -0
  106. package/lib/template/DefaultForm/DefaultForm.tsx +3 -3
  107. package/lib/template/DefaultForm/utils/index.ts +1 -3
  108. package/lib/template/DefaultPage/DefaultPage.tsx +108 -0
  109. package/lib/template/DefaultPage/index.tsx +1 -0
  110. package/lib/template/Details/Details/Details.tsx +11 -11
  111. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +2 -2
  112. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +11 -11
  113. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +11 -11
  114. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +1 -1
  115. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +12 -6
  116. package/lib/template/HierarchicalForm/HierarchicalForm.tsx +58 -0
  117. package/lib/template/HierarchicalForm/hooks.ts +224 -0
  118. package/lib/template/HierarchicalForm/index.tsx +1 -0
  119. package/lib/template/InlineDashboard/InlineDashboard.tsx +14 -16
  120. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
  121. package/lib/template/ListPage/ListPage.tsx +1 -1
  122. package/lib/template/ListView/ListView.tsx +342 -204
  123. package/lib/template/ListView/hooks.ts +1 -5
  124. package/lib/template/ListView/utils.ts +38 -5
  125. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +17 -2
  126. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +5 -5
  127. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +11 -11
  128. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +2 -2
  129. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +2 -2
  130. package/lib/template/ObjectPage/index.tsx +1 -0
  131. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -7
  132. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
  133. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
  134. package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -2
  135. package/lib/template/SelfServiceCaseView/SelfServiceCaseView.tsx +153 -0
  136. package/lib/template/SelfServiceCaseView/index.tsx +1 -0
  137. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +2 -3
  138. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +45 -34
  139. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +1 -1
  140. package/lib/template/SimpleTable/SimpleTableSelectReadonly/SimpleTableSelectReadonly.tsx +179 -0
  141. package/lib/template/SimpleTable/SimpleTableSelectReadonly/index.tsx +1 -0
  142. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +10 -2
  143. package/lib/template/SubTabs/SubTabs.tsx +2 -2
  144. package/lib/template/SubTabs/tabUtils.ts +118 -1
  145. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +9 -10
  146. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
  147. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +9 -10
  148. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +5 -5
  149. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +11 -11
  150. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
  151. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
  152. package/lib/template/WssNavBar/WssNavBar.css +1 -1
  153. package/lib/template/WssNavBar/WssNavBar.tsx +6 -6
  154. package/lib/template/utils.tsx +58 -0
  155. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +1 -1
  156. package/lib/widget/Attachment/Attachment.css +6 -8
  157. package/lib/widget/Attachment/Attachment.tsx +303 -225
  158. package/lib/widget/Attachment/Attachment.types.ts +96 -0
  159. package/lib/widget/Attachment/AttachmentUtils.ts +316 -0
  160. package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
  161. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +0 -14
  162. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +3 -3
  163. package/lib/widget/FileUtility/FileUtility/FileUtility.css +7 -6
  164. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +29 -22
  165. package/lib/widget/Followers/Followers.tsx +2 -4
  166. package/lib/widget/QuickCreate/QuickCreate.tsx +1 -2
  167. package/lib/widget/SummaryItem/SummaryItem.css +9 -11
  168. package/lib/widget/SummaryItem/SummaryItem.tsx +2 -2
  169. package/lib/widget/SummaryList/SummaryList.tsx +1 -1
  170. package/lib/widget/ToDo/ToDo.css +1 -13
  171. package/lib/widget/ToDo/ToDo.tsx +37 -36
  172. package/package.json +1 -1
  173. package/lib/helpers/attachmentHelpers.ts +0 -76
@@ -1,13 +1,11 @@
1
- import Typography from '@mui/material/Typography';
2
- import Grid from '@mui/material/Grid';
1
+ import { Link } from '@mui/material';
3
2
  import makeStyles from '@mui/styles/makeStyles';
4
3
 
5
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
5
 
8
- /* although this is called the SemanticLink component, we are not yet displaying as a
9
- SemanticLink in SDK and only showing the value as a read only text field. */
6
+ import semanticUtils from './utils';
10
7
 
8
+ // eslint-disable-next-line
11
9
  const useStyles = makeStyles(theme => ({
12
10
  root: {
13
11
  paddingRight: theme.spacing(1),
@@ -41,36 +39,170 @@ const useStyles = makeStyles(theme => ({
41
39
 
42
40
  interface SemanticLinkProps extends PConnFieldProps {
43
41
  // If any, enter additional props that only exist on SemanticLink here
44
- // from previous PropTypes
45
42
  text: string;
43
+ resourcePayload: any;
44
+ resourceParams: any;
45
+ previewKey: string | null;
46
+ onClick: (event: any) => void;
47
+ testId: string;
48
+ referenceType: string | null;
49
+ dataRelationshipContext: string | null;
50
+ contextPage: any;
46
51
  }
47
52
 
48
53
  export default function SemanticLink(props: SemanticLinkProps) {
49
- // Get emitted components from map (so we can get any override that may exist)
50
- const FieldValueList = getComponentFromMap('FieldValueList');
54
+ const {
55
+ text,
56
+ resourcePayload = {},
57
+ resourceParams = {},
58
+ getPConnect,
59
+ previewKey,
60
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
61
+ onClick,
62
+ testId = '',
63
+ referenceType,
64
+ dataRelationshipContext = null,
65
+ contextPage,
66
+ ...restProps
67
+ } = props;
68
+ const { ACTION_OPENWORKBYHANDLE, ACTION_SHOWDATA }: any = PCore.getSemanticUrlUtils().getActions();
69
+ const pConnect = getPConnect();
70
+ const dataResourcePayLoad = resourcePayload?.resourceType === 'DATA' ? resourcePayload : null;
51
71
 
52
- const { text, displayMode, label, hideLabel } = props;
53
- const classes = useStyles();
72
+ const {
73
+ RESOURCE_TYPES: { DATA },
74
+ WORKCLASS,
75
+ CASE_INFO: { CASE_INFO_CLASSID }
76
+ } = PCore.getConstants();
54
77
 
55
- if (displayMode === 'DISPLAY_ONLY' || (!displayMode && label !== undefined)) {
56
- const value = text || '---';
57
- return (
58
- <Grid container spacing={1} style={{ padding: '4px 0px' }} id='semantic-link-grid'>
59
- <Grid item xs={6}>
60
- <Typography variant='body2' component='span' className={`${classes.fieldLabel} ${classes.fieldMargin}`}>
61
- {label}
62
- </Typography>
63
- </Grid>
64
- <Grid item xs={6}>
65
- <Typography variant='body2' component='span' className={classes.fieldValue}>
66
- {value}
67
- </Typography>
68
- </Grid>
69
- </Grid>
78
+ let linkURL = '';
79
+ let payload = {};
80
+ let dataViewName;
81
+ let linkComponentProps = {
82
+ href: linkURL
83
+ };
84
+ if (text) {
85
+ (linkComponentProps as any).href = linkURL;
86
+ }
87
+ let isData = false;
88
+ const shouldTreatAsDataReference = !previewKey && resourcePayload.caseClassName;
89
+ if (contextPage?.classID) {
90
+ resourcePayload.caseClassName = contextPage.classID;
91
+ }
92
+ /* TODO : In case of duplicate search case the classID is Work- need to set it to
93
+ the current case class ID */
94
+ if (resourcePayload.caseClassName === WORKCLASS) {
95
+ resourcePayload.caseClassName = pConnect.getValue(CASE_INFO_CLASSID);
96
+ }
97
+
98
+ function showDataAction() {
99
+ if (dataResourcePayLoad && dataResourcePayLoad.resourceType === 'DATA') {
100
+ const { content } = dataResourcePayLoad;
101
+ const lookUpDataPageInfo = PCore.getDataTypeUtils().getLookUpDataPageInfo(dataResourcePayLoad?.className);
102
+ const lookUpDataPage = PCore.getDataTypeUtils().getLookUpDataPage(dataResourcePayLoad?.className);
103
+ if (lookUpDataPageInfo) {
104
+ const { parameters }: any = lookUpDataPageInfo;
105
+ payload = Object.keys(parameters).reduce((acc, param) => {
106
+ const paramValue = parameters[param];
107
+ return {
108
+ ...acc,
109
+ [param]: PCore.getAnnotationUtils().isProperty(paramValue) ? content[PCore.getAnnotationUtils().getPropertyName(paramValue)] : paramValue
110
+ };
111
+ }, {});
112
+ }
113
+ getPConnect()
114
+ .getActionsApi()
115
+ .showData('pyDetails', lookUpDataPage, {
116
+ ...payload
117
+ });
118
+ }
119
+ if ((referenceType && referenceType.toUpperCase() === DATA) || shouldTreatAsDataReference) {
120
+ getPConnect()
121
+ .getActionsApi()
122
+ .showData('pyDetails', dataViewName, {
123
+ ...payload
124
+ });
125
+ }
126
+ }
127
+
128
+ function openLinkClick(e) {
129
+ if (!e.metaKey && !e.ctrlKey) {
130
+ e.preventDefault();
131
+ if (
132
+ (dataResourcePayLoad && dataResourcePayLoad.resourceType === 'DATA') ||
133
+ (referenceType && referenceType.toUpperCase() === DATA) ||
134
+ shouldTreatAsDataReference
135
+ ) {
136
+ showDataAction();
137
+ } else if (previewKey) {
138
+ getPConnect().getActionsApi().openWorkByHandle(previewKey, resourcePayload.caseClassName);
139
+ }
140
+ }
141
+ }
142
+
143
+ if ((referenceType && referenceType.toUpperCase() === DATA) || shouldTreatAsDataReference) {
144
+ try {
145
+ isData = true;
146
+ // @ts-expect-error
147
+ const dataRefContext = semanticUtils.getDataReferenceInfo(pConnect, dataRelationshipContext, contextPage);
148
+ dataViewName = dataRefContext.dataContext;
149
+ payload = dataRefContext.dataContextParameters as any;
150
+ } catch (error) {
151
+ console.log('Error in getting the data reference info', error);
152
+ }
153
+ } else if (resourcePayload && resourcePayload.resourceType === 'DATA') {
154
+ isData = true;
155
+ dataViewName = PCore.getDataTypeUtils().getLookUpDataPage(resourcePayload.className);
156
+ const lookUpDataPageInfo = PCore.getDataTypeUtils().getLookUpDataPageInfo(resourcePayload.className);
157
+ const { content } = resourcePayload;
158
+ if (lookUpDataPageInfo) {
159
+ const { parameters }: any = lookUpDataPageInfo;
160
+ payload = Object.keys(parameters).reduce((acc, param) => {
161
+ const paramValue = parameters[param];
162
+ return {
163
+ ...acc,
164
+ [param]: PCore.getAnnotationUtils().isProperty(paramValue) ? content[PCore.getAnnotationUtils().getPropertyName(paramValue)] : paramValue
165
+ };
166
+ }, {});
167
+ } else {
168
+ const keysInfo = PCore.getDataTypeUtils().getDataPageKeys(dataViewName) ?? [];
169
+ payload = keysInfo.reduce((acc, curr) => {
170
+ return {
171
+ ...acc,
172
+ [curr.keyName]: content[curr.isAlternateKeyStorage ? curr.linkedField : curr.keyName]
173
+ };
174
+ }, {});
175
+ }
176
+ }
177
+
178
+ if (isData && dataViewName && payload) {
179
+ linkURL = PCore.getSemanticUrlUtils().getResolvedSemanticURL(
180
+ ACTION_SHOWDATA,
181
+ { pageName: 'pyDetails', dataViewName },
182
+ {
183
+ ...payload
184
+ }
70
185
  );
186
+ } else {
187
+ // BUG-678282 fix to handle scenario when workID was not populated.
188
+ // Check renderParentLink in Caseview / CasePreview
189
+ resourceParams.objectID = resourceParams.workID === '' && typeof previewKey === 'string' ? previewKey.split(' ')[1] : resourceParams.workID;
190
+ if (previewKey) {
191
+ resourceParams.id = previewKey;
192
+ }
193
+ linkURL = PCore.getSemanticUrlUtils().getResolvedSemanticURL(ACTION_OPENWORKBYHANDLE, resourcePayload, resourceParams);
71
194
  }
72
195
 
73
- if (displayMode === 'STACKED_LARGE_VAL') {
74
- return <FieldValueList name={hideLabel ? '' : label} value={text} variant='stacked' />;
196
+ if (text) {
197
+ linkComponentProps = {
198
+ ...linkComponentProps,
199
+ href: linkURL
200
+ };
75
201
  }
202
+
203
+ return (
204
+ <Link component='button' {...linkComponentProps} {...restProps} onClick={openLinkClick} data-testid={testId}>
205
+ {text || '--'}
206
+ </Link>
207
+ );
76
208
  }
@@ -32,7 +32,7 @@ function getDataReferenceInfo(pConnect, dataRelationshipContext) {
32
32
  dataContext = name;
33
33
  for (const [key, value] of Object.entries(parameters)) {
34
34
  const property =
35
- // @ts-ignore - Property 'getLeafPropertyName' is private and only accessible within class 'AnnotationUtils'
35
+ // @ts-expect-error - Property 'getLeafPropertyName' is private and only accessible within class 'AnnotationUtils'
36
36
  dataRelationshipContext !== null ? annotationUtils.getPropertyName(value as string) : annotationUtils.getLeafPropertyName(value);
37
37
  payload[key] = pConnect.getValue(`.${property}`);
38
38
  }
@@ -3,7 +3,7 @@ import { TextField } from '@mui/material';
3
3
 
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
 
8
8
  interface TextAreaProps extends PConnFieldProps {
9
9
  // If any, enter additional props that only exist on TextArea here
@@ -58,11 +58,7 @@ export default function TextArea(props: TextAreaProps) {
58
58
  readOnlyProp = { readOnly: true };
59
59
  }
60
60
 
61
- let testProp = {};
62
-
63
- testProp = {
64
- 'data-test-id': testId
65
- };
61
+ const testProps: any = { 'data-test-id': testId };
66
62
 
67
63
  function handleChange(event) {
68
64
  // update internal value
@@ -90,7 +86,9 @@ export default function TextArea(props: TextAreaProps) {
90
86
  error={status === 'error'}
91
87
  label={label}
92
88
  value={inputValue}
93
- InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}
89
+ slotProps={{
90
+ input: { ...readOnlyProp, inputProps: { maxLength, ...testProps } }
91
+ }}
94
92
  />
95
93
  );
96
94
  }
@@ -1,6 +1,6 @@
1
1
  import { Typography } from '@mui/material';
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
 
5
5
  interface TextContentProps extends PConnProps {
6
6
  // If any, enter additional props that only exist on TextContent here
@@ -38,7 +38,6 @@ export default function TextContent(props: TextContentProps) {
38
38
  break;
39
39
 
40
40
  default:
41
- // eslint-disable-next-line no-console
42
41
  console.error(`TextContent got an expected displayAs prop: ${displayAs}`);
43
42
  break;
44
43
  }
@@ -3,7 +3,7 @@ import { TextField } from '@mui/material';
3
3
 
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
 
8
8
  interface TextInputProps extends PConnFieldProps {
9
9
  // If any, enter additional props that only exist on TextInput here
@@ -59,11 +59,7 @@ export default function TextInput(props: TextInputProps) {
59
59
  readOnlyProp = { readOnly: true };
60
60
  }
61
61
 
62
- let testProp = {};
63
-
64
- testProp = {
65
- 'data-test-id': testId
66
- };
62
+ const testProps: any = { 'data-test-id': testId };
67
63
 
68
64
  function handleChange(event) {
69
65
  // update internal value
@@ -88,7 +84,9 @@ export default function TextInput(props: TextInputProps) {
88
84
  error={status === 'error'}
89
85
  label={label}
90
86
  value={inputValue}
91
- InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}
87
+ slotProps={{
88
+ input: { ...readOnlyProp, inputProps: { maxLength, ...testProps } }
89
+ }}
92
90
  />
93
91
  );
94
92
  }
@@ -4,7 +4,7 @@ import dayjs from 'dayjs';
4
4
 
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
8
 
9
9
  interface TimeProps extends PConnFieldProps {
10
10
  // If any, enter additional props that only exist on Time here
@@ -32,11 +32,7 @@ export default function Time(props: TimeProps) {
32
32
  return <TextInput {...props} />;
33
33
  }
34
34
 
35
- let testProp = {};
36
-
37
- testProp = {
38
- 'data-test-id': testId
39
- };
35
+ const testProps: any = { 'data-test-id': testId };
40
36
 
41
37
  const handleChange = date => {
42
38
  const theValue = date && date.isValid() ? date.format('HH:mm:ss') : null;
@@ -75,7 +71,7 @@ export default function Time(props: TimeProps) {
75
71
  error: status === 'error',
76
72
  helperText: helperTextToDisplay,
77
73
  size: 'small',
78
- InputProps: { ...testProp }
74
+ InputProps: { ...testProps }
79
75
  }
80
76
  }}
81
77
  />
@@ -3,7 +3,7 @@ import { TextField } from '@mui/material';
3
3
 
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
 
8
8
  interface URLComponentProps extends PConnFieldProps {
9
9
  // If any, enter additional props that only exist on URLComponent here
@@ -56,11 +56,7 @@ export default function URLComponent(props: URLComponentProps) {
56
56
  return <TextInput {...props} />;
57
57
  }
58
58
 
59
- let testProp = {};
60
-
61
- testProp = {
62
- 'data-test-id': testId
63
- };
59
+ const testProps: any = { 'data-test-id': testId };
64
60
 
65
61
  const handleChange = event => {
66
62
  setInputValue(event?.target?.value);
@@ -85,7 +81,9 @@ export default function URLComponent(props: URLComponentProps) {
85
81
  error={status === 'error'}
86
82
  label={label}
87
83
  value={inputValue}
88
- InputProps={{ inputProps: { ...testProp } }}
84
+ slotProps={{
85
+ input: { inputProps: { ...testProps } }
86
+ }}
89
87
  />
90
88
  );
91
89
  }
@@ -2,9 +2,8 @@ import { memo, useEffect, useState } from 'react';
2
2
  import { Typography } from '@mui/material';
3
3
 
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
6
 
7
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
8
7
  import { getUserId, isUserNameAvailable } from './UserReferenceUtils';
9
8
 
10
9
  const DROPDOWN_LIST = 'Drop-down list';
@@ -34,6 +33,7 @@ const UserReference = (props: UserReferenceProps) => {
34
33
  // Get emitted components from map (so we can get any override that may exist)
35
34
  const AutoComplete = getComponentFromMap('AutoComplete');
36
35
  const Dropdown = getComponentFromMap('Dropdown');
36
+ const FieldValueList = getComponentFromMap('FieldValueList');
37
37
 
38
38
  const {
39
39
  label = '',
@@ -89,7 +89,6 @@ const UserReference = (props: UserReferenceProps) => {
89
89
  setDropDownDataSource(ddDataSource);
90
90
  })
91
91
  .catch(err => {
92
- // eslint-disable-next-line no-console
93
92
  console.error(err);
94
93
  });
95
94
  }
@@ -0,0 +1,6 @@
1
+ const megabyteSize = 1048576;
2
+
3
+ export const validateMaxSize = (fileObj: Record<string, number>, maxSizeInMB: string) => {
4
+ const fileSize = (fileObj.size / megabyteSize).toFixed(2);
5
+ return parseFloat(fileSize) < parseFloat(maxSizeInMB);
6
+ };
@@ -1,4 +1,4 @@
1
- export function isEmptyObject(obj: Object): boolean {
1
+ export function isEmptyObject(obj: object): boolean {
2
2
  return Object.keys(obj).length === 0;
3
3
  }
4
4
 
@@ -9,14 +9,13 @@ export function isEmptyObject(obj: Object): boolean {
9
9
  * @returns The localized string or the key itself if no translation is found
10
10
  */
11
11
  export function getGenericFieldsLocalizedValue(path: string, key: string): string {
12
- const GENERIC_BUNDLE_KEY = PCore.getLocaleUtils().GENERIC_BUNDLE_KEY;
13
- const localeStore = PCore.getLocaleUtils().localeStore[GENERIC_BUNDLE_KEY];
12
+ const localeStore = PCore.getLocaleUtils().localeStore;
14
13
 
15
14
  if (!localeStore) return key;
16
15
 
17
16
  // Split the path and traverse the object
18
17
  const pathParts = path.split('.');
19
- let currentObj = localeStore;
18
+ let currentObj: any = localeStore;
20
19
 
21
20
  for (const part of pathParts) {
22
21
  if (!currentObj[part]) return key;
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line import/prefer-default-export
2
1
  export const getDataPage = (dataPageName, parameters, context) => {
3
2
  let dataViewParams;
4
3
  if (parameters) {
@@ -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,10 +1,14 @@
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) {
11
+ if (isValidValue(value)) {
8
12
  return Number(value).toLocaleString(currentLocale, { minimumFractionDigits: decPlaces, maximumFractionDigits: decPlaces });
9
13
  }
10
14
  return value;
@@ -16,7 +20,7 @@ function CurrencyFormatter(
16
20
  ): string {
17
21
  const currentLocale: string | undefined = getLocale(locale);
18
22
  let formattedValue: string = value;
19
- if (value !== null && value !== undefined && value !== '') {
23
+ if (isValidValue(value)) {
20
24
  formattedValue = NumberFormatter(value, { locale: currentLocale, decPlaces, style, currency });
21
25
 
22
26
  // For currency other than EUR, we need to determine the country code from currency code
@@ -55,7 +59,7 @@ function CurrencyFormatter(
55
59
 
56
60
  function SymbolFormatter(value, { symbol = '$', suffix = true, locale = 'en-US' } = {}): string {
57
61
  let formattedValue: string = value;
58
- if (value !== null && value !== undefined) {
62
+ if (isValidValue(value)) {
59
63
  formattedValue = NumberFormatter(value, { locale });
60
64
  return suffix ? `${formattedValue}${symbol}` : `${symbol}${formattedValue}`;
61
65
  }
@@ -68,5 +72,6 @@ export default {
68
72
  Decimal: (value, options) => NumberFormatter(value, options),
69
73
  'Decimal-Auto': (value, options) => NumberFormatter(value, { ...options, decPlaces: Number.isInteger(value) ? 0 : 2 }),
70
74
  Integer: (value, options) => NumberFormatter(value, { ...options, decPlaces: 0 }),
71
- Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' })
75
+ Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' }),
76
+ isValidValue
72
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;
@@ -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) {