@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,5 +1,4 @@
1
- /* eslint-disable no-nested-ternary */
2
- import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
1
+ import React, { type PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
3
2
  import Table from '@mui/material/Table';
4
3
  import TableBody from '@mui/material/TableBody';
5
4
  import TableCell from '@mui/material/TableCell';
@@ -28,8 +27,9 @@ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react
28
27
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
29
28
  import { getReferenceList } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
30
29
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
30
+ import { getGenericFieldsLocalizedValue } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
31
31
  import { buildFieldsForTable, filterData, getContext } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
32
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
32
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
33
33
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
34
34
 
35
35
  interface SimpleTableManualProps extends PConnProps {
@@ -52,14 +52,29 @@ interface SimpleTableManualProps extends PConnProps {
52
52
  displayMode?: string;
53
53
  useSeparateViewForEdit: any;
54
54
  viewForEditModal: any;
55
+ validatemessage?: string;
56
+ required?: boolean;
55
57
  }
56
58
 
57
59
  const useStyles = makeStyles((/* theme */) => ({
58
60
  label: {
59
61
  margin: '8px'
60
62
  },
63
+ tableLabel: {
64
+ '&::after': {
65
+ display: 'inline',
66
+ content: '" *"',
67
+ verticalAlign: 'top',
68
+ color: 'var(--app-error-color)'
69
+ }
70
+ },
71
+ message: {
72
+ margin: '8px',
73
+ color: 'var(--app-error-color)',
74
+ fontSize: '14px'
75
+ },
61
76
  header: {
62
- background: '#f5f5f5'
77
+ background: 'var(--table-header-background)'
63
78
  },
64
79
  tableCell: {
65
80
  borderRight: '1px solid lightgray',
@@ -110,7 +125,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
110
125
  editModeConfig,
111
126
  displayMode,
112
127
  useSeparateViewForEdit,
113
- viewForEditModal
128
+ viewForEditModal,
129
+ required,
130
+ validatemessage
114
131
  } = props;
115
132
  const pConn = getPConnect();
116
133
  const [rowData, setRowData] = useState([]);
@@ -130,7 +147,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
130
147
  const [displayDialogDateFilter, setDisplayDialogDateFilter] = useState<string>('notequal');
131
148
  const [displayDialogDateValue, setDisplayDialogDateValue] = useState<string>('');
132
149
  const selectedRowIndex: any = useRef(null);
133
-
150
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
151
+ const localeCategory = 'SimpleTable';
134
152
  const parameters = fieldMetadata?.datasource?.parameters;
135
153
  const { referenceListStr } = getContext(getPConnect());
136
154
  const label = labelProp || propertyLabel;
@@ -145,6 +163,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
145
163
  const menuIconOverride$ = Utils.getImageSrc('trash', Utils.getSDKStaticConentUrl());
146
164
 
147
165
  const resolvedFields = children?.[0]?.children || presets?.[0].children?.[0].children;
166
+ const primaryFieldsViewIndex = resolvedFields.findIndex(field => field.config.value === 'pyPrimaryFields');
148
167
  // NOTE: props has each child.config with datasource and value undefined
149
168
  // but getRawMetadata() has each child.config with datasource and value showing their unresolved values (ex: "@P thePropName")
150
169
  // We need to use the prop name as the "glue" to tie the table dataSource, displayColumns and data together.
@@ -176,15 +195,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
176
195
  });
177
196
 
178
197
  useEffect(() => {
179
- if (editableMode && !allowEditingInModal) {
180
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
181
- buildElementsForTable();
182
- }
183
- }, [referenceList.length]);
184
-
185
- useEffect(() => {
198
+ buildElementsForTable();
186
199
  if (readOnlyMode || allowEditingInModal) {
187
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
188
200
  generateRowsData();
189
201
  }
190
202
  }, [referenceList]);
@@ -195,19 +207,21 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
195
207
  // Constellation DX Components do). It will also have the "label", and "meta" contains the original,
196
208
  // unchanged config info. For now, much of the info here is carried over from
197
209
  // Constellation DX Components.
198
- const fieldDefs = buildFieldsForTable(rawFields, resolvedFields, showDeleteButton);
210
+ const fieldDefs = buildFieldsForTable(rawFields, getPConnect(), showDeleteButton, {
211
+ primaryFieldsViewIndex,
212
+ fields: resolvedFields
213
+ });
199
214
 
200
215
  useLayoutEffect(() => {
201
216
  if (allowEditingInModal) {
202
217
  getPConnect()
203
218
  .getListActions()
204
- // @ts-ignore - An argument for 'uniqueField' was not provided.
205
219
  .initDefaultPageInstructions(
206
220
  getPConnect().getReferenceList(),
207
221
  fieldDefs.filter(item => item.name).map(item => item.name)
208
222
  );
209
223
  } else {
210
- // @ts-ignore - An argument for 'fields' was not provided
224
+ // @ts-expect-error - An argument for 'fields' was not provided
211
225
  getPConnect().getListActions().initDefaultPageInstructions(getPConnect().getReferenceList());
212
226
  }
213
227
  }, []);
@@ -234,7 +248,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
234
248
 
235
249
  // return the value that should be shown as the contents for the given row data
236
250
  // of the given row field
237
- function getRowValue(inRowData: Object, inColKey: string): any {
251
+ function getRowValue(inRowData: object, inColKey: string): any {
238
252
  // See what data (if any) we have to display
239
253
  const refKeys: string[] = inColKey?.split('.');
240
254
  let valBuilder = inRowData;
@@ -265,7 +279,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
265
279
  setRowData(data);
266
280
  })
267
281
  .catch(e => {
268
- // eslint-disable-next-line no-console
269
282
  console.log(e);
270
283
  });
271
284
  } else {
@@ -274,7 +287,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
274
287
  // we're using as the table's dataSource
275
288
  const data: any = [];
276
289
  for (const row of referenceList) {
277
- const dataForRow: Object = {};
290
+ const dataForRow: object = {};
278
291
  for (const col of displayedColumns) {
279
292
  const colKey: string = col;
280
293
  const theVal = getRowValue(row, colKey);
@@ -306,9 +319,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
306
319
  if (allowEditingInModal && defaultView) {
307
320
  pConn
308
321
  .getActionsApi()
322
+ // @ts-expect-error
309
323
  .openEmbeddedDataModal(defaultView, pConn, referenceListStr, referenceList.length, PCore.getConstants().RESOURCE_STATUS.CREATE);
310
324
  } else {
311
- // @ts-ignore - An argument for 'pageRef' was not provided.
312
325
  pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
313
326
  }
314
327
 
@@ -322,6 +335,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
322
335
  if (typeof selectedRowIndex.current === 'number') {
323
336
  pConn
324
337
  .getActionsApi()
338
+ // @ts-expect-error
325
339
  .openEmbeddedDataModal(
326
340
  bUseSeparateViewForEdit ? editView : defaultView,
327
341
  pConn,
@@ -334,12 +348,10 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
334
348
 
335
349
  const deleteRecord = () => {
336
350
  setEditAnchorEl(null);
337
- // @ts-ignore - An argument for 'pageRef' was not provided.
338
351
  pConn.getListActions().deleteEntry(selectedRowIndex.current);
339
352
  };
340
353
 
341
354
  const deleteRecordFromInlineEditable = (index: number) => {
342
- // @ts-ignore - An argument for 'pageRef' was not provided.
343
355
  pConn.getListActions().deleteEntry(index);
344
356
  };
345
357
 
@@ -349,23 +361,25 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
349
361
  const data: any = [];
350
362
  rawFields.forEach(item => {
351
363
  // removing label field from config to hide title in the table cell
352
- item = { ...item, config: { ...item.config, label: '' } };
353
- const referenceListData = getReferenceList(pConn);
354
- const isDatapage = referenceListData.startsWith('D_');
355
- const pageReferenceValue = isDatapage
356
- ? `${referenceListData}[${index}]`
357
- : `${pConn.getPageReference()}${referenceListData.substring(referenceListData.lastIndexOf('.'))}[${index}]`;
358
- const config = {
359
- meta: item,
360
- options: {
361
- context,
362
- pageReference: pageReferenceValue,
363
- referenceList: referenceListData,
364
- hasForm: true
365
- }
366
- };
367
- const view = PCore.createPConnect(config);
368
- data.push(createElement(createPConnectComponent(), view));
364
+ if (!item.config.hide) {
365
+ item = { ...item, config: { ...item.config, label: '', displayMode: readOnlyMode || allowEditingInModal ? 'DISPLAY_ONLY' : undefined } };
366
+ const referenceListData = getReferenceList(pConn);
367
+ const isDatapage = referenceListData.startsWith('D_');
368
+ const pageReferenceValue = isDatapage
369
+ ? `${referenceListData}[${index}]`
370
+ : `${pConn.getPageReference()}${referenceListData.substring(referenceListData.lastIndexOf('.'))}[${index}]`;
371
+ const config = {
372
+ meta: item,
373
+ options: {
374
+ context,
375
+ pageReference: pageReferenceValue,
376
+ referenceList: referenceListData,
377
+ hasForm: true
378
+ }
379
+ };
380
+ const view = PCore.createPConnect(config);
381
+ data.push(createElement(createPConnectComponent(), view));
382
+ }
369
383
  });
370
384
  eleData.push(data);
371
385
  });
@@ -397,23 +411,27 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
397
411
 
398
412
  type Order = 'asc' | 'desc';
399
413
 
400
- function getComparator<Key extends keyof any>(
401
- theOrder: Order,
402
- orderedBy: Key
403
- ): (a: { [key in Key]: number | string }, b: { [key in Key]: number | string }) => number {
404
- return theOrder === 'desc' ? (a, b) => descendingComparator(a, b, orderedBy) : (a, b) => -descendingComparator(a, b, orderedBy);
414
+ interface Comparator<T> {
415
+ (a: T, b: T): number;
416
+ }
417
+
418
+ function getComparator<Key extends keyof any, T extends Record<Key, any>>(theOrder: Order, orderedBy: Key): Comparator<T> {
419
+ return theOrder === 'desc' ? (a: T, b: T) => descendingComparator<T>(a, b, orderedBy) : (a: T, b: T) => -descendingComparator<T>(a, b, orderedBy);
405
420
  }
406
421
 
407
422
  function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
408
423
  const stabilizedThis = array.map((el, index) => [el, index] as [T, number]);
409
424
  stabilizedThis.sort((a, b) => {
410
- // eslint-disable-next-line @typescript-eslint/no-shadow
411
425
  const order = comparator(a[0], b[0]);
412
426
  if (order !== 0) return order;
413
427
  return a[1] - b[1];
414
428
  });
415
429
 
416
- return stabilizedThis.map(el => el[0]);
430
+ const newElements = new Array(stabilizedThis.length);
431
+ stabilizedThis.forEach((el, index) => {
432
+ newElements[index] = elements[el[1]];
433
+ });
434
+ return newElements;
417
435
  }
418
436
 
419
437
  function _menuClick(event, columnId: string, columnType: string, labelValue: string) {
@@ -558,7 +576,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
558
576
  function _showFilteredIcon(columnId) {
559
577
  for (const filterObj of filterByColumns) {
560
578
  if (filterObj.ref === columnId) {
561
- // eslint-disable-next-line sonarjs/prefer-single-boolean-return
562
579
  if (filterObj.containsFilterValue !== '') {
563
580
  return true;
564
581
  }
@@ -583,19 +600,24 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
583
600
  <>
584
601
  <TableContainer component={Paper} style={{ margin: '4px 0px' }} id='simple-table-manual'>
585
602
  {propsToUse.label && (
586
- <h3 className={classes.label}>
603
+ <h3 className={`${classes.label} ${required ? classes.tableLabel : ''}`}>
587
604
  {propsToUse.label} {results()}
588
605
  </h3>
589
606
  )}
607
+ {validatemessage && <div className={classes.message}>{validatemessage}</div>}
590
608
  <Table>
591
609
  <TableHead className={classes.header}>
592
610
  <TableRow>
593
611
  {fieldDefs.map((field: any, index) => {
612
+ if (field?.meta?.config?.hide) {
613
+ return null; // Skip rendering if hide = true
614
+ }
594
615
  return (
595
616
  <TableCell key={`head-${displayedColumns[index]}`} className={classes.tableCell}>
596
- {readOnlyMode ? (
597
- <div>
617
+ {(readOnlyMode || allowEditingInModal) && field.cellRenderer !== 'DeleteIcon' ? (
618
+ <div style={{ display: 'flex' }}>
598
619
  <TableSortLabel
620
+ style={{ width: '75%' }}
599
621
  active={orderBy === displayedColumns[index]}
600
622
  direction={orderBy === displayedColumns[index] ? order : 'asc'}
601
623
  onClick={createSortHandler(displayedColumns[index])}
@@ -607,8 +629,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
607
629
  ) : null}
608
630
  </TableSortLabel>
609
631
  <MoreIcon
632
+ style={{ cursor: 'pointer', zIndex: 1000 }}
610
633
  id='menu-icon'
611
- className={classes.moreIcon}
612
634
  onClick={event => {
613
635
  _menuClick(event, field.name, field.meta.type, field.label);
614
636
  }}
@@ -624,6 +646,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
624
646
  </TableHead>
625
647
  <TableBody>
626
648
  {editableMode &&
649
+ !allowEditingInModal &&
627
650
  elements.map((row: any, index) => {
628
651
  const theKey = `row-${index}`;
629
652
  return (
@@ -659,55 +682,47 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
659
682
  .slice(0)
660
683
  .map((row, index) => {
661
684
  return (
662
- // eslint-disable-next-line react/no-array-index-key
663
685
  <TableRow key={index}>
664
- {displayedColumns.map(colKey => {
686
+ {row.map((item, childIndex) => {
687
+ const theColKey = displayedColumns[childIndex];
665
688
  return (
666
- <TableCell key={colKey} className={classes.tableCell}>
667
- {showDeleteButton && colKey === 'DeleteIcon' ? (
668
- <div>
669
- <MoreIcon
670
- id='table-edit-menu-icon'
671
- className={classes.moreIcon}
672
- onClick={event => {
673
- editMenuClick(event, index);
674
- }}
675
- />
676
- <Menu id='table-edit-menu' anchorEl={editAnchorEl} keepMounted open={Boolean(editAnchorEl)} onClose={_menuClose}>
677
- <MenuItem onClick={() => editRecord()}>Edit</MenuItem>
678
- <MenuItem onClick={() => deleteRecord()}>Delete</MenuItem>
679
- </Menu>
680
- </div>
681
- ) : typeof row[colKey] === 'boolean' && !row[colKey] ? (
682
- 'False'
683
- ) : typeof row[colKey] === 'boolean' && row[colKey] ? (
684
- 'True'
685
- ) : (
686
- row[colKey] || '---'
687
- )}
689
+ <TableCell key={theColKey} className={classes.tableCell}>
690
+ {item}
688
691
  </TableCell>
689
692
  );
690
693
  })}
694
+ {showDeleteButton && (
695
+ <TableCell key='DeleteIcon' className={classes.tableCell}>
696
+ <div>
697
+ <MoreIcon
698
+ id='table-edit-menu-icon'
699
+ className={classes.moreIcon}
700
+ onClick={event => {
701
+ editMenuClick(event, index);
702
+ }}
703
+ />
704
+ <Menu id='table-edit-menu' anchorEl={editAnchorEl} keepMounted open={Boolean(editAnchorEl)} onClose={_menuClose}>
705
+ <MenuItem onClick={() => editRecord()}>Edit</MenuItem>
706
+ <MenuItem onClick={() => deleteRecord()}>Delete</MenuItem>
707
+ </Menu>
708
+ </div>
709
+ </TableCell>
710
+ )}
691
711
  </TableRow>
692
712
  );
693
713
  })}
694
714
  </TableBody>
695
715
  </Table>
696
- {readOnlyMode && rowData && rowData.length === 0 && (
697
- <div className='no-records' id='no-records'>
698
- No records found.
699
- </div>
700
- )}
701
- {editableMode && referenceList && referenceList.length === 0 && (
716
+ {((readOnlyMode && (!rowData || rowData?.length === 0)) || (editableMode && (!referenceList || referenceList?.length === 0))) && (
702
717
  <div className='no-records' id='no-records'>
703
- No records found.
718
+ {getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.')}
704
719
  </div>
705
720
  )}
706
721
  </TableContainer>
707
722
  {showAddRowButton && (
708
723
  <div style={{ fontSize: '1rem' }}>
709
724
  <Link style={{ cursor: 'pointer' }} onClick={addRecord} underline='hover'>
710
- + Add
725
+ + {localizedVal('Add', localeCategory)}
711
726
  </Link>
712
727
  </div>
713
728
  )}
@@ -1,6 +1,6 @@
1
1
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
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 SimpleTableSelectProps extends PConnProps {
6
6
  // If any, enter additional props that only exist on this component
@@ -57,10 +57,8 @@ export default function SimpleTableSelect(props: SimpleTableSelectProps) {
57
57
 
58
58
  // Need to get this written so typedefs work
59
59
  const { datasource: { parameters: fieldParameters = {} } = {}, pageClass } = isMultiSelectMode
60
- ? // @ts-ignore - Property 'getFieldMetadata' is private and only accessible within class 'C11nEnv'.
61
- pConn.getFieldMetadata(`@P .${referenceProp}`)
62
- : // @ts-ignore - Property 'getCurrentPageFieldMetadata' is private and only accessible within class 'C11nEnv'.
63
- pConn.getCurrentPageFieldMetadata(contextPageReference);
60
+ ? pConn.getFieldMetadata(`@P .${referenceProp}`)
61
+ : pConn.getCurrentPageFieldMetadata(contextPageReference);
64
62
 
65
63
  const compositeKeys: any[] = [];
66
64
  Object.values(fieldParameters).forEach((param: any) => {
@@ -1,4 +1,5 @@
1
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
1
+ import { FormControl, FormLabel } from '@mui/material';
2
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
2
3
 
3
4
  interface SingleReferenceReadOnlyProps extends PConnProps {
4
5
  // If any, enter additional props that only exist on this component
@@ -59,5 +60,12 @@ export default function SingleReferenceReadOnly(props: SingleReferenceReadOnlyPr
59
60
  {}
60
61
  ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
61
62
 
62
- return <>{component}</>;
63
+ return (
64
+ <>
65
+ <FormControl variant='standard' sx={{ display: 'flex', flexDirection: 'row' }}>
66
+ <FormLabel sx={{ marginRight: '2rem' }}>{label}</FormLabel>
67
+ {component}
68
+ </FormControl>
69
+ </>
70
+ );
63
71
  }
@@ -1,9 +1,9 @@
1
- import { Children, PropsWithChildren, useEffect, useState } from 'react';
1
+ import { Children, type PropsWithChildren, useEffect, useState } from 'react';
2
2
  import { Tab, Tabs } from '@mui/material';
3
3
  import { TabContext, TabPanel } from '@mui/lab';
4
4
 
5
5
  import { getTransientTabs, getVisibleTabs, tabClick } from './tabUtils';
6
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
 
8
8
  interface SubTabsProps extends PConnProps {
9
9
  // If any, enter additional props that only exist on this component
@@ -19,7 +19,8 @@ export const getVisibleTabs = (allTabs, uuid) => {
19
19
  const { name: viewName, deferLoadId = `${viewName}_${uuid}_${index}` } = config;
20
20
  child.getPConnect().registerAdditionalProps({
21
21
  deferLoadId,
22
- isChildDeferLoad: true
22
+ isChildDeferLoad: true,
23
+ lastUpdateCaseTime: '@P caseInfo.lastUpdateTime'
23
24
  });
24
25
  }
25
26
  index += 1;
@@ -66,3 +67,119 @@ export const tabClick = (id, availableTabs, currentTabId, setCurrentTabId, tabIt
66
67
  PCore.getDeferLoadManager().activate(activeId, nextPConn?.getContextName());
67
68
  PCore.getDeferLoadManager().refreshComponent(activeId, nextPConn?.getContextName());
68
69
  };
70
+
71
+ export const searchtabsClick = (id, mainTabs, currentTabId, setCurrentTabId) => {
72
+ const currentTab = mainTabs.find(item => item.id === currentTabId && item.visibility());
73
+ const currentPConn = currentTab?.getPConnect();
74
+ const { deferLoadId } = currentPConn?.getConfigProps() ?? {};
75
+ PCore.getDeferLoadManager().deactivate(deferLoadId, currentPConn.getContextName());
76
+
77
+ setCurrentTabId(id);
78
+ const nextActiveTab = mainTabs.find(item => item.id === id && item.visibility());
79
+ if (mainTabs && nextActiveTab?.content === null) {
80
+ nextActiveTab.content = nextActiveTab.getPConnect().getComponent();
81
+ }
82
+
83
+ const nextPConn = nextActiveTab.getPConnect();
84
+ const { deferLoadId: activeId } = nextPConn.getConfigProps();
85
+ PCore.getDeferLoadManager().activate(activeId, nextPConn.getContextName());
86
+ PCore.getDeferLoadManager().refreshComponent(activeId, nextPConn.getContextName());
87
+ };
88
+
89
+ export const getTabLabel = tabPConnect => {
90
+ const config = tabPConnect.getConfigProps();
91
+
92
+ const label = config.inheritedProps?.find(obj => obj.prop === 'label')?.value;
93
+
94
+ if (label) {
95
+ return label;
96
+ }
97
+ if (config.label) {
98
+ return config.label;
99
+ }
100
+
101
+ if (tabPConnect.getReferencedView()?.config?.label) {
102
+ return tabPConnect.getReferencedView()?.config?.label;
103
+ }
104
+
105
+ return PCore.getLocaleUtils().getLocaleValue('No label specified in config', 'Generic');
106
+ };
107
+
108
+ export const getActiveTabId = (mainTabs, currentTabId) => {
109
+ let firstVisibleTabId = null;
110
+ let updatedActiveId = currentTabId;
111
+ let isCurrentTabFound = false;
112
+
113
+ if (!mainTabs?.length) {
114
+ return updatedActiveId;
115
+ }
116
+
117
+ for (let i = 0; i < mainTabs.length; i += 1) {
118
+ const tab = mainTabs[i];
119
+ const tabConfig = tab.getPConnect().getConfigProps();
120
+ const tabId = tab?.id || `${tab.getPConnect().viewName}-${tabConfig.name || getTabLabel(tab.getPConnect())}-${i}`;
121
+ const isTabVisible = !Object.hasOwn(tabConfig, 'visibility') || tabConfig.visibility === true;
122
+ if (isTabVisible && !firstVisibleTabId) {
123
+ firstVisibleTabId = tabId;
124
+ if (isCurrentTabFound) {
125
+ updatedActiveId = firstVisibleTabId;
126
+ break;
127
+ }
128
+ }
129
+ if (tabId === currentTabId) {
130
+ isCurrentTabFound = true;
131
+ if (isTabVisible) {
132
+ break;
133
+ } else if (firstVisibleTabId) {
134
+ updatedActiveId = firstVisibleTabId;
135
+ break;
136
+ }
137
+ }
138
+ }
139
+ return updatedActiveId;
140
+ };
141
+ /**
142
+ *
143
+ * @param {*} deferLoadedTabs list of deferLoadedTabs
144
+ * @param {string} tabViewName (optional) if provided, tabId of the given tabView will be returned
145
+ * @returns {string} a tab id is returned
146
+ */
147
+ export const getFirstVisibleTabId = (deferLoadedTabs, tabViewName) => {
148
+ let tabIndex = 0;
149
+
150
+ const viewName = deferLoadedTabs?.props?.getPConnect()?.options?.viewName;
151
+
152
+ const deferTabsChildren = deferLoadedTabs.props.getPConnect().getChildren();
153
+ if (tabViewName) {
154
+ const firstVisibleTab = deferTabsChildren?.find((item, index) => {
155
+ const tabConfig = item.getPConnect().getConfigProps();
156
+ if (tabViewName === tabConfig.name) {
157
+ tabIndex = index;
158
+ return true;
159
+ }
160
+ return false;
161
+ });
162
+ const tabConfig = firstVisibleTab.getPConnect().getConfigProps();
163
+
164
+ return `${viewName}-${tabConfig.name || getTabLabel(firstVisibleTab.getPConnect())}-${tabIndex}`;
165
+ }
166
+
167
+ const firstVisibleTab = deferLoadedTabs.props
168
+ .getPConnect()
169
+ .getChildren()
170
+ ?.find((item, index) => {
171
+ const tabConfig = item.getPConnect().getConfigProps();
172
+ if (!('visibility' in tabConfig) || tabConfig.visibility === true) {
173
+ tabIndex = index;
174
+ return true;
175
+ }
176
+ return false;
177
+ });
178
+
179
+ if (!firstVisibleTab) {
180
+ return null;
181
+ }
182
+
183
+ const tabConfig = firstVisibleTab.getPConnect().getConfigProps();
184
+ return `${viewName}-${tabConfig.name || getTabLabel(firstVisibleTab.getPConnect())}-${tabIndex}`;
185
+ };
@@ -1,7 +1,7 @@
1
- import { PropsWithChildren, ReactElement } from 'react';
2
- import { Grid, GridSize } from '@mui/material';
1
+ import type { PropsWithChildren, ReactElement } from 'react';
2
+ import Grid2, { type GridSize } from '@mui/material/Grid2';
3
3
  import makeStyles from '@mui/styles/makeStyles';
4
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
5
 
6
6
  interface TwoColumnProps extends PConnProps {
7
7
  // If any, enter additional props that only exist on this component
@@ -23,7 +23,6 @@ export default function TwoColumn(props: PropsWithChildren<TwoColumnProps>) {
23
23
  const childrenToRender = children as ReactElement[];
24
24
 
25
25
  if (childrenToRender.length !== 2) {
26
- // eslint-disable-next-line no-console
27
26
  console.error(`TwoColumn template sees more than 2 columns: ${childrenToRender.length}`);
28
27
  }
29
28
 
@@ -43,13 +42,13 @@ export default function TwoColumn(props: PropsWithChildren<TwoColumnProps>) {
43
42
  bSize = (ratio * colAArray[1]) as GridSize;
44
43
 
45
44
  return (
46
- <Grid container spacing={1}>
47
- <Grid item xs={12} md={aSize} className={classes.colStyles}>
45
+ <Grid2 container spacing={1}>
46
+ <Grid2 size={{ xs: 12, md: aSize }} className={classes.colStyles}>
48
47
  {childrenToRender[0]}
49
- </Grid>
50
- <Grid item xs={12} md={bSize} className={classes.colStyles}>
48
+ </Grid2>
49
+ <Grid2 size={{ xs: 12, md: bSize }} className={classes.colStyles}>
51
50
  {childrenToRender[1]}
52
- </Grid>
53
- </Grid>
51
+ </Grid2>
52
+ </Grid2>
54
53
  );
55
54
  }
@@ -1,5 +1,5 @@
1
1
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
2
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
2
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
3
 
4
4
  interface TwoColumnPageProps extends PConnProps {
5
5
  // If any, enter additional props that only exist on this component
@@ -1,7 +1,7 @@
1
- import { PropsWithChildren, ReactElement } from 'react';
2
- import { Grid, GridSize } from '@mui/material';
1
+ import type { PropsWithChildren, ReactElement } from 'react';
2
+ import Grid2, { type GridSize } from '@mui/material/Grid2';
3
3
  import makeStyles from '@mui/styles/makeStyles';
4
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
5
 
6
6
  interface TwoColumnTabProps extends PConnProps {
7
7
  // If any, enter additional props that only exist on this component
@@ -23,7 +23,6 @@ export default function TwoColumnTab(props: PropsWithChildren<TwoColumnTabProps>
23
23
  const childrenToRender = children as ReactElement[];
24
24
 
25
25
  if (childrenToRender.length !== 2) {
26
- // eslint-disable-next-line no-console
27
26
  console.error(`TwoColumn template sees more than 2 columns: ${childrenToRender.length}`);
28
27
  }
29
28
 
@@ -43,13 +42,13 @@ export default function TwoColumnTab(props: PropsWithChildren<TwoColumnTabProps>
43
42
  bSize = (ratio * colAArray[1]) as GridSize;
44
43
 
45
44
  return (
46
- <Grid container spacing={1}>
47
- <Grid item xs={12} md={aSize} className={classes.colStyles}>
45
+ <Grid2 container spacing={1}>
46
+ <Grid2 size={{ xs: 12, md: aSize }} className={classes.colStyles}>
48
47
  {childrenToRender[0]}
49
- </Grid>
50
- <Grid item xs={12} md={bSize} className={classes.colStyles}>
48
+ </Grid2>
49
+ <Grid2 size={{ xs: 12, md: bSize }} className={classes.colStyles}>
51
50
  {childrenToRender[1]}
52
- </Grid>
53
- </Grid>
51
+ </Grid2>
52
+ </Grid2>
54
53
  );
55
54
  }