@pega/react-sdk-overrides 0.23.26 → 0.23.27
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
|
@@ -5,15 +5,11 @@
|
|
|
5
5
|
* PCore/PConnect is being run
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const sdkVersion = "8.7";
|
|
8
|
+
export const sdkVersion = '8.7';
|
|
11
9
|
|
|
12
10
|
export function compareSdkPCoreVersions() {
|
|
13
|
-
|
|
14
11
|
// const theConstellationVersion = PCore.getPCoreVersion();
|
|
15
12
|
|
|
16
13
|
// eslint-disable-next-line no-console
|
|
17
14
|
console.warn(`Using Constellation version ${PCore.getPCoreVersion()}. Ensure this is the same version as your Infinity server.`);
|
|
18
|
-
|
|
19
15
|
}
|
|
@@ -1,70 +1,74 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
1
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
-
|
|
5
2
|
import Button from '@material-ui/core/Button';
|
|
6
|
-
import { Grid, Divider } from
|
|
7
|
-
|
|
3
|
+
import { Grid, Divider } from '@material-ui/core';
|
|
8
4
|
|
|
5
|
+
// ActionButtons does NOT have getPConnect. So, no need to extend from PConnProps
|
|
6
|
+
interface ActionButtonsProps {
|
|
7
|
+
// If any, enter additional props that only exist on this component
|
|
8
|
+
arMainButtons?: any[];
|
|
9
|
+
arSecondaryButtons?: any[];
|
|
10
|
+
onButtonPress: any;
|
|
11
|
+
}
|
|
9
12
|
|
|
10
13
|
const useStyles = makeStyles((/* theme */) => ({
|
|
11
14
|
button: {
|
|
12
|
-
padding:
|
|
15
|
+
padding: '0px 5px'
|
|
13
16
|
},
|
|
14
17
|
divider: {
|
|
15
|
-
marginTop:
|
|
16
|
-
marginBottom:
|
|
18
|
+
marginTop: '10px',
|
|
19
|
+
marginBottom: '10px'
|
|
17
20
|
}
|
|
18
21
|
}));
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const { arMainButtons, arSecondaryButtons, onButtonPress } = props;
|
|
23
|
+
export default function ActionButtons(props: ActionButtonsProps) {
|
|
24
|
+
const { arMainButtons = [], arSecondaryButtons = [], onButtonPress } = props;
|
|
23
25
|
const classes = useStyles();
|
|
26
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
27
|
+
const localeCategory = 'Assignment';
|
|
24
28
|
|
|
25
29
|
function _onButtonPress(sAction: string, sButtonType: string) {
|
|
26
|
-
|
|
27
30
|
onButtonPress(sAction, sButtonType);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
return (
|
|
31
|
-
|
|
32
|
-
<Divider className={classes.divider}/>
|
|
33
|
-
<Grid container spacing={4} justifyContent=
|
|
34
|
+
<>
|
|
35
|
+
<Divider className={classes.divider} />
|
|
36
|
+
<Grid container spacing={4} justifyContent='space-between'>
|
|
34
37
|
<Grid item>
|
|
35
38
|
<Grid container spacing={1}>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
{arSecondaryButtons.map(sButton => (
|
|
40
|
+
<Grid item key={sButton.name}>
|
|
41
|
+
<Button
|
|
42
|
+
variant='contained'
|
|
43
|
+
color='secondary'
|
|
44
|
+
onClick={() => {
|
|
45
|
+
_onButtonPress(sButton.jsAction, 'secondary');
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{localizedVal(sButton.name, localeCategory)}
|
|
49
|
+
</Button>
|
|
50
|
+
</Grid>
|
|
51
|
+
))}
|
|
41
52
|
</Grid>
|
|
42
53
|
</Grid>
|
|
43
54
|
<Grid item>
|
|
44
55
|
<Grid container spacing={1}>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
{arMainButtons.map(mButton => (
|
|
57
|
+
<Grid item key={mButton.name}>
|
|
58
|
+
<Button
|
|
59
|
+
variant='contained'
|
|
60
|
+
color='primary'
|
|
61
|
+
onClick={() => {
|
|
62
|
+
_onButtonPress(mButton.jsAction, 'primary');
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{localizedVal(mButton.name, localeCategory)}
|
|
66
|
+
</Button>
|
|
67
|
+
</Grid>
|
|
68
|
+
))}
|
|
50
69
|
</Grid>
|
|
51
70
|
</Grid>
|
|
52
71
|
</Grid>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
)
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
57
74
|
}
|
|
58
|
-
|
|
59
|
-
ActionButtons.propTypes = {
|
|
60
|
-
arMainButtons: PropTypes.array,
|
|
61
|
-
arSecondaryButtons: PropTypes.array,
|
|
62
|
-
onButtonPress: PropTypes.func
|
|
63
|
-
// buildName: PropTypes.string
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
ActionButtons.defaultProps = {
|
|
67
|
-
arMainButtons: [],
|
|
68
|
-
arSecondaryButtons: []
|
|
69
|
-
// buildName: null
|
|
70
|
-
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './ActionButtons';
|
|
1
|
+
export { default } from './ActionButtons';
|
|
@@ -1,25 +1,39 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import AssignmentCard from '@pega/react-sdk-components/lib/components/infra/AssignmentCard';
|
|
5
|
-
import MultiStep from '@pega/react-sdk-components/lib/components/infra/MultiStep';
|
|
1
|
+
import React, { PropsWithChildren, useEffect, useState } from 'react';
|
|
6
2
|
import Snackbar from '@material-ui/core/Snackbar';
|
|
7
3
|
import IconButton from '@material-ui/core/IconButton';
|
|
8
4
|
import CloseIcon from '@material-ui/icons/Close';
|
|
9
5
|
|
|
10
|
-
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
+
|
|
8
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
|
+
|
|
10
|
+
interface AssignmentProps extends PConnProps {
|
|
11
|
+
// If any, enter additional props that only exist on this component
|
|
12
|
+
itemKey: string;
|
|
13
|
+
isInModal: boolean;
|
|
14
|
+
banners: any[];
|
|
15
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
16
|
+
actionButtons: any[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
20
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
21
|
+
const AssignmentCard = getComponentFromMap('AssignmentCard');
|
|
22
|
+
const MultiStep = getComponentFromMap('MultiStep');
|
|
11
23
|
|
|
12
|
-
|
|
13
|
-
const { getPConnect, children, itemKey, isInModal } = props;
|
|
24
|
+
const { getPConnect, children, itemKey = '', isInModal = false, banners = [] } = props;
|
|
14
25
|
const thePConn = getPConnect();
|
|
15
26
|
|
|
16
27
|
const [bHasNavigation, setHasNavigation] = useState(false);
|
|
17
|
-
const [actionButtons, setActionButtons] = useState(
|
|
28
|
+
const [actionButtons, setActionButtons] = useState([]);
|
|
18
29
|
const [bIsVertical, setIsVertical] = useState(false);
|
|
19
|
-
const [arCurrentStepIndicies, setArCurrentStepIndicies] = useState<
|
|
20
|
-
const [arNavigationSteps, setArNavigationSteps] = useState<
|
|
30
|
+
const [arCurrentStepIndicies, setArCurrentStepIndicies] = useState<any[]>([]);
|
|
31
|
+
const [arNavigationSteps, setArNavigationSteps] = useState<any[]>([]);
|
|
21
32
|
|
|
22
33
|
const actionsAPI = thePConn.getActionsApi();
|
|
34
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
35
|
+
const localeCategory = 'Assignment';
|
|
36
|
+
const localeReference = `${getPConnect().getCaseInfo().getClassName()}!CASE!${getPConnect().getCaseInfo().getName()}`.toUpperCase();
|
|
23
37
|
|
|
24
38
|
// store off bound functions to above pointers
|
|
25
39
|
const finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI);
|
|
@@ -32,18 +46,14 @@ export default function Assignment(props) {
|
|
|
32
46
|
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
33
47
|
const [snackbarMessage, setSnackbarMessage] = useState('');
|
|
34
48
|
|
|
35
|
-
function findCurrentIndicies(
|
|
36
|
-
arStepperSteps: Array<any>,
|
|
37
|
-
arIndicies: Array<number>,
|
|
38
|
-
depth: number
|
|
39
|
-
): Array<number> {
|
|
49
|
+
function findCurrentIndicies(arStepperSteps: any[], arIndicies: number[], depth: number): number[] {
|
|
40
50
|
let count = 0;
|
|
41
51
|
arStepperSteps.forEach(step => {
|
|
42
52
|
if (step.visited_status === 'current') {
|
|
43
53
|
arIndicies[depth] = count;
|
|
44
54
|
|
|
45
55
|
// add in
|
|
46
|
-
step
|
|
56
|
+
step.step_status = '';
|
|
47
57
|
} else if (step.visited_status === 'success') {
|
|
48
58
|
count += 1;
|
|
49
59
|
step.step_status = 'completed';
|
|
@@ -61,12 +71,11 @@ export default function Assignment(props) {
|
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
useEffect(() => {
|
|
64
|
-
if (children
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const oWorkItem = children[0].props.getPConnect();
|
|
74
|
+
if (children) {
|
|
75
|
+
const firstChild = Array.isArray(children) ? children[0] : children;
|
|
76
|
+
const oWorkItem = firstChild.props.getPConnect();
|
|
68
77
|
const oWorkData = oWorkItem.getDataObject();
|
|
69
|
-
const oData = thePConn.getDataObject();
|
|
78
|
+
const oData: any = thePConn.getDataObject(''); // 1st arg empty string until typedefs allow it to be optional
|
|
70
79
|
|
|
71
80
|
if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
|
|
72
81
|
const oCaseInfo = oData.caseInfo;
|
|
@@ -79,23 +88,23 @@ export default function Assignment(props) {
|
|
|
79
88
|
setHasNavigation(true);
|
|
80
89
|
|
|
81
90
|
if (
|
|
82
|
-
oCaseInfo.navigation.template &&
|
|
83
|
-
oCaseInfo
|
|
91
|
+
(oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'standard') ||
|
|
92
|
+
oCaseInfo?.navigation?.steps?.length === 1
|
|
84
93
|
) {
|
|
85
94
|
setHasNavigation(false);
|
|
86
|
-
} else if (
|
|
87
|
-
oCaseInfo.navigation.template &&
|
|
88
|
-
oCaseInfo.navigation.template.toLowerCase() === 'vertical'
|
|
89
|
-
) {
|
|
95
|
+
} else if (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'vertical') {
|
|
90
96
|
setIsVertical(true);
|
|
91
97
|
} else {
|
|
92
98
|
setIsVertical(false);
|
|
93
99
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
|
|
101
|
+
steps.forEach(step => {
|
|
102
|
+
if (step.name) {
|
|
103
|
+
step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
setArNavigationSteps(steps);
|
|
107
|
+
setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
|
|
99
108
|
}
|
|
100
109
|
}
|
|
101
110
|
}
|
|
@@ -118,10 +127,7 @@ export default function Assignment(props) {
|
|
|
118
127
|
|
|
119
128
|
function onSaveActionSuccess(data) {
|
|
120
129
|
actionsAPI.cancelAssignment(itemKey).then(() => {
|
|
121
|
-
PCore.getPubSubUtils().publish(
|
|
122
|
-
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED,
|
|
123
|
-
data
|
|
124
|
-
);
|
|
130
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
|
|
125
131
|
});
|
|
126
132
|
}
|
|
127
133
|
|
|
@@ -134,7 +140,7 @@ export default function Assignment(props) {
|
|
|
134
140
|
navigatePromise
|
|
135
141
|
.then(() => {})
|
|
136
142
|
.catch(() => {
|
|
137
|
-
showToast(
|
|
143
|
+
showToast(`${localizedVal('Navigation failed!', localeCategory)}`);
|
|
138
144
|
});
|
|
139
145
|
|
|
140
146
|
break;
|
|
@@ -147,13 +153,11 @@ export default function Assignment(props) {
|
|
|
147
153
|
|
|
148
154
|
savePromise
|
|
149
155
|
.then(() => {
|
|
150
|
-
const caseType = thePConn
|
|
151
|
-
.getCaseInfo()
|
|
152
|
-
.c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
|
|
156
|
+
const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
|
|
153
157
|
onSaveActionSuccess({ caseType, caseID, assignmentID });
|
|
154
158
|
})
|
|
155
159
|
.catch(() => {
|
|
156
|
-
showToast('Save failed');
|
|
160
|
+
showToast(`${localizedVal('Save failed', localeCategory)}`);
|
|
157
161
|
});
|
|
158
162
|
|
|
159
163
|
break;
|
|
@@ -163,11 +167,12 @@ export default function Assignment(props) {
|
|
|
163
167
|
// check if create stage (modal)
|
|
164
168
|
const { PUB_SUB_EVENTS } = PCore.getConstants();
|
|
165
169
|
const { publish } = PCore.getPubSubUtils();
|
|
170
|
+
// @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
|
|
166
171
|
const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
|
|
167
172
|
const isLocalAction =
|
|
173
|
+
// @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
|
|
168
174
|
thePConn.getCaseInfo().isLocalAction() ||
|
|
169
|
-
(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION &&
|
|
170
|
-
getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
|
|
175
|
+
(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
|
|
171
176
|
if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
|
|
172
177
|
const cancelPromise = cancelCreateStageAssignment(itemKey);
|
|
173
178
|
|
|
@@ -176,7 +181,7 @@ export default function Assignment(props) {
|
|
|
176
181
|
publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
|
|
177
182
|
})
|
|
178
183
|
.catch(() => {
|
|
179
|
-
showToast(
|
|
184
|
+
showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
|
|
180
185
|
});
|
|
181
186
|
} else {
|
|
182
187
|
const cancelPromise = cancelAssignment(itemKey);
|
|
@@ -186,7 +191,7 @@ export default function Assignment(props) {
|
|
|
186
191
|
publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
|
|
187
192
|
})
|
|
188
193
|
.catch(() => {
|
|
189
|
-
showToast(
|
|
194
|
+
showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
|
|
190
195
|
});
|
|
191
196
|
}
|
|
192
197
|
break;
|
|
@@ -204,7 +209,7 @@ export default function Assignment(props) {
|
|
|
204
209
|
finishPromise
|
|
205
210
|
.then(() => {})
|
|
206
211
|
.catch(() => {
|
|
207
|
-
showToast(
|
|
212
|
+
showToast(`${localizedVal('Submit failed!', localeCategory)}`);
|
|
208
213
|
});
|
|
209
214
|
|
|
210
215
|
break;
|
|
@@ -216,10 +221,50 @@ export default function Assignment(props) {
|
|
|
216
221
|
}
|
|
217
222
|
}
|
|
218
223
|
|
|
224
|
+
function getRefreshProps(refreshConditions) {
|
|
225
|
+
// refreshConditions cuurently supports only "Changes" event
|
|
226
|
+
if (!refreshConditions) {
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
return refreshConditions.filter(item => item.event && item.event === 'Changes').map(item => [item.field, item.field?.substring(1)]) || [];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
|
|
233
|
+
// @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
|
|
234
|
+
const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
|
|
235
|
+
const context = thePConn.getContextName();
|
|
236
|
+
const pageReference = thePConn.getPageReference();
|
|
237
|
+
|
|
238
|
+
// refresh api de-registration
|
|
239
|
+
PCore.getRefreshManager().deRegisterForRefresh(context);
|
|
240
|
+
|
|
241
|
+
// refresh api registration
|
|
242
|
+
const refreshProps = getRefreshProps(refreshConditions);
|
|
243
|
+
const caseKey = thePConn.getCaseInfo().getKey();
|
|
244
|
+
const refreshOptions = {
|
|
245
|
+
autoDetectRefresh: true,
|
|
246
|
+
preserveClientChanges: false
|
|
247
|
+
};
|
|
248
|
+
if (refreshProps.length > 0) {
|
|
249
|
+
refreshProps.forEach(prop => {
|
|
250
|
+
PCore.getRefreshManager().registerForRefresh(
|
|
251
|
+
'PROP_CHANGE',
|
|
252
|
+
thePConn.getActionsApi().refreshCaseView.bind(thePConn.getActionsApi(), caseKey, null, pageReference, {
|
|
253
|
+
...refreshOptions,
|
|
254
|
+
refreshFor: prop[0]
|
|
255
|
+
}),
|
|
256
|
+
`${pageReference}.${prop[1]}`,
|
|
257
|
+
`${context}/${pageReference}`,
|
|
258
|
+
context
|
|
259
|
+
);
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
219
263
|
return (
|
|
220
264
|
<div id='Assignment'>
|
|
265
|
+
{banners}
|
|
221
266
|
{bHasNavigation ? (
|
|
222
|
-
|
|
267
|
+
<>
|
|
223
268
|
<MultiStep
|
|
224
269
|
getPConnect={getPConnect}
|
|
225
270
|
itemKey={itemKey}
|
|
@@ -237,25 +282,15 @@ export default function Assignment(props) {
|
|
|
237
282
|
onClose={handleSnackbarClose}
|
|
238
283
|
message={snackbarMessage}
|
|
239
284
|
action={
|
|
240
|
-
<IconButton
|
|
241
|
-
size='small'
|
|
242
|
-
aria-label='close'
|
|
243
|
-
color='inherit'
|
|
244
|
-
onClick={handleSnackbarClose}
|
|
245
|
-
>
|
|
285
|
+
<IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
|
|
246
286
|
<CloseIcon fontSize='small' />
|
|
247
287
|
</IconButton>
|
|
248
288
|
}
|
|
249
289
|
/>
|
|
250
|
-
|
|
290
|
+
</>
|
|
251
291
|
) : (
|
|
252
|
-
|
|
253
|
-
<AssignmentCard
|
|
254
|
-
getPConnect={getPConnect}
|
|
255
|
-
itemKey={itemKey}
|
|
256
|
-
actionButtons={actionButtons}
|
|
257
|
-
onButtonPress={buttonPress}
|
|
258
|
-
>
|
|
292
|
+
<>
|
|
293
|
+
<AssignmentCard getPConnect={getPConnect} itemKey={itemKey} actionButtons={actionButtons} onButtonPress={buttonPress}>
|
|
259
294
|
{children}
|
|
260
295
|
</AssignmentCard>
|
|
261
296
|
<Snackbar
|
|
@@ -264,17 +299,12 @@ export default function Assignment(props) {
|
|
|
264
299
|
onClose={handleSnackbarClose}
|
|
265
300
|
message={snackbarMessage}
|
|
266
301
|
action={
|
|
267
|
-
<IconButton
|
|
268
|
-
size='small'
|
|
269
|
-
aria-label='close'
|
|
270
|
-
color='inherit'
|
|
271
|
-
onClick={handleSnackbarClose}
|
|
272
|
-
>
|
|
302
|
+
<IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
|
|
273
303
|
<CloseIcon fontSize='small' />
|
|
274
304
|
</IconButton>
|
|
275
305
|
}
|
|
276
306
|
/>
|
|
277
|
-
|
|
307
|
+
</>
|
|
278
308
|
)}
|
|
279
309
|
</div>
|
|
280
310
|
);
|
|
@@ -303,18 +333,3 @@ export default function Assignment(props) {
|
|
|
303
333
|
// <lit-toast></lit-toast>
|
|
304
334
|
// </div>`}
|
|
305
335
|
// `;
|
|
306
|
-
|
|
307
|
-
Assignment.propTypes = {
|
|
308
|
-
children: PropTypes.node.isRequired,
|
|
309
|
-
getPConnect: PropTypes.func.isRequired,
|
|
310
|
-
itemKey: PropTypes.string,
|
|
311
|
-
isInModal: PropTypes.bool
|
|
312
|
-
// actionButtons: PropTypes.object
|
|
313
|
-
// buildName: PropTypes.string
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
Assignment.defaultProps = {
|
|
317
|
-
itemKey: null,
|
|
318
|
-
isInModal: false
|
|
319
|
-
// buildName: null
|
|
320
|
-
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './Assignment';
|
|
1
|
+
export { default } from './Assignment';
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import PropTypes from "prop-types";
|
|
1
|
+
import { PropsWithChildren, useEffect, useState } from 'react';
|
|
3
2
|
|
|
4
|
-
import
|
|
3
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
4
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
interface AssignmentCardProps extends PConnProps {
|
|
7
|
+
// If any, enter additional props that only exist on this component
|
|
8
|
+
actionButtons: any;
|
|
9
|
+
onButtonPress: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function AssignmentCard(props: PropsWithChildren<AssignmentCardProps>) {
|
|
13
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
14
|
+
const ActionButtons = getComponentFromMap('ActionButtons');
|
|
15
|
+
|
|
16
|
+
const { children, actionButtons, onButtonPress } = props;
|
|
8
17
|
|
|
9
18
|
const [arMainButtons, setArMainButtons] = useState([]);
|
|
10
19
|
const [arSecondaryButtons, setArSecondaryButtons] = useState([]);
|
|
11
20
|
|
|
12
|
-
useEffect(
|
|
21
|
+
useEffect(() => {
|
|
13
22
|
if (actionButtons) {
|
|
14
23
|
setArMainButtons(actionButtons.main);
|
|
15
24
|
setArSecondaryButtons(actionButtons.secondary);
|
|
@@ -23,25 +32,9 @@ export default function AssignmentCard(props) {
|
|
|
23
32
|
return (
|
|
24
33
|
<>
|
|
25
34
|
{children}
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
}
|
|
35
|
+
{arMainButtons && arSecondaryButtons && (
|
|
36
|
+
<ActionButtons arMainButtons={arMainButtons} arSecondaryButtons={arSecondaryButtons} onButtonPress={buttonPress} />
|
|
37
|
+
)}
|
|
29
38
|
</>
|
|
30
|
-
)
|
|
39
|
+
);
|
|
31
40
|
}
|
|
32
|
-
|
|
33
|
-
AssignmentCard.propTypes = {
|
|
34
|
-
children: PropTypes.node.isRequired,
|
|
35
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
36
|
-
getPConnect: PropTypes.func.isRequired,
|
|
37
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
38
|
-
itemKey: PropTypes.string,
|
|
39
|
-
actionButtons: PropTypes.object,
|
|
40
|
-
onButtonPress: PropTypes.func
|
|
41
|
-
// buildName: PropTypes.string
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
AssignmentCard.defaultProps = {
|
|
45
|
-
itemKey: null,
|
|
46
|
-
// buildName: null
|
|
47
|
-
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './AssignmentCard';
|
|
1
|
+
export { default } from './AssignmentCard';
|