@pega/react-sdk-components 0.23.28 → 0.23.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/designSystemExtension/Operator/Operator.d.ts +1 -0
- package/lib/components/designSystemExtension/Operator/Operator.d.ts.map +1 -1
- package/lib/components/designSystemExtension/Operator/Operator.js +4 -3
- package/lib/components/designSystemExtension/Operator/Operator.js.map +1 -1
- package/lib/components/infra/Assignment/Assignment.d.ts.map +1 -1
- package/lib/components/infra/Assignment/Assignment.js +19 -7
- package/lib/components/infra/Assignment/Assignment.js.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/CancelAlert/CancelAlert.d.ts +15 -0
- package/lib/components/infra/Containers/ModalViewContainer/CancelAlert/CancelAlert.d.ts.map +1 -0
- package/lib/components/infra/Containers/ModalViewContainer/CancelAlert/CancelAlert.js +91 -0
- package/lib/components/infra/Containers/ModalViewContainer/CancelAlert/CancelAlert.js.map +1 -0
- package/lib/components/infra/Containers/ModalViewContainer/CancelAlert/index.d.ts.map +1 -0
- package/lib/components/infra/Containers/ModalViewContainer/CancelAlert/index.js.map +1 -0
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.d.ts.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.js +0 -1
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.js.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js +153 -157
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js.map +1 -1
- package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
- package/lib/components/infra/NavBar/NavBar.js +4 -2
- package/lib/components/infra/NavBar/NavBar.js.map +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.d.ts.map +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.js +38 -0
- package/lib/components/template/CaseSummary/CaseSummary.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +10 -14
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
- package/lib/components/template/WssNavBar/WssNavBar.d.ts.map +1 -1
- package/lib/components/template/WssNavBar/WssNavBar.js +3 -1
- package/lib/components/template/WssNavBar/WssNavBar.js.map +1 -1
- package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
- package/lib/components/widget/Attachment/Attachment.js +12 -1
- package/lib/components/widget/Attachment/Attachment.js.map +1 -1
- package/lib/doc/KeyReleaseUpdates.md +14 -0
- package/lib/sdk-pega-component-map.d.ts +1 -1
- package/lib/sdk-pega-component-map.js +1 -1
- package/lib/sdk-pega-component-map.js.map +1 -1
- package/package.json +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.d.ts +0 -10
- package/lib/components/field/CancelAlert/CancelAlert.d.ts.map +0 -1
- package/lib/components/field/CancelAlert/CancelAlert.js +0 -70
- package/lib/components/field/CancelAlert/CancelAlert.js.map +0 -1
- package/lib/components/field/CancelAlert/index.d.ts.map +0 -1
- package/lib/components/field/CancelAlert/index.js.map +0 -1
- /package/lib/components/{field → infra/Containers/ModalViewContainer}/CancelAlert/CancelAlert.css +0 -0
- /package/lib/components/{field → infra/Containers/ModalViewContainer}/CancelAlert/index.d.ts +0 -0
- /package/lib/components/{field → infra/Containers/ModalViewContainer}/CancelAlert/index.js +0 -0
|
@@ -1,40 +1,72 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { createElement, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import isEqual from 'fast-deep-equal';
|
|
4
3
|
import Dialog from '@material-ui/core/Dialog';
|
|
5
4
|
import DialogContent from '@material-ui/core/DialogContent';
|
|
6
5
|
import DialogTitle from '@material-ui/core/DialogTitle';
|
|
7
6
|
import { makeStyles } from '@material-ui/core/styles';
|
|
8
7
|
import { MuiPickersUtilsProvider } from '@material-ui/pickers';
|
|
9
8
|
import DayjsUtils from '@date-io/dayjs';
|
|
9
|
+
import difference from 'lodash.difference';
|
|
10
10
|
import createPConnectComponent from '../../../../bridge/react_pconnect';
|
|
11
11
|
// Need to get correct implementation from component map for Assignment and CancelAlert
|
|
12
12
|
import { getComponentFromMap } from '../../../../bridge/helpers/sdk_component_map';
|
|
13
13
|
import { getBanners } from '../../../helpers/case-utils';
|
|
14
|
-
|
|
14
|
+
function isOpenModalAction(prevModalCollection, currentModalList) {
|
|
15
|
+
return prevModalCollection && currentModalList ? Object.keys(prevModalCollection).length < currentModalList.length : false;
|
|
16
|
+
}
|
|
17
|
+
function isUpdateModalAction(prevModalCollection, currentModalList) {
|
|
18
|
+
return prevModalCollection && currentModalList ? Object.keys(prevModalCollection).length === currentModalList.length : false;
|
|
19
|
+
}
|
|
20
|
+
function isCloseModalAction(prevModalCollection, currentModalList) {
|
|
21
|
+
return prevModalCollection && currentModalList ? Object.keys(prevModalCollection).length > currentModalList.length : false;
|
|
22
|
+
}
|
|
15
23
|
function buildName(pConnect, name = '') {
|
|
16
24
|
const context = pConnect.getContextName();
|
|
17
25
|
return `${context}/${name}`;
|
|
18
26
|
}
|
|
19
|
-
function getKeyAndLatestItem(routinginfo, pConn) {
|
|
27
|
+
function getKeyAndLatestItem(routinginfo, pConn, options) {
|
|
20
28
|
const containerName = pConn.getContainerName();
|
|
29
|
+
const { acTertiary = false } = options || {};
|
|
21
30
|
if (PCore.getContainerUtils().hasContainerItems(buildName(pConn, containerName))) {
|
|
22
31
|
const { accessedOrder, items } = routinginfo;
|
|
23
|
-
|
|
32
|
+
let key;
|
|
33
|
+
// eslint-disable-next-line no-plusplus
|
|
34
|
+
for (let i = accessedOrder.length - 1; i >= 0; i--) {
|
|
35
|
+
const tempkey = accessedOrder[i];
|
|
36
|
+
if ((acTertiary && items[tempkey].acTertiary) || (!acTertiary && !items[tempkey].acTertiary)) {
|
|
37
|
+
key = tempkey;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
24
41
|
const latestItem = items[key];
|
|
25
42
|
return { key, latestItem };
|
|
26
43
|
}
|
|
27
44
|
return {};
|
|
28
45
|
}
|
|
29
|
-
function getConfigObject(item, pConnect) {
|
|
46
|
+
function getConfigObject(item, pConnect, isReverseCoexistence = false) {
|
|
47
|
+
let config;
|
|
48
|
+
if (isReverseCoexistence) {
|
|
49
|
+
config = {
|
|
50
|
+
options: {
|
|
51
|
+
pageReference: pConnect?.getPageReference(),
|
|
52
|
+
hasForm: true,
|
|
53
|
+
containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return PCore.createPConnect(config);
|
|
57
|
+
}
|
|
30
58
|
if (item) {
|
|
31
|
-
const { context, view } = item;
|
|
32
|
-
const
|
|
59
|
+
const { context, view, isBulkAction } = item;
|
|
60
|
+
const target = PCore.getContainerUtils().getTargetFromContainerItemID(context);
|
|
61
|
+
config = {
|
|
33
62
|
meta: view,
|
|
34
63
|
options: {
|
|
35
64
|
context,
|
|
36
65
|
pageReference: view.config.context || pConnect.getPageReference(),
|
|
37
|
-
hasForm: true
|
|
66
|
+
hasForm: true,
|
|
67
|
+
...(isBulkAction && { isBulkAction }),
|
|
68
|
+
containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL,
|
|
69
|
+
target
|
|
38
70
|
}
|
|
39
71
|
};
|
|
40
72
|
return PCore.createPConnect(config);
|
|
@@ -47,20 +79,12 @@ const useStyles = makeStyles(theme => ({
|
|
|
47
79
|
marginRight: theme.spacing(2),
|
|
48
80
|
marginTop: theme.spacing(2),
|
|
49
81
|
marginBottom: theme.spacing(0)
|
|
50
|
-
// paddingLeft: theme.spacing(0),
|
|
51
|
-
// paddingRight: theme.spacing(0),
|
|
52
|
-
// paddingTop: theme.spacing(0),
|
|
53
|
-
// paddingBottom: theme.spacing(0),
|
|
54
82
|
},
|
|
55
83
|
dlgContent: {
|
|
56
84
|
marginLeft: theme.spacing(2),
|
|
57
85
|
marginRight: theme.spacing(2),
|
|
58
86
|
marginTop: theme.spacing(0),
|
|
59
87
|
marginBottom: theme.spacing(2)
|
|
60
|
-
// paddingLeft: theme.spacing(0),
|
|
61
|
-
// paddingRight: theme.spacing(0),
|
|
62
|
-
// paddingTop: theme.spacing(0),
|
|
63
|
-
// paddingBottom: theme.spacing(0),
|
|
64
88
|
}
|
|
65
89
|
}));
|
|
66
90
|
export default function ModalViewContainer(props) {
|
|
@@ -69,60 +93,68 @@ export default function ModalViewContainer(props) {
|
|
|
69
93
|
const CancelAlert = getComponentFromMap('CancelAlert');
|
|
70
94
|
const ListViewActionButtons = getComponentFromMap('ListViewActionButtons');
|
|
71
95
|
const classes = useStyles();
|
|
96
|
+
const modalCollection = useRef({});
|
|
72
97
|
const routingInfoRef = useRef({});
|
|
73
|
-
const { getPConnect, routingInfo = null,
|
|
98
|
+
const { getPConnect, routingInfo = null, pageMessages = [] } = props;
|
|
74
99
|
const pConn = getPConnect();
|
|
100
|
+
const { acTertiary } = pConn.getConfigProps();
|
|
75
101
|
const { CONTAINER_TYPE: { MULTIPLE }, PUB_SUB_EVENTS: { EVENT_SHOW_CANCEL_ALERT } } = PCore.getConstants();
|
|
76
|
-
const { subscribe } = PCore.getPubSubUtils();
|
|
102
|
+
const { subscribe, unsubscribe } = PCore.getPubSubUtils();
|
|
77
103
|
const [bShowModal, setShowModal] = useState(false);
|
|
78
|
-
const [bSubscribed, setSubscribed] = useState(false);
|
|
79
104
|
const [bShowCancelAlert, setShowCancelAlert] = useState(false);
|
|
80
|
-
const [oCaseInfo, setOCaseInfo] = useState({});
|
|
81
105
|
const [createdView, setCreatedView] = useState(null);
|
|
82
106
|
const [title, setTitle] = useState('');
|
|
83
107
|
const [arNewChildrenAsReact, setArNewChildrenAsReact] = useState([]);
|
|
84
108
|
const [itemKey, setItemKey] = useState('');
|
|
85
|
-
const [
|
|
109
|
+
const [cancelAlertProps, setCancelAlertProps] = useState({});
|
|
86
110
|
const [isMultiRecordData, setMultiRecordData] = useState(false);
|
|
87
111
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
88
112
|
const localeCategory = 'Data Object';
|
|
89
|
-
const
|
|
113
|
+
const ERROR_WHILE_RENDERING = 'ERROR_WHILE_RENDERING';
|
|
90
114
|
function showAlert(payload) {
|
|
91
|
-
const { latestItem } = getKeyAndLatestItem(routingInfoRef.current, pConn);
|
|
92
|
-
const
|
|
115
|
+
const { latestItem } = getKeyAndLatestItem(routingInfoRef.current, pConn, { acTertiary });
|
|
116
|
+
const isReverseCoexistence = PCore.getCoexistenceManager().getBroadcastUtils().isReverseCoexistenceCaseLoaded();
|
|
117
|
+
const { isModalAction, hideDelete, isDataObject, skipReleaseLockRequest } = payload;
|
|
93
118
|
/*
|
|
94
119
|
If we are in create stage full page mode, created a new case and trying to click on cancel button
|
|
95
120
|
it will show two alert dialogs which is not expected. Hence isModalAction flag to avoid that.
|
|
96
121
|
*/
|
|
97
|
-
if (latestItem && isModalAction
|
|
98
|
-
const configObject = getConfigObject(latestItem, pConn);
|
|
99
|
-
|
|
122
|
+
if (latestItem && isModalAction) {
|
|
123
|
+
const configObject = getConfigObject(latestItem, pConn, isReverseCoexistence);
|
|
124
|
+
const contextName = configObject?.getPConnect().getContextName();
|
|
125
|
+
setCancelAlertProps({
|
|
126
|
+
heading: 'Discard unsaved changes?',
|
|
127
|
+
content: 'You have unsaved changes. You can discard them or go back to keep working.',
|
|
128
|
+
getPConnect: configObject?.getPConnect,
|
|
129
|
+
itemKey: contextName,
|
|
130
|
+
hideDelete,
|
|
131
|
+
isDataObject,
|
|
132
|
+
skipReleaseLockRequest
|
|
133
|
+
});
|
|
100
134
|
setShowCancelAlert(true);
|
|
101
135
|
}
|
|
102
136
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// if different, save off new case info
|
|
118
|
-
if (bRet) {
|
|
119
|
-
setOCaseInfo(JSON.parse(JSON.stringify(oCurrentCaseInfo)));
|
|
137
|
+
function handleModalOpen(key) {
|
|
138
|
+
modalCollection.current = {
|
|
139
|
+
...modalCollection.current,
|
|
140
|
+
[key]: {}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function handleModalClose(accessedOrder) {
|
|
144
|
+
const tempModalCollection = modalCollection.current;
|
|
145
|
+
const [closedModalKey] = difference(Object.keys(tempModalCollection), accessedOrder);
|
|
146
|
+
if (closedModalKey && tempModalCollection[closedModalKey]) {
|
|
147
|
+
const modifiedModalCollection = { ...tempModalCollection };
|
|
148
|
+
delete modifiedModalCollection[closedModalKey];
|
|
149
|
+
modalCollection.current = modifiedModalCollection;
|
|
150
|
+
setShowModal(false);
|
|
120
151
|
}
|
|
121
|
-
return bRet;
|
|
122
152
|
}
|
|
123
|
-
const
|
|
153
|
+
const dismissCancelAlert = dismissAllModals => {
|
|
124
154
|
setShowCancelAlert(false);
|
|
125
|
-
|
|
155
|
+
if (dismissAllModals) {
|
|
156
|
+
setShowModal(false);
|
|
157
|
+
}
|
|
126
158
|
};
|
|
127
159
|
function getModalHeading(dataObjectAction) {
|
|
128
160
|
return dataObjectAction === PCore.getConstants().RESOURCE_STATUS.CREATE
|
|
@@ -141,128 +173,92 @@ export default function ModalViewContainer(props) {
|
|
|
141
173
|
containerMgr.initializeContainers({ type: MULTIPLE });
|
|
142
174
|
}, [MULTIPLE, pConn]);
|
|
143
175
|
useEffect(() => {
|
|
144
|
-
//
|
|
176
|
+
// Persisting routing information between the renders in showAlert
|
|
145
177
|
routingInfoRef.current = routingInfo;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
//
|
|
183
|
-
//
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
// the React return of React.Fragment does
|
|
189
|
-
// right now need to check caseInfo for changes, to trigger redraw, not getting
|
|
190
|
-
// changes from angularPconnect except for first draw
|
|
191
|
-
if (newComp && caseInfo && compareCaseInfoIsDifferent(caseInfo)) {
|
|
192
|
-
setCreatedView({ configObject, latestItem });
|
|
193
|
-
const { actionName } = latestItem;
|
|
194
|
-
const theNewCaseInfo = newComp.getCaseInfo();
|
|
195
|
-
const caseName = theNewCaseInfo.getName();
|
|
196
|
-
const ID = theNewCaseInfo.getBusinessID() || theNewCaseInfo.getID();
|
|
197
|
-
const caseTypeName = theNewCaseInfo.getCaseTypeName();
|
|
198
|
-
const isDataObject = routingInfo.items[latestItem.context].resourceType === PCore.getConstants().RESOURCE_TYPES.DATA;
|
|
199
|
-
const dataObjectAction = routingInfo.items[latestItem.context].resourceStatus;
|
|
200
|
-
const isMultiRecord = routingInfo.items[latestItem.context].isMultiRecordData;
|
|
201
|
-
setMultiRecordData(isMultiRecord);
|
|
202
|
-
const headingValue = isDataObject || isMultiRecord
|
|
203
|
-
? getModalHeading(dataObjectAction)
|
|
204
|
-
: determineModalHeaderByAction(actionName, caseTypeName, ID, `${theNewCaseInfo?.getClassName()}!CASE!${theNewCaseInfo.getName()}`.toUpperCase());
|
|
205
|
-
setTitle(headingValue);
|
|
206
|
-
let arChildrenAsReact = [];
|
|
207
|
-
if (newComp.getComponentName() === 'reference') {
|
|
208
|
-
// Reference component doesn't have children. It can build the View we want.
|
|
209
|
-
// The Reference component getPConnect is in configObject
|
|
210
|
-
arChildrenAsReact.push(createElement(createPConnectComponent(), {
|
|
211
|
-
...configObject,
|
|
212
|
-
key: `${caseName}-${ID}`
|
|
213
|
-
}));
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
// This is the 8.6 implementation. Leaving it in for reference for now.
|
|
217
|
-
// And create a similar array of the children as React components
|
|
218
|
-
// passed to Assignment component when rendered
|
|
219
|
-
arChildrenAsReact = newComp.getChildren().map((child) => {
|
|
220
|
-
// Use Case Summary ID as the React element's key
|
|
221
|
-
const caseSummaryID = child.getPConnect().getCaseSummary().ID;
|
|
222
|
-
return createElement(createPConnectComponent(), {
|
|
223
|
-
...child,
|
|
224
|
-
key: caseSummaryID
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
if (arChildrenAsReact.length > 0)
|
|
229
|
-
setArNewChildrenAsReact(arChildrenAsReact);
|
|
230
|
-
setShowModal(true);
|
|
231
|
-
// save off itemKey to be used for finishAssignment, etc.
|
|
232
|
-
setItemKey(key);
|
|
233
|
-
}
|
|
178
|
+
});
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
subscribe(EVENT_SHOW_CANCEL_ALERT, showAlert, EVENT_SHOW_CANCEL_ALERT /* Unique string for subscription */);
|
|
181
|
+
subscribe(ERROR_WHILE_RENDERING, error => {
|
|
182
|
+
// setError(true);
|
|
183
|
+
// eslint-disable-next-line no-console
|
|
184
|
+
console.error(error);
|
|
185
|
+
}, `${ERROR_WHILE_RENDERING}-mc-${getPConnect().getContextName()}`, false, getPConnect().getContextName());
|
|
186
|
+
// Unsubscribe on component unmount
|
|
187
|
+
return () => {
|
|
188
|
+
unsubscribe(EVENT_SHOW_CANCEL_ALERT, EVENT_SHOW_CANCEL_ALERT /* Should be same unique string passed during subscription */);
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
if (routingInfo) {
|
|
193
|
+
const { accessedOrder, type } = routingInfo;
|
|
194
|
+
const { key, latestItem } = getKeyAndLatestItem(routingInfo, pConn, { acTertiary });
|
|
195
|
+
if (latestItem &&
|
|
196
|
+
type === MULTIPLE &&
|
|
197
|
+
(isOpenModalAction(modalCollection.current, accessedOrder) || isUpdateModalAction(modalCollection.current, accessedOrder))) {
|
|
198
|
+
const { actionName } = latestItem;
|
|
199
|
+
// const { isDockable = false } = latestItem?.modalOptions || {};
|
|
200
|
+
const configObject = getConfigObject(latestItem, null, false);
|
|
201
|
+
const pConnect = configObject.getPConnect();
|
|
202
|
+
const caseInfo = pConnect.getCaseInfo();
|
|
203
|
+
const caseName = caseInfo.getName();
|
|
204
|
+
const caseTypeName = caseInfo.getCaseTypeName();
|
|
205
|
+
const ID = caseInfo.getBusinessID() || caseInfo.getID();
|
|
206
|
+
const isDataObject = routingInfo.items[latestItem.context].resourceType === PCore.getConstants().RESOURCE_TYPES.DATA;
|
|
207
|
+
const dataObjectAction = routingInfo.items[latestItem.context].resourceStatus;
|
|
208
|
+
const isMultiRecord = routingInfo.items[latestItem.context].isMultiRecordData;
|
|
209
|
+
const headingValue = isDataObject || isMultiRecord
|
|
210
|
+
? getModalHeading(dataObjectAction)
|
|
211
|
+
: determineModalHeaderByAction(actionName, caseTypeName, ID, `${caseInfo?.getClassName()}!CASE!${caseInfo.getName()}`.toUpperCase());
|
|
212
|
+
let arChildrenAsReact = [];
|
|
213
|
+
if (pConnect.getComponentName() === 'reference') {
|
|
214
|
+
// Reference component doesn't have children. It can build the View we want.
|
|
215
|
+
// The Reference component getPConnect is in configObject
|
|
216
|
+
arChildrenAsReact.push(createElement(createPConnectComponent(), {
|
|
217
|
+
...configObject,
|
|
218
|
+
key: `${caseName}-${ID}`
|
|
219
|
+
}));
|
|
234
220
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
221
|
+
else {
|
|
222
|
+
// This is the 8.6 implementation. Leaving it in for reference for now.
|
|
223
|
+
// And create a similar array of the children as React components
|
|
224
|
+
// passed to Assignment component when rendered
|
|
225
|
+
arChildrenAsReact = pConnect.getChildren().map((child) => {
|
|
226
|
+
// Use Case Summary ID as the React element's key
|
|
227
|
+
const caseSummaryID = child.getPConnect().getCaseSummary().ID;
|
|
228
|
+
return createElement(createPConnectComponent(), {
|
|
229
|
+
...child,
|
|
230
|
+
key: caseSummaryID
|
|
231
|
+
});
|
|
232
|
+
});
|
|
239
233
|
}
|
|
240
|
-
if (
|
|
241
|
-
|
|
234
|
+
if (arChildrenAsReact.length > 0)
|
|
235
|
+
setArNewChildrenAsReact(arChildrenAsReact);
|
|
236
|
+
setMultiRecordData(isMultiRecord);
|
|
237
|
+
setTitle(headingValue);
|
|
238
|
+
setCreatedView({ configObject, latestItem });
|
|
239
|
+
setItemKey(key);
|
|
240
|
+
setShowModal(true);
|
|
241
|
+
// Update modal use case which happens when assignment in submitted in modal.
|
|
242
|
+
if (isUpdateModalAction(modalCollection.current, accessedOrder)) {
|
|
243
|
+
// handleModalUpdate(key);
|
|
242
244
|
}
|
|
245
|
+
else if (isOpenModalAction(modalCollection.current, accessedOrder)) {
|
|
246
|
+
// New modal open scenario
|
|
247
|
+
handleModalOpen(key);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else if (isCloseModalAction(modalCollection.current, accessedOrder)) {
|
|
251
|
+
handleModalClose(accessedOrder);
|
|
243
252
|
}
|
|
244
253
|
}
|
|
245
254
|
}, [routingInfo]);
|
|
246
|
-
// function placeholderModalClose() {
|
|
247
|
-
// // Intentionally a no-op. Similar behavior in other SDKs.
|
|
248
|
-
// // Does NOT close the window. This forces the user to use
|
|
249
|
-
// // the cancel or submit button to close the modal (which, in turn, gets the right
|
|
250
|
-
// // Constellation code to run to clean up the containers, data, etc.)
|
|
251
|
-
// // console.log(`ModalViewContainer: placeholderModalClose setting bShowModal to false`) setShowModal(false);
|
|
252
|
-
// }
|
|
253
|
-
// if (bShowModal) {
|
|
254
|
-
// console.log(`ModalViewContainer about to show modal with`);
|
|
255
|
-
// console.log(`--> createdView: ${createdView} createdView.getPConnect: ${typeof createdView.getPConnect}`);
|
|
256
|
-
// console.log(`--> itemKey: ${itemKey}`);
|
|
257
|
-
// console.log(`--> arNewChildrenAsReact: ${JSON.stringify(arNewChildrenAsReact)}`);
|
|
258
|
-
// }
|
|
259
255
|
function closeActionsDialog() {
|
|
260
|
-
actionsDialog.current = true;
|
|
256
|
+
// actionsDialog.current = true;
|
|
261
257
|
setShowModal(false);
|
|
262
258
|
}
|
|
263
259
|
return (_jsxs(_Fragment, { children: [_jsxs(Dialog, { open: bShowModal, "aria-labelledby": 'form-dialog-title', children: [_jsx(DialogTitle, { id: 'form-dialog-title', className: classes.dlgTitle, children: title }), _jsx(DialogContent, { className: classes.dlgContent, children: bShowModal ? (_jsx(MuiPickersUtilsProvider, { utils: DayjsUtils, children: _jsx(Assignment, { getPConnect: createdView.configObject.getPConnect, itemKey: itemKey, isInModal: true, banners: getBanners({
|
|
264
260
|
target: itemKey,
|
|
265
261
|
pageMessages
|
|
266
|
-
}), children: arNewChildrenAsReact }) })) : null }), isMultiRecordData && (_jsx(ListViewActionButtons, { getPConnect: createdView.configObject.getPConnect, context: createdView.latestItem.context, closeActionsDialog: closeActionsDialog }))] }), bShowCancelAlert && _jsx(CancelAlert, {
|
|
262
|
+
}), children: arNewChildrenAsReact }) })) : null }), isMultiRecordData && (_jsx(ListViewActionButtons, { getPConnect: createdView.configObject.getPConnect, context: createdView.latestItem.context, closeActionsDialog: closeActionsDialog }))] }), bShowCancelAlert && _jsx(CancelAlert, { ...cancelAlertProps, dismiss: dismissCancelAlert })] }));
|
|
267
263
|
}
|
|
268
264
|
//# sourceMappingURL=ModalViewContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalViewContainer.js","sourceRoot":"","sources":["../../../../../src/components/infra/Containers/ModalViewContainer/ModalViewContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,OAAO,MAAM,iBAAiB,CAAC;AACtC,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,aAAa,MAAM,iCAAiC,CAAC;AAC5D,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,UAAU,MAAM,gBAAgB,CAAC;AAExC,OAAO,uBAAuB,MAAM,mCAAmC,CAAC;AACxE,uFAAuF;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAU9D,SAAS,SAAS,CAAC,QAAQ,EAAE,IAAI,GAAG,EAAE;IACpC,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;IAC1C,OAAO,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,mBAAmB,CAAC,WAAW,EAAE,KAAK;IAC7C,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC/C,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE;QAChF,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;QAC7C,MAAM,GAAG,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,GAA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,WAAW,CAAC,UAAU,CAAC,OAAO,EACvC,kBAAkB,EAAE,kBAAkB,GACtC,CACH,IACM,EACR,gBAAgB,IAAI,KAAC,WAAW,IAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,GAAI,IACxH,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { createElement, useEffect, useRef, useState } from 'react';\nimport isEqual from 'fast-deep-equal';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { MuiPickersUtilsProvider } from '@material-ui/pickers';\nimport DayjsUtils from '@date-io/dayjs';\n\nimport createPConnectComponent from '../../../../bridge/react_pconnect';\n// Need to get correct implementation from component map for Assignment and CancelAlert\nimport { getComponentFromMap } from '../../../../bridge/helpers/sdk_component_map';\nimport { getBanners } from '../../../helpers/case-utils';\nimport { isEmptyObject } from '../../../helpers/common-utils';\nimport { PConnProps } from '../../../../types/PConnProps';\n\ninterface ModalViewContainerProps extends PConnProps {\n // If any, enter additional props that only exist on this component\n loadingInfo?: string;\n routingInfo?: any;\n pageMessages?: string[];\n}\n\nfunction buildName(pConnect, name = '') {\n const context = pConnect.getContextName();\n return `${context}/${name}`;\n}\n\nfunction getKeyAndLatestItem(routinginfo, pConn) {\n const containerName = pConn.getContainerName();\n if (PCore.getContainerUtils().hasContainerItems(buildName(pConn, containerName))) {\n const { accessedOrder, items } = routinginfo;\n const key = accessedOrder[accessedOrder.length - 1];\n const latestItem = items[key];\n return { key, latestItem };\n }\n return {};\n}\n\nfunction getConfigObject(item, pConnect) {\n if (item) {\n const { context, view } = item;\n const config = {\n meta: view,\n options: {\n context,\n pageReference: view.config.context || pConnect.getPageReference(),\n hasForm: true\n }\n };\n return PCore.createPConnect(config);\n }\n return null;\n}\n\nconst useStyles = makeStyles(theme => ({\n dlgTitle: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(0)\n // paddingLeft: theme.spacing(0),\n // paddingRight: theme.spacing(0),\n // paddingTop: theme.spacing(0),\n // paddingBottom: theme.spacing(0),\n },\n dlgContent: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n marginTop: theme.spacing(0),\n marginBottom: theme.spacing(2)\n // paddingLeft: theme.spacing(0),\n // paddingRight: theme.spacing(0),\n // paddingTop: theme.spacing(0),\n // paddingBottom: theme.spacing(0),\n }\n}));\n\nexport default function ModalViewContainer(props: ModalViewContainerProps) {\n // Get the proper implementation (local or Pega-provided) for these components that are emitted below\n const Assignment = getComponentFromMap('Assignment');\n const CancelAlert = getComponentFromMap('CancelAlert');\n const ListViewActionButtons = getComponentFromMap('ListViewActionButtons');\n\n const classes = useStyles();\n\n const routingInfoRef = useRef({});\n const { getPConnect, routingInfo = null, loadingInfo = '', pageMessages = [] } = props;\n const pConn = getPConnect();\n const {\n CONTAINER_TYPE: { MULTIPLE },\n PUB_SUB_EVENTS: { EVENT_SHOW_CANCEL_ALERT }\n } = PCore.getConstants();\n const { subscribe } = PCore.getPubSubUtils();\n const [bShowModal, setShowModal] = useState(false);\n const [bSubscribed, setSubscribed] = useState(false);\n const [bShowCancelAlert, setShowCancelAlert] = useState(false);\n const [oCaseInfo, setOCaseInfo] = useState({});\n const [createdView, setCreatedView] = useState<any>(null);\n const [title, setTitle] = useState('');\n const [arNewChildrenAsReact, setArNewChildrenAsReact] = useState<any[]>([]);\n const [itemKey, setItemKey] = useState('');\n const [cancelPConn, setCancelPConn] = useState(null);\n const [isMultiRecordData, setMultiRecordData] = useState(false);\n const localizedVal = PCore.getLocaleUtils().getLocaleValue;\n const localeCategory = 'Data Object';\n\n const actionsDialog = useRef(false);\n\n function showAlert(payload) {\n const { latestItem } = getKeyAndLatestItem(routingInfoRef.current, pConn);\n const { isModalAction } = payload;\n\n /*\n If we are in create stage full page mode, created a new case and trying to click on cancel button\n it will show two alert dialogs which is not expected. Hence isModalAction flag to avoid that.\n */\n if (latestItem && isModalAction && !actionsDialog.current) {\n const configObject = getConfigObject(latestItem, pConn);\n setCancelPConn(configObject?.getPConnect() as any);\n setShowCancelAlert(true);\n }\n }\n\n function compareCaseInfoIsDifferent(oCurrentCaseInfo: Object): boolean {\n let bRet = false;\n\n // fast-deep-equal version\n if (isEqual !== undefined) {\n bRet = !isEqual(oCaseInfo, oCurrentCaseInfo);\n } else {\n const sCurrentCaseInfo = JSON.stringify(oCurrentCaseInfo);\n const sOldCaseInfo = JSON.stringify(oCaseInfo);\n // stringify compare version\n if (sCurrentCaseInfo !== sOldCaseInfo) {\n bRet = true;\n }\n }\n\n // if different, save off new case info\n if (bRet) {\n setOCaseInfo(JSON.parse(JSON.stringify(oCurrentCaseInfo)));\n }\n\n return bRet;\n }\n\n const updateAlertState = modalFlag => {\n setShowCancelAlert(false);\n setShowModal(modalFlag);\n };\n\n function getModalHeading(dataObjectAction) {\n return dataObjectAction === PCore.getConstants().RESOURCE_STATUS.CREATE\n ? localizedVal('Add Record', localeCategory)\n : localizedVal('Edit Record', localeCategory);\n }\n\n function determineModalHeaderByAction(actionName, caseTypeName, ID, caseLocaleRef) {\n if (actionName) {\n return localizedVal(actionName, localeCategory);\n }\n return `${localizedVal('Create', localeCategory)} ${localizedVal(caseTypeName, undefined, caseLocaleRef)} (${ID})`;\n }\n\n useEffect(() => {\n // Establish the necessary containers\n const containerMgr = pConn.getContainerManager();\n containerMgr.initializeContainers({ type: MULTIPLE });\n }, [MULTIPLE, pConn]);\n\n useEffect(() => {\n // Update routingInfoRef.current whenever routingInfo changes\n routingInfoRef.current = routingInfo;\n if (routingInfoRef.current && !loadingInfo) {\n const currentOrder = routingInfo.accessedOrder;\n\n if (undefined === currentOrder) {\n return;\n }\n\n const currentItems = routingInfo.items;\n\n const { key, latestItem } = getKeyAndLatestItem(routingInfoRef.current, pConn);\n // console.log(`ModalViewContainer: key: ${key} latestItem: ${JSON.stringify(latestItem)}`);\n\n if (currentOrder.length > 0) {\n if (currentItems[key] && currentItems[key].view && !isEmptyObject(currentItems[key].view)) {\n const currentItem = currentItems[key];\n const rootView = currentItem.view;\n const { context } = rootView.config;\n const config: any = { meta: rootView };\n config.options = {\n context: currentItem.context,\n hasForm: true,\n pageReference: context || pConn.getPageReference()\n };\n\n if (!bSubscribed) {\n setSubscribed(true);\n subscribe(EVENT_SHOW_CANCEL_ALERT, showAlert, EVENT_SHOW_CANCEL_ALERT /* Unique string for subscription */);\n }\n\n const configObject = PCore.createPConnect(config);\n\n // THIS is where the ViewContainer creates a View\n // The config has meta.config.type = \"view\"\n const newComp = configObject.getPConnect();\n // const newCompName = newComp.getComponentName();\n // @ts-ignore - parameter “contextName” for getDataObject method should be optional\n const caseInfo = newComp && newComp.getDataObject() && newComp.getDataObject().caseInfo ? newComp.getDataObject().caseInfo : null;\n\n // console.log(`ModalViewContainer just created newComp: ${newCompName}`);\n\n // The metadata for pyDetails changed such that the \"template\": \"CaseView\"\n // is no longer a child of the created View but is in the created View's\n // config. So, we DON'T want to replace this.pConn$ since the created\n // component is a View (and not a ViewContainer). We now look for the\n // \"template\" type directly in the created component (newComp) and NOT\n // as a child of the newly created component.\n // console.log(`---> ModalViewContainer created new ${newCompName}`);\n\n // Use the newly created component (View) info but DO NOT replace\n // this ModalViewContainer's pConn$, etc.\n // Note that we're now using the newly created View's PConnect in the\n // ViewContainer HTML template to guide what's rendered similar to what\n // the React return of React.Fragment does\n\n // right now need to check caseInfo for changes, to trigger redraw, not getting\n // changes from angularPconnect except for first draw\n if (newComp && caseInfo && compareCaseInfoIsDifferent(caseInfo)) {\n setCreatedView({ configObject, latestItem });\n\n const { actionName } = latestItem;\n const theNewCaseInfo = newComp.getCaseInfo();\n const caseName = theNewCaseInfo.getName();\n const ID = theNewCaseInfo.getBusinessID() || theNewCaseInfo.getID();\n const caseTypeName = theNewCaseInfo.getCaseTypeName();\n const isDataObject = routingInfo.items[latestItem.context].resourceType === PCore.getConstants().RESOURCE_TYPES.DATA;\n const dataObjectAction = routingInfo.items[latestItem.context].resourceStatus;\n const isMultiRecord = routingInfo.items[latestItem.context].isMultiRecordData;\n setMultiRecordData(isMultiRecord);\n const headingValue =\n isDataObject || isMultiRecord\n ? getModalHeading(dataObjectAction)\n : determineModalHeaderByAction(\n actionName,\n caseTypeName,\n ID,\n `${theNewCaseInfo?.getClassName()}!CASE!${theNewCaseInfo.getName()}`.toUpperCase()\n );\n\n setTitle(headingValue);\n\n let arChildrenAsReact: any[] = [];\n\n if (newComp.getComponentName() === 'reference') {\n // Reference component doesn't have children. It can build the View we want.\n // The Reference component getPConnect is in configObject\n\n arChildrenAsReact.push(\n createElement(createPConnectComponent(), {\n ...configObject,\n key: `${caseName}-${ID}`\n })\n );\n } else {\n // This is the 8.6 implementation. Leaving it in for reference for now.\n // And create a similar array of the children as React components\n // passed to Assignment component when rendered\n arChildrenAsReact = (newComp.getChildren() as []).map((child: any) => {\n // Use Case Summary ID as the React element's key\n const caseSummaryID = child.getPConnect().getCaseSummary().ID;\n return createElement(createPConnectComponent(), {\n ...child,\n key: caseSummaryID\n });\n });\n }\n\n if (arChildrenAsReact.length > 0) setArNewChildrenAsReact(arChildrenAsReact);\n\n setShowModal(true);\n\n // save off itemKey to be used for finishAssignment, etc.\n setItemKey(key);\n }\n }\n } else {\n if (bShowModal) {\n setShowModal(false);\n }\n if (!isEmptyObject(oCaseInfo)) {\n setOCaseInfo({});\n }\n }\n }\n }, [routingInfo]);\n\n // function placeholderModalClose() {\n // // Intentionally a no-op. Similar behavior in other SDKs.\n // // Does NOT close the window. This forces the user to use\n // // the cancel or submit button to close the modal (which, in turn, gets the right\n // // Constellation code to run to clean up the containers, data, etc.)\n\n // // console.log(`ModalViewContainer: placeholderModalClose setting bShowModal to false`) setShowModal(false);\n // }\n\n // if (bShowModal) {\n // console.log(`ModalViewContainer about to show modal with`);\n // console.log(`--> createdView: ${createdView} createdView.getPConnect: ${typeof createdView.getPConnect}`);\n // console.log(`--> itemKey: ${itemKey}`);\n // console.log(`--> arNewChildrenAsReact: ${JSON.stringify(arNewChildrenAsReact)}`);\n // }\n\n function closeActionsDialog() {\n actionsDialog.current = true;\n setShowModal(false);\n }\n\n return (\n <>\n <Dialog open={bShowModal} aria-labelledby='form-dialog-title'>\n <DialogTitle id='form-dialog-title' className={classes.dlgTitle}>\n {title}\n </DialogTitle>\n <DialogContent className={classes.dlgContent}>\n {bShowModal ? (\n <MuiPickersUtilsProvider utils={DayjsUtils}>\n <Assignment\n getPConnect={createdView.configObject.getPConnect}\n itemKey={itemKey}\n isInModal\n banners={getBanners({\n target: itemKey,\n pageMessages\n })}\n >\n {arNewChildrenAsReact}\n </Assignment>\n </MuiPickersUtilsProvider>\n ) : null}\n </DialogContent>\n {isMultiRecordData && (\n <ListViewActionButtons\n getPConnect={createdView.configObject.getPConnect}\n context={createdView.latestItem.context}\n closeActionsDialog={closeActionsDialog}\n />\n )}\n </Dialog>\n {bShowCancelAlert && <CancelAlert pConn={cancelPConn} showAlert={bShowCancelAlert} updateAlertState={updateAlertState} />}\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ModalViewContainer.js","sourceRoot":"","sources":["../../../../../src/components/infra/Containers/ModalViewContainer/ModalViewContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,aAAa,MAAM,iCAAiC,CAAC;AAC5D,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,UAAU,MAAM,gBAAgB,CAAC;AACxC,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAE3C,OAAO,uBAAuB,MAAM,mCAAmC,CA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,WAAW,IAAC,EAAE,EAAC,mBAAmB,EAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,YAC5D,KAAK,GACM,EACd,KAAC,aAAa,IAAC,SAAS,EAAE,OAAO,CAAC,UAAU,YACzC,UAAU,CAAC,CAAC,CAAC,CACZ,KAAC,uBAAuB,IAAC,KAAK,EAAE,UAAU,YACxC,KAAC,UAAU,IACT,WAAW,EAAE,WAAW,CAAC,YAAY,CAAC,WAAW,EACjD,OAAO,EAAE,OAAO,EAChB,SAAS,QACT,OAAO,EAAE,UAAU,CAAC;oCAClB,MAAM,EAAE,OAAO;oCACf,YAAY;iCACb,CAAC,YAED,oBAAoB,GACV,GACW,CAC3B,CAAC,CAAC,CAAC,IAAI,GACM,EAEf,iBAAiB,IAAI,CACpB,KAAC,qBAAqB,IACpB,WAAW,EAAE,WAAW,CAAC,YAAY,CAAC,WAAW,EACjD,OAAO,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,EACvC,kBAAkB,EAAE,kBAAkB,GACtC,CACH,IACM,EACR,gBAAgB,IAAI,KAAC,WAAW,OAAK,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,GAAI,IACtF,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { createElement, useEffect, useRef, useState } from 'react';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { MuiPickersUtilsProvider } from '@material-ui/pickers';\nimport DayjsUtils from '@date-io/dayjs';\nimport difference from 'lodash.difference';\n\nimport createPConnectComponent from '../../../../bridge/react_pconnect';\n// Need to get correct implementation from component map for Assignment and CancelAlert\nimport { getComponentFromMap } from '../../../../bridge/helpers/sdk_component_map';\nimport { getBanners } from '../../../helpers/case-utils';\nimport { PConnProps } from '../../../../types/PConnProps';\n\ninterface ModalViewContainerProps extends PConnProps {\n // If any, enter additional props that only exist on this component\n loadingInfo?: string;\n routingInfo?: any;\n pageMessages?: string[];\n}\n\nfunction isOpenModalAction(prevModalCollection, currentModalList) {\n return prevModalCollection && currentModalList ? Object.keys(prevModalCollection).length < currentModalList.length : false;\n}\n\nfunction isUpdateModalAction(prevModalCollection, currentModalList) {\n return prevModalCollection && currentModalList ? Object.keys(prevModalCollection).length === currentModalList.length : false;\n}\n\nfunction isCloseModalAction(prevModalCollection, currentModalList) {\n return prevModalCollection && currentModalList ? Object.keys(prevModalCollection).length > currentModalList.length : false;\n}\n\nfunction buildName(pConnect, name = '') {\n const context = pConnect.getContextName();\n return `${context}/${name}`;\n}\n\nfunction getKeyAndLatestItem(routinginfo, pConn, options) {\n const containerName = pConn.getContainerName();\n const { acTertiary = false } = options || {};\n if (PCore.getContainerUtils().hasContainerItems(buildName(pConn, containerName))) {\n const { accessedOrder, items } = routinginfo;\n let key;\n // eslint-disable-next-line no-plusplus\n for (let i = accessedOrder.length - 1; i >= 0; i--) {\n const tempkey = accessedOrder[i];\n if ((acTertiary && items[tempkey].acTertiary) || (!acTertiary && !items[tempkey].acTertiary)) {\n key = tempkey;\n break;\n }\n }\n const latestItem = items[key];\n return { key, latestItem };\n }\n return {};\n}\n\nfunction getConfigObject(item, pConnect, isReverseCoexistence = false) {\n let config;\n if (isReverseCoexistence) {\n config = {\n options: {\n pageReference: pConnect?.getPageReference(),\n hasForm: true,\n containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL\n }\n };\n return PCore.createPConnect(config);\n }\n if (item) {\n const { context, view, isBulkAction } = item;\n const target = PCore.getContainerUtils().getTargetFromContainerItemID(context);\n config = {\n meta: view,\n options: {\n context,\n pageReference: view.config.context || pConnect.getPageReference(),\n hasForm: true,\n ...(isBulkAction && { isBulkAction }),\n containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL,\n target\n }\n };\n return PCore.createPConnect(config);\n }\n return null;\n}\n\nconst useStyles = makeStyles(theme => ({\n dlgTitle: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(0)\n },\n dlgContent: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n marginTop: theme.spacing(0),\n marginBottom: theme.spacing(2)\n }\n}));\n\nexport default function ModalViewContainer(props: ModalViewContainerProps) {\n // Get the proper implementation (local or Pega-provided) for these components that are emitted below\n const Assignment = getComponentFromMap('Assignment');\n const CancelAlert = getComponentFromMap('CancelAlert');\n const ListViewActionButtons = getComponentFromMap('ListViewActionButtons');\n\n const classes = useStyles();\n\n const modalCollection = useRef({});\n const routingInfoRef = useRef({});\n const { getPConnect, routingInfo = null, pageMessages = [] } = props;\n const pConn = getPConnect();\n const { acTertiary } = pConn.getConfigProps() as any;\n const {\n CONTAINER_TYPE: { MULTIPLE },\n PUB_SUB_EVENTS: { EVENT_SHOW_CANCEL_ALERT }\n } = PCore.getConstants();\n const { subscribe, unsubscribe } = PCore.getPubSubUtils();\n const [bShowModal, setShowModal] = useState(false);\n const [bShowCancelAlert, setShowCancelAlert] = useState(false);\n const [createdView, setCreatedView] = useState<any>(null);\n const [title, setTitle] = useState('');\n const [arNewChildrenAsReact, setArNewChildrenAsReact] = useState<any[]>([]);\n const [itemKey, setItemKey] = useState('');\n const [cancelAlertProps, setCancelAlertProps] = useState({});\n const [isMultiRecordData, setMultiRecordData] = useState(false);\n const localizedVal = PCore.getLocaleUtils().getLocaleValue;\n const localeCategory = 'Data Object';\n\n const ERROR_WHILE_RENDERING = 'ERROR_WHILE_RENDERING';\n\n function showAlert(payload) {\n const { latestItem } = getKeyAndLatestItem(routingInfoRef.current, pConn, { acTertiary });\n const isReverseCoexistence = (PCore.getCoexistenceManager().getBroadcastUtils() as any).isReverseCoexistenceCaseLoaded();\n const { isModalAction, hideDelete, isDataObject, skipReleaseLockRequest } = payload;\n\n /*\n If we are in create stage full page mode, created a new case and trying to click on cancel button\n it will show two alert dialogs which is not expected. Hence isModalAction flag to avoid that.\n */\n if (latestItem && isModalAction) {\n const configObject = getConfigObject(latestItem, pConn, isReverseCoexistence);\n const contextName = configObject?.getPConnect().getContextName();\n setCancelAlertProps({\n heading: 'Discard unsaved changes?',\n content: 'You have unsaved changes. You can discard them or go back to keep working.',\n getPConnect: configObject?.getPConnect,\n itemKey: contextName,\n hideDelete,\n isDataObject,\n skipReleaseLockRequest\n });\n setShowCancelAlert(true);\n }\n }\n\n function handleModalOpen(key) {\n modalCollection.current = {\n ...modalCollection.current,\n [key]: {}\n };\n }\n\n function handleModalClose(accessedOrder) {\n const tempModalCollection = modalCollection.current;\n const [closedModalKey] = difference(Object.keys(tempModalCollection), accessedOrder);\n\n if (closedModalKey && tempModalCollection[closedModalKey]) {\n const modifiedModalCollection = { ...tempModalCollection };\n delete modifiedModalCollection[closedModalKey];\n modalCollection.current = modifiedModalCollection;\n setShowModal(false);\n }\n }\n\n const dismissCancelAlert = dismissAllModals => {\n setShowCancelAlert(false);\n\n if (dismissAllModals) {\n setShowModal(false);\n }\n };\n\n function getModalHeading(dataObjectAction) {\n return dataObjectAction === PCore.getConstants().RESOURCE_STATUS.CREATE\n ? localizedVal('Add Record', localeCategory)\n : localizedVal('Edit Record', localeCategory);\n }\n\n function determineModalHeaderByAction(actionName, caseTypeName, ID, caseLocaleRef) {\n if (actionName) {\n return localizedVal(actionName, localeCategory);\n }\n return `${localizedVal('Create', localeCategory)} ${localizedVal(caseTypeName, undefined, caseLocaleRef)} (${ID})`;\n }\n\n useEffect(() => {\n // Establish the necessary containers\n const containerMgr = pConn.getContainerManager();\n containerMgr.initializeContainers({ type: MULTIPLE });\n }, [MULTIPLE, pConn]);\n\n useEffect(() => {\n // Persisting routing information between the renders in showAlert\n routingInfoRef.current = routingInfo;\n });\n\n useEffect(() => {\n subscribe(EVENT_SHOW_CANCEL_ALERT, showAlert, EVENT_SHOW_CANCEL_ALERT /* Unique string for subscription */);\n subscribe(\n ERROR_WHILE_RENDERING,\n error => {\n // setError(true);\n // eslint-disable-next-line no-console\n console.error(error);\n },\n `${ERROR_WHILE_RENDERING}-mc-${getPConnect().getContextName()}`,\n false,\n getPConnect().getContextName()\n );\n\n // Unsubscribe on component unmount\n return () => {\n unsubscribe(EVENT_SHOW_CANCEL_ALERT, EVENT_SHOW_CANCEL_ALERT /* Should be same unique string passed during subscription */);\n };\n });\n\n useEffect(() => {\n if (routingInfo) {\n const { accessedOrder, type } = routingInfo;\n const { key, latestItem } = getKeyAndLatestItem(routingInfo, pConn, { acTertiary });\n\n if (\n latestItem &&\n type === MULTIPLE &&\n (isOpenModalAction(modalCollection.current, accessedOrder) || isUpdateModalAction(modalCollection.current, accessedOrder))\n ) {\n const { actionName } = latestItem;\n // const { isDockable = false } = latestItem?.modalOptions || {};\n const configObject: any = getConfigObject(latestItem, null, false);\n const pConnect = configObject.getPConnect();\n const caseInfo: any = pConnect.getCaseInfo();\n const caseName = caseInfo.getName();\n const caseTypeName = caseInfo.getCaseTypeName();\n const ID = caseInfo.getBusinessID() || caseInfo.getID();\n const isDataObject = routingInfo.items[latestItem.context].resourceType === PCore.getConstants().RESOURCE_TYPES.DATA;\n const dataObjectAction = routingInfo.items[latestItem.context].resourceStatus;\n const isMultiRecord = routingInfo.items[latestItem.context].isMultiRecordData;\n const headingValue =\n isDataObject || isMultiRecord\n ? getModalHeading(dataObjectAction)\n : determineModalHeaderByAction(actionName, caseTypeName, ID, `${caseInfo?.getClassName()}!CASE!${caseInfo.getName()}`.toUpperCase());\n\n let arChildrenAsReact: any[] = [];\n\n if (pConnect.getComponentName() === 'reference') {\n // Reference component doesn't have children. It can build the View we want.\n // The Reference component getPConnect is in configObject\n\n arChildrenAsReact.push(\n createElement(createPConnectComponent(), {\n ...configObject,\n key: `${caseName}-${ID}`\n })\n );\n } else {\n // This is the 8.6 implementation. Leaving it in for reference for now.\n // And create a similar array of the children as React components\n // passed to Assignment component when rendered\n arChildrenAsReact = (pConnect.getChildren() as []).map((child: any) => {\n // Use Case Summary ID as the React element's key\n const caseSummaryID = child.getPConnect().getCaseSummary().ID;\n return createElement(createPConnectComponent(), {\n ...child,\n key: caseSummaryID\n });\n });\n }\n\n if (arChildrenAsReact.length > 0) setArNewChildrenAsReact(arChildrenAsReact);\n setMultiRecordData(isMultiRecord);\n setTitle(headingValue);\n setCreatedView({ configObject, latestItem });\n setItemKey(key);\n setShowModal(true);\n\n // Update modal use case which happens when assignment in submitted in modal.\n if (isUpdateModalAction(modalCollection.current, accessedOrder)) {\n // handleModalUpdate(key);\n } else if (isOpenModalAction(modalCollection.current, accessedOrder)) {\n // New modal open scenario\n handleModalOpen(key);\n }\n } else if (isCloseModalAction(modalCollection.current, accessedOrder)) {\n handleModalClose(accessedOrder);\n }\n }\n }, [routingInfo]);\n\n function closeActionsDialog() {\n // actionsDialog.current = true;\n setShowModal(false);\n }\n\n return (\n <>\n <Dialog open={bShowModal} aria-labelledby='form-dialog-title'>\n <DialogTitle id='form-dialog-title' className={classes.dlgTitle}>\n {title}\n </DialogTitle>\n <DialogContent className={classes.dlgContent}>\n {bShowModal ? (\n <MuiPickersUtilsProvider utils={DayjsUtils}>\n <Assignment\n getPConnect={createdView.configObject.getPConnect}\n itemKey={itemKey}\n isInModal\n banners={getBanners({\n target: itemKey,\n pageMessages\n })}\n >\n {arNewChildrenAsReact}\n </Assignment>\n </MuiPickersUtilsProvider>\n ) : null}\n </DialogContent>\n\n {isMultiRecordData && (\n <ListViewActionButtons\n getPConnect={createdView.configObject.getPConnect}\n context={createdView.latestItem.context}\n closeActionsDialog={closeActionsDialog}\n />\n )}\n </Dialog>\n {bShowCancelAlert && <CancelAlert {...cancelAlertProps} dismiss={dismissCancelAlert} />}\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavBar.d.ts","sourceRoot":"","sources":["../../../../src/components/infra/NavBar/NavBar.tsx"],"names":[],"mappings":";AAkCA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,cAAc,CAAC;AAEtB,UAAU,WAAY,SAAQ,UAAU;IAGtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AA6DD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"NavBar.d.ts","sourceRoot":"","sources":["../../../../src/components/infra/NavBar/NavBar.tsx"],"names":[],"mappings":";AAkCA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,cAAc,CAAC;AAEtB,UAAU,WAAY,SAAQ,UAAU;IAGtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AA6DD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,eAuLhD"}
|
|
@@ -85,6 +85,8 @@ export default function NavBar(props) {
|
|
|
85
85
|
const [bShowCaseTypes, setBShowCaseTypes] = useState(true);
|
|
86
86
|
const [bShowOperatorButtons, setBShowOperatorButtons] = useState(false);
|
|
87
87
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
88
|
+
const localeUtils = PCore.getLocaleUtils();
|
|
89
|
+
const localeReference = pConn.getValue('.pyLocaleReference');
|
|
88
90
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
89
91
|
const localeCategory = 'AppShell';
|
|
90
92
|
const portalLogoImage = Utils.getIconPath(Utils.getSDKStaticConentUrl()).concat('pzpega-logo-mark.svg');
|
|
@@ -144,12 +146,12 @@ export default function NavBar(props) {
|
|
|
144
146
|
}, [isDesktop]);
|
|
145
147
|
return (_jsxs(Drawer, { variant: 'permanent', classes: {
|
|
146
148
|
paper: clsx(classes.drawerPaper, !open && classes.drawerPaperClose)
|
|
147
|
-
}, open: open && isDesktop, children: [open ? (_jsx(List, { className: classes.appListItem, children: _jsxs(ListItem, { onClick: handleDrawerOpen, children: [_jsx(ListItemIcon, { children: _jsx("img", { src: portalLogoImage, className: classes.appListLogo }) }), _jsx(ListItemText, { primary: _jsx(Typography, { variant: 'h6', className: classes.applicationLabel, children: portalApp }) }), _jsx(ListItemSecondaryAction, { children: _jsx(IconButton, { edge: 'end', onClick: handleDrawerOpen, children: _jsx(ChevronLeftIcon, { className: classes.appListIcon }) }) })] }) })) : (_jsx("div", { className: classes.appListDiv, onClick: handleDrawerOpen, children: _jsx(ChevronRightIcon, { className: classes.appListIcon, id: 'chevron-right-icon', fontSize: 'large' }) })), _jsx(List, { children: _jsxs(ListItem, { button: true, onClick: handleCaseItemClick, children: [_jsx(ListItemIcon, { children: bShowCaseTypes && open ? _jsx(ClearOutlinedIcon, { fontSize: 'large' }) : _jsx(AddIcon, { fontSize: 'large' }) }), _jsx(ListItemText, { primary: 'Create' }), bShowCaseTypes ? _jsx(ExpandLess, {}) : _jsx(ExpandMore, {})] }) }), _jsx(Collapse, { in: bShowCaseTypes && open, timeout: 'auto', unmountOnExit: true, className: 'scrollable', children: _jsx(List, { component: 'div', disablePadding: true, children: caseTypes.map(caseType => (_jsxs(ListItem, { button: true, className: classes.nested, onClick: () => navPanelCreateCaseType(caseType.pyClassName, caseType.pyFlowType), children: [_jsx(ListItemIcon, { children: _jsx(WorkOutlineIcon, { fontSize: 'large' }) }), _jsx(ListItemText, { primary: caseType.pyLabel })] }, caseType.pyLabel))) }) }), _jsx(List, { children: navPages.map(page => (_jsxs(ListItem, { button: true, onClick: () => navPanelButtonClick(page), children: [_jsx(ListItemIcon, { children: iconMap[page.pxPageViewIcon] }), _jsx(ListItemText, { primary: page.pyLabel })] }, page.pyLabel))) }), _jsx(Divider, {}), _jsx(List, { className: 'marginTopAuto', children: _jsxs(_Fragment, { children: [_jsxs(ListItem, { onClick: navPanelOperatorButtonClick, children: [_jsx(ListItemIcon, { children: _jsx(PersonOutlineIcon, { fontSize: 'large' }) }), _jsx(ListItemText, { primary: portalOperator }), open && (_jsx(ListItemSecondaryAction, { children: _jsx(IconButton, { edge: 'end', onClick: navPanelOperatorButtonClick, children: _jsx(ChevronRightIcon, {}) }) }))] }), _jsx(Menu, { anchorEl: anchorEl, keepMounted: bShowOperatorButtons, open: bShowOperatorButtons, onClick: navPanelOperatorButtonClick, anchorOrigin: {
|
|
149
|
+
}, open: open && isDesktop, children: [open ? (_jsx(List, { className: classes.appListItem, children: _jsxs(ListItem, { onClick: handleDrawerOpen, children: [_jsx(ListItemIcon, { children: _jsx("img", { src: portalLogoImage, className: classes.appListLogo }) }), _jsx(ListItemText, { primary: _jsx(Typography, { variant: 'h6', className: classes.applicationLabel, children: portalApp }) }), _jsx(ListItemSecondaryAction, { children: _jsx(IconButton, { edge: 'end', onClick: handleDrawerOpen, children: _jsx(ChevronLeftIcon, { className: classes.appListIcon }) }) })] }) })) : (_jsx("div", { className: classes.appListDiv, onClick: handleDrawerOpen, children: _jsx(ChevronRightIcon, { className: classes.appListIcon, id: 'chevron-right-icon', fontSize: 'large' }) })), _jsx(List, { children: _jsxs(ListItem, { button: true, onClick: handleCaseItemClick, children: [_jsx(ListItemIcon, { children: bShowCaseTypes && open ? _jsx(ClearOutlinedIcon, { fontSize: 'large' }) : _jsx(AddIcon, { fontSize: 'large' }) }), _jsx(ListItemText, { primary: 'Create' }), bShowCaseTypes ? _jsx(ExpandLess, {}) : _jsx(ExpandMore, {})] }) }), _jsx(Collapse, { in: bShowCaseTypes && open, timeout: 'auto', unmountOnExit: true, className: 'scrollable', children: _jsx(List, { component: 'div', disablePadding: true, children: caseTypes.map(caseType => (_jsxs(ListItem, { button: true, className: classes.nested, onClick: () => navPanelCreateCaseType(caseType.pyClassName, caseType.pyFlowType), children: [_jsx(ListItemIcon, { children: _jsx(WorkOutlineIcon, { fontSize: 'large' }) }), _jsx(ListItemText, { primary: localeUtils.getLocaleValue(caseType.pyLabel, '', localeReference) })] }, caseType.pyLabel))) }) }), _jsx(List, { children: navPages.map(page => (_jsxs(ListItem, { button: true, onClick: () => navPanelButtonClick(page), children: [_jsx(ListItemIcon, { children: iconMap[page.pxPageViewIcon] }), _jsx(ListItemText, { primary: localeUtils.getLocaleValue(page.pyLabel, '', localeReference) })] }, page.pyLabel))) }), _jsx(Divider, {}), _jsx(List, { className: 'marginTopAuto', children: _jsxs(_Fragment, { children: [_jsxs(ListItem, { onClick: navPanelOperatorButtonClick, children: [_jsx(ListItemIcon, { children: _jsx(PersonOutlineIcon, { fontSize: 'large' }) }), _jsx(ListItemText, { primary: portalOperator }), open && (_jsx(ListItemSecondaryAction, { children: _jsx(IconButton, { edge: 'end', onClick: navPanelOperatorButtonClick, children: _jsx(ChevronRightIcon, {}) }) }))] }), _jsx(Menu, { anchorEl: anchorEl, keepMounted: bShowOperatorButtons, open: bShowOperatorButtons, onClick: navPanelOperatorButtonClick, anchorOrigin: {
|
|
148
150
|
vertical: 'top',
|
|
149
151
|
horizontal: 'right'
|
|
150
152
|
}, transformOrigin: {
|
|
151
153
|
vertical: 'top',
|
|
152
154
|
horizontal: 'left'
|
|
153
|
-
}, children: _jsxs(MenuItem, { onClick: logout, children: [_jsx(ListItemIcon, { children: _jsx(ArrowBackIcon, { fontSize: 'large' }) }), _jsx(Typography, { variant: 'inherit', children: localizedVal('
|
|
155
|
+
}, children: _jsxs(MenuItem, { onClick: logout, children: [_jsx(ListItemIcon, { children: _jsx(ArrowBackIcon, { fontSize: 'large' }) }), _jsx(Typography, { variant: 'inherit', children: localizedVal('Log off', localeCategory) })] }) })] }) })] }));
|
|
154
156
|
}
|
|
155
157
|
//# sourceMappingURL=NavBar.js.map
|