@pega/react-sdk-overrides 0.23.26 → 8.8.21
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/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
- package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
- package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
- package/lib/field/AutoComplete/AutoComplete.tsx +37 -18
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
- package/lib/field/Checkbox/Checkbox.tsx +41 -17
- package/lib/field/Currency/Currency.tsx +23 -15
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +31 -17
- package/lib/field/DateTime/DateTime.tsx +26 -15
- package/lib/field/Decimal/Decimal.tsx +82 -19
- package/lib/field/Dropdown/Dropdown.tsx +57 -14
- package/lib/field/Email/Email.tsx +17 -9
- package/lib/field/Integer/Integer.tsx +15 -7
- package/lib/field/Percentage/Percentage.tsx +15 -7
- package/lib/field/Phone/Phone.tsx +21 -12
- package/lib/field/RadioButtons/RadioButtons.tsx +54 -27
- package/lib/field/RichText/RichText.tsx +93 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +64 -0
- package/lib/field/ScalarList/config-ext.json +8 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/utils.ts +2 -1
- package/lib/field/TextArea/TextArea.tsx +14 -5
- package/lib/field/TextContent/TextContent.tsx +10 -1
- package/lib/field/TextInput/TextInput.tsx +40 -11
- package/lib/field/Time/Time.tsx +29 -26
- package/lib/field/URL/URL.tsx +24 -8
- package/lib/field/UserReference/UserReference.tsx +52 -60
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
- package/lib/helpers/auth.js +741 -390
- package/lib/helpers/authManager.ts +933 -0
- package/lib/helpers/case-utils.tsx +103 -0
- package/lib/helpers/common-utils.ts +4 -0
- package/lib/helpers/config_access.js +63 -145
- package/lib/helpers/data_page.ts +2 -1
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
- package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
- package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
- package/lib/helpers/formatters/{common.js → common.ts} +4 -4
- package/lib/helpers/formatters/{index.js → index.ts} +3 -3
- package/lib/helpers/simpleTableHelpers.ts +10 -6
- package/lib/helpers/state-utils.tsx +47 -0
- package/lib/helpers/template-utils.ts +3 -4
- package/lib/helpers/utils.ts +12 -4
- package/lib/helpers/versionHelpers.ts +0 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
- package/lib/infra/Assignment/Assignment.tsx +38 -32
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
- package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -27
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +19 -28
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -1
- package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +20 -19
- package/lib/infra/MultiStep/MultiStep.tsx +24 -24
- package/lib/infra/NavBar/NavBar.tsx +23 -24
- package/lib/infra/Reference/Reference.tsx +13 -18
- package/lib/infra/Region/Region.tsx +8 -6
- package/lib/infra/RootContainer/RootContainer.tsx +32 -39
- package/lib/infra/Stages/Stages.tsx +15 -9
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
- package/lib/infra/View/View.tsx +28 -56
- package/lib/template/AppShell/AppShell.tsx +51 -34
- package/lib/template/BannerPage/BannerPage.tsx +26 -31
- package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
- package/lib/template/CaseView/CaseView.tsx +137 -100
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
- package/lib/template/Confirmation/Confirmation.tsx +29 -52
- package/lib/template/DataReference/DataReference.tsx +50 -52
- package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +16 -17
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
- package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -17
- package/lib/template/ListPage/ListPage.tsx +14 -13
- package/lib/template/ListView/ListView.tsx +191 -186
- package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
- package/lib/template/ListView/{utils.js → utils.ts} +172 -23
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
- package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +28 -7
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +34 -36
- package/lib/template/SubTabs/SubTabs.tsx +10 -11
- package/lib/template/SubTabs/tabUtils.ts +0 -2
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
- package/lib/template/WssNavBar/WssNavBar.tsx +20 -3
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
- package/lib/widget/Attachment/Attachment.css +15 -3
- package/lib/widget/Attachment/Attachment.tsx +51 -32
- package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
- package/lib/widget/Followers/Followers.tsx +10 -11
- package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
- package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
- package/lib/widget/SummaryList/SummaryList.tsx +17 -3
- package/lib/widget/ToDo/ToDo.tsx +69 -104
- package/package.json +1 -1
- package/lib/helpers/authManager.js +0 -631
- /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
- /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
- /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import React, { createElement } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import Grid from '@material-ui/core/Grid';
|
|
4
3
|
import { GridSize } from '@material-ui/core/Grid';
|
|
5
4
|
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
6
|
-
import
|
|
5
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
|
+
|
|
7
|
+
// import type { PConnProps } from '../../../../types/PConnProps';
|
|
8
|
+
|
|
9
|
+
// Can't use PConnProps until PConnect.getChildren() type is ok
|
|
10
|
+
// interface WideNarrowDetailsProps extends PConnProps {
|
|
11
|
+
// // If any, enter additional props that only exist on this component
|
|
12
|
+
// showLabel?: boolean,
|
|
13
|
+
// label?: string,
|
|
14
|
+
// showHighlightedData?: boolean
|
|
15
|
+
// }
|
|
7
16
|
|
|
8
17
|
const COLUMN_WIDTHS = [8, 4];
|
|
9
18
|
|
|
10
|
-
export default function WideNarrowDetails(props) {
|
|
11
|
-
|
|
19
|
+
export default function WideNarrowDetails(props /* : WideNarrowDetailsProps */) {
|
|
20
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
21
|
+
const FieldGroup = getComponentFromMap('FieldGroup');
|
|
22
|
+
|
|
23
|
+
const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
|
|
12
24
|
|
|
13
25
|
// Get the inherited props from the parent to determine label settings
|
|
14
26
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
@@ -19,13 +31,18 @@ export default function WideNarrowDetails(props) {
|
|
|
19
31
|
getPConnect().setInheritedProp('readOnly', true);
|
|
20
32
|
const children = getPConnect()
|
|
21
33
|
.getChildren()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
?.map((configObject, index) => {
|
|
35
|
+
let theConfigObject: object = configObject;
|
|
36
|
+
if (!theConfigObject) {
|
|
37
|
+
theConfigObject = {}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return createElement(createPConnectComponent(), {
|
|
41
|
+
...theConfigObject,
|
|
25
42
|
// eslint-disable-next-line react/no-array-index-key
|
|
26
43
|
key: index.toString()
|
|
27
|
-
})
|
|
28
|
-
);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
29
46
|
|
|
30
47
|
// Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
|
|
31
48
|
let highlightedDataArr = [];
|
|
@@ -40,12 +57,18 @@ export default function WideNarrowDetails(props) {
|
|
|
40
57
|
field.config.displayAsStatus = true;
|
|
41
58
|
}
|
|
42
59
|
|
|
43
|
-
return getPConnect().createComponent(field
|
|
60
|
+
return getPConnect().createComponent(field,
|
|
61
|
+
'', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
|
|
44
62
|
});
|
|
45
63
|
}
|
|
46
64
|
|
|
65
|
+
let theName = '';
|
|
66
|
+
if (propsToUse?.showLabel && propsToUse.label ) {
|
|
67
|
+
theName = propsToUse.label;
|
|
68
|
+
}
|
|
69
|
+
|
|
47
70
|
return (
|
|
48
|
-
<FieldGroup name={
|
|
71
|
+
<FieldGroup name={theName}>
|
|
49
72
|
{showHighlightedData && highlightedDataArr.length > 0 && (
|
|
50
73
|
<Grid container spacing={1} style={{ padding: '0 0 1em' }}>
|
|
51
74
|
{highlightedDataArr.map((child, i) => (
|
|
@@ -56,7 +79,7 @@ export default function WideNarrowDetails(props) {
|
|
|
56
79
|
</Grid>
|
|
57
80
|
)}
|
|
58
81
|
<Grid container spacing={1}>
|
|
59
|
-
{children
|
|
82
|
+
{children?.map((child, i) => (
|
|
60
83
|
<Grid item xs={COLUMN_WIDTHS[i] as GridSize} key={`r-${i + 1}`}>
|
|
61
84
|
{child}
|
|
62
85
|
</Grid>
|
|
@@ -65,16 +88,3 @@ export default function WideNarrowDetails(props) {
|
|
|
65
88
|
</FieldGroup>
|
|
66
89
|
);
|
|
67
90
|
}
|
|
68
|
-
|
|
69
|
-
WideNarrowDetails.defaultProps = {
|
|
70
|
-
label: undefined,
|
|
71
|
-
showLabel: true,
|
|
72
|
-
showHighlightedData: false
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
WideNarrowDetails.propTypes = {
|
|
76
|
-
showLabel: PropTypes.bool,
|
|
77
|
-
label: PropTypes.string,
|
|
78
|
-
getPConnect: PropTypes.func.isRequired,
|
|
79
|
-
showHighlightedData: PropTypes.bool
|
|
80
|
-
};
|
|
@@ -2,7 +2,13 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import './WideNarrowForm.css';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// WideNarrowForm does NOT have getPConnect. So, no need to extend from PConnProps
|
|
6
|
+
interface WideNarrowFormProps {
|
|
7
|
+
// If any, enter additional props that only exist on this component
|
|
8
|
+
children: Array<any>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function WideNarrowForm(props: WideNarrowFormProps) {
|
|
6
12
|
const {children} = props;
|
|
7
13
|
|
|
8
14
|
return (
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import React, { Children } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
3
|
+
|
|
4
|
+
// WideNarrowPage does NOT have getPConnect. So, no need to extend from PConnProps
|
|
5
|
+
interface WideNarrowPageProps {
|
|
6
|
+
// If any, enter additional props that only exist on this component
|
|
7
|
+
children: Array<any>,
|
|
8
|
+
title: string,
|
|
9
|
+
templateCol?: string,
|
|
10
|
+
icon?: string
|
|
11
|
+
}
|
|
3
12
|
|
|
4
|
-
// import { TwoColumnPage as TwoColumn } from "@pega/cosmos-react-core";
|
|
5
|
-
import WideNarrow from '@pega/react-sdk-components/lib/components/template/WideNarrow/WideNarrow';
|
|
6
13
|
|
|
7
14
|
/*
|
|
8
15
|
* The wrapper handles knowing how to take in just children and mapping
|
|
9
16
|
* to the Cosmos template.
|
|
10
17
|
*/
|
|
11
|
-
export default function WideNarrowPage(props) {
|
|
12
|
-
|
|
18
|
+
export default function WideNarrowPage(props: WideNarrowPageProps) {
|
|
19
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
20
|
+
const WideNarrow = getComponentFromMap('WideNarrow');
|
|
21
|
+
|
|
22
|
+
const { children, title, templateCol = '1fr 1fr', icon = '' } = props;
|
|
13
23
|
const childArray = Children.toArray(children);
|
|
14
24
|
|
|
15
25
|
return (
|
|
@@ -24,15 +34,3 @@ export default function WideNarrowPage(props) {
|
|
|
24
34
|
</div>
|
|
25
35
|
);
|
|
26
36
|
}
|
|
27
|
-
|
|
28
|
-
WideNarrowPage.propTypes = {
|
|
29
|
-
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
30
|
-
title: PropTypes.string.isRequired,
|
|
31
|
-
templateCol: PropTypes.string,
|
|
32
|
-
icon: PropTypes.string
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
WideNarrowPage.defaultProps = {
|
|
36
|
-
templateCol: "1fr 1fr",
|
|
37
|
-
icon: ""
|
|
38
|
-
};
|
|
@@ -11,6 +11,23 @@ import MenuIcon from '@material-ui/icons/Menu';
|
|
|
11
11
|
import { logout } from '@pega/react-sdk-components/lib/components/helpers/authManager';
|
|
12
12
|
import './WssNavBar.css';
|
|
13
13
|
|
|
14
|
+
// WssNavBar does NOT have getPConnect. So, no need to extend from PConnProps
|
|
15
|
+
|
|
16
|
+
interface WssNavBarProps {
|
|
17
|
+
// If any, enter additional props that only exist on this component
|
|
18
|
+
appInfo: any,
|
|
19
|
+
navLinks: Array<any>
|
|
20
|
+
operator: { currentUserInitials: string },
|
|
21
|
+
navDisplayOptions: { alignment: string, position: string},
|
|
22
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
23
|
+
portalName: string,
|
|
24
|
+
imageSrc: string,
|
|
25
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
26
|
+
fullImageSrc: string,
|
|
27
|
+
appName: any
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
14
31
|
const useStyles = makeStyles(theme => ({
|
|
15
32
|
root: {
|
|
16
33
|
display: 'flex'
|
|
@@ -32,7 +49,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
32
49
|
}
|
|
33
50
|
}));
|
|
34
51
|
|
|
35
|
-
export default function WssNavBar(props) {
|
|
52
|
+
export default function WssNavBar(props: WssNavBarProps) {
|
|
36
53
|
const { appInfo, navLinks, operator, navDisplayOptions } = props;
|
|
37
54
|
const { alignment, position } = navDisplayOptions;
|
|
38
55
|
const classes = useStyles();
|
|
@@ -56,7 +73,7 @@ export default function WssNavBar(props) {
|
|
|
56
73
|
};
|
|
57
74
|
|
|
58
75
|
const navLinksContent = (
|
|
59
|
-
<Box
|
|
76
|
+
<Box id="nav-links"
|
|
60
77
|
sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}
|
|
61
78
|
style={{ justifyContent: alignment }}
|
|
62
79
|
>
|
|
@@ -73,7 +90,7 @@ export default function WssNavBar(props) {
|
|
|
73
90
|
<AppBar position='static' color='primary'>
|
|
74
91
|
<Container maxWidth='xl'>
|
|
75
92
|
<Toolbar disableGutters style={{ justifyContent: 'space-between' }}>
|
|
76
|
-
<Button style={{ textTransform: 'capitalize' }} onClick={appInfo.onClick}>
|
|
93
|
+
<Button id="appName" style={{ textTransform: 'capitalize' }} onClick={appInfo.onClick}>
|
|
77
94
|
<img src={appInfo.imageSrc} className={classes.appListLogo} />
|
|
78
95
|
<span className={classes.appName}>{appInfo.appName}</span>
|
|
79
96
|
</Button>
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { Card, CardContent, CardHeader, Typography, CardActions, Button } from "@material-ui/core";
|
|
4
3
|
import { makeStyles } from '@material-ui/core/styles';
|
|
5
4
|
|
|
5
|
+
// AppAnnouncement is one of the few components that does NOT have getPConnect.
|
|
6
|
+
// So, no need to extend PConnProps
|
|
7
|
+
interface AppAnnouncementProps {
|
|
8
|
+
// If any, enter additional props that only exist on this component
|
|
9
|
+
header?: string,
|
|
10
|
+
description?: string,
|
|
11
|
+
datasource?: any,
|
|
12
|
+
whatsnewlink?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
6
16
|
const useStyles = makeStyles((theme) => ({
|
|
7
17
|
root: {
|
|
8
18
|
marginTop: theme.spacing(1),
|
|
@@ -12,8 +22,8 @@ const useStyles = makeStyles((theme) => ({
|
|
|
12
22
|
},
|
|
13
23
|
}));
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
const { header, description, datasource, whatsnewlink } = props;
|
|
25
|
+
export default function AppAnnouncement(props: AppAnnouncementProps) {
|
|
26
|
+
const { header = '', description = '', datasource = [], whatsnewlink = '' } = props;
|
|
17
27
|
let details = [];
|
|
18
28
|
if (datasource && datasource.source) {
|
|
19
29
|
details = datasource.source.map((item) => {
|
|
@@ -47,21 +57,3 @@ const AppAnnouncement = (props) => {
|
|
|
47
57
|
</Card>
|
|
48
58
|
);
|
|
49
59
|
};
|
|
50
|
-
|
|
51
|
-
AppAnnouncement.propTypes = {
|
|
52
|
-
header: PropTypes.string,
|
|
53
|
-
description: PropTypes.string,
|
|
54
|
-
datasource: PropTypes.instanceOf(Object),
|
|
55
|
-
whatsnewlink: PropTypes.string,
|
|
56
|
-
// image: PropTypes.string
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
AppAnnouncement.defaultProps = {
|
|
60
|
-
header: "",
|
|
61
|
-
description: "",
|
|
62
|
-
// image: "",
|
|
63
|
-
datasource: [],
|
|
64
|
-
whatsnewlink: ""
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export default AppAnnouncement;
|
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.file-div {
|
|
7
|
-
border: 1px dashed
|
|
7
|
+
border: 1px dashed var(--app-neutral-dark-color);
|
|
8
|
+
width: 100%;
|
|
9
|
+
padding: 0.5rem;
|
|
10
|
+
text-align: center;
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.file-div-error {
|
|
15
|
+
border: 1px dashed var(--app-error-color);
|
|
8
16
|
width: 100%;
|
|
9
17
|
padding: 0.5rem;
|
|
10
18
|
text-align: center;
|
|
@@ -17,9 +25,13 @@
|
|
|
17
25
|
left: 47%;
|
|
18
26
|
}
|
|
19
27
|
|
|
20
|
-
file-label::after {
|
|
28
|
+
.file-label::after {
|
|
21
29
|
display: inline;
|
|
22
30
|
content: " *";
|
|
23
31
|
vertical-align: top;
|
|
24
|
-
color:
|
|
32
|
+
color: var(--app-neutral-dark-color);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.file-error {
|
|
36
|
+
color: var(--app-error-color);
|
|
25
37
|
}
|
|
@@ -4,18 +4,35 @@ import { Button } from '@material-ui/core';
|
|
|
4
4
|
import React, { useState, useEffect } from 'react';
|
|
5
5
|
import { buildFilePropsFromResponse, getIconFromFileType, validateMaxSize, getIconForAttachment } from '@pega/react-sdk-components/lib/components/helpers/attachmentHelpers';
|
|
6
6
|
import './Attachment.css';
|
|
7
|
-
import SummaryList from '@pega/react-sdk-components/lib/components/widget/SummaryList'
|
|
8
7
|
import { CircularProgress } from "@material-ui/core";
|
|
9
8
|
import download from "downloadjs";
|
|
9
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
10
10
|
|
|
11
|
+
// import type { PConnProps } from '../../../types/PConnProps';
|
|
12
|
+
|
|
13
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
|
|
11
14
|
declare const PCore: any;
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
// NOTE: we can't use PConnProps in this file because the
|
|
17
|
+
// PConnect type is missing a number of expected properties
|
|
18
|
+
// such as attachmentsInfo and incorrect type for our use of clearMessages,
|
|
19
|
+
// interface AttachmentProps extends PConnProps {
|
|
20
|
+
// // If any, enter additional props that only exist on this component
|
|
21
|
+
// }
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const getAttachmentKey = (name='') => name ? `attachmentsList.${name}` : 'attachmentsList';
|
|
25
|
+
|
|
26
|
+
function getCurrentAttachmentsList(key, context) {
|
|
27
|
+
return PCore.getStoreValue(`.${key}`, 'context_data', context) || [];
|
|
15
28
|
}
|
|
16
29
|
|
|
17
|
-
export default function Attachment(props) {
|
|
18
|
-
|
|
30
|
+
export default function Attachment(props /* :AttachmentProps */) {
|
|
31
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
32
|
+
const SummaryList = getComponentFromMap('SummaryList');
|
|
33
|
+
|
|
34
|
+
const PCoreVersion = PCore.getPCoreVersion();
|
|
35
|
+
const {value, getPConnect, label, validatemessage} = props;
|
|
19
36
|
/* this is a temporary fix because required is supposed to be passed as a boolean and NOT as a string */
|
|
20
37
|
let { required, disabled } = props;
|
|
21
38
|
[required, disabled] = [required, disabled].map(
|
|
@@ -31,12 +48,12 @@ export default function Attachment(props) {
|
|
|
31
48
|
categoryName = value.pyCategoryName;
|
|
32
49
|
}
|
|
33
50
|
|
|
34
|
-
let valueRef = pConn.getStateProps()
|
|
51
|
+
let valueRef = pConn.getStateProps()["value"];
|
|
35
52
|
valueRef = valueRef.indexOf('.') === 0 ? valueRef.substring(1) : valueRef;
|
|
36
53
|
const [file, setFile] = useState(fileTemp);
|
|
37
54
|
|
|
38
55
|
const resetAttachmentStoredState = () => {
|
|
39
|
-
PCore.getStateUtils().updateState(pConn.getContextName(), '
|
|
56
|
+
PCore.getStateUtils().updateState(pConn.getContextName(), getAttachmentKey(PCoreVersion?.includes('8.23') ? valueRef : ''), undefined, {
|
|
40
57
|
pageReference: 'context_data',
|
|
41
58
|
isArrayDeepMerge: false
|
|
42
59
|
});
|
|
@@ -59,10 +76,11 @@ export default function Attachment(props) {
|
|
|
59
76
|
|
|
60
77
|
function setNewFiles(arFiles) {
|
|
61
78
|
let index = 0;
|
|
79
|
+
const maxAttachmentSize = 5;
|
|
62
80
|
for (const item of arFiles) {
|
|
63
|
-
if (!validateMaxSize(item,
|
|
81
|
+
if (!validateMaxSize(item, maxAttachmentSize.toString())) {
|
|
64
82
|
item.error = true;
|
|
65
|
-
item.meta =
|
|
83
|
+
item.meta = pConn.getLocalizedValue(`File is too big. Max allowed size is ${maxAttachmentSize}MB.`, '', ''); // 2nd and 3rd args empty string until typedef marked correctly
|
|
66
84
|
}
|
|
67
85
|
item.mimeType = item.type;
|
|
68
86
|
item.icon = getIconFromFileType(item.type);
|
|
@@ -76,7 +94,7 @@ export default function Attachment(props) {
|
|
|
76
94
|
return setNewFiles(arFiles);
|
|
77
95
|
}
|
|
78
96
|
|
|
79
|
-
function getNewListUtilityItemProps({
|
|
97
|
+
function getNewListUtilityItemProps(this: any, {
|
|
80
98
|
att,
|
|
81
99
|
cancelFile,
|
|
82
100
|
downloadFile,
|
|
@@ -88,7 +106,7 @@ export default function Attachment(props) {
|
|
|
88
106
|
actions = [
|
|
89
107
|
{
|
|
90
108
|
id: `Cancel-${att.ID}`,
|
|
91
|
-
text:
|
|
109
|
+
text: pConn.getLocalizedValue('Cancel', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
|
|
92
110
|
icon: "times",
|
|
93
111
|
onClick: cancelFile
|
|
94
112
|
}
|
|
@@ -101,7 +119,7 @@ export default function Attachment(props) {
|
|
|
101
119
|
"download",
|
|
102
120
|
{
|
|
103
121
|
id: `download-${ID}`,
|
|
104
|
-
text: isFile ?
|
|
122
|
+
text: isFile ? pConn.getLocalizedValue('Download', '', '') : pConn.getLocalizedValue('Open', '', ''),
|
|
105
123
|
icon: isFile ? "download" : "open",
|
|
106
124
|
onClick: downloadFile
|
|
107
125
|
}
|
|
@@ -110,7 +128,7 @@ export default function Attachment(props) {
|
|
|
110
128
|
"delete",
|
|
111
129
|
{
|
|
112
130
|
id: `Delete-${ID}`,
|
|
113
|
-
text:
|
|
131
|
+
text: pConn.getLocalizedValue('Delete', '', ''),
|
|
114
132
|
icon: "trash",
|
|
115
133
|
onClick: deleteFile
|
|
116
134
|
}
|
|
@@ -126,7 +144,7 @@ export default function Attachment(props) {
|
|
|
126
144
|
actions = [
|
|
127
145
|
{
|
|
128
146
|
id: `Remove-${att.ID}`,
|
|
129
|
-
text:
|
|
147
|
+
text: pConn.getLocalizedValue('Remove', '', ''),
|
|
130
148
|
icon: "trash",
|
|
131
149
|
onClick: removeFile
|
|
132
150
|
}
|
|
@@ -135,7 +153,7 @@ export default function Attachment(props) {
|
|
|
135
153
|
return {
|
|
136
154
|
id: att.ID,
|
|
137
155
|
visual: {
|
|
138
|
-
icon: getIconForAttachment(att),
|
|
156
|
+
icon: getIconForAttachment(this, att),
|
|
139
157
|
progress: att.progress === 100 ? undefined: att.progress,
|
|
140
158
|
},
|
|
141
159
|
primary: {
|
|
@@ -169,13 +187,13 @@ export default function Attachment(props) {
|
|
|
169
187
|
const errorHandler = (isFetchCanceled) => {
|
|
170
188
|
return (error) => {
|
|
171
189
|
if (!isFetchCanceled(error)) {
|
|
172
|
-
let uploadFailMsg = pConn.getLocalizedValue('Something went wrong');
|
|
190
|
+
let uploadFailMsg = pConn.getLocalizedValue('Something went wrong', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
|
|
173
191
|
if (error.response && error.response.data && error.response.data.errorDetails) {
|
|
174
|
-
uploadFailMsg = pConn.getLocalizedValue(error.response.data.errorDetails[0].localizedValue);
|
|
192
|
+
uploadFailMsg = pConn.getLocalizedValue(error.response.data.errorDetails[0].localizedValue, '', ''); // 2nd and 3rd args empty string until typedef marked correctly
|
|
175
193
|
}
|
|
176
194
|
myFiles[0].meta = uploadFailMsg;
|
|
177
195
|
myFiles[0].error = true;
|
|
178
|
-
myFiles[0].fileName = pConn.getLocalizedValue('Unable to upload file');
|
|
196
|
+
myFiles[0].fileName = pConn.getLocalizedValue('Unable to upload file', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
|
|
179
197
|
arFileList$ = myFiles.map((att) => {
|
|
180
198
|
return getNewListUtilityItemProps({
|
|
181
199
|
att,
|
|
@@ -211,7 +229,7 @@ export default function Attachment(props) {
|
|
|
211
229
|
)
|
|
212
230
|
.then((fileRes) => {
|
|
213
231
|
let reqObj;
|
|
214
|
-
if (
|
|
232
|
+
if (PCoreVersion?.includes('8.7')) {
|
|
215
233
|
reqObj = {
|
|
216
234
|
type: "File",
|
|
217
235
|
attachmentFieldName: valueRef,
|
|
@@ -227,12 +245,12 @@ export default function Attachment(props) {
|
|
|
227
245
|
handle: fileRes.ID,
|
|
228
246
|
ID: fileRes.clientFileID
|
|
229
247
|
};
|
|
230
|
-
const currentAttachmentList = getCurrentAttachmentsList(pConn.getContextName()).filter(
|
|
248
|
+
const currentAttachmentList = getCurrentAttachmentsList( getAttachmentKey(PCoreVersion?.includes('8.23') ? valueRef : ''), pConn.getContextName()).filter(
|
|
231
249
|
(f) => f.label !== valueRef
|
|
232
250
|
);
|
|
233
251
|
PCore.getStateUtils().updateState(
|
|
234
252
|
pConn.getContextName(),
|
|
235
|
-
'
|
|
253
|
+
getAttachmentKey(PCoreVersion?.includes('8.23') ? valueRef : ''),
|
|
236
254
|
[...currentAttachmentList, reqObj],
|
|
237
255
|
{
|
|
238
256
|
pageReference: 'context_data',
|
|
@@ -240,7 +258,7 @@ export default function Attachment(props) {
|
|
|
240
258
|
}
|
|
241
259
|
);
|
|
242
260
|
}
|
|
243
|
-
const fieldName = pConn.getStateProps()
|
|
261
|
+
const fieldName = pConn.getStateProps()["value"];
|
|
244
262
|
const context = pConn.getContextName();
|
|
245
263
|
|
|
246
264
|
PCore.getMessageManager().clearMessages({
|
|
@@ -249,7 +267,7 @@ export default function Attachment(props) {
|
|
|
249
267
|
pageReference: pConn.getPageReference(),
|
|
250
268
|
context
|
|
251
269
|
});
|
|
252
|
-
myFiles[0].meta =
|
|
270
|
+
myFiles[0].meta = pConn.getLocalizedValue('Uploaded successfully', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
|
|
253
271
|
|
|
254
272
|
arFileList$ = myFiles.map((att) => {
|
|
255
273
|
return getNewListUtilityItemProps({
|
|
@@ -283,7 +301,7 @@ export default function Attachment(props) {
|
|
|
283
301
|
function _removeFileFromList(item: any, list) {
|
|
284
302
|
const arFileList = file.props ? file.props.arFileList$ : list;
|
|
285
303
|
const fileIndex = arFileList.findIndex(element => element?.id === item?.id);
|
|
286
|
-
if (
|
|
304
|
+
if (PCoreVersion?.includes('8.7')) {
|
|
287
305
|
if (value) {
|
|
288
306
|
pConn.attachmentsInfo = {
|
|
289
307
|
type: "File",
|
|
@@ -303,7 +321,7 @@ export default function Attachment(props) {
|
|
|
303
321
|
});
|
|
304
322
|
} else {
|
|
305
323
|
const attachmentsList = [];
|
|
306
|
-
const currentAttachmentList = getCurrentAttachmentsList(pConn.getContextName()).filter(
|
|
324
|
+
const currentAttachmentList = getCurrentAttachmentsList( getAttachmentKey(PCoreVersion?.includes('8.23') ? valueRef : ''), pConn.getContextName()).filter(
|
|
307
325
|
(f) => f.label !== valueRef
|
|
308
326
|
);
|
|
309
327
|
if (value && value.pxResults && +value.pyCount > 0) {
|
|
@@ -318,7 +336,7 @@ export default function Attachment(props) {
|
|
|
318
336
|
// updating the redux store to help form-handler in passing the data to delete the file from server
|
|
319
337
|
PCore.getStateUtils().updateState(
|
|
320
338
|
pConn.getContextName(),
|
|
321
|
-
'
|
|
339
|
+
getAttachmentKey(PCoreVersion?.includes('8.23') ? valueRef : ''),
|
|
322
340
|
[...currentAttachmentList, deletedFile],
|
|
323
341
|
{
|
|
324
342
|
pageReference: 'context_data',
|
|
@@ -328,7 +346,7 @@ export default function Attachment(props) {
|
|
|
328
346
|
} else {
|
|
329
347
|
PCore.getStateUtils().updateState(
|
|
330
348
|
pConn.getContextName(),
|
|
331
|
-
'
|
|
349
|
+
getAttachmentKey(PCoreVersion?.includes('8.23') ? valueRef : ''),
|
|
332
350
|
[...currentAttachmentList, ...attachmentsList],
|
|
333
351
|
{
|
|
334
352
|
pageReference: 'context_data',
|
|
@@ -372,12 +390,12 @@ export default function Attachment(props) {
|
|
|
372
390
|
let oMenu: any = {};
|
|
373
391
|
|
|
374
392
|
oMenu.icon = "download";
|
|
375
|
-
oMenu.text =
|
|
393
|
+
oMenu.text = pConn.getLocalizedValue('Download', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
|
|
376
394
|
oMenu.onClick = () => { _downloadFileFromList(value.pxResults[0])}
|
|
377
395
|
arMenuList.push(oMenu);
|
|
378
396
|
oMenu = {};
|
|
379
397
|
oMenu.icon = "trash";
|
|
380
|
-
oMenu.text =
|
|
398
|
+
oMenu.text = pConn.getLocalizedValue('Delete', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
|
|
381
399
|
oMenu.onClick = () => { _removeFileFromList(arFileList$[0], arFileList$)}
|
|
382
400
|
arMenuList.push(oMenu);
|
|
383
401
|
|
|
@@ -405,7 +423,7 @@ export default function Attachment(props) {
|
|
|
405
423
|
}
|
|
406
424
|
|
|
407
425
|
if (fileTemp) {
|
|
408
|
-
const currentAttachmentList = getCurrentAttachmentsList(pConn.getContextName());
|
|
426
|
+
const currentAttachmentList = getCurrentAttachmentsList( getAttachmentKey(PCoreVersion?.includes('8.23') ? valueRef : ''), pConn.getContextName());
|
|
409
427
|
const index = currentAttachmentList.findIndex(element => element.props.ID === fileTemp.props.ID);
|
|
410
428
|
let tempFiles: any = [];
|
|
411
429
|
if (index < 0) {
|
|
@@ -413,7 +431,7 @@ export default function Attachment(props) {
|
|
|
413
431
|
}
|
|
414
432
|
PCore.getStateUtils().updateState(
|
|
415
433
|
pConn.getContextName(),
|
|
416
|
-
'
|
|
434
|
+
getAttachmentKey(PCoreVersion?.includes('8.23') ? valueRef : ''),
|
|
417
435
|
[...currentAttachmentList, ...tempFiles],
|
|
418
436
|
{
|
|
419
437
|
pageReference: 'context_data',
|
|
@@ -434,7 +452,7 @@ export default function Attachment(props) {
|
|
|
434
452
|
}, []);
|
|
435
453
|
|
|
436
454
|
let content = (
|
|
437
|
-
<div className='file-div'>
|
|
455
|
+
<div className={`${validatemessage === '' ? 'file-div' : 'file-div-error'}`}>
|
|
438
456
|
{file.inProgress && (<div className="progress-div"><CircularProgress /></div>)}
|
|
439
457
|
<div hidden={true} id="attachment-ID">{valueRef}</div>
|
|
440
458
|
<label htmlFor={valueRef}>
|
|
@@ -467,6 +485,7 @@ export default function Attachment(props) {
|
|
|
467
485
|
<div className='file-upload-container'>
|
|
468
486
|
<span className={`label ${required ? 'file-label' : ''}`}>{label}</span>
|
|
469
487
|
<section>{content}</section>
|
|
488
|
+
{validatemessage !== "" ? <span className='file-error'>{validatemessage}</span> : ''}
|
|
470
489
|
</div>
|
|
471
490
|
);
|
|
472
491
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { withStyles, Theme, createStyles } from '@material-ui/core/styles';
|
|
4
3
|
import Table from '@material-ui/core/Table';
|
|
5
4
|
import TableBody from '@material-ui/core/TableBody';
|
|
@@ -9,10 +8,17 @@ import TableHead from '@material-ui/core/TableHead';
|
|
|
9
8
|
import TableRow from '@material-ui/core/TableRow';
|
|
10
9
|
import isDeepEqual from 'fast-deep-equal/react';
|
|
11
10
|
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
11
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
interface CaseHistoryProps extends PConnProps {
|
|
15
|
+
// If any, enter additional props that only exist on this component
|
|
16
|
+
}
|
|
14
17
|
|
|
15
18
|
|
|
19
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
|
|
20
|
+
declare const PCore: any;
|
|
21
|
+
|
|
16
22
|
const StyledTableCell = withStyles((theme: Theme) =>
|
|
17
23
|
createStyles({
|
|
18
24
|
head: {
|
|
@@ -32,15 +38,15 @@ const StyledTableCell = withStyles((theme: Theme) =>
|
|
|
32
38
|
)(TableCell);
|
|
33
39
|
|
|
34
40
|
|
|
35
|
-
export default function CaseHistory(props) {
|
|
41
|
+
export default function CaseHistory(props:CaseHistoryProps) {
|
|
36
42
|
const { getPConnect } = props;
|
|
37
43
|
const thePConn = getPConnect();
|
|
38
44
|
// let waitingForData = true;
|
|
39
45
|
|
|
40
46
|
const displayedColumns = [
|
|
41
|
-
{ label:
|
|
42
|
-
{ label:
|
|
43
|
-
{ label:
|
|
47
|
+
{ label: thePConn.getLocalizedValue('Date', '', ''), type: "DateTime", fieldName: "pxTimeCreated" }, // 2nd and 3rd args empty string until typedef marked correctly
|
|
48
|
+
{ label: thePConn.getLocalizedValue('Description', '', ''), type: "TextInput", fieldName: "pyMessageKey" }, // 2nd and 3rd args empty string until typedef marked correctly
|
|
49
|
+
{ label: thePConn.getLocalizedValue('Performed by', '', ''), type: "TextInput", fieldName: "pyPerformer" } // 2nd and 3rd args empty string until typedef marked correctly
|
|
44
50
|
];
|
|
45
51
|
|
|
46
52
|
const rowData: any = useRef([]);
|
|
@@ -48,7 +54,7 @@ export default function CaseHistory(props) {
|
|
|
48
54
|
const [waitingForData, setWaitingForData] = useState<boolean>(true);
|
|
49
55
|
|
|
50
56
|
|
|
51
|
-
const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
|
|
57
|
+
const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
|
|
52
58
|
const dataViewName = "D_pyWorkHistory";
|
|
53
59
|
const context = thePConn.getContextName();
|
|
54
60
|
|
|
@@ -163,7 +169,3 @@ export default function CaseHistory(props) {
|
|
|
163
169
|
</div>
|
|
164
170
|
)
|
|
165
171
|
}
|
|
166
|
-
|
|
167
|
-
CaseHistory.propTypes = {
|
|
168
|
-
getPConnect: PropTypes.func.isRequired
|
|
169
|
-
};
|
|
@@ -2,7 +2,19 @@ import React from "react";
|
|
|
2
2
|
import { Button } from '@material-ui/core';
|
|
3
3
|
import './ActionButtonsForFileUtil.css';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// ActionButtonsForFileUtil does NOT have getPConnect.
|
|
6
|
+
// So, no need to extend PConnProps
|
|
7
|
+
|
|
8
|
+
interface ActionButtonsForFileUtilProps {
|
|
9
|
+
// If any, enter additional props that only exist on this component
|
|
10
|
+
arMainButtons: Array<any>,
|
|
11
|
+
arSecondaryButtons: Array<any>,
|
|
12
|
+
primaryAction: any,
|
|
13
|
+
secondaryAction: any
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export default function ActionButtonsForFileUtil(props: ActionButtonsForFileUtilProps) {
|
|
6
18
|
|
|
7
19
|
return (
|
|
8
20
|
<div className="psdk-actions">
|