@pega/react-sdk-overrides 0.24.4 → 0.25.1

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 (118) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +1 -1
  2. package/lib/designSystemExtension/Banner/Banner.tsx +1 -1
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +11 -2
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +4 -4
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +4 -4
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +6 -6
  9. package/lib/designSystemExtension/Operator/Operator.tsx +6 -5
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +2 -2
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
  13. package/lib/field/AutoComplete/AutoComplete.tsx +4 -4
  14. package/lib/field/CancelAlert/CancelAlert.tsx +4 -7
  15. package/lib/field/Checkbox/Checkbox.tsx +4 -4
  16. package/lib/field/Currency/Currency.tsx +10 -7
  17. package/lib/field/Date/Date.tsx +27 -42
  18. package/lib/field/DateTime/DateTime.tsx +39 -36
  19. package/lib/field/Decimal/Decimal.tsx +9 -4
  20. package/lib/field/Dropdown/Dropdown.tsx +29 -22
  21. package/lib/field/Email/Email.tsx +29 -8
  22. package/lib/field/Group/Group.tsx +2 -2
  23. package/lib/field/Integer/Integer.tsx +22 -8
  24. package/lib/field/Multiselect/Multiselect.tsx +8 -14
  25. package/lib/field/Multiselect/utils.ts +1 -1
  26. package/lib/field/Percentage/Percentage.tsx +8 -4
  27. package/lib/field/Phone/Phone.tsx +6 -5
  28. package/lib/field/Phone/config-ext.json +8 -0
  29. package/lib/field/RadioButtons/RadioButtons.tsx +3 -6
  30. package/lib/field/RichText/RichText.tsx +1 -1
  31. package/lib/field/RichText/config-ext.json +10 -0
  32. package/lib/field/ScalarList/ScalarList.tsx +3 -4
  33. package/lib/field/SemanticLink/SemanticLink.tsx +4 -4
  34. package/lib/field/TextArea/TextArea.tsx +26 -8
  35. package/lib/field/TextContent/TextContent.tsx +1 -1
  36. package/lib/field/TextInput/TextInput.tsx +2 -2
  37. package/lib/field/Time/Time.tsx +28 -21
  38. package/lib/field/URL/URL.tsx +26 -7
  39. package/lib/field/UserReference/UserReference.tsx +3 -5
  40. package/lib/helpers/common-utils.ts +24 -1
  41. package/lib/helpers/field-group-utils.ts +2 -2
  42. package/lib/helpers/formatters/Currency.ts +11 -16
  43. package/lib/helpers/formatters/common.ts +2 -1
  44. package/lib/helpers/formatters/index.ts +2 -4
  45. package/lib/helpers/simpleTableHelpers.ts +1 -1
  46. package/lib/infra/ActionButtons/ActionButtons.tsx +3 -3
  47. package/lib/infra/Assignment/Assignment.tsx +12 -12
  48. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +16 -28
  49. package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
  50. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +9 -4
  51. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +8 -8
  52. package/lib/infra/Containers/SimpleView/helper.ts +1 -1
  53. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +1 -1
  54. package/lib/infra/DashboardFilter/DashboardFilter.tsx +4 -6
  55. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
  56. package/lib/infra/DeferLoad/DeferLoad.tsx +8 -8
  57. package/lib/infra/MultiStep/MultiStep.tsx +15 -14
  58. package/lib/infra/NavBar/NavBar.css +1 -0
  59. package/lib/infra/NavBar/NavBar.tsx +25 -17
  60. package/lib/infra/RootContainer/RootContainer.tsx +5 -6
  61. package/lib/infra/Stages/Stages.tsx +4 -4
  62. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +4 -3
  63. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
  64. package/lib/infra/View/View.tsx +37 -3
  65. package/lib/template/AdvancedSearch/AdvancedSearch.tsx +87 -0
  66. package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +58 -0
  67. package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +245 -0
  68. package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
  69. package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
  70. package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
  71. package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
  72. package/lib/template/AdvancedSearch/config-ext.json +9 -0
  73. package/lib/template/AdvancedSearch/index.tsx +1 -0
  74. package/lib/template/AppShell/AppShell.tsx +60 -10
  75. package/lib/template/BannerPage/config-ext.json +9 -0
  76. package/lib/template/CaseView/CaseView.tsx +10 -9
  77. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +7 -7
  78. package/lib/template/Confirmation/Confirmation.tsx +3 -2
  79. package/lib/template/DataReference/DataReference.tsx +317 -107
  80. package/lib/template/DataReference/DataReferenceAdvancedSearchContext.js +10 -0
  81. package/lib/template/DataReference/SearchForm.tsx +148 -0
  82. package/lib/template/DataReference/utils.js +90 -0
  83. package/lib/template/DefaultForm/utils/index.ts +1 -3
  84. package/lib/template/Details/Details/Details.tsx +2 -2
  85. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +3 -3
  86. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +2 -2
  87. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +2 -2
  88. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +4 -4
  89. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +10 -5
  90. package/lib/template/InlineDashboard/InlineDashboard.tsx +2 -2
  91. package/lib/template/InlineDashboardPage/config-ext.json +9 -0
  92. package/lib/template/ListView/ListView.tsx +200 -94
  93. package/lib/template/ListView/utils.ts +38 -6
  94. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +2 -2
  95. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +2 -2
  96. package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -2
  97. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +0 -2
  98. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +110 -86
  99. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +2 -4
  100. package/lib/template/SubTabs/SubTabs.tsx +2 -2
  101. package/lib/template/SubTabs/tabUtils.ts +118 -1
  102. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +2 -2
  103. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +2 -2
  104. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +2 -2
  105. package/lib/template/WssNavBar/WssNavBar.tsx +9 -9
  106. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +2 -2
  107. package/lib/widget/Attachment/Attachment.css +1 -0
  108. package/lib/widget/Attachment/Attachment.tsx +7 -9
  109. package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
  110. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -1
  111. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +5 -4
  112. package/lib/widget/Followers/Followers.tsx +2 -2
  113. package/lib/widget/QuickCreate/QuickCreate.tsx +0 -1
  114. package/lib/widget/QuickCreate/config-ext.json +9 -0
  115. package/lib/widget/SummaryItem/SummaryItem.tsx +4 -3
  116. package/lib/widget/ToDo/ToDo.tsx +92 -22
  117. package/package.json +1 -1
  118. /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
