@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
@@ -0,0 +1,90 @@
1
+ const isSelfReferencedProperty = (param, referenceProp) => {
2
+ const [, parentPropName] = param.split('.');
3
+ const referencePropParent = referenceProp?.split('.').pop();
4
+ return parentPropName === referencePropParent;
5
+ };
6
+
7
+ export function getFieldMeta(getPConnect, dataRelationshipContext) {
8
+ const pConn = getPConnect();
9
+ const { selectionMode, selectionList } = pConn.getConfigProps();
10
+ const { MULTI } = PCore.getConstants().LIST_SELECTION_MODE;
11
+
12
+ const isMultiSelectMode = selectionMode === MULTI;
13
+
14
+ const pageReference = pConn.getPageReference();
15
+ let referenceProp = isMultiSelectMode ? selectionList.substring(1) : pageReference.substring(pageReference.lastIndexOf('.') + 1);
16
+ // Replace here to use the context name instead
17
+ let contextPageReference = null;
18
+ if (dataRelationshipContext !== null && selectionMode === 'single') {
19
+ referenceProp = dataRelationshipContext;
20
+ contextPageReference = pageReference.concat('.').concat(referenceProp);
21
+ }
22
+
23
+ const fieldMetadata =
24
+ (isMultiSelectMode ? pConn.getFieldMetadata(`${referenceProp}`) : pConn.getCurrentPageFieldMetadata(contextPageReference)) ?? {};
25
+ const { datasource: { parameters: fieldParameters = {} } = {} } = fieldMetadata;
26
+ const compositeKeys: any = [];
27
+ Object.values(fieldParameters).forEach((param: any) => {
28
+ if (isSelfReferencedProperty(param, referenceProp)) compositeKeys.push(param.substring(param.lastIndexOf('.') + 1));
29
+ });
30
+
31
+ return { compositeKeys, fieldMetadata };
32
+ }
33
+
34
+ /**
35
+ * returns array of self-referenced properties of the datasource
36
+ * Ex: returns ["@P .DataRef.pyGUID", "@P .DataRef.customerID"]
37
+ */
38
+ const getCompositeKeys = (pConnect, property) => {
39
+ const fieldMetadata = pConnect.getFieldMetadata(property) || {};
40
+ const { datasource: { parameters: fieldParameters = {} } = {} } = fieldMetadata;
41
+ const compositeKeys: any = [];
42
+ Object.values(fieldParameters).forEach(param => {
43
+ if (isSelfReferencedProperty(param, property)) {
44
+ compositeKeys.push(param);
45
+ }
46
+ });
47
+ return compositeKeys;
48
+ };
49
+
50
+ export const getFirstChildConfig = ({
51
+ firstChildMeta,
52
+ getPConnect,
53
+ rawViewMetadata,
54
+ contextClass,
55
+ dataReferenceConfigToChild,
56
+ isCreateNewReferenceEnabled,
57
+ disableStartingFieldsForReference,
58
+ pyID
59
+ }) => {
60
+ const config = {
61
+ ...firstChildMeta.config,
62
+ ...dataReferenceConfigToChild
63
+ };
64
+ const compositeKeys = getCompositeKeys(getPConnect(), dataReferenceConfigToChild?.dataRelationshipContext);
65
+ return {
66
+ ...config,
67
+ viewName: getPConnect().getCurrentView(),
68
+ referenceList: config.referenceList ?? rawViewMetadata.config.referenceList,
69
+ parameters: rawViewMetadata.config.parameters,
70
+ localeReference: rawViewMetadata.config.localeReference,
71
+ contextClass: config.contextClass || rawViewMetadata?.config?.contextClass || rawViewMetadata?.config?.targetObjectClass,
72
+ allowAddingNewRecords: firstChildMeta.type === 'SimpleTableSelect' && isCreateNewReferenceEnabled ? true : undefined,
73
+ actions: firstChildMeta.type === 'SimpleTableSelect' &&
74
+ isCreateNewReferenceEnabled && [
75
+ {
76
+ action: 'ADD_CASE',
77
+ config: {
78
+ label: '@L Add',
79
+ caseType: contextClass,
80
+ inputFields: disableStartingFieldsForReference
81
+ ? {}
82
+ : {
83
+ [`.pyAddCaseContextPage.${pyID}`]: `@P .${pyID}`
84
+ }
85
+ }
86
+ }
87
+ ],
88
+ compositeKeys
89
+ };
90
+ };
@@ -1,11 +1,11 @@
1
- import { createElement, PropsWithChildren } from 'react';
1
+ import { createElement, type PropsWithChildren } from 'react';
2
2
 
