@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.
Files changed (139) 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 -2
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +59 -32
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +4 -4
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +5 -5
  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 +16 -12
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +3 -3
  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 +5 -5
  14. package/lib/field/CancelAlert/CancelAlert.tsx +5 -8
  15. package/lib/field/Checkbox/Checkbox.tsx +5 -5
  16. package/lib/field/Currency/Currency.tsx +12 -9
  17. package/lib/field/Date/Date.tsx +29 -48
  18. package/lib/field/DateTime/DateTime.tsx +37 -39
  19. package/lib/field/Decimal/Decimal.tsx +12 -9
  20. package/lib/field/Dropdown/Dropdown.tsx +34 -27
  21. package/lib/field/Email/Email.tsx +39 -20
  22. package/lib/field/Group/Group.tsx +4 -4
  23. package/lib/field/Integer/Integer.tsx +27 -15
  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 +11 -11
  27. package/lib/field/Phone/Phone.tsx +13 -10
  28. package/lib/field/Phone/config-ext.json +8 -0
  29. package/lib/field/RadioButtons/RadioButtons.tsx +4 -7
  30. package/lib/field/RichText/RichText.tsx +2 -2
  31. package/lib/field/RichText/config-ext.json +10 -0
  32. package/lib/field/ScalarList/ScalarList.tsx +4 -5
  33. package/lib/field/SemanticLink/SemanticLink.tsx +5 -5
  34. package/lib/field/TextArea/TextArea.tsx +30 -14
  35. package/lib/field/TextContent/TextContent.tsx +2 -2
  36. package/lib/field/TextInput/TextInput.tsx +7 -9
  37. package/lib/field/Time/Time.tsx +30 -27
  38. package/lib/field/URL/URL.tsx +29 -12
  39. package/lib/field/UserReference/UserReference.tsx +4 -6
  40. package/lib/helpers/common-utils.ts +24 -1
  41. package/lib/helpers/field-group-utils.ts +3 -3
  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 +14 -14
  48. package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
  49. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +17 -29
  50. package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
  51. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +10 -5
  52. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +9 -9
  53. package/lib/infra/Containers/SimpleView/helper.ts +1 -1
  54. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +2 -2
  55. package/lib/infra/DashboardFilter/DashboardFilter.tsx +6 -8
  56. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
  57. package/lib/infra/DeferLoad/DeferLoad.tsx +9 -9
  58. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -1
  59. package/lib/infra/MultiStep/MultiStep.tsx +17 -16
  60. package/lib/infra/NavBar/NavBar.css +1 -0
  61. package/lib/infra/NavBar/NavBar.tsx +49 -38
  62. package/lib/infra/Reference/Reference.tsx +1 -1
  63. package/lib/infra/Region/Region.tsx +1 -1
  64. package/lib/infra/RootContainer/RootContainer.tsx +7 -8
  65. package/lib/infra/Stages/Stages.tsx +5 -5
  66. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +4 -3
  67. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
  68. package/lib/infra/View/View.tsx +38 -4
  69. package/lib/template/AdvancedSearch/AdvancedSearch.tsx +87 -0
  70. package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +58 -0
  71. package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +245 -0
  72. package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
  73. package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
  74. package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
  75. package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
  76. package/lib/template/AdvancedSearch/config-ext.json +9 -0
  77. package/lib/template/AdvancedSearch/index.tsx +1 -0
  78. package/lib/template/AppShell/AppShell.tsx +62 -12
  79. package/lib/template/BannerPage/BannerPage.tsx +2 -2
  80. package/lib/template/BannerPage/config-ext.json +9 -0
  81. package/lib/template/CaseSummary/CaseSummary.tsx +2 -2
  82. package/lib/template/CaseView/CaseView.tsx +12 -11
  83. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +8 -8
  84. package/lib/template/Confirmation/Confirmation.tsx +5 -4
  85. package/lib/template/DataReference/DataReference.tsx +318 -108
  86. package/lib/template/DataReference/DataReferenceAdvancedSearchContext.js +10 -0
  87. package/lib/template/DataReference/SearchForm.tsx +148 -0
  88. package/lib/template/DataReference/utils.js +90 -0
  89. package/lib/template/DefaultForm/DefaultForm.tsx +2 -2
  90. package/lib/template/DefaultForm/utils/index.ts +1 -3
  91. package/lib/template/Details/Details/Details.tsx +3 -3
  92. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +5 -5
  93. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +3 -3
  94. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +3 -3
  95. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +5 -5
  96. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +11 -6
  97. package/lib/template/InlineDashboard/InlineDashboard.tsx +4 -4
  98. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
  99. package/lib/template/InlineDashboardPage/config-ext.json +9 -0
  100. package/lib/template/ListPage/ListPage.tsx +1 -1
  101. package/lib/template/ListView/ListView.tsx +201 -95
  102. package/lib/template/ListView/utils.ts +38 -6
  103. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +1 -1
  104. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +2 -2
  105. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +3 -3
  106. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +2 -2
  107. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +2 -2
  108. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +4 -4
  109. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
  110. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
  111. package/lib/template/PromotedFilters/PromotedFilters.tsx +2 -3
  112. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +1 -3
  113. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +112 -88
  114. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +3 -5
  115. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +1 -1
  116. package/lib/template/SubTabs/SubTabs.tsx +4 -4
  117. package/lib/template/SubTabs/tabUtils.ts +118 -1
  118. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -10
  119. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
  120. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -10
  121. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +2 -2
  122. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +3 -3
  123. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
  124. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
  125. package/lib/template/WssNavBar/WssNavBar.tsx +10 -10
  126. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +3 -3
  127. package/lib/widget/Attachment/Attachment.css +1 -0
  128. package/lib/widget/Attachment/Attachment.tsx +8 -10
  129. package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
  130. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +2 -2
  131. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +6 -5
  132. package/lib/widget/Followers/Followers.tsx +4 -4
  133. package/lib/widget/QuickCreate/QuickCreate.tsx +1 -2
  134. package/lib/widget/QuickCreate/config-ext.json +9 -0
  135. package/lib/widget/SummaryItem/SummaryItem.tsx +5 -4
  136. package/lib/widget/SummaryList/SummaryList.tsx +1 -1
  137. package/lib/widget/ToDo/ToDo.tsx +102 -40
  138. package/package.json +1 -1
  139. /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
