@pega/react-sdk-overrides 24.2.10 → 25.1.10
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/Banner/Banner.css +1 -1
- package/lib/designSystemExtension/Banner/Banner.tsx +10 -7
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +53 -37
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -13
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +8 -9
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +9 -9
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +8 -9
- package/lib/designSystemExtension/Operator/Operator.tsx +21 -19
- package/lib/designSystemExtension/Pulse/Pulse.tsx +1 -1
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +32 -4
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +7 -14
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +13 -2
- package/lib/field/AutoComplete/AutoComplete.tsx +1 -1
- package/lib/field/CancelAlert/CancelAlert.css +4 -4
- package/lib/field/CancelAlert/CancelAlert.tsx +7 -10
- package/lib/field/Checkbox/Checkbox.tsx +97 -4
- package/lib/field/Currency/Currency.tsx +10 -7
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +8 -8
- package/lib/field/DateTime/DateTime.tsx +16 -13
- package/lib/field/Decimal/Decimal.tsx +10 -7
- package/lib/field/Dropdown/Dropdown.tsx +30 -25
- package/lib/field/Email/Email.tsx +11 -13
- package/lib/field/Group/Group.tsx +10 -8
- package/lib/field/Integer/Integer.tsx +5 -7
- package/lib/field/Location/Location.css +4 -0
- package/lib/field/Location/Location.tsx +258 -0
- package/lib/field/Location/config-ext.json +8 -0
- package/lib/field/Location/index.tsx +1 -0
- package/lib/field/Multiselect/utils.ts +1 -1
- package/lib/field/ObjectReference/ObjectReference.tsx +235 -0
- package/lib/field/ObjectReference/index.tsx +1 -0
- package/lib/field/ObjectReference/utils.ts +111 -0
- package/lib/field/Percentage/Percentage.tsx +9 -9
- package/lib/field/Phone/Phone.tsx +7 -5
- package/lib/field/RadioButtons/RadioButtons.tsx +47 -5
- package/lib/field/RichText/RichText.css +79 -0
- package/lib/field/RichText/RichText.tsx +3 -1
- package/lib/field/ScalarList/ScalarList.tsx +2 -4
- package/lib/field/SelectableCard/SelectableCard.tsx +175 -0
- package/lib/field/SelectableCard/index.tsx +1 -0
- package/lib/field/SelectableCard/utils.tsx +223 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +160 -28
- package/lib/field/SemanticLink/utils.ts +1 -1
- package/lib/field/TextArea/TextArea.tsx +5 -7
- package/lib/field/TextContent/TextContent.tsx +1 -2
- package/lib/field/TextInput/TextInput.tsx +5 -7
- package/lib/field/Time/Time.tsx +4 -8
- package/lib/field/URL/URL.tsx +5 -7
- package/lib/field/UserReference/UserReference.tsx +3 -6
- package/lib/helpers/attachmentShared.ts +6 -0
- package/lib/helpers/common-utils.ts +24 -2
- package/lib/helpers/data_page.ts +0 -1
- package/lib/helpers/field-group-utils.ts +1 -1
- package/lib/helpers/formatters/Currency.ts +20 -20
- package/lib/helpers/formatters/CurrencyMap.ts +0 -2
- package/lib/helpers/formatters/common.ts +2 -1
- package/lib/helpers/formatters/index.ts +2 -4
- package/lib/helpers/object-utils.ts +10 -0
- package/lib/helpers/simpleTableHelpers.ts +118 -6
- package/lib/helpers/utils.ts +8 -1
- package/lib/helpers/versionHelpers.ts +0 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +28 -21
- package/lib/infra/Assignment/Assignment.tsx +39 -36
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +21 -113
- package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +4 -3
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +7 -6
- package/lib/infra/Containers/SimpleView/helper.ts +1 -1
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +4 -5
- package/lib/infra/Containers/container-helpers.ts +52 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +5 -9
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -6
- package/lib/infra/DeferLoad/DeferLoad.tsx +7 -9
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -3
- package/lib/infra/MultiStep/MultiStep.css +48 -70
- package/lib/infra/MultiStep/MultiStep.tsx +27 -58
- package/lib/infra/NavBar/NavBar.css +1 -1
- package/lib/infra/NavBar/NavBar.tsx +43 -32
- package/lib/infra/Reference/Reference.tsx +3 -4
- package/lib/infra/Region/Region.tsx +1 -1
- package/lib/infra/RootContainer/RootContainer.tsx +3 -4
- package/lib/infra/Stages/Stages.tsx +3 -4
- package/lib/infra/View/View.tsx +4 -3
- package/lib/template/AdvancedSearch/AdvancedSearch.tsx +86 -0
- package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +52 -0
- package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +244 -0
- package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
- package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
- package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
- package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
- package/lib/template/AdvancedSearch/config-ext.json +9 -0
- package/lib/template/AdvancedSearch/index.tsx +1 -0
- package/lib/template/AppShell/AppShell.css +1 -1
- package/lib/template/AppShell/AppShell.tsx +22 -23
- package/lib/template/BannerPage/BannerPage.tsx +2 -2
- package/lib/template/CaseSummary/CaseSummary.tsx +28 -41
- package/lib/template/CaseView/CaseView.tsx +32 -38
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +1 -1
- package/lib/template/Confirmation/Confirmation.tsx +3 -4
- package/lib/template/DataReference/DataReference.tsx +312 -106
- package/lib/template/DataReference/DataReferenceAdvancedSearchContext.ts +10 -0
- package/lib/template/DataReference/SearchForm.tsx +149 -0
- package/lib/template/DataReference/utils.ts +90 -0
- package/lib/template/DefaultForm/DefaultForm.tsx +3 -3
- package/lib/template/DefaultForm/utils/index.ts +1 -3
- package/lib/template/DefaultPage/DefaultPage.tsx +108 -0
- package/lib/template/DefaultPage/index.tsx +1 -0
- package/lib/template/Details/Details/Details.tsx +11 -11
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +2 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +11 -11
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +11 -11
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +1 -2
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +2 -5
- package/lib/template/InlineDashboard/InlineDashboard.tsx +14 -16
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
- package/lib/template/ListPage/ListPage.tsx +1 -1
- package/lib/template/ListView/ListView.tsx +285 -204
- package/lib/template/ListView/hooks.ts +1 -5
- package/lib/template/ListView/utils.ts +38 -6
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +1 -1
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +5 -5
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +11 -11
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +2 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +2 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -7
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
- package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -3
- package/lib/template/SelfServiceCaseView/SelfServiceCaseView.tsx +145 -0
- package/lib/template/SelfServiceCaseView/index.tsx +1 -0
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +2 -5
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +99 -84
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +3 -5
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +10 -2
- package/lib/template/SubTabs/SubTabs.tsx +2 -2
- package/lib/template/SubTabs/tabUtils.ts +118 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +9 -10
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +9 -10
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +5 -5
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +11 -11
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
- package/lib/template/WssNavBar/WssNavBar.css +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +6 -6
- package/lib/template/utils.tsx +58 -0
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +1 -1
- package/lib/widget/Attachment/Attachment.css +7 -8
- package/lib/widget/Attachment/Attachment.tsx +304 -231
- package/lib/widget/Attachment/Attachment.types.ts +96 -0
- package/lib/widget/Attachment/AttachmentUtils.ts +316 -0
- package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +0 -14
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +3 -3
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +7 -6
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +30 -23
- package/lib/widget/Followers/Followers.tsx +2 -4
- package/lib/widget/QuickCreate/QuickCreate.tsx +1 -3
- package/lib/widget/SummaryItem/SummaryItem.css +9 -11
- package/lib/widget/SummaryItem/SummaryItem.tsx +3 -3
- package/lib/widget/SummaryList/SummaryList.tsx +1 -1
- package/lib/widget/ToDo/ToDo.css +1 -13
- package/lib/widget/ToDo/ToDo.tsx +38 -37
- package/package.json +1 -1
- package/lib/helpers/attachmentHelpers.ts +0 -76
- package/lib/infra/Containers/helpers.ts +0 -6
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-shadow */
|
|
5
|
-
|
|
6
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
7
|
-
import { Theme } from '@mui/material/styles';
|
|
1
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
2
|
+
import type { Theme } from '@mui/material/styles';
|
|
8
3
|
import createStyles from '@mui/styles/createStyles';
|
|
9
4
|
import makeStyles from '@mui/styles/makeStyles';
|
|
10
5
|
import Table from '@mui/material/Table';
|
|
@@ -21,7 +16,7 @@ import FilterListIcon from '@mui/icons-material/FilterList';
|
|
|
21
16
|
import SubjectIcon from '@mui/icons-material/Subject';
|
|
22
17
|
import SearchIcon from '@mui/icons-material/Search';
|
|
23
18
|
import TextField from '@mui/material/TextField';
|
|
24
|
-
import
|
|
19
|
+
import Grid2 from '@mui/material/Grid2';
|
|
25
20
|
import Menu from '@mui/material/Menu';
|
|
26
21
|
import MenuItem from '@mui/material/MenuItem';
|
|
27
22
|
import Dialog from '@mui/material/Dialog';
|
|
@@ -37,16 +32,16 @@ import IconButton from '@mui/material/IconButton';
|
|
|
37
32
|
import CloseIcon from '@mui/icons-material/Close';
|
|
38
33
|
import { Radio } from '@mui/material';
|
|
39
34
|
import Checkbox from '@mui/material/Checkbox';
|
|
40
|
-
|
|
41
35
|
import { filterData } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
42
36
|
|
|
43
37
|
import './ListView.css';
|
|
44
38
|
import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
45
39
|
import { getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
40
|
+
import { getGenericFieldsLocalizedValue } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
46
41
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
47
42
|
|
|
48
43
|
import useInit from './hooks';
|
|
49
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
44
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
50
45
|
|
|
51
46
|
interface ListViewProps extends PConnProps {
|
|
52
47
|
// If any, enter additional props that only exist on this component
|
|
@@ -62,6 +57,9 @@ interface ListViewProps extends PConnProps {
|
|
|
62
57
|
showDynamicFields?: boolean;
|
|
63
58
|
readonlyContextList?: any;
|
|
64
59
|
value: any;
|
|
60
|
+
viewName?: string;
|
|
61
|
+
showRecords?: boolean;
|
|
62
|
+
displayAs?: string;
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
@@ -88,28 +86,30 @@ export default function ListView(props: ListViewProps) {
|
|
|
88
86
|
parameters,
|
|
89
87
|
compositeKeys,
|
|
90
88
|
showDynamicFields,
|
|
89
|
+
viewName,
|
|
91
90
|
readonlyContextList: selectedValues,
|
|
92
|
-
value
|
|
91
|
+
value,
|
|
92
|
+
displayAs
|
|
93
93
|
} = props;
|
|
94
|
+
let { showRecords } = props;
|
|
94
95
|
const ref = useRef({}).current;
|
|
95
96
|
const cosmosTableRef = useRef();
|
|
96
97
|
// List component context
|
|
97
98
|
const [listContext, setListContext] = useState<any>({});
|
|
98
99
|
const { meta } = listContext;
|
|
99
|
-
const
|
|
100
|
-
const xRayUid = xRayApis.startXRay();
|
|
100
|
+
const { current: uniqueId } = useRef(crypto.randomUUID());
|
|
101
101
|
|
|
102
102
|
useInit({
|
|
103
103
|
...props,
|
|
104
104
|
setListContext,
|
|
105
105
|
ref,
|
|
106
106
|
showDynamicFields,
|
|
107
|
-
xRayUid,
|
|
108
107
|
cosmosTableRef
|
|
109
108
|
});
|
|
110
109
|
|
|
110
|
+
useClearSelectionsAndUpdateTable({ getPConnect, uniqueId, viewName });
|
|
111
|
+
|
|
111
112
|
const thePConn = getPConnect();
|
|
112
|
-
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
113
113
|
const componentConfig = thePConn.getComponentConfig();
|
|
114
114
|
const resolvedConfigProps: any = thePConn.getConfigProps() as ListViewProps;
|
|
115
115
|
|
|
@@ -157,10 +157,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
157
157
|
width: '100%',
|
|
158
158
|
marginTop: theme.spacing(2),
|
|
159
159
|
marginBottom: theme.spacing(2),
|
|
160
|
-
display: 'grid'
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
padding: '5px 5px'
|
|
160
|
+
display: 'grid',
|
|
161
|
+
borderRadius: 16,
|
|
162
|
+
padding: 20
|
|
164
163
|
},
|
|
165
164
|
table: {
|
|
166
165
|
minWidth: 750
|
|
@@ -189,16 +188,43 @@ export default function ListView(props: ListViewProps) {
|
|
|
189
188
|
position: 'absolute',
|
|
190
189
|
top: 20,
|
|
191
190
|
width: 1
|
|
192
|
-
},
|
|
193
|
-
title: {
|
|
194
|
-
marginTop: theme.spacing(1),
|
|
195
|
-
marginLeft: theme.spacing(1)
|
|
196
191
|
}
|
|
197
192
|
})
|
|
198
193
|
);
|
|
199
194
|
|
|
200
195
|
const classes = useStyles();
|
|
201
196
|
|
|
197
|
+
// Hook to clear the selections and update table in AdvancedSearch template when switching between search views
|
|
198
|
+
function useClearSelectionsAndUpdateTable({ getPConnect, uniqueId, viewName }) {
|
|
199
|
+
const clearSelectionsAndRefreshList = useCallback(
|
|
200
|
+
({ viewName: name, clearSelections }) => {
|
|
201
|
+
if (name === viewName) {
|
|
202
|
+
const { selectionMode } = getPConnect().getRawConfigProps();
|
|
203
|
+
if (!selectionMode) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (clearSelections) {
|
|
207
|
+
if (selectionMode === 'single') {
|
|
208
|
+
getPConnect().getListActions().setSelectedRows({});
|
|
209
|
+
} else {
|
|
210
|
+
getPConnect().getListActions().clearSelectedRows();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
[getPConnect, viewName]
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
useEffect(() => {
|
|
219
|
+
const identifier = `clear-and-update-advanced-search-selections-${uniqueId}`;
|
|
220
|
+
PCore.getPubSubUtils().subscribe('update-advanced-search-selections', clearSelectionsAndRefreshList, identifier);
|
|
221
|
+
|
|
222
|
+
return () => {
|
|
223
|
+
PCore.getPubSubUtils().unsubscribe('update-advanced-search-selections', identifier);
|
|
224
|
+
};
|
|
225
|
+
}, [uniqueId, clearSelectionsAndRefreshList]);
|
|
226
|
+
}
|
|
227
|
+
|
|
202
228
|
const handleRequestSort = (event: React.MouseEvent<unknown>, property: keyof any) => {
|
|
203
229
|
const isAsc = orderBy === property && order === 'asc';
|
|
204
230
|
setOrder(isAsc ? 'desc' : 'asc');
|
|
@@ -222,11 +248,12 @@ export default function ListView(props: ListViewProps) {
|
|
|
222
248
|
|
|
223
249
|
type Order = 'asc' | 'desc';
|
|
224
250
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
251
|
+
interface Comparator<T> {
|
|
252
|
+
(a: T, b: T): number;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function getComparator<T, Key extends keyof T>(theOrder: Order, orderedBy: Key): Comparator<T> {
|
|
256
|
+
return theOrder === 'desc' ? (a: T, b: T) => descendingComparator(a, b, orderedBy) : (a: T, b: T) => -descendingComparator(a, b, orderedBy);
|
|
230
257
|
}
|
|
231
258
|
|
|
232
259
|
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
@@ -259,18 +286,24 @@ export default function ListView(props: ListViewProps) {
|
|
|
259
286
|
theField = theField.substring(1);
|
|
260
287
|
}
|
|
261
288
|
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
262
|
-
const displayAsLink = field.config.displayAsLink;
|
|
289
|
+
// const displayAsLink = field.config.displayAsLink;
|
|
290
|
+
const { additionalDetails = {} } = field.config;
|
|
291
|
+
let shouldDisplayAsSemanticLink = additionalDetails.type === 'DISPLAY_LINK';
|
|
292
|
+
// TODO: This "if" check has been added for backward compatibility, to be removed once the users are notified about the changes in view metadata of US-517164
|
|
293
|
+
if (!shouldDisplayAsSemanticLink) {
|
|
294
|
+
shouldDisplayAsSemanticLink = 'displayAsLink' in field.config && field.config.displayAsLink;
|
|
295
|
+
}
|
|
263
296
|
const headerRow: any = {};
|
|
264
297
|
headerRow.id = fields[index].id;
|
|
265
298
|
headerRow.type = field.type;
|
|
266
|
-
headerRow.displayAsLink =
|
|
299
|
+
headerRow.displayAsLink = shouldDisplayAsSemanticLink;
|
|
267
300
|
headerRow.numeric = field.type === 'Decimal' || field.type === 'Integer' || field.type === 'Percentage' || field.type === 'Currency' || false;
|
|
268
301
|
headerRow.disablePadding = false;
|
|
269
302
|
headerRow.label = fields[index].label;
|
|
270
303
|
if (colIndex > -1) {
|
|
271
304
|
headerRow.classID = fields[colIndex].classID;
|
|
272
305
|
}
|
|
273
|
-
if (
|
|
306
|
+
if (shouldDisplayAsSemanticLink) {
|
|
274
307
|
headerRow.isAssignmentLink = AssignDashObjects.includes(headerRow.classID);
|
|
275
308
|
if (field.config.value?.startsWith('@CA')) {
|
|
276
309
|
headerRow.isAssociation = true;
|
|
@@ -284,7 +317,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
284
317
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
285
318
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
286
319
|
if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
|
|
287
|
-
// eslint-disable-next-line no-console
|
|
288
320
|
console.error('pyGUID or pyID values are mandatory to select the required row from the list');
|
|
289
321
|
}
|
|
290
322
|
}
|
|
@@ -306,32 +338,43 @@ export default function ListView(props: ListViewProps) {
|
|
|
306
338
|
|
|
307
339
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CHANGE fires
|
|
308
340
|
function processFilterChange(data) {
|
|
309
|
-
|
|
341
|
+
let filterId;
|
|
342
|
+
let filterExpression;
|
|
343
|
+
let isDateRange;
|
|
344
|
+
let field;
|
|
310
345
|
let dashboardFilterPayload: any = {
|
|
311
346
|
query: {
|
|
312
347
|
filter: {},
|
|
313
348
|
select: []
|
|
314
349
|
}
|
|
315
350
|
};
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
351
|
+
if (displayAs === 'advancedSearch') {
|
|
352
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
353
|
+
Object.entries(data).reduce((acc, [item, value]) => {
|
|
354
|
+
const { filterId, filterExpression } = value as any;
|
|
355
|
+
filters.current[filterId] = filterExpression;
|
|
356
|
+
return acc; // Ensure the accumulator is returned
|
|
357
|
+
}, {});
|
|
358
|
+
} else {
|
|
359
|
+
({ filterId, filterExpression } = data);
|
|
360
|
+
filters.current[filterId] = filterExpression;
|
|
361
|
+
isDateRange = data.filterExpression?.AND;
|
|
362
|
+
field = getFieldFromFilter(filterExpression, isDateRange);
|
|
363
|
+
selectParam = [];
|
|
364
|
+
// Constructing the select parameters list (will be sent in dashboardFilterPayload)
|
|
365
|
+
columnList.current.forEach(col => {
|
|
366
|
+
selectParam.push({
|
|
367
|
+
field: col
|
|
368
|
+
});
|
|
328
369
|
});
|
|
329
|
-
});
|
|
330
370
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
371
|
+
// Checking if the triggered filter is applicable for this list
|
|
372
|
+
if (data.filterExpression !== null && !(columnList.current?.length && columnList.current?.includes(field))) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
334
375
|
}
|
|
376
|
+
// Will be AND by default but making it dynamic in case we support dynamic relational ops in future
|
|
377
|
+
const relationalOp = 'AND';
|
|
335
378
|
// This is a flag which will be used to reset dashboardFilterPayload in case we don't find any valid filters
|
|
336
379
|
let validFilter = false;
|
|
337
380
|
|
|
@@ -341,7 +384,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
341
384
|
const filter = filters.current[filterExp];
|
|
342
385
|
// If the filter is null then we can skip this iteration
|
|
343
386
|
if (filter === null) {
|
|
344
|
-
// eslint-disable-next-line no-continue
|
|
345
387
|
continue;
|
|
346
388
|
}
|
|
347
389
|
|
|
@@ -350,7 +392,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
350
392
|
field = getFieldFromFilter(filter, isDateRange);
|
|
351
393
|
|
|
352
394
|
if (!(columnList.current.length && columnList.current.includes(field))) {
|
|
353
|
-
// eslint-disable-next-line no-continue
|
|
354
395
|
continue;
|
|
355
396
|
}
|
|
356
397
|
// If we reach here that implies we've at least one valid filter, hence setting the flag
|
|
@@ -377,7 +418,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
377
418
|
} else {
|
|
378
419
|
dashboardFilterPayload.query.filter.filterConditions = {
|
|
379
420
|
...dashboardFilterPayload.query.filter.filterConditions,
|
|
380
|
-
[`T${index++}`]: { ...filter.condition, ignoreCase: true }
|
|
421
|
+
[`T${index++}`]: { ...filter.condition, ...(filter.condition.comparator === 'CONTAINS' ? { ignoreCase: true } : {}) }
|
|
381
422
|
};
|
|
382
423
|
|
|
383
424
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
@@ -405,6 +446,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
405
446
|
}
|
|
406
447
|
|
|
407
448
|
function fetchAllData(fields): any {
|
|
449
|
+
if (displayAs === 'advancedSearch' && !showRecords) {
|
|
450
|
+
return Promise.resolve({ data: null });
|
|
451
|
+
}
|
|
408
452
|
let query: any = null;
|
|
409
453
|
if (payload) {
|
|
410
454
|
query = payload.query;
|
|
@@ -555,8 +599,36 @@ export default function ListView(props: ListViewProps) {
|
|
|
555
599
|
};
|
|
556
600
|
}
|
|
557
601
|
|
|
602
|
+
function prepareFilters(data) {
|
|
603
|
+
return Object.entries(data.payload).reduce((acc, [field, value]) => {
|
|
604
|
+
if (value) {
|
|
605
|
+
let comparator = 'EQ';
|
|
606
|
+
const filterRecord = listContext.meta.fieldDefs.filter(item => item.id === field);
|
|
607
|
+
if (filterRecord?.[0]?.meta.type === 'TextInput') {
|
|
608
|
+
comparator = 'CONTAINS';
|
|
609
|
+
}
|
|
610
|
+
acc[field] = {
|
|
611
|
+
filterExpression: {
|
|
612
|
+
condition: {
|
|
613
|
+
lhs: {
|
|
614
|
+
field
|
|
615
|
+
},
|
|
616
|
+
comparator,
|
|
617
|
+
rhs: {
|
|
618
|
+
value
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
filterId: field
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
return acc;
|
|
626
|
+
}, {});
|
|
627
|
+
}
|
|
628
|
+
|
|
558
629
|
useEffect(() => {
|
|
559
630
|
if (listContext.meta) {
|
|
631
|
+
const identifier = `promoted-filters-queryable-${uniqueId}`;
|
|
560
632
|
fetchDataFromServer();
|
|
561
633
|
setTimeout(() => {
|
|
562
634
|
PCore.getPubSubUtils().subscribe(
|
|
@@ -578,6 +650,15 @@ export default function ListView(props: ListViewProps) {
|
|
|
578
650
|
false,
|
|
579
651
|
getPConnect().getContextName()
|
|
580
652
|
);
|
|
653
|
+
PCore.getPubSubUtils().subscribe(
|
|
654
|
+
PCore.getEvents().getTransientEvent().UPDATE_PROMOTED_FILTERS,
|
|
655
|
+
data => {
|
|
656
|
+
showRecords = data.showRecords;
|
|
657
|
+
const filterData = prepareFilters(data);
|
|
658
|
+
processFilterChange(filterData);
|
|
659
|
+
},
|
|
660
|
+
identifier
|
|
661
|
+
);
|
|
581
662
|
}, 0);
|
|
582
663
|
|
|
583
664
|
return function cleanupSubscriptions() {
|
|
@@ -591,6 +672,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
591
672
|
`dashboard-component-${'id'}`,
|
|
592
673
|
getPConnect().getContextName()
|
|
593
674
|
);
|
|
675
|
+
PCore.getPubSubUtils().unsubscribe(PCore.getEvents().getTransientEvent().UPDATE_PROMOTED_FILTERS, identifier);
|
|
594
676
|
};
|
|
595
677
|
}
|
|
596
678
|
}, [listContext]);
|
|
@@ -628,7 +710,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
628
710
|
|
|
629
711
|
function showToast(message: string) {
|
|
630
712
|
const theMessage = `Assignment: ${message}`;
|
|
631
|
-
|
|
713
|
+
|
|
632
714
|
console.error(theMessage);
|
|
633
715
|
setSnackbarMessage(message);
|
|
634
716
|
setShowSnackbar(true);
|
|
@@ -642,7 +724,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
642
724
|
|
|
643
725
|
thePConn
|
|
644
726
|
.getActionsApi()
|
|
645
|
-
// @ts-ignore
|
|
646
727
|
.openAssignment(pzInsKey, pxRefObjectClass, options)
|
|
647
728
|
.then(() => {
|
|
648
729
|
// console.log("openAssignment successful");
|
|
@@ -759,7 +840,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
759
840
|
function _showFilteredIcon(columnId) {
|
|
760
841
|
for (const filterObj of filterByColumns) {
|
|
761
842
|
if (filterObj.ref === columnId) {
|
|
762
|
-
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
763
843
|
if (filterObj.containsFilterValue !== '') {
|
|
764
844
|
return true;
|
|
765
845
|
}
|
|
@@ -875,7 +955,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
875
955
|
pzInsKey = row[`${associationCategory}:pzInsKey`];
|
|
876
956
|
}
|
|
877
957
|
if (column.isAssignmentLink) {
|
|
878
|
-
// @ts-ignore
|
|
879
958
|
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
880
959
|
containerName: 'primary',
|
|
881
960
|
channelName: ''
|
|
@@ -981,160 +1060,162 @@ export default function ListView(props: ListViewProps) {
|
|
|
981
1060
|
<>
|
|
982
1061
|
{arColumns && arColumns.length > 0 && (
|
|
983
1062
|
<Paper className={classes.paper}>
|
|
984
|
-
<
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
<
|
|
990
|
-
<
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
<
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1063
|
+
<Grid2 container justifyContent='space-between'>
|
|
1064
|
+
<Typography variant='h6' color='textPrimary' gutterBottom>
|
|
1065
|
+
{_listTitle()}
|
|
1066
|
+
</Typography>
|
|
1067
|
+
{globalSearch && (
|
|
1068
|
+
<Grid2 container spacing={1} alignItems='flex-end'>
|
|
1069
|
+
<Grid2>
|
|
1070
|
+
<SearchIcon />
|
|
1071
|
+
</Grid2>
|
|
1072
|
+
<Grid2>
|
|
1073
|
+
<TextField
|
|
1074
|
+
label={PCore.getLocaleUtils().getLocaleValue('Search', 'Search')}
|
|
1075
|
+
fullWidth
|
|
1076
|
+
variant='outlined'
|
|
1077
|
+
placeholder=''
|
|
1078
|
+
size='small'
|
|
1079
|
+
id='search'
|
|
1080
|
+
onChange={_onSearch}
|
|
1081
|
+
/>
|
|
1082
|
+
</Grid2>
|
|
1083
|
+
</Grid2>
|
|
1084
|
+
)}
|
|
1085
|
+
</Grid2>
|
|
1086
|
+
{!bInForm ? (
|
|
1087
|
+
<TableContainer id='list-view' className={classes.tableInForm}>
|
|
1088
|
+
<Table stickyHeader aria-label='sticky table'>
|
|
1089
|
+
<TableHead>
|
|
1090
|
+
<TableRow>
|
|
1091
|
+
{arColumns.map(column => {
|
|
1092
|
+
return (
|
|
1093
|
+
<TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
|
|
1094
|
+
<TableSortLabel
|
|
1095
|
+
active={orderBy === column.id}
|
|
1096
|
+
direction={orderBy === column.id ? order : 'asc'}
|
|
1097
|
+
onClick={createSortHandler(column.id)}
|
|
1098
|
+
>
|
|
1099
|
+
{column.label}
|
|
1100
|
+
{_showFilteredIcon(column.id) && <FilterListIcon className={classes.filteredIcon} />}
|
|
1101
|
+
{orderBy === column.id ? (
|
|
1102
|
+
<span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
|
|
1103
|
+
) : null}
|
|
1104
|
+
</TableSortLabel>
|
|
1105
|
+
<MoreIcon
|
|
1106
|
+
className={classes.moreIcon}
|
|
1107
|
+
onClick={event => {
|
|
1108
|
+
_menuClick(event, column.id, column.type, column.label);
|
|
1109
|
+
}}
|
|
1110
|
+
/>
|
|
1111
|
+
</TableCell>
|
|
1112
|
+
);
|
|
1113
|
+
})}
|
|
1114
|
+
</TableRow>
|
|
1115
|
+
</TableHead>
|
|
1116
|
+
<TableBody>
|
|
1117
|
+
{arRows &&
|
|
1118
|
+
stableSort(arRows, getComparator(order, orderBy))
|
|
1119
|
+
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1120
|
+
.map(row => {
|
|
1012
1121
|
return (
|
|
1013
|
-
<
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1122
|
+
<TableRow key={row.pxRefObjectInsName || row.pyID}>
|
|
1123
|
+
{arColumns.map(column => {
|
|
1124
|
+
const value = row[column.id];
|
|
1125
|
+
return (
|
|
1126
|
+
<TableCell key={column.id} align={column.align} className={classes.cell}>
|
|
1127
|
+
{_showButton(column.id, row) || column.displayAsLink ? (
|
|
1128
|
+
<Link
|
|
1129
|
+
component='button'
|
|
1130
|
+
onClick={() => {
|
|
1131
|
+
_listViewClick(row, column);
|
|
1132
|
+
}}
|
|
1133
|
+
underline='hover'
|
|
1134
|
+
>
|
|
1135
|
+
{column.format && typeof value === 'number' ? column.format(value) : value}
|
|
1136
|
+
</Link>
|
|
1137
|
+
) : (
|
|
1138
|
+
<>{column.format && typeof value === 'number' ? column.format(value) : value || '---'}</>
|
|
1139
|
+
)}
|
|
1140
|
+
</TableCell>
|
|
1141
|
+
);
|
|
1142
|
+
})}
|
|
1143
|
+
</TableRow>
|
|
1032
1144
|
);
|
|
1033
1145
|
})}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
</Table>
|
|
1068
|
-
</TableContainer>
|
|
1069
|
-
) : (
|
|
1070
|
-
<TableContainer id='list-view'>
|
|
1071
|
-
<Table>
|
|
1072
|
-
<TableHead>
|
|
1073
|
-
<TableRow>
|
|
1074
|
-
{(selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) && <TableCell />}
|
|
1075
|
-
{arColumns.map(column => {
|
|
1146
|
+
</TableBody>
|
|
1147
|
+
</Table>
|
|
1148
|
+
</TableContainer>
|
|
1149
|
+
) : (
|
|
1150
|
+
<TableContainer id='list-view'>
|
|
1151
|
+
<Table>
|
|
1152
|
+
<TableHead>
|
|
1153
|
+
<TableRow>
|
|
1154
|
+
{(selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) && <TableCell />}
|
|
1155
|
+
{arColumns.map(column => {
|
|
1156
|
+
return (
|
|
1157
|
+
<TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
|
|
1158
|
+
<TableSortLabel
|
|
1159
|
+
active={orderBy === column.id}
|
|
1160
|
+
direction={orderBy === column.id ? order : 'asc'}
|
|
1161
|
+
onClick={createSortHandler(column.id)}
|
|
1162
|
+
>
|
|
1163
|
+
{column.label}
|
|
1164
|
+
{orderBy === column.id ? (
|
|
1165
|
+
<span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
|
|
1166
|
+
) : null}
|
|
1167
|
+
</TableSortLabel>
|
|
1168
|
+
</TableCell>
|
|
1169
|
+
);
|
|
1170
|
+
})}
|
|
1171
|
+
</TableRow>
|
|
1172
|
+
</TableHead>
|
|
1173
|
+
<TableBody>
|
|
1174
|
+
{arRows &&
|
|
1175
|
+
arRows.length > 0 &&
|
|
1176
|
+
stableSort(arRows, getComparator(order, orderBy))
|
|
1177
|
+
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1178
|
+
.map(row => {
|
|
1076
1179
|
return (
|
|
1077
|
-
<
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1180
|
+
<TableRow key={row[rowID]}>
|
|
1181
|
+
{selectionMode === SELECTION_MODE.SINGLE && (
|
|
1182
|
+
<TableCell>
|
|
1183
|
+
<Radio
|
|
1184
|
+
onChange={handleChange}
|
|
1185
|
+
value={row[rowID]}
|
|
1186
|
+
name='radio-buttons'
|
|
1187
|
+
inputProps={{ 'aria-label': 'A' }}
|
|
1188
|
+
checked={selectedValue === row[rowID]}
|
|
1189
|
+
/>
|
|
1190
|
+
</TableCell>
|
|
1191
|
+
)}
|
|
1192
|
+
{selectionMode === SELECTION_MODE.MULTI && (
|
|
1193
|
+
<TableCell>
|
|
1194
|
+
<Checkbox
|
|
1195
|
+
onChange={onCheckboxClick}
|
|
1196
|
+
checked={selectedValues.some(selectedValue => selectedValue[rowID] === row[rowID])}
|
|
1197
|
+
value={row[rowID]}
|
|
1198
|
+
/>
|
|
1199
|
+
</TableCell>
|
|
1200
|
+
)}
|
|
1201
|
+
{arColumns.map(column => {
|
|
1202
|
+
const value = row[column.id];
|
|
1203
|
+
return (
|
|
1204
|
+
<TableCell className={classes.cell} key={column.id} align={column.align}>
|
|
1205
|
+
{processColumnValue(column, value)}
|
|
1206
|
+
</TableCell>
|
|
1207
|
+
);
|
|
1208
|
+
})}
|
|
1209
|
+
</TableRow>
|
|
1089
1210
|
);
|
|
1090
1211
|
})}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
.map(row => {
|
|
1099
|
-
return (
|
|
1100
|
-
<TableRow key={row[rowID]}>
|
|
1101
|
-
{selectionMode === SELECTION_MODE.SINGLE && (
|
|
1102
|
-
<TableCell>
|
|
1103
|
-
<Radio
|
|
1104
|
-
onChange={handleChange}
|
|
1105
|
-
value={row[rowID]}
|
|
1106
|
-
name='radio-buttons'
|
|
1107
|
-
inputProps={{ 'aria-label': 'A' }}
|
|
1108
|
-
checked={selectedValue === row[rowID]}
|
|
1109
|
-
/>
|
|
1110
|
-
</TableCell>
|
|
1111
|
-
)}
|
|
1112
|
-
{selectionMode === SELECTION_MODE.MULTI && (
|
|
1113
|
-
<TableCell>
|
|
1114
|
-
<Checkbox
|
|
1115
|
-
onChange={onCheckboxClick}
|
|
1116
|
-
checked={selectedValues.some(selectedValue => selectedValue[rowID] === row[rowID])}
|
|
1117
|
-
value={row[rowID]}
|
|
1118
|
-
/>
|
|
1119
|
-
</TableCell>
|
|
1120
|
-
)}
|
|
1121
|
-
{arColumns.map(column => {
|
|
1122
|
-
const value = row[column.id];
|
|
1123
|
-
return (
|
|
1124
|
-
<TableCell className={classes.cell} key={column.id} align={column.align}>
|
|
1125
|
-
{processColumnValue(column, value)}
|
|
1126
|
-
</TableCell>
|
|
1127
|
-
);
|
|
1128
|
-
})}
|
|
1129
|
-
</TableRow>
|
|
1130
|
-
);
|
|
1131
|
-
})}
|
|
1132
|
-
</TableBody>
|
|
1133
|
-
</Table>
|
|
1134
|
-
{arRows && arRows.length === 0 && <div className='no-records'>No records found.</div>}
|
|
1135
|
-
</TableContainer>
|
|
1136
|
-
)}
|
|
1137
|
-
</>
|
|
1212
|
+
</TableBody>
|
|
1213
|
+
</Table>
|
|
1214
|
+
{(!arRows || arRows.length === 0) && (
|
|
1215
|
+
<div className='no-records'>{getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.')}</div>
|
|
1216
|
+
)}
|
|
1217
|
+
</TableContainer>
|
|
1218
|
+
)}
|
|
1138
1219
|
{arRows && arRows.length > 0 && (
|
|
1139
1220
|
<TablePagination
|
|
1140
1221
|
id='pagination'
|