@pega/react-sdk-overrides 0.24.4 → 0.25.2

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 (139) 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.css +0 -2
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +59 -32
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +4 -4
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +5 -5
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +6 -6
  9. package/lib/designSystemExtension/Operator/Operator.tsx +16 -12
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +3 -3
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
  13. package/lib/field/AutoComplete/AutoComplete.tsx +5 -5
  14. package/lib/field/CancelAlert/CancelAlert.tsx +5 -8
  15. package/lib/field/Checkbox/Checkbox.tsx +5 -5
  16. package/lib/field/Currency/Currency.tsx +12 -9
  17. package/lib/field/Date/Date.tsx +29 -48
  18. package/lib/field/DateTime/DateTime.tsx +37 -39
  19. package/lib/field/Decimal/Decimal.tsx +12 -9
  20. package/lib/field/Dropdown/Dropdown.tsx +34 -27
  21. package/lib/field/Email/Email.tsx +39 -20
  22. package/lib/field/Group/Group.tsx +4 -4
  23. package/lib/field/Integer/Integer.tsx +27 -15
  24. package/lib/field/Multiselect/Multiselect.tsx +8 -14
  25. package/lib/field/Multiselect/utils.ts +1 -1
  26. package/lib/field/Percentage/Percentage.tsx +11 -11
  27. package/lib/field/Phone/Phone.tsx +13 -10
  28. package/lib/field/Phone/config-ext.json +8 -0
  29. package/lib/field/RadioButtons/RadioButtons.tsx +4 -7
  30. package/lib/field/RichText/RichText.tsx +2 -2
  31. package/lib/field/RichText/config-ext.json +10 -0
  32. package/lib/field/ScalarList/ScalarList.tsx +4 -5
  33. package/lib/field/SemanticLink/SemanticLink.tsx +5 -5
  34. package/lib/field/TextArea/TextArea.tsx +30 -14
  35. package/lib/field/TextContent/TextContent.tsx +2 -2
  36. package/lib/field/TextInput/TextInput.tsx +7 -9
  37. package/lib/field/Time/Time.tsx +30 -27
  38. package/lib/field/URL/URL.tsx +29 -12
  39. package/lib/field/UserReference/UserReference.tsx +4 -6
  40. package/lib/helpers/common-utils.ts +24 -1
  41. package/lib/helpers/field-group-utils.ts +3 -3
  42. package/lib/helpers/formatters/Currency.ts +11 -16
  43. package/lib/helpers/formatters/common.ts +2 -1
  44. package/lib/helpers/formatters/index.ts +2 -4
  45. package/lib/helpers/simpleTableHelpers.ts +1 -1
  46. package/lib/infra/ActionButtons/ActionButtons.tsx +3 -3
  47. package/lib/infra/Assignment/Assignment.tsx +14 -14
  48. package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
  49. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +17 -29
  50. package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
  51. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +10 -5
  52. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +9 -9
  53. package/lib/infra/Containers/SimpleView/helper.ts +1 -1
  54. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +2 -2
  55. package/lib/infra/DashboardFilter/DashboardFilter.tsx +6 -8
  56. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
  57. package/lib/infra/DeferLoad/DeferLoad.tsx +9 -9
  58. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -1
  59. package/lib/infra/MultiStep/MultiStep.tsx +17 -16
  60. package/lib/infra/NavBar/NavBar.css +1 -0
  61. package/lib/infra/NavBar/NavBar.tsx +49 -38
  62. package/lib/infra/Reference/Reference.tsx +1 -1
  63. package/lib/infra/Region/Region.tsx +1 -1
  64. package/lib/infra/RootContainer/RootContainer.tsx +7 -8
  65. package/lib/infra/Stages/Stages.tsx +5 -5
  66. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +4 -3
  67. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
  68. package/lib/infra/View/View.tsx +38 -4
  69. package/lib/template/AdvancedSearch/AdvancedSearch.tsx +87 -0
  70. package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +58 -0
  71. package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +245 -0
  72. package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
  73. package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
  74. package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
  75. package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
  76. package/lib/template/AdvancedSearch/config-ext.json +9 -0
  77. package/lib/template/AdvancedSearch/index.tsx +1 -0
  78. package/lib/template/AppShell/AppShell.tsx +62 -12
  79. package/lib/template/BannerPage/BannerPage.tsx +2 -2
  80. package/lib/template/BannerPage/config-ext.json +9 -0
  81. package/lib/template/CaseSummary/CaseSummary.tsx +2 -2
  82. package/lib/template/CaseView/CaseView.tsx +12 -11
  83. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +8 -8
  84. package/lib/template/Confirmation/Confirmation.tsx +5 -4
  85. package/lib/template/DataReference/DataReference.tsx +318 -108
  86. package/lib/template/DataReference/DataReferenceAdvancedSearchContext.js +10 -0
  87. package/lib/template/DataReference/SearchForm.tsx +148 -0
  88. package/lib/template/DataReference/utils.js +90 -0
  89. package/lib/template/DefaultForm/DefaultForm.tsx +2 -2
  90. package/lib/template/DefaultForm/utils/index.ts +1 -3
  91. package/lib/template/Details/Details/Details.tsx +3 -3
  92. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +5 -5
  93. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +3 -3
  94. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +3 -3
  95. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +5 -5
  96. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +11 -6
  97. package/lib/template/InlineDashboard/InlineDashboard.tsx +4 -4
  98. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
  99. package/lib/template/InlineDashboardPage/config-ext.json +9 -0
  100. package/lib/template/ListPage/ListPage.tsx +1 -1
  101. package/lib/template/ListView/ListView.tsx +201 -95
  102. package/lib/template/ListView/utils.ts +38 -6
  103. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +1 -1
  104. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +2 -2
  105. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +3 -3
  106. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +2 -2
  107. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +2 -2
  108. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +4 -4
  109. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
  110. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
  111. package/lib/template/PromotedFilters/PromotedFilters.tsx +2 -3
  112. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +1 -3
  113. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +112 -88
  114. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +3 -5
  115. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +1 -1
  116. package/lib/template/SubTabs/SubTabs.tsx +4 -4
  117. package/lib/template/SubTabs/tabUtils.ts +118 -1
  118. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -10
  119. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
  120. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -10
  121. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +2 -2
  122. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +3 -3
  123. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
  124. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
  125. package/lib/template/WssNavBar/WssNavBar.tsx +10 -10
  126. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +3 -3
  127. package/lib/widget/Attachment/Attachment.css +1 -0
  128. package/lib/widget/Attachment/Attachment.tsx +8 -10
  129. package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
  130. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +2 -2
  131. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +6 -5
  132. package/lib/widget/Followers/Followers.tsx +4 -4
  133. package/lib/widget/QuickCreate/QuickCreate.tsx +1 -2
  134. package/lib/widget/QuickCreate/config-ext.json +9 -0
  135. package/lib/widget/SummaryItem/SummaryItem.tsx +5 -4
  136. package/lib/widget/SummaryList/SummaryList.tsx +1 -1
  137. package/lib/widget/ToDo/ToDo.tsx +102 -40
  138. package/package.json +1 -1
  139. /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