@@ -1,7 +1,7 @@
1
- import { PropsWithChildren, ReactElement } from 'react';
2
- import { Grid } from '@material-ui/core';
3
- import { makeStyles } from '@material-ui/core/styles';
4
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
1
+ import type { PropsWithChildren, ReactElement } from 'react';
2
+ import { Grid } from '@mui/material';
3
+ import makeStyles from '@mui/styles/makeStyles';
4
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
5
 
6
6
  interface OneColumnProps extends PConnProps {
7
7
  // If any, enter additional props that only exist on this component
@@ -1,5 +1,5 @@
1
1
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
2
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
2
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
3
 
4
4
  interface OneColumnPageProps extends PConnProps {
5
5
  // If any, enter additional props that only exist on this component
@@ -1,5 +1,5 @@
1
- import { PropsWithChildren } from 'react';
2
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
1
+ import type { PropsWithChildren } from 'react';
2
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
3
 
4
4
  interface OneColumnTabProps extends PConnProps {
5
5
  // If any, enter additional props that only exist on this component
@@ -1,12 +1,12 @@
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';
6
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
7
  import './PromotedFilters.css';
8
8
 
9
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
10
 
11
11
  // Can't use PromotedFilterProps until getContainerManager() knows about addTransientItem
12
12
  // Currently just expects "object"
@@ -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
  }, []);
@@ -4,7 +4,7 @@ import { useRef } from 'react';
4
4
  import { buildMetaForListView, getContext } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
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
  // Can't use SimpleTableProps until getComponentConfig() and getFieldMetadata() are NOT private
10
10
  interface SimpleTableProps extends PConnProps {
@@ -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;
@@ -1,35 +1,35 @@
1
- /* eslint-disable no-nested-ternary */
2
- import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
3
- import Table from '@material-ui/core/Table';
4
- import TableBody from '@material-ui/core/TableBody';
5
- import TableCell from '@material-ui/core/TableCell';
6
- import TableContainer from '@material-ui/core/TableContainer';
7
- import TableHead from '@material-ui/core/TableHead';
8
- import TableRow from '@material-ui/core/TableRow';
9
- import Paper from '@material-ui/core/Paper';
10
- import { makeStyles } from '@material-ui/core/styles';
11
- import Link from '@material-ui/core/Link';
1
+ import React, { type PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
2
+ import Table from '@mui/material/Table';
3
+ import TableBody from '@mui/material/TableBody';
4
+ import TableCell from '@mui/material/TableCell';
5
+ import TableContainer from '@mui/material/TableContainer';
6
+ import TableHead from '@mui/material/TableHead';
7
+ import TableRow from '@mui/material/TableRow';
8
+ import Paper from '@mui/material/Paper';
9
+ import makeStyles from '@mui/styles/makeStyles';
10
+ import Link from '@mui/material/Link';
12
11
  import { createElement } from 'react';
13
- import TableSortLabel from '@material-ui/core/TableSortLabel';
14
- import MoreIcon from '@material-ui/icons/MoreVert';
15
- import Menu from '@material-ui/core/Menu';
16
- import MenuItem from '@material-ui/core/MenuItem';
17
- import FilterListIcon from '@material-ui/icons/FilterList';
18
- import SubjectIcon from '@material-ui/icons/Subject';
19
- import Dialog from '@material-ui/core/Dialog';
20
- import DialogActions from '@material-ui/core/DialogActions';
21
- import DialogContent from '@material-ui/core/DialogContent';
22
- import DialogTitle from '@material-ui/core/DialogTitle';
23
- import Select from '@material-ui/core/Select';
24
- import Button from '@material-ui/core/Button';
25
- import TextField from '@material-ui/core/TextField';
12
+ import TableSortLabel from '@mui/material/TableSortLabel';
13
+ import MoreIcon from '@mui/icons-material/MoreVert';
14
+ import Menu from '@mui/material/Menu';
15
+ import MenuItem from '@mui/material/MenuItem';
16
+ import FilterListIcon from '@mui/icons-material/FilterList';
17
+ import SubjectIcon from '@mui/icons-material/Subject';
18
+ import Dialog from '@mui/material/Dialog';
19
+ import DialogActions from '@mui/material/DialogActions';
20
+ import DialogContent from '@mui/material/DialogContent';
21
+ import DialogTitle from '@mui/material/DialogTitle';
22
+ import Select from '@mui/material/Select';
23
+ import Button from '@mui/material/Button';
24
+ import TextField from '@mui/material/TextField';
26
25
 
27
26
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
28
27
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
29
28
  import { getReferenceList } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
30
29
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
30
+ import { getGenericFieldsLocalizedValue } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
31
31
  import { buildFieldsForTable, filterData, getContext } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
32
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
32
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
33
33
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
34
34
 
35
35
  interface SimpleTableManualProps extends PConnProps {
@@ -52,12 +52,27 @@ interface SimpleTableManualProps extends PConnProps {
52
52
  displayMode?: string;
53
53
  useSeparateViewForEdit: any;
54
54
  viewForEditModal: any;
55
+ validatemessage?: string;
56
+ required?: boolean;
55
57
  }
56
58
 
57
59
  const useStyles = makeStyles((/* theme */) => ({
58
60
  label: {
59
61
  margin: '8px'
60
62
  },
63
+ tableLabel: {
64
+ '&::after': {
65
+ display: 'inline',
66
+ content: '" *"',
67
+ verticalAlign: 'top',
68
+ color: 'var(--app-error-color)'
69
+ }
70
+ },
71
+ message: {
72
+ margin: '8px',
73
+ color: 'var(--app-error-color)',
74
+ fontSize: '14px'
75
+ },
61
76
  header: {
62
77
  background: '#f5f5f5'
63
78
  },
@@ -110,7 +125,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
110
125
  editModeConfig,
111
126
  displayMode,
112
127
  useSeparateViewForEdit,
113
- viewForEditModal
128
+ viewForEditModal,
129
+ required,
130
+ validatemessage
114
131
  } = props;
115
132
  const pConn = getPConnect();
116
133
  const [rowData, setRowData] = useState([]);
@@ -130,7 +147,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
130
147
  const [displayDialogDateFilter, setDisplayDialogDateFilter] = useState<string>('notequal');
131
148
  const [displayDialogDateValue, setDisplayDialogDateValue] = useState<string>('');
132
149
  const selectedRowIndex: any = useRef(null);
133
-
150
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
151
+ const localeCategory = 'SimpleTable';
134
152
  const parameters = fieldMetadata?.datasource?.parameters;
135
153
  const { referenceListStr } = getContext(getPConnect());
136
154
  const label = labelProp || propertyLabel;
@@ -176,13 +194,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
176
194
  });
177
195
 
178
196
  useEffect(() => {
179
- if (editableMode && !allowEditingInModal) {
180
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
181
- buildElementsForTable();
182
- }
183
- }, [referenceList.length]);
184
-
185
- useEffect(() => {
197
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
198
+ buildElementsForTable();
186
199
  if (readOnlyMode || allowEditingInModal) {
187
200
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
188
201
  generateRowsData();
@@ -201,7 +214,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
201
214
  if (allowEditingInModal) {
202
215
  getPConnect()
203
216
  .getListActions()
204
- // @ts-ignore - An argument for 'uniqueField' was not provided.
205
217
  .initDefaultPageInstructions(
206
218
  getPConnect().getReferenceList(),
207
219
  fieldDefs.filter(item => item.name).map(item => item.name)
@@ -258,11 +270,16 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
258
270
  function generateRowsData() {
259
271
  // if referenceList is empty and dataPageName property value exists then make a datapage fetch call and get the list of data.
260
272
  if (!referenceList.length && dataPageName) {
261
- getDataPage(dataPageName, parameters, context).then(listData => {
262
- const data = formatRowsData(listData);
263
- myRows = data;
264
- setRowData(data);
265
- });
273
+ getDataPage(dataPageName, parameters, context)
274
+ .then(listData => {
275
+ const data = formatRowsData(listData);
276
+ myRows = data;
277
+ setRowData(data);
278
+ })
279
+ .catch(e => {
280
+ // eslint-disable-next-line no-console
281
+ console.log(e);
282
+ });
266
283
  } else {
267
284
  // The referenceList prop has the JSON data for each row to be displayed
268
285
  // in the table. So, iterate over referenceList to create the dataRows that
@@ -301,9 +318,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
301
318
  if (allowEditingInModal && defaultView) {
302
319
  pConn
303
320
  .getActionsApi()
321
+ // @ts-ignore
304
322
  .openEmbeddedDataModal(defaultView, pConn, referenceListStr, referenceList.length, PCore.getConstants().RESOURCE_STATUS.CREATE);
305
323
  } else {
306
- // @ts-ignore - An argument for 'pageRef' was not provided.
307
324
  pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
308
325
  }
309
326
 
@@ -317,6 +334,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
317
334
  if (typeof selectedRowIndex.current === 'number') {
318
335
  pConn
319
336
  .getActionsApi()
337
+ // @ts-ignore
320
338
  .openEmbeddedDataModal(
321
339
  bUseSeparateViewForEdit ? editView : defaultView,
322
340
  pConn,
@@ -329,12 +347,10 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
329
347
 
330
348
  const deleteRecord = () => {
331
349
  setEditAnchorEl(null);
332
- // @ts-ignore - An argument for 'pageRef' was not provided.
333
350
  pConn.getListActions().deleteEntry(selectedRowIndex.current);
334
351
  };
335
352
 
336
353
  const deleteRecordFromInlineEditable = (index: number) => {
337
- // @ts-ignore - An argument for 'pageRef' was not provided.
338
354
  pConn.getListActions().deleteEntry(index);
339
355
  };
340
356
 
@@ -344,7 +360,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
344
360
  const data: any = [];
345
361
  rawFields.forEach(item => {
346
362
  // removing label field from config to hide title in the table cell
347
- item = { ...item, config: { ...item.config, label: '' } };
363
+ item = { ...item, config: { ...item.config, label: '', displayMode: readOnlyMode || allowEditingInModal ? 'DISPLAY_ONLY' : undefined } };
348
364
  const referenceListData = getReferenceList(pConn);
349
365
  const isDatapage = referenceListData.startsWith('D_');
350
366
  const pageReferenceValue = isDatapage
@@ -378,6 +394,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
378
394
  };
379
395
 
380
396
  function descendingComparator<T>(a: T, b: T, orderedBy: keyof T) {
397
+ if (!orderedBy || (!a[orderedBy] && !b[orderedBy])) {
398
+ return 0;
399
+ }
381
400
  if (!b[orderedBy] || b[orderedBy] < a[orderedBy]) {
382
401
  return -1;
383
402
  }
@@ -389,11 +408,12 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
389
408
 
390
409
  type Order = 'asc' | 'desc';
391
410
 
392
- function getComparator<Key extends keyof any>(
393
- theOrder: Order,
394
- orderedBy: Key
395
- ): (a: { [key in Key]: number | string }, b: { [key in Key]: number | string }) => number {
396
- return theOrder === 'desc' ? (a, b) => descendingComparator(a, b, orderedBy) : (a, b) => -descendingComparator(a, b, orderedBy);
411
+ interface Comparator<T> {
412
+ (a: T, b: T): number;
413
+ }
414
+
415
+ function getComparator<Key extends keyof any, T extends Record<Key, any>>(theOrder: Order, orderedBy: Key): Comparator<T> {
416
+ return theOrder === 'desc' ? (a: T, b: T) => descendingComparator<T>(a, b, orderedBy) : (a: T, b: T) => -descendingComparator<T>(a, b, orderedBy);
397
417
  }
398
418
 
399
419
  function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
@@ -405,7 +425,11 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
405
425
  return a[1] - b[1];
406
426
  });
407
427
 
408
- return stabilizedThis.map(el => el[0]);
428
+ const newElements = new Array(stabilizedThis.length);
429
+ stabilizedThis.forEach((el, index) => {
430
+ newElements[index] = elements[el[1]];
431
+ });
432
+ return newElements;
409
433
  }
410
434
 
411
435
  function _menuClick(event, columnId: string, columnType: string, labelValue: string) {
@@ -575,19 +599,21 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
575
599
  <>
576
600
  <TableContainer component={Paper} style={{ margin: '4px 0px' }} id='simple-table-manual'>
577
601
  {propsToUse.label && (
578
- <h3 className={classes.label}>
602
+ <h3 className={`${classes.label} ${required ? classes.tableLabel : ''}`}>
579
603
  {propsToUse.label} {results()}
580
604
  </h3>
581
605
  )}
606
+ {validatemessage && <div className={classes.message}>{validatemessage}</div>}
582
607
  <Table>
583
608
  <TableHead className={classes.header}>
584
609
  <TableRow>
585
610
  {fieldDefs.map((field: any, index) => {
586
611
  return (
587
612
  <TableCell key={`head-${displayedColumns[index]}`} className={classes.tableCell}>
588
- {readOnlyMode ? (
589
- <div>
613
+ {(readOnlyMode || allowEditingInModal) && field.cellRenderer !== 'DeleteIcon' ? (
614
+ <div style={{ display: 'flex' }}>
590
615
  <TableSortLabel
616
+ style={{ width: '75%' }}
591
617
  active={orderBy === displayedColumns[index]}
592
618
  direction={orderBy === displayedColumns[index] ? order : 'asc'}
593
619
  onClick={createSortHandler(displayedColumns[index])}
@@ -599,8 +625,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
599
625
  ) : null}
600
626
  </TableSortLabel>
601
627
  <MoreIcon
628
+ style={{ cursor: 'pointer', zIndex: 1000 }}
602
629
  id='menu-icon'
603
- className={classes.moreIcon}
604
630
  onClick={event => {
605
631
  _menuClick(event, field.name, field.meta.type, field.label);
606
632
  }}
@@ -616,6 +642,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
616
642
  </TableHead>
617
643
  <TableBody>
618
644
  {editableMode &&
645
+ !allowEditingInModal &&
619
646
  elements.map((row: any, index) => {
620
647
  const theKey = `row-${index}`;
621
648
  return (
@@ -653,53 +680,46 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
653
680
  return (
654
681
  // eslint-disable-next-line react/no-array-index-key
655
682
  <TableRow key={index}>
656
- {displayedColumns.map(colKey => {
683
+ {row.map((item, childIndex) => {
684
+ const theColKey = displayedColumns[childIndex];
657
685
  return (
658
- <TableCell key={colKey} className={classes.tableCell}>
659
- {showDeleteButton && colKey === 'DeleteIcon' ? (
660
- <div>
661
- <MoreIcon
662
- id='table-edit-menu-icon'
663
- className={classes.moreIcon}
664
- onClick={event => {
665
- editMenuClick(event, index);
666
- }}
667
- />
668
- <Menu id='table-edit-menu' anchorEl={editAnchorEl} keepMounted open={Boolean(editAnchorEl)} onClose={_menuClose}>
669
- <MenuItem onClick={() => editRecord()}>Edit</MenuItem>
670
- <MenuItem onClick={() => deleteRecord()}>Delete</MenuItem>
671
- </Menu>
672
- </div>
673
- ) : typeof row[colKey] === 'boolean' && !row[colKey] ? (
674
- 'False'
675
- ) : typeof row[colKey] === 'boolean' && row[colKey] ? (
676
- 'True'
677
- ) : (
678
- row[colKey] || '---'
679
- )}
686
+ <TableCell key={theColKey} className={classes.tableCell}>
687
+ {item}
680
688
  </TableCell>
681
689
  );
682
690
  })}
691
+ {showDeleteButton && (
692
+ <TableCell key='DeleteIcon' className={classes.tableCell}>
693
+ <div>
694
+ <MoreIcon
695
+ id='table-edit-menu-icon'
696
+ className={classes.moreIcon}
697
+ onClick={event => {
698
+ editMenuClick(event, index);
699
+ }}
700
+ />
701
+ <Menu id='table-edit-menu' anchorEl={editAnchorEl} keepMounted open={Boolean(editAnchorEl)} onClose={_menuClose}>
702
+ <MenuItem onClick={() => editRecord()}>Edit</MenuItem>
703
+ <MenuItem onClick={() => deleteRecord()}>Delete</MenuItem>
704
+ </Menu>
705
+ </div>
706
+ </TableCell>
707
+ )}
683
708
  </TableRow>
684
709
  );
685
710
  })}
686
711
  </TableBody>
687
712
  </Table>
688
- {readOnlyMode && rowData && rowData.length === 0 && (
689
- <div className='no-records' id='no-records'>
690
- No records found.
691
- </div>
692
- )}
693
- {editableMode && referenceList && referenceList.length === 0 && (
713
+ {((readOnlyMode && (!rowData || rowData?.length === 0)) || (editableMode && (!referenceList || referenceList?.length === 0))) && (
694
714
  <div className='no-records' id='no-records'>
695
- No records found.
715
+ {getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}
696
716
  </div>
697
717
  )}
698
718
  </TableContainer>
699
719
  {showAddRowButton && (
700
720
  <div style={{ fontSize: '1rem' }}>
701
- <Link style={{ cursor: 'pointer' }} onClick={addRecord}>
702
- + Add
721
+ <Link style={{ cursor: 'pointer' }} onClick={addRecord} underline='hover'>
722
+ + {localizedVal('Add', localeCategory)}
703
723
  </Link>
704
724
  </div>
705
725
  )}
@@ -716,7 +736,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
716
736
  <DialogContent>
717
737
  {containsDateOrTime ? (
718
738
  <>
719
- <Select value={displayDialogDateFilter} onChange={_dialogDateFilter} fullWidth>
739
+ <Select variant='standard' value={displayDialogDateFilter} onChange={_dialogDateFilter} fullWidth>
720
740
  <MenuItem value='notequal'>is not equal to</MenuItem>
721
741
  <MenuItem value='equal'>is equal to</MenuItem>
722
742
  <MenuItem value='after'>after</MenuItem>
@@ -726,6 +746,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
726
746
  </Select>
727
747
  {filterType === 'Date' && (
728
748
  <TextField
749
+ variant='standard'
729
750
  autoFocus
730
751
  margin='dense'
731
752
  id='containsFilter'
@@ -737,6 +758,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
737
758
  )}
738
759
  {filterType === 'DateTime' && (
739
760
  <TextField
761
+ variant='standard'
740
762
  autoFocus
741
763
  margin='dense'
742
764
  id='containsFilter'
@@ -748,6 +770,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
748
770
  )}
749
771
  {filterType === 'Time' && (
750
772
  <TextField
773
+ variant='standard'
751
774
  autoFocus
752
775
  margin='dense'
753
776
  id='containsFilter'
@@ -760,12 +783,13 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
760
783
  </>
761
784
  ) : (
762
785
  <>
763
- <Select id='filter' fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
786
+ <Select variant='standard' id='filter' fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
764
787
  <MenuItem value='contains'>Contains</MenuItem>
765
788
  <MenuItem value='equals'>Equals</MenuItem>
766
789
  <MenuItem value='startswith'>Starts with</MenuItem>
767
790
  </Select>
768
791
  <TextField
792
+ variant='standard'
769
793
  autoFocus
770
794
  margin='dense'
771
795
  id='containsFilter'
@@ -1,6 +1,6 @@
1
1
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
2
2
 
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 SimpleTableSelectProps extends PConnProps {
6
6
  // If any, enter additional props that only exist on this component
@@ -57,10 +57,8 @@ export default function SimpleTableSelect(props: SimpleTableSelectProps) {
57
57
 
58
58
  // Need to get this written so typedefs work
59
59
  const { datasource: { parameters: fieldParameters = {} } = {}, pageClass } = isMultiSelectMode
60
- ? // @ts-ignore - Property 'getFieldMetadata' is private and only accessible within class 'C11nEnv'.
61
- pConn.getFieldMetadata(`@P .${referenceProp}`)
62
- : // @ts-ignore - Property 'getCurrentPageFieldMetadata' is private and only accessible within class 'C11nEnv'.
63
- pConn.getCurrentPageFieldMetadata(contextPageReference);
60
+ ? pConn.getFieldMetadata(`@P .${referenceProp}`)
61
+ : pConn.getCurrentPageFieldMetadata(contextPageReference);
64
62
 
65
63
  const compositeKeys: any[] = [];
66
64
  Object.values(fieldParameters).forEach((param: any) => {
@@ -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 SingleReferenceReadOnlyProps extends PConnProps {
4
4
  // If any, enter additional props that only exist on this component
@@ -1,9 +1,9 @@
1
- import { Children, PropsWithChildren, useEffect, useState } from 'react';
2
- import { Tab, Tabs } from '@material-ui/core';
3
- import { TabContext, TabPanel } from '@material-ui/lab';
1
+ import { Children, type PropsWithChildren, useEffect, useState } from 'react';
2
+ import { Tab, Tabs } from '@mui/material';
3
+ import { TabContext, TabPanel } from '@mui/lab';
4
4
 
5
5
  import { getTransientTabs, getVisibleTabs, tabClick } from './tabUtils';
6
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
 
8
8
  interface SubTabsProps extends PConnProps {
9
9
  // If any, enter additional props that only exist on this component
@@ -19,7 +19,8 @@ export const getVisibleTabs = (allTabs, uuid) => {
19
19
  const { name: viewName, deferLoadId = `${viewName}_${uuid}_${index}` } = config;
20
20
  child.getPConnect().registerAdditionalProps({
21
21
  deferLoadId,
22
- isChildDeferLoad: true
22
+ isChildDeferLoad: true,
23
+ lastUpdateCaseTime: '@P caseInfo.lastUpdateTime'
23
24
  });
24
25
  }
25
26
  index += 1;
@@ -66,3 +67,119 @@ export const tabClick = (id, availableTabs, currentTabId, setCurrentTabId, tabIt
66
67
  PCore.getDeferLoadManager().activate(activeId, nextPConn?.getContextName());
67
68
  PCore.getDeferLoadManager().refreshComponent(activeId, nextPConn?.getContextName());
68
69
  };
70
+
71
+ export const searchtabsClick = (id, mainTabs, currentTabId, setCurrentTabId) => {
72
+ const currentTab = mainTabs.find(item => item.id === currentTabId && item.visibility());
73
+ const currentPConn = currentTab?.getPConnect();
74
+ const { deferLoadId } = currentPConn?.getConfigProps() ?? {};
75
+ PCore.getDeferLoadManager().deactivate(deferLoadId, currentPConn.getContextName());
76
+
77
+ setCurrentTabId(id);
78
+ const nextActiveTab = mainTabs.find(item => item.id === id && item.visibility());
79
+ if (mainTabs && nextActiveTab?.content === null) {
80
+ nextActiveTab.content = nextActiveTab.getPConnect().getComponent();
81
+ }
82
+
83
+ const nextPConn = nextActiveTab.getPConnect();
84
+ const { deferLoadId: activeId } = nextPConn.getConfigProps();
85
+ PCore.getDeferLoadManager().activate(activeId, nextPConn.getContextName());
86
+ PCore.getDeferLoadManager().refreshComponent(activeId, nextPConn.getContextName());
87
+ };
88
+
89
+ export const getTabLabel = tabPConnect => {
90
+ const config = tabPConnect.getConfigProps();
91
+
92
+ const label = config.inheritedProps?.find(obj => obj.prop === 'label')?.value;
93
+
94
+ if (label) {
95
+ return label;
96
+ }
97
+ if (config.label) {
98
+ return config.label;
99
+ }
100
+
101
+ if (tabPConnect.getReferencedView()?.config?.label) {
102
+ return tabPConnect.getReferencedView()?.config?.label;
103
+ }
104
+
105
+ return PCore.getLocaleUtils().getLocaleValue('No label specified in config', 'Generic');
106
+ };
107
+
108
+ export const getActiveTabId = (mainTabs, currentTabId) => {
109
+ let firstVisibleTabId = null;
110
+ let updatedActiveId = currentTabId;
111
+ let isCurrentTabFound = false;
112
+
113
+ if (!mainTabs?.length) {
114
+ return updatedActiveId;
115
+ }
116
+
117
+ for (let i = 0; i < mainTabs.length; i += 1) {
118
+ const tab = mainTabs[i];
119
+ const tabConfig = tab.getPConnect().getConfigProps();
120
+ const tabId = tab?.id || `${tab.getPConnect().viewName}-${tabConfig.name || getTabLabel(tab.getPConnect())}-${i}`;
121
+ const isTabVisible = !Object.hasOwn(tabConfig, 'visibility') || tabConfig.visibility === true;
122
+ if (isTabVisible && !firstVisibleTabId) {
123
+ firstVisibleTabId = tabId;
124
+ if (isCurrentTabFound) {
125
+ updatedActiveId = firstVisibleTabId;
126
+ break;
127
+ }
128
+ }
129
+ if (tabId === currentTabId) {
130
+ isCurrentTabFound = true;
131
+ if (isTabVisible) {
132
+ break;
133
+ } else if (firstVisibleTabId) {
134
+ updatedActiveId = firstVisibleTabId;
135
+ break;
136
+ }
137
+ }
138
+ }
139
+ return updatedActiveId;
140
+ };
141
+ /**
142
+ *
143
+ * @param {*} deferLoadedTabs list of deferLoadedTabs
144
+ * @param {string} tabViewName (optional) if provided, tabId of the given tabView will be returned
145
+ * @returns {string} a tab id is returned
146
+ */
147
+ export const getFirstVisibleTabId = (deferLoadedTabs, tabViewName) => {
148
+ let tabIndex = 0;
149
+
150
+ const viewName = deferLoadedTabs?.props?.getPConnect()?.options?.viewName;
151
+
152
+ const deferTabsChildren = deferLoadedTabs.props.getPConnect().getChildren();
153
+ if (tabViewName) {
154
+ const firstVisibleTab = deferTabsChildren?.find((item, index) => {
155
+ const tabConfig = item.getPConnect().getConfigProps();
156
+ if (tabViewName === tabConfig.name) {
157
+ tabIndex = index;
158
+ return true;
159
+ }
160
+ return false;
161
+ });
162
+ const tabConfig = firstVisibleTab.getPConnect().getConfigProps();
163
+
164
+ return `${viewName}-${tabConfig.name || getTabLabel(firstVisibleTab.getPConnect())}-${tabIndex}`;
165
+ }
166
+
167
+ const firstVisibleTab = deferLoadedTabs.props
168
+ .getPConnect()
169
+ .getChildren()
170
+ ?.find((item, index) => {
171
+ const tabConfig = item.getPConnect().getConfigProps();
172
+ if (!('visibility' in tabConfig) || tabConfig.visibility === true) {
173
+ tabIndex = index;
174
+ return true;
175
+ }
176
+ return false;
177
+ });
178
+
179
+ if (!firstVisibleTab) {
180
+ return null;
181
+ }
182
+
183
+ const tabConfig = firstVisibleTab.getPConnect().getConfigProps();
184
+ return `${viewName}-${tabConfig.name || getTabLabel(firstVisibleTab.getPConnect())}-${tabIndex}`;
185
+ };