@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
@@ -0,0 +1,223 @@
1
+ import { Link } from '@mui/material';
2
+
3
+ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
4
+
5
+ export const resolveReferencedPConnect = pConnect => {
6
+ if (!pConnect || !pConnect.meta) return undefined;
7
+ const type = pConnect?._type ?? undefined;
8
+ const referencedPConnect = type === 'reference' && pConnect.getReferencedViewPConnect().getPConnect();
9
+ return referencedPConnect || pConnect;
10
+ };
11
+
12
+ /**
13
+ * A helper function to create an object consisting react component as per the type.
14
+ * This is used by CaseSummary template.
15
+ * @param {object} pConnectMeta Object containing meta information for the particular field authored
16
+ * @param {Function} getPConnect PConnect function passed along to other components.
17
+ * @param {string} displayMode displayMode string contains information about the layout of component in review mode.
18
+ */
19
+ export function prepareComponentInCaseSummary(pConnectMeta: any, getPConnect: Function) {
20
+ const { config, children } = pConnectMeta;
21
+
22
+ const noValueComponent = <div>No Value</div>;
23
+ const placeholder = '...';
24
+ const pConnect = getPConnect();
25
+
26
+ const caseSummaryComponentObject: any = {};
27
+
28
+ let { type } = pConnectMeta;
29
+ let showAddressLabel = true;
30
+
31
+ if (config && config.value === `@P .${Utils.getMappedKey('pyStatusWork')}`) {
32
+ config.displayAsStatus = true;
33
+ type = 'TextInput'; // force the type to be TextInput for status field.
34
+ // As TextInput is loaded forcefully sometimes, TextInput component might not be available in lazy map.
35
+ // Load TextInput if it is not available.
36
+ if (!PCore.getComponentsRegistry().getLazyComponent(type)) {
37
+ PCore.getAssetLoader().getLoader('component-loader')([type]);
38
+ }
39
+ }
40
+
41
+ caseSummaryComponentObject.name = pConnect.resolveConfigProps({ label: config.label }).label;
42
+
43
+ if (config.inheritedProps) {
44
+ const labelInInheritedProp = config.inheritedProps.find(inheritedProp => inheritedProp.prop === 'label');
45
+ if (labelInInheritedProp) {
46
+ labelInInheritedProp.value = pConnect.resolveConfigProps({ label: labelInInheritedProp.value }).label;
47
+ }
48
+ }
49
+
50
+ switch (type) {
51
+ case 'CaseOperator': {
52
+ if (config.label.includes('Create operator')) {
53
+ caseSummaryComponentObject.name = pConnect.resolveConfigProps({
54
+ createLabel: config.createLabel
55
+ }).createLabel;
56
+ } else if (config.label.includes('Update operator')) {
57
+ caseSummaryComponentObject.name = pConnect.resolveConfigProps({
58
+ updateLabel: config.updateLabel
59
+ }).updateLabel;
60
+ } else {
61
+ caseSummaryComponentObject.name = pConnect.resolveConfigProps({
62
+ resolveLabel: config.resolveLabel
63
+ }).resolveLabel;
64
+ }
65
+
66
+ break;
67
+ }
68
+ case 'Checkbox': {
69
+ caseSummaryComponentObject.name = pConnect.resolveConfigProps({
70
+ label: config.caption
71
+ }).label;
72
+
73
+ break;
74
+ }
75
+ case 'Pega_UI_PercentageWidget': {
76
+ const rawValue = pConnect.resolveConfigProps({
77
+ value: config.value
78
+ }).value;
79
+
80
+ caseSummaryComponentObject.simpleValue = rawValue || rawValue === 0 ? `${rawValue}%` : noValueComponent;
81
+ break;
82
+ }
83
+ case 'Address': {
84
+ showAddressLabel = false;
85
+
86
+ caseSummaryComponentObject.variant = 'stacked';
87
+ break;
88
+ }
89
+ case 'Location':
90
+ case 'RichText': {
91
+ const rawValue = pConnect.resolveConfigProps({
92
+ value: config.value
93
+ }).value;
94
+
95
+ caseSummaryComponentObject.variant = 'stacked';
96
+ caseSummaryComponentObject.simpleValue = rawValue?.length ? rawValue : noValueComponent;
97
+ break;
98
+ }
99
+ case 'TextArea': {
100
+ const rawValue = pConnect.resolveConfigProps({
101
+ value: config.value
102
+ }).value;
103
+
104
+ if (rawValue?.length > 22) {
105
+ caseSummaryComponentObject.variant = 'stacked';
106
+ }
107
+
108
+ caseSummaryComponentObject.simpleValue = rawValue?.length ? rawValue : noValueComponent;
109
+ break;
110
+ }
111
+ case 'URL': {
112
+ if (config.displayAs === 'Image') {
113
+ const rawValue = pConnect.resolveConfigProps({
114
+ value: config.value
115
+ }).value;
116
+
117
+ caseSummaryComponentObject.variant = 'stacked';
118
+ caseSummaryComponentObject.simpleValue = rawValue?.length ? <Link href={rawValue}>{rawValue}</Link> : noValueComponent;
119
+ }
120
+ break;
121
+ }
122
+ case 'reference': {
123
+ const referencedPConnect = resolveReferencedPConnect(pConnect);
124
+ const viewType = referencedPConnect?.meta?.config.type;
125
+ const viewTemplate = referencedPConnect?.meta?.config.template;
126
+ const isTable = ['multirecordlist'].includes(viewType);
127
+ const isDataReference = viewTemplate === 'DataReference';
128
+
129
+ if (isTable || !isDataReference) {
130
+ caseSummaryComponentObject.variant = 'stacked';
131
+ caseSummaryComponentObject.simpleValue = placeholder;
132
+ }
133
+ break;
134
+ }
135
+ case 'view': {
136
+ caseSummaryComponentObject.variant = 'stacked';
137
+ caseSummaryComponentObject.simpleValue = placeholder;
138
+ break;
139
+ }
140
+ default:
141
+ break;
142
+ }
143
+
144
+ const createdComponent = pConnect.createComponent({
145
+ type,
146
+ children: children ? [...children] : [],
147
+ showAddressLabel,
148
+ config: {
149
+ ...config,
150
+ // Need a unique key for each summary component which helps in creating new component based on visibility
151
+ // Also a consistent key helps in rerendering summary components instead of remounting
152
+ key: config
153
+ }
154
+ });
155
+
156
+ createdComponent.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
157
+ createdComponent.props.getPConnect().setInheritedProp('readOnly', true);
158
+
159
+ if (type === 'Address') {
160
+ createdComponent.props.getPConnect().setInheritedProp('showAddressLabel', showAddressLabel);
161
+ }
162
+ // Add field label for reference summary item when not Embedded data
163
+ if (type === 'reference') {
164
+ const isEmbeddedData = config.context && config.displayAs === 'Form';
165
+ if (!isEmbeddedData) {
166
+ caseSummaryComponentObject.name = createdComponent.props.getPConnect().getInheritedProps().label;
167
+ }
168
+ }
169
+
170
+ caseSummaryComponentObject.value = createdComponent;
171
+
172
+ return caseSummaryComponentObject;
173
+ }
174
+
175
+ export function resolveReferenceFields(
176
+ item: {
177
+ [key: string]: unknown;
178
+ },
179
+ hideFieldLabels: boolean,
180
+ recordKey: string,
181
+ pConnect: typeof PConnect
182
+ ) {
183
+ const presets: {
184
+ children?: {
185
+ children?: {
186
+ config;
187
+ type;
188
+ };
189
+ config?;
190
+ };
191
+ } = (pConnect.getRawMetadata()?.config as any).presets ?? [];
192
+
193
+ const presetChildren = presets[0]?.children?.[0]?.children ?? [];
194
+
195
+ const maxFields = 5;
196
+ return presetChildren.slice(0, maxFields).map((preset, index) => {
197
+ const fieldMeta = {
198
+ meta: {
199
+ ...preset,
200
+ config: {
201
+ ...preset.config,
202
+ displayMode: 'DISPLAY_ONLY',
203
+ contextName: pConnect.getContextName()
204
+ }
205
+ },
206
+ useCustomContext: item
207
+ };
208
+ const configObj = PCore.createPConnect(fieldMeta);
209
+ const meta = configObj.getPConnect().getMetadata();
210
+ const fieldInfo: {
211
+ name?: string;
212
+ value?: React.ReactNode;
213
+ } = meta ? prepareComponentInCaseSummary(meta, configObj.getPConnect) : {};
214
+ return hideFieldLabels
215
+ ? { id: `${item[recordKey]} - ${index}`, value: fieldInfo.value }
216
+ : {
217
+ id: `${item[recordKey]} - ${index}`,
218
+ name: fieldInfo.name,
219
+ value: fieldInfo.value,
220
+ type: preset.type
221
+ };
222
+ });
223
+ }
@@ -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,14 +32,10 @@ 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
- const theValue = date && date.isValid() ? date.format('HH:mm') : null;
38
+ const theValue = date && date.isValid() ? date.format('HH:mm:ss') : null;
43
39
  handleEvent(actions, 'changeNblur', propName, theValue);
