@pega/react-sdk-overrides 0.23.19 → 0.23.21
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/Banner/Banner.css +35 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +33 -0
- package/lib/designSystemExtension/Banner/index.tsx +1 -0
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +1 -2
- package/lib/field/DateTime/DateTime.tsx +6 -7
- package/lib/helpers/template-utils.ts +7 -7
- package/lib/infra/Assignment/Assignment.tsx +126 -109
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +120 -136
- package/lib/infra/View/View.tsx +2 -1
- package/lib/template/AppShell/AppShell.tsx +159 -27
- package/lib/template/BannerPage/BannerPage.tsx +61 -0
- package/lib/template/BannerPage/index.tsx +1 -0
- package/lib/template/Confirmation/Confirmation.tsx +101 -0
- package/lib/template/Confirmation/config-ext.json +12 -0
- package/lib/template/Confirmation/index.tsx +1 -0
- package/lib/template/WssNavBar/WssNavBar.css +5 -0
- package/lib/template/WssNavBar/WssNavBar.tsx +141 -0
- package/lib/template/WssNavBar/index.tsx +1 -0
- package/lib/widget/Attachment/Attachment.tsx +9 -10
- package/lib/widget/ToDo/ToDo.css +10 -4
- package/lib/widget/ToDo/ToDo.tsx +125 -52
- package/package.json +1 -1
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
import React, { useEffect, useState } from
|
|
2
|
-
import PropTypes from
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
3
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
-
|
|
4
|
+
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
5
|
+
import Avatar from '@material-ui/core/Avatar';
|
|
5
6
|
import { NavContext } from '@pega/react-sdk-components/lib/components/helpers/reactContextHelpers';
|
|
6
7
|
import './AppShell.css';
|
|
7
8
|
|
|
8
|
-
// AppShell can emit NavBar
|
|
9
|
+
// AppShell can emit NavBar or WssNavBar
|
|
9
10
|
import NavBar from '@pega/react-sdk-components/lib/components/infra/NavBar';
|
|
11
|
+
import WssNavBar from '@pega/react-sdk-components/lib/components/template/WssNavBar';
|
|
10
12
|
|
|
11
|
-
const useStyles = makeStyles(
|
|
13
|
+
const useStyles = makeStyles(theme => ({
|
|
12
14
|
root: {
|
|
13
|
-
display: 'flex'
|
|
15
|
+
display: 'flex'
|
|
14
16
|
},
|
|
15
17
|
content: {
|
|
16
18
|
flexGrow: 1,
|
|
17
19
|
height: '100vh',
|
|
18
20
|
overflow: 'auto',
|
|
19
21
|
marginLeft: theme.spacing(2),
|
|
20
|
-
marginRight: theme.spacing(2)
|
|
22
|
+
marginRight: theme.spacing(2)
|
|
21
23
|
},
|
|
24
|
+
wsscontent: {
|
|
25
|
+
flexGrow: 1,
|
|
26
|
+
height: '100vh',
|
|
27
|
+
overflow: 'auto',
|
|
28
|
+
marginLeft: theme.spacing(1),
|
|
29
|
+
marginRight: theme.spacing(1)
|
|
30
|
+
}
|
|
22
31
|
}));
|
|
23
32
|
|
|
24
33
|
declare const PCore;
|
|
@@ -31,53 +40,176 @@ export default function AppShell(props) {
|
|
|
31
40
|
showAppName,
|
|
32
41
|
children,
|
|
33
42
|
getPConnect,
|
|
43
|
+
portalTemplate,
|
|
44
|
+
portalName,
|
|
45
|
+
portalLogo,
|
|
46
|
+
navDisplayOptions
|
|
34
47
|
} = props;
|
|
35
48
|
const [open, setOpen] = useState(true);
|
|
36
|
-
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
50
|
+
const [activeTab, setActiveTab] = useState(!pages ? null : pages[0]?.pyRuleName);
|
|
37
51
|
const pConn = getPConnect();
|
|
38
52
|
const envInfo = PCore.getEnvironmentInfo();
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
53
|
+
const imageKey = envInfo.getOperatorImageInsKey();
|
|
54
|
+
const userName = envInfo.getOperatorName();
|
|
55
|
+
const currentUserInitials = Utils.getInitials(userName);
|
|
56
|
+
const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : '';
|
|
57
|
+
const portalClass = pConn.getValue('.classID');
|
|
58
|
+
const envPortalName = envInfo.getPortalName();
|
|
59
|
+
const localeUtils = PCore.getLocaleUtils();
|
|
42
60
|
const classes = useStyles();
|
|
43
|
-
|
|
61
|
+
const actionsAPI = pConn.getActionsApi();
|
|
62
|
+
const localeReference = pConn.getValue('.pyLocaleReference');
|
|
63
|
+
const [imageBlobUrl, setImageBlobUrl] = useState(null);
|
|
44
64
|
// useState for appName and mapChildren - note these are ONLY updated once (on component mount!)
|
|
45
65
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
46
|
-
const [appName, setAppName] = useState(
|
|
66
|
+
const [appName, setAppName] = useState('');
|
|
47
67
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
48
68
|
const [mapChildren, setMapChildren] = useState([]);
|
|
49
69
|
|
|
50
70
|
// Initial setting of appName and mapChildren
|
|
51
|
-
useEffect(
|
|
71
|
+
useEffect(() => {
|
|
52
72
|
setAppName(PCore.getEnvironmentInfo().getApplicationName());
|
|
53
73
|
|
|
54
74
|
const tempMap = pConn.getChildren().map((child, index) => {
|
|
55
75
|
const theChildComp = child.getPConnect().getComponentName();
|
|
56
76
|
const theKey = `.${index}`;
|
|
57
|
-
return
|
|
77
|
+
return (
|
|
78
|
+
<div id={theChildComp} key={theKey} style={{ border: 'solid 1px silver', margin: '1px' }}>
|
|
79
|
+
{theChildComp} will be here
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
58
82
|
});
|
|
59
83
|
|
|
60
|
-
setMapChildren(tempMap)
|
|
84
|
+
setMapChildren(tempMap);
|
|
85
|
+
}, []);
|
|
61
86
|
|
|
87
|
+
const [iconURL, setIconURL] = useState('');
|
|
88
|
+
const [fullIconURL, setFullIconURL] = useState('');
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
// using the default icon then fetch it from the static folder (not auth involved)
|
|
91
|
+
if (
|
|
92
|
+
!portalLogo ||
|
|
93
|
+
portalLogo.toLowerCase().includes('pzpega-logo-mark') ||
|
|
94
|
+
portalLogo.toLowerCase().includes('py-logo') ||
|
|
95
|
+
portalLogo.toLowerCase().includes('py-full-logo')
|
|
96
|
+
) {
|
|
97
|
+
const portalLogoImage = Utils.getIconPath(PCore.getAssetLoader().getStaticServerUrl()).concat(
|
|
98
|
+
'pzpega-logo-mark.svg'
|
|
99
|
+
);
|
|
100
|
+
setIconURL(portalLogoImage);
|
|
101
|
+
setFullIconURL(`${PCore.getAssetLoader().getStaticServerUrl()}static/py-full-logo.svg`);
|
|
102
|
+
}
|
|
103
|
+
// not using default icon to fetch it using the way which uses authentication
|
|
104
|
+
else {
|
|
105
|
+
PCore.getAssetLoader()
|
|
106
|
+
.getSvcImage(portalLogo)
|
|
107
|
+
.then(blob => window.URL.createObjectURL(blob))
|
|
108
|
+
.then(data => {
|
|
109
|
+
setIconURL(data);
|
|
110
|
+
setFullIconURL(data);
|
|
111
|
+
})
|
|
112
|
+
.catch(() => {
|
|
113
|
+
// eslint-disable-next-line no-console
|
|
114
|
+
console.error(
|
|
115
|
+
`Unable to load the image for the portal logo/icon with the insName:${portalLogo}`
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}, [portalLogo]);
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (imageKey && portalTemplate === 'wss') {
|
|
123
|
+
PCore.getAssetLoader()
|
|
124
|
+
.getSvcImage(imageKey)
|
|
125
|
+
.then(blob => window.URL.createObjectURL(blob))
|
|
126
|
+
.then(imagePath => setImageBlobUrl(imagePath));
|
|
127
|
+
}
|
|
62
128
|
}, []);
|
|
63
129
|
|
|
130
|
+
const getOperator = () => {
|
|
131
|
+
return {
|
|
132
|
+
avatar: portalTemplate !== 'wss' ? <Avatar /> : { name: userName, imageSrc: imageBlobUrl },
|
|
133
|
+
name: userName,
|
|
134
|
+
currentUserInitials
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
function showPage(viewName, className) {
|
|
139
|
+
actionsAPI.showPage(viewName, className);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function openURL(URL) {
|
|
143
|
+
window.open(URL, '_blank');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const links = !pages
|
|
147
|
+
? []
|
|
148
|
+
: pages.map(page => {
|
|
149
|
+
const name = localeUtils.getLocaleValue(page.pyLabel, '', localeReference);
|
|
150
|
+
return {
|
|
151
|
+
text: name,
|
|
152
|
+
name,
|
|
153
|
+
icon: page.pxPageViewIcon.replace('pi pi-', ''),
|
|
154
|
+
active: page.pyRuleName === activeTab,
|
|
155
|
+
onClick: () =>
|
|
156
|
+
!page.pyURLContent || page.pyURLContent === ''
|
|
157
|
+
? showPage(page.pyRuleName, page.pyClassName)
|
|
158
|
+
: openURL(page.pyURLContent)
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
|
|
64
162
|
if (pConn.hasChildren()) {
|
|
65
163
|
// const theChildren = pConn.getChildren();
|
|
66
164
|
// const mapChildCompNames = theChildren.map((child) => { return child.getPConnect().getComponentName()});
|
|
67
|
-
|
|
68
165
|
// debugging/investigation help
|
|
69
166
|
// console.log(`AppShell has children: ${theChildren.length}`);
|
|
70
167
|
// console.log(`--> ${mapChildCompNames.map((name) => {return name;})}`);
|
|
71
168
|
}
|
|
72
169
|
|
|
73
|
-
|
|
170
|
+
if (portalTemplate === 'wss') {
|
|
171
|
+
return (
|
|
172
|
+
<div id='AppShell'>
|
|
173
|
+
<WssNavBar
|
|
174
|
+
portalName={portalName}
|
|
175
|
+
imageSrc={iconURL}
|
|
176
|
+
fullImageSrc={fullIconURL}
|
|
177
|
+
appName={localeUtils.getLocaleValue(
|
|
178
|
+
appNameToDisplay,
|
|
179
|
+
'',
|
|
180
|
+
`${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
|
|
181
|
+
)}
|
|
182
|
+
appInfo={{
|
|
183
|
+
imageSrc: iconURL,
|
|
184
|
+
appName: localeUtils.getLocaleValue(
|
|
185
|
+
appNameToDisplay,
|
|
186
|
+
'',
|
|
187
|
+
`${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
|
|
188
|
+
),
|
|
189
|
+
onClick: links[0] && links[0].onClick ? links[0].onClick : undefined
|
|
190
|
+
}}
|
|
191
|
+
navLinks={links.filter((link, index) => {
|
|
192
|
+
return index !== 0;
|
|
193
|
+
})}
|
|
194
|
+
operator={getOperator()}
|
|
195
|
+
navDisplayOptions={navDisplayOptions}
|
|
196
|
+
/>
|
|
197
|
+
<div className={classes.wsscontent}>{children}</div>
|
|
198
|
+
</div>
|
|
74
199
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<NavContext.Provider value={{ open, setOpen }}>
|
|
205
|
+
<div id='AppShell' className={classes.root}>
|
|
206
|
+
<NavBar
|
|
207
|
+
pConn={getPConnect()}
|
|
208
|
+
appName={appNameToDisplay}
|
|
209
|
+
pages={pages}
|
|
210
|
+
caseTypes={caseTypes}
|
|
211
|
+
></NavBar>
|
|
212
|
+
<div className={classes.content}>{children}</div>
|
|
81
213
|
</div>
|
|
82
214
|
</NavContext.Provider>
|
|
83
215
|
);
|
|
@@ -86,12 +218,12 @@ export default function AppShell(props) {
|
|
|
86
218
|
AppShell.defaultProps = {
|
|
87
219
|
pages: [],
|
|
88
220
|
caseTypes: [],
|
|
89
|
-
children: []
|
|
221
|
+
children: []
|
|
90
222
|
};
|
|
91
223
|
AppShell.propTypes = {
|
|
92
|
-
showAppName: PropTypes.bool/* .isRequired */,
|
|
224
|
+
showAppName: PropTypes.bool /* .isRequired */,
|
|
93
225
|
pages: PropTypes.arrayOf(PropTypes.object),
|
|
94
226
|
caseTypes: PropTypes.arrayOf(PropTypes.object),
|
|
95
227
|
children: PropTypes.arrayOf(PropTypes.node),
|
|
96
|
-
getPConnect: PropTypes.func.isRequired
|
|
228
|
+
getPConnect: PropTypes.func.isRequired
|
|
97
229
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useMemo, Children } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Banner from '@pega/react-sdk-components/lib/components/designSystemExtension/Banner';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* BannerPage template.
|
|
8
|
+
*/
|
|
9
|
+
export default function BannerPage(props) {
|
|
10
|
+
const {
|
|
11
|
+
children,
|
|
12
|
+
layout,
|
|
13
|
+
heading,
|
|
14
|
+
message,
|
|
15
|
+
imageTheme,
|
|
16
|
+
backgroundImage,
|
|
17
|
+
backgroundColor,
|
|
18
|
+
tintImage
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
const childArray = useMemo(() => {
|
|
22
|
+
return Children.toArray(children);
|
|
23
|
+
}, [children]);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Banner
|
|
27
|
+
variant={layout}
|
|
28
|
+
a={childArray[0]}
|
|
29
|
+
b={childArray[1]}
|
|
30
|
+
banner={{
|
|
31
|
+
variant: imageTheme,
|
|
32
|
+
backgroundColor,
|
|
33
|
+
title: heading,
|
|
34
|
+
message,
|
|
35
|
+
backgroundImage,
|
|
36
|
+
tintImage
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
BannerPage.propTypes = {
|
|
43
|
+
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
44
|
+
layout: PropTypes.string,
|
|
45
|
+
heading: PropTypes.string,
|
|
46
|
+
message: PropTypes.string,
|
|
47
|
+
imageTheme: PropTypes.string,
|
|
48
|
+
backgroundImage: PropTypes.string,
|
|
49
|
+
backgroundColor: PropTypes.string,
|
|
50
|
+
tintImage: PropTypes.bool
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
BannerPage.defaultProps = {
|
|
54
|
+
layout: 'two-column',
|
|
55
|
+
heading: '',
|
|
56
|
+
message: '',
|
|
57
|
+
imageTheme: 'light',
|
|
58
|
+
backgroundImage: '',
|
|
59
|
+
backgroundColor: '',
|
|
60
|
+
tintImage: false
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './BannerPage';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* eslint-disable no-unused-vars */
|
|
3
|
+
/* eslint-disable no-nested-ternary */
|
|
4
|
+
import { Fragment, useState } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { getToDoAssignments } from '@pega/react-sdk-components/lib/components/infra/Containers/FlowContainer/helpers';
|
|
8
|
+
import ToDo from '@pega/react-sdk-components/lib/components/widget/ToDo';
|
|
9
|
+
import Details from '@pega/react-sdk-components/lib/components/template/Details/Details';
|
|
10
|
+
import { Button, Card, makeStyles } from '@material-ui/core';
|
|
11
|
+
|
|
12
|
+
declare const PCore;
|
|
13
|
+
|
|
14
|
+
const useStyles = makeStyles(theme => ({
|
|
15
|
+
root: {
|
|
16
|
+
paddingRight: theme.spacing(1),
|
|
17
|
+
paddingLeft: theme.spacing(1),
|
|
18
|
+
paddingTop: theme.spacing(1),
|
|
19
|
+
paddingBottom: theme.spacing(1),
|
|
20
|
+
marginRight: theme.spacing(1),
|
|
21
|
+
marginLeft: theme.spacing(1),
|
|
22
|
+
marginTop: theme.spacing(1),
|
|
23
|
+
marginBottom: theme.spacing(1)
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
export default function Confirmation(props) {
|
|
28
|
+
const classes = useStyles();
|
|
29
|
+
const CONSTS = PCore.getConstants();
|
|
30
|
+
const [showConfirmView, setShowConfirmView] = useState(true);
|
|
31
|
+
const { showTasks, getPConnect, datasource } = props;
|
|
32
|
+
// Get the inherited props from the parent to determine label settings
|
|
33
|
+
// Not using whatsNext at the moment, need to figure out the use of it
|
|
34
|
+
const whatsNext = datasource?.source;
|
|
35
|
+
const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
|
|
36
|
+
const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(
|
|
37
|
+
getPConnect().getTarget()
|
|
38
|
+
);
|
|
39
|
+
const rootInfo = PCore.getContainerUtils().getContainerItemData(
|
|
40
|
+
getPConnect().getTarget(),
|
|
41
|
+
activeContainerItemID
|
|
42
|
+
);
|
|
43
|
+
const onConfirmViewClose = () => {
|
|
44
|
+
setShowConfirmView(false);
|
|
45
|
+
PCore.getPubSubUtils().publish(
|
|
46
|
+
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CLOSE_CONFIRM_VIEW,
|
|
47
|
+
rootInfo
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
const todoProps = { ...props, renderTodoInConfirm: true };
|
|
51
|
+
const toDoList = getToDoAssignments(getPConnect());
|
|
52
|
+
const detailProps = { ...props, showLabel: false };
|
|
53
|
+
const showDetails = detailProps?.children?.[0]?.props?.getPConnect()?.getChildren()?.length > 0;
|
|
54
|
+
return showConfirmView ? (
|
|
55
|
+
<Card className={classes.root}>
|
|
56
|
+
<h2 id='confirm-label'>{props.showLabel ? props.label : ''}</h2>
|
|
57
|
+
{showDetails ? <Details {...detailProps} /> : undefined}
|
|
58
|
+
{showTasks ? (
|
|
59
|
+
toDoList && toDoList.length > 0 ? (
|
|
60
|
+
<ToDo
|
|
61
|
+
{...todoProps}
|
|
62
|
+
datasource={{ source: toDoList }}
|
|
63
|
+
getPConnect={getPConnect}
|
|
64
|
+
type={CONSTS.TODO}
|
|
65
|
+
headerText='Open Tasks'
|
|
66
|
+
isConfirm
|
|
67
|
+
/>
|
|
68
|
+
) : undefined
|
|
69
|
+
) : undefined}
|
|
70
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
|
71
|
+
<Button variant='contained' color='primary' onClick={onConfirmViewClose}>
|
|
72
|
+
Done
|
|
73
|
+
</Button>
|
|
74
|
+
</div>
|
|
75
|
+
</Card>
|
|
76
|
+
) : toDoList && toDoList.length > 0 ? (
|
|
77
|
+
<Card className={classes.root}>
|
|
78
|
+
<ToDo
|
|
79
|
+
{...props}
|
|
80
|
+
datasource={{ source: toDoList }}
|
|
81
|
+
getPConnect={getPConnect}
|
|
82
|
+
type={CONSTS.TODO}
|
|
83
|
+
headerText='Tasks'
|
|
84
|
+
isConfirm
|
|
85
|
+
/>
|
|
86
|
+
</Card>
|
|
87
|
+
) : null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
Confirmation.defaultProps = {
|
|
91
|
+
datasource: undefined,
|
|
92
|
+
label: '',
|
|
93
|
+
showLabel: true
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
Confirmation.propTypes = {
|
|
97
|
+
getPConnect: PropTypes.func.isRequired,
|
|
98
|
+
datasource: PropTypes.objectOf(PropTypes.any),
|
|
99
|
+
label: PropTypes.string,
|
|
100
|
+
showLabel: PropTypes.bool
|
|
101
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Confirmation';
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
3
|
+
import AppBar from '@material-ui/core/AppBar';
|
|
4
|
+
import Box from '@material-ui/core/Box';
|
|
5
|
+
import Toolbar from '@material-ui/core/Toolbar';
|
|
6
|
+
import Container from '@material-ui/core/Container';
|
|
7
|
+
import { IconButton, Menu, MenuItem, Typography } from '@material-ui/core';
|
|
8
|
+
import { Button } from '@material-ui/core';
|
|
9
|
+
import Avatar from '@material-ui/core/Avatar';
|
|
10
|
+
import MenuIcon from '@material-ui/icons/Menu';
|
|
11
|
+
import { logout } from '@pega/react-sdk-components/lib/components/helpers/authManager';
|
|
12
|
+
import './WssNavBar.css';
|
|
13
|
+
|
|
14
|
+
const useStyles = makeStyles(theme => ({
|
|
15
|
+
root: {
|
|
16
|
+
display: 'flex'
|
|
17
|
+
},
|
|
18
|
+
content: {
|
|
19
|
+
flexGrow: 1,
|
|
20
|
+
height: '100vh',
|
|
21
|
+
marginLeft: theme.spacing(2),
|
|
22
|
+
marginRight: theme.spacing(2)
|
|
23
|
+
},
|
|
24
|
+
appListLogo: {
|
|
25
|
+
width: '3.6rem'
|
|
26
|
+
},
|
|
27
|
+
appName: {
|
|
28
|
+
color: 'white',
|
|
29
|
+
marginLeft: theme.spacing(2),
|
|
30
|
+
marginRight: theme.spacing(4),
|
|
31
|
+
fontSize: '1.5rem'
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
export default function WssNavBar(props) {
|
|
36
|
+
const { appInfo, navLinks, operator, navDisplayOptions } = props;
|
|
37
|
+
const { alignment } = navDisplayOptions;
|
|
38
|
+
const classes = useStyles();
|
|
39
|
+
|
|
40
|
+
const [anchorElNav, setAnchorElNav] = useState<null | HTMLElement>(null);
|
|
41
|
+
const [anchorElUser, setAnchorElUser] = useState<null | HTMLElement>(null);
|
|
42
|
+
|
|
43
|
+
const handleOpenNavMenu = (event: React.MouseEvent<HTMLElement>) => {
|
|
44
|
+
setAnchorElNav(event.currentTarget);
|
|
45
|
+
};
|
|
46
|
+
const handleOpenUserMenu = (event: React.MouseEvent<HTMLElement>) => {
|
|
47
|
+
setAnchorElUser(event.currentTarget);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const handleCloseNavMenu = () => {
|
|
51
|
+
setAnchorElNav(null);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const handleCloseUserMenu = () => {
|
|
55
|
+
setAnchorElUser(null);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div id='NavBar'>
|
|
60
|
+
<AppBar position='static' color='primary'>
|
|
61
|
+
<Container maxWidth='xl'>
|
|
62
|
+
<Toolbar disableGutters>
|
|
63
|
+
<Button style={{ textTransform: 'capitalize' }} onClick={appInfo.onClick}>
|
|
64
|
+
<img src={appInfo.imageSrc} className={classes.appListLogo} />
|
|
65
|
+
<span className={classes.appName}>{appInfo.appName}</span>
|
|
66
|
+
</Button>
|
|
67
|
+
<Box sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}>
|
|
68
|
+
<IconButton
|
|
69
|
+
size='small'
|
|
70
|
+
aria-label='account of current user'
|
|
71
|
+
aria-controls='menu-appbar'
|
|
72
|
+
aria-haspopup='true'
|
|
73
|
+
onClick={handleOpenNavMenu}
|
|
74
|
+
color='inherit'
|
|
75
|
+
>
|
|
76
|
+
<MenuIcon />
|
|
77
|
+
</IconButton>
|
|
78
|
+
<Menu
|
|
79
|
+
id='menu-appbar'
|
|
80
|
+
anchorEl={anchorElNav}
|
|
81
|
+
anchorOrigin={{
|
|
82
|
+
vertical: 'bottom',
|
|
83
|
+
horizontal: 'left'
|
|
84
|
+
}}
|
|
85
|
+
keepMounted
|
|
86
|
+
transformOrigin={{
|
|
87
|
+
vertical: 'top',
|
|
88
|
+
horizontal: 'left'
|
|
89
|
+
}}
|
|
90
|
+
open={Boolean(anchorElNav)}
|
|
91
|
+
onClose={handleCloseNavMenu}
|
|
92
|
+
>
|
|
93
|
+
{navLinks.map(link => (
|
|
94
|
+
<MenuItem key={link.text} onClick={link.onClick}>
|
|
95
|
+
<Typography>{link.text}</Typography>
|
|
96
|
+
</MenuItem>
|
|
97
|
+
))}
|
|
98
|
+
</Menu>
|
|
99
|
+
</Box>
|
|
100
|
+
|
|
101
|
+
<Box
|
|
102
|
+
sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}
|
|
103
|
+
style={{ justifyContent: alignment }}
|
|
104
|
+
>
|
|
105
|
+
{navLinks.map(link => (
|
|
106
|
+
<Button className='link-style' key={link.text} onClick={link.onClick}>
|
|
107
|
+
{link.text}
|
|
108
|
+
</Button>
|
|
109
|
+
))}
|
|
110
|
+
</Box>
|
|
111
|
+
|
|
112
|
+
<Box sx={{ flexGrow: 0 }}>
|
|
113
|
+
<IconButton onClick={handleOpenUserMenu}>
|
|
114
|
+
<Avatar>{operator.currentUserInitials}</Avatar>
|
|
115
|
+
</IconButton>
|
|
116
|
+
<Menu
|
|
117
|
+
id='menu-appbar'
|
|
118
|
+
anchorEl={anchorElUser}
|
|
119
|
+
anchorOrigin={{
|
|
120
|
+
vertical: 'top',
|
|
121
|
+
horizontal: 'right'
|
|
122
|
+
}}
|
|
123
|
+
keepMounted
|
|
124
|
+
transformOrigin={{
|
|
125
|
+
vertical: 'top',
|
|
126
|
+
horizontal: 'right'
|
|
127
|
+
}}
|
|
128
|
+
open={Boolean(anchorElUser)}
|
|
129
|
+
onClose={handleCloseUserMenu}
|
|
130
|
+
>
|
|
131
|
+
<MenuItem onClick={logout}>
|
|
132
|
+
<Typography>Logout</Typography>
|
|
133
|
+
</MenuItem>
|
|
134
|
+
</Menu>
|
|
135
|
+
</Box>
|
|
136
|
+
</Toolbar>
|
|
137
|
+
</Container>
|
|
138
|
+
</AppBar>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './WssNavBar';
|
|
@@ -421,17 +421,16 @@ export default function Attachment(props) {
|
|
|
421
421
|
}
|
|
422
422
|
);
|
|
423
423
|
}
|
|
424
|
-
|
|
425
|
-
PCore.getPubSubUtils().subscribe(
|
|
426
|
-
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION,
|
|
427
|
-
resetAttachmentStoredState,
|
|
428
|
-
caseID
|
|
429
|
-
);
|
|
430
|
-
return () => {
|
|
431
|
-
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION, caseID);
|
|
432
|
-
};
|
|
433
424
|
}
|
|
434
|
-
|
|
425
|
+
}
|
|
426
|
+
PCore.getPubSubUtils().subscribe(
|
|
427
|
+
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION,
|
|
428
|
+
resetAttachmentStoredState,
|
|
429
|
+
caseID
|
|
430
|
+
);
|
|
431
|
+
return () => {
|
|
432
|
+
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION, caseID);
|
|
433
|
+
};
|
|
435
434
|
}, []);
|
|
436
435
|
|
|
437
436
|
let content = (
|
package/lib/widget/ToDo/ToDo.css
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
min-width: 2.5rem;
|
|
35
35
|
min-height: 2.5rem;
|
|
36
36
|
max-width: 2.5rem;
|
|
37
|
-
max-height: 2.5rem;
|
|
37
|
+
max-height: 2.5rem;
|
|
38
38
|
border-radius: 50%;
|
|
39
39
|
justify-content: center;
|
|
40
40
|
align-items: center;
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.psdk-todo-assignment {
|
|
50
|
-
display: inline-flex;
|
|
51
|
-
width:100%;
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
width:100%;
|
|
52
52
|
padding: 0.625rem 0rem;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.psdk-todo-card {
|
|
80
|
-
width: 100%;
|
|
80
|
+
width: 100%;
|
|
81
81
|
padding-left: 0.625rem;
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -85,3 +85,9 @@
|
|
|
85
85
|
width: 100%;
|
|
86
86
|
text-align: center;
|
|
87
87
|
}
|
|
88
|
+
|
|
89
|
+
.psdk-todo-avatar-header{
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
padding: 16px;
|
|
93
|
+
}
|