@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.
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +1 -1
- package/lib/designSystemExtension/Banner/Banner.tsx +1 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +11 -2
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +3 -3
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +4 -4
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +3 -3
- package/lib/designSystemExtension/Operator/Operator.tsx +6 -5
- package/lib/designSystemExtension/Pulse/Pulse.tsx +2 -2
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
- package/lib/field/AutoComplete/AutoComplete.tsx +3 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +3 -3
- package/lib/field/Checkbox/Checkbox.tsx +3 -3
- package/lib/field/Currency/Currency.tsx +1 -1
- package/lib/field/Date/Date.tsx +22 -41
- package/lib/field/DateTime/DateTime.tsx +22 -34
- package/lib/field/Decimal/Decimal.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +2 -2
- package/lib/field/Email/Email.tsx +2 -2
- package/lib/field/Group/Group.tsx +1 -1
- package/lib/field/Integer/Integer.tsx +1 -1
- package/lib/field/Multiselect/Multiselect.tsx +8 -14
- package/lib/field/Percentage/Percentage.tsx +2 -2
- package/lib/field/Phone/Phone.tsx +17 -8
- package/lib/field/RadioButtons/RadioButtons.tsx +2 -2
- package/lib/field/SemanticLink/SemanticLink.tsx +3 -3
- package/lib/field/TextArea/TextArea.tsx +1 -1
- package/lib/field/TextContent/TextContent.tsx +1 -1
- package/lib/field/TextInput/TextInput.tsx +1 -1
- package/lib/field/Time/Time.tsx +19 -15
- package/lib/field/URL/URL.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +1 -1
- package/lib/helpers/simpleTableHelpers.ts +1 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +3 -3
- package/lib/infra/Assignment/Assignment.tsx +35 -5
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +8 -9
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +2 -2
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +8 -8
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +1 -1
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +1 -1
- package/lib/infra/DashboardFilter/filterUtils.tsx +2 -1
- package/lib/infra/DeferLoad/DeferLoad.tsx +2 -2
- package/lib/infra/NavBar/NavBar.tsx +17 -16
- package/lib/infra/RootContainer/RootContainer.tsx +5 -6
- package/lib/infra/Stages/Stages.tsx +4 -4
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +2 -2
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
- package/lib/template/AppShell/AppShell.tsx +21 -2
- package/lib/template/CaseView/CaseView.tsx +5 -5
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +7 -7
- package/lib/template/Confirmation/Confirmation.tsx +2 -1
- package/lib/template/DataReference/DataReference.tsx +1 -1
- package/lib/template/Details/Details/Details.tsx +1 -1
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +3 -3
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +1 -1
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +3 -2
- package/lib/template/InlineDashboard/InlineDashboard.tsx +2 -2
- package/lib/template/ListView/ListView.tsx +57 -63
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +1 -1
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +2 -2
- package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -1
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +29 -25
- package/lib/template/SubTabs/SubTabs.tsx +2 -2
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +2 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +2 -2
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +9 -9
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +2 -2
- package/lib/widget/Attachment/Attachment.tsx +3 -2
- package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -1
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +4 -3
- package/lib/widget/Followers/Followers.tsx +2 -2
- package/lib/widget/SummaryItem/SummaryItem.tsx +3 -2
- package/lib/widget/ToDo/ToDo.tsx +85 -21
- package/package.json +1 -1
package/lib/widget/ToDo/ToDo.tsx
CHANGED
|
@@ -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
|
|
17
|
-
import Snackbar from '@material
|
|
18
|
-
import IconButton from '@material
|
|
19
|
-
import CloseIcon from '@
|
|
20
|
-
import ArrowForwardIosOutlinedIcon from '@
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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 |
|
|
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
|
-
|
|
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(
|
|
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={
|
|
295
|
+
<Badge badgeContent={getCount()} overlap='rectangular' color='primary'>
|
|
232
296
|
<Typography variant='h6'>{headerText} </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={
|
|
334
|
+
<Badge badgeContent={getCount()} overlap='rectangular' color='primary'>
|
|
271
335
|
<Typography variant='h6'>{headerText} </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
|
-
{
|
|
361
|
+
{getCount() > 3 && (
|
|
298
362
|
<Box display='flex' justifyContent='center'>
|
|
299
363
|
{bShowMore ? (
|
|
300
364
|
<Button color='primary' onClick={_showMore}>
|
package/package.json
CHANGED