@pega/react-sdk-overrides 0.23.26 → 0.23.28
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 +39 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
- package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
- package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
- package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +29 -19
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +27 -38
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +10 -18
- package/lib/field/Date/Date.tsx +33 -15
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +22 -11
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +64 -17
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +154 -18
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +16 -7
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +37 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +15 -6
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/Percentage/Percentage.tsx +14 -6
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +17 -7
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +96 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +63 -0
- package/lib/field/ScalarList/config-ext.json +7 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -10
- package/lib/field/TextArea/TextArea.tsx +15 -5
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +9 -2
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +41 -10
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +21 -18
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +23 -6
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +52 -58
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
- package/lib/helpers/case-utils.tsx +99 -0
- package/lib/helpers/common-utils.ts +8 -0
- package/lib/helpers/data_page.ts +3 -6
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
- package/lib/helpers/formatters/Boolean.ts +21 -0
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
- package/lib/helpers/formatters/CurrencyMap.ts +915 -0
- package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
- package/lib/helpers/formatters/{common.js → common.ts} +3 -4
- package/lib/helpers/formatters/{index.js → index.ts} +22 -22
- package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
- package/lib/helpers/simpleTableHelpers.ts +65 -85
- package/lib/helpers/state-utils.tsx +43 -0
- package/lib/helpers/template-utils.ts +4 -8
- package/lib/helpers/utils.ts +16 -8
- package/lib/helpers/versionHelpers.ts +1 -5
- package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -84
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
- package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
- 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 +49 -64
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +180 -216
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +28 -43
- package/lib/infra/Reference/Reference.tsx +16 -22
- package/lib/infra/Region/Region.tsx +9 -9
- package/lib/infra/RootContainer/RootContainer.tsx +82 -125
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +38 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
- package/lib/infra/View/View.tsx +32 -63
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +51 -69
- package/lib/template/BannerPage/BannerPage.tsx +26 -33
- package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +122 -114
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
- package/lib/template/Confirmation/Confirmation.tsx +25 -53
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +112 -140
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +24 -28
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
- 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 +79 -0
- package/lib/template/Details/DynamicTabs/config.json +36 -0
- package/lib/template/Details/DynamicTabs/index.tsx +1 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
- package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
- package/lib/template/ListPage/ListPage.tsx +12 -16
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
- package/lib/template/ListView/ListView.tsx +245 -306
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
- package/lib/template/ListView/{utils.js → utils.ts} +202 -91
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
- 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 +17 -19
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
- package/lib/template/SubTabs/SubTabs.tsx +26 -45
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -7
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
- 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 +29 -27
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
- 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 +16 -18
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
- 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 +20 -9
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +75 -4
- package/lib/widget/Attachment/Attachment.tsx +370 -388
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +27 -25
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +15 -4
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +80 -116
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -483
- package/lib/helpers/authManager.js +0 -631
- package/lib/helpers/config_access.js +0 -268
- package/lib/helpers/formatters/Boolean.js +0 -38
- package/lib/helpers/formatters/CurrencyMap.js +0 -908
- package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
|
@@ -1,60 +1,69 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import createPConnectComponent from
|
|
5
|
-
import StoreContext from
|
|
6
|
-
import
|
|
1
|
+
import React, { createElement, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { Box, CircularProgress } from '@material-ui/core';
|
|
3
|
+
|
|
4
|
+
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
5
|
+
import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
|
|
6
|
+
import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
7
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
|
+
|
|
9
|
+
interface ViewContainerProps extends PConnProps {
|
|
10
|
+
// If any, enter additional props that only exist on this component
|
|
11
|
+
name?: string;
|
|
12
|
+
loadingInfo?: any; // can't be boolean until setDispatchObjState expects loadingInfo to be type null
|
|
13
|
+
routingInfo?: any;
|
|
14
|
+
mode?: string;
|
|
15
|
+
limit?: number;
|
|
16
|
+
}
|
|
7
17
|
|
|
8
18
|
// ViewContainer can emit View
|
|
9
19
|
// import View from '../View';
|
|
10
20
|
|
|
11
|
-
declare const PCore;
|
|
12
|
-
|
|
13
21
|
//
|
|
14
22
|
// WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
|
|
15
23
|
// Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
|
|
16
24
|
// is totally at your own risk.
|
|
17
25
|
//
|
|
18
26
|
|
|
19
|
-
|
|
20
|
-
export default function ViewContainer(props) {
|
|
27
|
+
export default function ViewContainer(props: ViewContainerProps) {
|
|
21
28
|
// const { getPConnect, children, routingInfo, name } = props;
|
|
22
|
-
const { getPConnect, name, mode, limit, loadingInfo, routingInfo } = props;
|
|
23
|
-
|
|
24
|
-
const { displayOnlyFA } = useContext(StoreContext);
|
|
29
|
+
const { getPConnect, name = '', mode = 'single', limit = 16, loadingInfo = false, routingInfo = null } = props;
|
|
25
30
|
|
|
31
|
+
const { displayOnlyFA } = useContext<any>(StoreContext);
|
|
26
32
|
|
|
27
33
|
const { CONTAINER_TYPE, APP } = PCore.getConstants();
|
|
28
34
|
const pConn = getPConnect();
|
|
29
35
|
const containerMgr: any = pConn.getContainerManager();
|
|
30
36
|
|
|
31
37
|
const [dispatchObjState, setDispatchObjState] = useState({
|
|
32
|
-
dispatchObject: {semanticURL:
|
|
38
|
+
dispatchObject: { semanticURL: '', context: '', acName: '' },
|
|
33
39
|
visible: false,
|
|
34
40
|
loadingInfo: null,
|
|
35
41
|
isLoadingInfoChange: false
|
|
36
|
-
});
|
|
42
|
+
}); // was this.state in class-based ViewContainer avoiding use of just "state" as the name
|
|
37
43
|
|
|
38
44
|
let root;
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
const thePConn = ((typeof getPConnect) === 'function') ? getPConnect() : null;
|
|
46
|
+
const thePConn = typeof getPConnect === 'function' ? getPConnect() : null;
|
|
42
47
|
|
|
43
48
|
// beginning of functions for use by ViewContainer
|
|
44
49
|
|
|
45
50
|
function buildName() {
|
|
46
|
-
const context = thePConn
|
|
51
|
+
const context = thePConn?.getContextName();
|
|
47
52
|
let viewContainerName = name;
|
|
48
|
-
if (!viewContainerName) viewContainerName =
|
|
49
|
-
return `${context
|
|
53
|
+
if (!viewContainerName) viewContainerName = '';
|
|
54
|
+
return `${context?.toUpperCase()}/${viewContainerName.toUpperCase()}`;
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
function prepareDispatchObject() {
|
|
53
58
|
const baseContext = pConn.getContextName();
|
|
54
|
-
const { acName = "primary" } = pConn.getContainerName();
|
|
59
|
+
// const { acName = "primary" } = pConn.getContainerName(); // doesn't work with 8.23 typings
|
|
60
|
+
let acName = pConn.getContainerName();
|
|
61
|
+
if (!acName) {
|
|
62
|
+
acName = 'primary';
|
|
63
|
+
}
|
|
55
64
|
|
|
56
65
|
return {
|
|
57
|
-
semanticURL:
|
|
66
|
+
semanticURL: '',
|
|
58
67
|
context: baseContext,
|
|
59
68
|
acName
|
|
60
69
|
};
|
|
@@ -72,7 +81,6 @@ export default function ViewContainer(props) {
|
|
|
72
81
|
|
|
73
82
|
// set the root component that is retrieved by PConnectHOC
|
|
74
83
|
function setRootComponent(configObject) {
|
|
75
|
-
|
|
76
84
|
const { isLoadingInfoChange } = dispatchObjState;
|
|
77
85
|
if (!isLoadingInfoChange) {
|
|
78
86
|
root = createElement(createPConnectComponent(), configObject);
|
|
@@ -83,13 +91,9 @@ export default function ViewContainer(props) {
|
|
|
83
91
|
|
|
84
92
|
// useEffect on [] -> code that should be run once (as in old constructor and in componentDidMount)
|
|
85
93
|
useEffect(() => {
|
|
86
|
-
|
|
87
94
|
// This is adapted from the class-based ViewContainer constructor
|
|
88
95
|
containerMgr.initializeContainers({
|
|
89
|
-
type:
|
|
90
|
-
mode === CONTAINER_TYPE.MULTIPLE
|
|
91
|
-
? CONTAINER_TYPE.MULTIPLE
|
|
92
|
-
: CONTAINER_TYPE.SINGLE
|
|
96
|
+
type: mode === CONTAINER_TYPE.MULTIPLE ? CONTAINER_TYPE.MULTIPLE : CONTAINER_TYPE.SINGLE
|
|
93
97
|
});
|
|
94
98
|
|
|
95
99
|
if (mode === CONTAINER_TYPE.MULTIPLE && limit) {
|
|
@@ -98,7 +102,7 @@ export default function ViewContainer(props) {
|
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
const dispatchObject = prepareDispatchObject();
|
|
101
|
-
setDispatchObjState(
|
|
105
|
+
setDispatchObjState({
|
|
102
106
|
dispatchObject,
|
|
103
107
|
// PCore is defined in pxBootstrapShell - eventually will be exported in place of constellationCore
|
|
104
108
|
visible: !PCore.checkIfSemanticURL(),
|
|
@@ -119,9 +123,8 @@ export default function ViewContainer(props) {
|
|
|
119
123
|
}
|
|
120
124
|
|
|
121
125
|
// Getting default view label
|
|
122
|
-
const navPages = pConn.getValue(
|
|
123
|
-
const defaultViewLabel =
|
|
124
|
-
Array.isArray(navPages) && navPages[0] ? navPages[0].pyLabel : "";
|
|
126
|
+
const navPages = pConn.getValue('pyPortal.pyPrimaryNavPages', ''); // 2nd arg empty string until typedefs allow optional
|
|
127
|
+
const defaultViewLabel = Array.isArray(navPages) && navPages[0] ? navPages[0].pyLabel : '';
|
|
125
128
|
// TODO: Plan is to rename window.constellationCore to window.pega (or similar)
|
|
126
129
|
// And expose less via ui-bootstrap.js
|
|
127
130
|
// PCore is defined in pxBootstrapShell - eventually will be exported in place of constellationCore
|
|
@@ -132,11 +135,8 @@ export default function ViewContainer(props) {
|
|
|
132
135
|
...objectForAddContainer,
|
|
133
136
|
defaultViewLabel
|
|
134
137
|
});
|
|
135
|
-
|
|
136
138
|
}
|
|
137
|
-
|
|
138
|
-
},
|
|
139
|
-
[]);
|
|
139
|
+
}, []);
|
|
140
140
|
|
|
141
141
|
// This code (that's run every time the ViewContainer is called) is adapted from the class-based ViewContainer's render
|
|
142
142
|
|
|
@@ -154,11 +154,7 @@ export default function ViewContainer(props) {
|
|
|
154
154
|
let componentVisible = accessedOrder.length > 0;
|
|
155
155
|
const { visible } = dispatchObjState;
|
|
156
156
|
componentVisible = visible || componentVisible;
|
|
157
|
-
if (
|
|
158
|
-
items[key] &&
|
|
159
|
-
items[key].view &&
|
|
160
|
-
!Utils.isEmptyObject(items[key].view)
|
|
161
|
-
) {
|
|
157
|
+
if (items[key] && items[key].view && !isEmptyObject(items[key].view)) {
|
|
162
158
|
const latestItem = items[key];
|
|
163
159
|
const rootView = latestItem.view;
|
|
164
160
|
const { context, name: viewName } = rootView.config;
|
|
@@ -170,18 +166,22 @@ export default function ViewContainer(props) {
|
|
|
170
166
|
containerItemName: key,
|
|
171
167
|
hasForm: viewName === CREATE_DETAILS_VIEW_NAME
|
|
172
168
|
};
|
|
173
|
-
const configObject = PCore.createPConnect(config);
|
|
169
|
+
const configObject: any = PCore.createPConnect(config);
|
|
174
170
|
|
|
175
171
|
// Add in displayOnlyFA if prop is on ViewContainer
|
|
176
172
|
if (displayOnlyFA) {
|
|
177
|
-
configObject
|
|
173
|
+
configObject.displayOnlyFA = true;
|
|
178
174
|
}
|
|
179
175
|
|
|
180
176
|
setRootComponent(configObject);
|
|
181
177
|
return (
|
|
182
178
|
<React.Fragment key={theBuildName}>
|
|
183
179
|
{componentVisible && root}
|
|
184
|
-
{loadingInfo &&
|
|
180
|
+
{loadingInfo && (
|
|
181
|
+
<Box textAlign='center'>
|
|
182
|
+
<CircularProgress />
|
|
183
|
+
</Box>
|
|
184
|
+
)}
|
|
185
185
|
</React.Fragment>
|
|
186
186
|
);
|
|
187
187
|
}
|
|
@@ -191,26 +191,11 @@ export default function ViewContainer(props) {
|
|
|
191
191
|
// fall through return if insufficient routingInfo
|
|
192
192
|
return (
|
|
193
193
|
<React.Fragment key={theBuildName}>
|
|
194
|
-
{loadingInfo &&
|
|
194
|
+
{loadingInfo && (
|
|
195
|
+
<Box textAlign='center'>
|
|
196
|
+
<CircularProgress />
|
|
197
|
+
</Box>
|
|
198
|
+
)}
|
|
195
199
|
</React.Fragment>
|
|
196
200
|
);
|
|
197
|
-
|
|
198
201
|
}
|
|
199
|
-
|
|
200
|
-
ViewContainer.defaultProps = {
|
|
201
|
-
getPConnect: null,
|
|
202
|
-
name: "",
|
|
203
|
-
loadingInfo: false,
|
|
204
|
-
routingInfo: null,
|
|
205
|
-
mode: "single",
|
|
206
|
-
limit: 16
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
ViewContainer.propTypes = {
|
|
210
|
-
getPConnect: PropTypes.func,
|
|
211
|
-
name: PropTypes.string,
|
|
212
|
-
loadingInfo: PropTypes.bool,
|
|
213
|
-
routingInfo: PropTypes.objectOf(PropTypes.any),
|
|
214
|
-
mode: PropTypes.string,
|
|
215
|
-
limit: PropTypes.number
|
|
216
|
-
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
2
|
+
export const isContainerInitialized = pConnect => {
|
|
3
|
+
const context = pConnect.getContextName();
|
|
4
|
+
const containerName = pConnect.getContainerName();
|
|
5
|
+
return PCore.getContainerUtils().isContainerInitialized(context, containerName);
|
|
6
|
+
};
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
/* eslint-disable no-shadow */
|
|
2
1
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
3
2
|
/* eslint-disable operator-assignment */
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
3
|
+
import { forwardRef, PropsWithChildren, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { TextField } from '@material-ui/core';
|
|
6
5
|
import { v4 as uuidv4 } from 'uuid';
|
|
7
6
|
import { debounce } from 'throttle-debounce';
|
|
8
|
-
import { createFilter, combineFilters, getFormattedDate } from './filterUtils';
|
|
9
|
-
import { getFilterExpression } from './filterUtils';
|
|
10
|
-
import { TextField } from '@material-ui/core';
|
|
11
|
-
import React from 'react';
|
|
12
7
|
import DatePicker from 'react-datepicker';
|
|
8
|
+
|
|
9
|
+
import { createFilter, combineFilters, getFormattedDate, getFilterExpression } from './filterUtils';
|
|
10
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
11
|
+
|
|
13
12
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
interface DashboardFilterProps extends PConnProps {
|
|
15
|
+
// If any, enter additional props that only exist on this component
|
|
16
|
+
name: string;
|
|
17
|
+
filterProp: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
metadata?: any;
|
|
20
|
+
}
|
|
16
21
|
|
|
17
|
-
export default function DashboardFilter(props) {
|
|
18
|
-
const { children, name, filterProp, type, metadata, getPConnect } = props;
|
|
22
|
+
export default function DashboardFilter(props: PropsWithChildren<DashboardFilterProps>) {
|
|
23
|
+
const { children = [], name, filterProp, type = '', metadata = null, getPConnect } = props;
|
|
19
24
|
const { current: filterId } = useRef(uuidv4());
|
|
20
25
|
|
|
21
26
|
const [startDate, setStartDate] = useState(null);
|
|
@@ -64,10 +69,7 @@ export default function DashboardFilter(props) {
|
|
|
64
69
|
filterExpression: getFilterExpression(filterValue, name, metadata)
|
|
65
70
|
};
|
|
66
71
|
|
|
67
|
-
PCore.getPubSubUtils().publish(
|
|
68
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
69
|
-
filterData
|
|
70
|
-
);
|
|
72
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE, filterData);
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
const fireFilterChangeDebounced = debounce(500, fireFilterChange);
|
|
@@ -87,10 +89,7 @@ export default function DashboardFilter(props) {
|
|
|
87
89
|
filterId,
|
|
88
90
|
filterExpression: combineFilters([startFilter, endFilter], null)
|
|
89
91
|
};
|
|
90
|
-
PCore.getPubSubUtils().publish(
|
|
91
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
92
|
-
filterData
|
|
93
|
-
);
|
|
92
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE, filterData);
|
|
94
93
|
}
|
|
95
94
|
};
|
|
96
95
|
|
|
@@ -98,7 +97,7 @@ export default function DashboardFilter(props) {
|
|
|
98
97
|
metadata.config.onRecordChange = e => {
|
|
99
98
|
fireFilterChange(e.id);
|
|
100
99
|
};
|
|
101
|
-
return getPConnect().createComponent(metadata);
|
|
100
|
+
return getPConnect().createComponent(metadata, '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
|
|
102
101
|
};
|
|
103
102
|
|
|
104
103
|
const onChange = dates => {
|
|
@@ -112,24 +111,15 @@ export default function DashboardFilter(props) {
|
|
|
112
111
|
|
|
113
112
|
const label = metadata.config.label.substring(3);
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
value={value}
|
|
122
|
-
size='small'
|
|
123
|
-
onClick={onClick}
|
|
124
|
-
ref={ref}
|
|
125
|
-
>
|
|
126
|
-
{value}
|
|
127
|
-
</TextField>
|
|
128
|
-
)
|
|
129
|
-
);
|
|
114
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
115
|
+
const CustomDateInput = forwardRef<HTMLInputElement, TextProps>(({ value, onClick }, ref: any) => (
|
|
116
|
+
<TextField label={label} variant='outlined' fullWidth value={value} size='small' onClick={onClick} ref={ref}>
|
|
117
|
+
{value}
|
|
118
|
+
</TextField>
|
|
119
|
+
));
|
|
130
120
|
|
|
131
121
|
return (
|
|
132
|
-
|
|
122
|
+
<>
|
|
133
123
|
{type === 'DateTime' && (
|
|
134
124
|
<DatePicker
|
|
135
125
|
onChange={onChange}
|
|
@@ -160,21 +150,6 @@ export default function DashboardFilter(props) {
|
|
|
160
150
|
{children}
|
|
161
151
|
</span>
|
|
162
152
|
)}
|
|
163
|
-
|
|
153
|
+
</>
|
|
164
154
|
);
|
|
165
155
|
}
|
|
166
|
-
|
|
167
|
-
DashboardFilter.defaultProps = {
|
|
168
|
-
children: null,
|
|
169
|
-
type: null,
|
|
170
|
-
metadata: null
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
DashboardFilter.propTypes = {
|
|
174
|
-
getPConnect: PropTypes.func.isRequired,
|
|
175
|
-
children: PropTypes.object,
|
|
176
|
-
name: PropTypes.string.isRequired,
|
|
177
|
-
filterProp: PropTypes.string.isRequired,
|
|
178
|
-
type: PropTypes.string,
|
|
179
|
-
metadata: PropTypes.objectOf(PropTypes.any)
|
|
180
|
-
};
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
/** This file contains various utility methods to generate filter components, regionLayout data, filter expressions, etc. */
|
|
3
3
|
|
|
4
4
|
import { Grid, Link } from '@material-ui/core';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import DashboardFilter from './DashboardFilter';
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
import DashboardFilter from './DashboardFilter';
|
|
9
7
|
|
|
10
8
|
export const createFilter = (value, fieldId, comparator = 'EQ') => {
|
|
11
9
|
return {
|
|
@@ -46,11 +44,9 @@ export const createFilterComponent = (getPConnect, filterMeta, index) => {
|
|
|
46
44
|
if (name.indexOf('.') !== -1) {
|
|
47
45
|
cleanedName = name.substring(name.indexOf('.') + 1);
|
|
48
46
|
}
|
|
49
|
-
let propInfo = PCore.getMetadataUtils().getPropertyMetadata(
|
|
50
|
-
cleanedName,
|
|
51
|
-
filterMeta.config.ruleClass
|
|
52
|
-
);
|
|
47
|
+
let propInfo: any = PCore.getMetadataUtils().getPropertyMetadata(cleanedName, filterMeta.config.ruleClass);
|
|
53
48
|
if (!propInfo) {
|
|
49
|
+
// @ts-ignore - PCore.getMetadataUtils().getPropertyMetadata - An argument for 'currentClassID' was not provided.
|
|
54
50
|
propInfo = PCore.getMetadataUtils().getPropertyMetadata(cleanedName);
|
|
55
51
|
}
|
|
56
52
|
const { type: propertyType } = propInfo || { type: 'Text' };
|
|
@@ -60,16 +56,7 @@ export const createFilterComponent = (getPConnect, filterMeta, index) => {
|
|
|
60
56
|
const type = filterType || filterMeta.type;
|
|
61
57
|
const filterProp = `.pyDashboardFilter${index}`;
|
|
62
58
|
if (type === 'DateTime') {
|
|
63
|
-
return
|
|
64
|
-
<DashboardFilter
|
|
65
|
-
key={name}
|
|
66
|
-
getPConnect={getPConnect}
|
|
67
|
-
name={name}
|
|
68
|
-
filterProp={filterProp}
|
|
69
|
-
metadata={filterMeta}
|
|
70
|
-
type={filterMeta.type}
|
|
71
|
-
></DashboardFilter>
|
|
72
|
-
);
|
|
59
|
+
return <DashboardFilter key={name} getPConnect={getPConnect} name={name} filterProp={filterProp} metadata={filterMeta} type={filterMeta.type} />;
|
|
73
60
|
}
|
|
74
61
|
if (datasource && datasource.fields) {
|
|
75
62
|
datasource.fields.key = datasource.fields.value;
|
|
@@ -81,32 +68,22 @@ export const createFilterComponent = (getPConnect, filterMeta, index) => {
|
|
|
81
68
|
filterMeta.type = filterMeta.config.displayAs || type;
|
|
82
69
|
filterMeta.config.placeholder = 'ALL';
|
|
83
70
|
return (
|
|
84
|
-
<DashboardFilter
|
|
85
|
-
|
|
86
|
-
getPConnect={getPConnect}
|
|
87
|
-
name={name}
|
|
88
|
-
filterProp={filterProp}
|
|
89
|
-
metadata={filterMeta}
|
|
90
|
-
type={filterMeta.type}
|
|
91
|
-
>
|
|
92
|
-
{getPConnect().createComponent(filterMeta)}
|
|
71
|
+
<DashboardFilter key={name} getPConnect={getPConnect} name={name} filterProp={filterProp} metadata={filterMeta} type={filterMeta.type}>
|
|
72
|
+
{getPConnect().createComponent(filterMeta, '', '', {})}
|
|
93
73
|
</DashboardFilter>
|
|
94
74
|
);
|
|
95
75
|
};
|
|
96
76
|
|
|
97
77
|
export const buildFilterComponents = (getPConnect, allFilters) => {
|
|
98
|
-
const filterComponents = allFilters.children.map((filter, index) =>
|
|
99
|
-
createFilterComponent(getPConnect, filter, index)
|
|
100
|
-
);
|
|
78
|
+
const filterComponents = allFilters.children.map((filter, index) => createFilterComponent(getPConnect, filter, index));
|
|
101
79
|
if (filterComponents && filterComponents.length > 0) {
|
|
102
80
|
filterComponents.push(
|
|
103
81
|
<Grid>
|
|
104
82
|
<Link
|
|
105
83
|
style={{ cursor: 'pointer' }}
|
|
106
84
|
onClick={() => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
);
|
|
85
|
+
// @ts-ignore - second parameter “payload” for publish method should be optional
|
|
86
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL);
|
|
110
87
|
}}
|
|
111
88
|
>
|
|
112
89
|
Clear All
|
|
@@ -134,7 +111,7 @@ export const getFilterExpression = (filterValue, name, metadata) => {
|
|
|
134
111
|
if (metadata.config.filterType && metadata.config.filterType === 'RelativeDates') {
|
|
135
112
|
const fieldSource = metadata.config.datasource.filter(source => source.key === filterValue)[0];
|
|
136
113
|
const relativeDateExpression = JSON.parse(fieldSource.json);
|
|
137
|
-
// eslint-disable-next-line
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
138
115
|
const fields = [
|
|
139
116
|
{
|
|
140
117
|
name: relativeDateExpression.condition.lhs.field,
|
|
@@ -165,9 +142,7 @@ export function getLayoutDataFromRegion(regionData) {
|
|
|
165
142
|
const itemPConnect = item?.getPConnect();
|
|
166
143
|
|
|
167
144
|
return {
|
|
168
|
-
id: itemPConnect?.getComponentName()
|
|
169
|
-
? `${itemPConnect.getComponentName()}--${index}`
|
|
170
|
-
: `item--${index}`,
|
|
145
|
+
id: itemPConnect?.getComponentName() ? `${itemPConnect.getComponentName()}--${index}` : `item--${index}`,
|
|
171
146
|
content: itemPConnect?.getComponent(),
|
|
172
147
|
layoutConfig: {
|
|
173
148
|
...defaultLayoutConfig,
|
|
@@ -181,8 +156,5 @@ export const getFormattedDate = date => {
|
|
|
181
156
|
if (!date) {
|
|
182
157
|
return date;
|
|
183
158
|
}
|
|
184
|
-
|
|
185
|
-
'0' + date.getDate()
|
|
186
|
-
).slice(-2)}`;
|
|
187
|
-
return formattedDate;
|
|
159
|
+
return `${date.getFullYear()}-${('0' + (date.getMonth() + 1)).slice(-2)}-${('0' + date.getDate()).slice(-2)}`;
|
|
188
160
|
};
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import { useState, useEffect, createElement } from 'react';
|
|
3
2
|
import { Box, Card, CircularProgress } from '@material-ui/core';
|
|
4
3
|
import { makeStyles } from '@material-ui/core/styles';
|
|
5
4
|
|
|
6
5
|
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
|
+
|
|
9
|
+
interface DeferLoadProps extends PConnProps {
|
|
10
|
+
// If any, enter additional props that only exist on this component
|
|
11
|
+
name: string;
|
|
12
|
+
isChildDeferLoad?: boolean;
|
|
13
|
+
isTab: boolean;
|
|
14
|
+
deferLoadId: string;
|
|
15
|
+
}
|
|
9
16
|
|
|
10
17
|
//
|
|
11
18
|
// WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
|
|
@@ -26,26 +33,25 @@ const useStyles = makeStyles(theme => ({
|
|
|
26
33
|
}
|
|
27
34
|
}));
|
|
28
35
|
|
|
29
|
-
export default function DeferLoad(props) {
|
|
36
|
+
export default function DeferLoad(props: DeferLoadProps) {
|
|
30
37
|
const { getPConnect, name, deferLoadId, isTab } = props;
|
|
31
38
|
const [content, setContent] = useState<any>(null);
|
|
32
39
|
const [isLoading, setLoading] = useState(true);
|
|
33
|
-
const [currentLoadedAssignment, setCurrentLoadedAssignment] = useState(
|
|
40
|
+
const [currentLoadedAssignment, setCurrentLoadedAssignment] = useState('');
|
|
34
41
|
|
|
35
42
|
const classes = useStyles();
|
|
36
43
|
|
|
37
44
|
const pConnect = getPConnect();
|
|
38
45
|
const constants = PCore.getConstants();
|
|
39
46
|
|
|
40
|
-
const theRequestedAssignment = pConnect.getValue(
|
|
41
|
-
if (theRequestedAssignment !== currentLoadedAssignment)
|
|
47
|
+
const theRequestedAssignment = pConnect.getValue(PCore.getConstants().CASE_INFO.ASSIGNMENT_LABEL, ''); // 2nd arg empty string until typedef allows optional
|
|
48
|
+
if (theRequestedAssignment !== currentLoadedAssignment) {
|
|
42
49
|
// console.log(`DeferLoad: currentLoadedAssignment about to change from ${currentLoadedAssignment} to ${theRequestedAssignment}`);
|
|
43
50
|
setCurrentLoadedAssignment(theRequestedAssignment);
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
const { CASE, PAGE, DATA } = constants.RESOURCE_TYPES;
|
|
47
|
-
const loadViewCaseID =
|
|
48
|
-
pConnect.getValue(constants.PZINSKEY) || pConnect.getValue(constants.CASE_INFO.CASE_INFO_ID);
|
|
54
|
+
const loadViewCaseID = pConnect.getValue(constants.PZINSKEY, '') || pConnect.getValue(constants.CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef allows optional
|
|
49
55
|
let containerName;
|
|
50
56
|
let containerItemData;
|
|
51
57
|
const targetName = pConnect.getTarget();
|
|
@@ -62,7 +68,7 @@ export default function DeferLoad(props) {
|
|
|
62
68
|
|
|
63
69
|
const getViewOptions = () => ({
|
|
64
70
|
viewContext: resourceType,
|
|
65
|
-
pageClass: loadViewCaseID ? '' : pConnect.getDataObject().pyPortal.classID,
|
|
71
|
+
pageClass: loadViewCaseID ? '' : (pConnect.getDataObject('') as any).pyPortal.classID, // 2nd arg empty string until typedef allows optional
|
|
66
72
|
container: isContainerPreview ? 'preview' : null,
|
|
67
73
|
containerName: isContainerPreview ? 'preview' : null,
|
|
68
74
|
updateData: isContainerPreview
|
|
@@ -102,16 +108,14 @@ export default function DeferLoad(props) {
|
|
|
102
108
|
// Rendering defer loaded tabs in data context
|
|
103
109
|
if (containerName) {
|
|
104
110
|
const dataContext = PCore.getStoreValue('.dataContext', 'dataInfo', containerName);
|
|
105
|
-
const dataContextParameters = PCore.getStoreValue(
|
|
106
|
-
'.dataContextParameters',
|
|
107
|
-
'dataInfo',
|
|
108
|
-
containerName
|
|
109
|
-
);
|
|
111
|
+
const dataContextParameters = PCore.getStoreValue('.dataContextParameters', 'dataInfo', containerName);
|
|
110
112
|
|
|
111
113
|
getPConnect()
|
|
112
114
|
.getActionsApi()
|
|
113
115
|
.showData(name, dataContext, dataContextParameters, {
|
|
116
|
+
// @ts-ignore - Type 'boolean' is not assignable to type 'string'
|
|
114
117
|
skipSemanticUrl: true,
|
|
118
|
+
// @ts-ignore
|
|
115
119
|
isDeferLoaded: true
|
|
116
120
|
})
|
|
117
121
|
.then(data => {
|
|
@@ -132,7 +136,7 @@ export default function DeferLoad(props) {
|
|
|
132
136
|
} else {
|
|
133
137
|
getPConnect()
|
|
134
138
|
.getActionsApi()
|
|
135
|
-
.refreshCaseView(encodeURI(loadViewCaseID), name)
|
|
139
|
+
.refreshCaseView(encodeURI(loadViewCaseID), name, '') // 3rd arg empty string until typedef allows optional
|
|
136
140
|
.then(data => {
|
|
137
141
|
onResponse(data.root);
|
|
138
142
|
});
|
|
@@ -150,26 +154,13 @@ export default function DeferLoad(props) {
|
|
|
150
154
|
);
|
|
151
155
|
} else {
|
|
152
156
|
deferLoadContent = !isTab ? (
|
|
153
|
-
<div className={classes.root}>
|
|
154
|
-
<React.Fragment>{content}</React.Fragment>
|
|
155
|
-
</div>
|
|
157
|
+
<div className={classes.root}>{content}</div>
|
|
156
158
|
) : (
|
|
157
159
|
<Card id='DeferLoad' className={classes.root}>
|
|
158
|
-
|
|
160
|
+
<>{content}</>
|
|
159
161
|
</Card>
|
|
160
162
|
);
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
return deferLoadContent;
|
|
164
166
|
}
|
|
165
|
-
|
|
166
|
-
DeferLoad.defaultProps = {
|
|
167
|
-
isChildDeferLoad: false
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
DeferLoad.propTypes = {
|
|
171
|
-
getPConnect: PropTypes.func.isRequired,
|
|
172
|
-
name: PropTypes.string.isRequired,
|
|
173
|
-
isChildDeferLoad: PropTypes.bool,
|
|
174
|
-
isTab: PropTypes.bool
|
|
175
|
-
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './DeferLoad';
|
|
1
|
+
export { default } from './DeferLoad';
|
|
@@ -1,59 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import PropTypes from "prop-types";
|
|
1
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
interface ErrorBoundaryProps extends PConnProps {
|
|
4
|
+
// If any, enter additional props that only exist on this component
|
|
5
|
+
isInternalError?: boolean;
|
|
6
|
+
}
|
|
5
7
|
|
|
6
|
-
function ErrorBoundary(props) {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
export default function ErrorBoundary(props: ErrorBoundaryProps) {
|
|
9
|
+
const errorMsg = PCore.getErrorHandler().getGenericFailedMessage();
|
|
10
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
11
|
+
const localeCategory = 'Messages';
|
|
12
|
+
const ERROR_TEXT = localizedVal(errorMsg, localeCategory);
|
|
13
|
+
const WORK_AREA = 'workarea';
|
|
14
|
+
const ERROR_WHILE_RENDERING = 'ERROR_WHILE_RENDERING';
|
|
15
|
+
const { getPConnect, isInternalError = false } = props;
|
|
11
16
|
|
|
12
|
-
const theErrorDiv = <div>{ERROR_TEXT}</div
|
|
17
|
+
const theErrorDiv = <div>{ERROR_TEXT}</div>;
|
|
13
18
|
|
|
14
19
|
if (!getPConnect) {
|
|
15
|
-
return
|
|
16
|
-
theErrorDiv
|
|
17
|
-
);
|
|
20
|
+
return theErrorDiv;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
const pConn = getPConnect();
|
|
21
24
|
|
|
22
25
|
if (!isInternalError) {
|
|
23
26
|
// eslint-disable-next-line no-console
|
|
24
|
-
console.error(`
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
console.error(`
|
|
28
|
+
${localizedVal('Unable to load the component', localeCategory)} ${pConn.getComponentName()}
|
|
29
|
+
${localizedVal('This might be due to the view metadata getting corrupted or the component file missing.', localeCategory)}
|
|
30
|
+
Raw metadata for the component: ${JSON.stringify(pConn.getRawMetadata())}
|
|
31
|
+
`);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
if (pConn.getConfigProps().type ===
|
|
30
|
-
return
|
|
31
|
-
theErrorDiv
|
|
32
|
-
);
|
|
34
|
+
if ((pConn.getConfigProps() as any).type === 'page') {
|
|
35
|
+
return theErrorDiv;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
if (
|
|
36
|
-
pConn.getContainerName() === WORK_AREA ||
|
|
37
|
-
pConn.isInsideList() === true ||
|
|
38
|
-
pConn.getContainerName() === "modal"
|
|
39
|
-
) {
|
|
38
|
+
if (pConn.getContainerName() === WORK_AREA || pConn.isInsideList() === true || pConn.getContainerName() === 'modal') {
|
|
40
39
|
const { publish } = PCore.getPubSubUtils();
|
|
40
|
+
// @ts-ignore - second parameter “payload” for publish method should be optional
|
|
41
41
|
publish(ERROR_WHILE_RENDERING);
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
return
|
|
46
|
-
theErrorDiv
|
|
47
|
-
);
|
|
45
|
+
return theErrorDiv;
|
|
48
46
|
}
|
|
49
|
-
ErrorBoundary.propTypes = {
|
|
50
|
-
getPConnect: PropTypes.func,
|
|
51
|
-
isInternalError: PropTypes.bool
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
ErrorBoundary.defaultProps = {
|
|
55
|
-
getPConnect: null,
|
|
56
|
-
isInternalError: false
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default ErrorBoundary;
|