@pega/react-sdk-overrides 0.23.6
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/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.css +19 -0
- package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.tsx +156 -0
- package/lib/designSystemExtensions/CaseSummaryFields/index.tsx +1 -0
- package/lib/designSystemExtensions/DetailsFields/DetailsFields.tsx +154 -0
- package/lib/designSystemExtensions/DetailsFields/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldGroup/FieldGroup.tsx +113 -0
- package/lib/designSystemExtensions/FieldGroup/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldGroupList/FieldGroupList.tsx +53 -0
- package/lib/designSystemExtensions/FieldGroupList/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldValueList/FieldValueList.tsx +106 -0
- package/lib/designSystemExtensions/FieldValueList/index.tsx +1 -0
- package/lib/designSystemExtensions/Operator/Operator.tsx +195 -0
- package/lib/designSystemExtensions/Operator/index.tsx +1 -0
- package/lib/designSystemExtensions/Pulse/Pulse.tsx +31 -0
- package/lib/designSystemExtensions/Pulse/index.tsx +1 -0
- package/lib/forms/AutoComplete/AutoComplete.tsx +183 -0
- package/lib/forms/AutoComplete/index.tsx +1 -0
- package/lib/forms/CancelAlert/CancelAlert.css +24 -0
- package/lib/forms/CancelAlert/CancelAlert.tsx +126 -0
- package/lib/forms/CancelAlert/index.tsx +1 -0
- package/lib/forms/Checkbox/Checkbox.tsx +68 -0
- package/lib/forms/Checkbox/index.tsx +1 -0
- package/lib/forms/Currency/Currency.tsx +89 -0
- package/lib/forms/Currency/index.tsx +1 -0
- package/lib/forms/Date/Date.tsx +79 -0
- package/lib/forms/Date/index.tsx +1 -0
- package/lib/forms/DateTime/DateTime.tsx +75 -0
- package/lib/forms/DateTime/index.tsx +1 -0
- package/lib/forms/Decimal/Decimal.tsx +51 -0
- package/lib/forms/Decimal/index.tsx +1 -0
- package/lib/forms/Dropdown/Dropdown.tsx +82 -0
- package/lib/forms/Dropdown/index.tsx +1 -0
- package/lib/forms/Email/Email.tsx +68 -0
- package/lib/forms/Email/index.tsx +1 -0
- package/lib/forms/Integer/Integer.tsx +77 -0
- package/lib/forms/Integer/index.tsx +1 -0
- package/lib/forms/Percentage/Percentage.tsx +82 -0
- package/lib/forms/Percentage/index.tsx +1 -0
- package/lib/forms/Phone/Phone.tsx +90 -0
- package/lib/forms/Phone/index.tsx +1 -0
- package/lib/forms/RadioButtons/RadioButtons.tsx +73 -0
- package/lib/forms/RadioButtons/index.tsx +1 -0
- package/lib/forms/SemanticLink/SemanticLink.tsx +69 -0
- package/lib/forms/SemanticLink/index.tsx +1 -0
- package/lib/forms/SemanticLink/utils.ts +51 -0
- package/lib/forms/TextArea/TextArea.tsx +66 -0
- package/lib/forms/TextArea/index.tsx +1 -0
- package/lib/forms/TextContent/TextContent.tsx +40 -0
- package/lib/forms/TextContent/index.tsx +1 -0
- package/lib/forms/TextInput/TextInput.tsx +61 -0
- package/lib/forms/TextInput/index.tsx +1 -0
- package/lib/forms/Time/Time.tsx +71 -0
- package/lib/forms/Time/index.tsx +1 -0
- package/lib/forms/URL/URL.tsx +53 -0
- package/lib/forms/URL/index.tsx +1 -0
- package/lib/forms/UserReference/UserReference.tsx +197 -0
- package/lib/forms/UserReference/UserReferenceUtils.ts +13 -0
- package/lib/forms/UserReference/index.tsx +1 -0
- package/lib/helpers/auth.js +483 -0
- package/lib/helpers/authManager.js +630 -0
- package/lib/helpers/config_access.js +268 -0
- package/lib/helpers/data_page.ts +24 -0
- package/lib/helpers/event-utils.js +20 -0
- package/lib/helpers/field-group-utils.js +61 -0
- package/lib/helpers/formatters/Boolean.js +38 -0
- package/lib/helpers/formatters/Currency.js +74 -0
- package/lib/helpers/formatters/CurrencyMap.js +908 -0
- package/lib/helpers/formatters/Date.js +77 -0
- package/lib/helpers/formatters/common.js +10 -0
- package/lib/helpers/formatters/index.js +120 -0
- package/lib/helpers/utils.ts +334 -0
- package/lib/helpers/versionHelpers.ts +50 -0
- package/lib/infra/ActionButtons/ActionButtons.tsx +70 -0
- package/lib/infra/ActionButtons/index.tsx +1 -0
- package/lib/infra/Assignment/Assignment.tsx +301 -0
- package/lib/infra/Assignment/index.tsx +1 -0
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +47 -0
- package/lib/infra/AssignmentCard/index.tsx +1 -0
- package/lib/infra/Attachment/Attachment.css +18 -0
- package/lib/infra/Attachment/Attachment.tsx +404 -0
- package/lib/infra/Attachment/AttachmentUtils.js +71 -0
- package/lib/infra/Attachment/index.tsx +1 -0
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +511 -0
- package/lib/infra/Containers/FlowContainer/helpers.js +147 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +320 -0
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +216 -0
- package/lib/infra/Containers/ViewContainer/index.tsx +1 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +180 -0
- package/lib/infra/DashboardFilter/filterUtils.tsx +188 -0
- package/lib/infra/DashboardFilter/index.tsx +1 -0
- package/lib/infra/DeferLoad/DeferLoad.tsx +175 -0
- package/lib/infra/DeferLoad/index.tsx +1 -0
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +103 -0
- package/lib/infra/ErrorBoundary/index.tsx +1 -0
- package/lib/infra/MultiStep/MultiStep.css +261 -0
- package/lib/infra/MultiStep/MultiStep.tsx +225 -0
- package/lib/infra/MultiStep/index.tsx +1 -0
- package/lib/infra/NavBar/NavBar.css +170 -0
- package/lib/infra/NavBar/NavBar.tsx +393 -0
- package/lib/infra/NavBar/index.tsx +1 -0
- package/lib/infra/Reference/Reference.tsx +58 -0
- package/lib/infra/Reference/index.tsx +1 -0
- package/lib/infra/Region/Region.tsx +17 -0
- package/lib/infra/Region/index.tsx +1 -0
- package/lib/infra/RootContainer/RootContainer.tsx +336 -0
- package/lib/infra/RootContainer/index.tsx +1 -0
- package/lib/infra/Stages/Stages.tsx +120 -0
- package/lib/infra/Stages/index.tsx +1 -0
- package/lib/infra/ToDo/ToDo.css +87 -0
- package/lib/infra/ToDo/ToDo.tsx +285 -0
- package/lib/infra/ToDo/index.tsx +1 -0
- package/lib/infra/VerticalTabs/LeftAlignVerticalTab.tsx +27 -0
- package/lib/infra/VerticalTabs/VerticalTabs.tsx +75 -0
- package/lib/infra/VerticalTabs/index.tsx +1 -0
- package/lib/infra/View/View.css +8 -0
- package/lib/infra/View/View.tsx +175 -0
- package/lib/infra/View/index.tsx +1 -0
- package/lib/templates/AppShell/AppShell.css +40 -0
- package/lib/templates/AppShell/AppShell.tsx +439 -0
- package/lib/templates/AppShell/index.tsx +1 -0
- package/lib/templates/CaseSummary/CaseSummary.tsx +50 -0
- package/lib/templates/CaseSummary/index.tsx +1 -0
- package/lib/templates/CaseView/CaseView.tsx +261 -0
- package/lib/templates/CaseView/CaseViewActionsMenu.tsx +73 -0
- package/lib/templates/CaseView/index.tsx +1 -0
- package/lib/templates/DataReference/DataReference.tsx +290 -0
- package/lib/templates/DataReference/index.tsx +1 -0
- package/lib/templates/DefaultForm/DefaultForm.css +25 -0
- package/lib/templates/DefaultForm/DefaultForm.tsx +52 -0
- package/lib/templates/DefaultForm/index.tsx +1 -0
- package/lib/templates/Details/Details/Details.tsx +35 -0
- package/lib/templates/Details/Details/index.tsx +1 -0
- package/lib/templates/Details/DetailsSubTabs/DetailsSubTabs.tsx +65 -0
- package/lib/templates/Details/DetailsSubTabs/index.tsx +1 -0
- package/lib/templates/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +45 -0
- package/lib/templates/Details/DetailsThreeColumn/index.tsx +1 -0
- package/lib/templates/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +43 -0
- package/lib/templates/Details/DetailsTwoColumn/index.tsx +1 -0
- package/lib/templates/FieldGroupTemplate/FieldGroupTemplate.tsx +94 -0
- package/lib/templates/FieldGroupTemplate/index.tsx +1 -0
- package/lib/templates/InlineDashboard/InlineDashboard.tsx +72 -0
- package/lib/templates/InlineDashboard/index.tsx +1 -0
- package/lib/templates/InlineDashboardPage/InlineDashboardPage.tsx +41 -0
- package/lib/templates/InlineDashboardPage/index.tsx +1 -0
- package/lib/templates/ListPage/ListPage.tsx +20 -0
- package/lib/templates/ListPage/index.tsx +1 -0
- package/lib/templates/ListView/ListView.css +10 -0
- package/lib/templates/ListView/ListView.tsx +1230 -0
- package/lib/templates/ListView/index.tsx +1 -0
- package/lib/templates/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +42 -0
- package/lib/templates/MultiReferenceReadOnly/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWide/NarrowWide.css +21 -0
- package/lib/templates/NarrowWide/NarrowWide/NarrowWide.tsx +35 -0
- package/lib/templates/NarrowWide/NarrowWide/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +53 -0
- package/lib/templates/NarrowWide/NarrowWideDetails/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.css +21 -0
- package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +24 -0
- package/lib/templates/NarrowWide/NarrowWideForm/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +38 -0
- package/lib/templates/NarrowWide/NarrowWidePage/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumn/OneColumn.tsx +32 -0
- package/lib/templates/OneColumn/OneColumn/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumnPage/OneColumnPage.tsx +24 -0
- package/lib/templates/OneColumn/OneColumnPage/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumnTab/OneColumnTab.tsx +17 -0
- package/lib/templates/OneColumn/OneColumnTab/index.tsx +1 -0
- package/lib/templates/PromotedFilters/PromotedFilters.css +7 -0
- package/lib/templates/PromotedFilters/PromotedFilters.tsx +160 -0
- package/lib/templates/PromotedFilters/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTable/SimpleTable.tsx +28 -0
- package/lib/templates/SimpleTable/SimpleTable/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +719 -0
- package/lib/templates/SimpleTable/SimpleTableManual/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +129 -0
- package/lib/templates/SimpleTable/SimpleTableSelect/index.tsx +1 -0
- package/lib/templates/SimpleTable/helpers.ts +360 -0
- package/lib/templates/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +66 -0
- package/lib/templates/SingleReferenceReadOnly/index.tsx +1 -0
- package/lib/templates/SubTabs/SubTabs.tsx +65 -0
- package/lib/templates/SubTabs/index.tsx +1 -0
- package/lib/templates/SubTabs/tabUtils.ts +73 -0
- package/lib/templates/TwoColumn/TwoColumn/TwoColumn.css +13 -0
- package/lib/templates/TwoColumn/TwoColumn/TwoColumn.tsx +58 -0
- package/lib/templates/TwoColumn/TwoColumn/index.tsx +1 -0
- package/lib/templates/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +25 -0
- package/lib/templates/TwoColumn/TwoColumnPage/index.tsx +1 -0
- package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
- package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +55 -0
- package/lib/templates/TwoColumn/TwoColumnTab/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrow/WideNarrow.css +21 -0
- package/lib/templates/WideNarrow/WideNarrow/WideNarrow.tsx +35 -0
- package/lib/templates/WideNarrow/WideNarrow/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +54 -0
- package/lib/templates/WideNarrow/WideNarrowDetails/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.css +21 -0
- package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +24 -0
- package/lib/templates/WideNarrow/WideNarrowForm/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +38 -0
- package/lib/templates/WideNarrow/WideNarrowPage/index.tsx +1 -0
- package/lib/templates/utils.ts +23 -0
- package/lib/widgets/AppAnnouncement/AppAnnouncement.tsx +67 -0
- package/lib/widgets/AppAnnouncement/index.tsx +1 -0
- package/lib/widgets/CaseHistory/CaseHistory.tsx +169 -0
- package/lib/widgets/CaseHistory/index.tsx +1 -0
- package/lib/widgets/FileUtility/ActionButtonsForFileUtil.css +27 -0
- package/lib/widgets/FileUtility/ActionButtonsForFileUtil.tsx +22 -0
- package/lib/widgets/FileUtility/FileUtility.css +117 -0
- package/lib/widgets/FileUtility/FileUtility.tsx +567 -0
- package/lib/widgets/FileUtility/index.tsx +0 -0
- package/lib/widgets/Followers/Followers.tsx +43 -0
- package/lib/widgets/Followers/index.tsx +1 -0
- package/lib/widgets/SummaryItem/SummaryItem.css +78 -0
- package/lib/widgets/SummaryItem/SummaryItem.tsx +80 -0
- package/lib/widgets/SummaryItem/index.tsx +1 -0
- package/lib/widgets/SummaryList/SummaryList.tsx +12 -0
- package/lib/widgets/SummaryList/index.tsx +1 -0
- package/package.json +14 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import React, {useState} from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import TextField from '@material-ui/core/TextField';
|
|
4
|
+
import Popover from '@material-ui/core/Popover';
|
|
5
|
+
import Grid from '@material-ui/core/Grid';
|
|
6
|
+
import Typography from '@material-ui/core/Typography';
|
|
7
|
+
|
|
8
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
9
|
+
|
|
10
|
+
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
11
|
+
|
|
12
|
+
declare const PCore: any;
|
|
13
|
+
|
|
14
|
+
const useStyles = makeStyles((theme) => ({
|
|
15
|
+
root: {
|
|
16
|
+
padding: theme.spacing(1),
|
|
17
|
+
margin: theme.spacing(1),
|
|
18
|
+
},
|
|
19
|
+
popover: {
|
|
20
|
+
padding: theme.spacing(1),
|
|
21
|
+
margin: theme.spacing(1),
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
export default function Operator(props) {
|
|
26
|
+
// const componentName = "Operator";
|
|
27
|
+
const { caseOpConfig } = props;
|
|
28
|
+
const classes = useStyles();
|
|
29
|
+
|
|
30
|
+
const fieldLabel = caseOpConfig.label.toLowerCase();
|
|
31
|
+
let caseOpLabel = "---";
|
|
32
|
+
let caseOpName = "---";
|
|
33
|
+
let caseOpId = "";
|
|
34
|
+
let caseTime = null;
|
|
35
|
+
|
|
36
|
+
if (fieldLabel === "create operator") {
|
|
37
|
+
caseOpLabel = caseOpConfig.createLabel;
|
|
38
|
+
caseOpName = caseOpConfig.createOperator.userName;
|
|
39
|
+
caseTime = caseOpConfig.createDateTime;
|
|
40
|
+
caseOpId = caseOpConfig.createOperator.userId;
|
|
41
|
+
} else if (fieldLabel === "update operator") {
|
|
42
|
+
caseOpLabel = caseOpConfig.updateLabel;
|
|
43
|
+
caseOpName = caseOpConfig.updateOperator.userName;
|
|
44
|
+
caseTime = caseOpConfig.updateDateTime;
|
|
45
|
+
caseOpId = caseOpConfig.updateOperator.userId;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Popover-related
|
|
49
|
+
const [popoverAnchorEl, setPopoverAnchorEl] = useState(null);
|
|
50
|
+
const [popoverFields, setPopoverFields] = useState<Array<any>>([]);
|
|
51
|
+
|
|
52
|
+
const popoverOpen = Boolean(popoverAnchorEl);
|
|
53
|
+
const popoverId = popoverOpen ? 'operator-details-popover' : undefined;
|
|
54
|
+
|
|
55
|
+
const handlePopoverClose = (() => {
|
|
56
|
+
setPopoverAnchorEl(null);
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
function showOperatorDetails(event) {
|
|
60
|
+
|
|
61
|
+
const operatorPreviewPromise = PCore.getUserApi().getOperatorDetails(caseOpId);
|
|
62
|
+
|
|
63
|
+
operatorPreviewPromise.then((res) => {
|
|
64
|
+
const fillerString = "---";
|
|
65
|
+
let fields: any = [];
|
|
66
|
+
if (
|
|
67
|
+
res.data &&
|
|
68
|
+
res.data.pyOperatorInfo &&
|
|
69
|
+
res.data.pyOperatorInfo.pyUserName
|
|
70
|
+
) {
|
|
71
|
+
fields = [
|
|
72
|
+
{
|
|
73
|
+
id: "pyPosition",
|
|
74
|
+
name: "Position",
|
|
75
|
+
value: res.data.pyOperatorInfo.pyPosition ? res.data.pyOperatorInfo.pyPosition : fillerString
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "pyOrganization",
|
|
79
|
+
name: "Organization",
|
|
80
|
+
value: res.data.pyOperatorInfo.pyOrganization ? res.data.pyOperatorInfo.pyOrganization : fillerString
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "ReportToUserName",
|
|
84
|
+
name: "Reports to",
|
|
85
|
+
value: res.data.pyOperatorInfo.pyReportToUserName ? res.data.pyOperatorInfo.pyReportToUserName : fillerString
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "pyTelephone",
|
|
89
|
+
name: "Telephone",
|
|
90
|
+
value: res.data.pyOperatorInfo.pyTelephone ? <a href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>{res.data.pyOperatorInfo.pyTelephone}</a> : fillerString
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "pyEmailAddress",
|
|
94
|
+
name: "Email address",
|
|
95
|
+
value: res.data.pyOperatorInfo.pyEmailAddress ? <a href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>{res.data.pyOperatorInfo.pyEmailAddress}</a> : fillerString
|
|
96
|
+
}
|
|
97
|
+
];
|
|
98
|
+
} else {
|
|
99
|
+
// eslint-disable-next-line no-console
|
|
100
|
+
console.log(`Operator: PCore.getUserApi().getOperatorDetails(${caseOpId}); returned empty res.data.pyOperatorInfo.pyUserName - adding default`);
|
|
101
|
+
fields = [
|
|
102
|
+
{
|
|
103
|
+
id: "pyPosition",
|
|
104
|
+
name: "Position",
|
|
105
|
+
value: fillerString
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "pyOrganization",
|
|
109
|
+
name: "Organization",
|
|
110
|
+
value: fillerString
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: "ReportToUserName",
|
|
114
|
+
name: "Reports to",
|
|
115
|
+
value: fillerString
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "pyTelephone",
|
|
119
|
+
name: "Telephone",
|
|
120
|
+
value: fillerString
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "pyEmailAddress",
|
|
124
|
+
name: "Email address",
|
|
125
|
+
value: fillerString
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
// Whatever the fields are, update the component's popoverFields
|
|
130
|
+
setPopoverFields(fields);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
setPopoverAnchorEl(event.currentTarget);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getPopoverGrid() {
|
|
137
|
+
// return popoverFields.map((field) => {
|
|
138
|
+
// return <div className={classes.popover}>{field.name}: {field.value}</div>
|
|
139
|
+
// })
|
|
140
|
+
|
|
141
|
+
if (popoverFields.length === 0) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// There are fields, so build the grid.
|
|
146
|
+
return <Grid container className={classes.popover} spacing={1}>
|
|
147
|
+
<Grid item xs={12}><Typography variant="h6">{caseOpName}</Typography></Grid>
|
|
148
|
+
{popoverFields.map((field) => {
|
|
149
|
+
return <React.Fragment key={field.id}>
|
|
150
|
+
<Grid container item xs={12} spacing={1}>
|
|
151
|
+
<Grid item xs={6}><Typography variant="caption">{field.name}</Typography></Grid>
|
|
152
|
+
<Grid item xs={6}><Typography variant="subtitle2">{field.value}</Typography></Grid>
|
|
153
|
+
</Grid>
|
|
154
|
+
</React.Fragment>
|
|
155
|
+
})}
|
|
156
|
+
</Grid>
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// End of popover-related
|
|
161
|
+
|
|
162
|
+
return <React.Fragment>
|
|
163
|
+
<TextField
|
|
164
|
+
defaultValue={caseOpName}
|
|
165
|
+
label={caseOpLabel}
|
|
166
|
+
onClick={showOperatorDetails}
|
|
167
|
+
InputProps={{
|
|
168
|
+
readOnly: true,
|
|
169
|
+
inputProps: {style: {cursor: 'pointer'}}
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
<br />
|
|
173
|
+
{Utils.generateDateTime(caseTime, "DateTime-Since")}
|
|
174
|
+
|
|
175
|
+
<Popover
|
|
176
|
+
id={popoverId}
|
|
177
|
+
open={popoverOpen}
|
|
178
|
+
anchorEl={popoverAnchorEl}
|
|
179
|
+
onClose={handlePopoverClose}
|
|
180
|
+
anchorOrigin={{ vertical: 'bottom', horizontal: 'center'}}
|
|
181
|
+
transformOrigin={{ vertical: 'top', horizontal: 'center'}}
|
|
182
|
+
PaperProps={{ style: {maxWidth: '45ch'}}}
|
|
183
|
+
>
|
|
184
|
+
{getPopoverGrid()}
|
|
185
|
+
</Popover>
|
|
186
|
+
</React.Fragment>;
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
Operator.defaultProps = {
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
Operator.propTypes = {
|
|
194
|
+
caseOpConfig: PropTypes.object.isRequired,
|
|
195
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Operator';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// import PropTypes from "prop-types";
|
|
3
|
+
import { Card, CardContent, CardHeader, Typography } from "@material-ui/core";
|
|
4
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
5
|
+
|
|
6
|
+
const useStyles = makeStyles((theme) => ({
|
|
7
|
+
root: {
|
|
8
|
+
marginTop: theme.spacing(1),
|
|
9
|
+
marginBottom: theme.spacing(1),
|
|
10
|
+
borderLeft: "6px solid",
|
|
11
|
+
borderLeftColor: theme.palette.primary.light
|
|
12
|
+
},
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
export default function Pulse(/* props */) {
|
|
16
|
+
// const { children } = props;
|
|
17
|
+
const classes = useStyles();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Card className={classes.root}>
|
|
21
|
+
<CardHeader title={<Typography variant="h6">Pulse</Typography>} />
|
|
22
|
+
<CardContent>
|
|
23
|
+
<Typography>Pulse</Typography>
|
|
24
|
+
</CardContent>
|
|
25
|
+
</Card>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Pulse.propTypes = {
|
|
30
|
+
// children: PropTypes.arrayOf(PropTypes.node).isRequired
|
|
31
|
+
// };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Pulse';
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { TextField } from '@material-ui/core';
|
|
3
|
+
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
4
|
+
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
5
|
+
import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
|
|
6
|
+
import isDeepEqual from 'fast-deep-equal/react';
|
|
7
|
+
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
8
|
+
|
|
9
|
+
interface IOption {
|
|
10
|
+
key: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const preProcessColumns = columnList => {
|
|
15
|
+
return columnList.map(col => {
|
|
16
|
+
const tempColObj = { ...col };
|
|
17
|
+
tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
|
|
18
|
+
return tempColObj;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const getDisplayFieldsMetaData = columnList => {
|
|
23
|
+
const displayColumns = columnList.filter(col => col.display === 'true');
|
|
24
|
+
const metaDataObj: any = { key: '', primary: '', secondary: [] };
|
|
25
|
+
const keyCol = columnList.filter(col => col.key === 'true');
|
|
26
|
+
metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
|
|
27
|
+
for (let index = 0; index < displayColumns.length; index += 1) {
|
|
28
|
+
if (displayColumns[index].primary === 'true') {
|
|
29
|
+
metaDataObj.primary = displayColumns[index].value;
|
|
30
|
+
} else {
|
|
31
|
+
metaDataObj.secondary.push(displayColumns[index].value);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return metaDataObj;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default function AutoComplete(props) {
|
|
38
|
+
const {
|
|
39
|
+
getPConnect,
|
|
40
|
+
label,
|
|
41
|
+
required,
|
|
42
|
+
placeholder,
|
|
43
|
+
value = '',
|
|
44
|
+
validatemessage,
|
|
45
|
+
onChange,
|
|
46
|
+
readOnly,
|
|
47
|
+
testId,
|
|
48
|
+
displayMode,
|
|
49
|
+
deferDatasource,
|
|
50
|
+
datasourceMetadata,
|
|
51
|
+
status,
|
|
52
|
+
helperText
|
|
53
|
+
} = props;
|
|
54
|
+
let parameters = datasourceMetadata?.datasource?.parameters;
|
|
55
|
+
const context = getPConnect().getContextName();
|
|
56
|
+
let { listType, datasource = [], columns = [] } = props;
|
|
57
|
+
const [inputValue, setInputValue] = useState('');
|
|
58
|
+
const [options, setOptions] = useState<Array<IOption>>([]);
|
|
59
|
+
const [theDatasource, setDatasource] = useState(null);
|
|
60
|
+
let selectedValue: any = '';
|
|
61
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
62
|
+
|
|
63
|
+
if (!isDeepEqual(datasource, theDatasource)) {
|
|
64
|
+
// inbound datasource is different, so update theDatasource (to trigger useEffect)
|
|
65
|
+
setDatasource(datasource);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const flattenParameters = (params = {}) => {
|
|
69
|
+
const flatParams = {};
|
|
70
|
+
Object.keys(params).forEach((key) => {
|
|
71
|
+
const { name, value: theVal } = params[key];
|
|
72
|
+
flatParams[name] = theVal;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return flatParams;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// convert associated to datapage listtype and transform props
|
|
79
|
+
// Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList
|
|
80
|
+
if (deferDatasource && datasourceMetadata?.datasource?.name) {
|
|
81
|
+
listType = 'datapage';
|
|
82
|
+
datasource = datasourceMetadata.datasource.name;
|
|
83
|
+
parameters = flattenParameters(parameters);
|
|
84
|
+
const displayProp = datasourceMetadata.datasource.propertyForDisplayText.startsWith('@P')
|
|
85
|
+
? datasourceMetadata.datasource.propertyForDisplayText.substring(3)
|
|
86
|
+
: datasourceMetadata.datasource.propertyForDisplayText;
|
|
87
|
+
const valueProp = datasourceMetadata.datasource.propertyForValue.startsWith('@P')
|
|
88
|
+
? datasourceMetadata.datasource.propertyForValue.substring(3)
|
|
89
|
+
: datasourceMetadata.datasource.propertyForValue;
|
|
90
|
+
columns = [
|
|
91
|
+
{
|
|
92
|
+
key: 'true',
|
|
93
|
+
setProperty: 'Associated property',
|
|
94
|
+
value: valueProp
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
display: 'true',
|
|
98
|
+
primary: 'true',
|
|
99
|
+
useForSearch: true,
|
|
100
|
+
value: displayProp
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
columns = preProcessColumns(columns);
|
|
105
|
+
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (listType === 'associated') {
|
|
108
|
+
setOptions(Utils.getOptionList(props, getPConnect().getDataObject()));
|
|
109
|
+
}
|
|
110
|
+
}, [theDatasource]);
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (!displayMode && listType !== 'associated') {
|
|
114
|
+
getDataPage(datasource, parameters, context).then((results: any) => {
|
|
115
|
+
const optionsData: Array<any> = [];
|
|
116
|
+
const displayColumn = getDisplayFieldsMetaData(columns);
|
|
117
|
+
results?.forEach(element => {
|
|
118
|
+
const val = element[displayColumn.primary]?.toString();
|
|
119
|
+
const obj = {
|
|
120
|
+
key: element[displayColumn.key] || element.pyGUID,
|
|
121
|
+
value: val
|
|
122
|
+
};
|
|
123
|
+
optionsData.push(obj);
|
|
124
|
+
});
|
|
125
|
+
setOptions(optionsData);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}, []);
|
|
129
|
+
|
|
130
|
+
if (value) {
|
|
131
|
+
const index = options?.findIndex(element => element.key === value);
|
|
132
|
+
if (index > -1) {
|
|
133
|
+
selectedValue = options[index].value;
|
|
134
|
+
} else {
|
|
135
|
+
selectedValue = value;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const handleChange = (event: object, newValue) => {
|
|
140
|
+
onChange({ value: newValue ? newValue.key : '' });
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const handleInputValue = (event, newInputValue) => {
|
|
144
|
+
setInputValue(newInputValue);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
if (readOnly) {
|
|
148
|
+
const theValAsString = options?.find(opt => opt.key === value)?.value;
|
|
149
|
+
return <TextInput {...props} value={theValAsString} />;
|
|
150
|
+
}
|
|
151
|
+
// Need to use both getOptionLabel and getOptionSelected to map our
|
|
152
|
+
// key/value structure to what Autocomplete expects
|
|
153
|
+
return (
|
|
154
|
+
<Autocomplete
|
|
155
|
+
options={options}
|
|
156
|
+
getOptionLabel={(option: IOption) => {
|
|
157
|
+
return option.value ? option.value : '';
|
|
158
|
+
}}
|
|
159
|
+
getOptionSelected={(option: any) => {
|
|
160
|
+
return option.value ? option.value : '';
|
|
161
|
+
}}
|
|
162
|
+
fullWidth
|
|
163
|
+
onChange={handleChange}
|
|
164
|
+
value={selectedValue}
|
|
165
|
+
inputValue={inputValue || selectedValue}
|
|
166
|
+
onInputChange={handleInputValue}
|
|
167
|
+
renderInput={params => (
|
|
168
|
+
<TextField
|
|
169
|
+
{...params}
|
|
170
|
+
fullWidth
|
|
171
|
+
variant='outlined'
|
|
172
|
+
helperText={helperTextToDisplay}
|
|
173
|
+
placeholder={placeholder}
|
|
174
|
+
size='small'
|
|
175
|
+
required={required}
|
|
176
|
+
error={status === 'error'}
|
|
177
|
+
label={label}
|
|
178
|
+
data-test-id={testId}
|
|
179
|
+
/>
|
|
180
|
+
)}
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AutoComplete';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.cancel-alert-background {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
align-items: center;
|
|
6
|
+
height: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
background-color: rgba(100, 100, 100, 0.4);
|
|
9
|
+
position: fixed;
|
|
10
|
+
z-index: 9999;
|
|
11
|
+
top: 0px;
|
|
12
|
+
left: 0px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.cancel-alert-top {
|
|
16
|
+
display: table;
|
|
17
|
+
margin: auto;
|
|
18
|
+
min-width: 550px;
|
|
19
|
+
background-color: white;
|
|
20
|
+
border: 1px solid black;
|
|
21
|
+
border-radius: 10px;
|
|
22
|
+
padding: 20px;
|
|
23
|
+
box-shadow: 0 0 10px 3px #777;
|
|
24
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button, Grid, IconButton, Snackbar } from '@material-ui/core';
|
|
3
|
+
import CloseIcon from '@material-ui/icons/Close';
|
|
4
|
+
|
|
5
|
+
import './CancelAlert.css';
|
|
6
|
+
|
|
7
|
+
declare const PCore;
|
|
8
|
+
|
|
9
|
+
const CancelAlert = props => {
|
|
10
|
+
const { pConn, updateAlertState } = props;
|
|
11
|
+
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
12
|
+
const [snackbarMessage, setSnackbarMessage] = useState('');
|
|
13
|
+
|
|
14
|
+
const itemKey = pConn.getContextName();
|
|
15
|
+
const caseInfo = pConn.getCaseInfo();
|
|
16
|
+
const caseName = caseInfo.getName();
|
|
17
|
+
const ID = caseInfo.getID();
|
|
18
|
+
|
|
19
|
+
function showToast(message: string) {
|
|
20
|
+
setSnackbarMessage(message);
|
|
21
|
+
setShowSnackbar(true);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const dismissCancelAlertOnly = () => {
|
|
25
|
+
updateAlertState(true);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const dismissModal = () => {
|
|
29
|
+
updateAlertState(false);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
|
|
33
|
+
if (reason === 'clickaway') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
setShowSnackbar(false);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const buttonClick = action => {
|
|
40
|
+
const actionsAPI = pConn.getActionsApi();
|
|
41
|
+
|
|
42
|
+
switch (action) {
|
|
43
|
+
case 'save':
|
|
44
|
+
// eslint-disable-next-line no-case-declarations
|
|
45
|
+
const savePromise = actionsAPI.saveAndClose(itemKey);
|
|
46
|
+
|
|
47
|
+
savePromise
|
|
48
|
+
.then(() => {
|
|
49
|
+
dismissModal();
|
|
50
|
+
|
|
51
|
+
PCore.getPubSubUtils().publish(
|
|
52
|
+
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED
|
|
53
|
+
);
|
|
54
|
+
})
|
|
55
|
+
.catch(() => {
|
|
56
|
+
showToast('Save failed');
|
|
57
|
+
});
|
|
58
|
+
break;
|
|
59
|
+
|
|
60
|
+
case 'continue':
|
|
61
|
+
dismissCancelAlertOnly();
|
|
62
|
+
break;
|
|
63
|
+
|
|
64
|
+
case 'delete':
|
|
65
|
+
// eslint-disable-next-line no-case-declarations
|
|
66
|
+
const deletePromise = actionsAPI.deleteCaseInCreateStage(itemKey);
|
|
67
|
+
|
|
68
|
+
deletePromise
|
|
69
|
+
.then(() => {
|
|
70
|
+
dismissModal();
|
|
71
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
|
|
72
|
+
})
|
|
73
|
+
.catch(() => {
|
|
74
|
+
showToast('Delete failed.');
|
|
75
|
+
});
|
|
76
|
+
break;
|
|
77
|
+
|
|
78
|
+
default:
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
<div className='cancel-alert-background'>
|
|
86
|
+
<div className='cancel-alert-top'>
|
|
87
|
+
<h3>{`Delete ${caseName}(${ID})`}</h3>
|
|
88
|
+
<div>
|
|
89
|
+
<p>{`Are you sure you want to delete ${caseName} (${ID})?`}</p>
|
|
90
|
+
<p>Alternatively, you can continue working or save your work for later.</p>
|
|
91
|
+
</div>
|
|
92
|
+
<div className='action-controls'>
|
|
93
|
+
<Grid container spacing={4} justifyContent='space-between'>
|
|
94
|
+
<Grid item>
|
|
95
|
+
<Button variant='outlined' color='primary' onClick={() => buttonClick('save')}>
|
|
96
|
+
Save for later
|
|
97
|
+
</Button>
|
|
98
|
+
</Grid>
|
|
99
|
+
<Grid item>
|
|
100
|
+
<Button variant='outlined' color='primary' onClick={() => buttonClick('continue')}>
|
|
101
|
+
Continue Working
|
|
102
|
+
</Button>
|
|
103
|
+
<Button variant='contained' color='primary' onClick={() => buttonClick('delete')}>
|
|
104
|
+
Delete
|
|
105
|
+
</Button>
|
|
106
|
+
</Grid>
|
|
107
|
+
</Grid>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
<Snackbar
|
|
112
|
+
open={showSnackbar}
|
|
113
|
+
autoHideDuration={3000}
|
|
114
|
+
onClose={handleSnackbarClose}
|
|
115
|
+
message={snackbarMessage}
|
|
116
|
+
action={
|
|
117
|
+
<IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
|
|
118
|
+
<CloseIcon fontSize='small' />
|
|
119
|
+
</IconButton>
|
|
120
|
+
}
|
|
121
|
+
/>
|
|
122
|
+
</>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default CancelAlert;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CancelAlert';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Checkbox,
|
|
4
|
+
FormControl,
|
|
5
|
+
FormControlLabel,
|
|
6
|
+
FormGroup,
|
|
7
|
+
FormHelperText
|
|
8
|
+
} from '@material-ui/core';
|
|
9
|
+
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
10
|
+
|
|
11
|
+
export default function CheckboxComponent(props) {
|
|
12
|
+
const {
|
|
13
|
+
getPConnect,
|
|
14
|
+
value = false,
|
|
15
|
+
readOnly,
|
|
16
|
+
testId,
|
|
17
|
+
required,
|
|
18
|
+
status,
|
|
19
|
+
helperText,
|
|
20
|
+
validatemessage
|
|
21
|
+
} = props;
|
|
22
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
23
|
+
|
|
24
|
+
const thePConn = getPConnect();
|
|
25
|
+
const theConfigProps = thePConn.getConfigProps();
|
|
26
|
+
const { caption } = theConfigProps;
|
|
27
|
+
const actionsApi = thePConn.getActionsApi();
|
|
28
|
+
const propName = thePConn.getStateProps().value;
|
|
29
|
+
|
|
30
|
+
const [checked, setChecked] = useState(false);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
// This update theSelectedButton which will update the UI to show the selected button correctly
|
|
33
|
+
setChecked(value);
|
|
34
|
+
}, [value]);
|
|
35
|
+
|
|
36
|
+
const handleChange = event => {
|
|
37
|
+
handleEvent(actionsApi, 'changeNblur', propName, event.target.checked);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleBlur = event => {
|
|
41
|
+
thePConn.getValidationApi().validate(event.target.checked);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
let theCheckbox = <Checkbox color='primary' />;
|
|
45
|
+
|
|
46
|
+
if (readOnly) {
|
|
47
|
+
// Workaround for lack of InputProps readOnly from https://github.com/mui-org/material-ui/issues/17043
|
|
48
|
+
// Also note that we need to turn off the onChange call in the FormControlLabel wrapper, too. See below!
|
|
49
|
+
theCheckbox = <Checkbox value={value || false} onChange={handleChange} readOnly={readOnly} />;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<FormControl required={required} error={status === 'error'}>
|
|
54
|
+
<FormGroup>
|
|
55
|
+
<FormControlLabel
|
|
56
|
+
control={theCheckbox}
|
|
57
|
+
checked={checked}
|
|
58
|
+
onChange={!readOnly ? handleChange : undefined}
|
|
59
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
60
|
+
label={caption}
|
|
61
|
+
labelPlacement='end'
|
|
62
|
+
data-test-id={testId}
|
|
63
|
+
/>
|
|
64
|
+
</FormGroup>
|
|
65
|
+
<FormHelperText>{helperTextToDisplay}</FormHelperText>
|
|
66
|
+
</FormControl>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Checkbox';
|