@pega/dx-component-builder-sdk 0.242.15 → 0.242.17
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/README.md +3 -3
- package/package.json +1 -1
- package/src/constants.js +39 -6
- package/src/tasks/create/templates/Constellation/field/Date/demo.stories.tsx.mustache +0 -16
- package/src/tasks/create/templates/Constellation/field/DateTime/demo.stories.tsx.mustache +0 -17
- package/src/tasks/create/templates/Constellation/field/Decimal/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Decimal-Currency/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/demo.stories.tsx.mustache +9 -20
- package/src/tasks/create/templates/Constellation/field/Picklist/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Picklist-Autocomplete/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Picklist-RadioButtons/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Picklist-RadioButtons/index.tsx.mustache +3 -5
- package/src/tasks/create/templates/Constellation/field/Text/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Text-Email/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Text-Email/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/field/Text-Input/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Text-Paragraph/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Text-Phone/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/field/Text-URL/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/TimeOfDay/demo.stories.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/template/DETAILS/demo.stories.tsx.mustache +10 -0
- package/src/tasks/create/templates/Constellation/template/PAGE/demo.stories.tsx.mustache +0 -13
- package/src/tasks/create/templates/Constellation/widget/CASE/demo.stories.tsx.mustache +10 -32
- package/src/tasks/create/templates/Constellation/widget/CASE/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/widget/PAGE/demo.stories.tsx.mustache +10 -21
- package/src/tasks/create/templates/Constellation/widget/PAGE-CASE/demo.stories.tsx.mustache +10 -22
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.spec.ts.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Date/demo.stories.tsx.mustache +1 -11
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/demo.stories.tsx.mustache +1 -12
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.spec.ts.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/demo.stories.tsx.mustache +1 -15
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.spec.ts.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/demo.stories.tsx.mustache +10 -21
- package/src/tasks/create/templates/SDK-Angular/field/Integer/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Picklist-Autocomplete/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Picklist-RadioButtons/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/template/FORM/demo.stories.tsx.mustache +9 -17
- package/src/tasks/create/templates/SDK-Angular/template/FORM/mock.ts.mustache +19 -1
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/demo.stories.tsx.mustache +7 -16
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/mock.ts.mustache +19 -1
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/demo.stories.tsx.mustache +35 -47
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/demo.stories.tsx.mustache +7 -17
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/demo.stories.tsx.mustache +7 -10
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/demo.stories.tsx.mustache +9 -17
- package/src/tasks/create/templates/SDK-React/field/Date/demo.stories.tsx.mustache +0 -21
- package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +5 -1
- package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.tsx.mustache +0 -21
- package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +13 -5
- package/src/tasks/create/templates/SDK-React/field/Decimal/demo.stories.tsx.mustache +0 -14
- package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +6 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/demo.stories.tsx.mustache +0 -14
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +6 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/demo.stories.tsx.mustache +0 -14
- package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +5 -1
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/demo.stories.tsx.mustache +2 -6
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/field/Integer/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +25 -20
- package/src/tasks/create/templates/SDK-React/field/Picklist-RadioButtons/index.tsx.mustache +1 -4
- package/src/tasks/create/templates/SDK-React/field/Text/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/SDK-React/field/Text-Email/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/SDK-React/field/Text-Input/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/SDK-React/field/Text-Phone/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/SDK-React/field/Text-URL/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/SDK-React/field/TimeOfDay/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/template/DETAILS/demo.stories.tsx.mustache +8 -28
- package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +7 -2
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/demo.stories.tsx.mustache +8 -28
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +7 -2
- package/src/tasks/create/templates/SDK-React/template/FORM/demo.stories.tsx.mustache +10 -16
- package/src/tasks/create/templates/SDK-React/template/FORM-region/index.tsx.mustache +5 -5
- package/src/tasks/create/templates/SDK-React/widget/CASE/demo.stories.tsx.mustache +10 -20
- package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +2 -1
- package/src/tasks/create/templates/SDK-React/widget/PAGE/demo.stories.tsx.mustache +9 -19
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.tsx.mustache +10 -20
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyRadioButtons/index.tsx +3 -5
- package/tests/assets/sdk-r/components/create/custom-sdk/field/Pega_DXIL_MyTestText/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/create/override-sdk/designSystemExtension/FieldValueList/FieldValueList.tsx +2 -2
- package/tests/assets/sdk-r/components/create/override-sdk/field/Phone/Phone.tsx +5 -5
- package/tests/assets/sdk-r/components/create/override-sdk/infra/FlowContainer/FlowContainer.tsx +360 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/FlowContainer/helpers.ts +138 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/FlowContainer/index.tsx +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +68 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/ModalViewContainer/ModalViewContainer.tsx +345 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/ModalViewContainer/index.tsx +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/NavBar/NavBar.css +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/Reference/Reference.tsx +52 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/Reference/index.tsx +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/Region/Region.tsx +17 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/Region/index.tsx +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/RootContainer/RootContainer.tsx +240 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/RootContainer/index.tsx +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/SimpleView/SimpleView.tsx +48 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/SimpleView/helper.ts +125 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/SimpleView/index.tsx +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/ViewContainer/ViewContainer.tsx +201 -0
- package/tests/assets/sdk-r/components/create/override-sdk/infra/ViewContainer/index.tsx +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/template/DynamicTabs/DynamicTabs.tsx +80 -0
- package/tests/assets/sdk-r/components/create/override-sdk/template/DynamicTabs/config.json +36 -0
- package/tests/assets/sdk-r/components/create/override-sdk/template/DynamicTabs/index.tsx +1 -0
- package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/ListView.tsx +29 -28
- package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +13 -5
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyRadiobuttons/index.tsx +3 -5
- package/tests/assets/sdk-r/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/index.tsx +2 -2
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/index.tsx +6 -1
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDate/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDate/index.tsx +5 -1
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/index.tsx +13 -5
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDecimal/index.tsx +6 -1
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyEmail/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyIconButtonURL/index.tsx +1 -1
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyInteger/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyParagraph/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/index.tsx +5 -1
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPhone/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPhone/index.tsx +5 -5
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPicklist/index.tsx +25 -20
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyRadiobuttons/index.tsx +1 -4
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyText/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTextInput/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTimeOfDay/index.tsx +1 -1
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyURL/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyDetails/index.tsx +7 -2
- package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnDetails/index.tsx +7 -2
- package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +28 -13
- package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnForm/index.tsx +5 -5
- package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyCaseWidget/index.tsx +2 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/designSystemExtension/FieldValueList/FieldValueList.tsx +2 -2
- package/tests/assets/sdk-r/components/createAll/override-sdk/field/Phone/Phone.tsx +5 -5
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/FlowContainer/FlowContainer.tsx +360 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/FlowContainer/helpers.ts +138 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/FlowContainer/index.tsx +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +68 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ModalViewContainer/ModalViewContainer.tsx +345 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ModalViewContainer/index.tsx +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/NavBar/NavBar.css +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Reference/Reference.tsx +52 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Reference/index.tsx +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Region/Region.tsx +17 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Region/index.tsx +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/RootContainer/RootContainer.tsx +240 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/RootContainer/index.tsx +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/SimpleView/SimpleView.tsx +48 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/SimpleView/helper.ts +125 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/SimpleView/index.tsx +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ViewContainer/ViewContainer.tsx +201 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ViewContainer/index.tsx +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/DynamicTabs/DynamicTabs.tsx +80 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/DynamicTabs/config.json +36 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/DynamicTabs/index.tsx +1 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/ListView.tsx +29 -28
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +13 -5
package/tests/assets/sdk-r/components/create/override-sdk/infra/RootContainer/RootContainer.tsx
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { Children, createElement, PropsWithChildren, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { Box, CircularProgress } from '@mui/material';
|
|
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 { LazyMap as LazyComponentMap } from '@pega/react-sdk-components/lib/components_map';
|
|
7
|
+
import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
8
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
|
+
|
|
10
|
+
interface RootContainerProps extends PConnProps {
|
|
11
|
+
// If any, enter additional props that only exist on this component
|
|
12
|
+
renderingMode?: string;
|
|
13
|
+
routingInfo: { type: string; accessedOrder: any[]; items: any };
|
|
14
|
+
skeleton: any;
|
|
15
|
+
httpMessages: any[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//
|
|
19
|
+
// WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
|
|
20
|
+
// Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
|
|
21
|
+
// is totally at your own risk.
|
|
22
|
+
//
|
|
23
|
+
|
|
24
|
+
const renderingModes = ['portal', 'view'];
|
|
25
|
+
|
|
26
|
+
function usePrevious(value) {
|
|
27
|
+
const ref = useRef(null);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
ref.current = value;
|
|
30
|
+
});
|
|
31
|
+
return ref.current;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getItemView(routingInfo, renderingMode) {
|
|
35
|
+
const viewConfigs: any = [];
|
|
36
|
+
if (routingInfo && renderingModes.includes(renderingMode)) {
|
|
37
|
+
const { accessedOrder, items }: { accessedOrder: any; items: any } = routingInfo;
|
|
38
|
+
if (accessedOrder && items) {
|
|
39
|
+
const key = accessedOrder[accessedOrder.length - 1];
|
|
40
|
+
if (items[key] && items[key].view && !isEmptyObject(items[key].view)) {
|
|
41
|
+
viewConfigs.push(items[key]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return viewConfigs;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default function RootContainer(props: PropsWithChildren<RootContainerProps>) {
|
|
49
|
+
const { getPConnect, renderingMode = '', children, skeleton, httpMessages = [], routingInfo } = props;
|
|
50
|
+
|
|
51
|
+
const { displayOnlyFA } = useContext<any>(StoreContext);
|
|
52
|
+
|
|
53
|
+
const pConn = getPConnect();
|
|
54
|
+
|
|
55
|
+
const options = { context: 'app' };
|
|
56
|
+
const rootView = useRef(null);
|
|
57
|
+
|
|
58
|
+
const [componentName, setComponentName] = useState('');
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
// debugging/investigation help
|
|
62
|
+
// console.log(`componentName change: ${componentName} triggering a re-render`);
|
|
63
|
+
}, [componentName]);
|
|
64
|
+
|
|
65
|
+
// debugging/investigation help
|
|
66
|
+
// console.log(`RootContainer props.routingInfo: ${JSON.stringify(routingInfo)}`);
|
|
67
|
+
|
|
68
|
+
let hasBanner = false;
|
|
69
|
+
let banners: any = null;
|
|
70
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
71
|
+
const localeCategory = 'Messages';
|
|
72
|
+
|
|
73
|
+
const messages = httpMessages ? httpMessages.map(msg => localizedVal(msg.message, localeCategory)) : httpMessages;
|
|
74
|
+
|
|
75
|
+
hasBanner = messages && messages.length > 0;
|
|
76
|
+
banners = hasBanner && <div>{localizedVal(`RootContainer: trying to emit Banner with ${messages}`, localeCategory)}</div>;
|
|
77
|
+
|
|
78
|
+
const MemoizedModalViewContainer = useMemo(() => {
|
|
79
|
+
return createElement(
|
|
80
|
+
createPConnectComponent(),
|
|
81
|
+
PCore.createPConnect({
|
|
82
|
+
meta: {
|
|
83
|
+
type: 'ModalViewContainer',
|
|
84
|
+
config: {
|
|
85
|
+
name: 'modal'
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
options
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
}, []);
|
|
92
|
+
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
94
|
+
const MemoizedPreviewViewContainer = useMemo(() => {
|
|
95
|
+
return createElement(
|
|
96
|
+
createPConnectComponent(),
|
|
97
|
+
PCore.createPConnect({
|
|
98
|
+
meta: {
|
|
99
|
+
type: 'PreviewViewContainer',
|
|
100
|
+
config: {
|
|
101
|
+
name: 'preview'
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
options
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
}, []);
|
|
108
|
+
|
|
109
|
+
//
|
|
110
|
+
function getNoPortalContent() {
|
|
111
|
+
let noPortalContent: any;
|
|
112
|
+
|
|
113
|
+
switch (componentName) {
|
|
114
|
+
case 'View':
|
|
115
|
+
noPortalContent = <div>{localizedVal('getNoPortalContent: RootContainer wants to render View in noPortal mode', localeCategory)}</div>;
|
|
116
|
+
break;
|
|
117
|
+
|
|
118
|
+
case 'ViewContainer': {
|
|
119
|
+
const configProps = pConn.getConfigProps();
|
|
120
|
+
const viewContConfig = {
|
|
121
|
+
meta: {
|
|
122
|
+
type: 'ViewContainer',
|
|
123
|
+
config: configProps
|
|
124
|
+
},
|
|
125
|
+
options
|
|
126
|
+
};
|
|
127
|
+
const theViewCont: any = PCore.createPConnect(viewContConfig);
|
|
128
|
+
// Add in displayOnlyFA if prop is on RootContainer
|
|
129
|
+
if (displayOnlyFA) {
|
|
130
|
+
theViewCont.displayOnlyFA = true;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const theViewContainerAsReact = createElement(createPConnectComponent(), theViewCont);
|
|
134
|
+
|
|
135
|
+
noPortalContent = theViewContainerAsReact;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
default:
|
|
140
|
+
noPortalContent = (
|
|
141
|
+
<div>{localizedVal('getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode', localeCategory)}</div>
|
|
142
|
+
);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return noPortalContent;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let rootViewConfig: any = null;
|
|
150
|
+
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
const { containers } = PCore.getStore().getState();
|
|
153
|
+
const items = Object.keys(containers).filter(item => item.includes('root'));
|
|
154
|
+
(PCore.getContainerUtils().getContainerAPI() as any).addContainerItems(items);
|
|
155
|
+
}, [routingInfo]);
|
|
156
|
+
|
|
157
|
+
const items: any = getItemView(routingInfo, renderingMode);
|
|
158
|
+
|
|
159
|
+
if (items.length > 0) {
|
|
160
|
+
rootViewConfig = {
|
|
161
|
+
meta: items[0].view,
|
|
162
|
+
options: {
|
|
163
|
+
context: items[0].context
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
const prevRootConfig = usePrevious(rootViewConfig);
|
|
168
|
+
|
|
169
|
+
if (renderingModes.includes(renderingMode) && messages && routingInfo && routingInfo?.accessedOrder.length === 0) {
|
|
170
|
+
return <div id='root-container'>{banners}</div>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (items.length > 0) {
|
|
174
|
+
const itemView = items[0].view;
|
|
175
|
+
const currentRootConfig = {
|
|
176
|
+
meta: itemView,
|
|
177
|
+
options: {
|
|
178
|
+
context: items[0].context
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
if (!PCore.isDeepEqual(currentRootConfig, prevRootConfig)) {
|
|
183
|
+
rootView.current = createElement(createPConnectComponent(), PCore.createPConnect(currentRootConfig)) as any;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// debugging/investigation help
|
|
187
|
+
// console.log(`rootView.props.getPConnect().getComponentName(): ${rootView.props.getPConnect().getComponentName()}`);
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<div id='ModalManager'>
|
|
191
|
+
{rootView.current}
|
|
192
|
+
{MemoizedModalViewContainer}
|
|
193
|
+
<div id='MemoizedPreviewViewContainer' />
|
|
194
|
+
<div id='ReAuthMessageModal' />
|
|
195
|
+
</div>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
if (renderingMode === 'noPortal') {
|
|
199
|
+
// eslint-disable-next-line no-console
|
|
200
|
+
console.log(`${localizedVal('RootContainer rendering in noPortal mode', localeCategory)}`);
|
|
201
|
+
|
|
202
|
+
const theChildren = pConn.getChildren() as any[];
|
|
203
|
+
if (theChildren && theChildren.length === 1) {
|
|
204
|
+
const localPConn = theChildren[0].getPConnect();
|
|
205
|
+
const localCompName = localPConn.getComponentName();
|
|
206
|
+
if (componentName !== localCompName) {
|
|
207
|
+
setComponentName(localCompName);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return getNoPortalContent();
|
|
212
|
+
}
|
|
213
|
+
if (children && Children.count(children) > 0) {
|
|
214
|
+
return (
|
|
215
|
+
<>
|
|
216
|
+
<div>{localizedVal('RootContainer: Has children. Trying to show ModalManager with children, etc.', localeCategory)}</div>
|
|
217
|
+
{children}
|
|
218
|
+
{MemoizedModalViewContainer}
|
|
219
|
+
</>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
if (skeleton) {
|
|
223
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
224
|
+
const LoadingComponent = LazyComponentMap[skeleton];
|
|
225
|
+
|
|
226
|
+
return (
|
|
227
|
+
<div id='root-container'>
|
|
228
|
+
{/* <div>RootContainer: Trying to show skeleton</div> */}
|
|
229
|
+
<Box textAlign='center'>
|
|
230
|
+
<CircularProgress />
|
|
231
|
+
</Box>
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
return (
|
|
236
|
+
<div id='root-container'>
|
|
237
|
+
<div>{localizedVal('RootContainer: Should be ModalManager, etc.', localeCategory)}</div>
|
|
238
|
+
</div>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './RootContainer';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { getActiveContainerItemID, getActiveContainerRootViewElement, getPConnectOfActiveContainerItem, useContainerInitializer } from './helper';
|
|
4
|
+
|
|
5
|
+
const SimpleViewContainer = props => {
|
|
6
|
+
const { CONTAINER_TYPE } = PCore.getConstants();
|
|
7
|
+
|
|
8
|
+
const { getPConnect, mode = CONTAINER_TYPE.SINGLE, routingInfo: containerInfo, isAssignmentView, options = {} } = props;
|
|
9
|
+
|
|
10
|
+
const rootViewElement = useMemo(() => {
|
|
11
|
+
return getActiveContainerRootViewElement(containerInfo, {
|
|
12
|
+
isAssignmentView,
|
|
13
|
+
parentGetPConnect: getPConnect
|
|
14
|
+
});
|
|
15
|
+
}, [containerInfo, isAssignmentView, getPConnect]);
|
|
16
|
+
|
|
17
|
+
useContainerInitializer(getPConnect, options.mode || mode);
|
|
18
|
+
|
|
19
|
+
return rootViewElement;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const withSimpleViewContainerRenderer =
|
|
23
|
+
(Component, options: any = {}) =>
|
|
24
|
+
props => {
|
|
25
|
+
const { CONTAINER_TYPE } = PCore.getConstants();
|
|
26
|
+
|
|
27
|
+
const { getPConnect, mode = CONTAINER_TYPE.SINGLE, routingInfo: containerInfo, isAssignmentView } = props;
|
|
28
|
+
|
|
29
|
+
const rootViewElement = <SimpleViewContainer {...props} options={options} />;
|
|
30
|
+
const activeContainerItemID = getActiveContainerItemID(containerInfo);
|
|
31
|
+
const getPConnectOfActiveItem = getPConnectOfActiveContainerItem(containerInfo, {
|
|
32
|
+
isAssignmentView,
|
|
33
|
+
parentGetPConnect: getPConnect
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
useContainerInitializer(getPConnect, options.mode || mode);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Component
|
|
40
|
+
{...props}
|
|
41
|
+
rootViewElement={rootViewElement}
|
|
42
|
+
activeContainerItemID={activeContainerItemID}
|
|
43
|
+
getPConnectOfActiveContainerItem={getPConnectOfActiveItem}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default SimpleViewContainer;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useEffect, createElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
4
|
+
import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/helpers';
|
|
5
|
+
|
|
6
|
+
const processRootViewDetails = (rootView, containerItem, options) => {
|
|
7
|
+
const {
|
|
8
|
+
config: { context: viewContext, name: viewName }
|
|
9
|
+
} = rootView;
|
|
10
|
+
const { context: containerContext } = containerItem;
|
|
11
|
+
const { parentGetPConnect } = options;
|
|
12
|
+
let resolvedViewName = viewName;
|
|
13
|
+
let resolvedViewContext = viewContext;
|
|
14
|
+
|
|
15
|
+
const isAnnotedViewName = PCore.getAnnotationUtils().isProperty(viewName);
|
|
16
|
+
const isAnnotedViewContext = PCore.getAnnotationUtils().isProperty(viewContext);
|
|
17
|
+
|
|
18
|
+
// resolving annoted view context
|
|
19
|
+
if (isAnnotedViewContext) {
|
|
20
|
+
const viewContextProperty = PCore.getAnnotationUtils().getPropertyName(viewContext);
|
|
21
|
+
resolvedViewContext = PCore.getStoreValue(
|
|
22
|
+
`.${viewContextProperty}`,
|
|
23
|
+
viewContextProperty.startsWith('.') ? parentGetPConnect().getPageReference() : '',
|
|
24
|
+
containerContext
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!resolvedViewContext) {
|
|
29
|
+
resolvedViewContext = parentGetPConnect().getPageReference();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// resolving annoted view name
|
|
33
|
+
if (isAnnotedViewName) {
|
|
34
|
+
const viewNameProperty = PCore.getAnnotationUtils().getPropertyName(viewName);
|
|
35
|
+
resolvedViewName = PCore.getStoreValue(`.${viewNameProperty}`, resolvedViewContext, containerContext);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Special case where context and viewname are dynamic values
|
|
39
|
+
Use case - split for each shape
|
|
40
|
+
|
|
41
|
+
Ex - (caseInfo.content.SCRequestWorkQueues[1]):context --> .pyViewName:viewName
|
|
42
|
+
*/
|
|
43
|
+
if (isAnnotedViewName && isAnnotedViewContext && resolvedViewName !== '') {
|
|
44
|
+
/* Allow context processor to resolve view and context when both are dynamic */
|
|
45
|
+
resolvedViewName = viewName;
|
|
46
|
+
resolvedViewContext = viewContext;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
viewName: resolvedViewName,
|
|
51
|
+
viewContext: resolvedViewContext
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const getPConnectOfActiveContainerItem = (containerInfo, options) => {
|
|
56
|
+
const { accessedOrder, items } = containerInfo;
|
|
57
|
+
const { isAssignmentView = false, parentGetPConnect } = options;
|
|
58
|
+
const containerName = parentGetPConnect().getContainerName();
|
|
59
|
+
const { CONTAINER_NAMES } = PCore.getContainerUtils();
|
|
60
|
+
const { CREATE_DETAILS_VIEW_NAME } = PCore.getConstants();
|
|
61
|
+
|
|
62
|
+
if (accessedOrder && items) {
|
|
63
|
+
const activeContainerItemKey = accessedOrder[accessedOrder.length - 1];
|
|
64
|
+
|
|
65
|
+
if (items[activeContainerItemKey] && items[activeContainerItemKey].view && Object.keys(items[activeContainerItemKey].view).length > 0) {
|
|
66
|
+
const activeContainerItem = items[activeContainerItemKey];
|
|
67
|
+
const target = activeContainerItemKey.substring(0, activeContainerItemKey.lastIndexOf('_'));
|
|
68
|
+
|
|
69
|
+
const { view: rootView, context } = activeContainerItem;
|
|
70
|
+
const { viewName, viewContext } = processRootViewDetails(rootView, activeContainerItem, { parentGetPConnect });
|
|
71
|
+
|
|
72
|
+
if (!viewName) return null;
|
|
73
|
+
|
|
74
|
+
const config = {
|
|
75
|
+
meta: rootView,
|
|
76
|
+
options: {
|
|
77
|
+
context,
|
|
78
|
+
pageReference: viewContext || parentGetPConnect().getPageReference(),
|
|
79
|
+
containerName,
|
|
80
|
+
containerItemID: activeContainerItemKey,
|
|
81
|
+
parentPageReference: parentGetPConnect().getPageReference(),
|
|
82
|
+
hasForm:
|
|
83
|
+
isAssignmentView ||
|
|
84
|
+
containerName === CONTAINER_NAMES.WORKAREA ||
|
|
85
|
+
containerName === CONTAINER_NAMES.MODAL ||
|
|
86
|
+
viewName === CREATE_DETAILS_VIEW_NAME,
|
|
87
|
+
target
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return PCore.createPConnect(config).getPConnect;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const getActiveContainerRootViewElement = (containerInfo, options) => {
|
|
98
|
+
const getPConnect = getPConnectOfActiveContainerItem(containerInfo, options);
|
|
99
|
+
if (getPConnect) {
|
|
100
|
+
return createElement(createPConnectComponent(), { getPConnect });
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const getActiveContainerItemID = containerInfo => {
|
|
106
|
+
const { accessedOrder } = containerInfo;
|
|
107
|
+
if (accessedOrder && accessedOrder.length > 0) {
|
|
108
|
+
return accessedOrder[accessedOrder.length - 1];
|
|
109
|
+
}
|
|
110
|
+
return '';
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const useContainerInitializer = (getPConnect, mode) => {
|
|
114
|
+
const pConnect = getPConnect();
|
|
115
|
+
const containerName = pConnect.getContainerName();
|
|
116
|
+
const containerManager = pConnect.getContainerManager();
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (!isContainerInitialized(pConnect)) {
|
|
119
|
+
containerManager.initializeContainers({
|
|
120
|
+
type: mode,
|
|
121
|
+
name: containerName
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SimpleView';
|
package/tests/assets/sdk-r/components/create/override-sdk/infra/ViewContainer/ViewContainer.tsx
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React, { createElement, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { Box, CircularProgress } from '@mui/material';
|
|
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
|
+
}
|
|
17
|
+
|
|
18
|
+
// ViewContainer can emit View
|
|
19
|
+
// import View from '../View';
|
|
20
|
+
|
|
21
|
+
//
|
|
22
|
+
// WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
|
|
23
|
+
// Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
|
|
24
|
+
// is totally at your own risk.
|
|
25
|
+
//
|
|
26
|
+
|
|
27
|
+
export default function ViewContainer(props: ViewContainerProps) {
|
|
28
|
+
// const { getPConnect, children, routingInfo, name } = props;
|
|
29
|
+
const { getPConnect, name = '', mode = 'single', limit = 16, loadingInfo = false, routingInfo = null } = props;
|
|
30
|
+
|
|
31
|
+
const { displayOnlyFA } = useContext<any>(StoreContext);
|
|
32
|
+
|
|
33
|
+
const { CONTAINER_TYPE, APP } = PCore.getConstants();
|
|
34
|
+
const pConn = getPConnect();
|
|
35
|
+
const containerMgr: any = pConn.getContainerManager();
|
|
36
|
+
|
|
37
|
+
const [dispatchObjState, setDispatchObjState] = useState({
|
|
38
|
+
dispatchObject: { semanticURL: '', context: '', acName: '' },
|
|
39
|
+
visible: false,
|
|
40
|
+
loadingInfo: null,
|
|
41
|
+
isLoadingInfoChange: false
|
|
42
|
+
}); // was this.state in class-based ViewContainer avoiding use of just "state" as the name
|
|
43
|
+
|
|
44
|
+
let root;
|
|
45
|
+
|
|
46
|
+
const thePConn = typeof getPConnect === 'function' ? getPConnect() : null;
|
|
47
|
+
|
|
48
|
+
// beginning of functions for use by ViewContainer
|
|
49
|
+
|
|
50
|
+
function buildName() {
|
|
51
|
+
const context = thePConn?.getContextName();
|
|
52
|
+
let viewContainerName = name;
|
|
53
|
+
if (!viewContainerName) viewContainerName = '';
|
|
54
|
+
return `${context?.toUpperCase()}/${viewContainerName.toUpperCase()}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function prepareDispatchObject() {
|
|
58
|
+
const baseContext = pConn.getContextName();
|
|
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
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
semanticURL: '',
|
|
67
|
+
context: baseContext,
|
|
68
|
+
acName
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// determine if or not loadingInfo prop changed on next re-render
|
|
73
|
+
// function getDerivedStateFromProps(nextProps, prevState) {
|
|
74
|
+
// const { loadingInfo: prevLoadingInfo } = prevState;
|
|
75
|
+
// const { loadingInfo: nextLoadingIndfo } = nextProps;
|
|
76
|
+
// return {
|
|
77
|
+
// loadingInfo: nextLoadingIndfo,
|
|
78
|
+
// isLoadingInfoChange: prevLoadingInfo !== nextLoadingIndfo
|
|
79
|
+
// };
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
// set the root component that is retrieved by PConnectHOC
|
|
83
|
+
function setRootComponent(configObject) {
|
|
84
|
+
const { isLoadingInfoChange } = dispatchObjState;
|
|
85
|
+
if (!isLoadingInfoChange) {
|
|
86
|
+
root = createElement(createPConnectComponent(), configObject);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// end of functions for use by ViewContainer
|
|
91
|
+
|
|
92
|
+
// useEffect on [] -> code that should be run once (as in old constructor and in componentDidMount)
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
// This is adapted from the class-based ViewContainer constructor
|
|
95
|
+
containerMgr.initializeContainers({
|
|
96
|
+
type: mode === CONTAINER_TYPE.MULTIPLE ? CONTAINER_TYPE.MULTIPLE : CONTAINER_TYPE.SINGLE
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
if (mode === CONTAINER_TYPE.MULTIPLE && limit) {
|
|
100
|
+
/* NOTE: setContainerLimit use is temporary. It is a non-public, unsupported API. */
|
|
101
|
+
PCore.getContainerUtils().setContainerLimit(`${APP.APP}/${name}`, limit);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const dispatchObject = prepareDispatchObject();
|
|
105
|
+
setDispatchObjState({
|
|
106
|
+
dispatchObject,
|
|
107
|
+
// PCore is defined in pxBootstrapShell - eventually will be exported in place of constellationCore
|
|
108
|
+
visible: !PCore.checkIfSemanticURL(),
|
|
109
|
+
loadingInfo,
|
|
110
|
+
isLoadingInfoChange: false
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const { visible } = dispatchObjState;
|
|
114
|
+
if (visible) containerMgr.addContainerItem(dispatchObject);
|
|
115
|
+
|
|
116
|
+
// This is adapted from the class-based ViewContainer componentDidMount
|
|
117
|
+
let objectForAddContainer;
|
|
118
|
+
if (PCore.checkIfSemanticURL()) {
|
|
119
|
+
objectForAddContainer = prepareDispatchObject();
|
|
120
|
+
} else {
|
|
121
|
+
const { dispatchObject: theDispatchObject } = dispatchObjState;
|
|
122
|
+
objectForAddContainer = theDispatchObject;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Getting default view label
|
|
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 : '';
|
|
128
|
+
// TODO: Plan is to rename window.constellationCore to window.pega (or similar)
|
|
129
|
+
// And expose less via ui-bootstrap.js
|
|
130
|
+
// PCore is defined in pxBootstrapShell - eventually will be exported in place of constellationCore
|
|
131
|
+
|
|
132
|
+
if (!displayOnlyFA) {
|
|
133
|
+
// configureForBrowserBookmark not applicable in Embedded mode
|
|
134
|
+
PCore.configureForBrowserBookmark({
|
|
135
|
+
...objectForAddContainer,
|
|
136
|
+
defaultViewLabel
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}, []);
|
|
140
|
+
|
|
141
|
+
// This code (that's run every time the ViewContainer is called) is adapted from the class-based ViewContainer's render
|
|
142
|
+
|
|
143
|
+
// Looking for routingInfo
|
|
144
|
+
|
|
145
|
+
// debugging/investigation help
|
|
146
|
+
// console.log(`ViewContainer props: ${JSON.stringify(props)}`);
|
|
147
|
+
|
|
148
|
+
const theBuildName = buildName();
|
|
149
|
+
const { CREATE_DETAILS_VIEW_NAME } = PCore.getConstants();
|
|
150
|
+
if (routingInfo) {
|
|
151
|
+
const { accessedOrder, items } = routingInfo;
|
|
152
|
+
if (accessedOrder && items) {
|
|
153
|
+
const key = accessedOrder[accessedOrder.length - 1];
|
|
154
|
+
let componentVisible = accessedOrder.length > 0;
|
|
155
|
+
const { visible } = dispatchObjState;
|
|
156
|
+
componentVisible = visible || componentVisible;
|
|
157
|
+
if (items[key] && items[key].view && !isEmptyObject(items[key].view)) {
|
|
158
|
+
const latestItem = items[key];
|
|
159
|
+
const rootView = latestItem.view;
|
|
160
|
+
const { context, name: viewName } = rootView.config;
|
|
161
|
+
const config: any = { meta: rootView };
|
|
162
|
+
config.options = {
|
|
163
|
+
context: latestItem.context,
|
|
164
|
+
pageReference: context || getPConnect().getPageReference(),
|
|
165
|
+
containerName: getPConnect().getContainerName(),
|
|
166
|
+
containerItemName: key,
|
|
167
|
+
hasForm: viewName === CREATE_DETAILS_VIEW_NAME
|
|
168
|
+
};
|
|
169
|
+
const configObject: any = PCore.createPConnect(config);
|
|
170
|
+
|
|
171
|
+
// Add in displayOnlyFA if prop is on ViewContainer
|
|
172
|
+
if (displayOnlyFA) {
|
|
173
|
+
configObject.displayOnlyFA = true;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
setRootComponent(configObject);
|
|
177
|
+
return (
|
|
178
|
+
<React.Fragment key={theBuildName}>
|
|
179
|
+
{componentVisible && root}
|
|
180
|
+
{loadingInfo && (
|
|
181
|
+
<Box textAlign='center'>
|
|
182
|
+
<CircularProgress />
|
|
183
|
+
</Box>
|
|
184
|
+
)}
|
|
185
|
+
</React.Fragment>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// fall through return if insufficient routingInfo
|
|
192
|
+
return (
|
|
193
|
+
<React.Fragment key={theBuildName}>
|
|
194
|
+
{loadingInfo && (
|
|
195
|
+
<Box textAlign='center'>
|
|
196
|
+
<CircularProgress />
|
|
197
|
+
</Box>
|
|
198
|
+
)}
|
|
199
|
+
</React.Fragment>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ViewContainer';
|