@@ -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 = [];
27
+ Object.values(fieldParameters).forEach(param => {
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 = [];
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,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
  };
@@ -1,5 +1,5 @@
1
1
  import { createElement } from 'react';
2
- import Grid from '@material-ui/core/Grid';
2
+ import Grid from '@mui/material/Grid';
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';
@@ -23,7 +23,7 @@ export default function Details(props: DetailsProps) {
23
23
 
24
24
  // Set display mode prop and re-create the children so this part of the dom tree renders
25
25
  // in a readonly (display) mode instead of a editable
26
- getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
26
+ getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
27
27
  getPConnect().setInheritedProp('readOnly', true);
28
28
  const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
29
  createElement(createPConnectComponent(), {
@@ -1,6 +1,6 @@
1
1
  import { Children, PropsWithChildren, useEffect, useState } from 'react';
2
- import { Tab, Tabs, TextField } from '@material-ui/core';
3
- import { TabContext, TabPanel } from '@material-ui/lab';
2
+ import { Tab, Tabs } from '@mui/material';
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
6
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
@@ -39,7 +39,7 @@ export default function DetailsSubTabs(props: PropsWithChildren<DetailsSubTabsPr
39
39
 
40
40
  return (
41
41
  <>
42
- {propsToUse.showLabel && <TextField>{propsToUse.label}</TextField>}
42
+ {propsToUse.showLabel && <h3>{propsToUse.label}</h3>}
43
43
  <TabContext value={currentTabId.toString()}>
44
44
  <Tabs onChange={handleTabClick} value={currentTabId}>
45
45
  {tabItems.map((tab: any) => (
@@ -1,5 +1,5 @@
1
1
  import { createElement } from 'react';
2
- import Grid from '@material-ui/core/Grid';
2
+ import Grid from '@mui/material/Grid';
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';
@@ -23,7 +23,7 @@ export default function DetailsThreeColumn(props: DetailsThreeColumnProps) {
23
23
 
24
24
  // Set display mode prop and re-create the children so this part of the dom tree renders
25
25
  // in a readonly (display) mode instead of a editable
26
- getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
26
+ getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
27
27
  getPConnect().setInheritedProp('readOnly', true);
28
28
  const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
29
  createElement(createPConnectComponent(), {
@@ -1,5 +1,5 @@
1
1
  import { createElement } from 'react';
2
- import Grid from '@material-ui/core/Grid';
2
+ import Grid from '@mui/material/Grid';
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';
@@ -23,7 +23,7 @@ export default function DetailsTwoColumn(props: DetailsTwoColumnProps) {
23
23
 
24
24
  // Set display mode prop and re-create the children so this part of the dom tree renders
25
25
  // in a readonly (display) mode instead of a editable
26
- getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
26
+ getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
27
27
  getPConnect().setInheritedProp('readOnly', true);
28
28
  const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
29
  createElement(createPConnectComponent(), {
@@ -1,6 +1,7 @@
1
1
  import React, { Children, useMemo, useState } from 'react';
2
- import { makeStyles, Tab, Tabs } from '@material-ui/core';
3
- import { TabContext, TabPanel } from '@material-ui/lab';
2
+ import { Tab, Tabs } from '@mui/material';
3
+ import { TabContext, TabPanel } from '@mui/lab';
4
+ import makeStyles from '@mui/styles/makeStyles';
4
5
 
5
6
  import { buildView } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
6
7
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
@@ -25,12 +26,11 @@ function DynamicTabs(props: DynamicTabsProps) {
25
26
  // Get the inherited props from the parent to determine label settings
26
27
  const propsToUse = { label, showLabel, ...pConnect.getInheritedProps() };
27
28
  const defaultTabIndex = 0;
28
- // @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
29
29
  const { tablabel } = pConnect.getComponentConfig();
30
30
  const tablabelProp = PCore.getAnnotationUtils().getPropertyName(tablabel);
31
31
  const referenceListData: any = pConnect.getValue(`${referenceList}.pxResults`, ''); // 2nd arg empty string until typedefs properly allow optional
32
32
  const memoisedTabViews = useMemo(() => {
33
- pConnect.setInheritedProp('displayMode', 'LABELS_LEFT');
33
+ pConnect.setInheritedProp('displayMode', 'DISPLAY_ONLY');
34
34
  pConnect.setInheritedProp('readOnly', true);
35
35
 
36
36
  return (
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react-hooks/rules-of-hooks */
2
- import { useMemo } from 'react';
2
+ import { useLayoutEffect, useMemo } from 'react';
3
3
 
4
4
  import { getReferenceList, buildView } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
@@ -37,9 +37,16 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
37
37
  const resolvedList = getReferenceList(pConn);
38
38
  pConn.setReferenceList(resolvedList);
39
39
  const pageReference = `${pConn.getPageReference()}${resolvedList}`;
40
- const isReadonlyMode = renderMode === 'ReadOnly' || displayMode === 'LABELS_LEFT';
40
+ const isReadonlyMode = renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY';
41
41
  const HEADING = heading ?? 'Row';
42
42
 
43
+ useLayoutEffect(() => {
44
+ if (!isReadonlyMode) {
45
+ // @ts-ignore - Expected 3 arguments, but got 1
46
+ pConn.getListActions().initDefaultPageInstructions(resolvedList);
47
+ }
48
+ }, [referenceList?.length]);
49
+
43
50
  const getDynamicHeaderProp = (item, index) => {
44
51
  if (fieldHeader === 'propertyRef' && heading && item[heading.substring(1)]) {
45
52
  return item[heading.substring(1)];
@@ -51,7 +58,6 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
51
58
  if (PCore.getPCoreVersion()?.includes('8.7')) {
52
59
  pConn.getListActions().insert({ classID: contextClass }, referenceList.length, pageReference);
53
60
  } else {
54
- // @ts-ignore - An argument for 'pageRef' was not provided.
55
61
  pConn.getListActions().insert({}, referenceList.length);
56
62
  }
57
63
  };
@@ -64,7 +70,6 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
64
70
  if (PCore.getPCoreVersion()?.includes('8.7')) {
65
71
  pConn.getListActions().deleteEntry(index, pageReference);
66
72
  } else {
67
- // @ts-ignore - An argument for 'pageRef' was not provided.
68
73
  pConn.getListActions().deleteEntry(index);
69
74
  }
70
75
  };
@@ -89,7 +94,7 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
89
94
  );
90
95
  }
91
96
 
92
- pConn.setInheritedProp('displayMode', 'LABELS_LEFT');
97
+ pConn.setInheritedProp('displayMode', 'DISPLAY_ONLY');
93
98
  const memoisedReadOnlyList = useMemo(() => {
94
99
  return referenceList.map((item, index) => {
95
100
  const key = item[heading] || `field-group-row-${index}`;
@@ -1,6 +1,6 @@
1
1
  import { PropsWithChildren, ReactElement } from 'react';
2
- import { Grid, Typography } from '@material-ui/core';
3
- import { makeStyles } from '@material-ui/core/styles';
2
+ import { Grid, Typography } from '@mui/material';
3
+ import makeStyles from '@mui/styles/makeStyles';
4
4
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
5
 
6
6
  interface InlineDashboardProps extends PConnProps {
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "InlineDashboardPage",
3
+ "label": "Inline Dashboard",
4
+ "description": "Inline Dashboard Page Template",
5
+ "type": "Template",
6
+ "subtype": "PAGE",
7
+ "icon": "InlineDashboardPage.svg",
8
+ "properties": []
9
+ }