@pega/react-sdk-overrides 0.23.6

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.
Files changed (220) hide show
  1. package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.css +19 -0
  2. package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.tsx +156 -0
  3. package/lib/designSystemExtensions/CaseSummaryFields/index.tsx +1 -0
  4. package/lib/designSystemExtensions/DetailsFields/DetailsFields.tsx +154 -0
  5. package/lib/designSystemExtensions/DetailsFields/index.tsx +1 -0
  6. package/lib/designSystemExtensions/FieldGroup/FieldGroup.tsx +113 -0
  7. package/lib/designSystemExtensions/FieldGroup/index.tsx +1 -0
  8. package/lib/designSystemExtensions/FieldGroupList/FieldGroupList.tsx +53 -0
  9. package/lib/designSystemExtensions/FieldGroupList/index.tsx +1 -0
  10. package/lib/designSystemExtensions/FieldValueList/FieldValueList.tsx +106 -0
  11. package/lib/designSystemExtensions/FieldValueList/index.tsx +1 -0
  12. package/lib/designSystemExtensions/Operator/Operator.tsx +195 -0
  13. package/lib/designSystemExtensions/Operator/index.tsx +1 -0
  14. package/lib/designSystemExtensions/Pulse/Pulse.tsx +31 -0
  15. package/lib/designSystemExtensions/Pulse/index.tsx +1 -0
  16. package/lib/forms/AutoComplete/AutoComplete.tsx +183 -0
  17. package/lib/forms/AutoComplete/index.tsx +1 -0
  18. package/lib/forms/CancelAlert/CancelAlert.css +24 -0
  19. package/lib/forms/CancelAlert/CancelAlert.tsx +126 -0
  20. package/lib/forms/CancelAlert/index.tsx +1 -0
  21. package/lib/forms/Checkbox/Checkbox.tsx +68 -0
  22. package/lib/forms/Checkbox/index.tsx +1 -0
  23. package/lib/forms/Currency/Currency.tsx +89 -0
  24. package/lib/forms/Currency/index.tsx +1 -0
  25. package/lib/forms/Date/Date.tsx +79 -0
  26. package/lib/forms/Date/index.tsx +1 -0
  27. package/lib/forms/DateTime/DateTime.tsx +75 -0
  28. package/lib/forms/DateTime/index.tsx +1 -0
  29. package/lib/forms/Decimal/Decimal.tsx +51 -0
  30. package/lib/forms/Decimal/index.tsx +1 -0
  31. package/lib/forms/Dropdown/Dropdown.tsx +82 -0
  32. package/lib/forms/Dropdown/index.tsx +1 -0
  33. package/lib/forms/Email/Email.tsx +68 -0
  34. package/lib/forms/Email/index.tsx +1 -0
  35. package/lib/forms/Integer/Integer.tsx +77 -0
  36. package/lib/forms/Integer/index.tsx +1 -0
  37. package/lib/forms/Percentage/Percentage.tsx +82 -0
  38. package/lib/forms/Percentage/index.tsx +1 -0
  39. package/lib/forms/Phone/Phone.tsx +90 -0
  40. package/lib/forms/Phone/index.tsx +1 -0
  41. package/lib/forms/RadioButtons/RadioButtons.tsx +73 -0
  42. package/lib/forms/RadioButtons/index.tsx +1 -0
  43. package/lib/forms/SemanticLink/SemanticLink.tsx +69 -0
  44. package/lib/forms/SemanticLink/index.tsx +1 -0
  45. package/lib/forms/SemanticLink/utils.ts +51 -0
  46. package/lib/forms/TextArea/TextArea.tsx +66 -0
  47. package/lib/forms/TextArea/index.tsx +1 -0
  48. package/lib/forms/TextContent/TextContent.tsx +40 -0
  49. package/lib/forms/TextContent/index.tsx +1 -0
  50. package/lib/forms/TextInput/TextInput.tsx +61 -0
  51. package/lib/forms/TextInput/index.tsx +1 -0
  52. package/lib/forms/Time/Time.tsx +71 -0
  53. package/lib/forms/Time/index.tsx +1 -0
  54. package/lib/forms/URL/URL.tsx +53 -0
  55. package/lib/forms/URL/index.tsx +1 -0
  56. package/lib/forms/UserReference/UserReference.tsx +197 -0
  57. package/lib/forms/UserReference/UserReferenceUtils.ts +13 -0
  58. package/lib/forms/UserReference/index.tsx +1 -0
  59. package/lib/helpers/auth.js +483 -0
  60. package/lib/helpers/authManager.js +630 -0
  61. package/lib/helpers/config_access.js +268 -0
  62. package/lib/helpers/data_page.ts +24 -0
  63. package/lib/helpers/event-utils.js +20 -0
  64. package/lib/helpers/field-group-utils.js +61 -0
  65. package/lib/helpers/formatters/Boolean.js +38 -0
  66. package/lib/helpers/formatters/Currency.js +74 -0
  67. package/lib/helpers/formatters/CurrencyMap.js +908 -0
  68. package/lib/helpers/formatters/Date.js +77 -0
  69. package/lib/helpers/formatters/common.js +10 -0
  70. package/lib/helpers/formatters/index.js +120 -0
  71. package/lib/helpers/utils.ts +334 -0
  72. package/lib/helpers/versionHelpers.ts +50 -0
  73. package/lib/infra/ActionButtons/ActionButtons.tsx +70 -0
  74. package/lib/infra/ActionButtons/index.tsx +1 -0
  75. package/lib/infra/Assignment/Assignment.tsx +301 -0
  76. package/lib/infra/Assignment/index.tsx +1 -0
  77. package/lib/infra/AssignmentCard/AssignmentCard.tsx +47 -0
  78. package/lib/infra/AssignmentCard/index.tsx +1 -0
  79. package/lib/infra/Attachment/Attachment.css +18 -0
  80. package/lib/infra/Attachment/Attachment.tsx +404 -0
  81. package/lib/infra/Attachment/AttachmentUtils.js +71 -0
  82. package/lib/infra/Attachment/index.tsx +1 -0
  83. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +511 -0
  84. package/lib/infra/Containers/FlowContainer/helpers.js +147 -0
  85. package/lib/infra/Containers/FlowContainer/index.tsx +1 -0
  86. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +320 -0
  87. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -0
  88. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +216 -0
  89. package/lib/infra/Containers/ViewContainer/index.tsx +1 -0
  90. package/lib/infra/DashboardFilter/DashboardFilter.tsx +180 -0
  91. package/lib/infra/DashboardFilter/filterUtils.tsx +188 -0
  92. package/lib/infra/DashboardFilter/index.tsx +1 -0
  93. package/lib/infra/DeferLoad/DeferLoad.tsx +175 -0
  94. package/lib/infra/DeferLoad/index.tsx +1 -0
  95. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +103 -0
  96. package/lib/infra/ErrorBoundary/index.tsx +1 -0
  97. package/lib/infra/MultiStep/MultiStep.css +261 -0
  98. package/lib/infra/MultiStep/MultiStep.tsx +225 -0
  99. package/lib/infra/MultiStep/index.tsx +1 -0
  100. package/lib/infra/NavBar/NavBar.css +170 -0
  101. package/lib/infra/NavBar/NavBar.tsx +393 -0
  102. package/lib/infra/NavBar/index.tsx +1 -0
  103. package/lib/infra/Reference/Reference.tsx +58 -0
  104. package/lib/infra/Reference/index.tsx +1 -0
  105. package/lib/infra/Region/Region.tsx +17 -0
  106. package/lib/infra/Region/index.tsx +1 -0
  107. package/lib/infra/RootContainer/RootContainer.tsx +336 -0
  108. package/lib/infra/RootContainer/index.tsx +1 -0
  109. package/lib/infra/Stages/Stages.tsx +120 -0
  110. package/lib/infra/Stages/index.tsx +1 -0
  111. package/lib/infra/ToDo/ToDo.css +87 -0
  112. package/lib/infra/ToDo/ToDo.tsx +285 -0
  113. package/lib/infra/ToDo/index.tsx +1 -0
  114. package/lib/infra/VerticalTabs/LeftAlignVerticalTab.tsx +27 -0
  115. package/lib/infra/VerticalTabs/VerticalTabs.tsx +75 -0
  116. package/lib/infra/VerticalTabs/index.tsx +1 -0
  117. package/lib/infra/View/View.css +8 -0
  118. package/lib/infra/View/View.tsx +175 -0
  119. package/lib/infra/View/index.tsx +1 -0
  120. package/lib/templates/AppShell/AppShell.css +40 -0
  121. package/lib/templates/AppShell/AppShell.tsx +439 -0
  122. package/lib/templates/AppShell/index.tsx +1 -0
  123. package/lib/templates/CaseSummary/CaseSummary.tsx +50 -0
  124. package/lib/templates/CaseSummary/index.tsx +1 -0
  125. package/lib/templates/CaseView/CaseView.tsx +261 -0
  126. package/lib/templates/CaseView/CaseViewActionsMenu.tsx +73 -0
  127. package/lib/templates/CaseView/index.tsx +1 -0
  128. package/lib/templates/DataReference/DataReference.tsx +290 -0
  129. package/lib/templates/DataReference/index.tsx +1 -0
  130. package/lib/templates/DefaultForm/DefaultForm.css +25 -0
  131. package/lib/templates/DefaultForm/DefaultForm.tsx +52 -0
  132. package/lib/templates/DefaultForm/index.tsx +1 -0
  133. package/lib/templates/Details/Details/Details.tsx +35 -0
  134. package/lib/templates/Details/Details/index.tsx +1 -0
  135. package/lib/templates/Details/DetailsSubTabs/DetailsSubTabs.tsx +65 -0
  136. package/lib/templates/Details/DetailsSubTabs/index.tsx +1 -0
  137. package/lib/templates/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +45 -0
  138. package/lib/templates/Details/DetailsThreeColumn/index.tsx +1 -0
  139. package/lib/templates/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +43 -0
  140. package/lib/templates/Details/DetailsTwoColumn/index.tsx +1 -0
  141. package/lib/templates/FieldGroupTemplate/FieldGroupTemplate.tsx +94 -0
  142. package/lib/templates/FieldGroupTemplate/index.tsx +1 -0
  143. package/lib/templates/InlineDashboard/InlineDashboard.tsx +72 -0
  144. package/lib/templates/InlineDashboard/index.tsx +1 -0
  145. package/lib/templates/InlineDashboardPage/InlineDashboardPage.tsx +41 -0
  146. package/lib/templates/InlineDashboardPage/index.tsx +1 -0
  147. package/lib/templates/ListPage/ListPage.tsx +20 -0
  148. package/lib/templates/ListPage/index.tsx +1 -0
  149. package/lib/templates/ListView/ListView.css +10 -0
  150. package/lib/templates/ListView/ListView.tsx +1230 -0
  151. package/lib/templates/ListView/index.tsx +1 -0
  152. package/lib/templates/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +42 -0
  153. package/lib/templates/MultiReferenceReadOnly/index.tsx +1 -0
  154. package/lib/templates/NarrowWide/NarrowWide/NarrowWide.css +21 -0
  155. package/lib/templates/NarrowWide/NarrowWide/NarrowWide.tsx +35 -0
  156. package/lib/templates/NarrowWide/NarrowWide/index.tsx +1 -0
  157. package/lib/templates/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +53 -0
  158. package/lib/templates/NarrowWide/NarrowWideDetails/index.tsx +1 -0
  159. package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.css +21 -0
  160. package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +24 -0
  161. package/lib/templates/NarrowWide/NarrowWideForm/index.tsx +1 -0
  162. package/lib/templates/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +38 -0
  163. package/lib/templates/NarrowWide/NarrowWidePage/index.tsx +1 -0
  164. package/lib/templates/OneColumn/OneColumn/OneColumn.tsx +32 -0
  165. package/lib/templates/OneColumn/OneColumn/index.tsx +1 -0
  166. package/lib/templates/OneColumn/OneColumnPage/OneColumnPage.tsx +24 -0
  167. package/lib/templates/OneColumn/OneColumnPage/index.tsx +1 -0
  168. package/lib/templates/OneColumn/OneColumnTab/OneColumnTab.tsx +17 -0
  169. package/lib/templates/OneColumn/OneColumnTab/index.tsx +1 -0
  170. package/lib/templates/PromotedFilters/PromotedFilters.css +7 -0
  171. package/lib/templates/PromotedFilters/PromotedFilters.tsx +160 -0
  172. package/lib/templates/PromotedFilters/index.tsx +1 -0
  173. package/lib/templates/SimpleTable/SimpleTable/SimpleTable.tsx +28 -0
  174. package/lib/templates/SimpleTable/SimpleTable/index.tsx +1 -0
  175. package/lib/templates/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +719 -0
  176. package/lib/templates/SimpleTable/SimpleTableManual/index.tsx +1 -0
  177. package/lib/templates/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +129 -0
  178. package/lib/templates/SimpleTable/SimpleTableSelect/index.tsx +1 -0
  179. package/lib/templates/SimpleTable/helpers.ts +360 -0
  180. package/lib/templates/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +66 -0
  181. package/lib/templates/SingleReferenceReadOnly/index.tsx +1 -0
  182. package/lib/templates/SubTabs/SubTabs.tsx +65 -0
  183. package/lib/templates/SubTabs/index.tsx +1 -0
  184. package/lib/templates/SubTabs/tabUtils.ts +73 -0
  185. package/lib/templates/TwoColumn/TwoColumn/TwoColumn.css +13 -0
  186. package/lib/templates/TwoColumn/TwoColumn/TwoColumn.tsx +58 -0
  187. package/lib/templates/TwoColumn/TwoColumn/index.tsx +1 -0
  188. package/lib/templates/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +25 -0
  189. package/lib/templates/TwoColumn/TwoColumnPage/index.tsx +1 -0
  190. package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
  191. package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +55 -0
  192. package/lib/templates/TwoColumn/TwoColumnTab/index.tsx +1 -0
  193. package/lib/templates/WideNarrow/WideNarrow/WideNarrow.css +21 -0
  194. package/lib/templates/WideNarrow/WideNarrow/WideNarrow.tsx +35 -0
  195. package/lib/templates/WideNarrow/WideNarrow/index.tsx +1 -0
  196. package/lib/templates/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +54 -0
  197. package/lib/templates/WideNarrow/WideNarrowDetails/index.tsx +1 -0
  198. package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.css +21 -0
  199. package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +24 -0
  200. package/lib/templates/WideNarrow/WideNarrowForm/index.tsx +1 -0
  201. package/lib/templates/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +38 -0
  202. package/lib/templates/WideNarrow/WideNarrowPage/index.tsx +1 -0
  203. package/lib/templates/utils.ts +23 -0
  204. package/lib/widgets/AppAnnouncement/AppAnnouncement.tsx +67 -0
  205. package/lib/widgets/AppAnnouncement/index.tsx +1 -0
  206. package/lib/widgets/CaseHistory/CaseHistory.tsx +169 -0
  207. package/lib/widgets/CaseHistory/index.tsx +1 -0
  208. package/lib/widgets/FileUtility/ActionButtonsForFileUtil.css +27 -0
  209. package/lib/widgets/FileUtility/ActionButtonsForFileUtil.tsx +22 -0
  210. package/lib/widgets/FileUtility/FileUtility.css +117 -0
  211. package/lib/widgets/FileUtility/FileUtility.tsx +567 -0
  212. package/lib/widgets/FileUtility/index.tsx +0 -0
  213. package/lib/widgets/Followers/Followers.tsx +43 -0
  214. package/lib/widgets/Followers/index.tsx +1 -0
  215. package/lib/widgets/SummaryItem/SummaryItem.css +78 -0
  216. package/lib/widgets/SummaryItem/SummaryItem.tsx +80 -0
  217. package/lib/widgets/SummaryItem/index.tsx +1 -0
  218. package/lib/widgets/SummaryList/SummaryList.tsx +12 -0
  219. package/lib/widgets/SummaryList/index.tsx +1 -0
  220. package/package.json +14 -0
