@pega/dx-component-builder-sdk 23.1.12 → 23.1.14
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 +4 -4
- package/package.json +1 -1
- package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +3 -2
- package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.tsx.mustache +8 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +3 -9
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +7 -15
- package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/demo.stories.tsx.mustache +20 -0
- package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +38 -37
- package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +3 -3
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.tsx.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +5 -3
- package/src/tasks/map/map.js +29 -8
- 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/field/Checkbox/Checkbox.tsx +3 -1
- package/tests/assets/sdk-r/components/create/override-sdk/field/Currency/Currency.tsx +10 -16
- package/tests/assets/sdk-r/components/create/override-sdk/field/Decimal/Decimal.tsx +6 -10
- package/tests/assets/sdk-r/components/create/override-sdk/field/Group/Group.tsx +2 -0
- package/tests/assets/sdk-r/components/create/override-sdk/field/Percentage/Percentage.tsx +41 -36
- 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/ListView/ListView.tsx +2 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/utils.ts +3 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +28 -12
- 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/create/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyBoolean/index.tsx +3 -2
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/index.tsx +7 -15
- 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/field/Pega_DXIL_MyDecimal/index.tsx +3 -9
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/demo.stories.tsx +20 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/index.tsx +38 -37
- package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyCaseWidget/index.tsx +3 -3
- package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +7 -0
- 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/field/Checkbox/Checkbox.tsx +3 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/field/Currency/Currency.tsx +10 -16
- package/tests/assets/sdk-r/components/createAll/override-sdk/field/Decimal/Decimal.tsx +6 -10
- package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/Group.tsx +2 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/field/Percentage/Percentage.tsx +41 -36
- 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/ListView/ListView.tsx +2 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/utils.ts +3 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +28 -12
- 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/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
- 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
|
@@ -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
|
}
|
|
@@ -154,7 +154,8 @@ export default function ListView(props: ListViewProps) {
|
|
|
154
154
|
paper: {
|
|
155
155
|
width: '100%',
|
|
156
156
|
marginTop: theme.spacing(2),
|
|
157
|
-
marginBottom: theme.spacing(2)
|
|
157
|
+
marginBottom: theme.spacing(2),
|
|
158
|
+
display: 'grid'
|
|
158
159
|
},
|
|
159
160
|
search: {
|
|
160
161
|
padding: '5px 5px'
|
|
@@ -680,7 +680,9 @@ export const readContextResponse = async (context, params) => {
|
|
|
680
680
|
if (compositeKeys.length) {
|
|
681
681
|
otherContext.setCompositeKeys(compositeKeys);
|
|
682
682
|
}
|
|
683
|
-
otherContext
|
|
683
|
+
if (otherContext) {
|
|
684
|
+
otherContext.fetchRowActionDetails = null;
|
|
685
|
+
}
|
|
684
686
|
}
|
|
685
687
|
|
|
686
688
|
const presetArray = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
|
-
import React, { PropsWithChildren, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import Table from '@material-ui/core/Table';
|
|
4
4
|
import TableBody from '@material-ui/core/TableBody';
|
|
5
5
|
import TableCell from '@material-ui/core/TableCell';
|
|
@@ -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
|
|
|
@@ -198,6 +197,20 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
198
197
|
// Constellation DX Components.
|
|
199
198
|
const fieldDefs = buildFieldsForTable(rawFields, resolvedFields, showDeleteButton);
|
|
200
199
|
|
|
200
|
+
useLayoutEffect(() => {
|
|
201
|
+
if (allowEditingInModal) {
|
|
202
|
+
getPConnect()
|
|
203
|
+
.getListActions()
|
|
204
|
+
.initDefaultPageInstructions(
|
|
205
|
+
getPConnect().getReferenceList(),
|
|
206
|
+
fieldDefs.filter(item => item.name).map(item => item.name)
|
|
207
|
+
);
|
|
208
|
+
} else {
|
|
209
|
+
// @ts-ignore - An argument for 'fields' was not provided
|
|
210
|
+
getPConnect().getListActions().initDefaultPageInstructions(getPConnect().getReferenceList());
|
|
211
|
+
}
|
|
212
|
+
}, []);
|
|
213
|
+
|
|
201
214
|
const displayedColumns = fieldDefs.map(field => {
|
|
202
215
|
return field.name ? field.name : field.cellRenderer;
|
|
203
216
|
});
|
|
@@ -288,11 +301,13 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
288
301
|
pConn
|
|
289
302
|
.getActionsApi()
|
|
290
303
|
.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
304
|
} else {
|
|
294
|
-
pConn.getListActions().insert({ classID: contextClass }, referenceList.length
|
|
305
|
+
pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
|
|
295
306
|
}
|
|
307
|
+
|
|
308
|
+
getPConnect().clearErrorMessages({
|
|
309
|
+
property: (getPConnect().getStateProps() as any)?.referenceList?.substring(1)
|
|
310
|
+
} as any);
|
|
296
311
|
};
|
|
297
312
|
|
|
298
313
|
const editRecord = () => {
|
|
@@ -312,11 +327,11 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
312
327
|
|
|
313
328
|
const deleteRecord = () => {
|
|
314
329
|
setEditAnchorEl(null);
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
330
|
+
pConn.getListActions().deleteEntry(selectedRowIndex.current);
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
const deleteRecordFromInlineEditable = (index: number) => {
|
|
334
|
+
pConn.getListActions().deleteEntry(index);
|
|
320
335
|
};
|
|
321
336
|
|
|
322
337
|
function buildElementsForTable() {
|
|
@@ -616,7 +631,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
616
631
|
className='psdk-utility-button'
|
|
617
632
|
id='delete-button'
|
|
618
633
|
aria-label='Delete Cell'
|
|
619
|
-
onClick={() =>
|
|
634
|
+
onClick={() => deleteRecordFromInlineEditable(index)}
|
|
620
635
|
>
|
|
621
636
|
<img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$} />
|
|
622
637
|
</button>
|
|
@@ -632,7 +647,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
632
647
|
.slice(0)
|
|
633
648
|
.map((row, index) => {
|
|
634
649
|
return (
|
|
635
|
-
|
|
650
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
651
|
+
<TableRow key={index}>
|
|
636
652
|
{displayedColumns.map(colKey => {
|
|
637
653
|
return (
|
|
638
654
|
<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>
|
package/tests/assets/sdk-r/components/createAll/override-sdk/widget/Attachment/Attachment.tsx
CHANGED
|
@@ -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>
|
package/tests/assets/sdk-r/components/createAll/override-sdk/widget/QuickCreate/QuickCreate.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
1
2
|
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
2
3
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
3
4
|
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
@@ -25,38 +26,64 @@ export default function QuickCreate(props: QuickCreateProps) {
|
|
|
25
26
|
});
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
let icon = Utils.getImageSrc('polaris-solid', Utils.getSDKStaticConentUrl());
|
|
38
|
-
let label = '';
|
|
29
|
+
const [quickCreatecases, setCases] = useState([]);
|
|
30
|
+
|
|
31
|
+
/* If the classFilter is empty and has no entries - we will default to the default set of case types
|
|
32
|
+
It will usually come from the envInfo but for Launchpad, this is not populated - instead get the list of cases from the store */
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const cases: any = [];
|
|
35
|
+
const defaultCases: any = [];
|
|
36
|
+
const envInfo = PCore.getEnvironmentInfo();
|
|
37
|
+
if (envInfo?.environmentInfoObject?.pyCaseTypeList) {
|
|
39
38
|
envInfo.environmentInfoObject.pyCaseTypeList.forEach(casetype => {
|
|
40
|
-
if (casetype.
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
if (casetype.pyWorkTypeName && casetype.pyWorkTypeImplementationClassName) {
|
|
40
|
+
defaultCases.push({
|
|
41
|
+
classname: casetype.pyWorkTypeImplementationClassName,
|
|
42
|
+
onClick: () => {
|
|
43
|
+
createCase(casetype.pyWorkTypeImplementationClassName);
|
|
44
|
+
},
|
|
45
|
+
...(showCaseIcons && { icon: Utils.getImageSrc(casetype?.pxIcon, Utils.getSDKStaticConentUrl()) }),
|
|
46
|
+
label: casetype.pyWorkTypeName
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
const pConnectInAppContext = PCore.createPConnect({
|
|
52
|
+
options: { context: PCore.getConstants().APP.APP }
|
|
53
|
+
}).getPConnect();
|
|
54
|
+
const pyPortalInAppContext = pConnectInAppContext.getValue('pyPortal') as any;
|
|
55
|
+
pyPortalInAppContext?.pyCaseTypesAvailableToCreate?.forEach(casetype => {
|
|
56
|
+
if (casetype.pyClassName && casetype.pyLabel) {
|
|
57
|
+
defaultCases.push({
|
|
58
|
+
classname: casetype.pyClassName,
|
|
59
|
+
onClick: () => {
|
|
60
|
+
createCase(casetype.pyClassName);
|
|
61
|
+
},
|
|
62
|
+
...(showCaseIcons && { icon: Utils.getImageSrc(casetype?.pxIcon, Utils.getSDKStaticConentUrl()) }),
|
|
63
|
+
label: casetype.pyLabel
|
|
64
|
+
});
|
|
43
65
|
}
|
|
44
66
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* If classFilter is not empty - filter from the list of defaultCases */
|
|
70
|
+
if (classFilter?.length > 0) {
|
|
71
|
+
classFilter.forEach(item => {
|
|
72
|
+
defaultCases.forEach(casetype => {
|
|
73
|
+
if (casetype.classname === item) {
|
|
74
|
+
cases.push(casetype);
|
|
75
|
+
}
|
|
52
76
|
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
});
|
|
78
|
+
setCases(cases);
|
|
79
|
+
} else {
|
|
80
|
+
setCases(defaultCases);
|
|
81
|
+
}
|
|
82
|
+
}, []);
|
|
56
83
|
|
|
57
84
|
return (
|
|
58
85
|
<div>
|
|
59
|
-
<WssQuickCreate heading={heading} actions={
|
|
86
|
+
<WssQuickCreate heading={heading} actions={quickCreatecases} />
|
|
60
87
|
</div>
|
|
61
88
|
);
|
|
62
89
|
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {PConnect } from '@pega/pcore-pconnect-typedefs';
|
|
2
|
-
|
|
3
|
-
// PConnProps.d.ts
|
|
4
|
-
// This gives us a place to have each component (which is most DX Components) that is
|
|
5
|
-
// expected to have a getPConnect extend its props (from BaseProps)
|
|
6
|
-
// such that every component will be expected to have a getPConnect() function
|
|
7
|
-
// that returns a PConnect object. (new/better way of doing .propTypes).
|
|
8
|
-
// This PConnProps can be extended to include other props that we know are in every component
|
|
9
|
-
export interface PConnProps {
|
|
10
|
-
// getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
|
|
11
|
-
getPConnect: () => typeof PConnect;
|
|
12
|
-
|
|
13
|
-
// Allow any/all other key/value pairs in the BaseProps for now
|
|
14
|
-
// TODO: refine which other props are always expected for various component
|
|
15
|
-
// types and consider further interface "subclassing". For example, we may
|
|
16
|
-
// want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
|
|
17
|
-
// and any other props that every Form component expects.
|
|
18
|
-
// For example, see the PConnFieldProps below.
|
|
19
|
-
// NOTE: if you uncomment the line below, the PConnProps type will allow
|
|
20
|
-
// otherwise undefined types to appear. This can be helpful for debugging
|
|
21
|
-
// or when adding new components whose types aren't yet known.
|
|
22
|
-
// [key: string]: any;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// PConnFieldProps extends PConnProps to bring in the common properties that are
|
|
27
|
-
// associated with most field components (ex: Dropdown, TextInput, etc.) in the
|
|
28
|
-
// components/field directory
|
|
29
|
-
export interface PConnFieldProps extends PConnProps {
|
|
30
|
-
label: string,
|
|
31
|
-
required: boolean,
|
|
32
|
-
disabled: boolean,
|
|
33
|
-
value: any,
|
|
34
|
-
validatemessage: string,
|
|
35
|
-
status?: string,
|
|
36
|
-
onChange?: any,
|
|
37
|
-
onBlur?: any,
|
|
38
|
-
readOnly: boolean,
|
|
39
|
-
testId: string,
|
|
40
|
-
helperText: string,
|
|
41
|
-
displayMode?: string,
|
|
42
|
-
hideLabel: boolean,
|
|
43
|
-
placeholder?: string,
|
|
44
|
-
fieldMetadata?: any,
|
|
45
|
-
additionalProps?: any
|
|
46
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import { withKnobs } from '@storybook/addon-knobs';
|
|
6
|
-
|
|
7
|
-
import { stateProps, configProps } from './mock';
|
|
8
|
-
|
|
9
|
-
import PegaDxilMyTestText from './index';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'PegaDxilMyTestText',
|
|
13
|
-
decorators: [withKnobs],
|
|
14
|
-
component: PegaDxilMyTestText
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const BasePegaDxilMyTestText = () => {
|
|
18
|
-
|
|
19
|
-
const [value, setValue] = useState(configProps.value);
|
|
20
|
-
|
|
21
|
-
const props = {
|
|
22
|
-
value,
|
|
23
|
-
placeholder: configProps.placeholder,
|
|
24
|
-
label: configProps.label,
|
|
25
|
-
testId: configProps.testId,
|
|
26
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
27
|
-
|
|
28
|
-
getPConnect: () => {
|
|
29
|
-
return {
|
|
30
|
-
getStateProps: () => {
|
|
31
|
-
return stateProps;
|
|
32
|
-
},
|
|
33
|
-
getActionsApi: () => {
|
|
34
|
-
return {
|
|
35
|
-
updateFieldValue: (propName, theValue) => {
|
|
36
|
-
setValue(theValue);
|
|
37
|
-
},
|
|
38
|
-
triggerFieldChange: () => {/* nothing */}
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
ignoreSuggestion: () => {/* nothing */},
|
|
42
|
-
acceptSuggestion: () => {/* nothing */},
|
|
43
|
-
setInheritedProps: () => {/* nothing */},
|
|
44
|
-
resolveConfigProps: () => {/* nothing */}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<>
|
|
51
|
-
<PegaDxilMyTestText {...props} />
|
|
52
|
-
</>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import { Input } from '@pega/cosmos-react-core';
|
|
3
|
-
|
|
4
|
-
import type { PConnFieldProps } from './PConnProps';
|
|
5
|
-
|
|
6
|
-
import StyledPegaDxilMyTestTextWrapper from './styles';
|
|
7
|
-
|
|
8
|
-
// interface for props
|
|
9
|
-
interface PegaDxilMyTestTextProps extends PConnFieldProps {
|
|
10
|
-
// If any, enter additional props that only exist on TextInput here
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// interface for StateProps object
|
|
15
|
-
interface StateProps {
|
|
16
|
-
value: string;
|
|
17
|
-
hasSuggestions: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Duplicated runtime code from Constellation Design System Component
|
|
21
|
-
|
|
22
|
-
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
23
|
-
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
24
|
-
export default function PegaDxilMyTestText(props: PegaDxilMyTestTextProps) {
|
|
25
|
-
const { getPConnect, value, placeholder, disabled, readOnly, required, label, hideLabel, testId } = props;
|
|
26
|
-
|
|
27
|
-
const pConn = getPConnect();
|
|
28
|
-
const actions = pConn.getActionsApi();
|
|
29
|
-
const stateProps = pConn.getStateProps() as StateProps;
|
|
30
|
-
const propName: string = stateProps.value;
|
|
31
|
-
|
|
32
|
-
const handleOnChange = (event: any) => {
|
|
33
|
-
const { value: updatedValue } = event.target;
|
|
34
|
-
actions.updateFieldValue(propName, updatedValue);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<StyledPegaDxilMyTestTextWrapper>
|
|
39
|
-
<Input
|
|
40
|
-
type='text'
|
|
41
|
-
value={value}
|
|
42
|
-
label={label}
|
|
43
|
-
labelHidden={hideLabel}
|
|
44
|
-
placeholder={placeholder}
|
|
45
|
-
disabled={disabled}
|
|
46
|
-
readOnly={readOnly}
|
|
47
|
-
required={required}
|
|
48
|
-
onChange={handleOnChange}
|
|
49
|
-
testId={testId}
|
|
50
|
-
/>
|
|
51
|
-
</StyledPegaDxilMyTestTextWrapper>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
PegaDxilMyTestText.defaultProps = {
|
|
56
|
-
value: '',
|
|
57
|
-
placeholder: '',
|
|
58
|
-
disabled: false,
|
|
59
|
-
readOnly: false,
|
|
60
|
-
required: false,
|
|
61
|
-
testId: ''
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
PegaDxilMyTestText.propTypes = {
|
|
65
|
-
label: PropTypes.string,
|
|
66
|
-
value: PropTypes.string,
|
|
67
|
-
placeholder: PropTypes.string,
|
|
68
|
-
getPConnect: PropTypes.func.isRequired,
|
|
69
|
-
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
70
|
-
readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
71
|
-
required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
72
|
-
testId: PropTypes.string
|
|
73
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
export const configProps = {
|
|
4
|
-
value: '',
|
|
5
|
-
label: 'Text Sample',
|
|
6
|
-
placeholder: 'Text Placeholder',
|
|
7
|
-
helperText: 'Text Helper Text',
|
|
8
|
-
testId: 'Text-12345678',
|
|
9
|
-
hasSuggestions: false
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const stateProps = {
|
|
13
|
-
value: '.TextSample',
|
|
14
|
-
hasSuggestions: false
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// utilizing theming, comment out, if want individual style
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Configuration } from '@pega/cosmos-react-core';
|
|
5
|
-
|
|
6
|
-
export default styled(Configuration)``;
|
|
7
|
-
|
|
8
|
-
// individual style, comment out above, and uncomment here and add styles
|
|
9
|
-
// import styled, { css } from 'styled-components';
|
|
10
|
-
//
|
|
11
|
-
// export default styled.div(() => {
|
|
12
|
-
// return css`
|
|
13
|
-
// margin: 0px 0;
|
|
14
|
-
// `;
|
|
15
|
-
// });
|
package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/config.json
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Pega_DXIL_MyTestText",
|
|
3
|
-
"label": "My Test Text",
|
|
4
|
-
"description": "My Test Text Description",
|
|
5
|
-
"organization": "Pega",
|
|
6
|
-
"version": "0.0.1",
|
|
7
|
-
"library": "DXIL",
|
|
8
|
-
"allowedApplications": [],
|
|
9
|
-
"componentKey": "Pega_DXIL_MyTestText",
|
|
10
|
-
"type": "Field",
|
|
11
|
-
"subtype": "Text",
|
|
12
|
-
"icon": "images/pz-url-active.svg",
|
|
13
|
-
"properties": [
|
|
14
|
-
{
|
|
15
|
-
"name": "label",
|
|
16
|
-
"label": "Field label",
|
|
17
|
-
"format": "TEXT",
|
|
18
|
-
"required": true
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"name": "readOnly",
|
|
22
|
-
"label": "Edit mode",
|
|
23
|
-
"format": "READONLY"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"label": "Input settings",
|
|
27
|
-
"format": "GROUP",
|
|
28
|
-
"visibility": "(!readOnly = true)",
|
|
29
|
-
"properties": [
|
|
30
|
-
{
|
|
31
|
-
"name": "placeholder",
|
|
32
|
-
"label": "Placeholder",
|
|
33
|
-
"format": "TEXT"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"name": "helperText",
|
|
37
|
-
"label": "Helper text",
|
|
38
|
-
"format": "TEXT"
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"label": "Conditions",
|
|
44
|
-
"format": "GROUP",
|
|
45
|
-
"properties": [
|
|
46
|
-
{
|
|
47
|
-
"name": "required",
|
|
48
|
-
"label": "Required",
|
|
49
|
-
"format": "REQUIRED",
|
|
50
|
-
"visibility": "(!readOnly = true)"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"name": "disabled",
|
|
54
|
-
"label": "Disabled",
|
|
55
|
-
"format": "DISABLED",
|
|
56
|
-
"visibility": "(!readOnly = true)"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"name": "visibility",
|
|
60
|
-
"label": "Visibility",
|
|
61
|
-
"format": "VISIBILITY"
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"label": "Advanced",
|
|
67
|
-
"format": "GROUP",
|
|
68
|
-
"collapsible": true,
|
|
69
|
-
"properties": [
|
|
70
|
-
{
|
|
71
|
-
"name": "testId",
|
|
72
|
-
"label": "Test ID",
|
|
73
|
-
"format": "TEXT",
|
|
74
|
-
"ignorePattern": "[^-_\\p{N}\\p{L}]",
|
|
75
|
-
"includeAnnotations": false
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"defaultConfig": {
|
|
81
|
-
"label": "@L $this.label"
|
|
82
|
-
}
|
|
83
|
-
}
|