@pega/react-sdk-overrides 0.24.3 → 0.242.1

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 (78) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +1 -1
  2. package/lib/designSystemExtension/Banner/Banner.tsx +1 -1
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +11 -2
  4. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +3 -3
  5. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +4 -4
  6. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
  7. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +3 -3
  8. package/lib/designSystemExtension/Operator/Operator.tsx +6 -5
  9. package/lib/designSystemExtension/Pulse/Pulse.tsx +2 -2
  10. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
  11. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
  12. package/lib/field/AutoComplete/AutoComplete.tsx +3 -3
  13. package/lib/field/CancelAlert/CancelAlert.tsx +3 -3
  14. package/lib/field/Checkbox/Checkbox.tsx +3 -3
  15. package/lib/field/Currency/Currency.tsx +1 -1
  16. package/lib/field/Date/Date.tsx +22 -41
  17. package/lib/field/DateTime/DateTime.tsx +22 -34
  18. package/lib/field/Decimal/Decimal.tsx +1 -1
  19. package/lib/field/Dropdown/Dropdown.tsx +2 -2
  20. package/lib/field/Email/Email.tsx +2 -2
  21. package/lib/field/Group/Group.tsx +1 -1
  22. package/lib/field/Integer/Integer.tsx +1 -1
  23. package/lib/field/Multiselect/Multiselect.tsx +8 -14
  24. package/lib/field/Percentage/Percentage.tsx +2 -2
  25. package/lib/field/Phone/Phone.tsx +17 -8
  26. package/lib/field/RadioButtons/RadioButtons.tsx +2 -2
  27. package/lib/field/SemanticLink/SemanticLink.tsx +3 -3
  28. package/lib/field/TextArea/TextArea.tsx +1 -1
  29. package/lib/field/TextContent/TextContent.tsx +1 -1
  30. package/lib/field/TextInput/TextInput.tsx +1 -1
  31. package/lib/field/Time/Time.tsx +19 -15
  32. package/lib/field/URL/URL.tsx +1 -1
  33. package/lib/field/UserReference/UserReference.tsx +1 -1
  34. package/lib/helpers/simpleTableHelpers.ts +1 -1
  35. package/lib/infra/ActionButtons/ActionButtons.tsx +3 -3
  36. package/lib/infra/Assignment/Assignment.tsx +35 -5
  37. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +8 -9
  38. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +2 -2
  39. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +8 -8
  40. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +1 -1
  41. package/lib/infra/DashboardFilter/DashboardFilter.tsx +1 -1
  42. package/lib/infra/DashboardFilter/filterUtils.tsx +2 -1
  43. package/lib/infra/DeferLoad/DeferLoad.tsx +2 -2
  44. package/lib/infra/NavBar/NavBar.tsx +17 -16
  45. package/lib/infra/RootContainer/RootContainer.tsx +5 -6
  46. package/lib/infra/Stages/Stages.tsx +4 -4
  47. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +2 -2
  48. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
  49. package/lib/template/AppShell/AppShell.tsx +21 -2
  50. package/lib/template/CaseView/CaseView.tsx +5 -5
  51. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +7 -7
  52. package/lib/template/Confirmation/Confirmation.tsx +2 -1
  53. package/lib/template/DataReference/DataReference.tsx +1 -1
  54. package/lib/template/Details/Details/Details.tsx +1 -1
  55. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +3 -3
  56. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +1 -1
  57. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +1 -1
  58. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +3 -2
  59. package/lib/template/InlineDashboard/InlineDashboard.tsx +2 -2
  60. package/lib/template/ListView/ListView.tsx +57 -63
  61. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +1 -1
  62. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +2 -2
  63. package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -1
  64. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +29 -25
  65. package/lib/template/SubTabs/SubTabs.tsx +2 -2
  66. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +2 -2
  67. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +2 -2
  68. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +1 -1
  69. package/lib/template/WssNavBar/WssNavBar.tsx +9 -9
  70. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +2 -2
  71. package/lib/widget/Attachment/Attachment.tsx +3 -2
  72. package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
  73. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -1
  74. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +4 -3
  75. package/lib/widget/Followers/Followers.tsx +2 -2
  76. package/lib/widget/SummaryItem/SummaryItem.tsx +3 -2
  77. package/lib/widget/ToDo/ToDo.tsx +85 -21
  78. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-shadow */