3
3
  import { getInstructions } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
4
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
5
  import connectToState from '@pega/react-sdk-components/lib/components/helpers/state-utils';
6
6
 
7
7
  import { getKeyForMappedField, mapStateToProps } from './utils';
8
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
9
 
10
10
  import './DefaultForm.css';
11
11
 
@@ -56,7 +56,7 @@ export default function DefaultForm(props: PropsWithChildren<DefaultFormProps>)
56
56
  {instructions && (
57
57
  <div className='psdk-default-form-instruction-text'>
58
58
  {/* server performs sanitization method for instructions html content */}
59
- {/* eslint-disable react/no-danger */}
59
+ {}
60
60
  <div key='instructions' id='instruction-text' dangerouslySetInnerHTML={{ __html: instructions }} />
61
61
  </div>
62
62
  )}
@@ -1,5 +1,3 @@
1
- import { v4 as uuidv4 } from 'uuid';
2
-
3
1
  export const mapStateToProps: any = (_, ownProps) => {
4
2
  const { getPConnect } = ownProps;
5
3
 
@@ -24,5 +22,5 @@ export const getKeyForMappedField = field => {
24
22
  return JSON.stringify(pConnect.meta);
25
23
  }
26
24
 
27
- return uuidv4();
25
+ return crypto.randomUUID();
28
26
  };
@@ -0,0 +1,108 @@
1
+ import { useMemo, Children } from 'react';
2
+ import type { ReactNode } from 'react';
3
+ import { Grid2 } from '@mui/material';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+
6
+ export interface CommonPageProps {
7
+ /** Page title */
8
+ title: string;
9
+
10
+ /** Page icon */
11
+ icon: string;
12
+
13
+ /** Region children */
14
+ children: ReactNode | ReactNode[];
15
+
16
+ /** Dynamic page pconnect object */
17
+ // getPConnect: () => PConnect;
18
+
19
+ /** Enable GetNextWork in page */
20
+ enableGetNextWork?: boolean;
21
+
22
+ /** GetAI coaches configured in page */
23
+ // coaches?: GenAICoach[];
24
+
25
+ /** Locale reference */
26
+ localeReference: string;
27
+ }
28
+ interface DefaultPageProps extends CommonPageProps {
29
+ /** Default page layout one or two columns */
30
+ layout: 'one-column' | 'two-column' | 'wide-narrow' | 'narrow-wide' | 'dynamic';
31
+
32
+ /** Flag to enable banner/hero */
33
+ enableBanner?: boolean;
34
+
35
+ /** Banner - Heading displayed */
36
+ heading?: string;
37
+
38
+ /** Banner - Message displayed */
39
+ message?: string;
40
+
41
+ /** Banner - Theme of the image */
42
+ imageTheme?: 'light' | 'dark' | undefined;
43
+
44
+ /** Banner - Background image */
45
+ backgroundImage?: string;
46
+
47
+ /** Banner - Background color */
48
+ backgroundColor?: string;
49
+
50
+ /** Banner - Tint image */
51
+ tintImage?: boolean;
52
+
53
+ /** Flag to enable layout model */
54
+ // layoutModel?: GridLayoutModel | undefined;
55
+ }
56
+
57
+ const COLUMNS_WIDTHS = {
58
+ 'one-column': [12],
59
+ 'two-column': [6, 6],
60
+ 'narrow-wide': [4, 8],
61
+ 'wide-narrow': [8, 4]
62
+ };
63
+
64
+ export default function DefaultPage({
65
+ layout = 'one-column',
66
+ children,
67
+ enableBanner,
68
+ heading = '',
69
+ message = '',
70
+ imageTheme,
71
+ backgroundImage = '',
72
+ backgroundColor = '',
73
+ tintImage
74
+ }: DefaultPageProps) {
75
+ const Banner = getComponentFromMap('Banner');
76
+
77
+ const childArray = useMemo(() => {
78
+ return Children.toArray(children);
79
+ }, [children]);
80
+
81
+ if (enableBanner) {
82
+ return (
83
+ <Banner
84
+ variant={layout === 'one-column' ? 'two-column' : layout}
85
+ a={[childArray[0]]}
86
+ b={[childArray[1]]}
87
+ banner={{
88
+ variant: imageTheme,
89
+ backgroundColor,
90
+ title: heading,
91
+ message,
92
+ backgroundImage,
93
+ tintImage
94
+ }}
95
+ />
96
+ );
97
+ }
98
+
99
+ return (
100
+ <Grid2 container spacing={1}>
101
+ {childArray.map((child, index) => (
102
+ <Grid2 key={index} size={COLUMNS_WIDTHS[layout][index]}>
103
+ {child}
104
+ </Grid2>
105
+ ))}
106
+ </Grid2>
107
+ );
108
+ }
@@ -0,0 +1 @@
1
+ export { default } from './DefaultPage';
@@ -1,9 +1,9 @@
1
1
  import { createElement } from 'react';
