@pega/react-sdk-overrides 23.1.10 → 23.1.12
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/LICENSE +201 -0
- package/README.md +17 -0
- package/SECURITY.md +10 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +6 -14
- package/lib/designSystemExtension/Banner/Banner.tsx +14 -11
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +27 -22
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +14 -20
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +44 -19
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +7 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +21 -32
- package/lib/designSystemExtension/Operator/Operator.tsx +94 -82
- package/lib/designSystemExtension/Pulse/Pulse.tsx +14 -16
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +6 -5
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +14 -14
- package/lib/field/AutoComplete/AutoComplete.tsx +24 -26
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +98 -84
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +120 -63
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +25 -50
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +9 -16
- package/lib/field/Date/Date.tsx +15 -11
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +9 -9
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +33 -44
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +122 -31
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +11 -10
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +39 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +8 -7
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/MultiSelect/Multiselect.tsx +244 -0
- package/lib/field/MultiSelect/index.tsx +1 -0
- package/lib/field/MultiSelect/utils.ts +230 -0
- package/lib/field/Percentage/Percentage.tsx +46 -41
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +13 -12
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +20 -18
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +8 -7
- package/lib/field/ScalarList/ScalarList.tsx +3 -13
- package/lib/field/ScalarList/config-ext.json +1 -2
- package/lib/field/SemanticLink/SemanticLink.tsx +7 -7
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -11
- package/lib/field/TextArea/TextArea.tsx +7 -6
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +4 -6
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +9 -7
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +11 -11
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +9 -8
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +18 -16
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/attachmentHelpers.ts +13 -8
- package/lib/helpers/case-utils.tsx +4 -8
- package/lib/helpers/common-utils.ts +5 -1
- package/lib/helpers/data_page.ts +3 -7
- package/lib/helpers/date-format-utils.ts +3 -3
- package/lib/helpers/event-utils.ts +3 -3
- package/lib/helpers/field-group-utils.ts +1 -1
- package/lib/helpers/formatters/Boolean.ts +9 -26
- package/lib/helpers/formatters/Currency.ts +15 -21
- package/lib/helpers/formatters/CurrencyMap.ts +505 -501
- package/lib/helpers/formatters/Date.ts +20 -26
- package/lib/helpers/formatters/common.ts +1 -2
- package/lib/helpers/formatters/index.ts +26 -19
- package/lib/helpers/instructions-utils.ts +38 -0
- package/lib/helpers/reactContextHelpers.ts +2 -2
- package/lib/helpers/simpleTableHelpers.ts +59 -83
- package/lib/helpers/state-utils.tsx +5 -9
- package/lib/helpers/template-utils.ts +3 -6
- package/lib/helpers/utils.ts +5 -5
- package/lib/helpers/versionHelpers.ts +1 -4
- package/lib/infra/ActionButtons/ActionButtons.tsx +38 -29
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -79
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +13 -16
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +67 -213
- package/lib/infra/Containers/FlowContainer/helpers.ts +34 -45
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +227 -218
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
- package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
- package/lib/infra/Containers/SimpleView/helper.ts +125 -0
- package/lib/infra/Containers/SimpleView/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +36 -46
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -42
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -43
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -28
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +16 -30
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +176 -212
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +19 -31
- package/lib/infra/Reference/Reference.tsx +16 -18
- package/lib/infra/Region/Region.tsx +4 -6
- package/lib/infra/RootContainer/RootContainer.tsx +75 -111
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +32 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +11 -11
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +21 -28
- package/lib/infra/View/View.tsx +17 -21
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +39 -74
- package/lib/template/BannerPage/BannerPage.tsx +12 -14
- package/lib/template/CaseSummary/CaseSummary.tsx +58 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +34 -63
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +63 -19
- package/lib/template/Confirmation/Confirmation.tsx +12 -17
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +95 -121
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +13 -16
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/Details/Details/Details.tsx +19 -22
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +9 -13
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -24
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +19 -25
- package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +15 -14
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +15 -22
- package/lib/template/InlineDashboard/InlineDashboard.tsx +12 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +12 -16
- package/lib/template/ListPage/ListPage.tsx +5 -10
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/DefaultViewMeta.ts +1 -3
- package/lib/template/ListView/ListView.tsx +185 -175
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/hooks.ts +24 -26
- package/lib/template/ListView/utils.ts +51 -87
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +20 -20
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +25 -38
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +20 -25
- package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +14 -24
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +9 -19
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +14 -15
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +3 -10
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +6 -10
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +32 -28
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +37 -33
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -121
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +24 -25
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +30 -30
- package/lib/template/SubTabs/SubTabs.tsx +22 -40
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -5
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +30 -28
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +3 -10
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +30 -28
- package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +22 -34
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +24 -28
- package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +13 -21
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +8 -16
- package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +18 -21
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +29 -28
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +60 -1
- package/lib/widget/Attachment/Attachment.tsx +378 -405
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +64 -66
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +16 -18
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +310 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +23 -20
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +68 -42
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +58 -58
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +7 -10
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +52 -53
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -834
- package/lib/helpers/authManager.ts +0 -933
- package/lib/helpers/config_access.js +0 -186
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
3
|
-
|
|
4
|
-
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
4
|
|
|
6
5
|
interface CaseSummaryProps extends PConnProps {
|
|
7
6
|
// If any, enter additional props that only exist on this component
|
|
8
|
-
children: Array<any>
|
|
9
7
|
}
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
export default function CaseSummary(props: CaseSummaryProps) {
|
|
9
|
+
export default function CaseSummary(props: PropsWithChildren<CaseSummaryProps>) {
|
|
13
10
|
// Get emitted components from map (so we can get any override that may exist)
|
|
14
11
|
const CaseSummaryFields = getComponentFromMap('CaseSummaryFields');
|
|
15
12
|
|
|
16
13
|
const { getPConnect, children } = props;
|
|
14
|
+
|
|
17
15
|
const thePConn = getPConnect();
|
|
18
|
-
const theConfigProps = thePConn.getConfigProps();
|
|
16
|
+
const theConfigProps: any = thePConn.getConfigProps();
|
|
19
17
|
// const { status, showStatus } = theConfigProps;
|
|
20
|
-
const status = theConfigProps
|
|
21
|
-
const showStatus = theConfigProps
|
|
22
|
-
|
|
18
|
+
const status = theConfigProps.status;
|
|
19
|
+
const showStatus = theConfigProps.showStatus;
|
|
20
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
21
|
+
const localeCategory = 'ModalContainer';
|
|
23
22
|
// from Constellation DX Components
|
|
24
23
|
// get the primary and secondary fields with the raw data (which has the non-resolved property values)
|
|
25
24
|
// const regionsRaw = getPConnect().getRawMetadata().children;
|
|
@@ -28,16 +27,57 @@ export default function CaseSummary(props: CaseSummaryProps) {
|
|
|
28
27
|
|
|
29
28
|
// From other SDKs
|
|
30
29
|
// may want to move these into useEffect/useState combo
|
|
31
|
-
let arPrimaryFields:
|
|
32
|
-
let arSecondaryFields:
|
|
30
|
+
let arPrimaryFields: any[] = [];
|
|
31
|
+
let arSecondaryFields: any[] = [];
|
|
32
|
+
|
|
33
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
34
|
+
function prepareComponentInCaseSummary(pConnectMeta, getPConnect) {
|
|
35
|
+
const { config, children } = pConnectMeta;
|
|
36
|
+
const pConnect = getPConnect();
|
|
37
|
+
|
|
38
|
+
const caseSummaryComponentObject: any = {};
|
|
39
|
+
|
|
40
|
+
const { type } = pConnectMeta;
|
|
41
|
+
const createdComponent = pConnect.createComponent({
|
|
42
|
+
type,
|
|
43
|
+
children: children ? [...children] : [],
|
|
44
|
+
config: {
|
|
45
|
+
...config
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
caseSummaryComponentObject.value = createdComponent;
|
|
50
|
+
return caseSummaryComponentObject;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function prepareCaseSummaryData(summaryFieldChildren) {
|
|
54
|
+
const convertChildrenToSummaryData = kid => {
|
|
55
|
+
return kid?.map((childItem, index) => {
|
|
56
|
+
const childMeta = childItem.getPConnect().meta;
|
|
57
|
+
const caseSummaryComponentObject = prepareComponentInCaseSummary(childMeta, childItem.getPConnect);
|
|
58
|
+
caseSummaryComponentObject.id = index + 1;
|
|
59
|
+
return caseSummaryComponentObject;
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
return summaryFieldChildren ? convertChildrenToSummaryData(summaryFieldChildren?.getChildren()) : undefined;
|
|
63
|
+
}
|
|
33
64
|
|
|
34
|
-
for (const child of children) {
|
|
35
|
-
const childPConn = child.props.getPConnect();
|
|
65
|
+
for (const child of children as ReactElement[]) {
|
|
66
|
+
const childPConn = (child as ReactElement).props.getPConnect();
|
|
36
67
|
const childPConnData = childPConn.resolveConfigProps(childPConn.getRawMetadata());
|
|
37
|
-
if (childPConnData.name.toLowerCase() ===
|
|
68
|
+
if (childPConnData.name.toLowerCase() === 'primary fields') {
|
|
38
69
|
arPrimaryFields = childPConnData.children;
|
|
39
|
-
|
|
70
|
+
arPrimaryFields.forEach(field => {
|
|
71
|
+
if (field.config?.value && typeof field.config?.value === 'string') {
|
|
72
|
+
field.config.value = localizedVal(field.config.value, localeCategory);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
} else if (childPConnData.name.toLowerCase() === 'secondary fields') {
|
|
76
|
+
const secondarySummaryFields = prepareCaseSummaryData(childPConn);
|
|
40
77
|
arSecondaryFields = childPConnData.children;
|
|
78
|
+
arSecondaryFields.forEach((field, index) => {
|
|
79
|
+
field.config.displayLabel = secondarySummaryFields[index]?.value?.props?.label;
|
|
80
|
+
});
|
|
41
81
|
}
|
|
42
82
|
}
|
|
43
83
|
|
|
@@ -49,9 +89,9 @@ export default function CaseSummary(props: CaseSummaryProps) {
|
|
|
49
89
|
// console.log(`CaseSummary: arSecondaryFields: ${JSON.stringify(arSecondaryFields)}`);
|
|
50
90
|
|
|
51
91
|
return (
|
|
52
|
-
<div id=
|
|
92
|
+
<div id='CaseSummary'>
|
|
53
93
|
<CaseSummaryFields status={status} showStatus={showStatus} theFields={arPrimaryFields} />
|
|
54
94
|
<CaseSummaryFields theFields={arSecondaryFields} />
|
|
55
95
|
</div>
|
|
56
|
-
)
|
|
96
|
+
);
|
|
57
97
|
}
|
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-boolean-value */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { Card, CardHeader, Avatar, Typography, Divider } from '@material-ui/core';
|
|
3
|
+
import { PropsWithChildren, ReactElement, useContext, useEffect, useState } from 'react';
|
|
4
|
+
import { Avatar, Card, CardHeader, Divider, Typography } from '@material-ui/core';
|
|
6
5
|
import { makeStyles } from '@material-ui/core/styles';
|
|
7
6
|
import Box from '@material-ui/core/Box';
|
|
8
7
|
import Button from '@material-ui/core/Button';
|
|
9
8
|
import Grid from '@material-ui/core/Grid';
|
|
10
9
|
|
|
10
|
+
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
11
11
|
import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
|
|
12
12
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
13
|
-
|
|
14
|
-
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
13
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
15
14
|
|
|
16
15
|
interface CaseViewProps extends PConnProps {
|
|
17
16
|
// If any, enter additional props that only exist on this component
|
|
18
|
-
icon: string
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
caseInfo: any,
|
|
17
|
+
icon: string;
|
|
18
|
+
subheader: string;
|
|
19
|
+
header: string;
|
|
20
|
+
showIconInHeader: boolean;
|
|
21
|
+
caseInfo: any;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
|
|
28
|
-
declare const PCore: any;
|
|
29
|
-
|
|
30
|
-
|
|
31
24
|
const useStyles = makeStyles(theme => ({
|
|
32
25
|
root: {
|
|
33
26
|
paddingRight: theme.spacing(1),
|
|
@@ -55,11 +48,11 @@ const useStyles = makeStyles(theme => ({
|
|
|
55
48
|
}
|
|
56
49
|
}));
|
|
57
50
|
|
|
58
|
-
export default function CaseView(props: CaseViewProps) {
|
|
51
|
+
export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
59
52
|
// Get emitted components from map (so we can get any override that may exist)
|
|
60
|
-
const CaseViewActionsMenu = getComponentFromMap(
|
|
61
|
-
const VerticalTabs = getComponentFromMap(
|
|
62
|
-
const DeferLoad = getComponentFromMap(
|
|
53
|
+
const CaseViewActionsMenu = getComponentFromMap('CaseViewActionsMenu');
|
|
54
|
+
const VerticalTabs = getComponentFromMap('VerticalTabs');
|
|
55
|
+
const DeferLoad = getComponentFromMap('DeferLoad');
|
|
63
56
|
|
|
64
57
|
const {
|
|
65
58
|
getPConnect,
|
|
@@ -67,16 +60,11 @@ export default function CaseView(props: CaseViewProps) {
|
|
|
67
60
|
header,
|
|
68
61
|
subheader,
|
|
69
62
|
children = [],
|
|
70
|
-
// eslint-disable-next-line
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
71
64
|
showIconInHeader = true,
|
|
72
|
-
caseInfo: {
|
|
73
|
-
availableActions = [],
|
|
74
|
-
availableProcesses = [],
|
|
75
|
-
hasNewAttachments,
|
|
76
|
-
caseTypeID = '',
|
|
77
|
-
caseTypeName = ''
|
|
78
|
-
}
|
|
65
|
+
caseInfo: { availableActions = [], availableProcesses = [], hasNewAttachments, caseTypeID = '', caseTypeName = '' }
|
|
79
66
|
} = props;
|
|
67
|
+
|
|
80
68
|
const currentCaseID = props.caseInfo.ID;
|
|
81
69
|
let isComponentMounted = true;
|
|
82
70
|
|
|
@@ -97,15 +85,9 @@ export default function CaseView(props: CaseViewProps) {
|
|
|
97
85
|
* @param inName the metadata <em>name</em> that will cause a region to be returned
|
|
98
86
|
*/
|
|
99
87
|
function getChildRegionByName(inName: string): any {
|
|
100
|
-
for (const child of children) {
|
|
101
|
-
const theMetadataType: string = child.props
|
|
102
|
-
|
|
103
|
-
.getRawMetadata()
|
|
104
|
-
['type'].toLowerCase();
|
|
105
|
-
const theMetadataName: string = child.props
|
|
106
|
-
.getPConnect()
|
|
107
|
-
.getRawMetadata()
|
|
108
|
-
['name'].toLowerCase();
|
|
88
|
+
for (const child of children as ReactElement[]) {
|
|
89
|
+
const theMetadataType: string = (child as ReactElement).props.getPConnect().getRawMetadata().type.toLowerCase();
|
|
90
|
+
const theMetadataName: string = (child as ReactElement).props.getPConnect().getRawMetadata().name.toLowerCase();
|
|
109
91
|
|
|
110
92
|
if (theMetadataType === 'region' && theMetadataName === inName) {
|
|
111
93
|
return child;
|
|
@@ -132,10 +114,10 @@ export default function CaseView(props: CaseViewProps) {
|
|
|
132
114
|
const theTabsRegionChildren = theTabsRegion.props.getPConnect().getChildren();
|
|
133
115
|
|
|
134
116
|
// vertTabInfo is sent to VerticalTabs component
|
|
135
|
-
const vertTabInfo:
|
|
117
|
+
const vertTabInfo: Object[] = [];
|
|
136
118
|
|
|
137
119
|
// deferLoadInfo is sent to DeferLoad component (currently selected entry)
|
|
138
|
-
const deferLoadInfo:
|
|
120
|
+
const deferLoadInfo: any[] = [];
|
|
139
121
|
|
|
140
122
|
if (theTabsRegionChildren) {
|
|
141
123
|
// populate vertTabInfo and deferLoadInfo
|
|
@@ -187,10 +169,8 @@ export default function CaseView(props: CaseViewProps) {
|
|
|
187
169
|
|
|
188
170
|
useEffect(() => {
|
|
189
171
|
if (hasNewAttachments) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
true
|
|
193
|
-
);
|
|
172
|
+
// @ts-ignore - Argument of type 'boolean' is not assignable to parameter of type 'object'
|
|
173
|
+
PCore.getPubSubUtils().publish((PCore.getEvents().getCaseEvent() as any).CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, true);
|
|
194
174
|
}
|
|
195
175
|
}, [hasNewAttachments]);
|
|
196
176
|
|
|
@@ -198,11 +178,11 @@ export default function CaseView(props: CaseViewProps) {
|
|
|
198
178
|
const actionsAPI = thePConn.getActionsApi();
|
|
199
179
|
const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
|
|
200
180
|
|
|
201
|
-
openLocalAction(editAction.ID, { ...editAction });
|
|
181
|
+
openLocalAction(editAction.ID, { ...editAction, containerName: 'modal', type: 'express' });
|
|
202
182
|
}
|
|
203
183
|
|
|
204
184
|
function getActionButtonsHtml(): any {
|
|
205
|
-
|
|
185
|
+
return (
|
|
206
186
|
<Box>
|
|
207
187
|
{editAction && (
|
|
208
188
|
<Button
|
|
@@ -222,8 +202,6 @@ export default function CaseView(props: CaseViewProps) {
|
|
|
222
202
|
/>
|
|
223
203
|
</Box>
|
|
224
204
|
);
|
|
225
|
-
|
|
226
|
-
return aBHtml;
|
|
227
205
|
}
|
|
228
206
|
|
|
229
207
|
function getContainerContents() {
|
|
@@ -265,13 +243,7 @@ export default function CaseView(props: CaseViewProps) {
|
|
|
265
243
|
<Grid item xs={6}>
|
|
266
244
|
{theStagesRegion}
|
|
267
245
|
{theTodoRegion}
|
|
268
|
-
{deferLoadInfo.length > 0 &&
|
|
269
|
-
<DeferLoad
|
|
270
|
-
getPConnect={getPConnect}
|
|
271
|
-
name={deferLoadInfo[activeVertTab].config.name}
|
|
272
|
-
isTab
|
|
273
|
-
/>
|
|
274
|
-
)}
|
|
246
|
+
{deferLoadInfo.length > 0 && <DeferLoad getPConnect={getPConnect} name={deferLoadInfo[activeVertTab].config.name} isTab />}
|
|
275
247
|
</Grid>
|
|
276
248
|
|
|
277
249
|
<Grid item xs={3}>
|
|
@@ -279,16 +251,15 @@ export default function CaseView(props: CaseViewProps) {
|
|
|
279
251
|
</Grid>
|
|
280
252
|
</Grid>
|
|
281
253
|
);
|
|
282
|
-
} else {
|
|
283
|
-
// displayOnlyFA - only show the "todo" region
|
|
284
|
-
return (
|
|
285
|
-
<Grid container>
|
|
286
|
-
<Grid item xs={12}>
|
|
287
|
-
{theTodoRegion}
|
|
288
|
-
</Grid>
|
|
289
|
-
</Grid>
|
|
290
|
-
);
|
|
291
254
|
}
|
|
255
|
+
// displayOnlyFA - only show the "todo" region
|
|
256
|
+
return (
|
|
257
|
+
<Grid container>
|
|
258
|
+
<Grid item xs={12}>
|
|
259
|
+
{theTodoRegion}
|
|
260
|
+
</Grid>
|
|
261
|
+
</Grid>
|
|
262
|
+
);
|
|
292
263
|
}
|
|
293
264
|
|
|
294
265
|
return getContainerContents();
|
|
@@ -2,18 +2,21 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import Button from '@material-ui/core/Button';
|
|
3
3
|
import Menu from '@material-ui/core/Menu';
|
|
4
4
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
|
+
import Snackbar from '@material-ui/core/Snackbar';
|
|
8
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
9
|
+
import CloseIcon from '@material-ui/icons/Close';
|
|
6
10
|
|
|
7
11
|
interface CaseViewActionsMenuProps extends PConnProps {
|
|
8
12
|
// If any, enter additional props that only exist on this component
|
|
9
|
-
availableActions:
|
|
10
|
-
availableProcesses:
|
|
11
|
-
caseTypeID: string
|
|
12
|
-
caseTypeName: string
|
|
13
|
+
availableActions: any[];
|
|
14
|
+
availableProcesses: any[];
|
|
15
|
+
caseTypeID: string;
|
|
16
|
+
caseTypeName: string;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
export default function CaseViewActionsMenu(props:CaseViewActionsMenuProps) {
|
|
19
|
+
export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
|
|
17
20
|
const { getPConnect, availableActions, availableProcesses, caseTypeID, caseTypeName } = props;
|
|
18
21
|
const thePConn = getPConnect();
|
|
19
22
|
|
|
@@ -23,6 +26,9 @@ export default function CaseViewActionsMenu(props:CaseViewActionsMenuProps) {
|
|
|
23
26
|
|
|
24
27
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
25
28
|
|
|
29
|
+
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
30
|
+
const [snackbarMessage, setSnackbarMessage]: any = useState('');
|
|
31
|
+
|
|
26
32
|
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
27
33
|
setAnchorEl(event.currentTarget);
|
|
28
34
|
};
|
|
@@ -31,17 +37,46 @@ export default function CaseViewActionsMenu(props:CaseViewActionsMenuProps) {
|
|
|
31
37
|
setAnchorEl(null);
|
|
32
38
|
};
|
|
33
39
|
|
|
34
|
-
const arMenuItems:
|
|
40
|
+
const arMenuItems: any[] = [];
|
|
41
|
+
|
|
42
|
+
function showToast(message: string) {
|
|
43
|
+
setSnackbarMessage(message);
|
|
44
|
+
setShowSnackbar(true);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
|
|
48
|
+
if (reason === 'clickaway') {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
setShowSnackbar(false);
|
|
52
|
+
}
|
|
35
53
|
|
|
36
54
|
function _actionMenuActionsClick(data) {
|
|
37
55
|
const actionsAPI = thePConn.getActionsApi();
|
|
38
56
|
const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
|
|
39
57
|
|
|
40
|
-
openLocalAction(data.ID, {
|
|
58
|
+
openLocalAction(data.ID, {
|
|
59
|
+
...data,
|
|
60
|
+
containerName: 'modal',
|
|
61
|
+
type: 'express'
|
|
62
|
+
});
|
|
41
63
|
// after doing the action, close the menu...
|
|
42
64
|
handleClose();
|
|
43
65
|
}
|
|
44
66
|
|
|
67
|
+
function _actionMenuProcessClick(process) {
|
|
68
|
+
const actionsAPI = thePConn.getActionsApi();
|
|
69
|
+
const openProcessAction = actionsAPI.openProcessAction.bind(actionsAPI);
|
|
70
|
+
openProcessAction(process.ID, {
|
|
71
|
+
...process
|
|
72
|
+
})
|
|
73
|
+
.then(() => {})
|
|
74
|
+
.catch(() => {
|
|
75
|
+
showToast(`${process.name} Submit failed!`);
|
|
76
|
+
});
|
|
77
|
+
handleClose();
|
|
78
|
+
}
|
|
79
|
+
|
|
45
80
|
availableActions.forEach(action => {
|
|
46
81
|
arMenuItems.push(
|
|
47
82
|
<MenuItem key={action.ID} onClick={() => _actionMenuActionsClick(action)}>
|
|
@@ -51,23 +86,32 @@ export default function CaseViewActionsMenu(props:CaseViewActionsMenuProps) {
|
|
|
51
86
|
});
|
|
52
87
|
|
|
53
88
|
availableProcesses.forEach(process => {
|
|
54
|
-
arMenuItems.push(
|
|
89
|
+
arMenuItems.push(
|
|
90
|
+
<MenuItem key={process.ID} onClick={() => _actionMenuProcessClick(process)}>
|
|
91
|
+
{localizedVal(process.name, '', localeKey)}
|
|
92
|
+
</MenuItem>
|
|
93
|
+
);
|
|
55
94
|
});
|
|
56
95
|
|
|
57
96
|
return (
|
|
58
|
-
|
|
97
|
+
<>
|
|
59
98
|
<Button aria-controls='simple-menu' aria-haspopup='true' onClick={handleClick}>
|
|
60
99
|
{localizedVal('Actions...', localeCategory)}
|
|
61
100
|
</Button>
|
|
62
|
-
<Menu
|
|
63
|
-
id='simple-menu'
|
|
64
|
-
anchorEl={anchorEl}
|
|
65
|
-
keepMounted
|
|
66
|
-
open={Boolean(anchorEl)}
|
|
67
|
-
onClose={handleClose}
|
|
68
|
-
>
|
|
101
|
+
<Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
|
|
69
102
|
{arMenuItems}
|
|
70
103
|
</Menu>
|
|
71
|
-
|
|
104
|
+
<Snackbar
|
|
105
|
+
open={showSnackbar}
|
|
106
|
+
autoHideDuration={3000}
|
|
107
|
+
onClose={handleSnackbarClose}
|
|
108
|
+
message={snackbarMessage}
|
|
109
|
+
action={
|
|
110
|
+
<IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
|
|
111
|
+
<CloseIcon fontSize='small' />
|
|
112
|
+
</IconButton>
|
|
113
|
+
}
|
|
114
|
+
/>
|
|
115
|
+
</>
|
|
72
116
|
);
|
|
73
117
|
}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
/* eslint-disable no-unused-vars */
|
|
3
1
|
/* eslint-disable no-nested-ternary */
|
|
4
|
-
import
|
|
2
|
+
import { PropsWithChildren, useState } from 'react';
|
|
5
3
|
import { Button, Card, makeStyles } from '@material-ui/core';
|
|
4
|
+
|
|
6
5
|
import { getToDoAssignments } from '@pega/react-sdk-components/lib/components/infra/Containers/FlowContainer/helpers';
|
|
7
6
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
8
|
-
|
|
9
|
-
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
10
|
-
|
|
11
|
-
// Confirmation does NOT have getPConnect. So, no need to extend from PConnProps
|
|
7
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
12
8
|
|
|
13
9
|
interface ConfirmationProps extends PConnProps {
|
|
14
10
|
// If any, enter additional props that only exist on this component
|
|
15
|
-
children: Array<any>;
|
|
16
11
|
datasource: { source: any };
|
|
17
12
|
label: string;
|
|
18
13
|
showLabel: boolean;
|
|
19
14
|
showTasks: boolean;
|
|
20
15
|
}
|
|
21
16
|
|
|
22
|
-
const useStyles = makeStyles(
|
|
17
|
+
const useStyles = makeStyles(theme => ({
|
|
23
18
|
root: {
|
|
24
19
|
paddingRight: theme.spacing(1),
|
|
25
20
|
paddingLeft: theme.spacing(1),
|
|
@@ -32,7 +27,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
32
27
|
}
|
|
33
28
|
}));
|
|
34
29
|
|
|
35
|
-
export default function Confirmation(props: ConfirmationProps) {
|
|
30
|
+
export default function Confirmation(props: PropsWithChildren<ConfirmationProps>) {
|
|
36
31
|
// Get emitted components from map (so we can get any override that may exist)
|
|
37
32
|
const ToDo = getComponentFromMap('Todo'); // NOTE: ConstellationJS Engine uses "Todo" and not "ToDo"!!!
|
|
38
33
|
const Details = getComponentFromMap('Details');
|
|
@@ -40,11 +35,11 @@ export default function Confirmation(props: ConfirmationProps) {
|
|
|
40
35
|
const classes = useStyles();
|
|
41
36
|
const CONSTS = PCore.getConstants();
|
|
42
37
|
const [showConfirmView, setShowConfirmView] = useState(true);
|
|
43
|
-
const { showTasks, getPConnect
|
|
38
|
+
const { showTasks, getPConnect } = props;
|
|
44
39
|
// Get the inherited props from the parent to determine label settings
|
|
45
40
|
// Not using whatsNext at the moment, need to figure out the use of it
|
|
46
|
-
const whatsNext = datasource?.source;
|
|
47
|
-
const items = whatsNext.length > 0 ? whatsNext.map(
|
|
41
|
+
// const whatsNext = datasource?.source;
|
|
42
|
+
// const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
|
|
48
43
|
const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget());
|
|
49
44
|
const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), activeContainerItemID);
|
|
50
45
|
const onConfirmViewClose = () => {
|
|
@@ -57,22 +52,22 @@ export default function Confirmation(props: ConfirmationProps) {
|
|
|
57
52
|
const showDetails = detailProps?.children?.[0]?.props?.getPConnect()?.getChildren()?.length > 0;
|
|
58
53
|
return showConfirmView ? (
|
|
59
54
|
<Card className={classes.root}>
|
|
60
|
-
<h2 id=
|
|
55
|
+
<h2 id='confirm-label'>{props.showLabel ? props.label : ''}</h2>
|
|
61
56
|
{showDetails ? <Details {...detailProps} /> : undefined}
|
|
62
57
|
{showTasks ? (
|
|
63
58
|
toDoList && toDoList.length > 0 ? (
|
|
64
|
-
<ToDo {...todoProps} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText=
|
|
59
|
+
<ToDo {...todoProps} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText='Open Tasks' isConfirm />
|
|
65
60
|
) : undefined
|
|
66
61
|
) : undefined}
|
|
67
62
|
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
|
68
|
-
<Button variant=
|
|
63
|
+
<Button variant='contained' color='primary' onClick={onConfirmViewClose}>
|
|
69
64
|
Done
|
|
70
65
|
</Button>
|
|
71
66
|
</div>
|
|
72
67
|
</Card>
|
|
73
68
|
) : toDoList && toDoList.length > 0 ? (
|
|
74
69
|
<Card className={classes.root}>
|
|
75
|
-
<ToDo {...props} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText=
|
|
70
|
+
<ToDo {...props} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText='Tasks' isConfirm />
|
|
76
71
|
</Card>
|
|
77
72
|
) : null;
|
|
78
73
|
}
|