@pega/react-sdk-overrides 0.23.20 → 0.23.22

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.
@@ -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 = (
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-shadow */
2
2
  /* eslint-disable @typescript-eslint/no-shadow */
3
- import React, { useState } from 'react';
3
+ import React, { Fragment, useState } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
6
6
  import {
@@ -30,7 +30,7 @@ import './ToDo.css';
30
30
 
31
31
  declare const PCore: any;
32
32
 
33
- const isChildCase = (assignment) => {
33
+ const isChildCase = assignment => {
34
34
  return assignment.isChild;
35
35
  };
36
36
 
@@ -60,11 +60,17 @@ const useStyles = makeStyles(theme => ({
60
60
  avatar: {
61
61
  backgroundColor: theme.palette.primary.light,
62
62
  color: theme.palette.getContrastText(theme.palette.primary.light)
63
+ },
64
+ todoWrapper: {
65
+ borderLeft: '6px solid',
66
+ borderLeftColor: theme.palette.primary.light,
67
+ padding: theme.spacing(1),
68
+ margin: theme.spacing(1)
63
69
  }
64
70
  }));
65
71
 
66
72
  export default function ToDo(props) {
67
- const { datasource, getPConnect, headerText, showTodoList, myWorkList, type } = props;
73
+ const { datasource, getPConnect, headerText, showTodoList, myWorkList, type, isConfirm } = props;
68
74
 
69
75
  const CONSTS = PCore.getConstants();
70
76
 
@@ -203,6 +209,47 @@ export default function ToDo(props) {
203
209
  );
204
210
  };
205
211
 
212
+ const toDoContent = (
213
+ <>
214
+ {showTodoList && (
215
+ <CardHeader
216
+ title={
217
+ <Badge badgeContent={assignmentCount} color='primary'>
218
+ <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>
219
+ </Badge>
220
+ }
221
+ ></CardHeader>
222
+ )}
223
+ <List>
224
+ {assignments.map(assignment => (
225
+ <>
226
+ <div className='psdk-todo-avatar-header'>
227
+ <Avatar className={classes.avatar} style={{ marginRight: '16px' }}>
228
+ {currentUserInitials}
229
+ </Avatar>
230
+ <div style={{ display: 'block' }}>
231
+ <Typography variant='h6'>{assignment?.name}</Typography>
232
+ {`Task in ${renderTaskId(
233
+ type,
234
+ getPConnect,
235
+ showTodoList,
236
+ assignment
237
+ )} \u2022 Urgency ${getPriority(assignment)}`}
238
+ </div>
239
+ {!isConfirm && (
240
+ <div style={{ marginLeft: 'auto' }}>
241
+ <IconButton onClick={() => clickGo(assignment)}>
242
+ <ArrowForwardIosOutlinedIcon />
243
+ </IconButton>
244
+ </div>
245
+ )}
246
+ </div>
247
+ </>
248
+ ))}
249
+ </List>
250
+ </>
251
+ );
252
+
206
253
  return (
207
254
  <React.Fragment>
208
255
  {type === CONSTS.WORKLIST && (
@@ -230,72 +277,33 @@ export default function ToDo(props) {
230
277
  primary={getAssignmentName(assignment)}
231
278
  secondary={getListItemComponent(assignment)}
232
279
  />
233
- {type === CONSTS.WORKLIST && (
234
- <ListItemSecondaryAction>
235
- <IconButton onClick={() => clickGo(assignment)}>
236
- <ArrowForwardIosOutlinedIcon />
237
- </IconButton>
238
- </ListItemSecondaryAction>
239
- )}
280
+ <ListItemSecondaryAction>
281
+ <IconButton onClick={() => clickGo(assignment)}>
282
+ <ArrowForwardIosOutlinedIcon />
283
+ </IconButton>
284
+ </ListItemSecondaryAction>
240
285
  </ListItem>
241
286
  ))}
242
287
  </List>
243
288
  </CardContent>
244
- {assignmentCount > 3 && (
245
- <Box display='flex' justifyContent='center'>
246
- {bShowMore ? (
247
- <Button color='primary' onClick={_showMore}>
248
- Show more
249
- </Button>
250
- ) : (
251
- <Button onClick={_showLess}>Show less</Button>
252
- )}
253
- </Box>
254
- )}
255
289
  </Card>
256
290
  )}
257
291
 
258
- {type === CONSTS.TODO && (
259
- <>
260
- {showTodoList && (
261
- <>
262
- <Badge badgeContent={assignmentCount} color='primary'>
263
- <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>
264
- </Badge>
265
- </>
266
- )}
267
- <List>
268
- {assignments.map(assignment => (
269
- <>
270
- <div className='psdk-todo-avatar-header'>
271
- <Avatar className={classes.avatar} style={{ marginRight: '16px' }}>
272
- {currentUserInitials}
273
- </Avatar>
274
- <div style={{ display: 'block' }}>
275
- <Typography variant='h6'>{assignment?.name}</Typography>
276
- {`Task in ${renderTaskId(
277
- type,
278
- getPConnect,
279
- showTodoList,
280
- assignment
281
- )} \u2022 Urgency ${getPriority(assignment)}`}
282
- </div>
283
- </div>
284
- </>
285
- ))}
286
- </List>
287
- {assignmentCount > 3 && (
288
- <Box display='flex' justifyContent='center'>
289
- {bShowMore ? (
290
- <Button color='primary' onClick={_showMore}>
291
- Show more
292
- </Button>
293
- ) : (
294
- <Button onClick={_showLess}>Show less</Button>
295
- )}
296
- </Box>
292
+ {type === CONSTS.TODO && !isConfirm && (
293
+ <Card className={classes.todoWrapper}>{toDoContent}</Card>
294
+ )}
295
+ {type === CONSTS.TODO && isConfirm && <Fragment>{toDoContent}</Fragment>}
296
+
297
+ {assignmentCount > 3 && (
298
+ <Box display='flex' justifyContent='center'>
299
+ {bShowMore ? (
300
+ <Button color='primary' onClick={_showMore}>
301
+ Show more
302
+ </Button>
303
+ ) : (
304
+ <Button onClick={_showLess}>Show less</Button>
297
305
  )}
298
- </>
306
+ </Box>
299
307
  )}
300
308
 
301
309
  <Snackbar
@@ -328,8 +336,9 @@ ToDo.propTypes = {
328
336
  type: PropTypes.string,
329
337
  // pageMessages: PropTypes.arrayOf(PropTypes.any),
330
338
  // eslint-disable-next-line react/no-unused-prop-types
331
- context: PropTypes.string
339
+ context: PropTypes.string,
332
340
  // hideActionButtons: PropTypes.bool
341
+ isConfirm: PropTypes.bool
333
342
  };
334
343
 
335
344
  ToDo.defaultProps = {
@@ -343,6 +352,7 @@ ToDo.defaultProps = {
343
352
  // target: "",
344
353
  type: 'worklist',
345
354
  // pageMessages: null,
346
- context: ''
355
+ context: '',
347
356
  // hideActionButtons: false
357
+ isConfirm: false
348
358
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.20",
3
+ "version": "0.23.22",
4
4
  "description": "React SDK - Code for overriding components",
5
5
  "_filesComment": "During packing, npm ignores everything NOT in the files list",
6
6
  "files": [