@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
|
@@ -13,14 +13,21 @@ export const formatConstants = {
|
|
|
13
13
|
class DataApi {
|
|
14
14
|
mappedPropertyToOriginalProperty: any;
|
|
15
15
|
originalPropertyToMappedProperty: any;
|
|
16
|
-
|
|
16
|
+
showRecords: any;
|
|
17
|
+
constructor(showRecords = true) {
|
|
18
|
+
this.showRecords = showRecords;
|
|
17
19
|
this.originalPropertyToMappedProperty = {};
|
|
18
20
|
this.mappedPropertyToOriginalProperty = {};
|
|
21
|
+
this.setShowRecords = this.setShowRecords.bind(this);
|
|
19
22
|
this.setPropertyMaps = this.setPropertyMaps.bind(this);
|
|
20
23
|
this.getMappedProperty = this.getMappedProperty.bind(this);
|
|
21
24
|
this.getOriginalProperty = this.getOriginalProperty.bind(this);
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
setShowRecords(showRecords) {
|
|
28
|
+
this.showRecords = showRecords;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
setPropertyMaps(originalToMappedPropertyObj = {}, mappedToOriginalPropertyObj = {}) {
|
|
25
32
|
this.originalPropertyToMappedProperty = {
|
|
26
33
|
...this.originalPropertyToMappedProperty,
|
|
@@ -202,7 +209,6 @@ export function getConfigEmbeddedFieldsMeta(configFields, classID) {
|
|
|
202
209
|
if (value.includes('[')) {
|
|
203
210
|
value = value.substring(0, value.indexOf('[')) + value.substring(value.indexOf(']') + 1);
|
|
204
211
|
}
|
|
205
|
-
// @ts-ignore - Expected 3 arguments, but got 2.
|
|
206
212
|
const meta: any = PCore.getMetadataUtils().getEmbeddedPropertyMetadata(value, classID);
|
|
207
213
|
meta.fieldID = field;
|
|
208
214
|
configEmbeddedFieldsMeta.push(meta);
|
|
@@ -537,6 +543,28 @@ function prepareExtraFields(metaFields, configFields, configFieldSet, reportColu
|
|
|
537
543
|
|
|
538
544
|
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
539
545
|
|
|
546
|
+
function isFLProperty(label) {
|
|
547
|
+
return label?.startsWith('@FL');
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function getFieldLabel(fieldConfig) {
|
|
551
|
+
const { label, classID, caption } = fieldConfig;
|
|
552
|
+
let fieldLabel = (label ?? caption)?.substring(4);
|
|
553
|
+
const labelSplit = fieldLabel?.split('.');
|
|
554
|
+
const propertyName = labelSplit?.pop();
|
|
555
|
+
const fieldMetaData: any = PCore.getMetadataUtils().getPropertyMetadata(propertyName, classID) ?? {};
|
|
556
|
+
fieldLabel = fieldMetaData.label ?? fieldMetaData.caption ?? propertyName;
|
|
557
|
+
|
|
558
|
+
const definedOnClassID = fieldMetaData.definedOnClassID;
|
|
559
|
+
const localeValue = PCore.getLocaleUtils().getLocaleValue(
|
|
560
|
+
fieldLabel,
|
|
561
|
+
`${definedOnClassID ?? fieldMetaData.classID ?? classID}.${propertyName}`,
|
|
562
|
+
PCore.getLocaleUtils().FIELD_LABELS_BUNDLE_KEY,
|
|
563
|
+
null
|
|
564
|
+
);
|
|
565
|
+
return localeValue || fieldLabel;
|
|
566
|
+
}
|
|
567
|
+
|
|
540
568
|
function populateRenderingOptions(name, config, field) {
|
|
541
569
|
const shouldDisplayAsSemanticLink = 'displayAsLink' in field.config && field.config.displayAsLink;
|
|
542
570
|
if (shouldDisplayAsSemanticLink) {
|
|
@@ -551,6 +579,7 @@ function populateRenderingOptions(name, config, field) {
|
|
|
551
579
|
config.cellRenderer = formatConstants.Integer;
|
|
552
580
|
}
|
|
553
581
|
}
|
|
582
|
+
|
|
554
583
|
export function initializeColumns(fields: any[] = [], getMappedProperty: any = null) {
|
|
555
584
|
return fields.map((field, originalColIndex) => {
|
|
556
585
|
let name = field.config.value;
|
|
@@ -563,7 +592,9 @@ export function initializeColumns(fields: any[] = [], getMappedProperty: any = n
|
|
|
563
592
|
|
|
564
593
|
let label = field.config.label || field.config.caption;
|
|
565
594
|
const { show = true, displayAs } = field.config;
|
|
566
|
-
if (label
|
|
595
|
+
if (isFLProperty(label)) {
|
|
596
|
+
label = getFieldLabel(field.config);
|
|
597
|
+
} else if (label.startsWith('@')) {
|
|
567
598
|
label = label.substring(3);
|
|
568
599
|
}
|
|
569
600
|
|
|
@@ -651,10 +682,11 @@ export function updatePageFieldsConfig(configFields, parentClassID) {
|
|
|
651
682
|
}
|
|
652
683
|
|
|
653
684
|
export const readContextResponse = async (context, params) => {
|
|
654
|
-
const { getPConnect, apiContext, setListContext, children, showDynamicFields, referenceList, isDataObject } = params;
|
|
655
|
-
const { promisesResponseArray, apiContext: otherContext } = context;
|
|
685
|
+
const { getPConnect, apiContext, setListContext, children, showDynamicFields, referenceList, isDataObject, ref } = params;
|
|
686
|
+
const { promisesResponseArray, setShowRecords, apiContext: otherContext } = context;
|
|
656
687
|
// eslint-disable-next-line sonarjs/no-unused-collection
|
|
657
688
|
const listOfComponents: any[] = [];
|
|
689
|
+
ref.setShowRecords = setShowRecords;
|
|
658
690
|
const {
|
|
659
691
|
data: { fields: metaFields, classID, isQueryable }
|
|
660
692
|
} = promisesResponseArray[0];
|
|
@@ -678,7 +710,7 @@ export const readContextResponse = async (context, params) => {
|
|
|
678
710
|
const dataPageKeys = PCore.getDataTypeUtils().getDataPageKeys(dataViewName);
|
|
679
711
|
dataPageKeys?.forEach(item => (item.isAlternateKeyStorage ? compositeKeys.push(item.linkedField) : compositeKeys.push(item.keyName)));
|
|
680
712
|
if (compositeKeys.length) {
|
|
681
|
-
otherContext
|
|
713
|
+
otherContext?.setCompositeKeys(compositeKeys);
|
|
682
714
|
}
|
|
683
715
|
if (otherContext) {
|
|
684
716
|
otherContext.fetchRowActionDetails = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
-
import Grid, { GridSize } from '@material
|
|
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', '
|
|
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
|
|
3
|
-
import
|
|
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
|
|
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;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/* eslint-disable no-nested-ternary */
|
|
2
1
|
import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
-
import Table from '@material
|
|
4
|
-
import TableBody from '@material
|
|
5
|
-
import TableCell from '@material
|
|
6
|
-
import TableContainer from '@material
|
|
7
|
-
import TableHead from '@material
|
|
8
|
-
import TableRow from '@material
|
|
9
|
-
import Paper from '@material
|
|
10
|
-
import
|
|
11
|
-
import Link from '@material
|
|
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
|
|
14
|
-
import MoreIcon from '@
|
|
15
|
-
import Menu from '@material
|
|
16
|
-
import MenuItem from '@material
|
|
17
|
-
import FilterListIcon from '@
|
|
18
|
-
import SubjectIcon from '@
|
|
19
|
-
import Dialog from '@material
|
|
20
|
-
import DialogActions from '@material
|
|
21
|
-
import DialogContent from '@material
|
|
22
|
-
import DialogTitle from '@material
|
|
23
|
-
import Select from '@material
|
|
24
|
-
import Button from '@material
|
|
25
|
-
import TextField from '@material
|
|
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
32
|
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
33
33
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
@@ -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
|
-
|
|
180
|
-
|
|
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)
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
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
|
-
|
|
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
|
-
{
|
|
683
|
+
{row.map((item, childIndex) => {
|
|
684
|
+
const theColKey = displayedColumns[childIndex];
|
|
657
685
|
return (
|
|
658
|
-
<TableCell key={
|
|
659
|
-
{
|
|
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
|
|
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'
|
|
@@ -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
|
-
?
|
|
61
|
-
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { Children, PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
-
import { Tab, Tabs } from '@material
|
|
3
|
-
import { TabContext, TabPanel } from '@
|
|
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
6
|
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|