@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,4 +1,4 @@
1
- import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
1
+ import React, { type PropsWithChildren, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
2
2
  import Table from '@mui/material/Table';
3
3
  import TableBody from '@mui/material/TableBody';
4
4
  import TableCell from '@mui/material/TableCell';
@@ -28,9 +28,10 @@ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
28
28
  import { getReferenceList } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
29
29
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
30
30
  import { getGenericFieldsLocalizedValue } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
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';
31
+ import { buildFieldsForTable, filterData, getConfigFields, getContext } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
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
+ import { initializeColumns } from '@pega/react-sdk-components/lib/components/template/ListView/utils';
34
35
 
35
36
  interface SimpleTableManualProps extends PConnProps {
36
37
  // If any, enter additional props that only exist on this component
@@ -74,7 +75,7 @@ const useStyles = makeStyles((/* theme */) => ({
74
75
  fontSize: '14px'
75
76
  },
76
77
  header: {
77
- background: '#f5f5f5'
78
+ background: 'var(--table-header-background)'
78
79
  },
79
80
  tableCell: {
80
81
  borderRight: '1px solid lightgray',
@@ -163,6 +164,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
163
164
  const menuIconOverride$ = Utils.getImageSrc('trash', Utils.getSDKStaticConentUrl());
164
165
 
165
166
  const resolvedFields = children?.[0]?.children || presets?.[0].children?.[0].children;
167
+ const primaryFieldsViewIndex = resolvedFields.findIndex(field => field.config.value === 'pyPrimaryFields');
166
168
  // NOTE: props has each child.config with datasource and value undefined
167
169
  // but getRawMetadata() has each child.config with datasource and value showing their unresolved values (ex: "@P thePropName")
168
170
  // We need to use the prop name as the "glue" to tie the table dataSource, displayColumns and data together.
@@ -189,15 +191,15 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
189
191
  const bUseSeparateViewForEdit = editModeConfig ? editModeConfig.useSeparateViewForEdit : useSeparateViewForEdit;
190
192
  const editView = editModeConfig ? editModeConfig.editView : viewForEditModal;
191
193
 
194
+ const configFields = getConfigFields(rawFields, contextClass, primaryFieldsViewIndex);
195
+
192
196
  const fieldsWithPropNames = rawFields.map((field, index) => {
193
197
  return { ...resolvedFields[index], propName: field.config.value.replace('@P .', '') };
194
198
  });
195
199
 
196
200
  useEffect(() => {
197
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
198
201
  buildElementsForTable();
199
202
  if (readOnlyMode || allowEditingInModal) {
200
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
201
203
  generateRowsData();
202
204
  }
203
205
  }, [referenceList]);
@@ -208,7 +210,15 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
208
210
  // Constellation DX Components do). It will also have the "label", and "meta" contains the original,
209
211
  // unchanged config info. For now, much of the info here is carried over from
210
212
  // Constellation DX Components.
211
- const fieldDefs = buildFieldsForTable(rawFields, resolvedFields, showDeleteButton);
213
+
214
+ const fieldDefs = useMemo(
215
+ () =>
216
+ isDisplayModeEnabled || readOnlyMode
217
+ ? initializeColumns(configFields, undefined)
218
+ : // For inline edit table
219
+ buildFieldsForTable(rawFields, getPConnect(), showDeleteButton, { primaryFieldsViewIndex, fields: resolvedFields }),
220
+ []
221
+ );
212
222
 
213
223
  useLayoutEffect(() => {
214
224
  if (allowEditingInModal) {
@@ -219,7 +229,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
219
229
  fieldDefs.filter(item => item.name).map(item => item.name)
220
230
  );
221
231
  } else {
222
- // @ts-ignore - An argument for 'fields' was not provided
232
+ // @ts-expect-error - An argument for 'fields' was not provided
223
233
  getPConnect().getListActions().initDefaultPageInstructions(getPConnect().getReferenceList());
224
234
  }
225
235
  }, []);
@@ -246,7 +256,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
246
256
 
247
257
  // return the value that should be shown as the contents for the given row data
248
258
  // of the given row field
249
- function getRowValue(inRowData: Object, inColKey: string): any {
259
+ function getRowValue(inRowData: object, inColKey: string): any {
250
260
  // See what data (if any) we have to display
251
261
  const refKeys: string[] = inColKey?.split('.');
252
262
  let valBuilder = inRowData;
@@ -277,7 +287,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
277
287
  setRowData(data);
278
288
  })
279
289
  .catch(e => {
280
- // eslint-disable-next-line no-console
281
290
  console.log(e);
282
291
  });
283
292
  } else {
@@ -286,7 +295,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
286
295
  // we're using as the table's dataSource
287
296
  const data: any = [];
288
297
  for (const row of referenceList) {
289
- const dataForRow: Object = {};
298
+ const dataForRow: object = {};
290
299
  for (const col of displayedColumns) {
291
300
  const colKey: string = col;
292
301
  const theVal = getRowValue(row, colKey);
@@ -318,7 +327,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
318
327
  if (allowEditingInModal && defaultView) {
319
328
  pConn
320
329
  .getActionsApi()
321
- // @ts-ignore
330
+ // @ts-expect-error
322
331
  .openEmbeddedDataModal(defaultView, pConn, referenceListStr, referenceList.length, PCore.getConstants().RESOURCE_STATUS.CREATE);
323
332
  } else {
324
333
  pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
@@ -334,7 +343,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
334
343
  if (typeof selectedRowIndex.current === 'number') {
335
344
  pConn
336
345
  .getActionsApi()
337
- // @ts-ignore
346
+ // @ts-expect-error
338
347
  .openEmbeddedDataModal(
339
348
  bUseSeparateViewForEdit ? editView : defaultView,
340
349
  pConn,
@@ -360,23 +369,25 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
360
369
  const data: any = [];
361
370
  rawFields.forEach(item => {
362
371
  // removing label field from config to hide title in the table cell
363
- item = { ...item, config: { ...item.config, label: '', displayMode: readOnlyMode || allowEditingInModal ? 'DISPLAY_ONLY' : undefined } };
364
- const referenceListData = getReferenceList(pConn);
365
- const isDatapage = referenceListData.startsWith('D_');
366
- const pageReferenceValue = isDatapage
367
- ? `${referenceListData}[${index}]`
368
- : `${pConn.getPageReference()}${referenceListData.substring(referenceListData.lastIndexOf('.'))}[${index}]`;
369
- const config = {
370
- meta: item,
371
- options: {
372
- context,
373
- pageReference: pageReferenceValue,
374
- referenceList: referenceListData,
375
- hasForm: true
376
- }
377
- };
378
- const view = PCore.createPConnect(config);
379
- data.push(createElement(createPConnectComponent(), view));
372
+ if (!item.config.hide) {
373
+ item = { ...item, config: { ...item.config, label: '', displayMode: readOnlyMode || allowEditingInModal ? 'DISPLAY_ONLY' : undefined } };
374
+ const referenceListData = getReferenceList(pConn);
375
+ const isDatapage = referenceListData.startsWith('D_');
376
+ const pageReferenceValue = isDatapage
377
+ ? `${referenceListData}[${index}]`
378
+ : `${pConn.getPageReference()}${referenceListData.substring(referenceListData.lastIndexOf('.'))}[${index}]`;
379
+ const config = {
380
+ meta: item,
381
+ options: {
382
+ context,
383
+ pageReference: pageReferenceValue,
384
+ referenceList: referenceListData,
385
+ hasForm: true
386
+ }
387
+ };
388
+ const view = PCore.createPConnect(config);
389
+ data.push(createElement(createPConnectComponent(), view));
390
+ }
380
391
  });
381
392
  eleData.push(data);
382
393
  });
@@ -419,7 +430,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
419
430
  function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
420
431
  const stabilizedThis = array.map((el, index) => [el, index] as [T, number]);
421
432
  stabilizedThis.sort((a, b) => {
422
- // eslint-disable-next-line @typescript-eslint/no-shadow
423
433
  const order = comparator(a[0], b[0]);
424
434
  if (order !== 0) return order;
425
435
  return a[1] - b[1];
@@ -574,7 +584,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
574
584
  function _showFilteredIcon(columnId) {
575
585
  for (const filterObj of filterByColumns) {
576
586
  if (filterObj.ref === columnId) {
577
- // eslint-disable-next-line sonarjs/prefer-single-boolean-return
578
587
  if (filterObj.containsFilterValue !== '') {
579
588
  return true;
580
589
  }
@@ -608,6 +617,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
608
617
  <TableHead className={classes.header}>
609
618
  <TableRow>
610
619
  {fieldDefs.map((field: any, index) => {
620
+ if (field?.meta?.config?.hide) {
621
+ return null; // Skip rendering if hide = true
622
+ }
611
623
  return (
612
624
  <TableCell key={`head-${displayedColumns[index]}`} className={classes.tableCell}>
613
625
  {(readOnlyMode || allowEditingInModal) && field.cellRenderer !== 'DeleteIcon' ? (
@@ -678,7 +690,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
678
690
  .slice(0)
679
691
  .map((row, index) => {
680
692
  return (
681
- // eslint-disable-next-line react/no-array-index-key
682
693
  <TableRow key={index}>
683
694
  {row.map((item, childIndex) => {
684
695
  const theColKey = displayedColumns[childIndex];
@@ -712,7 +723,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
712
723
  </Table>
713
724
  {((readOnlyMode && (!rowData || rowData?.length === 0)) || (editableMode && (!referenceList || referenceList?.length === 0))) && (
714
725
  <div className='no-records' id='no-records'>
715
- {getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}
726
+ {getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.')}
716
727
  </div>
717
728
  )}
718
729
  </TableContainer>
@@ -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
@@ -0,0 +1,179 @@
1
+ import { createElement, Fragment, useState } from 'react';
2
+ import Button from '@mui/material/Button';
3
+ import Dialog from '@mui/material/Dialog';
4
+ import DialogActions from '@mui/material/DialogActions';
5
+ import DialogContent from '@mui/material/DialogContent';
6
+ import DialogTitle from '@mui/material/DialogTitle';
7
+ import Link from '@mui/material/Link';
8
+ import Typography from '@mui/material/Typography';
9
+
10
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
11
+ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
12
+ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
13
+ import { SIMPLE_TABLE_MANUAL_READONLY } from '@pega/react-sdk-components/lib/components/field/ObjectReference/utils';
14
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
15
+
16
+ interface SimpleTableSelectReadonlyProps extends PConnProps {
17
+ label?: string;
18
+ referenceList: object[] | string;
19
+ readonlyContextList?: object[];
20
+ primaryField?: string;
21
+ referenceType?: string;
22
+ selectionKey?: string;
23
+ selectionList?: string;
24
+ hideLabel?: boolean;
25
+ variant?: string;
26
+ displayAs?: string;
27
+ displayMode?: string;
28
+ }
29
+
30
+ export default function SimpleTableSelectReadonly(props: SimpleTableSelectReadonlyProps) {
31
+ const {
32
+ label = '',
33
+ getPConnect,
34
+ readonlyContextList = [],
35
+ primaryField = '',
36
+ referenceType = '',
37
+ selectionKey = '',
38
+ selectionList = '',
39
+ hideLabel = false,
40
+ displayAs = 'readonly',
41
+ displayMode
42
+ } = props;
43
+
44
+ const [modalOpen, setModalOpen] = useState(false);
45
+
46
+ const { DATA, CASE } = PCore.getConstants().RESOURCE_TYPES;
47
+ const pConn = getPConnect();
48
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
49
+ const localeCategory = 'SimpleTableSelectReadOnly';
50
+ const PComponent = createPConnectComponent();
51
+
52
+ const openModal = () => {
53
+ const rawConfig = (getPConnect().getRawMetadata() as any).config;
54
+ const rawFields = rawConfig?.presets?.[0].children?.[0]?.children || [];
55
+
56
+ const caseFields = rawFields
57
+ .filter((field: any) => field.config.value.includes(`@P .${Utils.getMappedKey('pyID')}`) || field.config.value.includes(`@P ${primaryField}`))
58
+ .map((field: any) => field.config.value);
59
+
60
+ const dataFields = rawFields.filter((field: any) => field.config.value.includes(`@P ${primaryField}`)).map((field: any) => field.config.value);
61
+
62
+ const defaultFields: any[] = rawConfig?.detailsDisplay || [];
63
+ if (defaultFields?.length === 2 && defaultFields[0].config.value === defaultFields[1].config.value) {
64
+ defaultFields.splice(0, 1);
65
+ }
66
+ defaultFields.forEach((field: any) => {
67
+ if (
68
+ (referenceType.toUpperCase() === CASE && !caseFields.includes(field?.config?.value)) ||
69
+ (referenceType.toUpperCase() === DATA && !dataFields.includes(field?.config?.value))
70
+ ) {
71
+ (getPConnect().getRawMetadata() as any).config?.presets?.[0].children?.[0]?.children?.unshift(field);
72
+ }
73
+ });
74
+
75
+ setModalOpen(true);
76
+ };
77
+
78
+ const closeModal = () => {
79
+ setModalOpen(false);
80
+ };
81
+
82
+ const renderModal = () => {
83
+ const SimpleTableManual = getComponentFromMap('SimpleTableManual');
84
+
85
+ let readonlyContextObject: { referenceList?: object[] } | undefined;
86
+ if (typeof props.referenceList === 'string') {
87
+ readonlyContextObject = { referenceList: readonlyContextList };
88
+ }
89
+
90
+ return (
91
+ <Dialog open={modalOpen} onClose={closeModal} maxWidth='md' fullWidth>
92
+ <DialogTitle>{label}</DialogTitle>
93
+ <DialogContent>
94
+ <SimpleTableManual {...props} {...readonlyContextObject} classId={SIMPLE_TABLE_MANUAL_READONLY} />
95
+ </DialogContent>
96
+ <DialogActions>
97
+ <Button onClick={closeModal} variant='contained'>
98
+ {localizedVal('Close', localeCategory)}
99
+ </Button>
100
+ </DialogActions>
101
+ </Dialog>
102
+ );
103
+ };
104
+
105
+ let displayComp: any;
106
+
107
+ if (readonlyContextList && readonlyContextList.length > 0) {
108
+ const listLength = readonlyContextList.length;
109
+ const filteredList = ['combobox', 'checkboxgroup'].includes(displayAs) ? readonlyContextList : readonlyContextList.slice(0, 5);
110
+
111
+ displayComp = (
112
+ <div>
113
+ {filteredList.map((child: any, index: number) => {
114
+ const selectionKeyProp = selectionKey.substring(1);
115
+ const primaryFieldProp = primaryField?.substring(1);
116
+ const selectionListProp = selectionList?.substring(1);
117
+ const referenceLabel = child[primaryFieldProp] || '';
118
+
119
+ let resourcePayload = {};
120
+ let resourceParams = {};
121
+ let previewKey = '';
122
+
123
+ if (referenceType.toUpperCase() === CASE) {
124
+ previewKey = child[Utils.getMappedKey('pzInsKey')];
125
+ resourcePayload = { caseClassName: child.classID };
126
+ resourceParams = { workID: child[selectionKeyProp] };
127
+ }
128
+
129
+ const metadata = {
130
+ type: 'SemanticLink',
131
+ config: {
132
+ text: referenceLabel,
133
+ resourceParams,
134
+ resourcePayload,
135
+ previewKey,
136
+ referenceType
137
+ }
138
+ };
139
+
140
+ const childPConnectConfig = PCore.createPConnect({
141
+ meta: metadata,
142
+ options: {
143
+ context: pConn.getContextName(),
144
+ pageReference: `${pConn.getPageReference()}.${selectionListProp}[${index}]`
145
+ }
146
+ });
147
+
148
+ return (
149
+ <Fragment key={child[selectionKeyProp]}>
150
+ {createElement(PComponent, { ...childPConnectConfig })}
151
+ {index + 1 !== filteredList.length && ', '}
152
+ </Fragment>
153
+ );
154
+ })}
155
+ {listLength > 5 && !['combobox', 'checkboxgroup'].includes(displayAs) && (
156
+ <Link component='button' onClick={openModal} underline='hover'>
157
+ ({listLength} {localizedVal('Total', localeCategory)})
158
+ </Link>
159
+ )}
160
+ </div>
161
+ );
162
+ }
163
+
164
+ if (displayMode === 'DISPLAY_ONLY') {
165
+ return displayComp ?? <Typography variant='body2'>---</Typography>;
166
+ }
167
+
168
+ return (
169
+ <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'baseline', gap: '0.5rem' }}>
170
+ {!hideLabel && label && (
171
+ <Typography variant='body2' color='text.secondary'>
172
+ {label}
173
+ </Typography>
174
+ )}
175
+ {displayComp}
176
+ {renderModal()}
177
+ </div>
178
+ );
179
+ }
@@ -0,0 +1 @@
1
+ export { default } from './SimpleTableSelectReadonly';
@@ -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
  }
@@ -1,16 +1,16 @@
1
- import { PropsWithChildren, ReactElement } from 'react';
2
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
1
+ import type { PropsWithChildren, ReactElement } from 'react';
2
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
3
  import './WideNarrow.css';
4
4
 
5
5
  interface WideNarrowProps extends PConnProps {
6
6
  // If any, enter additional props that only exist on this component
7
7
  a: any;
8
8
  b: any;
9
- // eslint-disable-next-line react/no-unused-prop-types
9
+
10
10
  title?: string;
11
- // eslint-disable-next-line react/no-unused-prop-types
11
+
12
12
  cols?: string;
13
- // eslint-disable-next-line react/no-unused-prop-types
13
+
14
14
  icon?: string;
15
15
  }
16
16