2
- import React, { useState } from 'react';
2
+ import React, { useCallback, useEffect, useState } from 'react';
3
3
  import {
4
4
  Box,
5
5
  Button,
@@ -13,19 +13,52 @@ import {
13
13
  ListItem,
14
14
  ListItemText,
15
15
  ListItemSecondaryAction
16
- } from '@material-ui/core';
17
- import Snackbar from '@material-ui/core/Snackbar';
18
- import IconButton from '@material-ui/core/IconButton';
19
- import CloseIcon from '@material-ui/icons/Close';
20
- import ArrowForwardIosOutlinedIcon from '@material-ui/icons/ArrowForwardIosOutlined';
21
- import { makeStyles, useTheme } from '@material-ui/core/styles';
22
- import useMediaQuery from '@material-ui/core/useMediaQuery';
16
+ } from '@mui/material';
17
+ import Snackbar from '@mui/material/Snackbar';
18
+ import IconButton from '@mui/material/IconButton';
19
+ import CloseIcon from '@mui/icons-material/Close';
20
+ import ArrowForwardIosOutlinedIcon from '@mui/icons-material/ArrowForwardIosOutlined';
21
+ import { useTheme } from '@mui/material/styles';
22
+ import makeStyles from '@mui/styles/makeStyles';
23
+ import useMediaQuery from '@mui/material/useMediaQuery';
23
24
 
24
25
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
25
26
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
26
27
 
27
28
  import './ToDo.css';
28
29
 
