@pega/react-sdk-overrides 8.23.10 → 8.23.11-debug
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/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +43 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +1 -3
- package/lib/designSystemExtension/Operator/Operator.tsx +16 -11
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +2 -2
- package/lib/field/CancelAlert/CancelAlert.tsx +12 -8
- package/lib/field/Checkbox/Checkbox.tsx +3 -2
- package/lib/field/Currency/currency-utils.ts +4 -1
- package/lib/field/Date/Date.tsx +12 -5
- package/lib/field/DateTime/DateTime.tsx +1 -1
- package/lib/field/Decimal/Decimal.tsx +66 -14
- package/lib/field/Dropdown/Dropdown.tsx +49 -10
- package/lib/field/Phone/Phone.tsx +2 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +43 -4
- package/lib/field/SemanticLink/utils.ts +2 -1
- package/lib/field/TextInput/TextInput.tsx +26 -6
- package/lib/field/Time/Time.tsx +9 -1
- package/lib/field/URL/URL.tsx +8 -0
- package/lib/field/UserReference/UserReference.tsx +2 -0
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +2 -2
- package/lib/helpers/auth.js +10 -3
- package/lib/helpers/authManager.js +16 -13
- package/lib/helpers/case-utils.tsx +104 -0
- package/lib/helpers/common-utils.ts +4 -0
- package/lib/helpers/config_access.js +122 -131
- package/lib/helpers/data_page.ts +2 -1
- package/lib/helpers/date-format-utils.ts +28 -18
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +4 -3
- package/lib/helpers/formatters/{Date.js → Date.ts} +1 -1
- package/lib/helpers/formatters/common.ts +18 -0
- package/lib/helpers/simpleTableHelpers.ts +6 -2
- package/lib/helpers/state-utils.tsx +50 -0
- package/lib/helpers/template-utils.ts +3 -1
- package/lib/helpers/utils.ts +12 -4
- package/lib/helpers/versionHelpers.ts +3 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +7 -2
- package/lib/infra/Assignment/Assignment.tsx +23 -10
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +24 -11
- package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +21 -16
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +28 -9
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +7 -5
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +5 -1
- package/lib/infra/DashboardFilter/filterUtils.tsx +2 -0
- package/lib/infra/DeferLoad/DeferLoad.tsx +4 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +10 -5
- package/lib/infra/MultiStep/MultiStep.tsx +2 -2
- package/lib/infra/NavBar/NavBar.tsx +11 -5
- package/lib/infra/RootContainer/RootContainer.tsx +16 -14
- package/lib/infra/Stages/Stages.tsx +5 -1
- package/lib/infra/View/View.tsx +7 -34
- package/lib/template/AppShell/AppShell.tsx +15 -9
- package/lib/template/CaseView/CaseView.tsx +116 -78
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +26 -17
- package/lib/template/Confirmation/Confirmation.tsx +4 -1
- package/lib/template/DataReference/DataReference.tsx +2 -0
- package/lib/template/DefaultForm/DefaultForm.tsx +15 -8
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +5 -2
- package/lib/template/ListView/ListView.tsx +3 -1
- package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
- package/lib/template/ListView/{utils.js → utils.ts} +12 -10
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +5 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +9 -5
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +4 -1
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +8 -4
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +6 -1
- package/lib/template/SubTabs/tabUtils.ts +3 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +2 -2
- package/lib/widget/Attachment/Attachment.css +15 -3
- package/lib/widget/Attachment/Attachment.tsx +32 -25
- package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +20 -19
- package/lib/widget/QuickCreate/QuickCreate.tsx +6 -3
- package/lib/widget/SummaryItem/SummaryItem.tsx +2 -4
- package/lib/widget/ToDo/ToDo.tsx +17 -9
- package/package.json +1 -1
- package/lib/helpers/formatters/common.js +0 -14
- /package/lib/helpers/{event-utils.js → event-utils.ts} +0 -0
- /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
- /package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +0 -0
- /package/lib/helpers/formatters/{index.js → index.ts} +0 -0
- /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
- /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
|
@@ -7,9 +7,11 @@ import { Box, CircularProgress } from "@material-ui/core";
|
|
|
7
7
|
import createPConnectComponent from "@pega/react-sdk-components/lib/bridge/react_pconnect";
|
|
8
8
|
import { LazyMap as LazyComponentMap } from "@pega/react-sdk-components/lib/components_map";
|
|
9
9
|
import StoreContext from "@pega/react-sdk-components/lib/bridge/Context/StoreContext";
|
|
10
|
-
import
|
|
10
|
+
import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
11
|
+
|
|
12
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
|
|
13
|
+
declare const PCore: any;
|
|
11
14
|
|
|
12
|
-
declare const PCore;
|
|
13
15
|
|
|
14
16
|
//
|
|
15
17
|
// WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
|
|
@@ -37,7 +39,7 @@ function getItemView(routingInfo, renderingMode) {
|
|
|
37
39
|
if (
|
|
38
40
|
items[key] &&
|
|
39
41
|
items[key].view &&
|
|
40
|
-
!
|
|
42
|
+
!isEmptyObject(items[key].view)
|
|
41
43
|
) {
|
|
42
44
|
viewConfigs.push(items[key]);
|
|
43
45
|
}
|
|
@@ -56,15 +58,12 @@ const RootContainer = (props) => {
|
|
|
56
58
|
routingInfo
|
|
57
59
|
} = props;
|
|
58
60
|
|
|
59
|
-
const { displayOnlyFA
|
|
61
|
+
const { displayOnlyFA } = useContext<any>(StoreContext);
|
|
60
62
|
|
|
61
63
|
|
|
62
64
|
const pConn = getPConnect();
|
|
63
65
|
|
|
64
66
|
const options = { "context": "app" };
|
|
65
|
-
if (isMashup) {
|
|
66
|
-
options["context"] = "root";
|
|
67
|
-
}
|
|
68
67
|
|
|
69
68
|
const [componentName, setComponentName] = useState("");
|
|
70
69
|
|
|
@@ -78,12 +77,15 @@ const RootContainer = (props) => {
|
|
|
78
77
|
|
|
79
78
|
let hasBanner = false;
|
|
80
79
|
let banners: any = null;
|
|
80
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
81
|
+
const localeCategory = 'Messages';
|
|
82
|
+
|
|
81
83
|
const messages = httpMessages
|
|
82
|
-
? httpMessages.map((msg) => msg.message)
|
|
84
|
+
? httpMessages.map((msg) => localizedVal(msg.message, localeCategory))
|
|
83
85
|
: httpMessages;
|
|
84
86
|
|
|
85
87
|
hasBanner = messages && messages.length > 0;
|
|
86
|
-
banners = hasBanner && (<div>RootContainer: trying to emit Banner with {messages}</div>);
|
|
88
|
+
banners = hasBanner && (<div>{localizedVal(`RootContainer: trying to emit Banner with ${messages}`, localeCategory)}</div>);
|
|
87
89
|
|
|
88
90
|
const MemoizedModalViewContainer = useMemo(() => {
|
|
89
91
|
return createElement(
|
|
@@ -123,7 +125,7 @@ const RootContainer = (props) => {
|
|
|
123
125
|
|
|
124
126
|
switch (componentName) {
|
|
125
127
|
case "View":
|
|
126
|
-
noPortalContent = <div>getNoPortalContent: RootContainer wants to render View in noPortal mode</div>
|
|
128
|
+
noPortalContent = <div>{localizedVal('getNoPortalContent: RootContainer wants to render View in noPortal mode', localeCategory)}</div>
|
|
127
129
|
break;
|
|
128
130
|
|
|
129
131
|
case "ViewContainer": {
|
|
@@ -148,7 +150,7 @@ const RootContainer = (props) => {
|
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
default:
|
|
151
|
-
noPortalContent = <div>getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode</div>
|
|
153
|
+
noPortalContent = <div>{localizedVal('getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode', localeCategory)}</div>
|
|
152
154
|
break;
|
|
153
155
|
|
|
154
156
|
}
|
|
@@ -220,7 +222,7 @@ const RootContainer = (props) => {
|
|
|
220
222
|
}
|
|
221
223
|
else if (renderingMode === "noPortal") {
|
|
222
224
|
// eslint-disable-next-line no-console
|
|
223
|
-
console.log(
|
|
225
|
+
console.log(`${localizedVal('RootContainer rendering in noPortal mode', localeCategory)}`);
|
|
224
226
|
|
|
225
227
|
const theChildren = pConn.getChildren();
|
|
226
228
|
if (theChildren && (theChildren.length === 1)) {
|
|
@@ -238,7 +240,7 @@ const RootContainer = (props) => {
|
|
|
238
240
|
else if (children && children.length > 0) {
|
|
239
241
|
return (
|
|
240
242
|
<React.Fragment>
|
|
241
|
-
<div>RootContainer: Has children. Trying to show ModalManager with children, etc
|
|
243
|
+
<div>{localizedVal('RootContainer: Has children. Trying to show ModalManager with children, etc.', localeCategory)}</div>
|
|
242
244
|
{children}
|
|
243
245
|
{MemoizedModalViewContainer}
|
|
244
246
|
</React.Fragment>
|
|
@@ -257,7 +259,7 @@ const RootContainer = (props) => {
|
|
|
257
259
|
} else {
|
|
258
260
|
return (
|
|
259
261
|
<div id="root-container">
|
|
260
|
-
<div>RootContainer: Should be ModalManager, etc
|
|
262
|
+
<div>{localizedVal('RootContainer: Should be ModalManager, etc.', localeCategory)}</div>
|
|
261
263
|
</div>
|
|
262
264
|
);
|
|
263
265
|
}
|
|
@@ -5,8 +5,10 @@ import DoubleArrowIcon from '@material-ui/icons/DoubleArrow';
|
|
|
5
5
|
import DoneIcon from '@material-ui/icons/Done';
|
|
6
6
|
import { makeStyles } from '@material-ui/core/styles';
|
|
7
7
|
|
|
8
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
|
|
8
9
|
declare const PCore: any;
|
|
9
10
|
|
|
11
|
+
|
|
10
12
|
const useStyles = makeStyles((theme) => ({
|
|
11
13
|
root: {
|
|
12
14
|
paddingRight: theme.spacing(1),
|
|
@@ -60,13 +62,15 @@ export default function Stages(props) {
|
|
|
60
62
|
|
|
61
63
|
const { getPConnect, stages } = props;
|
|
62
64
|
const pConn = getPConnect();
|
|
65
|
+
const key = `${pConn.getCaseInfo().getClassName()}!CASE!${pConn.getCaseInfo().getName()}`.toUpperCase();
|
|
66
|
+
|
|
63
67
|
|
|
64
68
|
const filteredStages = getFilteredStages(stages);
|
|
65
69
|
const currentStageID = pConn.getValue(PCore.getConstants().CASE_INFO.STAGEID);
|
|
66
70
|
const stagesObj = filteredStages.map((stage, index, arr) => {
|
|
67
71
|
const theID = stage.ID || stage.id;
|
|
68
72
|
return {
|
|
69
|
-
name: stage.name,
|
|
73
|
+
name: PCore.getLocaleUtils().getLocaleValue(stage.name, null, key),
|
|
70
74
|
id: theID,
|
|
71
75
|
complete: stage.visited_status === "completed",
|
|
72
76
|
current: (theID === currentStageID),
|
package/lib/infra/View/View.tsx
CHANGED
|
@@ -3,8 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
// import { FieldGroup } from "@pega/cosmos-react-core";
|
|
4
4
|
// import { LazyMap as LazyComponentMap } from "../../components_map";
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import ErrorBoundary from '@pega/react-sdk-components/lib/components/infra/ErrorBoundary';
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
8
7
|
|
|
9
8
|
import { getAllFields } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
|
|
10
9
|
|
|
@@ -57,38 +56,12 @@ export default function View(props) {
|
|
|
57
56
|
// JA - React SDK not using LazyComponentMap yet
|
|
58
57
|
if (template /* && LazyComponentMap[template] */) {
|
|
59
58
|
// const ViewTemplate = LazyComponentMap[template];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
//
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
// eslint-disable-next-line no-console
|
|
67
|
-
console.log(`View component found ${template}: Local`);
|
|
68
|
-
ViewTemplate = theLocalComponent;
|
|
69
|
-
} else {
|
|
70
|
-
const thePegaProvidedComponent = SdkComponentMap.getPegaProvidedComponentMap()[template];
|
|
71
|
-
if (thePegaProvidedComponent !== undefined) {
|
|
72
|
-
// console.log(`View component found ${template}: Pega-provided`);
|
|
73
|
-
ViewTemplate = thePegaProvidedComponent;
|
|
74
|
-
} else {
|
|
75
|
-
// eslint-disable-next-line no-console
|
|
76
|
-
console.error(`View component can't find template type ${template}`);
|
|
77
|
-
ViewTemplate = ErrorBoundary;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (template === 'ListView') {
|
|
82
|
-
// special case for ListView - add in a prop
|
|
83
|
-
const bInForm = true;
|
|
84
|
-
props = { ...props, bInForm };
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
// eslint-disable-next-line no-console
|
|
88
|
-
console.warn(`View: SdkComponentMap expected but not found.`);
|
|
89
|
-
|
|
90
|
-
// eslint-disable-next-line no-console
|
|
91
|
-
console.error(`View: Trying to render an unknown template: ${template}`);
|
|
59
|
+
const ViewTemplate: any = getComponentFromMap(template);
|
|
60
|
+
|
|
61
|
+
if (template === 'ListView') {
|
|
62
|
+
// special case for ListView - add in a prop
|
|
63
|
+
const bInForm = true;
|
|
64
|
+
props = { ...props, bInForm };
|
|
92
65
|
}
|
|
93
66
|
|
|
94
67
|
// for debugging/investigation
|
|
@@ -29,7 +29,8 @@ const useStyles = makeStyles(theme => ({
|
|
|
29
29
|
}
|
|
30
30
|
}));
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
|
|
33
|
+
declare const PCore: any;
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
export default function AppShell(props) {
|
|
@@ -55,7 +56,8 @@ export default function AppShell(props) {
|
|
|
55
56
|
const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : '';
|
|
56
57
|
const portalClass = pConn.getValue('.classID');
|
|
57
58
|
const envPortalName = envInfo.getPortalName();
|
|
58
|
-
const
|
|
59
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
60
|
+
|
|
59
61
|
const classes = useStyles();
|
|
60
62
|
const actionsAPI = pConn.getActionsApi();
|
|
61
63
|
const localeReference = pConn.getValue('.pyLocaleReference');
|
|
@@ -93,11 +95,11 @@ export default function AppShell(props) {
|
|
|
93
95
|
portalLogo.toLowerCase().includes('py-logo') ||
|
|
94
96
|
portalLogo.toLowerCase().includes('py-full-logo')
|
|
95
97
|
) {
|
|
96
|
-
const portalLogoImage = Utils.getIconPath(
|
|
98
|
+
const portalLogoImage = Utils.getIconPath(Utils.getSDKStaticConentUrl()).concat(
|
|
97
99
|
'pzpega-logo-mark.svg'
|
|
98
100
|
);
|
|
99
101
|
setIconURL(portalLogoImage);
|
|
100
|
-
setFullIconURL(`${
|
|
102
|
+
setFullIconURL(`${Utils.getSDKStaticConentUrl()}static/py-full-logo.svg`);
|
|
101
103
|
}
|
|
102
104
|
// not using default icon to fetch it using the way which uses authentication
|
|
103
105
|
else {
|
|
@@ -111,7 +113,7 @@ export default function AppShell(props) {
|
|
|
111
113
|
.catch(() => {
|
|
112
114
|
// eslint-disable-next-line no-console
|
|
113
115
|
console.error(
|
|
114
|
-
|
|
116
|
+
`${localizedVal('Unable to load the image for the portal logo/icon with the insName', 'AppShell')}:${portalLogo}`
|
|
115
117
|
);
|
|
116
118
|
});
|
|
117
119
|
}
|
|
@@ -145,7 +147,7 @@ export default function AppShell(props) {
|
|
|
145
147
|
const links = !pages
|
|
146
148
|
? []
|
|
147
149
|
: pages.map(page => {
|
|
148
|
-
const name =
|
|
150
|
+
const name = localizedVal(page.pyLabel, '', localeReference);
|
|
149
151
|
return {
|
|
150
152
|
text: name,
|
|
151
153
|
name,
|
|
@@ -173,14 +175,14 @@ export default function AppShell(props) {
|
|
|
173
175
|
portalName={portalName}
|
|
174
176
|
imageSrc={iconURL}
|
|
175
177
|
fullImageSrc={fullIconURL}
|
|
176
|
-
appName={
|
|
178
|
+
appName={localizedVal(
|
|
177
179
|
appNameToDisplay,
|
|
178
180
|
'',
|
|
179
181
|
`${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
|
|
180
182
|
)}
|
|
181
183
|
appInfo={{
|
|
182
184
|
imageSrc: iconURL,
|
|
183
|
-
appName:
|
|
185
|
+
appName: localizedVal(
|
|
184
186
|
appNameToDisplay,
|
|
185
187
|
'',
|
|
186
188
|
`${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
|
|
@@ -204,7 +206,11 @@ export default function AppShell(props) {
|
|
|
204
206
|
<div id='AppShell' className={classes.root}>
|
|
205
207
|
<NavBar
|
|
206
208
|
pConn={getPConnect()}
|
|
207
|
-
appName={
|
|
209
|
+
appName={localizedVal(
|
|
210
|
+
appNameToDisplay,
|
|
211
|
+
'',
|
|
212
|
+
`${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
|
|
213
|
+
)}
|
|
208
214
|
pages={pages}
|
|
209
215
|
caseTypes={caseTypes}
|
|
210
216
|
></NavBar>
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-boolean-value */
|
|
2
2
|
|
|
3
|
-
import React, { useState, useEffect, useContext } from
|
|
4
|
-
import PropTypes from
|
|
3
|
+
import React, { useState, useEffect, useContext } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
5
|
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
6
|
-
import { Card, CardHeader, Avatar, Typography, Divider } from
|
|
6
|
+
import { Card, CardHeader, Avatar, Typography, Divider } from '@material-ui/core';
|
|
7
7
|
import { makeStyles } from '@material-ui/core/styles';
|
|
8
8
|
import Box from '@material-ui/core/Box';
|
|
9
9
|
import Button from '@material-ui/core/Button';
|
|
10
10
|
import Grid from '@material-ui/core/Grid';
|
|
11
11
|
|
|
12
|
-
import StoreContext from
|
|
13
|
-
import CaseViewActionsMenu from
|
|
12
|
+
import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
|
|
13
|
+
import CaseViewActionsMenu from '@pega/react-sdk-components/lib/components/template/CaseViewActionsMenu';
|
|
14
14
|
import VerticalTabs from '@pega/react-sdk-components/lib/components/infra/VerticalTabs/VerticalTabs';
|
|
15
15
|
import DeferLoad from '@pega/react-sdk-components/lib/components/infra/DeferLoad';
|
|
16
16
|
|
|
17
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
|
|
18
|
+
declare const PCore: any;
|
|
17
19
|
|
|
18
|
-
declare const PCore;
|
|
19
20
|
|
|
20
|
-
const useStyles = makeStyles(
|
|
21
|
+
const useStyles = makeStyles(theme => ({
|
|
21
22
|
root: {
|
|
22
23
|
paddingRight: theme.spacing(1),
|
|
23
24
|
paddingLeft: theme.spacing(1),
|
|
@@ -26,18 +27,18 @@ const useStyles = makeStyles((theme) => ({
|
|
|
26
27
|
marginRight: theme.spacing(1),
|
|
27
28
|
marginLeft: theme.spacing(1),
|
|
28
29
|
marginTop: theme.spacing(1),
|
|
29
|
-
marginBottom: theme.spacing(1)
|
|
30
|
+
marginBottom: theme.spacing(1)
|
|
30
31
|
},
|
|
31
32
|
caseViewHeader: {
|
|
32
33
|
backgroundColor: theme.palette.info.light,
|
|
33
34
|
color: theme.palette.getContrastText(theme.palette.info.light),
|
|
34
|
-
borderRadius:
|
|
35
|
+
borderRadius: 'inherit'
|
|
35
36
|
},
|
|
36
37
|
caseViewIconBox: {
|
|
37
38
|
backgroundColor: theme.palette.info.dark,
|
|
38
39
|
width: theme.spacing(8),
|
|
39
40
|
height: theme.spacing(8),
|
|
40
|
-
padding: theme.spacing(1)
|
|
41
|
+
padding: theme.spacing(1)
|
|
41
42
|
},
|
|
42
43
|
caseViewIconImage: {
|
|
43
44
|
filter: 'invert(100%)'
|
|
@@ -51,30 +52,45 @@ export default function CaseView(props) {
|
|
|
51
52
|
header,
|
|
52
53
|
subheader,
|
|
53
54
|
children,
|
|
54
|
-
caseInfo: {
|
|
55
|
+
caseInfo: {
|
|
56
|
+
availableActions = [],
|
|
57
|
+
availableProcesses = [],
|
|
58
|
+
hasNewAttachments,
|
|
59
|
+
caseTypeID = '',
|
|
60
|
+
caseTypeName = ''
|
|
61
|
+
}
|
|
55
62
|
} = props;
|
|
56
63
|
const currentCaseID = props.caseInfo.ID;
|
|
57
64
|
let isComponentMounted = true;
|
|
58
65
|
|
|
59
|
-
const { displayOnlyFA } = useContext(StoreContext);
|
|
66
|
+
const { displayOnlyFA } = useContext<any>(StoreContext);
|
|
60
67
|
|
|
61
68
|
const thePConn = getPConnect();
|
|
62
69
|
|
|
63
70
|
const classes = useStyles();
|
|
64
71
|
|
|
65
|
-
const editAction = availableActions.find(
|
|
72
|
+
const editAction = availableActions.find(action => action.ID === 'pyUpdateCaseDetails');
|
|
73
|
+
|
|
74
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
75
|
+
const localeCategory = 'CaseView';
|
|
76
|
+
const localeKey = `${caseTypeID}!CASE!${caseTypeName}`.toUpperCase();
|
|
66
77
|
|
|
67
78
|
/**
|
|
68
79
|
*
|
|
69
80
|
* @param inName the metadata <em>name</em> that will cause a region to be returned
|
|
70
81
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
function getChildRegionByName(inName: string): any {
|
|
73
83
|
for (const child of children) {
|
|
74
|
-
const theMetadataType: string = child.props
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
const theMetadataType: string = child.props
|
|
85
|
+
.getPConnect()
|
|
86
|
+
.getRawMetadata()
|
|
87
|
+
['type'].toLowerCase();
|
|
88
|
+
const theMetadataName: string = child.props
|
|
89
|
+
.getPConnect()
|
|
90
|
+
.getRawMetadata()
|
|
91
|
+
['name'].toLowerCase();
|
|
92
|
+
|
|
93
|
+
if (theMetadataType === 'region' && theMetadataName === inName) {
|
|
78
94
|
return child;
|
|
79
95
|
}
|
|
80
96
|
}
|
|
@@ -82,14 +98,13 @@ export default function CaseView(props) {
|
|
|
82
98
|
return null;
|
|
83
99
|
}
|
|
84
100
|
|
|
101
|
+
const theSummaryRegion = getChildRegionByName('summary');
|
|
102
|
+
const theStagesRegion = getChildRegionByName('stages');
|
|
103
|
+
const theTodoRegion = getChildRegionByName('todo');
|
|
104
|
+
const theUtilitiesRegion = getChildRegionByName('utilities');
|
|
105
|
+
const theTabsRegion = getChildRegionByName('tabs');
|
|
85
106
|
|
|
86
|
-
const
|
|
87
|
-
const theStagesRegion = getChildRegionByName("stages");
|
|
88
|
-
const theTodoRegion = getChildRegionByName("todo");
|
|
89
|
-
const theUtilitiesRegion = getChildRegionByName("utilities");
|
|
90
|
-
const theTabsRegion = getChildRegionByName("tabs");
|
|
91
|
-
|
|
92
|
-
const svgCase = Utils.getImageSrc(icon, PCore.getAssetLoader().getStaticServerUrl());
|
|
107
|
+
const svgCase = Utils.getImageSrc(icon, Utils.getSDKStaticConentUrl());
|
|
93
108
|
|
|
94
109
|
const [activeVertTab, setActiveVertTab] = useState(0);
|
|
95
110
|
|
|
@@ -127,8 +142,6 @@ export default function CaseView(props) {
|
|
|
127
142
|
});
|
|
128
143
|
}
|
|
129
144
|
|
|
130
|
-
|
|
131
|
-
|
|
132
145
|
function handleVerticalTabClick(eventDetail: any) {
|
|
133
146
|
const theItem = parseInt(eventDetail.additionalData.itemClicked, 10);
|
|
134
147
|
|
|
@@ -138,14 +151,13 @@ export default function CaseView(props) {
|
|
|
138
151
|
}
|
|
139
152
|
}
|
|
140
153
|
|
|
141
|
-
|
|
142
154
|
// Add and Remove event listener for VerticalTabClick only at startup and teardown
|
|
143
155
|
useEffect(() => {
|
|
144
156
|
document.addEventListener('VerticalTabClick', (event: any) => {
|
|
145
157
|
handleVerticalTabClick(event.detail);
|
|
146
158
|
});
|
|
147
159
|
|
|
148
|
-
return ():void => {
|
|
160
|
+
return (): void => {
|
|
149
161
|
// inform that the component is unmounted so other code can
|
|
150
162
|
// know not to try to call useState setters (to avoid console warnings)
|
|
151
163
|
isComponentMounted = false;
|
|
@@ -153,74 +165,103 @@ export default function CaseView(props) {
|
|
|
153
165
|
document.removeEventListener('VerticalTabClick', (event: any) => {
|
|
154
166
|
handleVerticalTabClick(event.detail);
|
|
155
167
|
});
|
|
156
|
-
}
|
|
157
|
-
}, [])
|
|
168
|
+
};
|
|
169
|
+
}, []);
|
|
158
170
|
|
|
159
171
|
useEffect(() => {
|
|
160
172
|
if (hasNewAttachments) {
|
|
161
|
-
PCore.getPubSubUtils().publish(
|
|
173
|
+
PCore.getPubSubUtils().publish(
|
|
174
|
+
PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
|
|
175
|
+
true
|
|
176
|
+
);
|
|
162
177
|
}
|
|
163
178
|
}, [hasNewAttachments]);
|
|
164
179
|
|
|
165
180
|
function _editClick() {
|
|
166
|
-
|
|
167
181
|
const actionsAPI = thePConn.getActionsApi();
|
|
168
182
|
const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
|
|
169
183
|
|
|
170
|
-
openLocalAction(
|
|
184
|
+
openLocalAction(editAction.ID, { ...editAction });
|
|
171
185
|
}
|
|
172
186
|
|
|
173
|
-
|
|
174
187
|
function getActionButtonsHtml(): any {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
188
|
+
const aBHtml = (
|
|
189
|
+
<Box>
|
|
190
|
+
{editAction && (
|
|
191
|
+
<Button
|
|
192
|
+
onClick={() => {
|
|
193
|
+
_editClick();
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
{localizedVal('Edit', localeCategory)}
|
|
197
|
+
</Button>
|
|
198
|
+
)}
|
|
199
|
+
<CaseViewActionsMenu
|
|
200
|
+
getPConnect={getPConnect}
|
|
201
|
+
availableActions={availableActions}
|
|
202
|
+
availableProcesses={availableProcesses}
|
|
203
|
+
caseTypeName={caseTypeName}
|
|
204
|
+
caseTypeID={caseTypeID}
|
|
205
|
+
/>
|
|
206
|
+
</Box>
|
|
207
|
+
);
|
|
181
208
|
|
|
182
209
|
return aBHtml;
|
|
183
|
-
|
|
184
210
|
}
|
|
185
211
|
|
|
186
|
-
|
|
187
212
|
function getContainerContents() {
|
|
188
|
-
|
|
189
213
|
if (!displayOnlyFA) {
|
|
190
214
|
// show full portal
|
|
191
215
|
return (
|
|
192
216
|
<Grid container>
|
|
193
217
|
<Grid item xs={3}>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
218
|
+
<div hidden={true} id='current-caseID'>
|
|
219
|
+
{currentCaseID}
|
|
220
|
+
</div>
|
|
221
|
+
<Card className={classes.root}>
|
|
222
|
+
<CardHeader
|
|
223
|
+
className={classes.caseViewHeader}
|
|
224
|
+
title={
|
|
225
|
+
<Typography variant='h6' component='div'>
|
|
226
|
+
{PCore.getLocaleUtils().getLocaleValue(header, '', localeKey)}
|
|
227
|
+
</Typography>
|
|
228
|
+
}
|
|
229
|
+
subheader={
|
|
230
|
+
<Typography variant='body1' component='div' id='caseId'>
|
|
231
|
+
{subheader}
|
|
232
|
+
</Typography>
|
|
233
|
+
}
|
|
234
|
+
avatar={
|
|
235
|
+
<Avatar className={classes.caseViewIconBox} variant='square'>
|
|
236
|
+
<img src={svgCase} className={classes.caseViewIconImage} />
|
|
237
|
+
</Avatar>
|
|
238
|
+
}
|
|
239
|
+
/>
|
|
240
|
+
{getActionButtonsHtml()}
|
|
241
|
+
<Divider />
|
|
242
|
+
{theSummaryRegion}
|
|
243
|
+
<Divider />
|
|
244
|
+
{vertTabInfo.length > 1 && <VerticalTabs tabconfig={vertTabInfo} />}
|
|
245
|
+
</Card>
|
|
246
|
+
</Grid>
|
|
212
247
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
248
|
+
<Grid item xs={6}>
|
|
249
|
+
{theStagesRegion}
|
|
250
|
+
{theTodoRegion}
|
|
251
|
+
{deferLoadInfo.length > 0 && (
|
|
252
|
+
<DeferLoad
|
|
253
|
+
getPConnect={getPConnect}
|
|
254
|
+
name={deferLoadInfo[activeVertTab].config.name}
|
|
255
|
+
isTab
|
|
256
|
+
/>
|
|
257
|
+
)}
|
|
258
|
+
</Grid>
|
|
218
259
|
|
|
219
|
-
|
|
220
|
-
|
|
260
|
+
<Grid item xs={3}>
|
|
261
|
+
{theUtilitiesRegion}
|
|
262
|
+
</Grid>
|
|
221
263
|
</Grid>
|
|
222
|
-
|
|
223
|
-
)
|
|
264
|
+
);
|
|
224
265
|
} else {
|
|
225
266
|
// displayOnlyFA - only show the "todo" region
|
|
226
267
|
return (
|
|
@@ -229,18 +270,15 @@ export default function CaseView(props) {
|
|
|
229
270
|
{theTodoRegion}
|
|
230
271
|
</Grid>
|
|
231
272
|
</Grid>
|
|
232
|
-
)
|
|
273
|
+
);
|
|
233
274
|
}
|
|
234
275
|
}
|
|
235
276
|
|
|
236
|
-
|
|
237
|
-
return (
|
|
238
|
-
getContainerContents()
|
|
239
|
-
);
|
|
277
|
+
return getContainerContents();
|
|
240
278
|
}
|
|
241
279
|
|
|
242
280
|
CaseView.defaultProps = {
|
|
243
|
-
icon:
|
|
281
|
+
icon: '',
|
|
244
282
|
children: [],
|
|
245
283
|
caseInfo: {},
|
|
246
284
|
showIconInHeader: true,
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import PropTypes from
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
3
|
import Button from '@material-ui/core/Button';
|
|
4
4
|
import Menu from '@material-ui/core/Menu';
|
|
5
5
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
6
6
|
|
|
7
|
+
import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
|
|
8
|
+
|
|
9
|
+
declare const PCore: typeof PCoreType;
|
|
10
|
+
|
|
11
|
+
|
|
7
12
|
export default function CaseViewActionsMenu(props) {
|
|
8
|
-
const {getPConnect, availableActions, availableProcesses} = props;
|
|
13
|
+
const { getPConnect, availableActions, availableProcesses, caseTypeID, caseTypeName } = props;
|
|
9
14
|
const thePConn = getPConnect();
|
|
10
15
|
|
|
16
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
17
|
+
const localeCategory = 'CaseView';
|
|
18
|
+
const localeKey = `${caseTypeID}!CASE!${caseTypeName}`.toUpperCase();
|
|
11
19
|
|
|
12
20
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
13
21
|
|
|
@@ -21,35 +29,34 @@ export default function CaseViewActionsMenu(props) {
|
|
|
21
29
|
|
|
22
30
|
const arMenuItems: Array<any> = [];
|
|
23
31
|
|
|
24
|
-
|
|
25
32
|
function _actionMenuActionsClick(data) {
|
|
26
|
-
|
|
27
33
|
const actionsAPI = thePConn.getActionsApi();
|
|
28
34
|
const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
|
|
29
35
|
|
|
30
|
-
openLocalAction(
|
|
36
|
+
openLocalAction(data.ID, { ...data, containerName: 'modal', type: 'express' });
|
|
31
37
|
// after doing the action, close the menu...
|
|
32
38
|
handleClose();
|
|
33
|
-
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
availableActions.forEach(action => {
|
|
42
|
+
arMenuItems.push(
|
|
43
|
+
<MenuItem key={action.ID} onClick={() => _actionMenuActionsClick(action)}>
|
|
44
|
+
{localizedVal(action.name, '', localeKey)}
|
|
45
|
+
</MenuItem>
|
|
46
|
+
);
|
|
39
47
|
});
|
|
40
48
|
|
|
41
|
-
availableProcesses.forEach(
|
|
42
|
-
arMenuItems.push(
|
|
49
|
+
availableProcesses.forEach(process => {
|
|
50
|
+
arMenuItems.push(<MenuItem onClick={handleClose}>{process.name}</MenuItem>);
|
|
43
51
|
});
|
|
44
52
|
|
|
45
|
-
|
|
46
53
|
return (
|
|
47
54
|
<React.Fragment>
|
|
48
|
-
<Button aria-controls=
|
|
49
|
-
Actions...
|
|
55
|
+
<Button aria-controls='simple-menu' aria-haspopup='true' onClick={handleClick}>
|
|
56
|
+
{localizedVal('Actions...', localeCategory)}
|
|
50
57
|
</Button>
|
|
51
58
|
<Menu
|
|
52
|
-
id=
|
|
59
|
+
id='simple-menu'
|
|
53
60
|
anchorEl={anchorEl}
|
|
54
61
|
keepMounted
|
|
55
62
|
open={Boolean(anchorEl)}
|
|
@@ -64,10 +71,12 @@ export default function CaseViewActionsMenu(props) {
|
|
|
64
71
|
CaseViewActionsMenu.defaultProps = {
|
|
65
72
|
availableActions: [],
|
|
66
73
|
availableProcesses: []
|
|
67
|
-
}
|
|
74
|
+
};
|
|
68
75
|
|
|
69
76
|
CaseViewActionsMenu.propTypes = {
|
|
70
77
|
getPConnect: PropTypes.func.isRequired,
|
|
71
78
|
availableActions: PropTypes.arrayOf(PropTypes.object),
|
|
72
|
-
availableProcesses: PropTypes.arrayOf(PropTypes.any)
|
|
79
|
+
availableProcesses: PropTypes.arrayOf(PropTypes.any),
|
|
80
|
+
caseTypeID: PropTypes.string,
|
|
81
|
+
caseTypeName: PropTypes.string
|
|
73
82
|
};
|