@pega/react-sdk-overrides 0.242.7 → 0.242.9
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/FieldValueList/FieldValueList.tsx +2 -2
- package/lib/field/CancelAlert/CancelAlert.tsx +1 -4
- package/lib/field/Currency/Currency.tsx +8 -5
- package/lib/field/Date/Date.tsx +5 -1
- package/lib/field/DateTime/DateTime.tsx +13 -5
- package/lib/field/Decimal/Decimal.tsx +7 -2
- package/lib/field/Dropdown/Dropdown.tsx +27 -20
- package/lib/field/Percentage/Percentage.tsx +6 -2
- package/lib/field/RadioButtons/RadioButtons.tsx +0 -3
- package/lib/field/ScalarList/ScalarList.tsx +1 -2
- package/lib/field/Time/Time.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +1 -3
- package/lib/helpers/common-utils.ts +24 -1
- 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/infra/Assignment/Assignment.tsx +2 -6
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +5 -18
- package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +7 -2
- package/lib/infra/Containers/SimpleView/helper.ts +1 -1
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +2 -3
- package/lib/infra/DashboardFilter/filterUtils.tsx +1 -3
- package/lib/infra/DeferLoad/DeferLoad.tsx +5 -5
- package/lib/infra/MultiStep/MultiStep.tsx +1 -6
- package/lib/infra/RootContainer/RootContainer.tsx +1 -1
- package/lib/template/AppShell/AppShell.tsx +6 -6
- package/lib/template/CaseView/CaseView.tsx +5 -4
- package/lib/template/Confirmation/Confirmation.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +0 -1
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +0 -2
- package/lib/template/ListView/ListView.tsx +10 -9
- package/lib/template/ListView/utils.ts +0 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +0 -1
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +0 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +71 -56
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +2 -4
- package/lib/widget/Attachment/Attachment.css +1 -0
- package/lib/widget/Attachment/Attachment.tsx +2 -7
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +1 -1
- package/lib/widget/QuickCreate/QuickCreate.tsx +0 -1
- package/lib/widget/SummaryItem/SummaryItem.tsx +1 -1
- package/lib/widget/ToDo/ToDo.tsx +1 -1
- package/package.json +1 -1
- /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
|
@@ -12,6 +12,7 @@ interface DeferLoadProps extends PConnProps {
|
|
|
12
12
|
isChildDeferLoad?: boolean;
|
|
13
13
|
isTab: boolean;
|
|
14
14
|
deferLoadId: string;
|
|
15
|
+
lastUpdateCaseTime: any;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
//
|
|
@@ -34,7 +35,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
34
35
|
}));
|
|
35
36
|
|
|
36
37
|
export default function DeferLoad(props: DeferLoadProps) {
|
|
37
|
-
const { getPConnect, name, deferLoadId, isTab } = props;
|
|
38
|
+
const { getPConnect, name, deferLoadId, isTab, lastUpdateCaseTime } = props;
|
|
38
39
|
const [content, setContent] = useState<any>(null);
|
|
39
40
|
const [isLoading, setLoading] = useState(true);
|
|
40
41
|
const [currentLoadedAssignment, setCurrentLoadedAssignment] = useState('');
|
|
@@ -69,8 +70,8 @@ export default function DeferLoad(props: DeferLoadProps) {
|
|
|
69
70
|
const getViewOptions = () => ({
|
|
70
71
|
viewContext: resourceType,
|
|
71
72
|
pageClass: loadViewCaseID ? '' : (pConnect.getDataObject('') as any).pyPortal.classID, // 2nd arg empty string until typedef allows optional
|
|
72
|
-
container: isContainerPreview ? 'preview' :
|
|
73
|
-
containerName: isContainerPreview ? 'preview' :
|
|
73
|
+
container: isContainerPreview ? 'preview' : undefined,
|
|
74
|
+
containerName: isContainerPreview ? 'preview' : undefined,
|
|
74
75
|
updateData: isContainerPreview
|
|
75
76
|
});
|
|
76
77
|
|
|
@@ -113,7 +114,6 @@ export default function DeferLoad(props: DeferLoadProps) {
|
|
|
113
114
|
getPConnect()
|
|
114
115
|
.getActionsApi()
|
|
115
116
|
.showData(name, dataContext, dataContextParameters, {
|
|
116
|
-
// @ts-ignore - Type 'boolean' is not assignable to type 'string'
|
|
117
117
|
skipSemanticUrl: true,
|
|
118
118
|
// @ts-ignore
|
|
119
119
|
isDeferLoaded: true
|
|
@@ -145,7 +145,7 @@ export default function DeferLoad(props: DeferLoadProps) {
|
|
|
145
145
|
console.log(`deferload: ${error}`);
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
}, [name, getPConnect, currentLoadedAssignment]);
|
|
148
|
+
}, [name, getPConnect, currentLoadedAssignment, lastUpdateCaseTime]);
|
|
149
149
|
/* TODO Cosmos need to handle for now added a wrapper div with pos relative */
|
|
150
150
|
let deferLoadContent;
|
|
151
151
|
if (isLoading) {
|
|
@@ -71,12 +71,7 @@ export default function MultiStep(props: PropsWithChildren<MultiStepProps>) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function _showHLine(index: number): boolean {
|
|
74
|
-
|
|
75
|
-
if (index < arNavigationSteps.length - 1) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return false;
|
|
74
|
+
return index < arNavigationSteps.length - 1;
|
|
80
75
|
}
|
|
81
76
|
|
|
82
77
|
function buttonPress(sAction: string, sButtonType: string) {
|
|
@@ -179,7 +179,7 @@ export default function RootContainer(props: PropsWithChildren<RootContainerProp
|
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
if (!PCore.isDeepEqual(currentRootConfig, prevRootConfig)) {
|
|
182
|
+
if (prevRootConfig === null || !PCore.isDeepEqual(currentRootConfig, prevRootConfig)) {
|
|
183
183
|
rootView.current = createElement(createPConnectComponent(), PCore.createPConnect(currentRootConfig)) as any;
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -73,7 +73,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
73
73
|
const pConn = getPConnect();
|
|
74
74
|
const envInfo = PCore.getEnvironmentInfo();
|
|
75
75
|
const imageKey = envInfo.getOperatorImageInsKey();
|
|
76
|
-
const userName = envInfo.getOperatorName();
|
|
76
|
+
const userName = envInfo.getOperatorName() || '';
|
|
77
77
|
const currentUserInitials = Utils.getInitials(userName);
|
|
78
78
|
const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : '';
|
|
79
79
|
const portalClass = pConn.getValue('.classID', ''); // 2nd arg empty string until typedef marked correctly
|
|
@@ -101,7 +101,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
101
101
|
);
|
|
102
102
|
// Initial setting of appName and mapChildren
|
|
103
103
|
useEffect(() => {
|
|
104
|
-
setAppName(PCore.getEnvironmentInfo().getApplicationName());
|
|
104
|
+
setAppName(PCore.getEnvironmentInfo().getApplicationName() || '');
|
|
105
105
|
|
|
106
106
|
const tempMap: any = (pConn.getChildren() as any)?.map((child: any, index) => {
|
|
107
107
|
const theChildComp = child.getPConnect().getComponentName();
|
|
@@ -125,7 +125,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
125
125
|
.getPageDataAsync(caseTypesAvailableToCreateDP, pConn.getContextName(), {
|
|
126
126
|
PortalName: portalID
|
|
127
127
|
})
|
|
128
|
-
.then(response => {
|
|
128
|
+
.then((response: { pyCaseTypesAvailableToCreate?: any }) => {
|
|
129
129
|
if (response?.pyCaseTypesAvailableToCreate) {
|
|
130
130
|
pConn.replaceState('.pyCaseTypesAvailableToCreate', response.pyCaseTypesAvailableToCreate, {
|
|
131
131
|
skipDirtyValidation: true
|
|
@@ -218,10 +218,10 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
218
218
|
portalName={portalName}
|
|
219
219
|
imageSrc={iconURL}
|
|
220
220
|
fullImageSrc={fullIconURL}
|
|
221
|
-
appName={localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
|
|
221
|
+
appName={localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
|
|
222
222
|
appInfo={{
|
|
223
223
|
imageSrc: iconURL,
|
|
224
|
-
appName: localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()),
|
|
224
|
+
appName: localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()),
|
|
225
225
|
onClick: links[0] && /* links[0].onClick ? */ links[0].onClick /* : undefined */
|
|
226
226
|
}}
|
|
227
227
|
navLinks={links.filter((link, index) => {
|
|
@@ -245,7 +245,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
245
245
|
<NavBar
|
|
246
246
|
getPConnect={getPConnect}
|
|
247
247
|
pConn={getPConnect()}
|
|
248
|
-
appName={localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
|
|
248
|
+
appName={localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
|
|
249
249
|
pages={pages}
|
|
250
250
|
caseTypes={caseTypes}
|
|
251
251
|
/>
|
|
@@ -19,6 +19,7 @@ interface CaseViewProps extends PConnProps {
|
|
|
19
19
|
header: string;
|
|
20
20
|
showIconInHeader: boolean;
|
|
21
21
|
caseInfo: any;
|
|
22
|
+
lastUpdateCaseTime: any;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const useStyles = makeStyles(theme => ({
|
|
@@ -64,10 +65,10 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
|
64
65
|
showIconInHeader = true,
|
|
65
66
|
caseInfo: { availableActions = [], availableProcesses = [], hasNewAttachments, caseTypeID = '', caseTypeName = '' }
|
|
66
67
|
} = props;
|
|
68
|
+
const { lastUpdateCaseTime = getPConnect().getValue('caseInfo.lastUpdateTime') } = props;
|
|
67
69
|
|
|
68
70
|
const currentCaseID = props.caseInfo.ID;
|
|
69
71
|
let isComponentMounted = true;
|
|
70
|
-
|
|
71
72
|
const { displayOnlyFA } = useContext<any>(StoreContext);
|
|
72
73
|
|
|
73
74
|
const thePConn = getPConnect();
|
|
@@ -79,7 +80,6 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
|
79
80
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
80
81
|
const localeCategory = 'CaseView';
|
|
81
82
|
const localeKey = `${caseTypeID}!CASE!${caseTypeName}`.toUpperCase();
|
|
82
|
-
|
|
83
83
|
/**
|
|
84
84
|
*
|
|
85
85
|
* @param inName the metadata <em>name</em> that will cause a region to be returned
|
|
@@ -169,7 +169,6 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
|
169
169
|
|
|
170
170
|
useEffect(() => {
|
|
171
171
|
if (hasNewAttachments) {
|
|
172
|
-
// @ts-ignore - Argument of type 'boolean' is not assignable to parameter of type 'object'
|
|
173
172
|
PCore.getPubSubUtils().publish((PCore.getEvents().getCaseEvent() as any).CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, true);
|
|
174
173
|
}
|
|
175
174
|
}, [hasNewAttachments]);
|
|
@@ -244,7 +243,9 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
|
244
243
|
<Grid item xs={6}>
|
|
245
244
|
{theStagesRegion}
|
|
246
245
|
{theTodoRegion}
|
|
247
|
-
{deferLoadInfo.length > 0 &&
|
|
246
|
+
{deferLoadInfo.length > 0 && (
|
|
247
|
+
<DeferLoad getPConnect={getPConnect} name={deferLoadInfo[activeVertTab].config.name} isTab lastUpdateCaseTime={lastUpdateCaseTime} />
|
|
248
|
+
)}
|
|
248
249
|
</Grid>
|
|
249
250
|
|
|
250
251
|
<Grid item xs={3}>
|
|
@@ -41,7 +41,7 @@ export default function Confirmation(props: PropsWithChildren<ConfirmationProps>
|
|
|
41
41
|
// Not using whatsNext at the moment, need to figure out the use of it
|
|
42
42
|
// const whatsNext = datasource?.source;
|
|
43
43
|
// const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
|
|
44
|
-
const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget());
|
|
44
|
+
const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget() || '');
|
|
45
45
|
const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), activeContainerItemID);
|
|
46
46
|
const onConfirmViewClose = () => {
|
|
47
47
|
setShowConfirmView(false);
|
|
@@ -26,7 +26,6 @@ function DynamicTabs(props: DynamicTabsProps) {
|
|
|
26
26
|
// Get the inherited props from the parent to determine label settings
|
|
27
27
|
const propsToUse = { label, showLabel, ...pConnect.getInheritedProps() };
|
|
28
28
|
const defaultTabIndex = 0;
|
|
29
|
-
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
30
29
|
const { tablabel } = pConnect.getComponentConfig();
|
|
31
30
|
const tablabelProp = PCore.getAnnotationUtils().getPropertyName(tablabel);
|
|
32
31
|
const referenceListData: any = pConnect.getValue(`${referenceList}.pxResults`, ''); // 2nd arg empty string until typedefs properly allow optional
|
|
@@ -58,7 +58,6 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
|
|
|
58
58
|
if (PCore.getPCoreVersion()?.includes('8.7')) {
|
|
59
59
|
pConn.getListActions().insert({ classID: contextClass }, referenceList.length, pageReference);
|
|
60
60
|
} else {
|
|
61
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
62
61
|
pConn.getListActions().insert({}, referenceList.length);
|
|
63
62
|
}
|
|
64
63
|
};
|
|
@@ -71,7 +70,6 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
|
|
|
71
70
|
if (PCore.getPCoreVersion()?.includes('8.7')) {
|
|
72
71
|
pConn.getListActions().deleteEntry(index, pageReference);
|
|
73
72
|
} else {
|
|
74
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
75
73
|
pConn.getListActions().deleteEntry(index);
|
|
76
74
|
}
|
|
77
75
|
};
|
|
@@ -43,6 +43,7 @@ import { filterData } from '@pega/react-sdk-components/lib/components/helpers/si
|
|
|
43
43
|
import './ListView.css';
|
|
44
44
|
import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
45
45
|
import { getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
46
|
+
import { getGenericFieldsLocalizedValue } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
46
47
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
47
48
|
|
|
48
49
|
import useInit from './hooks';
|
|
@@ -109,7 +110,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
109
110
|
});
|
|
110
111
|
|
|
111
112
|
const thePConn = getPConnect();
|
|
112
|
-
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
113
113
|
const componentConfig = thePConn.getComponentConfig();
|
|
114
114
|
const resolvedConfigProps: any = thePConn.getConfigProps() as ListViewProps;
|
|
115
115
|
|
|
@@ -222,11 +222,12 @@ export default function ListView(props: ListViewProps) {
|
|
|
222
222
|
|
|
223
223
|
type Order = 'asc' | 'desc';
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
interface Comparator<T> {
|
|
226
|
+
(a: T, b: T): number;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function getComparator<T, Key extends keyof T>(theOrder: Order, orderedBy: Key): Comparator<T> {
|
|
230
|
+
return theOrder === 'desc' ? (a: T, b: T) => descendingComparator(a, b, orderedBy) : (a: T, b: T) => -descendingComparator(a, b, orderedBy);
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
@@ -642,7 +643,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
642
643
|
|
|
643
644
|
thePConn
|
|
644
645
|
.getActionsApi()
|
|
645
|
-
// @ts-ignore
|
|
646
646
|
.openAssignment(pzInsKey, pxRefObjectClass, options)
|
|
647
647
|
.then(() => {
|
|
648
648
|
// console.log("openAssignment successful");
|
|
@@ -875,7 +875,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
875
875
|
pzInsKey = row[`${associationCategory}:pzInsKey`];
|
|
876
876
|
}
|
|
877
877
|
if (column.isAssignmentLink) {
|
|
878
|
-
// @ts-ignore
|
|
879
878
|
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
880
879
|
containerName: 'primary',
|
|
881
880
|
channelName: ''
|
|
@@ -1131,7 +1130,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
1131
1130
|
})}
|
|
1132
1131
|
</TableBody>
|
|
1133
1132
|
</Table>
|
|
1134
|
-
{arRows && arRows.length === 0 &&
|
|
1133
|
+
{arRows && arRows.length === 0 && (
|
|
1134
|
+
<div className='no-records'>{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}</div>
|
|
1135
|
+
)}
|
|
1135
1136
|
</TableContainer>
|
|
1136
1137
|
)}
|
|
1137
1138
|
</>
|
|
@@ -202,7 +202,6 @@ export function getConfigEmbeddedFieldsMeta(configFields, classID) {
|
|
|
202
202
|
if (value.includes('[')) {
|
|
203
203
|
value = value.substring(0, value.indexOf('[')) + value.substring(value.indexOf(']') + 1);
|
|
204
204
|
}
|
|
205
|
-
// @ts-ignore - Expected 3 arguments, but got 2.
|
|
206
205
|
const meta: any = PCore.getMetadataUtils().getEmbeddedPropertyMetadata(value, classID);
|
|
207
206
|
meta.fieldID = field;
|
|
208
207
|
configEmbeddedFieldsMeta.push(meta);
|
|
@@ -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,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-nested-ternary */
|
|
2
1
|
import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
2
|
import Table from '@mui/material/Table';
|
|
4
3
|
import TableBody from '@mui/material/TableBody';
|
|
@@ -28,6 +27,7 @@ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react
|
|
|
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)
|
|
@@ -306,9 +318,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
306
318
|
if (allowEditingInModal && defaultView) {
|
|
307
319
|
pConn
|
|
308
320
|
.getActionsApi()
|
|
321
|
+
// @ts-ignore
|
|
309
322
|
.openEmbeddedDataModal(defaultView, pConn, referenceListStr, referenceList.length, PCore.getConstants().RESOURCE_STATUS.CREATE);
|
|
310
323
|
} else {
|
|
311
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
312
324
|
pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
|
|
313
325
|
}
|
|
314
326
|
|
|
@@ -322,6 +334,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
322
334
|
if (typeof selectedRowIndex.current === 'number') {
|
|
323
335
|
pConn
|
|
324
336
|
.getActionsApi()
|
|
337
|
+
// @ts-ignore
|
|
325
338
|
.openEmbeddedDataModal(
|
|
326
339
|
bUseSeparateViewForEdit ? editView : defaultView,
|
|
327
340
|
pConn,
|
|
@@ -334,12 +347,10 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
334
347
|
|
|
335
348
|
const deleteRecord = () => {
|
|
336
349
|
setEditAnchorEl(null);
|
|
337
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
338
350
|
pConn.getListActions().deleteEntry(selectedRowIndex.current);
|
|
339
351
|
};
|
|
340
352
|
|
|
341
353
|
const deleteRecordFromInlineEditable = (index: number) => {
|
|
342
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
343
354
|
pConn.getListActions().deleteEntry(index);
|
|
344
355
|
};
|
|
345
356
|
|
|
@@ -349,7 +360,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
349
360
|
const data: any = [];
|
|
350
361
|
rawFields.forEach(item => {
|
|
351
362
|
// removing label field from config to hide title in the table cell
|
|
352
|
-
item = { ...item, config: { ...item.config, label: '' } };
|
|
363
|
+
item = { ...item, config: { ...item.config, label: '', displayMode: readOnlyMode || allowEditingInModal ? 'DISPLAY_ONLY' : undefined } };
|
|
353
364
|
const referenceListData = getReferenceList(pConn);
|
|
354
365
|
const isDatapage = referenceListData.startsWith('D_');
|
|
355
366
|
const pageReferenceValue = isDatapage
|
|
@@ -383,6 +394,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
383
394
|
};
|
|
384
395
|
|
|
385
396
|
function descendingComparator<T>(a: T, b: T, orderedBy: keyof T) {
|
|
397
|
+
if (!orderedBy || (!a[orderedBy] && !b[orderedBy])) {
|
|
398
|
+
return 0;
|
|
399
|
+
}
|
|
386
400
|
if (!b[orderedBy] || b[orderedBy] < a[orderedBy]) {
|
|
387
401
|
return -1;
|
|
388
402
|
}
|
|
@@ -394,11 +408,12 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
394
408
|
|
|
395
409
|
type Order = 'asc' | 'desc';
|
|
396
410
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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);
|
|
402
417
|
}
|
|
403
418
|
|
|
404
419
|
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
@@ -410,7 +425,11 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
410
425
|
return a[1] - b[1];
|
|
411
426
|
});
|
|
412
427
|
|
|
413
|
-
|
|
428
|
+
const newElements = new Array(stabilizedThis.length);
|
|
429
|
+
stabilizedThis.forEach((el, index) => {
|
|
430
|
+
newElements[index] = elements[el[1]];
|
|
431
|
+
});
|
|
432
|
+
return newElements;
|
|
414
433
|
}
|
|
415
434
|
|
|
416
435
|
function _menuClick(event, columnId: string, columnType: string, labelValue: string) {
|
|
@@ -580,19 +599,21 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
580
599
|
<>
|
|
581
600
|
<TableContainer component={Paper} style={{ margin: '4px 0px' }} id='simple-table-manual'>
|
|
582
601
|
{propsToUse.label && (
|
|
583
|
-
<h3 className={classes.label}>
|
|
602
|
+
<h3 className={`${classes.label} ${required ? classes.tableLabel : ''}`}>
|
|
584
603
|
{propsToUse.label} {results()}
|
|
585
604
|
</h3>
|
|
586
605
|
)}
|
|
606
|
+
{validatemessage && <div className={classes.message}>{validatemessage}</div>}
|
|
587
607
|
<Table>
|
|
588
608
|
<TableHead className={classes.header}>
|
|
589
609
|
<TableRow>
|
|
590
610
|
{fieldDefs.map((field: any, index) => {
|
|
591
611
|
return (
|
|
592
612
|
<TableCell key={`head-${displayedColumns[index]}`} className={classes.tableCell}>
|
|
593
|
-
{readOnlyMode ? (
|
|
594
|
-
<div>
|
|
613
|
+
{(readOnlyMode || allowEditingInModal) && field.cellRenderer !== 'DeleteIcon' ? (
|
|
614
|
+
<div style={{ display: 'flex' }}>
|
|
595
615
|
<TableSortLabel
|
|
616
|
+
style={{ width: '75%' }}
|
|
596
617
|
active={orderBy === displayedColumns[index]}
|
|
597
618
|
direction={orderBy === displayedColumns[index] ? order : 'asc'}
|
|
598
619
|
onClick={createSortHandler(displayedColumns[index])}
|
|
@@ -604,8 +625,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
604
625
|
) : null}
|
|
605
626
|
</TableSortLabel>
|
|
606
627
|
<MoreIcon
|
|
628
|
+
style={{ cursor: 'pointer', zIndex: 1000 }}
|
|
607
629
|
id='menu-icon'
|
|
608
|
-
className={classes.moreIcon}
|
|
609
630
|
onClick={event => {
|
|
610
631
|
_menuClick(event, field.name, field.meta.type, field.label);
|
|
611
632
|
}}
|
|
@@ -621,6 +642,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
621
642
|
</TableHead>
|
|
622
643
|
<TableBody>
|
|
623
644
|
{editableMode &&
|
|
645
|
+
!allowEditingInModal &&
|
|
624
646
|
elements.map((row: any, index) => {
|
|
625
647
|
const theKey = `row-${index}`;
|
|
626
648
|
return (
|
|
@@ -658,53 +680,46 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
658
680
|
return (
|
|
659
681
|
// eslint-disable-next-line react/no-array-index-key
|
|
660
682
|
<TableRow key={index}>
|
|
661
|
-
{
|
|
683
|
+
{row.map((item, childIndex) => {
|
|
684
|
+
const theColKey = displayedColumns[childIndex];
|
|
662
685
|
return (
|
|
663
|
-
<TableCell key={
|
|
664
|
-
{
|
|
665
|
-
<div>
|
|
666
|
-
<MoreIcon
|
|
667
|
-
id='table-edit-menu-icon'
|
|
668
|
-
className={classes.moreIcon}
|
|
669
|
-
onClick={event => {
|
|
670
|
-
editMenuClick(event, index);
|
|
671
|
-
}}
|
|
672
|
-
/>
|
|
673
|
-
<Menu id='table-edit-menu' anchorEl={editAnchorEl} keepMounted open={Boolean(editAnchorEl)} onClose={_menuClose}>
|
|
674
|
-
<MenuItem onClick={() => editRecord()}>Edit</MenuItem>
|
|
675
|
-
<MenuItem onClick={() => deleteRecord()}>Delete</MenuItem>
|
|
676
|
-
</Menu>
|
|
677
|
-
</div>
|
|
678
|
-
) : typeof row[colKey] === 'boolean' && !row[colKey] ? (
|
|
679
|
-
'False'
|
|
680
|
-
) : typeof row[colKey] === 'boolean' && row[colKey] ? (
|
|
681
|
-
'True'
|
|
682
|
-
) : (
|
|
683
|
-
row[colKey] || '---'
|
|
684
|
-
)}
|
|
686
|
+
<TableCell key={theColKey} className={classes.tableCell}>
|
|
687
|
+
{item}
|
|
685
688
|
</TableCell>
|
|
686
689
|
);
|
|
687
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
|
+
)}
|
|
688
708
|
</TableRow>
|
|
689
709
|
);
|
|
690
710
|
})}
|
|
691
711
|
</TableBody>
|
|
692
712
|
</Table>
|
|
693
|
-
{readOnlyMode && rowData
|
|
694
|
-
<div className='no-records' id='no-records'>
|
|
695
|
-
No records found.
|
|
696
|
-
</div>
|
|
697
|
-
)}
|
|
698
|
-
{editableMode && referenceList && referenceList.length === 0 && (
|
|
713
|
+
{((readOnlyMode && (!rowData || rowData?.length === 0)) || (editableMode && (!referenceList || referenceList?.length === 0))) && (
|
|
699
714
|
<div className='no-records' id='no-records'>
|
|
700
|
-
No records found.
|
|
715
|
+
{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}
|
|
701
716
|
</div>
|
|
702
717
|
)}
|
|
703
718
|
</TableContainer>
|
|
704
719
|
{showAddRowButton && (
|
|
705
720
|
<div style={{ fontSize: '1rem' }}>
|
|
706
721
|
<Link style={{ cursor: 'pointer' }} onClick={addRecord} underline='hover'>
|
|
707
|
-
+ Add
|
|
722
|
+
+ {localizedVal('Add', localeCategory)}
|
|
708
723
|
</Link>
|
|
709
724
|
</div>
|
|
710
725
|
)}
|
|
@@ -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) => {
|
|
@@ -33,7 +33,7 @@ const updateAttachmentState = (pConn, key, attachments) => {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
export default function Attachment(props: AttachmentProps) {
|
|
36
|
-
const { value, getPConnect, label, validatemessage, allowMultiple, extensions, displayMode } = props;
|
|
36
|
+
const { value, getPConnect, label, validatemessage, allowMultiple, extensions, displayMode, helperText } = props;
|
|
37
37
|
/* this is a temporary fix because required is supposed to be passed as a boolean and NOT as a string */
|
|
38
38
|
let { required, disabled } = props;
|
|
39
39
|
[required, disabled] = [required, disabled].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
|
|
@@ -155,11 +155,9 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
155
155
|
const context = pConn.getContextName();
|
|
156
156
|
// set errors to property to block submit even on errors in file upload
|
|
157
157
|
PCore.getMessageManager().addMessages({
|
|
158
|
-
// @ts-ignore
|
|
159
158
|
messages: [
|
|
160
159
|
{
|
|
161
160
|
type: 'error',
|
|
162
|
-
// @ts-ignore - Type '{ type: string; message: string; }' is not assignable to type 'MessagesConfigObject'.
|
|
163
161
|
message: pConn.getLocalizedValue('Error with one or more files', '', '')
|
|
164
162
|
}
|
|
165
163
|
],
|
|
@@ -192,7 +190,6 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
192
190
|
const clearFieldErrorMessages = () => {
|
|
193
191
|
const fieldName = (pConn.getStateProps() as any).value;
|
|
194
192
|
const context = pConn.getContextName();
|
|
195
|
-
// @ts-ignore
|
|
196
193
|
PCore.getMessageManager().clearMessages({
|
|
197
194
|
type: PCore.getConstants().MESSAGES.MESSAGES_TYPE_ERROR,
|
|
198
195
|
property: fieldName,
|
|
@@ -231,11 +228,9 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
231
228
|
const fieldName = (pConn.getStateProps() as any).value;
|
|
232
229
|
const context = pConn.getContextName();
|
|
233
230
|
PCore.getMessageManager().addMessages({
|
|
234
|
-
// @ts-ignore
|
|
235
231
|
messages: [
|
|
236
232
|
{
|
|
237
233
|
type: 'error',
|
|
238
|
-
// @ts-ignore - Type '{ type: string; message: string; }' is not assignable to type 'MessagesConfigObject'.
|
|
239
234
|
message: pConn.getLocalizedValue('Error with one or more files', '', '')
|
|
240
235
|
}
|
|
241
236
|
],
|
|
@@ -461,7 +456,7 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
461
456
|
<div className='file-upload-container'>
|
|
462
457
|
<span className={`label ${required ? 'file-label' : ''}`}>{label}</span>
|
|
463
458
|
{((files.length === 0 && allowMultiple !== 'true') || allowMultiple === 'true') && <section>{content}</section>}
|
|
464
|
-
{validatemessage !== '' ? <span className='file-error'>{validatemessage}</span> : ''}
|
|
459
|
+
{validatemessage !== '' ? <span className='file-error'>{validatemessage}</span> : <span style={{ fontSize: '14px' }}>{helperText}</span>}
|
|
465
460
|
{files && files.length > 0 && <section>{fileDisplay}</section>}
|
|
466
461
|
</div>
|
|
467
462
|
);
|