44
40
  };
45
41
 
@@ -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 = '',
@@ -80,10 +80,8 @@ const UserReference = (props: UserReferenceProps) => {
80
80
  };
81
81
 
82
82
  PCore.getRestClient()
83
- // @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
84
- // @ts-ignore - Expected 3 arguments, but got 2
85
83
  .invokeRestApi('getListData', { queryPayload })
86
- .then((res: any) => {
84
+ .then(res => {
87
85
  const ddDataSource = res.data.data.map(listItem => ({
88
86
  key: listItem.pyUserIdentifier,
89
87
  value: listItem.pyUserName
@@ -91,7 +89,6 @@ const UserReference = (props: UserReferenceProps) => {
91
89
  setDropDownDataSource(ddDataSource);
92
90
  })
93
91
  .catch(err => {
94
- // eslint-disable-next-line no-console
95
92
  console.error(err);
96
93
  });
97
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,26 @@
1
- /* eslint-disable import/prefer-default-export */
2
- export function isEmptyObject(obj: Object): boolean {
1
+ export function isEmptyObject(obj: object): boolean {
3
2
  return Object.keys(obj).length === 0;
4
3
  }
4
+
5
+ /**
6
+ * Get a localized value from the Generic Fields
7
+ * @param path - The path within Generic Fields (e.g., 'CosmosFields.fields.lists')
8
+ * @param key - The key of the string to localize
9
+ * @returns The localized string or the key itself if no translation is found
10
+ */
11
+ export function getGenericFieldsLocalizedValue(path: string, key: string): string {
12
+ const localeStore = PCore.getLocaleUtils().localeStore;
13
+
14
+ if (!localeStore) return key;
15
+
16
+ // Split the path and traverse the object
17
+ const pathParts = path.split('.');
18
+ let currentObj: any = localeStore;
19
+
20
+ for (const part of pathParts) {
21
+ if (!currentObj[part]) return key;
22
+ currentObj = currentObj[part];
23
+ }
24
+
25
+ return currentObj[key] || key;
26
+ }
@@ -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) {