@pega/react-sdk-overrides 0.23.26 → 0.23.28
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.
- package/LICENSE +201 -0
- package/README.md +17 -0
- package/SECURITY.md +10 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +39 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
- package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
- package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
- package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +29 -19
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +27 -38
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +10 -18
- package/lib/field/Date/Date.tsx +33 -15
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +22 -11
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +64 -17
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +154 -18
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +16 -7
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +37 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +15 -6
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/Percentage/Percentage.tsx +14 -6
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +17 -7
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +96 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +63 -0
- package/lib/field/ScalarList/config-ext.json +7 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -10
- package/lib/field/TextArea/TextArea.tsx +15 -5
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +9 -2
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +41 -10
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +21 -18
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +23 -6
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +52 -58
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
- package/lib/helpers/case-utils.tsx +99 -0
- package/lib/helpers/common-utils.ts +8 -0
- package/lib/helpers/data_page.ts +3 -6
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
- package/lib/helpers/formatters/Boolean.ts +21 -0
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
- package/lib/helpers/formatters/CurrencyMap.ts +915 -0
- package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
- package/lib/helpers/formatters/{common.js → common.ts} +3 -4
- package/lib/helpers/formatters/{index.js → index.ts} +22 -22
- package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
- package/lib/helpers/simpleTableHelpers.ts +65 -85
- package/lib/helpers/state-utils.tsx +43 -0
- package/lib/helpers/template-utils.ts +4 -8
- package/lib/helpers/utils.ts +16 -8
- package/lib/helpers/versionHelpers.ts +1 -5
- package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -84
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
- package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
- package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
- package/lib/infra/Containers/SimpleView/helper.ts +125 -0
- package/lib/infra/Containers/SimpleView/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +180 -216
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +28 -43
- package/lib/infra/Reference/Reference.tsx +16 -22
- package/lib/infra/Region/Region.tsx +9 -9
- package/lib/infra/RootContainer/RootContainer.tsx +82 -125
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +38 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
- package/lib/infra/View/View.tsx +32 -63
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +51 -69
- package/lib/template/BannerPage/BannerPage.tsx +26 -33
- package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +122 -114
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
- package/lib/template/Confirmation/Confirmation.tsx +25 -53
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +112 -140
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +24 -28
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
- package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
- package/lib/template/Details/DynamicTabs/config.json +36 -0
- package/lib/template/Details/DynamicTabs/index.tsx +1 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
- package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
- package/lib/template/ListPage/ListPage.tsx +12 -16
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
- package/lib/template/ListView/ListView.tsx +245 -306
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
- package/lib/template/ListView/{utils.js → utils.ts} +202 -91
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
- package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
- package/lib/template/SubTabs/SubTabs.tsx +26 -45
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -7
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
- package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
- package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
- package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +20 -9
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +75 -4
- package/lib/widget/Attachment/Attachment.tsx +370 -388
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +27 -25
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +15 -4
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +80 -116
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -483
- package/lib/helpers/authManager.js +0 -631
- package/lib/helpers/config_access.js +0 -268
- package/lib/helpers/formatters/Boolean.js +0 -38
- package/lib/helpers/formatters/CurrencyMap.js +0 -908
- package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import Button from '@material-ui/core/Button';
|
|
3
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
|
|
6
|
+
const useStyles = makeStyles((/* theme */) => ({
|
|
7
|
+
button: {
|
|
8
|
+
width: '50%',
|
|
9
|
+
margin: '4px'
|
|
10
|
+
},
|
|
11
|
+
div: {
|
|
12
|
+
display: 'flex',
|
|
13
|
+
margin: '8px'
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
interface ListViewActionButtonsProps extends PConnProps {
|
|
18
|
+
// If any, enter additional props that only exist on this component
|
|
19
|
+
context: string;
|
|
20
|
+
closeActionsDialog: Function;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function ListViewActionButtons(props: ListViewActionButtonsProps) {
|
|
24
|
+
const { getPConnect, context, closeActionsDialog } = props;
|
|
25
|
+
const classes = useStyles();
|
|
26
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
27
|
+
const localeCategory = 'Data Object';
|
|
28
|
+
const [isDisabled, setIsDisabled] = useState(false);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className={classes.div}>
|
|
32
|
+
<Button
|
|
33
|
+
className={classes.button}
|
|
34
|
+
variant='contained'
|
|
35
|
+
color='secondary'
|
|
36
|
+
onClick={() => {
|
|
37
|
+
closeActionsDialog();
|
|
38
|
+
getPConnect().getActionsApi().cancelDataObject(context);
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{localizedVal('Cancel', localeCategory)}
|
|
42
|
+
</Button>
|
|
43
|
+
<Button
|
|
44
|
+
className={classes.button}
|
|
45
|
+
variant='contained'
|
|
46
|
+
color='primary'
|
|
47
|
+
disabled={isDisabled}
|
|
48
|
+
onClick={() => {
|
|
49
|
+
setIsDisabled(true);
|
|
50
|
+
getPConnect()
|
|
51
|
+
.getActionsApi()
|
|
52
|
+
.submitEmbeddedDataModal(context)
|
|
53
|
+
.then(() => {})
|
|
54
|
+
.finally(() => {
|
|
55
|
+
setIsDisabled(false);
|
|
56
|
+
closeActionsDialog();
|
|
57
|
+
});
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
{localizedVal('Submit', localeCategory)}
|
|
61
|
+
</Button>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default ListViewActionButtons;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ListViewActionButtons';
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import { createElement, useEffect, useRef, useState } from 'react';
|
|
3
2
|
import isEqual from 'fast-deep-equal';
|
|
4
3
|
import Dialog from '@material-ui/core/Dialog';
|
|
5
4
|
import DialogContent from '@material-ui/core/DialogContent';
|
|
6
5
|
import DialogTitle from '@material-ui/core/DialogTitle';
|
|
7
6
|
import { makeStyles } from '@material-ui/core/styles';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import CancelAlert from '@pega/react-sdk-components/lib/components/field/CancelAlert';
|
|
11
|
-
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
7
|
+
import { MuiPickersUtilsProvider } from '@material-ui/pickers';
|
|
8
|
+
import DayjsUtils from '@date-io/dayjs';
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
11
|
+
// Need to get correct implementation from component map for Assignment and CancelAlert
|
|
12
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
13
|
+
import { getBanners } from '@pega/react-sdk-components/lib/components/helpers/case-utils';
|
|
14
|
+
import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
15
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
16
|
+
|
|
17
|
+
interface ModalViewContainerProps extends PConnProps {
|
|
18
|
+
// If any, enter additional props that only exist on this component
|
|
19
|
+
loadingInfo?: string;
|
|
20
|
+
routingInfo?: any;
|
|
21
|
+
pageMessages?: string[];
|
|
22
|
+
}
|
|
14
23
|
|
|
15
24
|
function buildName(pConnect, name = '') {
|
|
16
25
|
const context = pConnect.getContextName();
|
|
@@ -67,11 +76,16 @@ const useStyles = makeStyles(theme => ({
|
|
|
67
76
|
}
|
|
68
77
|
}));
|
|
69
78
|
|
|
70
|
-
|
|
79
|
+
export default function ModalViewContainer(props: ModalViewContainerProps) {
|
|
80
|
+
// Get the proper implementation (local or Pega-provided) for these components that are emitted below
|
|
81
|
+
const Assignment = getComponentFromMap('Assignment');
|
|
82
|
+
const CancelAlert = getComponentFromMap('CancelAlert');
|
|
83
|
+
const ListViewActionButtons = getComponentFromMap('ListViewActionButtons');
|
|
84
|
+
|
|
71
85
|
const classes = useStyles();
|
|
72
86
|
|
|
73
87
|
const routingInfoRef = useRef({});
|
|
74
|
-
const { getPConnect, routingInfo, loadingInfo } = props;
|
|
88
|
+
const { getPConnect, routingInfo = null, loadingInfo = '', pageMessages = [] } = props;
|
|
75
89
|
const pConn = getPConnect();
|
|
76
90
|
const {
|
|
77
91
|
CONTAINER_TYPE: { MULTIPLE },
|
|
@@ -84,9 +98,14 @@ const ModalViewContainer = props => {
|
|
|
84
98
|
const [oCaseInfo, setOCaseInfo] = useState({});
|
|
85
99
|
const [createdView, setCreatedView] = useState<any>(null);
|
|
86
100
|
const [title, setTitle] = useState('');
|
|
87
|
-
const [arNewChildrenAsReact, setArNewChildrenAsReact] = useState<
|
|
101
|
+
const [arNewChildrenAsReact, setArNewChildrenAsReact] = useState<any[]>([]);
|
|
88
102
|
const [itemKey, setItemKey] = useState('');
|
|
89
103
|
const [cancelPConn, setCancelPConn] = useState(null);
|
|
104
|
+
const [isMultiRecordData, setMultiRecordData] = useState(false);
|
|
105
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
106
|
+
const localeCategory = 'Data Object';
|
|
107
|
+
|
|
108
|
+
const actionsDialog = useRef(false);
|
|
90
109
|
|
|
91
110
|
function showAlert(payload) {
|
|
92
111
|
const { latestItem } = getKeyAndLatestItem(routingInfoRef.current, pConn);
|
|
@@ -96,9 +115,9 @@ const ModalViewContainer = props => {
|
|
|
96
115
|
If we are in create stage full page mode, created a new case and trying to click on cancel button
|
|
97
116
|
it will show two alert dialogs which is not expected. Hence isModalAction flag to avoid that.
|
|
98
117
|
*/
|
|
99
|
-
if (latestItem && isModalAction) {
|
|
118
|
+
if (latestItem && isModalAction && !actionsDialog.current) {
|
|
100
119
|
const configObject = getConfigObject(latestItem, pConn);
|
|
101
|
-
setCancelPConn(configObject
|
|
120
|
+
setCancelPConn(configObject?.getPConnect() as any);
|
|
102
121
|
setShowCancelAlert(true);
|
|
103
122
|
}
|
|
104
123
|
}
|
|
@@ -131,6 +150,19 @@ const ModalViewContainer = props => {
|
|
|
131
150
|
setShowModal(modalFlag);
|
|
132
151
|
};
|
|
133
152
|
|
|
153
|
+
function getModalHeading(dataObjectAction) {
|
|
154
|
+
return dataObjectAction === PCore.getConstants().RESOURCE_STATUS.CREATE
|
|
155
|
+
? localizedVal('Add Record', localeCategory)
|
|
156
|
+
: localizedVal('Edit Record', localeCategory);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function determineModalHeaderByAction(actionName, caseTypeName, ID, caseLocaleRef) {
|
|
160
|
+
if (actionName) {
|
|
161
|
+
return localizedVal(actionName, localeCategory);
|
|
162
|
+
}
|
|
163
|
+
return `${localizedVal('Create', localeCategory)} ${localizedVal(caseTypeName, undefined, caseLocaleRef)} (${ID})`;
|
|
164
|
+
}
|
|
165
|
+
|
|
134
166
|
useEffect(() => {
|
|
135
167
|
// Establish the necessary containers
|
|
136
168
|
const containerMgr = pConn.getContainerManager();
|
|
@@ -140,9 +172,6 @@ const ModalViewContainer = props => {
|
|
|
140
172
|
useEffect(() => {
|
|
141
173
|
// Update routingInfoRef.current whenever routingInfo changes
|
|
142
174
|
routingInfoRef.current = routingInfo;
|
|
143
|
-
}, [routingInfo]);
|
|
144
|
-
|
|
145
|
-
useEffect(() => {
|
|
146
175
|
if (routingInfoRef.current && !loadingInfo) {
|
|
147
176
|
const currentOrder = routingInfo.accessedOrder;
|
|
148
177
|
|
|
@@ -153,20 +182,15 @@ const ModalViewContainer = props => {
|
|
|
153
182
|
const currentItems = routingInfo.items;
|
|
154
183
|
|
|
155
184
|
const { key, latestItem } = getKeyAndLatestItem(routingInfoRef.current, pConn);
|
|
156
|
-
|
|
157
185
|
// console.log(`ModalViewContainer: key: ${key} latestItem: ${JSON.stringify(latestItem)}`);
|
|
158
186
|
|
|
159
187
|
if (currentOrder.length > 0) {
|
|
160
|
-
if (
|
|
161
|
-
currentItems[key] &&
|
|
162
|
-
currentItems[key].view &&
|
|
163
|
-
!Utils.isEmptyObject(currentItems[key].view)
|
|
164
|
-
) {
|
|
188
|
+
if (currentItems[key] && currentItems[key].view && !isEmptyObject(currentItems[key].view)) {
|
|
165
189
|
const currentItem = currentItems[key];
|
|
166
190
|
const rootView = currentItem.view;
|
|
167
191
|
const { context } = rootView.config;
|
|
168
|
-
const config = { meta: rootView };
|
|
169
|
-
config
|
|
192
|
+
const config: any = { meta: rootView };
|
|
193
|
+
config.options = {
|
|
170
194
|
context: currentItem.context,
|
|
171
195
|
hasForm: true,
|
|
172
196
|
pageReference: context || pConn.getPageReference()
|
|
@@ -174,11 +198,7 @@ const ModalViewContainer = props => {
|
|
|
174
198
|
|
|
175
199
|
if (!bSubscribed) {
|
|
176
200
|
setSubscribed(true);
|
|
177
|
-
subscribe(
|
|
178
|
-
EVENT_SHOW_CANCEL_ALERT,
|
|
179
|
-
showAlert,
|
|
180
|
-
EVENT_SHOW_CANCEL_ALERT /* Unique string for subscription */
|
|
181
|
-
);
|
|
201
|
+
subscribe(EVENT_SHOW_CANCEL_ALERT, showAlert, EVENT_SHOW_CANCEL_ALERT /* Unique string for subscription */);
|
|
182
202
|
}
|
|
183
203
|
|
|
184
204
|
const configObject = PCore.createPConnect(config);
|
|
@@ -187,10 +207,8 @@ const ModalViewContainer = props => {
|
|
|
187
207
|
// The config has meta.config.type = "view"
|
|
188
208
|
const newComp = configObject.getPConnect();
|
|
189
209
|
// const newCompName = newComp.getComponentName();
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
? newComp.getDataObject().caseInfo
|
|
193
|
-
: null;
|
|
210
|
+
// @ts-ignore - parameter “contextName” for getDataObject method should be optional
|
|
211
|
+
const caseInfo = newComp && newComp.getDataObject() && newComp.getDataObject().caseInfo ? newComp.getDataObject().caseInfo : null;
|
|
194
212
|
|
|
195
213
|
// console.log(`ModalViewContainer just created newComp: ${newCompName}`);
|
|
196
214
|
|
|
@@ -211,16 +229,30 @@ const ModalViewContainer = props => {
|
|
|
211
229
|
// right now need to check caseInfo for changes, to trigger redraw, not getting
|
|
212
230
|
// changes from angularPconnect except for first draw
|
|
213
231
|
if (newComp && caseInfo && compareCaseInfoIsDifferent(caseInfo)) {
|
|
214
|
-
setCreatedView(configObject);
|
|
232
|
+
setCreatedView({ configObject, latestItem });
|
|
215
233
|
|
|
216
234
|
const { actionName } = latestItem;
|
|
217
235
|
const theNewCaseInfo = newComp.getCaseInfo();
|
|
218
236
|
const caseName = theNewCaseInfo.getName();
|
|
219
|
-
const ID = theNewCaseInfo.getID();
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
237
|
+
const ID = theNewCaseInfo.getBusinessID() || theNewCaseInfo.getID();
|
|
238
|
+
const caseTypeName = theNewCaseInfo.getCaseTypeName();
|
|
239
|
+
const isDataObject = routingInfo.items[latestItem.context].resourceType === PCore.getConstants().RESOURCE_TYPES.DATA;
|
|
240
|
+
const dataObjectAction = routingInfo.items[latestItem.context].resourceStatus;
|
|
241
|
+
const isMultiRecord = routingInfo.items[latestItem.context].isMultiRecordData;
|
|
242
|
+
setMultiRecordData(isMultiRecord);
|
|
243
|
+
const headingValue =
|
|
244
|
+
isDataObject || isMultiRecord
|
|
245
|
+
? getModalHeading(dataObjectAction)
|
|
246
|
+
: determineModalHeaderByAction(
|
|
247
|
+
actionName,
|
|
248
|
+
caseTypeName,
|
|
249
|
+
ID,
|
|
250
|
+
`${theNewCaseInfo?.getClassName()}!CASE!${theNewCaseInfo.getName()}`.toUpperCase()
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
setTitle(headingValue);
|
|
254
|
+
|
|
255
|
+
let arChildrenAsReact: any[] = [];
|
|
224
256
|
|
|
225
257
|
if (newComp.getComponentName() === 'reference') {
|
|
226
258
|
// Reference component doesn't have children. It can build the View we want.
|
|
@@ -236,10 +268,13 @@ const ModalViewContainer = props => {
|
|
|
236
268
|
// This is the 8.6 implementation. Leaving it in for reference for now.
|
|
237
269
|
// And create a similar array of the children as React components
|
|
238
270
|
// passed to Assignment component when rendered
|
|
239
|
-
arChildrenAsReact = newComp.getChildren().map(child => {
|
|
271
|
+
arChildrenAsReact = (newComp.getChildren() as []).map((child: any) => {
|
|
240
272
|
// Use Case Summary ID as the React element's key
|
|
241
273
|
const caseSummaryID = child.getPConnect().getCaseSummary().ID;
|
|
242
|
-
return createElement(createPConnectComponent(), {
|
|
274
|
+
return createElement(createPConnectComponent(), {
|
|
275
|
+
...child,
|
|
276
|
+
key: caseSummaryID
|
|
277
|
+
});
|
|
243
278
|
});
|
|
244
279
|
}
|
|
245
280
|
|
|
@@ -255,12 +290,12 @@ const ModalViewContainer = props => {
|
|
|
255
290
|
if (bShowModal) {
|
|
256
291
|
setShowModal(false);
|
|
257
292
|
}
|
|
258
|
-
if (!
|
|
293
|
+
if (!isEmptyObject(oCaseInfo)) {
|
|
259
294
|
setOCaseInfo({});
|
|
260
295
|
}
|
|
261
296
|
}
|
|
262
297
|
}
|
|
263
|
-
});
|
|
298
|
+
}, [routingInfo]);
|
|
264
299
|
|
|
265
300
|
// function placeholderModalClose() {
|
|
266
301
|
// // Intentionally a no-op. Similar behavior in other SDKs.
|
|
@@ -278,6 +313,11 @@ const ModalViewContainer = props => {
|
|
|
278
313
|
// console.log(`--> arNewChildrenAsReact: ${JSON.stringify(arNewChildrenAsReact)}`);
|
|
279
314
|
// }
|
|
280
315
|
|
|
316
|
+
function closeActionsDialog() {
|
|
317
|
+
actionsDialog.current = true;
|
|
318
|
+
setShowModal(false);
|
|
319
|
+
}
|
|
320
|
+
|
|
281
321
|
return (
|
|
282
322
|
<>
|
|
283
323
|
<Dialog open={bShowModal} aria-labelledby='form-dialog-title'>
|
|
@@ -286,35 +326,30 @@ const ModalViewContainer = props => {
|
|
|
286
326
|
</DialogTitle>
|
|
287
327
|
<DialogContent className={classes.dlgContent}>
|
|
288
328
|
{bShowModal ? (
|
|
289
|
-
<
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
329
|
+
<MuiPickersUtilsProvider utils={DayjsUtils}>
|
|
330
|
+
<Assignment
|
|
331
|
+
getPConnect={createdView.configObject.getPConnect}
|
|
332
|
+
itemKey={itemKey}
|
|
333
|
+
isInModal
|
|
334
|
+
banners={getBanners({
|
|
335
|
+
target: itemKey,
|
|
336
|
+
pageMessages
|
|
337
|
+
})}
|
|
338
|
+
>
|
|
339
|
+
{arNewChildrenAsReact}
|
|
340
|
+
</Assignment>
|
|
341
|
+
</MuiPickersUtilsProvider>
|
|
342
|
+
) : null}
|
|
295
343
|
</DialogContent>
|
|
344
|
+
{isMultiRecordData && (
|
|
345
|
+
<ListViewActionButtons
|
|
346
|
+
getPConnect={createdView.configObject.getPConnect}
|
|
347
|
+
context={createdView.latestItem.context}
|
|
348
|
+
closeActionsDialog={closeActionsDialog}
|
|
349
|
+
/>
|
|
350
|
+
)}
|
|
296
351
|
</Dialog>
|
|
297
|
-
{bShowCancelAlert &&
|
|
298
|
-
<CancelAlert
|
|
299
|
-
pConn={cancelPConn}
|
|
300
|
-
showAlert={bShowCancelAlert}
|
|
301
|
-
updateAlertState={updateAlertState}
|
|
302
|
-
/>
|
|
303
|
-
)}
|
|
352
|
+
{bShowCancelAlert && <CancelAlert pConn={cancelPConn} showAlert={bShowCancelAlert} updateAlertState={updateAlertState} />}
|
|
304
353
|
</>
|
|
305
354
|
);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
export default ModalViewContainer;
|
|
309
|
-
|
|
310
|
-
ModalViewContainer.defaultProps = {
|
|
311
|
-
getPConnect: null,
|
|
312
|
-
loadingInfo: false,
|
|
313
|
-
routingInfo: null
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
ModalViewContainer.propTypes = {
|
|
317
|
-
getPConnect: PropTypes.func,
|
|
318
|
-
loadingInfo: PropTypes.bool,
|
|
319
|
-
routingInfo: PropTypes.objectOf(PropTypes.any)
|
|
320
|
-
};
|
|
355
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './ModalViewContainer';
|
|
1
|
+
export { default } from './ModalViewContainer';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { getActiveContainerItemID, getActiveContainerRootViewElement, getPConnectOfActiveContainerItem, useContainerInitializer } from './helper';
|
|
4
|
+
|
|
5
|
+
const SimpleViewContainer = props => {
|
|
6
|
+
const { CONTAINER_TYPE } = PCore.getConstants();
|
|
7
|
+
|
|
8
|
+
const { getPConnect, mode = CONTAINER_TYPE.SINGLE, routingInfo: containerInfo, isAssignmentView, options = {} } = props;
|
|
9
|
+
|
|
10
|
+
const rootViewElement = useMemo(() => {
|
|
11
|
+
return getActiveContainerRootViewElement(containerInfo, {
|
|
12
|
+
isAssignmentView,
|
|
13
|
+
parentGetPConnect: getPConnect
|
|
14
|
+
});
|
|
15
|
+
}, [containerInfo, isAssignmentView, getPConnect]);
|
|
16
|
+
|
|
17
|
+
useContainerInitializer(getPConnect, options.mode || mode);
|
|
18
|
+
|
|
19
|
+
return rootViewElement;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const withSimpleViewContainerRenderer =
|
|
23
|
+
(Component, options: any = {}) =>
|
|
24
|
+
props => {
|
|
25
|
+
const { CONTAINER_TYPE } = PCore.getConstants();
|
|
26
|
+
|
|
27
|
+
const { getPConnect, mode = CONTAINER_TYPE.SINGLE, routingInfo: containerInfo, isAssignmentView } = props;
|
|
28
|
+
|
|
29
|
+
const rootViewElement = <SimpleViewContainer {...props} options={options} />;
|
|
30
|
+
const activeContainerItemID = getActiveContainerItemID(containerInfo);
|
|
31
|
+
const getPConnectOfActiveItem = getPConnectOfActiveContainerItem(containerInfo, {
|
|
32
|
+
isAssignmentView,
|
|
33
|
+
parentGetPConnect: getPConnect
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
useContainerInitializer(getPConnect, options.mode || mode);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Component
|
|
40
|
+
{...props}
|
|
41
|
+
rootViewElement={rootViewElement}
|
|
42
|
+
activeContainerItemID={activeContainerItemID}
|
|
43
|
+
getPConnectOfActiveContainerItem={getPConnectOfActiveItem}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default SimpleViewContainer;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useEffect, createElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
4
|
+
import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/helpers';
|
|
5
|
+
|
|
6
|
+
const processRootViewDetails = (rootView, containerItem, options) => {
|
|
7
|
+
const {
|
|
8
|
+
config: { context: viewContext, name: viewName }
|
|
9
|
+
} = rootView;
|
|
10
|
+
const { context: containerContext } = containerItem;
|
|
11
|
+
const { parentGetPConnect } = options;
|
|
12
|
+
let resolvedViewName = viewName;
|
|
13
|
+
let resolvedViewContext = viewContext;
|
|
14
|
+
|
|
15
|
+
const isAnnotedViewName = PCore.getAnnotationUtils().isProperty(viewName);
|
|
16
|
+
const isAnnotedViewContext = PCore.getAnnotationUtils().isProperty(viewContext);
|
|
17
|
+
|
|
18
|
+
// resolving annoted view context
|
|
19
|
+
if (isAnnotedViewContext) {
|
|
20
|
+
const viewContextProperty = PCore.getAnnotationUtils().getPropertyName(viewContext);
|
|
21
|
+
resolvedViewContext = PCore.getStoreValue(
|
|
22
|
+
`.${viewContextProperty}`,
|
|
23
|
+
viewContextProperty.startsWith('.') ? parentGetPConnect().getPageReference() : '',
|
|
24
|
+
containerContext
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!resolvedViewContext) {
|
|
29
|
+
resolvedViewContext = parentGetPConnect().getPageReference();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// resolving annoted view name
|
|
33
|
+
if (isAnnotedViewName) {
|
|
34
|
+
const viewNameProperty = PCore.getAnnotationUtils().getPropertyName(viewName);
|
|
35
|
+
resolvedViewName = PCore.getStoreValue(`.${viewNameProperty}`, resolvedViewContext, containerContext);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Special case where context and viewname are dynamic values
|
|
39
|
+
Use case - split for each shape
|
|
40
|
+
|
|
41
|
+
Ex - (caseInfo.content.SCRequestWorkQueues[1]):context --> .pyViewName:viewName
|
|
42
|
+
*/
|
|
43
|
+
if (isAnnotedViewName && isAnnotedViewContext && resolvedViewName !== '') {
|
|
44
|
+
/* Allow context processor to resolve view and context when both are dynamic */
|
|
45
|
+
resolvedViewName = viewName;
|
|
46
|
+
resolvedViewContext = viewContext;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
viewName: resolvedViewName,
|
|
51
|
+
viewContext: resolvedViewContext
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const getPConnectOfActiveContainerItem = (containerInfo, options) => {
|
|
56
|
+
const { accessedOrder, items } = containerInfo;
|
|
57
|
+
const { isAssignmentView = false, parentGetPConnect } = options;
|
|
58
|
+
const containerName = parentGetPConnect().getContainerName();
|
|
59
|
+
const { CONTAINER_NAMES } = PCore.getContainerUtils();
|
|
60
|
+
const { CREATE_DETAILS_VIEW_NAME } = PCore.getConstants();
|
|
61
|
+
|
|
62
|
+
if (accessedOrder && items) {
|
|
63
|
+
const activeContainerItemKey = accessedOrder[accessedOrder.length - 1];
|
|
64
|
+
|
|
65
|
+
if (items[activeContainerItemKey] && items[activeContainerItemKey].view && Object.keys(items[activeContainerItemKey].view).length > 0) {
|
|
66
|
+
const activeContainerItem = items[activeContainerItemKey];
|
|
67
|
+
const target = activeContainerItemKey.substring(0, activeContainerItemKey.lastIndexOf('_'));
|
|
68
|
+
|
|
69
|
+
const { view: rootView, context } = activeContainerItem;
|
|
70
|
+
const { viewName, viewContext } = processRootViewDetails(rootView, activeContainerItem, { parentGetPConnect });
|
|
71
|
+
|
|
72
|
+
if (!viewName) return null;
|
|
73
|
+
|
|
74
|
+
const config = {
|
|
75
|
+
meta: rootView,
|
|
76
|
+
options: {
|
|
77
|
+
context,
|
|
78
|
+
pageReference: viewContext || parentGetPConnect().getPageReference(),
|
|
79
|
+
containerName,
|
|
80
|
+
containerItemID: activeContainerItemKey,
|
|
81
|
+
parentPageReference: parentGetPConnect().getPageReference(),
|
|
82
|
+
hasForm:
|
|
83
|
+
isAssignmentView ||
|
|
84
|
+
containerName === CONTAINER_NAMES.WORKAREA ||
|
|
85
|
+
containerName === CONTAINER_NAMES.MODAL ||
|
|
86
|
+
viewName === CREATE_DETAILS_VIEW_NAME,
|
|
87
|
+
target
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return PCore.createPConnect(config).getPConnect;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const getActiveContainerRootViewElement = (containerInfo, options) => {
|
|
98
|
+
const getPConnect = getPConnectOfActiveContainerItem(containerInfo, options);
|
|
99
|
+
if (getPConnect) {
|
|
100
|
+
return createElement(createPConnectComponent(), { getPConnect });
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const getActiveContainerItemID = containerInfo => {
|
|
106
|
+
const { accessedOrder } = containerInfo;
|
|
107
|
+
if (accessedOrder && accessedOrder.length > 0) {
|
|
108
|
+
return accessedOrder[accessedOrder.length - 1];
|
|
109
|
+
}
|
|
110
|
+
return '';
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const useContainerInitializer = (getPConnect, mode) => {
|
|
114
|
+
const pConnect = getPConnect();
|
|
115
|
+
const containerName = pConnect.getContainerName();
|
|
116
|
+
const containerManager = pConnect.getContainerManager();
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (!isContainerInitialized(pConnect)) {
|
|
119
|
+
containerManager.initializeContainers({
|
|
120
|
+
type: mode,
|
|
121
|
+
name: containerName
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SimpleView';
|