@pega/react-sdk-overrides 0.24.3 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +1 -1
- package/lib/designSystemExtension/Banner/Banner.tsx +1 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +11 -2
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +4 -4
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +4 -4
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +6 -6
- package/lib/designSystemExtension/Operator/Operator.tsx +6 -5
- package/lib/designSystemExtension/Pulse/Pulse.tsx +2 -2
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
- package/lib/field/AutoComplete/AutoComplete.tsx +4 -4
- package/lib/field/CancelAlert/CancelAlert.tsx +4 -7
- package/lib/field/Checkbox/Checkbox.tsx +4 -4
- package/lib/field/Currency/Currency.tsx +10 -7
- package/lib/field/Date/Date.tsx +27 -42
- package/lib/field/DateTime/DateTime.tsx +39 -36
- package/lib/field/Decimal/Decimal.tsx +9 -4
- package/lib/field/Dropdown/Dropdown.tsx +29 -22
- package/lib/field/Email/Email.tsx +29 -8
- package/lib/field/Group/Group.tsx +2 -2
- package/lib/field/Integer/Integer.tsx +22 -8
- package/lib/field/Multiselect/Multiselect.tsx +8 -14
- package/lib/field/Multiselect/utils.ts +1 -1
- package/lib/field/Percentage/Percentage.tsx +8 -4
- package/lib/field/Phone/Phone.tsx +22 -12
- package/lib/field/Phone/config-ext.json +8 -0
- package/lib/field/RadioButtons/RadioButtons.tsx +3 -6
- package/lib/field/RichText/RichText.tsx +1 -1
- package/lib/field/RichText/config-ext.json +10 -0
- package/lib/field/ScalarList/ScalarList.tsx +3 -4
- package/lib/field/SemanticLink/SemanticLink.tsx +4 -4
- package/lib/field/TextArea/TextArea.tsx +26 -8
- package/lib/field/TextContent/TextContent.tsx +1 -1
- package/lib/field/TextInput/TextInput.tsx +2 -2
- package/lib/field/Time/Time.tsx +28 -21
- package/lib/field/URL/URL.tsx +26 -7
- package/lib/field/UserReference/UserReference.tsx +3 -5
- package/lib/helpers/common-utils.ts +24 -1
- package/lib/helpers/field-group-utils.ts +2 -2
- 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 +38 -12
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +16 -28
- package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +9 -4
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +8 -8
- package/lib/infra/Containers/SimpleView/helper.ts +1 -1
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +1 -1
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +4 -6
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
- package/lib/infra/DeferLoad/DeferLoad.tsx +8 -8
- package/lib/infra/MultiStep/MultiStep.tsx +15 -14
- package/lib/infra/NavBar/NavBar.css +1 -0
- package/lib/infra/NavBar/NavBar.tsx +25 -17
- package/lib/infra/RootContainer/RootContainer.tsx +5 -6
- package/lib/infra/Stages/Stages.tsx +4 -4
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +4 -3
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
- package/lib/infra/View/View.tsx +37 -3
- 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 +60 -10
- package/lib/template/BannerPage/config-ext.json +9 -0
- package/lib/template/CaseView/CaseView.tsx +10 -9
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +7 -7
- package/lib/template/Confirmation/Confirmation.tsx +3 -2
- package/lib/template/DataReference/DataReference.tsx +317 -107
- 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/utils/index.ts +1 -3
- package/lib/template/Details/Details/Details.tsx +2 -2
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +3 -3
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +2 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +2 -2
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +4 -4
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +10 -5
- package/lib/template/InlineDashboard/InlineDashboard.tsx +2 -2
- package/lib/template/InlineDashboardPage/config-ext.json +9 -0
- package/lib/template/ListView/ListView.tsx +216 -123
- package/lib/template/ListView/utils.ts +38 -6
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +2 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +2 -2
- package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -2
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +0 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +110 -86
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +2 -4
- package/lib/template/SubTabs/SubTabs.tsx +2 -2
- package/lib/template/SubTabs/tabUtils.ts +118 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +2 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +2 -2
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +2 -2
- package/lib/template/WssNavBar/WssNavBar.tsx +9 -9
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +2 -2
- package/lib/widget/Attachment/Attachment.css +1 -0
- package/lib/widget/Attachment/Attachment.tsx +7 -9
- package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -1
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +5 -4
- package/lib/widget/Followers/Followers.tsx +2 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +0 -1
- package/lib/widget/QuickCreate/config-ext.json +9 -0
- package/lib/widget/SummaryItem/SummaryItem.tsx +4 -3
- package/lib/widget/ToDo/ToDo.tsx +92 -22
- package/package.json +1 -1
- /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
|
@@ -3,44 +3,46 @@
|
|
|
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 { 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';
|
|
@@ -60,12 +62,14 @@ 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' };
|
|
66
71
|
|
|
67
72
|
let myRows: any[];
|
|
68
|
-
let myDisplayColumnList: any[];
|
|
69
73
|
|
|
70
74
|
let menuColumnId = '';
|
|
71
75
|
let menuColumnType = '';
|
|
@@ -87,9 +91,12 @@ export default function ListView(props: ListViewProps) {
|
|
|
87
91
|
parameters,
|
|
88
92
|
compositeKeys,
|
|
89
93
|
showDynamicFields,
|
|
94
|
+
viewName,
|
|
90
95
|
readonlyContextList: selectedValues,
|
|
91
|
-
value
|
|
96
|
+
value,
|
|
97
|
+
displayAs
|
|
92
98
|
} = props;
|
|
99
|
+
let { showRecords } = props;
|
|
93
100
|
const ref = useRef({}).current;
|
|
94
101
|
const cosmosTableRef = useRef();
|
|
95
102
|
// List component context
|
|
@@ -97,6 +104,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
97
104
|
const { meta } = listContext;
|
|
98
105
|
const xRayApis = PCore.getDebugger().getXRayRuntime();
|
|
99
106
|
const xRayUid = xRayApis.startXRay();
|
|
107
|
+
const { current: uniqueId } = useRef(crypto.randomUUID());
|
|
100
108
|
|
|
101
109
|
useInit({
|
|
102
110
|
...props,
|
|
@@ -107,8 +115,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
107
115
|
cosmosTableRef
|
|
108
116
|
});
|
|
109
117
|
|
|
118
|
+
useClearSelectionsAndUpdateTable({ getPConnect, uniqueId, viewName });
|
|
119
|
+
|
|
110
120
|
const thePConn = getPConnect();
|
|
111
|
-
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
112
121
|
const componentConfig = thePConn.getComponentConfig();
|
|
113
122
|
const resolvedConfigProps: any = thePConn.getConfigProps() as ListViewProps;
|
|
114
123
|
|
|
@@ -119,6 +128,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
119
128
|
const rowID = compositeKeys && compositeKeys?.length === 1 ? compositeKeys[0] : defRowID;
|
|
120
129
|
|
|
121
130
|
const [arRows, setRows] = useState<any[]>([]);
|
|
131
|
+
const [rowsData, setRowsData] = useState<any[]>([]);
|
|
122
132
|
const [arColumns, setColumns] = useState<any[]>([]);
|
|
123
133
|
const [response, setResponse] = useState<any[]>([]);
|
|
124
134
|
|
|
@@ -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;
|
|
@@ -291,16 +339,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
291
339
|
});
|
|
292
340
|
}
|
|
293
341
|
|
|
294
|
-
function getMyColumnList(arCols: any[]): string[] {
|
|
295
|
-
const myColList: string[] = [];
|
|
296
|
-
|
|
297
|
-
arCols.forEach(col => {
|
|
298
|
-
myColList.push(col.id);
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
return myColList;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
342
|
/** Will return field from a filter expression */
|
|
305
343
|
function getFieldFromFilter(filter, dateRange = false) {
|
|
306
344
|
let fieldValue;
|
|
@@ -314,32 +352,43 @@ export default function ListView(props: ListViewProps) {
|
|
|
314
352
|
|
|
315
353
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CHANGE fires
|
|
316
354
|
function processFilterChange(data) {
|
|
317
|
-
|
|
355
|
+
let filterId;
|
|
356
|
+
let filterExpression;
|
|
357
|
+
let isDateRange;
|
|
358
|
+
let field;
|
|
318
359
|
let dashboardFilterPayload: any = {
|
|
319
360
|
query: {
|
|
320
361
|
filter: {},
|
|
321
362
|
select: []
|
|
322
363
|
}
|
|
323
364
|
};
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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
|
+
});
|
|
336
383
|
});
|
|
337
|
-
});
|
|
338
384
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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
|
+
}
|
|
342
389
|
}
|
|
390
|
+
// Will be AND by default but making it dynamic in case we support dynamic relational ops in future
|
|
391
|
+
const relationalOp = 'AND';
|
|
343
392
|
// This is a flag which will be used to reset dashboardFilterPayload in case we don't find any valid filters
|
|
344
393
|
let validFilter = false;
|
|
345
394
|
|
|
@@ -385,7 +434,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
385
434
|
} else {
|
|
386
435
|
dashboardFilterPayload.query.filter.filterConditions = {
|
|
387
436
|
...dashboardFilterPayload.query.filter.filterConditions,
|
|
388
|
-
[`T${index++}`]: { ...filter.condition, ignoreCase: true }
|
|
437
|
+
[`T${index++}`]: { ...filter.condition, ...(filter.condition.comparator === 'CONTAINS' ? { ignoreCase: true } : {}) }
|
|
389
438
|
};
|
|
390
439
|
|
|
391
440
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
@@ -413,6 +462,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
413
462
|
}
|
|
414
463
|
|
|
415
464
|
function fetchAllData(fields): any {
|
|
465
|
+
if (displayAs === 'advancedSearch' && !showRecords) {
|
|
466
|
+
return Promise.resolve({ data: null });
|
|
467
|
+
}
|
|
416
468
|
let query: any = null;
|
|
417
469
|
if (payload) {
|
|
418
470
|
query = payload.query;
|
|
@@ -543,8 +595,8 @@ export default function ListView(props: ListViewProps) {
|
|
|
543
595
|
|
|
544
596
|
// store globally, so can be searched, filtered, etc.
|
|
545
597
|
myRows = usingDataResults;
|
|
546
|
-
myDisplayColumnList = getMyColumnList(myColumns);
|
|
547
598
|
|
|
599
|
+
setRowsData(myRows);
|
|
548
600
|
// At this point, if we have data ready to render and haven't been asked
|
|
549
601
|
// to NOT call setRows and setColumns, call them
|
|
550
602
|
if (bCallSetRowsColumns) {
|
|
@@ -563,8 +615,36 @@ export default function ListView(props: ListViewProps) {
|
|
|
563
615
|
};
|
|
564
616
|
}
|
|
565
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
|
+
|
|
566
645
|
useEffect(() => {
|
|
567
646
|
if (listContext.meta) {
|
|
647
|
+
const identifier = `promoted-filters-queryable-${uniqueId}`;
|
|
568
648
|
fetchDataFromServer();
|
|
569
649
|
setTimeout(() => {
|
|
570
650
|
PCore.getPubSubUtils().subscribe(
|
|
@@ -586,6 +666,15 @@ export default function ListView(props: ListViewProps) {
|
|
|
586
666
|
false,
|
|
587
667
|
getPConnect().getContextName()
|
|
588
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
|
+
);
|
|
589
678
|
}, 0);
|
|
590
679
|
|
|
591
680
|
return function cleanupSubscriptions() {
|
|
@@ -599,29 +688,28 @@ export default function ListView(props: ListViewProps) {
|
|
|
599
688
|
`dashboard-component-${'id'}`,
|
|
600
689
|
getPConnect().getContextName()
|
|
601
690
|
);
|
|
691
|
+
PCore.getPubSubUtils().unsubscribe(PCore.getEvents().getTransientEvent().UPDATE_PROMOTED_FILTERS, identifier);
|
|
602
692
|
};
|
|
603
693
|
}
|
|
604
694
|
}, [listContext]);
|
|
605
695
|
|
|
606
696
|
function searchFilter(value: string, rows: any[]) {
|
|
697
|
+
const cols = arColumns.map(ele => {
|
|
698
|
+
return ele.id;
|
|
699
|
+
});
|
|
700
|
+
|
|
607
701
|
function filterArray(el: any): boolean {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
myVal = myVal.toString();
|
|
616
|
-
}
|
|
617
|
-
if (myVal.toLowerCase().indexOf(value.toLowerCase()) >= 0) {
|
|
618
|
-
return true;
|
|
619
|
-
}
|
|
702
|
+
return Object.keys(el).some(key => {
|
|
703
|
+
// only search columns that are displayed (pzInsKey and pxRefObjectClass are added and may or may not be displayed)
|
|
704
|
+
if (cols.includes(key)) {
|
|
705
|
+
const myVal = el[key];
|
|
706
|
+
if (myVal !== null && typeof myVal !== 'undefined') {
|
|
707
|
+
const strVal = String(myVal); // Ensure myVal is a string
|
|
708
|
+
return strVal.toLowerCase().includes(value.toLowerCase());
|
|
620
709
|
}
|
|
621
710
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
return bReturn;
|
|
711
|
+
return false;
|
|
712
|
+
});
|
|
625
713
|
}
|
|
626
714
|
|
|
627
715
|
rows = rows.filter(filterArray);
|
|
@@ -631,8 +719,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
631
719
|
|
|
632
720
|
function _onSearch(event: any) {
|
|
633
721
|
const searchValue = event.target.value;
|
|
634
|
-
|
|
635
|
-
const filteredRows = searchFilter(searchValue, myRows.slice());
|
|
722
|
+
const filteredRows = searchFilter(searchValue, rowsData?.slice());
|
|
636
723
|
|
|
637
724
|
setRows(filteredRows);
|
|
638
725
|
}
|
|
@@ -653,7 +740,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
653
740
|
|
|
654
741
|
thePConn
|
|
655
742
|
.getActionsApi()
|
|
656
|
-
// @ts-ignore
|
|
657
743
|
.openAssignment(pzInsKey, pxRefObjectClass, options)
|
|
658
744
|
.then(() => {
|
|
659
745
|
// console.log("openAssignment successful");
|
|
@@ -683,7 +769,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
683
769
|
}
|
|
684
770
|
}
|
|
685
771
|
|
|
686
|
-
function handleSnackbarClose(event: React.SyntheticEvent |
|
|
772
|
+
function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {
|
|
687
773
|
if (reason === 'clickaway') {
|
|
688
774
|
return;
|
|
689
775
|
}
|
|
@@ -886,7 +972,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
886
972
|
pzInsKey = row[`${associationCategory}:pzInsKey`];
|
|
887
973
|
}
|
|
888
974
|
if (column.isAssignmentLink) {
|
|
889
|
-
// @ts-ignore
|
|
890
975
|
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
891
976
|
containerName: 'primary',
|
|
892
977
|
channelName: ''
|
|
@@ -1045,33 +1130,35 @@ export default function ListView(props: ListViewProps) {
|
|
|
1045
1130
|
</TableRow>
|
|
1046
1131
|
</TableHead>
|
|
1047
1132
|
<TableBody>
|
|
1048
|
-
{
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
{
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
{
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
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
|
+
})}
|
|
1075
1162
|
</TableBody>
|
|
1076
1163
|
</Table>
|
|
1077
1164
|
</TableContainer>
|
|
@@ -1140,7 +1227,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
1140
1227
|
})}
|
|
1141
1228
|
</TableBody>
|
|
1142
1229
|
</Table>
|
|
1143
|
-
{arRows
|
|
1230
|
+
{(!arRows || arRows.length === 0) && (
|
|
1231
|
+
<div className='no-records'>{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}</div>
|
|
1232
|
+
)}
|
|
1144
1233
|
</TableContainer>
|
|
1145
1234
|
)}
|
|
1146
1235
|
</>
|
|
@@ -1171,7 +1260,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
1171
1260
|
<DialogContent>
|
|
1172
1261
|
{containsDateOrTime ? (
|
|
1173
1262
|
<>
|
|
1174
|
-
<Select value={displayDialogDateFilter} onChange={_dialogDateFilter} fullWidth>
|
|
1263
|
+
<Select variant='standard' value={displayDialogDateFilter} onChange={_dialogDateFilter} fullWidth>
|
|
1175
1264
|
<MenuItem value='notequal'>is not equal to</MenuItem>
|
|
1176
1265
|
<MenuItem value='after'>after</MenuItem>
|
|
1177
1266
|
<MenuItem value='before'>before</MenuItem>
|
|
@@ -1180,6 +1269,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
1180
1269
|
</Select>
|
|
1181
1270
|
{filterType === 'Date' && (
|
|
1182
1271
|
<TextField
|
|
1272
|
+
variant='standard'
|
|
1183
1273
|
autoFocus
|
|
1184
1274
|
margin='dense'
|
|
1185
1275
|
id='containsFilter'
|
|
@@ -1191,6 +1281,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
1191
1281
|
)}
|
|
1192
1282
|
{filterType === 'DateTime' && (
|
|
1193
1283
|
<TextField
|
|
1284
|
+
variant='standard'
|
|
1194
1285
|
autoFocus
|
|
1195
1286
|
margin='dense'
|
|
1196
1287
|
id='containsFilter'
|
|
@@ -1202,6 +1293,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
1202
1293
|
)}
|
|
1203
1294
|
{filterType === 'Time' && (
|
|
1204
1295
|
<TextField
|
|
1296
|
+
variant='standard'
|
|
1205
1297
|
autoFocus
|
|
1206
1298
|
margin='dense'
|
|
1207
1299
|
id='containsFilter'
|
|
@@ -1214,12 +1306,13 @@ export default function ListView(props: ListViewProps) {
|
|
|
1214
1306
|
</>
|
|
1215
1307
|
) : (
|
|
1216
1308
|
<>
|
|
1217
|
-
<Select fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
|
|
1309
|
+
<Select variant='standard' fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
|
|
1218
1310
|
<MenuItem value='contains'>Contains</MenuItem>
|
|
1219
1311
|
<MenuItem value='equals'>Equals</MenuItem>
|
|
1220
1312
|
<MenuItem value='startswith'>Starts with</MenuItem>
|
|
1221
1313
|
</Select>
|
|
1222
1314
|
<TextField
|
|
1315
|
+
variant='standard'
|
|
1223
1316
|
autoFocus
|
|
1224
1317
|
margin='dense'
|
|
1225
1318
|
id='containsFilter'
|