@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.
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +1 -1
- package/lib/designSystemExtension/Banner/Banner.tsx +1 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -2
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +59 -32
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +4 -4
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +5 -5
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +6 -6
- package/lib/designSystemExtension/Operator/Operator.tsx +16 -12
- package/lib/designSystemExtension/Pulse/Pulse.tsx +3 -3
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
- package/lib/field/AutoComplete/AutoComplete.tsx +5 -5
- package/lib/field/CancelAlert/CancelAlert.tsx +5 -8
- package/lib/field/Checkbox/Checkbox.tsx +5 -5
- package/lib/field/Currency/Currency.tsx +12 -9
- package/lib/field/Date/Date.tsx +29 -48
- package/lib/field/DateTime/DateTime.tsx +37 -39
- package/lib/field/Decimal/Decimal.tsx +12 -9
- package/lib/field/Dropdown/Dropdown.tsx +34 -27
- package/lib/field/Email/Email.tsx +39 -20
- package/lib/field/Group/Group.tsx +4 -4
- package/lib/field/Integer/Integer.tsx +27 -15
- package/lib/field/Multiselect/Multiselect.tsx +8 -14
- package/lib/field/Multiselect/utils.ts +1 -1
- package/lib/field/Percentage/Percentage.tsx +11 -11
- package/lib/field/Phone/Phone.tsx +13 -10
- package/lib/field/Phone/config-ext.json +8 -0
- package/lib/field/RadioButtons/RadioButtons.tsx +4 -7
- package/lib/field/RichText/RichText.tsx +2 -2
- package/lib/field/RichText/config-ext.json +10 -0
- package/lib/field/ScalarList/ScalarList.tsx +4 -5
- package/lib/field/SemanticLink/SemanticLink.tsx +5 -5
- package/lib/field/TextArea/TextArea.tsx +30 -14
- package/lib/field/TextContent/TextContent.tsx +2 -2
- package/lib/field/TextInput/TextInput.tsx +7 -9
- package/lib/field/Time/Time.tsx +30 -27
- package/lib/field/URL/URL.tsx +29 -12
- package/lib/field/UserReference/UserReference.tsx +4 -6
- package/lib/helpers/common-utils.ts +24 -1
- package/lib/helpers/field-group-utils.ts +3 -3
- package/lib/helpers/formatters/Currency.ts +11 -16
- package/lib/helpers/formatters/common.ts +2 -1
- package/lib/helpers/formatters/index.ts +2 -4
- package/lib/helpers/simpleTableHelpers.ts +1 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +3 -3
- package/lib/infra/Assignment/Assignment.tsx +14 -14
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +17 -29
- package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +10 -5
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +9 -9
- package/lib/infra/Containers/SimpleView/helper.ts +1 -1
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +2 -2
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +6 -8
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
- package/lib/infra/DeferLoad/DeferLoad.tsx +9 -9
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -1
- package/lib/infra/MultiStep/MultiStep.tsx +17 -16
- package/lib/infra/NavBar/NavBar.css +1 -0
- package/lib/infra/NavBar/NavBar.tsx +49 -38
- package/lib/infra/Reference/Reference.tsx +1 -1
- package/lib/infra/Region/Region.tsx +1 -1
- package/lib/infra/RootContainer/RootContainer.tsx +7 -8
- package/lib/infra/Stages/Stages.tsx +5 -5
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +4 -3
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
- package/lib/infra/View/View.tsx +38 -4
- package/lib/template/AdvancedSearch/AdvancedSearch.tsx +87 -0
- package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +58 -0
- package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +245 -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.tsx +62 -12
- package/lib/template/BannerPage/BannerPage.tsx +2 -2
- package/lib/template/BannerPage/config-ext.json +9 -0
- package/lib/template/CaseSummary/CaseSummary.tsx +2 -2
- package/lib/template/CaseView/CaseView.tsx +12 -11
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +8 -8
- package/lib/template/Confirmation/Confirmation.tsx +5 -4
- package/lib/template/DataReference/DataReference.tsx +318 -108
- package/lib/template/DataReference/DataReferenceAdvancedSearchContext.js +10 -0
- package/lib/template/DataReference/SearchForm.tsx +148 -0
- package/lib/template/DataReference/utils.js +90 -0
- package/lib/template/DefaultForm/DefaultForm.tsx +2 -2
- package/lib/template/DefaultForm/utils/index.ts +1 -3
- package/lib/template/Details/Details/Details.tsx +3 -3
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +5 -5
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +3 -3
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +3 -3
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +5 -5
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +11 -6
- package/lib/template/InlineDashboard/InlineDashboard.tsx +4 -4
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
- package/lib/template/InlineDashboardPage/config-ext.json +9 -0
- package/lib/template/ListPage/ListPage.tsx +1 -1
- package/lib/template/ListView/ListView.tsx +201 -95
- package/lib/template/ListView/utils.ts +38 -6
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +1 -1
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +2 -2
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +3 -3
- 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 +4 -4
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
- package/lib/template/PromotedFilters/PromotedFilters.tsx +2 -3
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +1 -3
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +112 -88
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +3 -5
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +1 -1
- package/lib/template/SubTabs/SubTabs.tsx +4 -4
- package/lib/template/SubTabs/tabUtils.ts +118 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -10
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -10
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +2 -2
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +3 -3
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
- package/lib/template/WssNavBar/WssNavBar.tsx +10 -10
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +3 -3
- package/lib/widget/Attachment/Attachment.css +1 -0
- package/lib/widget/Attachment/Attachment.tsx +8 -10
- package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +6 -5
- package/lib/widget/Followers/Followers.tsx +4 -4
- package/lib/widget/QuickCreate/QuickCreate.tsx +1 -2
- package/lib/widget/QuickCreate/config-ext.json +9 -0
- package/lib/widget/SummaryItem/SummaryItem.tsx +5 -4
- package/lib/widget/SummaryList/SummaryList.tsx +1 -1
- package/lib/widget/ToDo/ToDo.tsx +102 -40
- package/package.json +1 -1
- /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
|
@@ -3,48 +3,50 @@
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
5
5
|
|
|
6
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
|
|
6
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
7
|
+
import type { Theme } from '@mui/material/styles';
|
|
8
|
+
import createStyles from '@mui/styles/createStyles';
|
|
9
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
10
|
+
import Table from '@mui/material/Table';
|
|
11
|
+
import TableBody from '@mui/material/TableBody';
|
|
12
|
+
import TableCell from '@mui/material/TableCell';
|
|
13
|
+
import TableContainer from '@mui/material/TableContainer';
|
|
14
|
+
import TableHead from '@mui/material/TableHead';
|
|
15
|
+
import TablePagination from '@mui/material/TablePagination';
|
|
16
|
+
import TableRow from '@mui/material/TableRow';
|
|
17
|
+
import TableSortLabel from '@mui/material/TableSortLabel';
|
|
18
|
+
import Paper from '@mui/material/Paper';
|
|
19
|
+
import MoreIcon from '@mui/icons-material/MoreVert';
|
|
20
|
+
import FilterListIcon from '@mui/icons-material/FilterList';
|
|
21
|
+
import SubjectIcon from '@mui/icons-material/Subject';
|
|
22
|
+
import SearchIcon from '@mui/icons-material/Search';
|
|
23
|
+
import TextField from '@mui/material/TextField';
|
|
24
|
+
import Grid from '@mui/material/Grid';
|
|
25
|
+
import Menu from '@mui/material/Menu';
|
|
26
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
27
|
+
import Dialog from '@mui/material/Dialog';
|
|
28
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
29
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
30
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
31
|
+
import Select from '@mui/material/Select';
|
|
32
|
+
import Button from '@mui/material/Button';
|
|
33
|
+
import Link from '@mui/material/Link';
|
|
34
|
+
import Typography from '@mui/material/Typography';
|
|
35
|
+
import Snackbar from '@mui/material/Snackbar';
|
|
36
|
+
import IconButton from '@mui/material/IconButton';
|
|
37
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
38
|
+
import { Radio } from '@mui/material';
|
|
39
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
39
40
|
import { filterData } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
40
41
|
|
|
41
42
|
import './ListView.css';
|
|
42
43
|
import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
43
44
|
import { getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
45
|
+
import { getGenericFieldsLocalizedValue } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
44
46
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
45
47
|
|
|
46
48
|
import useInit from './hooks';
|
|
47
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
49
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
48
50
|
|
|
49
51
|
interface ListViewProps extends PConnProps {
|
|
50
52
|
// If any, enter additional props that only exist on this component
|
|
@@ -60,6 +62,9 @@ interface ListViewProps extends PConnProps {
|
|
|
60
62
|
showDynamicFields?: boolean;
|
|
61
63
|
readonlyContextList?: any;
|
|
62
64
|
value: any;
|
|
65
|
+
viewName?: string;
|
|
66
|
+
showRecords?: boolean;
|
|
67
|
+
displayAs?: string;
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
@@ -86,9 +91,12 @@ export default function ListView(props: ListViewProps) {
|
|
|
86
91
|
parameters,
|
|
87
92
|
compositeKeys,
|
|
88
93
|
showDynamicFields,
|
|
94
|
+
viewName,
|
|
89
95
|
readonlyContextList: selectedValues,
|
|
90
|
-
value
|
|
96
|
+
value,
|
|
97
|
+
displayAs
|
|
91
98
|
} = props;
|
|
99
|
+
let { showRecords } = props;
|
|
92
100
|
const ref = useRef({}).current;
|
|
93
101
|
const cosmosTableRef = useRef();
|
|
94
102
|
// List component context
|
|
@@ -96,6 +104,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
96
104
|
const { meta } = listContext;
|
|
97
105
|
const xRayApis = PCore.getDebugger().getXRayRuntime();
|
|
98
106
|
const xRayUid = xRayApis.startXRay();
|
|
107
|
+
const { current: uniqueId } = useRef(crypto.randomUUID());
|
|
99
108
|
|
|
100
109
|
useInit({
|
|
101
110
|
...props,
|
|
@@ -106,8 +115,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
106
115
|
cosmosTableRef
|
|
107
116
|
});
|
|
108
117
|
|
|
118
|
+
useClearSelectionsAndUpdateTable({ getPConnect, uniqueId, viewName });
|
|
119
|
+
|
|
109
120
|
const thePConn = getPConnect();
|
|
110
|
-
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
111
121
|
const componentConfig = thePConn.getComponentConfig();
|
|
112
122
|
const resolvedConfigProps: any = thePConn.getConfigProps() as ListViewProps;
|
|
113
123
|
|
|
@@ -197,6 +207,37 @@ export default function ListView(props: ListViewProps) {
|
|
|
197
207
|
|
|
198
208
|
const classes = useStyles();
|
|
199
209
|
|
|
210
|
+
// Hook to clear the selections and update table in AdvancedSearch template when switching between search views
|
|
211
|
+
function useClearSelectionsAndUpdateTable({ getPConnect, uniqueId, viewName }) {
|
|
212
|
+
const clearSelectionsAndRefreshList = useCallback(
|
|
213
|
+
({ viewName: name, clearSelections }) => {
|
|
214
|
+
if (name === viewName) {
|
|
215
|
+
const { selectionMode } = getPConnect().getRawConfigProps();
|
|
216
|
+
if (!selectionMode) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (clearSelections) {
|
|
220
|
+
if (selectionMode === 'single') {
|
|
221
|
+
getPConnect().getListActions().setSelectedRows({});
|
|
222
|
+
} else {
|
|
223
|
+
getPConnect().getListActions().clearSelectedRows();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
[getPConnect, viewName]
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
const identifier = `clear-and-update-advanced-search-selections-${uniqueId}`;
|
|
233
|
+
PCore.getPubSubUtils().subscribe('update-advanced-search-selections', clearSelectionsAndRefreshList, identifier);
|
|
234
|
+
|
|
235
|
+
return () => {
|
|
236
|
+
PCore.getPubSubUtils().unsubscribe('update-advanced-search-selections', identifier);
|
|
237
|
+
};
|
|
238
|
+
}, [uniqueId, clearSelectionsAndRefreshList]);
|
|
239
|
+
}
|
|
240
|
+
|
|
200
241
|
const handleRequestSort = (event: React.MouseEvent<unknown>, property: keyof any) => {
|
|
201
242
|
const isAsc = orderBy === property && order === 'asc';
|
|
202
243
|
setOrder(isAsc ? 'desc' : 'asc');
|
|
@@ -220,11 +261,12 @@ export default function ListView(props: ListViewProps) {
|
|
|
220
261
|
|
|
221
262
|
type Order = 'asc' | 'desc';
|
|
222
263
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
264
|
+
interface Comparator<T> {
|
|
265
|
+
(a: T, b: T): number;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function getComparator<T, Key extends keyof T>(theOrder: Order, orderedBy: Key): Comparator<T> {
|
|
269
|
+
return theOrder === 'desc' ? (a: T, b: T) => descendingComparator(a, b, orderedBy) : (a: T, b: T) => -descendingComparator(a, b, orderedBy);
|
|
228
270
|
}
|
|
229
271
|
|
|
230
272
|
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
@@ -257,18 +299,24 @@ export default function ListView(props: ListViewProps) {
|
|
|
257
299
|
theField = theField.substring(1);
|
|
258
300
|
}
|
|
259
301
|
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
260
|
-
const displayAsLink = field.config.displayAsLink;
|
|
302
|
+
// const displayAsLink = field.config.displayAsLink;
|
|
303
|
+
const { additionalDetails = {} } = field.config;
|
|
304
|
+
let shouldDisplayAsSemanticLink = additionalDetails.type === 'DISPLAY_LINK';
|
|
305
|
+
// 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
|
|
306
|
+
if (!shouldDisplayAsSemanticLink) {
|
|
307
|
+
shouldDisplayAsSemanticLink = 'displayAsLink' in field.config && field.config.displayAsLink;
|
|
308
|
+
}
|
|
261
309
|
const headerRow: any = {};
|
|
262
310
|
headerRow.id = fields[index].id;
|
|
263
311
|
headerRow.type = field.type;
|
|
264
|
-
headerRow.displayAsLink =
|
|
312
|
+
headerRow.displayAsLink = shouldDisplayAsSemanticLink;
|
|
265
313
|
headerRow.numeric = field.type === 'Decimal' || field.type === 'Integer' || field.type === 'Percentage' || field.type === 'Currency' || false;
|
|
266
314
|
headerRow.disablePadding = false;
|
|
267
315
|
headerRow.label = fields[index].label;
|
|
268
316
|
if (colIndex > -1) {
|
|
269
317
|
headerRow.classID = fields[colIndex].classID;
|
|
270
318
|
}
|
|
271
|
-
if (
|
|
319
|
+
if (shouldDisplayAsSemanticLink) {
|
|
272
320
|
headerRow.isAssignmentLink = AssignDashObjects.includes(headerRow.classID);
|
|
273
321
|
if (field.config.value?.startsWith('@CA')) {
|
|
274
322
|
headerRow.isAssociation = true;
|
|
@@ -304,32 +352,43 @@ export default function ListView(props: ListViewProps) {
|
|
|
304
352
|
|
|
305
353
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CHANGE fires
|
|
306
354
|
function processFilterChange(data) {
|
|
307
|
-
|
|
355
|
+
let filterId;
|
|
356
|
+
let filterExpression;
|
|
357
|
+
let isDateRange;
|
|
358
|
+
let field;
|
|
308
359
|
let dashboardFilterPayload: any = {
|
|
309
360
|
query: {
|
|
310
361
|
filter: {},
|
|
311
362
|
select: []
|
|
312
363
|
}
|
|
313
364
|
};
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
365
|
+
if (displayAs === 'advancedSearch') {
|
|
366
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
367
|
+
Object.entries(data).reduce((acc, [item, value]) => {
|
|
368
|
+
const { filterId, filterExpression } = value as any;
|
|
369
|
+
filters.current[filterId] = filterExpression;
|
|
370
|
+
return acc; // Ensure the accumulator is returned
|
|
371
|
+
}, {});
|
|
372
|
+
} else {
|
|
373
|
+
({ filterId, filterExpression } = data);
|
|
374
|
+
filters.current[filterId] = filterExpression;
|
|
375
|
+
isDateRange = data.filterExpression?.AND;
|
|
376
|
+
field = getFieldFromFilter(filterExpression, isDateRange);
|
|
377
|
+
selectParam = [];
|
|
378
|
+
// Constructing the select parameters list (will be sent in dashboardFilterPayload)
|
|
379
|
+
columnList.current.forEach(col => {
|
|
380
|
+
selectParam.push({
|
|
381
|
+
field: col
|
|
382
|
+
});
|
|
326
383
|
});
|
|
327
|
-
});
|
|
328
384
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
385
|
+
// Checking if the triggered filter is applicable for this list
|
|
386
|
+
if (data.filterExpression !== null && !(columnList.current?.length && columnList.current?.includes(field))) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
332
389
|
}
|
|
390
|
+
// Will be AND by default but making it dynamic in case we support dynamic relational ops in future
|
|
391
|
+
const relationalOp = 'AND';
|
|
333
392
|
// This is a flag which will be used to reset dashboardFilterPayload in case we don't find any valid filters
|
|
334
393
|
let validFilter = false;
|
|
335
394
|
|
|
@@ -375,7 +434,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
375
434
|
} else {
|
|
376
435
|
dashboardFilterPayload.query.filter.filterConditions = {
|
|
377
436
|
...dashboardFilterPayload.query.filter.filterConditions,
|
|
378
|
-
[`T${index++}`]: { ...filter.condition, ignoreCase: true }
|
|
437
|
+
[`T${index++}`]: { ...filter.condition, ...(filter.condition.comparator === 'CONTAINS' ? { ignoreCase: true } : {}) }
|
|
379
438
|
};
|
|
380
439
|
|
|
381
440
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
@@ -403,6 +462,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
403
462
|
}
|
|
404
463
|
|
|
405
464
|
function fetchAllData(fields): any {
|
|
465
|
+
if (displayAs === 'advancedSearch' && !showRecords) {
|
|
466
|
+
return Promise.resolve({ data: null });
|
|
467
|
+
}
|
|
406
468
|
let query: any = null;
|
|
407
469
|
if (payload) {
|
|
408
470
|
query = payload.query;
|
|
@@ -553,8 +615,36 @@ export default function ListView(props: ListViewProps) {
|
|
|
553
615
|
};
|
|
554
616
|
}
|
|
555
617
|
|
|
618
|
+
function prepareFilters(data) {
|
|
619
|
+
return Object.entries(data.payload).reduce((acc, [field, value]) => {
|
|
620
|
+
if (value) {
|
|
621
|
+
let comparator = 'EQ';
|
|
622
|
+
const filterRecord = listContext.meta.fieldDefs.filter(item => item.id === field);
|
|
623
|
+
if (filterRecord?.[0]?.meta.type === 'TextInput') {
|
|
624
|
+
comparator = 'CONTAINS';
|
|
625
|
+
}
|
|
626
|
+
acc[field] = {
|
|
627
|
+
filterExpression: {
|
|
628
|
+
condition: {
|
|
629
|
+
lhs: {
|
|
630
|
+
field
|
|
631
|
+
},
|
|
632
|
+
comparator,
|
|
633
|
+
rhs: {
|
|
634
|
+
value
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
filterId: field
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
return acc;
|
|
642
|
+
}, {});
|
|
643
|
+
}
|
|
644
|
+
|
|
556
645
|
useEffect(() => {
|
|
557
646
|
if (listContext.meta) {
|
|
647
|
+
const identifier = `promoted-filters-queryable-${uniqueId}`;
|
|
558
648
|
fetchDataFromServer();
|
|
559
649
|
setTimeout(() => {
|
|
560
650
|
PCore.getPubSubUtils().subscribe(
|
|
@@ -576,6 +666,15 @@ export default function ListView(props: ListViewProps) {
|
|
|
576
666
|
false,
|
|
577
667
|
getPConnect().getContextName()
|
|
578
668
|
);
|
|
669
|
+
PCore.getPubSubUtils().subscribe(
|
|
670
|
+
PCore.getEvents().getTransientEvent().UPDATE_PROMOTED_FILTERS,
|
|
671
|
+
data => {
|
|
672
|
+
showRecords = data.showRecords;
|
|
673
|
+
const filterData = prepareFilters(data);
|
|
674
|
+
processFilterChange(filterData);
|
|
675
|
+
},
|
|
676
|
+
identifier
|
|
677
|
+
);
|
|
579
678
|
}, 0);
|
|
580
679
|
|
|
581
680
|
return function cleanupSubscriptions() {
|
|
@@ -589,6 +688,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
589
688
|
`dashboard-component-${'id'}`,
|
|
590
689
|
getPConnect().getContextName()
|
|
591
690
|
);
|
|
691
|
+
PCore.getPubSubUtils().unsubscribe(PCore.getEvents().getTransientEvent().UPDATE_PROMOTED_FILTERS, identifier);
|
|
592
692
|
};
|
|
593
693
|
}
|
|
594
694
|
}, [listContext]);
|
|
@@ -640,7 +740,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
640
740
|
|
|
641
741
|
thePConn
|
|
642
742
|
.getActionsApi()
|
|
643
|
-
// @ts-ignore
|
|
644
743
|
.openAssignment(pzInsKey, pxRefObjectClass, options)
|
|
645
744
|
.then(() => {
|
|
646
745
|
// console.log("openAssignment successful");
|
|
@@ -670,7 +769,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
670
769
|
}
|
|
671
770
|
}
|
|
672
771
|
|
|
673
|
-
function handleSnackbarClose(event: React.SyntheticEvent |
|
|
772
|
+
function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {
|
|
674
773
|
if (reason === 'clickaway') {
|
|
675
774
|
return;
|
|
676
775
|
}
|
|
@@ -873,7 +972,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
873
972
|
pzInsKey = row[`${associationCategory}:pzInsKey`];
|
|
874
973
|
}
|
|
875
974
|
if (column.isAssignmentLink) {
|
|
876
|
-
// @ts-ignore
|
|
877
975
|
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
878
976
|
containerName: 'primary',
|
|
879
977
|
channelName: ''
|
|
@@ -1032,33 +1130,35 @@ export default function ListView(props: ListViewProps) {
|
|
|
1032
1130
|
</TableRow>
|
|
1033
1131
|
</TableHead>
|
|
1034
1132
|
<TableBody>
|
|
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
|
-
|
|
1133
|
+
{arRows &&
|
|
1134
|
+
stableSort(arRows, getComparator(order, orderBy))
|
|
1135
|
+
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1136
|
+
.map(row => {
|
|
1137
|
+
return (
|
|
1138
|
+
<TableRow key={row.pxRefObjectInsName || row.pyID}>
|
|
1139
|
+
{arColumns.map(column => {
|
|
1140
|
+
const value = row[column.id];
|
|
1141
|
+
return (
|
|
1142
|
+
<TableCell key={column.id} align={column.align} className={classes.cell}>
|
|
1143
|
+
{_showButton(column.id, row) || column.displayAsLink ? (
|
|
1144
|
+
<Link
|
|
1145
|
+
component='button'
|
|
1146
|
+
onClick={() => {
|
|
1147
|
+
_listViewClick(row, column);
|
|
1148
|
+
}}
|
|
1149
|
+
underline='hover'
|
|
1150
|
+
>
|
|
1151
|
+
{column.format && typeof value === 'number' ? column.format(value) : value}
|
|
1152
|
+
</Link>
|
|
1153
|
+
) : (
|
|
1154
|
+
<>{column.format && typeof value === 'number' ? column.format(value) : value || '---'}</>
|
|
1155
|
+
)}
|
|
1156
|
+
</TableCell>
|
|
1157
|
+
);
|
|
1158
|
+
})}
|
|
1159
|
+
</TableRow>
|
|
1160
|
+
);
|
|
1161
|
+
})}
|
|
1062
1162
|
</TableBody>
|
|
1063
1163
|
</Table>
|
|
1064
1164
|
</TableContainer>
|
|
@@ -1127,7 +1227,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
1127
1227
|
})}
|
|
1128
1228
|
</TableBody>
|
|
1129
1229
|
</Table>
|
|
1130
|
-
{arRows
|
|
1230
|
+
{(!arRows || arRows.length === 0) && (
|
|
1231
|
+
<div className='no-records'>{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}</div>
|
|
1232
|
+
)}
|
|
1131
1233
|
</TableContainer>
|
|
1132
1234
|
)}
|
|
1133
1235
|
</>
|
|
@@ -1158,7 +1260,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
1158
1260
|
<DialogContent>
|
|
1159
1261
|
{containsDateOrTime ? (
|
|
1160
1262
|
<>
|
|
1161
|
-
<Select value={displayDialogDateFilter} onChange={_dialogDateFilter} fullWidth>
|
|
1263
|
+
<Select variant='standard' value={displayDialogDateFilter} onChange={_dialogDateFilter} fullWidth>
|
|
1162
1264
|
<MenuItem value='notequal'>is not equal to</MenuItem>
|
|
1163
1265
|
<MenuItem value='after'>after</MenuItem>
|
|
1164
1266
|
<MenuItem value='before'>before</MenuItem>
|
|
@@ -1167,6 +1269,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
1167
1269
|
</Select>
|
|
1168
1270
|
{filterType === 'Date' && (
|
|
1169
1271
|
<TextField
|
|
1272
|
+
variant='standard'
|
|
1170
1273
|
autoFocus
|
|
1171
1274
|
margin='dense'
|
|
1172
1275
|
id='containsFilter'
|
|
@@ -1178,6 +1281,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
1178
1281
|
)}
|
|
1179
1282
|
{filterType === 'DateTime' && (
|
|
1180
1283
|
<TextField
|
|
1284
|
+
variant='standard'
|
|
1181
1285
|
autoFocus
|
|
1182
1286
|
margin='dense'
|
|
1183
1287
|
id='containsFilter'
|
|
@@ -1189,6 +1293,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
1189
1293
|
)}
|
|
1190
1294
|
{filterType === 'Time' && (
|
|
1191
1295
|
<TextField
|
|
1296
|
+
variant='standard'
|
|
1192
1297
|
autoFocus
|
|
1193
1298
|
margin='dense'
|
|
1194
1299
|
id='containsFilter'
|
|
@@ -1201,12 +1306,13 @@ export default function ListView(props: ListViewProps) {
|
|
|
1201
1306
|
</>
|
|
1202
1307
|
) : (
|
|
1203
1308
|
<>
|
|
1204
|
-
<Select fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
|
|
1309
|
+
<Select variant='standard' fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
|
|
1205
1310
|
<MenuItem value='contains'>Contains</MenuItem>
|
|
1206
1311
|
<MenuItem value='equals'>Equals</MenuItem>
|
|
1207
1312
|
<MenuItem value='startswith'>Starts with</MenuItem>
|
|
1208
1313
|
</Select>
|
|
1209
1314
|
<TextField
|
|
1315
|
+
variant='standard'
|
|
1210
1316
|
autoFocus
|
|
1211
1317
|
margin='dense'
|
|
1212
1318
|
id='containsFilter'
|
|
@@ -13,14 +13,21 @@ export const formatConstants = {
|
|
|
13
13
|
class DataApi {
|
|
14
14
|
mappedPropertyToOriginalProperty: any;
|
|
15
15
|
originalPropertyToMappedProperty: any;
|
|
16
|
-
|
|
16
|
+
showRecords: any;
|
|
17
|
+
constructor(showRecords = true) {
|
|
18
|
+
this.showRecords = showRecords;
|
|
17
19
|
this.originalPropertyToMappedProperty = {};
|
|
18
20
|
this.mappedPropertyToOriginalProperty = {};
|
|
21
|
+
this.setShowRecords = this.setShowRecords.bind(this);
|
|
19
22
|
this.setPropertyMaps = this.setPropertyMaps.bind(this);
|
|
20
23
|
this.getMappedProperty = this.getMappedProperty.bind(this);
|
|
21
24
|
this.getOriginalProperty = this.getOriginalProperty.bind(this);
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
setShowRecords(showRecords) {
|
|
28
|
+
this.showRecords = showRecords;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
setPropertyMaps(originalToMappedPropertyObj = {}, mappedToOriginalPropertyObj = {}) {
|
|
25
32
|
this.originalPropertyToMappedProperty = {
|
|
26
33
|
...this.originalPropertyToMappedProperty,
|
|
@@ -202,7 +209,6 @@ export function getConfigEmbeddedFieldsMeta(configFields, classID) {
|
|
|
202
209
|
if (value.includes('[')) {
|
|
203
210
|
value = value.substring(0, value.indexOf('[')) + value.substring(value.indexOf(']') + 1);
|
|
204
211
|
}
|
|
205
|
-
// @ts-ignore - Expected 3 arguments, but got 2.
|
|
206
212
|
const meta: any = PCore.getMetadataUtils().getEmbeddedPropertyMetadata(value, classID);
|
|
207
213
|
meta.fieldID = field;
|
|
208
214
|
configEmbeddedFieldsMeta.push(meta);
|
|
@@ -537,6 +543,28 @@ function prepareExtraFields(metaFields, configFields, configFieldSet, reportColu
|
|
|
537
543
|
|
|
538
544
|
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
539
545
|
|
|
546
|
+
function isFLProperty(label) {
|
|
547
|
+
return label?.startsWith('@FL');
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function getFieldLabel(fieldConfig) {
|
|
551
|
+
const { label, classID, caption } = fieldConfig;
|
|
552
|
+
let fieldLabel = (label ?? caption)?.substring(4);
|
|
553
|
+
const labelSplit = fieldLabel?.split('.');
|
|
554
|
+
const propertyName = labelSplit?.pop();
|
|
555
|
+
const fieldMetaData: any = PCore.getMetadataUtils().getPropertyMetadata(propertyName, classID) ?? {};
|
|
556
|
+
fieldLabel = fieldMetaData.label ?? fieldMetaData.caption ?? propertyName;
|
|
557
|
+
|
|
558
|
+
const definedOnClassID = fieldMetaData.definedOnClassID;
|
|
559
|
+
const localeValue = PCore.getLocaleUtils().getLocaleValue(
|
|
560
|
+
fieldLabel,
|
|
561
|
+
`${definedOnClassID ?? fieldMetaData.classID ?? classID}.${propertyName}`,
|
|
562
|
+
PCore.getLocaleUtils().FIELD_LABELS_BUNDLE_KEY,
|
|
563
|
+
null
|
|
564
|
+
);
|
|
565
|
+
return localeValue || fieldLabel;
|
|
566
|
+
}
|
|
567
|
+
|
|
540
568
|
function populateRenderingOptions(name, config, field) {
|
|
541
569
|
const shouldDisplayAsSemanticLink = 'displayAsLink' in field.config && field.config.displayAsLink;
|
|
542
570
|
if (shouldDisplayAsSemanticLink) {
|
|
@@ -551,6 +579,7 @@ function populateRenderingOptions(name, config, field) {
|
|
|
551
579
|
config.cellRenderer = formatConstants.Integer;
|
|
552
580
|
}
|
|
553
581
|
}
|
|
582
|
+
|
|
554
583
|
export function initializeColumns(fields: any[] = [], getMappedProperty: any = null) {
|
|
555
584
|
return fields.map((field, originalColIndex) => {
|
|
556
585
|
let name = field.config.value;
|
|
@@ -563,7 +592,9 @@ export function initializeColumns(fields: any[] = [], getMappedProperty: any = n
|
|
|
563
592
|
|
|
564
593
|
let label = field.config.label || field.config.caption;
|
|
565
594
|
const { show = true, displayAs } = field.config;
|
|
566
|
-
if (label
|
|
595
|
+
if (isFLProperty(label)) {
|
|
596
|
+
label = getFieldLabel(field.config);
|
|
597
|
+
} else if (label.startsWith('@')) {
|
|
567
598
|
label = label.substring(3);
|
|
568
599
|
}
|
|
569
600
|
|
|
@@ -651,10 +682,11 @@ export function updatePageFieldsConfig(configFields, parentClassID) {
|
|
|
651
682
|
}
|
|
652
683
|
|
|
653
684
|
export const readContextResponse = async (context, params) => {
|
|
654
|
-
const { getPConnect, apiContext, setListContext, children, showDynamicFields, referenceList, isDataObject } = params;
|
|
655
|
-
const { promisesResponseArray, apiContext: otherContext } = context;
|
|
685
|
+
const { getPConnect, apiContext, setListContext, children, showDynamicFields, referenceList, isDataObject, ref } = params;
|
|
686
|
+
const { promisesResponseArray, setShowRecords, apiContext: otherContext } = context;
|
|
656
687
|
// eslint-disable-next-line sonarjs/no-unused-collection
|
|
657
688
|
const listOfComponents: any[] = [];
|
|
689
|
+
ref.setShowRecords = setShowRecords;
|
|
658
690
|
const {
|
|
659
691
|
data: { fields: metaFields, classID, isQueryable }
|
|
660
692
|
} = promisesResponseArray[0];
|
|
@@ -678,7 +710,7 @@ export const readContextResponse = async (context, params) => {
|
|
|
678
710
|
const dataPageKeys = PCore.getDataTypeUtils().getDataPageKeys(dataViewName);
|
|
679
711
|
dataPageKeys?.forEach(item => (item.isAlternateKeyStorage ? compositeKeys.push(item.linkedField) : compositeKeys.push(item.keyName)));
|
|
680
712
|
if (compositeKeys.length) {
|
|
681
|
-
otherContext
|
|
713
|
+
otherContext?.setCompositeKeys(compositeKeys);
|
|
682
714
|
}
|
|
683
715
|
if (otherContext) {
|
|
684
716
|
otherContext.fetchRowActionDetails = null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
1
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
2
2
|
|
|
3
3
|
interface MultiReferenceReadOnlyProps extends PConnProps {
|
|
4
4
|
config: { referenceList: any; readonlyContextList: any };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
1
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
3
|
import './NarrowWide.css';
|
|
4
4
|
|
|
5
5
|
interface NarrowWideProps extends PConnProps {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
-
import Grid, { GridSize } from '@material
|
|
2
|
+
import Grid, { type GridSize } from '@mui/material/Grid';
|
|
3
3
|
|
|
4
4
|
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
5
5
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
6
|
|
|
7
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
8
|
|
|
9
9
|
interface NarrowWideDetailsProps extends PConnProps {
|
|
10
10
|
// If any, enter additional props that only exist on this component
|
|
@@ -26,7 +26,7 @@ export default function NarrowWideDetails(props: NarrowWideDetailsProps) {
|
|
|
26
26
|
|
|
27
27
|
// Set display mode prop and re-create the children so this part of the dom tree renders
|
|
28
28
|
// in a readonly (display) mode instead of a editable
|
|
29
|
-
getPConnect().setInheritedProp('displayMode', '
|
|
29
|
+
getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
30
30
|
getPConnect().setInheritedProp('readOnly', true);
|
|
31
31
|
const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
|
|
32
32
|
createElement(createPConnectComponent(), {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
1
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
3
|
import './NarrowWideForm.css';
|
|
4
4
|
|
|
5
5
|
interface NarrowWideFormProps extends PConnProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactElement } from 'react';
|
|
1
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
3
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
4
4
|
|
|
5
5
|
interface NarrowWidePageProps extends PConnProps {
|
|
6
6
|
// If any, enter additional props that only exist on this component
|