@pega/react-sdk-overrides 0.24.4 → 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.
Files changed (118) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +1 -1
  2. package/lib/designSystemExtension/Banner/Banner.tsx +1 -1
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +11 -2
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +4 -4
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +4 -4
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +6 -6
  9. package/lib/designSystemExtension/Operator/Operator.tsx +6 -5
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +2 -2
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
  13. package/lib/field/AutoComplete/AutoComplete.tsx +4 -4
  14. package/lib/field/CancelAlert/CancelAlert.tsx +4 -7
  15. package/lib/field/Checkbox/Checkbox.tsx +4 -4
  16. package/lib/field/Currency/Currency.tsx +10 -7
  17. package/lib/field/Date/Date.tsx +27 -42
  18. package/lib/field/DateTime/DateTime.tsx +39 -36
  19. package/lib/field/Decimal/Decimal.tsx +9 -4
  20. package/lib/field/Dropdown/Dropdown.tsx +29 -22
  21. package/lib/field/Email/Email.tsx +29 -8
  22. package/lib/field/Group/Group.tsx +2 -2
  23. package/lib/field/Integer/Integer.tsx +22 -8
  24. package/lib/field/Multiselect/Multiselect.tsx +8 -14
  25. package/lib/field/Multiselect/utils.ts +1 -1
  26. package/lib/field/Percentage/Percentage.tsx +8 -4
  27. package/lib/field/Phone/Phone.tsx +6 -5
  28. package/lib/field/Phone/config-ext.json +8 -0
  29. package/lib/field/RadioButtons/RadioButtons.tsx +3 -6
  30. package/lib/field/RichText/RichText.tsx +1 -1
  31. package/lib/field/RichText/config-ext.json +10 -0
  32. package/lib/field/ScalarList/ScalarList.tsx +3 -4
  33. package/lib/field/SemanticLink/SemanticLink.tsx +4 -4
  34. package/lib/field/TextArea/TextArea.tsx +26 -8
  35. package/lib/field/TextContent/TextContent.tsx +1 -1
  36. package/lib/field/TextInput/TextInput.tsx +2 -2
  37. package/lib/field/Time/Time.tsx +28 -21
  38. package/lib/field/URL/URL.tsx +26 -7
  39. package/lib/field/UserReference/UserReference.tsx +3 -5
  40. package/lib/helpers/common-utils.ts +24 -1
  41. package/lib/helpers/field-group-utils.ts +2 -2
  42. package/lib/helpers/formatters/Currency.ts +11 -16
  43. package/lib/helpers/formatters/common.ts +2 -1
  44. package/lib/helpers/formatters/index.ts +2 -4
  45. package/lib/helpers/simpleTableHelpers.ts +1 -1
  46. package/lib/infra/ActionButtons/ActionButtons.tsx +3 -3
  47. package/lib/infra/Assignment/Assignment.tsx +12 -12
  48. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +16 -28
  49. package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
  50. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +9 -4
  51. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +8 -8
  52. package/lib/infra/Containers/SimpleView/helper.ts +1 -1
  53. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +1 -1
  54. package/lib/infra/DashboardFilter/DashboardFilter.tsx +4 -6
  55. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
  56. package/lib/infra/DeferLoad/DeferLoad.tsx +8 -8
  57. package/lib/infra/MultiStep/MultiStep.tsx +15 -14
  58. package/lib/infra/NavBar/NavBar.css +1 -0
  59. package/lib/infra/NavBar/NavBar.tsx +25 -17
  60. package/lib/infra/RootContainer/RootContainer.tsx +5 -6
  61. package/lib/infra/Stages/Stages.tsx +4 -4
  62. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +4 -3
  63. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
  64. package/lib/infra/View/View.tsx +37 -3
  65. package/lib/template/AdvancedSearch/AdvancedSearch.tsx +87 -0
  66. package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +58 -0
  67. package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +245 -0
  68. package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
  69. package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
  70. package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
  71. package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
  72. package/lib/template/AdvancedSearch/config-ext.json +9 -0
  73. package/lib/template/AdvancedSearch/index.tsx +1 -0
  74. package/lib/template/AppShell/AppShell.tsx +60 -10
  75. package/lib/template/BannerPage/config-ext.json +9 -0
  76. package/lib/template/CaseView/CaseView.tsx +10 -9
  77. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +7 -7
  78. package/lib/template/Confirmation/Confirmation.tsx +3 -2
  79. package/lib/template/DataReference/DataReference.tsx +317 -107
  80. package/lib/template/DataReference/DataReferenceAdvancedSearchContext.js +10 -0
  81. package/lib/template/DataReference/SearchForm.tsx +148 -0
  82. package/lib/template/DataReference/utils.js +90 -0
  83. package/lib/template/DefaultForm/utils/index.ts +1 -3
  84. package/lib/template/Details/Details/Details.tsx +2 -2
  85. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +3 -3
  86. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +2 -2
  87. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +2 -2
  88. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +4 -4
  89. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +10 -5
  90. package/lib/template/InlineDashboard/InlineDashboard.tsx +2 -2
  91. package/lib/template/InlineDashboardPage/config-ext.json +9 -0
  92. package/lib/template/ListView/ListView.tsx +200 -94
  93. package/lib/template/ListView/utils.ts +38 -6
  94. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +2 -2
  95. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +2 -2
  96. package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -2
  97. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +0 -2
  98. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +110 -86
  99. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +2 -4
  100. package/lib/template/SubTabs/SubTabs.tsx +2 -2
  101. package/lib/template/SubTabs/tabUtils.ts +118 -1
  102. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +2 -2
  103. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +2 -2
  104. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +2 -2
  105. package/lib/template/WssNavBar/WssNavBar.tsx +9 -9
  106. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +2 -2
  107. package/lib/widget/Attachment/Attachment.css +1 -0
  108. package/lib/widget/Attachment/Attachment.tsx +7 -9
  109. package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
  110. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -1
  111. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +5 -4
  112. package/lib/widget/Followers/Followers.tsx +2 -2
  113. package/lib/widget/QuickCreate/QuickCreate.tsx +0 -1
  114. package/lib/widget/QuickCreate/config-ext.json +9 -0
  115. package/lib/widget/SummaryItem/SummaryItem.tsx +4 -3
  116. package/lib/widget/ToDo/ToDo.tsx +92 -22
  117. package/package.json +1 -1
  118. /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 { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
8
- import Table from '@material-ui/core/Table';
9
- import TableBody from '@material-ui/core/TableBody';
10
- import TableCell from '@material-ui/core/TableCell';
11
- import TableContainer from '@material-ui/core/TableContainer';
12
- import TableHead from '@material-ui/core/TableHead';
13
- import TablePagination from '@material-ui/core/TablePagination';
14
- import TableRow from '@material-ui/core/TableRow';
15
- import TableSortLabel from '@material-ui/core/TableSortLabel';
16
- import Paper from '@material-ui/core/Paper';
17
- import MoreIcon from '@material-ui/icons/MoreVert';
18
- import FilterListIcon from '@material-ui/icons/FilterList';
19
- import SubjectIcon from '@material-ui/icons/Subject';
20
- import SearchIcon from '@material-ui/icons/Search';
21
- import TextField from '@material-ui/core/TextField';
22
- import Grid from '@material-ui/core/Grid';
23
- import Menu from '@material-ui/core/Menu';
24
- import MenuItem from '@material-ui/core/MenuItem';
25
- import Dialog from '@material-ui/core/Dialog';
26
- import DialogActions from '@material-ui/core/DialogActions';
27
- import DialogContent from '@material-ui/core/DialogContent';
28
- import DialogTitle from '@material-ui/core/DialogTitle';
29
- import Select from '@material-ui/core/Select';
30
- import Button from '@material-ui/core/Button';
31
- import Link from '@material-ui/core/Link';
32
- import Typography from '@material-ui/core/Typography';
33
- import Snackbar from '@material-ui/core/Snackbar';
34
- import IconButton from '@material-ui/core/IconButton';
35
- import CloseIcon from '@material-ui/icons/Close';
36
- import { Radio } from '@material-ui/core';
37
- import Checkbox from '@material-ui/core/Checkbox';
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,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
- function getComparator<Key extends keyof any>(
224
- theOrder: Order,
225
- orderedBy: Key
226
- ): (a: { [key in Key]: number | string }, b: { [key in Key]: number | string }) => number {
227
- return theOrder === 'desc' ? (a, b) => descendingComparator(a, b, orderedBy) : (a, b) => -descendingComparator(a, b, orderedBy);
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 = 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 (displayAsLink) {
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
- const { filterId, filterExpression } = data;
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
- filters.current[filterId] = filterExpression;
316
- let isDateRange = data.filterExpression?.AND;
317
- // Will be AND by default but making it dynamic in case we support dynamic relational ops in future
318
- const relationalOp = 'AND';
319
-
320
- let field = getFieldFromFilter(filterExpression, isDateRange);
321
- selectParam = [];
322
- // Constructing the select parameters list (will be sent in dashboardFilterPayload)
323
- columnList.current.forEach(col => {
324
- selectParam.push({
325
- field: col
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
- // Checking if the triggered filter is applicable for this list
330
- if (data.filterExpression !== null && !(columnList.current?.length && columnList.current?.includes(field))) {
331
- return;
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 | React.MouseEvent, reason?: string) {
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
- {stableSort(arRows, getComparator(order, orderBy))
1036
- .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
1037
- .map(row => {
1038
- return (
1039
- <TableRow key={row.pxRefObjectInsName || row.pyID}>
1040
- {arColumns.map(column => {
1041
- const value = row[column.id];
1042
- return (
1043
- <TableCell key={column.id} align={column.align} className={classes.cell}>
1044
- {_showButton(column.id, row) || column.displayAsLink ? (
1045
- <Link
1046
- component='button'
1047
- onClick={() => {
1048
- _listViewClick(row, column);
1049
- }}
1050
- >
1051
- {column.format && typeof value === 'number' ? column.format(value) : value}
1052
- </Link>
1053
- ) : (
1054
- <>{column.format && typeof value === 'number' ? column.format(value) : value || '---'}</>
1055
- )}
1056
- </TableCell>
1057
- );
1058
- })}
1059
- </TableRow>
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 && arRows.length === 0 && <div className='no-records'>No records found.</div>}
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
- constructor() {
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.startsWith('@')) {
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.setCompositeKeys(compositeKeys);
713
+ otherContext?.setCompositeKeys(compositeKeys);
682
714
  }
683
715
  if (otherContext) {
684
716
  otherContext.fetchRowActionDetails = null;
@@ -1,5 +1,5 @@
1
1
  import { createElement } from 'react';
2
- import Grid, { GridSize } from '@material-ui/core/Grid';
2
+ import Grid, { 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';
@@ -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', 'LABELS_LEFT');
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,6 +1,6 @@
1
1
  import { PropsWithChildren, ReactElement } from 'react';
2
- import { Grid } from '@material-ui/core';
3
- import { makeStyles } from '@material-ui/core/styles';
2
+ import { Grid } from '@mui/material';
3
+ import makeStyles from '@mui/styles/makeStyles';
4
4
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
5
 
6
6
  interface OneColumnProps extends PConnProps {
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useMemo, useState, createElement } from 'react';
2
- import Button from '@material-ui/core/Button';
2
+ import Button from '@mui/material/Button';
3
3
 
4
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
5
  import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
@@ -87,7 +87,6 @@ export default function PromotedFilters(props: PromotedFilterProps) {
87
87
  };
88
88
  return getPConnect().getContainerManager().addTransientItem({
89
89
  id: viewName,
90
- // @ts-ignore - Property 'coreHeaders' is missing in type '{ classID: string; }' but required in type '{ coreHeaders: any; }'.
91
90
  data: filtersWithClassID
92
91
  });
93
92
  }, []);
@@ -50,11 +50,9 @@ export default function SimpleTable(props: SimpleTableProps) {
50
50
 
51
51
  let { contextClass } = props;
52
52
  if (!contextClass) {
53
- // @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
54
53
  let listName = getPConnect().getComponentConfig().referenceList;
55
54
  listName = PCore.getAnnotationUtils().getPropertyName(listName);
56
55
  // was... contextClass = getPConnect().getFieldMetadata(listName)?.pageClass;
57
- // @ts-ignore - Property 'getFieldMetadata' is private and only accessible within class 'C11nEnv'.
58
56
  const theFieldMetadata = getPConnect().getFieldMetadata(listName);
59
57
  if (theFieldMetadata) {
60
58
  contextClass = theFieldMetadata.pageClass;