30
+ const fetchMyWorkList = (datapage, fields, numberOfRecords, includeTotalCount, context) => {
31
+ return PCore.getDataPageUtils()
32
+ .getDataAsync(
33
+ datapage,
34
+ context,
35
+ {},
36
+ {
37
+ pageNumber: 1,
38
+ pageSize: numberOfRecords
39
+ },
40
+ {
41
+ select: Object.keys(fields).map(key => ({ field: PCore.getAnnotationUtils().getPropertyName(fields[key]) }))
42
+ },
43
+ {
44
+ additionalApiParams: {
45
+ includeTotalCount
46
+ }
47
+ }
48
+ )
49
+ .then(response => {
50
+ return {
51
+ ...response,
52
+ data: (Array.isArray(response?.data) ? response.data : []).map(row =>
53
+ Object.keys(fields).reduce((obj, key) => {
54
+ obj[key] = row[PCore.getAnnotationUtils().getPropertyName(fields[key])];
55
+ return obj;
56
+ }, {})
57
+ )
58
+ };
59
+ });
60
+ };
61
+
29
62
  interface ToDoProps extends PConnProps {
30
63
  // If any, enter additional props that only exist on this component
31
64
  datasource?: any;
@@ -37,7 +70,7 @@ interface ToDoProps extends PConnProps {
37
70
  itemKey?: string;
38
71
  showTodoList?: boolean;
39
72
  type?: string;
40
- // eslint-disable-next-line react/no-unused-prop-types
73
+
41
74
  context?: string;
42
75
  isConfirm?: boolean;
43
76
  }
@@ -81,12 +114,20 @@ const useStyles = makeStyles(theme => ({
81
114
  }));
82
115
 
83
116
  export default function ToDo(props: ToDoProps) {
84
- const { getPConnect, datasource = [], headerText = 'To do', showTodoList = true, myWorkList = {}, type = 'worklist', isConfirm = false } = props;
117
+ const {
118
+ getPConnect,
119
+ context,
120
+ datasource = [],
121
+ headerText = 'To do',
122
+ showTodoList = true,
123
+ myWorkList = {},
124
+ type = 'worklist',
125
+ isConfirm = false
126
+ } = props;
85
127
 
86
128
  const CONSTS = PCore.getConstants();
87
129
 
88
130
  const bLogging = true;
89
- let assignmentCount = 0;
90
131
  const currentUser = PCore.getEnvironmentInfo().getOperatorName();
91
132
  const currentUserInitials = Utils.getInitials(currentUser);
92
133
  const assignmentsSource = datasource?.source || myWorkList?.source;
@@ -106,17 +147,34 @@ export default function ToDo(props: ToDoProps) {
106
147
  const showlessLocalizedValue = localizedVal('show_less', 'CosmosFields');
107
148
  const showMoreLocalizedValue = localizedVal('show_more', 'CosmosFields');
108
149
  const canPerform = assignments?.[0]?.canPerform === 'true' || assignments?.[0]?.canPerform === true;
109
- // const { setOpen } = useNavBar();
150
+ const [count, setCount] = useState(null);
151
+
152
+ const {
153
+ WORK_BASKET: { MY_WORK_LIST }
154
+ } = PCore.getConstants();
110
155
 
111
156
  function initAssignments(): any[] {
112
157
  if (assignmentsSource) {
113
- assignmentCount = assignmentsSource.length;
114
158
  return topThreeAssignments(assignmentsSource);
115
159
  }
116
160
  // turn off todolist
117
161
  return [];
118
162
  }
119
163
 
164
+ const deferLoadWorklistItems = useCallback(
165
+ responseData => {
166
+ setCount(responseData.totalCount);
167
+ setAssignments(responseData.data);
168
+ },
169
+ [MY_WORK_LIST]
170
+ );
171
+
172
+ useEffect(() => {
173
+ fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, 3, true, context).then(responseData => {
174
+ deferLoadWorklistItems(responseData);
175
+ });
176
+ }, []);
177
+
120
178
  const getAssignmentId = assignment => {
121
179
  return type === CONSTS.TODO ? assignment.ID : assignment.id;
122
180
  };
@@ -137,7 +195,7 @@ export default function ToDo(props: ToDoProps) {
137
195
  setShowSnackbar(true);
138
196
  }
139
197
 
140
- function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
198
+ function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {
141
199
  if (reason === 'clickaway') {
142
200
  return;
143
201
  }
@@ -146,12 +204,16 @@ export default function ToDo(props: ToDoProps) {
146
204
 
147
205
  function _showMore() {
148
206
  setBShowMore(false);
149
- setAssignments(assignmentsSource);
207
+ if (type === CONSTS.WORKLIST && count && count > assignments.length) {
208
+ fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, count, false, context).then(response => {
209
+ setAssignments(response.data);
210
+ });
211
+ }
150
212
  }
151
213
 
152
214
  function _showLess() {
153
215
  setBShowMore(true);
154
- setAssignments(topThreeAssignments(assignmentsSource));
216
+ setAssignments(assignments => assignments.slice(0, 3));
155
217
  }
156
218
 
157
219
  function clickGo(assignment) {
@@ -223,12 +285,14 @@ export default function ToDo(props: ToDoProps) {
223
285
  );
224
286
  };
225
287
 
288
+ const getCount = () => (type === CONSTS.WORKLIST ? (count ?? assignments.length) : assignments.length);
289
+
226
290
  const toDoContent = (
227
291
  <>
228
292
  {showTodoList && (
229
293
  <CardHeader
230
294
  title={
231
- <Badge badgeContent={assignmentCount} overlap='rectangular' color='primary'>
295
+ <Badge badgeContent={getCount()} overlap='rectangular' color='primary'>
232
296
  <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>
233
297
  </Badge>
234
298
  }
@@ -249,7 +313,7 @@ export default function ToDo(props: ToDoProps) {
249
313
  </div>
250
314
  {(!isConfirm || canPerform) && (
251
315
  <div style={{ marginLeft: 'auto' }}>
252
- <IconButton id='go-btn' onClick={() => clickGo(assignment)}>
316
+ <IconButton id='go-btn' onClick={() => clickGo(assignment)} size='large'>
253
317
  <ArrowForwardIosOutlinedIcon />
254
318
  </IconButton>
255
319
  </div>
@@ -267,7 +331,7 @@ export default function ToDo(props: ToDoProps) {
267
331
  {showTodoList && (
268
332
  <CardHeader
269
333
  title={
270
- <Badge badgeContent={assignmentCount} overlap='rectangular' color='primary'>
334
+ <Badge badgeContent={getCount()} overlap='rectangular' color='primary'>
271
335
  <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>
272
336
  </Badge>
273
337
  }
@@ -280,7 +344,7 @@ export default function ToDo(props: ToDoProps) {
280
344
  <ListItem key={getAssignmentId(assignment)} dense divider onClick={() => clickGo(assignment)}>
281
345
  <ListItemText primary={getAssignmentName(assignment)} secondary={getListItemComponent(assignment)} />
282
346
  <ListItemSecondaryAction>
283
- <IconButton onClick={() => clickGo(assignment)}>
347
+ <IconButton onClick={() => clickGo(assignment)} size='large'>
284
348
  <ArrowForwardIosOutlinedIcon />
285
349
  </IconButton>
286
350
  </ListItemSecondaryAction>
@@ -294,7 +358,7 @@ export default function ToDo(props: ToDoProps) {
294
358
  {type === CONSTS.TODO && !isConfirm && <Card className={classes.todoWrapper}>{toDoContent}</Card>}
295
359
  {type === CONSTS.TODO && isConfirm && <>{toDoContent}</>}
296
360
 
297
- {assignmentCount > 3 && (
361
+ {getCount() > 3 && (
298
362
  <Box display='flex' justifyContent='center'>
299
363
  {bShowMore ? (
300
364
  <Button color='primary' onClick={_showMore}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.24.3",
3
+ "version": "0.242.1",
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": [