@@ -0,0 +1,285 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
4
+ import {
5
+ Box,
6
+ Button,
7
+ Card,
8
+ CardContent,
9
+ CardHeader,
10
+ Avatar,
11
+ Typography,
12
+ Badge,
13
+ List,
14
+ ListItem,
15
+ ListItemText,
16
+ ListItemSecondaryAction
17
+ } from '@material-ui/core';
18
+ import Snackbar from '@material-ui/core/Snackbar';
19
+ import IconButton from '@material-ui/core/IconButton';
20
+ import CloseIcon from '@material-ui/icons/Close';
21
+
22
+ import ArrowForwardIosOutlinedIcon from '@material-ui/icons/ArrowForwardIosOutlined';
23
+ import { makeStyles } from '@material-ui/core/styles';
24
+ import { useTheme } from '@material-ui/core/styles';
25
+ import useMediaQuery from '@material-ui/core/useMediaQuery';
26
+
27
+ import './ToDo.css';
28
+
29
+ declare const PCore: any;
30
+
31
+ const isChildCase = (assignment) => {
32
+ return assignment.isChild;
33
+ };
34
+
35
+ function topThreeAssignments(assignmentsSource: Array<any>): Array<any> {
36
+ return Array.isArray(assignmentsSource) ? assignmentsSource.slice(0, 3) : [];
37
+ }
38
+
39
+ function getID(assignment: any) {
40
+ if (assignment.value) {
41
+ const refKey = assignment.value;
42
+ return refKey.substring(refKey.lastIndexOf(' ') + 1);
43
+ } else {
44
+ const refKey = assignment.ID;
45
+ const arKeys = refKey.split('!')[0].split(' ');
46
+ return arKeys[2];
47
+ }
48
+ }
49
+
50
+ const useStyles = makeStyles(theme => ({
51
+ root: {
52
+ marginTop: theme.spacing(1),
53
+ marginBottom: theme.spacing(1),
54
+ paddingBottom: theme.spacing(1),
55
+ borderLeft: '6px solid',
56
+ borderLeftColor: theme.palette.primary.light
57
+ },
58
+ avatar: {
59
+ backgroundColor: theme.palette.primary.light,
60
+ color: theme.palette.getContrastText(theme.palette.primary.light)
61
+ }
62
+ }));
63
+
64
+ export default function ToDo(props) {
65
+ const { datasource, getPConnect, headerText, showTodoList, myWorkList, type } = props;
66
+
67
+ const CONSTS = PCore.getConstants();
68
+
69
+ const bLogging = true;
70
+ let assignmentCount = 0;
71
+ const currentUser = PCore.getEnvironmentInfo().getOperatorName();
72
+ const currentUserInitials = Utils.getInitials(currentUser);
73
+ const assignmentsSource = datasource?.source || myWorkList?.source;
74
+
75
+ const [bShowMore, setBShowMore] = useState(true);
76
+ const [showSnackbar, setShowSnackbar] = useState(false);
77
+ const [snackbarMessage, setSnackbarMessage]: any = useState('');
78
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
79
+ const [assignments, setAssignments] = useState<Array<any>>(initAssignments());
80
+
81
+ const thePConn = getPConnect();
82
+ const classes = useStyles();
83
+ const theme = useTheme();
84
+ const isDesktop = useMediaQuery(theme.breakpoints.up('md'));
85
+ // const { setOpen } = useNavBar();
86
+
87
+ function initAssignments(): Array<any> {
88
+ if (assignmentsSource) {
89
+ assignmentCount = assignmentsSource.length;
90
+ return topThreeAssignments(assignmentsSource);
91
+ } else {
92
+ // turn off todolist
93
+ return [];
94
+ }
95
+ }
96
+
97
+ const getAssignmentId = assignment => {
98
+ return type === CONSTS.TODO ? assignment.ID : assignment.id;
99
+ };
100
+
101
+ const getPriority = assignment => {
102
+ return type === CONSTS.TODO ? assignment.urgency : assignment.priority;
103
+ };
104
+
105
+ const getAssignmentName = assignment => {
106
+ return type === CONSTS.TODO ? assignment.name : assignment.stepName;
107
+ };
108
+
109
+ function showToast(message: string) {
110
+ const theMessage = `Assignment: ${message}`;
111
+ // eslint-disable-next-line no-console
112
+ console.error(theMessage);
113
+ setSnackbarMessage(message);
114
+ setShowSnackbar(true);
115
+ }
116
+
117
+ function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
118
+ if (reason === 'clickaway') {
119
+ return;
120
+ }
121
+ setShowSnackbar(false);
122
+ }
123
+
124
+ function _showMore() {
125
+ setBShowMore(false);
126
+ setAssignments(assignmentsSource);
127
+ }
128
+
129
+ function _showLess() {
130
+ setBShowMore(true);
131
+ setAssignments(topThreeAssignments(assignmentsSource));
132
+ }
133
+
134
+ function clickGo(assignment) {
135
+ const id = getAssignmentId(assignment);
136
+ let { classname = '' } = assignment;
137
+ const sTarget = thePConn.getContainerName();
138
+ const sTargetContainerName = sTarget;
139
+
140
+ const options = { containerName: sTargetContainerName };
141
+
142
+ if (classname === null || classname === '') {
143
+ classname = thePConn.getCaseInfo().getClassName();
144
+ }
145
+
146
+ if (sTarget === 'workarea') {
147
+ options['isActionFromToDoList'] = true;
148
+ options['target'] = '';
149
+ options['context'] = null;
150
+ options['isChild'] = isChildCase(assignment);
151
+ } else {
152
+ options['isActionFromToDoList'] = false;
153
+ options['target'] = sTarget;
154
+ }
155
+
156
+ thePConn
157
+ .getActionsApi()
158
+ .openAssignment(id, classname, options)
159
+ .then(() => {
160
+ if (bLogging) {
161
+ // eslint-disable-next-line no-console
162
+ console.log(`openAssignment completed`);
163
+ }
164
+ })
165
+ .catch(() => {
166
+ showToast(`Submit failed!`);
167
+ });
168
+ }
169
+
170
+ const getListItemComponent = assignment => {
171
+ if (isDesktop) {
172
+ return (
173
+ <>
174
+ Task in
175
+ <Button size='small' color='primary'>{`${assignment.name} ${getID(assignment)}`}</Button>
176
+ {` \u2022 `}
177
+ <span className='psdk-todo-assignment-status'>{assignment.status}</span>
178
+ {` \u2022 Urgency ${getPriority(assignment)}`}
179
+ </>
180
+ );
181
+ }
182
+ return (
183
+ <>
184
+ <Button size='small' color='primary'>{`${assignment.name} ${getID(assignment)}`}</Button>
185
+ {` \u2022 Urgency ${getPriority(assignment)}`}
186
+ </>
187
+ );
188
+ };
189
+
190
+ return (
191
+ <React.Fragment>
192
+ <Card className={classes.root}>
193
+ {showTodoList && (
194
+ <CardHeader
195
+ title={
196
+ <Badge badgeContent={assignmentCount} color='primary'>
197
+ <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>
198
+ </Badge>
199
+ }
200
+ avatar={<Avatar className={classes.avatar}>{currentUserInitials}</Avatar>}
201
+ ></CardHeader>
202
+ )}
203
+ <CardContent>
204
+ <List>
205
+ {assignments.map(assignment => (
206
+ <ListItem
207
+ key={getAssignmentId(assignment)}
208
+ dense
209
+ divider
210
+ onClick={() => clickGo(assignment)}
211
+ >
212
+ <ListItemText
213
+ primary={getAssignmentName(assignment)}
214
+ secondary={getListItemComponent(assignment)}
215
+ />
216
+ <ListItemSecondaryAction>
217
+ <IconButton onClick={() => clickGo(assignment)}>
218
+ <ArrowForwardIosOutlinedIcon />
219
+ </IconButton>
220
+ </ListItemSecondaryAction>
221
+ </ListItem>
222
+ ))}
223
+ </List>
224
+ </CardContent>
225
+ {assignmentCount > 3 && (
226
+ <Box display='flex' justifyContent='center'>
227
+ {bShowMore ? (
228
+ <Button color='primary' onClick={_showMore}>
229
+ Show more
230
+ </Button>
231
+ ) : (
232
+ <Button onClick={_showLess}>Show less</Button>
233
+ )}
234
+ </Box>
235
+ )}
236
+ </Card>
237
+
238
+ <Snackbar
239
+ open={showSnackbar}
240
+ autoHideDuration={3000}
241
+ onClose={handleSnackbarClose}
242
+ message={snackbarMessage}
243
+ action={
244
+ <IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
245
+ <CloseIcon fontSize='small' />
246
+ </IconButton>
247
+ }
248
+ />
249
+ </React.Fragment>
250
+ );
251
+ }
252
+
253
+ ToDo.propTypes = {
254
+ datasource: PropTypes.instanceOf(Object),
255
+ myWorkList: PropTypes.instanceOf(Object),
256
+ // eslint-disable-next-line react/no-unused-prop-types
257
+ caseInfoID: PropTypes.string,
258
+ // buildName: PropTypes.string,
259
+ getPConnect: PropTypes.func.isRequired,
260
+ headerText: PropTypes.string,
261
+ // eslint-disable-next-line react/no-unused-prop-types
262
+ itemKey: PropTypes.string,
263
+ showTodoList: PropTypes.bool,
264
+ // target: PropTypes.string,
265
+ type: PropTypes.string,
266
+ // pageMessages: PropTypes.arrayOf(PropTypes.any),
267
+ // eslint-disable-next-line react/no-unused-prop-types
268
+ context: PropTypes.string
269
+ // hideActionButtons: PropTypes.bool
270
+ };
271
+
272
+ ToDo.defaultProps = {
273
+ caseInfoID: '',
274
+ datasource: [],
275
+ myWorkList: {},
276
+ // buildName: "",
277
+ headerText: 'To do',
278
+ itemKey: '',
279
+ showTodoList: true,
280
+ // target: "",
281
+ type: 'worklist',
282
+ // pageMessages: null,
283
+ context: ''
284
+ // hideActionButtons: false
285
+ };
@@ -0,0 +1 @@
1
+ export { default } from './ToDo';
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { withStyles } from '@material-ui/core/styles'
3
+ import {
4
+ Tab,
5
+ Divider,
6
+ } from '@material-ui/core';
7
+
8
+ // LeftAlignVerticalTab is a specialized Tab that has styles to make it
9
+ // left aligned and full width of the container Tabs
10
+
11
+ // Aligning the Tab labels left (with & .<class name> syntax) inspired by:
12
+ // https://stackoverflow.com/questions/63307723/how-to-modify-the-wrapper-css-rule-of-a-tabs-component-to-make-the-text-aligned
13
+
14
+ // In this styling, "root" is the top-level "Tab" object (which is the button)
15
+ // and the button contains spans that will match on the '> span'
16
+ const LeftAlignVerticalTab: any = withStyles((/* theme */) => ({
17
+ root: {
18
+ width: '100%',
19
+ maxWidth: '100%',
20
+ },
21
+ wrapper: {
22
+ display: 'block',
23
+ textAlign: 'left',
24
+ },
25
+ }))((props) => <div><Tab {...props} /><Divider /></div>);
26
+
27
+ export default LeftAlignVerticalTab;
@@ -0,0 +1,75 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { makeStyles } from '@material-ui/core/styles'
4
+
5
+ import Tabs from '@material-ui/core/Tabs';
6
+ import LeftAlignVerticalTab from './LeftAlignVerticalTab';
7
+
8
+
9
+ // The MuiTabs-indicator class is in a span whose parent is div (under the Tabs root component)
10
+ // So, we're going to make the selected vertical tab indicator use a color from our theme.
11
+ const useStyles = makeStyles((theme) => (
12
+ {
13
+ tabs: {
14
+ '& div > span': {
15
+ backgroundColor: theme.palette.info.dark,
16
+ width: "3px"
17
+ },
18
+ },
19
+ }));
20
+
21
+ // Implementation of custom event inspired by:
22
+ // https://betterprogramming.pub/master-your-react-skills-with-event-listeners-ebc01dde4fad
23
+ const createCustomEvent = (eventName: string, additionalData: {[key: string]: string}): CustomEvent | null => {
24
+ if (window) {
25
+ return new CustomEvent(eventName, {
26
+ detail: { additionalData }
27
+ });
28
+ }
29
+
30
+ return null;
31
+ };
32
+
33
+
34
+ export default function VerticalTabs(props) {
35
+ // Get a React warning when we use tabConfig as mixed case. So all lowercase tabconfig
36
+ const { tabconfig } = props;
37
+ const classes = useStyles();
38
+ const [value, setValue] = useState(0);
39
+
40
+ useEffect(() => {
41
+
42
+ const eventData = {"itemClicked": value.toString()};
43
+ const myEvent = createCustomEvent('VerticalTabClick', eventData);
44
+
45
+ if (myEvent !== null) {
46
+ document.dispatchEvent( myEvent );
47
+ }
48
+
49
+ }, [value]);
50
+
51
+ const handleChange = (event: React.ChangeEvent<{}>, newValue: number) => {
52
+ setValue(newValue);
53
+ };
54
+
55
+ return (
56
+ <div id="VerticalTabs">
57
+ {/* VerticalTabs: {JSON.stringify(tabconfig)} */}
58
+ <Tabs
59
+ className={classes.tabs}
60
+ orientation="vertical"
61
+ value={value}
62
+ onChange={handleChange}>
63
+ {tabconfig.map((tab) => <LeftAlignVerticalTab {...props} label={tab.name} key={tab.name} />)}
64
+ </Tabs>
65
+ </div>
66
+ )
67
+ }
68
+
69
+ VerticalTabs.defaultProps = {
70
+ tabconfig: []
71
+ };
72
+
73
+ VerticalTabs.propTypes = {
74
+ tabconfig: PropTypes.arrayOf(PropTypes.object)
75
+ };
@@ -0,0 +1 @@
1
+ export { default } from './VerticalTabs';
@@ -0,0 +1,8 @@
1
+ .template-title-container {
2
+ display: flex;
3
+ justify-content: space-between;
4
+ align-items: center;
5
+ font-size: calc(0.9375rem);
6
+ font-weight: 600;
7
+ margin-bottom: 5px;
8
+ }
@@ -0,0 +1,175 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ // import { FieldGroup } from "@pega/cosmos-react-core";
4
+ // import { LazyMap as LazyComponentMap } from "../../components_map";
5
+
6
+ import { SdkComponentMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ import ErrorBoundary from '@pega/react-sdk-components/lib/components/infra/ErrorBoundary';
8
+
9
+ import { getAllFields } from '@pega/react-sdk-components/lib/components/templates/utils';
10
+
11
+ // Need to import any templates that we might render
12
+
13
+ import './View.css';
14
+ //
15
+ // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
16
+ // Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
17
+ // is totally at your own risk.
18
+ //
19
+
20
+ const FORMTEMPLATES = ['OneColumn', 'TwoColumn', 'DefaultForm', 'WideNarrow', 'NarrowWide'];
21
+
22
+ export default function View(props) {
23
+ const { children, template, getPConnect, mode } = props;
24
+ let { label, showLabel = false } = props;
25
+
26
+ // Get the inherited props from the parent to determine label settings. For 8.6, this is only for embedded data form views
27
+ // Putting this logic here instead of copy/paste in every Form template index.js
28
+
29
+ const inheritedProps = getPConnect().getInheritedProps();
30
+ label = inheritedProps.label || label;
31
+ showLabel = inheritedProps.showLabel || showLabel;
32
+
33
+ const isEmbeddedDataView = mode === 'editable'; // would be better to check the reference child for `context` attribute if possible
34
+ if (isEmbeddedDataView && showLabel === undefined) {
35
+ showLabel = true;
36
+ }
37
+
38
+ // As long as the template is defined in the dependencies of the view
39
+ // it will be loaded, otherwise fall back to single column
40
+ // JA - React SDK not using LazyComponentMap yet
41
+ if (template /* && LazyComponentMap[template] */) {
42
+ // const ViewTemplate = LazyComponentMap[template];
43
+ let ViewTemplate: any;
44
+
45
+ if (SdkComponentMap) {
46
+ // This is the node_modules version of react_pconnect!
47
+ const theLocalComponent = SdkComponentMap.getLocalComponentMap()[template];
48
+ if ( theLocalComponent !== undefined) {
49
+ // eslint-disable-next-line no-console
50
+ console.log(`View component found ${template}: Local`);
51
+ ViewTemplate = theLocalComponent
52
+ } else {
53
+ const thePegaProvidedComponent = SdkComponentMap.getPegaProvidedComponentMap()[template];
54
+ if ( thePegaProvidedComponent !== undefined) {
55
+ // console.log(`View component found ${template}: Pega-provided`);
56
+ ViewTemplate = thePegaProvidedComponent;
57
+ } else {
58
+ // eslint-disable-next-line no-console
59
+ console.error(`View component can't find template type ${template}`);
60
+ ViewTemplate = ErrorBoundary;
61
+ }
62
+ }
63
+
64
+ if (template === "ListView") {
65
+ // special case for ListView - add in a prop
66
+ const bInForm = true;
67
+ props = { ...props, bInForm};
68
+ }
69
+ } else {
70
+
71
+ // eslint-disable-next-line no-console
72
+ console.warn(`View: SdkComponentMap expected but not found.`)
73
+
74
+ // eslint-disable-next-line no-console
75
+ console.error(`View: Trying to render an unknown template: ${template}`);
76
+
77
+ }
78
+
79
+ // for debugging/investigation
80
+ // console.log(`View rendering template: ${template}`);
81
+
82
+ // spreading because all props should go to the template
83
+ let RenderedTemplate = <ViewTemplate {...props}>{children}</ViewTemplate>;
84
+
85
+ if (FORMTEMPLATES.includes(template) && showLabel) {
86
+ // Original:
87
+ // RenderedTemplate = (
88
+ // <FieldGroup name={label} style={{ marginBlockStart: "1rem" }}>
89
+ // {RenderedTemplate}
90
+ // </FieldGroup>
91
+ // );
92
+ RenderedTemplate = (
93
+ <div
94
+ data-name='RenderedTemplate'
95
+ data-template-type={template}
96
+ /* name */ id='label'
97
+ style={{ marginBlockStart: '1rem' }}
98
+ className='grid-column'
99
+ >
100
+ {RenderedTemplate}
101
+ </div>
102
+ );
103
+ }
104
+
105
+ return (
106
+ <div className='grid-column'>
107
+ {showLabel && template !== 'SubTabs' && template !== 'SimpleTable' && (
108
+ <div className='template-title-container'>
109
+ <span>{label}</span>
110
+ </div>
111
+ )}
112
+ {RenderedTemplate}
113
+ </div>
114
+ );
115
+ }
116
+
117
+ // debugging/investigation help
118
+ // console.log(`View about to render React.Fragment for children: ${children}`);
119
+
120
+ if (children) {
121
+ return <>{children}</>;
122
+ } else {
123
+ return <div id='View'>View has no children.</div>;
124
+ }
125
+ }
126
+
127
+ View.defaultProps = {
128
+ label: undefined,
129
+ showLabel: undefined,
130
+ mode: undefined
131
+ };
132
+
133
+ View.propTypes = {
134
+ children: PropTypes.oneOfType([
135
+ PropTypes.arrayOf(PropTypes.node),
136
+ PropTypes.array
137
+ ]) /* array might be empty */,
138
+ template: PropTypes.string /* .isRequired */,
139
+ getPConnect: PropTypes.func.isRequired,
140
+ label: PropTypes.string,
141
+ showLabel: PropTypes.bool,
142
+ mode: PropTypes.string,
143
+ title: PropTypes.string
144
+ };
145
+
146
+ // Adapted from Nebula/Constellation to add in additional props for some templates
147
+ View.additionalProps = (state, getPConnect) => {
148
+ const thePConn = getPConnect();
149
+ const { template } = thePConn.getConfigProps();
150
+
151
+ let propObj = {};
152
+ let allFields = {};
153
+
154
+ switch (template) {
155
+ case 'CaseSummary':
156
+ allFields = getAllFields(thePConn);
157
+ // eslint-disable-next-line no-case-declarations
158
+ const unresFields = {
159
+ primaryFields: allFields[0],
160
+ secondaryFields: allFields[1]
161
+ };
162
+ propObj = thePConn.resolveConfigProps(unresFields);
163
+ break;
164
+
165
+ case 'Details':
166
+ allFields = getAllFields(thePConn);
167
+ propObj = { fields: allFields[0] };
168
+ break;
169
+
170
+ default:
171
+ break;
172
+ }
173
+
174
+ return propObj;
175
+ };
@@ -0,0 +1 @@
1
+ export { default } from './View';
@@ -0,0 +1,40 @@
1
+ .appshell-top {
2
+ display: flex;
3
+ background-color: var(--app-background-color);
4
+ }
5
+
6
+
7
+ .appshell-main {
8
+ position: relative;
9
+ min-height: 100vh;
10
+ display: block;
11
+ width: 100%;
12
+ }
13
+
14
+ .psdk-icon {
15
+ padding: 0rem 0.125rem;
16
+ min-width: unset;
17
+ }
18
+
19
+ .progress-box {
20
+ display: flex;
21
+ flex-direction: column;
22
+ justify-content: center;
23
+ align-items: center;
24
+ height: 100%;
25
+ width: 100%;
26
+ background-color: whitesmoke;
27
+ position: fixed;
28
+ z-index: 999;
29
+ top: 0rem;
30
+ left: 0rem;
31
+ opacity: 0.5;
32
+ }
33
+
34
+ .progress-spinner {
35
+ text-align: center;
36
+ }
37
+
38
+ ::ng-deep snack-bar-container.snackbar-newline {
39
+ white-space: pre-line;
40
+ }