@@ -1,31 +1,52 @@
1
1
  /* eslint-disable @typescript-eslint/no-shadow */
2
- import React, { useState } from 'react';
3
- import {
4
- Box,
5
- Button,
6
- Card,
7
- CardContent,
8
- CardHeader,
9
- Avatar,
10
- Typography,
11
- Badge,
12
- List,
13
- ListItem,
14
- ListItemText,
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';
2
+ import React, { useCallback, useEffect, useState } from 'react';
3
+ import { Box, Button, Card, CardContent, CardHeader, Avatar, Typography, Badge, List, ListItem, ListItemText } from '@mui/material';
4
+ import Snackbar from '@mui/material/Snackbar';
5
+ import IconButton from '@mui/material/IconButton';
6
+ import CloseIcon from '@mui/icons-material/Close';
7
+ import ArrowForwardIosOutlinedIcon from '@mui/icons-material/ArrowForwardIosOutlined';
8
+ import { useTheme } from '@mui/material/styles';
9
+ import makeStyles from '@mui/styles/makeStyles';
10
+ import useMediaQuery from '@mui/material/useMediaQuery';
23
11
 
24
12
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
25
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
13
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
26
14
 
27
15
  import './ToDo.css';
28
16
 
17
+ const fetchMyWorkList = (datapage, fields, numberOfRecords, includeTotalCount, context) => {
18
+ return PCore.getDataPageUtils()
19
+ .getDataAsync(
20
+ datapage,
21
+ context,
22
+ {},
23
+ {
24
+ pageNumber: 1,
25
+ pageSize: numberOfRecords
26
+ },
27
+ {
28
+ select: Object.keys(fields).map(key => ({ field: PCore.getAnnotationUtils().getPropertyName(fields[key]) }))
29
+ },
30
+ {
31
+ invalidateCache: true,
32
+ additionalApiParams: {
33
+ includeTotalCount
34
+ }
35
+ }
36
+ )
37
+ .then(response => {
38
+ return {
39
+ ...response,
40
+ data: (Array.isArray(response?.data) ? response.data : []).map(row =>
41
+ Object.keys(fields).reduce((obj, key) => {
42
+ obj[key] = row[PCore.getAnnotationUtils().getPropertyName(fields[key])];
43
+ return obj;
44
+ }, {})
45
+ )
46
+ };
47
+ });
48
+ };
49
+
29
50
  interface ToDoProps extends PConnProps {
30
51
  // If any, enter additional props that only exist on this component
31
52
  datasource?: any;
@@ -37,7 +58,7 @@ interface ToDoProps extends PConnProps {
37
58
  itemKey?: string;
38
59
  showTodoList?: boolean;
39
60
  type?: string;
40
- // eslint-disable-next-line react/no-unused-prop-types
61
+
41
62
  context?: string;
42
63
  isConfirm?: boolean;
43
64
  }
@@ -81,13 +102,21 @@ const useStyles = makeStyles(theme => ({
81
102
  }));
82
103
 
83
104
  export default function ToDo(props: ToDoProps) {
84
- const { getPConnect, datasource = [], headerText = 'To do', showTodoList = true, myWorkList = {}, type = 'worklist', isConfirm = false } = props;
105
+ const {
106
+ getPConnect,
107
+ context,
108
+ datasource = [],
109
+ headerText = 'To do',
110
+ showTodoList = true,
111
+ myWorkList = {},
112
+ type = 'worklist',
113
+ isConfirm = false
114
+ } = props;
85
115
 
86
116
  const CONSTS = PCore.getConstants();
87
117
 
88
118
  const bLogging = true;
89
- let assignmentCount = 0;
90
- const currentUser = PCore.getEnvironmentInfo().getOperatorName();
119
+ const currentUser = PCore.getEnvironmentInfo().getOperatorName() ?? '';
91
120
  const currentUserInitials = Utils.getInitials(currentUser);
92
121
  const assignmentsSource = datasource?.source || myWorkList?.source;
93
122
 
@@ -106,17 +135,36 @@ export default function ToDo(props: ToDoProps) {
106
135
  const showlessLocalizedValue = localizedVal('show_less', 'CosmosFields');
107
136
  const showMoreLocalizedValue = localizedVal('show_more', 'CosmosFields');
108
137
  const canPerform = assignments?.[0]?.canPerform === 'true' || assignments?.[0]?.canPerform === true;
109
- // const { setOpen } = useNavBar();
138
+ const [count, setCount] = useState(0);
139
+
140
+ const {
141
+ WORK_BASKET: { MY_WORK_LIST }
142
+ } = PCore.getConstants();
110
143
 
111
144
  function initAssignments(): any[] {
112
145
  if (assignmentsSource) {
113
- assignmentCount = assignmentsSource.length;
114
146
  return topThreeAssignments(assignmentsSource);
115
147
  }
116
148
  // turn off todolist
117
149
  return [];
118
150
  }
119
151
 
152
+ const deferLoadWorklistItems = useCallback(
153
+ responseData => {
154
+ setCount(responseData.totalCount);
155
+ setAssignments(responseData.data);
156
+ },
157
+ [MY_WORK_LIST]
158
+ );
159
+
160
+ useEffect(() => {
161
+ if (Object.keys(myWorkList).length && myWorkList.datapage) {
162
+ fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, 3, true, context).then(responseData => {
163
+ deferLoadWorklistItems(responseData);
164
+ });
165
+ }
166
+ }, []);
167
+
120
168
  const getAssignmentId = assignment => {
121
169
  return type === CONSTS.TODO ? assignment.ID : assignment.id;
122
170
  };
@@ -137,7 +185,7 @@ export default function ToDo(props: ToDoProps) {
137
185
  setShowSnackbar(true);
138
186
  }
139
187
 
140
- function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
188
+ function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {
141
189
  if (reason === 'clickaway') {
142
190
  return;
143
191
  }
@@ -146,12 +194,18 @@ export default function ToDo(props: ToDoProps) {
146
194
 
147
195
  function _showMore() {
148
196
  setBShowMore(false);
149
- setAssignments(assignmentsSource);
197
+ if (type === CONSTS.WORKLIST && count && count > assignments.length && !assignmentsSource) {
198
+ fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, count, false, context).then(response => {
199
+ setAssignments(response.data);
200
+ });
201
+ } else {
202
+ setAssignments(assignmentsSource);
203
+ }
150
204
  }
151
205
 
152
206
  function _showLess() {
153
207
  setBShowMore(true);
154
- setAssignments(topThreeAssignments(assignmentsSource));
208
+ setAssignments(assignments => assignments.slice(0, 3));
155
209
  }
156
210
 
157
211
  function clickGo(assignment) {
@@ -223,12 +277,15 @@ export default function ToDo(props: ToDoProps) {
223
277
  );
224
278
  };
225
279
 
280
+ // eslint-disable-next-line no-nested-ternary
281
+ const getCount = () => (assignmentsSource ? assignmentsSource.length : type === CONSTS.WORKLIST ? count : 0);
282
+
226
283
  const toDoContent = (
227
284
  <>
228
285
  {showTodoList && (
229
286
  <CardHeader
230
287
  title={
231
- <Badge badgeContent={assignmentCount} overlap='rectangular' color='primary'>
288
+ <Badge badgeContent={getCount()} overlap='rectangular' color='primary'>
232
289
  <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>
233
290
  </Badge>
234
291
  }
@@ -249,7 +306,7 @@ export default function ToDo(props: ToDoProps) {
249
306
  </div>
250
307
  {(!isConfirm || canPerform) && (
251
308
  <div style={{ marginLeft: 'auto' }}>
252
- <IconButton id='go-btn' onClick={() => clickGo(assignment)}>
309
+ <IconButton id='go-btn' onClick={() => clickGo(assignment)} size='large'>
253
310
  <ArrowForwardIosOutlinedIcon />
254
311
  </IconButton>
255
312
  </div>
@@ -267,7 +324,7 @@ export default function ToDo(props: ToDoProps) {
267
324
  {showTodoList && (
268
325
  <CardHeader
269
326
  title={
270
- <Badge badgeContent={assignmentCount} overlap='rectangular' color='primary'>
327
+ <Badge badgeContent={getCount()} overlap='rectangular' color='primary'>
271
328
  <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>
272
329
  </Badge>
273
330
  }
@@ -277,13 +334,18 @@ export default function ToDo(props: ToDoProps) {
277
334
  <CardContent>
278
335
  <List>
279
336
  {assignments.map(assignment => (
280
- <ListItem key={getAssignmentId(assignment)} dense divider onClick={() => clickGo(assignment)}>
281
- <ListItemText primary={getAssignmentName(assignment)} secondary={getListItemComponent(assignment)} />
282
- <ListItemSecondaryAction>
283
- <IconButton onClick={() => clickGo(assignment)}>
337
+ <ListItem
338
+ key={getAssignmentId(assignment)}
339
+ dense
340
+ divider
341
+ onClick={() => clickGo(assignment)}
342
+ secondaryAction={
343
+ <IconButton onClick={() => clickGo(assignment)} size='large'>
284
344
  <ArrowForwardIosOutlinedIcon />
285
345
  </IconButton>
286
- </ListItemSecondaryAction>
346
+ }
347
+ >
348
+ <ListItemText primary={getAssignmentName(assignment)} secondary={getListItemComponent(assignment)} />
287
349
  </ListItem>
288
350
  ))}
289
351
  </List>
@@ -294,7 +356,7 @@ export default function ToDo(props: ToDoProps) {
294
356
  {type === CONSTS.TODO && !isConfirm && <Card className={classes.todoWrapper}>{toDoContent}</Card>}
295
357
  {type === CONSTS.TODO && isConfirm && <>{toDoContent}</>}
296
358
 
297
- {assignmentCount > 3 && (
359
+ {getCount() > 3 && (
298
360
  <Box display='flex' justifyContent='center'>
299
361
  {bShowMore ? (
300
362
  <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.4",
3
+ "version": "0.25.2",
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": [