@pega/react-sdk-overrides 24.2.11 → 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 +7 -8
- 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 +6 -6
- package/lib/field/Checkbox/Checkbox.tsx +97 -4
- package/lib/field/Currency/Currency.tsx +3 -3
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +3 -7
- package/lib/field/DateTime/DateTime.tsx +3 -8
- package/lib/field/Decimal/Decimal.tsx +3 -5
- package/lib/field/Dropdown/Dropdown.tsx +5 -7
- 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 +3 -7
- package/lib/field/Phone/Phone.tsx +7 -5
- package/lib/field/RadioButtons/RadioButtons.tsx +47 -2
- package/lib/field/RichText/RichText.css +79 -0
- package/lib/field/RichText/RichText.tsx +3 -1
- package/lib/field/ScalarList/ScalarList.tsx +2 -3
- 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 +3 -7
- package/lib/field/URL/URL.tsx +5 -7
- package/lib/field/UserReference/UserReference.tsx +2 -3
- package/lib/helpers/attachmentShared.ts +6 -0
- package/lib/helpers/common-utils.ts +3 -4
- package/lib/helpers/data_page.ts +0 -1
- package/lib/helpers/field-group-utils.ts +1 -1
- package/lib/helpers/formatters/Currency.ts +9 -4
- package/lib/helpers/formatters/CurrencyMap.ts +0 -2
- 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 +37 -30
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +17 -96
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +1 -2
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +7 -6
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +4 -5
- package/lib/infra/Containers/container-helpers.ts +47 -1
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +3 -6
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
- package/lib/infra/DeferLoad/DeferLoad.tsx +2 -4
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -3
- package/lib/infra/MultiStep/MultiStep.css +48 -70
- package/lib/infra/MultiStep/MultiStep.tsx +27 -53
- 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 +2 -3
- 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 +16 -17
- package/lib/template/BannerPage/BannerPage.tsx +2 -2
- package/lib/template/CaseSummary/CaseSummary.tsx +28 -41
- package/lib/template/CaseView/CaseView.tsx +28 -35
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +1 -1
- package/lib/template/Confirmation/Confirmation.tsx +2 -3
- 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 -1
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +2 -3
- 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 +278 -198
- package/lib/template/ListView/hooks.ts +1 -5
- package/lib/template/ListView/utils.ts +38 -5
- 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 -2
- package/lib/template/SelfServiceCaseView/SelfServiceCaseView.tsx +145 -0
- package/lib/template/SelfServiceCaseView/index.tsx +1 -0
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +2 -3
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +36 -33
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +1 -1
- 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 +6 -8
- package/lib/widget/Attachment/Attachment.tsx +303 -225
- 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 +29 -22
- package/lib/widget/Followers/Followers.tsx +2 -4
- package/lib/widget/QuickCreate/QuickCreate.tsx +1 -2
- package/lib/widget/SummaryItem/SummaryItem.css +9 -11
- package/lib/widget/SummaryItem/SummaryItem.tsx +2 -2
- package/lib/widget/SummaryList/SummaryList.tsx +1 -1
- package/lib/widget/ToDo/ToDo.css +1 -13
- package/lib/widget/ToDo/ToDo.tsx +37 -36
- package/package.json +1 -1
- package/lib/helpers/attachmentHelpers.ts +0 -76
|
@@ -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,7 +32,6 @@ 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';
|
|
@@ -47,7 +41,7 @@ import { getGenericFieldsLocalizedValue } from '@pega/react-sdk-components/lib/c
|
|
|
47
41
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
48
42
|
|
|
49
43
|
import useInit from './hooks';
|
|
50
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
44
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
51
45
|
|
|
52
46
|
interface ListViewProps extends PConnProps {
|
|
53
47
|
// If any, enter additional props that only exist on this component
|
|
@@ -63,6 +57,9 @@ interface ListViewProps extends PConnProps {
|
|
|
63
57
|
showDynamicFields?: boolean;
|
|
64
58
|
readonlyContextList?: any;
|
|
65
59
|
value: any;
|
|
60
|
+
viewName?: string;
|
|
61
|
+
showRecords?: boolean;
|
|
62
|
+
displayAs?: string;
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
@@ -89,26 +86,29 @@ export default function ListView(props: ListViewProps) {
|
|
|
89
86
|
parameters,
|
|
90
87
|
compositeKeys,
|
|
91
88
|
showDynamicFields,
|
|
89
|
+
viewName,
|
|
92
90
|
readonlyContextList: selectedValues,
|
|
93
|
-
value
|
|
91
|
+
value,
|
|
92
|
+
displayAs
|
|
94
93
|
} = props;
|
|
94
|
+
let { showRecords } = props;
|
|
95
95
|
const ref = useRef({}).current;
|
|
96
96
|
const cosmosTableRef = useRef();
|
|
97
97
|
// List component context
|
|
98
98
|
const [listContext, setListContext] = useState<any>({});
|
|
99
99
|
const { meta } = listContext;
|
|
100
|
-
const
|
|
101
|
-
const xRayUid = xRayApis.startXRay();
|
|
100
|
+
const { current: uniqueId } = useRef(crypto.randomUUID());
|
|
102
101
|
|
|
103
102
|
useInit({
|
|
104
103
|
...props,
|
|
105
104
|
setListContext,
|
|
106
105
|
ref,
|
|
107
106
|
showDynamicFields,
|
|
108
|
-
xRayUid,
|
|
109
107
|
cosmosTableRef
|
|
110
108
|
});
|
|
111
109
|
|
|
110
|
+
useClearSelectionsAndUpdateTable({ getPConnect, uniqueId, viewName });
|
|
111
|
+
|
|
112
112
|
const thePConn = getPConnect();
|
|
113
113
|
const componentConfig = thePConn.getComponentConfig();
|
|
114
114
|
const resolvedConfigProps: any = thePConn.getConfigProps() as ListViewProps;
|
|
@@ -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');
|
|
@@ -260,18 +286,24 @@ export default function ListView(props: ListViewProps) {
|
|
|
260
286
|
theField = theField.substring(1);
|
|
261
287
|
}
|
|
262
288
|
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
263
|
-
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
|
+
}
|
|
264
296
|
const headerRow: any = {};
|
|
265
297
|
headerRow.id = fields[index].id;
|
|
266
298
|
headerRow.type = field.type;
|
|
267
|
-
headerRow.displayAsLink =
|
|
299
|
+
headerRow.displayAsLink = shouldDisplayAsSemanticLink;
|
|
268
300
|
headerRow.numeric = field.type === 'Decimal' || field.type === 'Integer' || field.type === 'Percentage' || field.type === 'Currency' || false;
|
|
269
301
|
headerRow.disablePadding = false;
|
|
270
302
|
headerRow.label = fields[index].label;
|
|
271
303
|
if (colIndex > -1) {
|
|
272
304
|
headerRow.classID = fields[colIndex].classID;
|
|
273
305
|
}
|
|
274
|
-
if (
|
|
306
|
+
if (shouldDisplayAsSemanticLink) {
|
|
275
307
|
headerRow.isAssignmentLink = AssignDashObjects.includes(headerRow.classID);
|
|
276
308
|
if (field.config.value?.startsWith('@CA')) {
|
|
277
309
|
headerRow.isAssociation = true;
|
|
@@ -285,7 +317,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
285
317
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
286
318
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
287
319
|
if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
|
|
288
|
-
// eslint-disable-next-line no-console
|
|
289
320
|
console.error('pyGUID or pyID values are mandatory to select the required row from the list');
|
|
290
321
|
}
|
|
291
322
|
}
|
|
@@ -307,32 +338,43 @@ export default function ListView(props: ListViewProps) {
|
|
|
307
338
|
|
|
308
339
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CHANGE fires
|
|
309
340
|
function processFilterChange(data) {
|
|
310
|
-
|
|
341
|
+
let filterId;
|
|
342
|
+
let filterExpression;
|
|
343
|
+
let isDateRange;
|
|
344
|
+
let field;
|
|
311
345
|
let dashboardFilterPayload: any = {
|
|
312
346
|
query: {
|
|
313
347
|
filter: {},
|
|
314
348
|
select: []
|
|
315
349
|
}
|
|
316
350
|
};
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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
|
+
});
|
|
329
369
|
});
|
|
330
|
-
});
|
|
331
370
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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
|
+
}
|
|
335
375
|
}
|
|
376
|
+
// Will be AND by default but making it dynamic in case we support dynamic relational ops in future
|
|
377
|
+
const relationalOp = 'AND';
|
|
336
378
|
// This is a flag which will be used to reset dashboardFilterPayload in case we don't find any valid filters
|
|
337
379
|
let validFilter = false;
|
|
338
380
|
|
|
@@ -342,7 +384,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
342
384
|
const filter = filters.current[filterExp];
|
|
343
385
|
// If the filter is null then we can skip this iteration
|
|
344
386
|
if (filter === null) {
|
|
345
|
-
// eslint-disable-next-line no-continue
|
|
346
387
|
continue;
|
|
347
388
|
}
|
|
348
389
|
|
|
@@ -351,7 +392,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
351
392
|
field = getFieldFromFilter(filter, isDateRange);
|
|
352
393
|
|
|
353
394
|
if (!(columnList.current.length && columnList.current.includes(field))) {
|
|
354
|
-
// eslint-disable-next-line no-continue
|
|
355
395
|
continue;
|
|
356
396
|
}
|
|
357
397
|
// If we reach here that implies we've at least one valid filter, hence setting the flag
|
|
@@ -378,7 +418,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
378
418
|
} else {
|
|
379
419
|
dashboardFilterPayload.query.filter.filterConditions = {
|
|
380
420
|
...dashboardFilterPayload.query.filter.filterConditions,
|
|
381
|
-
[`T${index++}`]: { ...filter.condition, ignoreCase: true }
|
|
421
|
+
[`T${index++}`]: { ...filter.condition, ...(filter.condition.comparator === 'CONTAINS' ? { ignoreCase: true } : {}) }
|
|
382
422
|
};
|
|
383
423
|
|
|
384
424
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
@@ -406,6 +446,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
406
446
|
}
|
|
407
447
|
|
|
408
448
|
function fetchAllData(fields): any {
|
|
449
|
+
if (displayAs === 'advancedSearch' && !showRecords) {
|
|
450
|
+
return Promise.resolve({ data: null });
|
|
451
|
+
}
|
|
409
452
|
let query: any = null;
|
|
410
453
|
if (payload) {
|
|
411
454
|
query = payload.query;
|
|
@@ -556,8 +599,36 @@ export default function ListView(props: ListViewProps) {
|
|
|
556
599
|
};
|
|
557
600
|
}
|
|
558
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
|
+
|
|
559
629
|
useEffect(() => {
|
|
560
630
|
if (listContext.meta) {
|
|
631
|
+
const identifier = `promoted-filters-queryable-${uniqueId}`;
|
|
561
632
|
fetchDataFromServer();
|
|
562
633
|
setTimeout(() => {
|
|
563
634
|
PCore.getPubSubUtils().subscribe(
|
|
@@ -579,6 +650,15 @@ export default function ListView(props: ListViewProps) {
|
|
|
579
650
|
false,
|
|
580
651
|
getPConnect().getContextName()
|
|
581
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
|
+
);
|
|
582
662
|
}, 0);
|
|
583
663
|
|
|
584
664
|
return function cleanupSubscriptions() {
|
|
@@ -592,6 +672,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
592
672
|
`dashboard-component-${'id'}`,
|
|
593
673
|
getPConnect().getContextName()
|
|
594
674
|
);
|
|
675
|
+
PCore.getPubSubUtils().unsubscribe(PCore.getEvents().getTransientEvent().UPDATE_PROMOTED_FILTERS, identifier);
|
|
595
676
|
};
|
|
596
677
|
}
|
|
597
678
|
}, [listContext]);
|
|
@@ -629,7 +710,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
629
710
|
|
|
630
711
|
function showToast(message: string) {
|
|
631
712
|
const theMessage = `Assignment: ${message}`;
|
|
632
|
-
|
|
713
|
+
|
|
633
714
|
console.error(theMessage);
|
|
634
715
|
setSnackbarMessage(message);
|
|
635
716
|
setShowSnackbar(true);
|
|
@@ -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
|
}
|
|
@@ -980,162 +1060,162 @@ export default function ListView(props: ListViewProps) {
|
|
|
980
1060
|
<>
|
|
981
1061
|
{arColumns && arColumns.length > 0 && (
|
|
982
1062
|
<Paper className={classes.paper}>
|
|
983
|
-
<
|
|
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
|
-
|
|
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 => {
|
|
1011
1121
|
return (
|
|
1012
|
-
<
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
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>
|
|
1031
1144
|
);
|
|
1032
1145
|
})}
|
|
1033
|
-
|
|
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
|
-
</Table>
|
|
1067
|
-
</TableContainer>
|
|
1068
|
-
) : (
|
|
1069
|
-
<TableContainer id='list-view'>
|
|
1070
|
-
<Table>
|
|
1071
|
-
<TableHead>
|
|
1072
|
-
<TableRow>
|
|
1073
|
-
{(selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) && <TableCell />}
|
|
1074
|
-
{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 => {
|
|
1075
1179
|
return (
|
|
1076
|
-
<
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
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>
|
|
1088
1210
|
);
|
|
1089
1211
|
})}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
.map(row => {
|
|
1098
|
-
return (
|
|
1099
|
-
<TableRow key={row[rowID]}>
|
|
1100
|
-
{selectionMode === SELECTION_MODE.SINGLE && (
|
|
1101
|
-
<TableCell>
|
|
1102
|
-
<Radio
|
|
1103
|
-
onChange={handleChange}
|
|
1104
|
-
value={row[rowID]}
|
|
1105
|
-
name='radio-buttons'
|
|
1106
|
-
inputProps={{ 'aria-label': 'A' }}
|
|
1107
|
-
checked={selectedValue === row[rowID]}
|
|
1108
|
-
/>
|
|
1109
|
-
</TableCell>
|
|
1110
|
-
)}
|
|
1111
|
-
{selectionMode === SELECTION_MODE.MULTI && (
|
|
1112
|
-
<TableCell>
|
|
1113
|
-
<Checkbox
|
|
1114
|
-
onChange={onCheckboxClick}
|
|
1115
|
-
checked={selectedValues.some(selectedValue => selectedValue[rowID] === row[rowID])}
|
|
1116
|
-
value={row[rowID]}
|
|
1117
|
-
/>
|
|
1118
|
-
</TableCell>
|
|
1119
|
-
)}
|
|
1120
|
-
{arColumns.map(column => {
|
|
1121
|
-
const value = row[column.id];
|
|
1122
|
-
return (
|
|
1123
|
-
<TableCell className={classes.cell} key={column.id} align={column.align}>
|
|
1124
|
-
{processColumnValue(column, value)}
|
|
1125
|
-
</TableCell>
|
|
1126
|
-
);
|
|
1127
|
-
})}
|
|
1128
|
-
</TableRow>
|
|
1129
|
-
);
|
|
1130
|
-
})}
|
|
1131
|
-
</TableBody>
|
|
1132
|
-
</Table>
|
|
1133
|
-
{arRows && arRows.length === 0 && (
|
|
1134
|
-
<div className='no-records'>{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}</div>
|
|
1135
|
-
)}
|
|
1136
|
-
</TableContainer>
|
|
1137
|
-
)}
|
|
1138
|
-
</>
|
|
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
|
+
)}
|
|
1139
1219
|
{arRows && arRows.length > 0 && (
|
|
1140
1220
|
<TablePagination
|
|
1141
1221
|
id='pagination'
|