@pega/dx-component-builder-sdk 0.23.15 → 0.23.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/package.json +1 -1
- package/src/tasks/create/templates/Constellation/field/Boolean/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.tsx.mustache +8 -1
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +5 -3
- package/src/tasks/publish/index.js +3 -1
- package/src/tasks/publish-all/index.js +7 -5
- package/tests/assets/sdk-a/components/create/override-sdk/template/list-view/utils.ts +4 -2
- package/tests/assets/sdk-a/components/createAll/override-sdk/template/list-view/utils.ts +4 -2
- package/tests/assets/sdk-r/components/create/override-sdk/designSystemExtension/Operator/Operator.tsx +5 -3
- package/tests/assets/sdk-r/components/create/override-sdk/field/CancelAlert/CancelAlert.tsx +95 -78
- package/tests/assets/sdk-r/components/create/override-sdk/infra/Assignment/Assignment.tsx +21 -7
- package/tests/assets/sdk-r/components/create/override-sdk/infra/NavBar/NavBar.tsx +5 -3
- package/tests/assets/sdk-r/components/create/override-sdk/template/CaseSummary/CaseSummary.tsx +43 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/CaseView/CaseView.tsx +1 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +34 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +9 -11
- package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrow/WideNarrow.tsx +1 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/WssNavBar/WssNavBar.tsx +4 -1
- package/tests/assets/sdk-r/components/create/override-sdk/widget/Attachment/Attachment.tsx +12 -2
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/demo.stories.tsx +8 -1
- package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageCaseWidget/index.tsx +5 -3
- package/tests/assets/sdk-r/components/createAll/override-sdk/designSystemExtension/Operator/Operator.tsx +5 -3
- package/tests/assets/sdk-r/components/createAll/override-sdk/field/CancelAlert/CancelAlert.tsx +95 -78
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Assignment/Assignment.tsx +21 -7
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/NavBar/NavBar.tsx +5 -3
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseSummary/CaseSummary.tsx +43 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseView/CaseView.tsx +1 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +34 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +9 -11
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrow/WideNarrow.tsx +1 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/WssNavBar/WssNavBar.tsx +4 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/widget/Attachment/Attachment.tsx +12 -2
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/PConnProps.d.ts +0 -46
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/demo.stories.tsx +0 -54
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/index.tsx +0 -73
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/mock.ts +0 -15
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/styles.ts +0 -15
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/config.json +0 -83
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/demo.stories.tsx +0 -59
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/index.tsx +0 -101
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/mock.ts +0 -16
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/styles.js +0 -7
- /package/src/tasks/create/templates/Constellation/field/Boolean/{demo.stories.jsx.mustache → demo.stories.tsx.mustache} +0 -0
- /package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/{demo.stories.jsx → demo.stories.tsx} +0 -0
package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrow/WideNarrow.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
-
import { PConnProps } from '
|
|
2
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
3
|
import './WideNarrow.css';
|
|
4
4
|
|
|
5
5
|
interface WideNarrowProps extends PConnProps {
|
|
@@ -54,6 +54,9 @@ export default function WssNavBar(props: WssNavBarProps) {
|
|
|
54
54
|
const [anchorElNav, setAnchorElNav] = useState<null | HTMLElement>(null);
|
|
55
55
|
const [anchorElUser, setAnchorElUser] = useState<null | HTMLElement>(null);
|
|
56
56
|
|
|
57
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
58
|
+
const localeCategory = 'AppShell';
|
|
59
|
+
|
|
57
60
|
const handleOpenNavMenu = (event: React.MouseEvent<HTMLElement>) => {
|
|
58
61
|
setAnchorElNav(event.currentTarget);
|
|
59
62
|
};
|
|
@@ -144,7 +147,7 @@ export default function WssNavBar(props: WssNavBarProps) {
|
|
|
144
147
|
onClose={handleCloseUserMenu}
|
|
145
148
|
>
|
|
146
149
|
<MenuItem onClick={logout}>
|
|
147
|
-
<Typography>
|
|
150
|
+
<Typography>{localizedVal('Log off', localeCategory)}</Typography>
|
|
148
151
|
</MenuItem>
|
|
149
152
|
</Menu>
|
|
150
153
|
</Box>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-boolean-value */
|
|
2
2
|
/* eslint-disable react/no-array-index-key */
|
|
3
|
+
/* eslint-disable no-nested-ternary */
|
|
3
4
|
import { useState, useEffect, useCallback } from 'react';
|
|
4
5
|
import { CircularProgress, IconButton, Menu, MenuItem, Button } from '@material-ui/core';
|
|
5
6
|
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
|
@@ -39,7 +40,10 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
39
40
|
[required, disabled] = [required, disabled].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
|
|
40
41
|
const pConn = getPConnect();
|
|
41
42
|
const caseID = PCore.getStoreValue('.pyID', 'caseInfo.content', pConn.getContextName());
|
|
42
|
-
|
|
43
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
44
|
+
const localeCategory = 'CosmosFields';
|
|
45
|
+
const uploadMultipleFilesLabel = localizedVal('file_upload_text_multiple', localeCategory);
|
|
46
|
+
const uploadSingleFileLabel = localizedVal('file_upload_text_one', localeCategory);
|
|
43
47
|
let categoryName = '';
|
|
44
48
|
if (value && value.pyCategoryName) {
|
|
45
49
|
categoryName = value.pyCategoryName;
|
|
@@ -379,7 +383,13 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
379
383
|
onChange={onFileAdded}
|
|
380
384
|
/>
|
|
381
385
|
<Button style={{ textTransform: 'none' }} variant='outlined' color='primary' component='span'>
|
|
382
|
-
{allowMultiple === 'true'
|
|
386
|
+
{allowMultiple === 'true'
|
|
387
|
+
? uploadMultipleFilesLabel === 'file_upload_text_multiple'
|
|
388
|
+
? 'Choose files'
|
|
389
|
+
: uploadMultipleFilesLabel
|
|
390
|
+
: uploadSingleFileLabel === 'file_upload_text_one'
|
|
391
|
+
? 'Choose a file'
|
|
392
|
+
: uploadSingleFileLabel}
|
|
383
393
|
</Button>
|
|
384
394
|
</label>
|
|
385
395
|
</div>
|
|
@@ -20,6 +20,7 @@ interface PegaDxilMyPageCaseWidgetProps extends PConnProps {
|
|
|
20
20
|
updateDateTime: string;
|
|
21
21
|
updateLabel: string;
|
|
22
22
|
updateOperator: { userName: string; userId: string };
|
|
23
|
+
displayLabel?: any;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const useStyles = makeStyles(theme => ({
|
|
@@ -42,18 +43,19 @@ export default function PegaDxilMyPageCaseWidget(props: PegaDxilMyPageCaseWidget
|
|
|
42
43
|
// const componentName = "Operator";
|
|
43
44
|
const classes = useStyles();
|
|
44
45
|
|
|
45
|
-
const fieldLabel = props
|
|
46
|
+
const fieldLabel = props?.label?.toLowerCase();
|
|
47
|
+
const displayLabel = props?.displayLabel?.toLowerCase();
|
|
46
48
|
let caseOpLabel = '---';
|
|
47
49
|
let caseOpName = '---';
|
|
48
50
|
let caseOpId = '';
|
|
49
51
|
let caseTime = '';
|
|
50
52
|
|
|
51
|
-
if (fieldLabel === 'create operator') {
|
|
53
|
+
if (fieldLabel === 'create operator' || displayLabel === 'create operator') {
|
|
52
54
|
caseOpLabel = props.createLabel;
|
|
53
55
|
caseOpName = props.createOperator.userName;
|
|
54
56
|
caseTime = props.createDateTime;
|
|
55
57
|
caseOpId = props.createOperator.userId;
|
|
56
|
-
} else if (fieldLabel === 'update operator') {
|
|
58
|
+
} else if (fieldLabel === 'update operator' || displayLabel === 'update operator') {
|
|
57
59
|
caseOpLabel = props.updateLabel;
|
|
58
60
|
caseOpName = props.updateOperator.userName;
|
|
59
61
|
caseTime = props.updateDateTime;
|
|
@@ -19,6 +19,7 @@ interface OperatorProps extends PConnProps {
|
|
|
19
19
|
updateDateTime: string;
|
|
20
20
|
updateLabel: string;
|
|
21
21
|
updateOperator: { userName: string; userId: string };
|
|
22
|
+
displayLabel?: any;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const useStyles = makeStyles(theme => ({
|
|
@@ -36,18 +37,19 @@ export default function Operator(props: OperatorProps) {
|
|
|
36
37
|
// const componentName = "Operator";
|
|
37
38
|
const classes = useStyles();
|
|
38
39
|
|
|
39
|
-
const fieldLabel = props
|
|
40
|
+
const fieldLabel = props?.label?.toLowerCase();
|
|
41
|
+
const displayLabel = props?.displayLabel?.toLowerCase();
|
|
40
42
|
let caseOpLabel = '---';
|
|
41
43
|
let caseOpName = '---';
|
|
42
44
|
let caseOpId = '';
|
|
43
45
|
let caseTime = '';
|
|
44
46
|
|
|
45
|
-
if (fieldLabel === 'create operator') {
|
|
47
|
+
if (fieldLabel === 'create operator' || displayLabel === 'create operator') {
|
|
46
48
|
caseOpLabel = props.createLabel;
|
|
47
49
|
caseOpName = props.createOperator.userName;
|
|
48
50
|
caseTime = props.createDateTime;
|
|
49
51
|
caseOpId = props.createOperator.userId;
|
|
50
|
-
} else if (fieldLabel === 'update operator') {
|
|
52
|
+
} else if (fieldLabel === 'update operator' || displayLabel === 'update operator') {
|
|
51
53
|
caseOpLabel = props.updateLabel;
|
|
52
54
|
caseOpName = props.updateOperator.userName;
|
|
53
55
|
caseTime = props.updateDateTime;
|
package/tests/assets/sdk-r/components/createAll/override-sdk/field/CancelAlert/CancelAlert.tsx
CHANGED
|
@@ -7,34 +7,85 @@ import './CancelAlert.css';
|
|
|
7
7
|
|
|
8
8
|
interface CancelAlertProps extends PConnFieldProps {
|
|
9
9
|
// If any, enter additional props that only exist on CancelAlert here
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
heading: string;
|
|
11
|
+
content: string;
|
|
12
|
+
itemKey: string;
|
|
13
|
+
hideDelete: boolean;
|
|
14
|
+
isDataObject: boolean;
|
|
15
|
+
skipReleaseLockRequest: any;
|
|
16
|
+
dismiss: Function;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
export default function CancelAlert(props: CancelAlertProps) {
|
|
15
|
-
const {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const caseInfo = pConn.getCaseInfo();
|
|
21
|
-
const caseName = caseInfo.getName();
|
|
22
|
-
const ID = caseInfo.getID();
|
|
20
|
+
const { heading, content, getPConnect, itemKey: containerItemID, hideDelete, isDataObject, skipReleaseLockRequest, dismiss } = props;
|
|
21
|
+
const actionsAPI = getPConnect().getActionsApi();
|
|
22
|
+
const containerManagerAPI = getPConnect().getContainerManager();
|
|
23
|
+
const isLocalAction = getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION);
|
|
24
|
+
const isBulkAction = getPConnect()?.options?.isBulkAction;
|
|
23
25
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
26
|
+
const broadCastUtils: any = PCore.getCoexistenceManager().getBroadcastUtils();
|
|
27
|
+
const isReverseCoexistence = broadCastUtils.isReverseCoexistenceCaseLoaded();
|
|
24
28
|
const localeCategory = 'ModalContainer';
|
|
29
|
+
const btnIds = {
|
|
30
|
+
SAVE_AND_CLOSE: 'saveAndClose',
|
|
31
|
+
CONTINUE_WORKING: 'continueWorking',
|
|
32
|
+
DELETE: 'delete'
|
|
33
|
+
};
|
|
25
34
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
const [buttonsState, setButtonsState] = useState({
|
|
36
|
+
[btnIds.SAVE_AND_CLOSE]: false,
|
|
37
|
+
[btnIds.DELETE]: false
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
41
|
+
const [snackbarMessage, setSnackbarMessage] = useState('');
|
|
42
|
+
|
|
43
|
+
function disableButton(id) {
|
|
44
|
+
setButtonsState(prevState => ({
|
|
45
|
+
...prevState,
|
|
46
|
+
[id]: true
|
|
47
|
+
}));
|
|
29
48
|
}
|
|
30
49
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
function enableButton(id) {
|
|
51
|
+
setButtonsState(prevState => ({
|
|
52
|
+
...prevState,
|
|
53
|
+
[id]: false
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
34
56
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
57
|
+
function cancelHandler() {
|
|
58
|
+
if (isReverseCoexistence) {
|
|
59
|
+
dismiss(true);
|
|
60
|
+
// @ts-ignore - An argument for 'payload' was not provided.
|
|
61
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.REVERSE_COEXISTENCE_EVENTS.HANDLE_DISCARD);
|
|
62
|
+
} else if (!isDataObject && !isLocalAction && !isBulkAction) {
|
|
63
|
+
disableButton(btnIds.DELETE);
|
|
64
|
+
actionsAPI
|
|
65
|
+
.deleteCaseInCreateStage(containerItemID, hideDelete)
|
|
66
|
+
.then(() => {
|
|
67
|
+
// @ts-ignore - An argument for 'payload' was not provided.
|
|
68
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
|
|
69
|
+
})
|
|
70
|
+
.catch(() => {
|
|
71
|
+
setSnackbarMessage(localizedVal('Delete failed.', localeCategory));
|
|
72
|
+
setShowSnackbar(true);
|
|
73
|
+
})
|
|
74
|
+
.finally(() => {
|
|
75
|
+
enableButton(btnIds.DELETE);
|
|
76
|
+
dismiss(true);
|
|
77
|
+
});
|
|
78
|
+
} else if (isLocalAction) {
|
|
79
|
+
dismiss(true);
|
|
80
|
+
actionsAPI.cancelAssignment(containerItemID);
|
|
81
|
+
} else if (isBulkAction) {
|
|
82
|
+
dismiss(true);
|
|
83
|
+
actionsAPI.cancelBulkAction(containerItemID);
|
|
84
|
+
} else {
|
|
85
|
+
dismiss(true);
|
|
86
|
+
containerManagerAPI.removeContainerItem({ containerItemID, skipReleaseLockRequest });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
38
89
|
|
|
39
90
|
function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
|
|
40
91
|
if (reason === 'clickaway') {
|
|
@@ -43,75 +94,41 @@ export default function CancelAlert(props: CancelAlertProps) {
|
|
|
43
94
|
setShowSnackbar(false);
|
|
44
95
|
}
|
|
45
96
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
showToast(localizedVal('Save failed', localeCategory));
|
|
63
|
-
});
|
|
64
|
-
break;
|
|
65
|
-
|
|
66
|
-
case 'continue':
|
|
67
|
-
dismissCancelAlertOnly();
|
|
68
|
-
break;
|
|
69
|
-
|
|
70
|
-
case 'delete':
|
|
71
|
-
// eslint-disable-next-line no-case-declarations
|
|
72
|
-
const deletePromise = actionsAPI.deleteCaseInCreateStage(itemKey);
|
|
73
|
-
|
|
74
|
-
deletePromise
|
|
75
|
-
.then(() => {
|
|
76
|
-
dismissModal();
|
|
77
|
-
|
|
78
|
-
// @ts-ignore - second parameter “payload” for publish method should be optional
|
|
79
|
-
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
|
|
80
|
-
})
|
|
81
|
-
.catch(() => {
|
|
82
|
-
showToast(localizedVal('Delete failed.', localeCategory));
|
|
83
|
-
});
|
|
84
|
-
break;
|
|
97
|
+
const leftButton = (
|
|
98
|
+
<Button
|
|
99
|
+
name={btnIds.CONTINUE_WORKING}
|
|
100
|
+
variant='contained'
|
|
101
|
+
color='secondary'
|
|
102
|
+
onClick={() => {
|
|
103
|
+
dismiss();
|
|
104
|
+
if (isReverseCoexistence) {
|
|
105
|
+
broadCastUtils.setCallBackFunction(null);
|
|
106
|
+
broadCastUtils.setIsDirtyDialogActive(false);
|
|
107
|
+
}
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
{localizedVal('Go back', localeCategory)}
|
|
111
|
+
</Button>
|
|
112
|
+
);
|
|
85
113
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
114
|
+
const rightButton = (
|
|
115
|
+
<Button name={btnIds.DELETE} variant='contained' color='primary' disabled={buttonsState[btnIds.DELETE]} onClick={cancelHandler}>
|
|
116
|
+
{localizedVal('Discard', localeCategory)}
|
|
117
|
+
</Button>
|
|
118
|
+
);
|
|
90
119
|
|
|
91
120
|
return (
|
|
92
121
|
<>
|
|
93
122
|
<div className='cancel-alert-background'>
|
|
94
123
|
<div className='cancel-alert-top'>
|
|
95
|
-
<h3>{
|
|
124
|
+
<h3>{localizedVal(heading, localeCategory)}</h3>
|
|
96
125
|
<div>
|
|
97
|
-
<p>{
|
|
98
|
-
<p>{localizedVal('Alternatively, you can continue working or save your work for later.', localeCategory)}</p>
|
|
126
|
+
<p>{localizedVal(content, localeCategory)}</p>
|
|
99
127
|
</div>
|
|
100
128
|
<div className='action-controls'>
|
|
101
129
|
<Grid container spacing={4} justifyContent='space-between'>
|
|
102
|
-
<Grid item>
|
|
103
|
-
|
|
104
|
-
{localizedVal('Save for later', localeCategory)}
|
|
105
|
-
</Button>
|
|
106
|
-
</Grid>
|
|
107
|
-
<Grid item>
|
|
108
|
-
<Button variant='outlined' color='primary' onClick={() => buttonClick('continue')}>
|
|
109
|
-
{localizedVal('Continue Working', localeCategory)}
|
|
110
|
-
</Button>
|
|
111
|
-
<Button variant='contained' color='primary' onClick={() => buttonClick('delete')}>
|
|
112
|
-
{localizedVal('Delete', localeCategory)}
|
|
113
|
-
</Button>
|
|
114
|
-
</Grid>
|
|
130
|
+
<Grid item>{leftButton}</Grid>
|
|
131
|
+
<Grid item>{rightButton}</Grid>
|
|
115
132
|
</Grid>
|
|
116
133
|
</div>
|
|
117
134
|
</div>
|
package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Assignment/Assignment.tsx
CHANGED
|
@@ -70,6 +70,20 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
70
70
|
return arIndicies;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
function getStepsInfo(steps, formedSteps: any = []) {
|
|
74
|
+
steps.forEach(step => {
|
|
75
|
+
if (step.name) {
|
|
76
|
+
step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
|
|
77
|
+
}
|
|
78
|
+
if (step.steps) {
|
|
79
|
+
formedSteps = getStepsInfo(step.steps, formedSteps);
|
|
80
|
+
} else {
|
|
81
|
+
formedSteps.push(step);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return formedSteps;
|
|
85
|
+
}
|
|
86
|
+
|
|
73
87
|
useEffect(() => {
|
|
74
88
|
if (children) {
|
|
75
89
|
const firstChild = Array.isArray(children) ? children[0] : children;
|
|
@@ -97,13 +111,13 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
97
111
|
} else {
|
|
98
112
|
setIsVertical(false);
|
|
99
113
|
}
|
|
100
|
-
|
|
101
|
-
steps
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
114
|
+
|
|
115
|
+
if (oCaseInfo?.navigation?.steps) {
|
|
116
|
+
const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
|
|
117
|
+
const formedSteps = getStepsInfo(steps);
|
|
118
|
+
setArNavigationSteps(formedSteps);
|
|
119
|
+
}
|
|
120
|
+
|
|
107
121
|
setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
|
|
108
122
|
}
|
|
109
123
|
}
|
|
@@ -116,6 +116,8 @@ export default function NavBar(props: NavBarProps) {
|
|
|
116
116
|
const [bShowCaseTypes, setBShowCaseTypes] = useState(true);
|
|
117
117
|
const [bShowOperatorButtons, setBShowOperatorButtons] = useState(false);
|
|
118
118
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
119
|
+
const localeUtils = PCore.getLocaleUtils();
|
|
120
|
+
const localeReference = pConn.getValue('.pyLocaleReference');
|
|
119
121
|
|
|
120
122
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
121
123
|
const localeCategory = 'AppShell';
|
|
@@ -231,7 +233,7 @@ export default function NavBar(props: NavBarProps) {
|
|
|
231
233
|
<ListItemIcon>
|
|
232
234
|
<WorkOutlineIcon fontSize='large' />
|
|
233
235
|
</ListItemIcon>
|
|
234
|
-
<ListItemText primary={caseType.pyLabel} />
|
|
236
|
+
<ListItemText primary={localeUtils.getLocaleValue(caseType.pyLabel, '', localeReference)} />
|
|
235
237
|
</ListItem>
|
|
236
238
|
))}
|
|
237
239
|
</List>
|
|
@@ -240,7 +242,7 @@ export default function NavBar(props: NavBarProps) {
|
|
|
240
242
|
{navPages.map(page => (
|
|
241
243
|
<ListItem button onClick={() => navPanelButtonClick(page)} key={page.pyLabel}>
|
|
242
244
|
<ListItemIcon>{iconMap[page.pxPageViewIcon]}</ListItemIcon>
|
|
243
|
-
<ListItemText primary={page.pyLabel} />
|
|
245
|
+
<ListItemText primary={localeUtils.getLocaleValue(page.pyLabel, '', localeReference)} />
|
|
244
246
|
</ListItem>
|
|
245
247
|
))}
|
|
246
248
|
</List>
|
|
@@ -278,7 +280,7 @@ export default function NavBar(props: NavBarProps) {
|
|
|
278
280
|
<ListItemIcon>
|
|
279
281
|
<ArrowBackIcon fontSize='large' />
|
|
280
282
|
</ListItemIcon>
|
|
281
|
-
<Typography variant='inherit'>{localizedVal('
|
|
283
|
+
<Typography variant='inherit'>{localizedVal('Log off', localeCategory)}</Typography>
|
|
282
284
|
</MenuItem>
|
|
283
285
|
</Menu>
|
|
284
286
|
</>
|
package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseSummary/CaseSummary.tsx
CHANGED
|
@@ -17,7 +17,8 @@ export default function CaseSummary(props: PropsWithChildren<CaseSummaryProps>)
|
|
|
17
17
|
// const { status, showStatus } = theConfigProps;
|
|
18
18
|
const status = theConfigProps.status;
|
|
19
19
|
const showStatus = theConfigProps.showStatus;
|
|
20
|
-
|
|
20
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
21
|
+
const localeCategory = 'ModalContainer';
|
|
21
22
|
// from Constellation DX Components
|
|
22
23
|
// get the primary and secondary fields with the raw data (which has the non-resolved property values)
|
|
23
24
|
// const regionsRaw = getPConnect().getRawMetadata().children;
|
|
@@ -29,13 +30,54 @@ export default function CaseSummary(props: PropsWithChildren<CaseSummaryProps>)
|
|
|
29
30
|
let arPrimaryFields: any[] = [];
|
|
30
31
|
let arSecondaryFields: any[] = [];
|
|
31
32
|
|
|
33
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
34
|
+
function prepareComponentInCaseSummary(pConnectMeta, getPConnect) {
|
|
35
|
+
const { config, children } = pConnectMeta;
|
|
36
|
+
const pConnect = getPConnect();
|
|
37
|
+
|
|
38
|
+
const caseSummaryComponentObject: any = {};
|
|
39
|
+
|
|
40
|
+
const { type } = pConnectMeta;
|
|
41
|
+
const createdComponent = pConnect.createComponent({
|
|
42
|
+
type,
|
|
43
|
+
children: children ? [...children] : [],
|
|
44
|
+
config: {
|
|
45
|
+
...config
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
caseSummaryComponentObject.value = createdComponent;
|
|
50
|
+
return caseSummaryComponentObject;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function prepareCaseSummaryData(summaryFieldChildren) {
|
|
54
|
+
const convertChildrenToSummaryData = kid => {
|
|
55
|
+
return kid?.map((childItem, index) => {
|
|
56
|
+
const childMeta = childItem.getPConnect().meta;
|
|
57
|
+
const caseSummaryComponentObject = prepareComponentInCaseSummary(childMeta, childItem.getPConnect);
|
|
58
|
+
caseSummaryComponentObject.id = index + 1;
|
|
59
|
+
return caseSummaryComponentObject;
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
return summaryFieldChildren ? convertChildrenToSummaryData(summaryFieldChildren?.getChildren()) : undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
32
65
|
for (const child of children as ReactElement[]) {
|
|
33
66
|
const childPConn = (child as ReactElement).props.getPConnect();
|
|
34
67
|
const childPConnData = childPConn.resolveConfigProps(childPConn.getRawMetadata());
|
|
35
68
|
if (childPConnData.name.toLowerCase() === 'primary fields') {
|
|
36
69
|
arPrimaryFields = childPConnData.children;
|
|
70
|
+
arPrimaryFields.forEach(field => {
|
|
71
|
+
if (field.config?.value && typeof field.config?.value === 'string') {
|
|
72
|
+
field.config.value = localizedVal(field.config.value, localeCategory);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
37
75
|
} else if (childPConnData.name.toLowerCase() === 'secondary fields') {
|
|
76
|
+
const secondarySummaryFields = prepareCaseSummaryData(childPConn);
|
|
38
77
|
arSecondaryFields = childPConnData.children;
|
|
78
|
+
arSecondaryFields.forEach((field, index) => {
|
|
79
|
+
field.config.displayLabel = secondarySummaryFields[index]?.value?.props?.label;
|
|
80
|
+
});
|
|
39
81
|
}
|
|
40
82
|
}
|
|
41
83
|
|
|
@@ -178,7 +178,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
|
178
178
|
const actionsAPI = thePConn.getActionsApi();
|
|
179
179
|
const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
|
|
180
180
|
|
|
181
|
-
openLocalAction(editAction.ID, { ...editAction });
|
|
181
|
+
openLocalAction(editAction.ID, { ...editAction, containerName: 'modal', type: 'express' });
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
function getActionButtonsHtml(): any {
|
|
@@ -4,6 +4,9 @@ import Menu from '@material-ui/core/Menu';
|
|
|
4
4
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
5
5
|
|
|
6
6
|
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
|
+
import Snackbar from '@material-ui/core/Snackbar';
|
|
8
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
9
|
+
import CloseIcon from '@material-ui/icons/Close';
|
|
7
10
|
|
|
8
11
|
interface CaseViewActionsMenuProps extends PConnProps {
|
|
9
12
|
// If any, enter additional props that only exist on this component
|
|
@@ -23,6 +26,9 @@ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
|
|
|
23
26
|
|
|
24
27
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
25
28
|
|
|
29
|
+
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
30
|
+
const [snackbarMessage, setSnackbarMessage]: any = useState('');
|
|
31
|
+
|
|
26
32
|
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
27
33
|
setAnchorEl(event.currentTarget);
|
|
28
34
|
};
|
|
@@ -33,6 +39,18 @@ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
|
|
|
33
39
|
|
|
34
40
|
const arMenuItems: any[] = [];
|
|
35
41
|
|
|
42
|
+
function showToast(message: string) {
|
|
43
|
+
setSnackbarMessage(message);
|
|
44
|
+
setShowSnackbar(true);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
|
|
48
|
+
if (reason === 'clickaway') {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
setShowSnackbar(false);
|
|
52
|
+
}
|
|
53
|
+
|
|
36
54
|
function _actionMenuActionsClick(data) {
|
|
37
55
|
const actionsAPI = thePConn.getActionsApi();
|
|
38
56
|
const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
|
|
@@ -51,7 +69,11 @@ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
|
|
|
51
69
|
const openProcessAction = actionsAPI.openProcessAction.bind(actionsAPI);
|
|
52
70
|
openProcessAction(process.ID, {
|
|
53
71
|
...process
|
|
54
|
-
})
|
|
72
|
+
})
|
|
73
|
+
.then(() => {})
|
|
74
|
+
.catch(() => {
|
|
75
|
+
showToast(`${process.name} Submit failed!`);
|
|
76
|
+
});
|
|
55
77
|
handleClose();
|
|
56
78
|
}
|
|
57
79
|
|
|
@@ -79,6 +101,17 @@ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
|
|
|
79
101
|
<Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
|
|
80
102
|
{arMenuItems}
|
|
81
103
|
</Menu>
|
|
104
|
+
<Snackbar
|
|
105
|
+
open={showSnackbar}
|
|
106
|
+
autoHideDuration={3000}
|
|
107
|
+
onClose={handleSnackbarClose}
|
|
108
|
+
message={snackbarMessage}
|
|
109
|
+
action={
|
|
110
|
+
<IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
|
|
111
|
+
<CloseIcon fontSize='small' />
|
|
112
|
+
</IconButton>
|
|
113
|
+
}
|
|
114
|
+
/>
|
|
82
115
|
</>
|
|
83
116
|
);
|
|
84
117
|
}
|
|
@@ -141,7 +141,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
141
141
|
// Getting current context
|
|
142
142
|
const context = getPConnect().getContextName();
|
|
143
143
|
const resolvedList = getReferenceList(pConn);
|
|
144
|
-
const pageReference = `${pConn.getPageReference()}${resolvedList}`;
|
|
145
144
|
pConn.setReferenceList(resolvedList);
|
|
146
145
|
const menuIconOverride$ = Utils.getImageSrc('trash', Utils.getSDKStaticConentUrl());
|
|
147
146
|
|
|
@@ -288,10 +287,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
288
287
|
pConn
|
|
289
288
|
.getActionsApi()
|
|
290
289
|
.openEmbeddedDataModal(defaultView, pConn, referenceListStr, referenceList.length, PCore.getConstants().RESOURCE_STATUS.CREATE);
|
|
291
|
-
} else if (PCore.getPCoreVersion()?.includes('8.7')) {
|
|
292
|
-
pConn.getListActions().insert({ classID: contextClass }, referenceList.length, pageReference);
|
|
293
290
|
} else {
|
|
294
|
-
pConn.getListActions().insert({ classID: contextClass }, referenceList.length
|
|
291
|
+
pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
|
|
295
292
|
}
|
|
296
293
|
};
|
|
297
294
|
|
|
@@ -312,11 +309,11 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
312
309
|
|
|
313
310
|
const deleteRecord = () => {
|
|
314
311
|
setEditAnchorEl(null);
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
312
|
+
pConn.getListActions().deleteEntry(selectedRowIndex.current);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const deleteRecordFromInlineEditable = (index: number) => {
|
|
316
|
+
pConn.getListActions().deleteEntry(index);
|
|
320
317
|
};
|
|
321
318
|
|
|
322
319
|
function buildElementsForTable() {
|
|
@@ -616,7 +613,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
616
613
|
className='psdk-utility-button'
|
|
617
614
|
id='delete-button'
|
|
618
615
|
aria-label='Delete Cell'
|
|
619
|
-
onClick={() =>
|
|
616
|
+
onClick={() => deleteRecordFromInlineEditable(index)}
|
|
620
617
|
>
|
|
621
618
|
<img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$} />
|
|
622
619
|
</button>
|
|
@@ -632,7 +629,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
632
629
|
.slice(0)
|
|
633
630
|
.map((row, index) => {
|
|
634
631
|
return (
|
|
635
|
-
|
|
632
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
633
|
+
<TableRow key={index}>
|
|
636
634
|
{displayedColumns.map(colKey => {
|
|
637
635
|
return (
|
|
638
636
|
<TableCell key={colKey} className={classes.tableCell}>
|
package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrow/WideNarrow.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
-
import { PConnProps } from '
|
|
2
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
3
|
import './WideNarrow.css';
|
|
4
4
|
|
|
5
5
|
interface WideNarrowProps extends PConnProps {
|
package/tests/assets/sdk-r/components/createAll/override-sdk/template/WssNavBar/WssNavBar.tsx
CHANGED
|
@@ -54,6 +54,9 @@ export default function WssNavBar(props: WssNavBarProps) {
|
|
|
54
54
|
const [anchorElNav, setAnchorElNav] = useState<null | HTMLElement>(null);
|
|
55
55
|
const [anchorElUser, setAnchorElUser] = useState<null | HTMLElement>(null);
|
|
56
56
|
|
|
57
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
58
|
+
const localeCategory = 'AppShell';
|
|
59
|
+
|
|
57
60
|
const handleOpenNavMenu = (event: React.MouseEvent<HTMLElement>) => {
|
|
58
61
|
setAnchorElNav(event.currentTarget);
|
|
59
62
|
};
|
|
@@ -144,7 +147,7 @@ export default function WssNavBar(props: WssNavBarProps) {
|
|
|
144
147
|
onClose={handleCloseUserMenu}
|
|
145
148
|
>
|
|
146
149
|
<MenuItem onClick={logout}>
|
|
147
|
-
<Typography>
|
|
150
|
+
<Typography>{localizedVal('Log off', localeCategory)}</Typography>
|
|
148
151
|
</MenuItem>
|
|
149
152
|
</Menu>
|
|
150
153
|
</Box>
|