2
- import Grid from '@mui/material/Grid';
2
+ import Grid2 from '@mui/material/Grid2';
3
3
 
4
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
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 DetailsProps extends PConnProps {
9
9
  // If any, enter additional props that only exist on this component
@@ -28,7 +28,7 @@ export default function Details(props: DetailsProps) {
28
28
  const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
29
  createElement(createPConnectComponent(), {
30
30
  ...configObject,
31
- // eslint-disable-next-line react/no-array-index-key
31
+
32
32
  key: index.toString()
33
33
  })
34
34
  );
@@ -53,21 +53,21 @@ export default function Details(props: DetailsProps) {
53
53
  return (
54
54
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
55
55
  {showHighlightedData && highlightedDataArr.length > 0 && (
56
- <Grid container spacing={1} style={{ padding: '0 0 1em' }}>
56
+ <Grid2 container spacing={1} style={{ padding: '0 0 1em' }}>
57
57
  {highlightedDataArr.map((child, i) => (
58
- <Grid item xs={12} key={`hf-${i + 1}`}>
58
+ <Grid2 size={{ xs: 12 }} key={`hf-${i + 1}`}>
59
59
  {child}
60
- </Grid>
60
+ </Grid2>
61
61
  ))}
62
- </Grid>
62
+ </Grid2>
63
63
  )}
64
- <Grid container spacing={1}>
64
+ <Grid2 container spacing={1}>
65
65
  {children.map((child, i) => (
66
- <Grid item xs={12} key={`r-${i + 1}`}>
66
+ <Grid2 size={{ xs: 12 }} key={`r-${i + 1}`}>
67
67
  {child}
68
- </Grid>
68
+ </Grid2>
69
69
  ))}
70
- </Grid>
70
+ </Grid2>
71
71
  </FieldGroup>
72
72
  );
73
73
  }
@@ -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 '@pega/react-sdk-components/lib/components/template/SubTabs/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 DetailsSubTabsProps extends PConnProps {
9
9
  // If any, enter additional props that only exist on this component
@@ -1,9 +1,9 @@
1
1
  import { createElement } from 'react';
2
- import Grid from '@mui/material/Grid';
2
+ import Grid2 from '@mui/material/Grid2';
3
3
 
4
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
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 DetailsThreeColumnProps extends PConnProps {
9
9
  // If any, enter additional props that only exist on this component
@@ -28,7 +28,7 @@ export default function DetailsThreeColumn(props: DetailsThreeColumnProps) {
28
28
  const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
29
  createElement(createPConnectComponent(), {
30
30
  ...configObject,
31
- // eslint-disable-next-line react/no-array-index-key
31
+
32
32
  key: index.toString()
33
33
  })
34
34
  );
@@ -53,21 +53,21 @@ export default function DetailsThreeColumn(props: DetailsThreeColumnProps) {
53
53
  return (
54
54
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
55
55
  {showHighlightedData && highlightedDataArr.length > 0 && (
56
- <Grid container spacing={1} style={{ padding: '0 0 1em' }}>
56
+ <Grid2 container spacing={1} style={{ padding: '0 0 1em' }}>
57
57
  {highlightedDataArr.map((child, i) => (
58
- <Grid item xs={4} key={`hf-${i + 1}`}>
58
+ <Grid2 size={{ xs: 4 }} key={`hf-${i + 1}`}>
59
59
  {child}
60
- </Grid>
60
+ </Grid2>
61
61
  ))}
62
- </Grid>
62
+ </Grid2>
63
63
  )}
64
- <Grid container spacing={1}>
64
+ <Grid2 container spacing={1}>
65
65
  {children.map((child, i) => (
66
- <Grid item xs={4} key={`r-${i + 1}`}>
66
+ <Grid2 size={{ xs: 4 }} key={`r-${i + 1}`}>
67
67
  {child}
68
- </Grid>
68
+ </Grid2>
69
69
  ))}
70
- </Grid>
70
+ </Grid2>
71
71
  </FieldGroup>
72
72
  );
73
73
  }
@@ -1,9 +1,9 @@
1
1
  import { createElement } from 'react';
2
- import Grid from '@mui/material/Grid';
2
+ import Grid2 from '@mui/material/Grid2';
3
3
 
4
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
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 DetailsTwoColumnProps extends PConnProps {
9
9
  // If any, enter additional props that only exist on this component
@@ -28,7 +28,7 @@ export default function DetailsTwoColumn(props: DetailsTwoColumnProps) {
28
28
  const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
29
  createElement(createPConnectComponent(), {
30
30
  ...configObject,
31
- // eslint-disable-next-line react/no-array-index-key
31
+
32
32
  key: index.toString()
33
33
  })
34
34
  );
@@ -53,21 +53,21 @@ export default function DetailsTwoColumn(props: DetailsTwoColumnProps) {
53
53
  return (
54
54
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
55
55
  {showHighlightedData && highlightedDataArr.length > 0 && (
56
- <Grid container spacing={1} style={{ padding: '0 0 1em' }}>
56
+ <Grid2 container spacing={1} style={{ padding: '0 0 1em' }}>
57
57
  {highlightedDataArr.map((child, i) => (
58
- <Grid item xs={6} key={`hf-${i + 1}`}>
58
+ <Grid2 size={{ xs: 6 }} key={`hf-${i + 1}`}>
59
59
  {child}
60
- </Grid>
60
+ </Grid2>
61
61
  ))}
62
- </Grid>
62
+ </Grid2>
63
63
  )}
64
- <Grid container spacing={1}>
64
+ <Grid2 container spacing={1}>
65
65
  {children.map((child, i) => (
66
- <Grid item xs={6} key={`r-${i + 1}`}>
66
+ <Grid2 size={{ xs: 6 }} key={`r-${i + 1}`}>
67
67
  {child}
68
- </Grid>
68
+ </Grid2>
69
69
  ))}
70
- </Grid>
70
+ </Grid2>
71
71
  </FieldGroup>
72
72
  );
73
73
  }
@@ -4,7 +4,7 @@ import { TabContext, TabPanel } from '@mui/lab';
4
4
  import makeStyles from '@mui/styles/makeStyles';
5
5
 
6
6
  import { buildView } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
7
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
8
 
9
9
  const useStyles = makeStyles(() => ({
10
10
  tab: {
@@ -1,9 +1,8 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
1
  import { useLayoutEffect, useMemo } from 'react';
3
2
 
4
3
  import { getReferenceList, buildView } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
5
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
6
 
8
7
  interface FieldGroupTemplateProps extends PConnProps {
9
8
  // If any, enter additional props that only exist on this component
@@ -15,6 +14,7 @@ interface FieldGroupTemplateProps extends PConnProps {
15
14
  displayMode?: string;
16
15
  fieldHeader?: string;
17
16
  allowTableEdit: boolean;
17
+ allowActions?: any;
18
18
  }
19
19
 
20
20
  export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
@@ -31,6 +31,7 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
31
31
  heading = '',
32
32
  displayMode,
33
33
  fieldHeader,
34
+ allowActions,
34
35
  allowTableEdit: allowAddEdit
35
36
  } = props;
36
37
  const pConn = getPConnect();
@@ -40,9 +41,14 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
40
41
  const isReadonlyMode = renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY';
41
42
  const HEADING = heading ?? 'Row';
42
43
 
44
+ const hasAllowActions = Object.keys(allowActions ?? {}).length > 0;
45
+ const { allowAdd: actionAdd, allowDelete: actionDelete } = allowActions ?? {};
46
+ const allowAdd = hasAllowActions ? (actionAdd ?? true) : (allowAddEdit ?? true);
47
+ const allowDelete = hasAllowActions ? (actionDelete ?? true) : (allowAddEdit ?? true);
48
+
43
49
  useLayoutEffect(() => {
44
50
  if (!isReadonlyMode) {
45
- // @ts-ignore - Expected 3 arguments, but got 1
51
+ // @ts-expect-error - Expected 3 arguments, but got 1
46
52
  pConn.getListActions().initDefaultPageInstructions(resolvedList);
47
53
  }
48
54
  }, [referenceList?.length]);
@@ -73,7 +79,7 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
73
79
  pConn.getListActions().deleteEntry(index);
74
80
  }
75
81
  };
76
- if (referenceList.length === 0 && allowAddEdit !== false) {
82
+ if (referenceList.length === 0 && allowAdd) {
77
83
  addFieldGroupItem();
78
84
  }
79
85
 
@@ -88,8 +94,8 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
88
94
  return (
89
95
  <FieldGroupList
90
96
  items={MemoisedChildren}
91
- onAdd={allowAddEdit !== false ? addFieldGroupItem : undefined}
92
- onDelete={allowAddEdit !== false ? deleteFieldGroupItem : undefined}
97
+ onAdd={allowAdd ? addFieldGroupItem : undefined}
98
+ onDelete={allowDelete ? deleteFieldGroupItem : undefined}
93
99
  />
94
100
  );
95
101
  }
@@ -0,0 +1,58 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import { Tab, Tabs, Box, Badge, Tooltip } from '@mui/material';
3
+ import { TabContext, TabPanel } from '@mui/lab';
4
+
5
+ import { useHierarchicalForm, type HierarchicalFormProps } from './hooks';
6
+
7
+ export default function HierarchicalForm(props: PropsWithChildren<HierarchicalFormProps>) {
8
+ const { currentTabId, handleTabClick, processedTabs, instructions } = useHierarchicalForm(props);
9
+
10
+ if (!currentTabId) {
11
+ return null;
12
+ }
13
+
14
+ return (
15
+ <Box display='flex' flexDirection='column'>
16
+ {instructions && (
17
+ <Box mb={2}>
18
+ <div dangerouslySetInnerHTML={{ __html: instructions }} />
19
+ </Box>
20
+ )}
21
+ <Box sx={{ flexGrow: 1 }}>
22
+ <TabContext value={currentTabId.toString()}>
23
+ <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
24
+ <Tabs onChange={handleTabClick} value={currentTabId.toString()} variant='scrollable'>
25
+ {processedTabs.map((tab: any) => {
26
+ const tabLabel = tab.name || tab.label;
27
+ return (
28
+ <Tab
29
+ key={tab.id}
30
+ sx={{ textTransform: 'none' }}
31
+ label={
32
+ tab.errors ? (
33
+ <Tooltip title={`${tabLabel} has errors`} placement='top'>
34
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
35
+ <span>{tabLabel}</span>
36
+ <Badge badgeContent={tab.errors} color='error' sx={{ '& .MuiBadge-badge': { position: 'static', transform: 'none' } }} />
37
+ </Box>
38
+ </Tooltip>
39
+ ) : (
40
+ tabLabel
41
+ )
42
+ }
43
+ value={tab.id?.toString()}
44
+ />
45
+ );
46
+ })}
47
+ </Tabs>
48
+ </Box>
49
+ {processedTabs.map((tab: any) => (
50
+ <TabPanel key={tab.id} value={tab.id?.toString()} tabIndex={+tab.id} keepMounted sx={{ px: 0 }}>
51
+ <div>{tab.content ? tab.content : 'No content exists'}</div>
52
+ </TabPanel>
53
+ ))}
54
+ </TabContext>
55
+ </Box>
56
+ </Box>
57
+ );
58
+ }