@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,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MuiPhoneNumber from 'material-ui-phone-number';
|
|
3
|
+
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
|
|
4
|
+
|
|
5
|
+
export default function Phone(props) {
|
|
6
|
+
const {
|
|
7
|
+
label,
|
|
8
|
+
required,
|
|
9
|
+
disabled,
|
|
10
|
+
value = '',
|
|
11
|
+
validatemessage,
|
|
12
|
+
status,
|
|
13
|
+
onChange,
|
|
14
|
+
onBlur,
|
|
15
|
+
readOnly,
|
|
16
|
+
testId,
|
|
17
|
+
helperText,
|
|
18
|
+
displayMode
|
|
19
|
+
} = props;
|
|
20
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
21
|
+
|
|
22
|
+
let testProp = {};
|
|
23
|
+
|
|
24
|
+
testProp = {
|
|
25
|
+
'data-test-id': testId
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
if(displayMode === 'LABELS_LEFT') {
|
|
29
|
+
const field = {
|
|
30
|
+
[label]: value
|
|
31
|
+
};
|
|
32
|
+
return <FieldValueList item={field} />
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (readOnly) {
|
|
36
|
+
const disableDropdown = true;
|
|
37
|
+
return (
|
|
38
|
+
<div>
|
|
39
|
+
<MuiPhoneNumber
|
|
40
|
+
fullWidth
|
|
41
|
+
helperText={helperTextToDisplay}
|
|
42
|
+
placeholder=''
|
|
43
|
+
size='small'
|
|
44
|
+
required={required}
|
|
45
|
+
disabled={disabled}
|
|
46
|
+
onChange={onChange}
|
|
47
|
+
error={status === 'error'}
|
|
48
|
+
label={label}
|
|
49
|
+
value={value}
|
|
50
|
+
InputProps={{
|
|
51
|
+
readOnly: true
|
|
52
|
+
}}
|
|
53
|
+
disableDropdown={disableDropdown}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const handleChange = inputVal => {
|
|
61
|
+
let phoneValue = inputVal && inputVal.replace(/\D+/g, '');
|
|
62
|
+
phoneValue = `+${phoneValue}`;
|
|
63
|
+
onChange({ value: phoneValue });
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handleBlur = event => {
|
|
67
|
+
const phoneValue = event?.target?.value;
|
|
68
|
+
event.target.value = `+${phoneValue && phoneValue.replace(/\D+/g, '')}`;
|
|
69
|
+
onBlur(event);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<MuiPhoneNumber
|
|
74
|
+
fullWidth
|
|
75
|
+
variant='outlined'
|
|
76
|
+
helperText={helperTextToDisplay}
|
|
77
|
+
placeholder=''
|
|
78
|
+
size='small'
|
|
79
|
+
defaultCountry='us'
|
|
80
|
+
required={required}
|
|
81
|
+
disabled={disabled}
|
|
82
|
+
onChange={handleChange}
|
|
83
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
84
|
+
error={status === 'error'}
|
|
85
|
+
label={label}
|
|
86
|
+
value={value}
|
|
87
|
+
InputProps={{ ...testProp }}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Phone';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Radio,
|
|
4
|
+
RadioGroup,
|
|
5
|
+
FormControl,
|
|
6
|
+
FormControlLabel,
|
|
7
|
+
FormLabel,
|
|
8
|
+
FormHelperText
|
|
9
|
+
} from '@material-ui/core';
|
|
10
|
+
|
|
11
|
+
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
12
|
+
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
13
|
+
|
|
14
|
+
export default function RadioButtons(props) {
|
|
15
|
+
const {
|
|
16
|
+
getPConnect,
|
|
17
|
+
label,
|
|
18
|
+
value = '',
|
|
19
|
+
readOnly,
|
|
20
|
+
validatemessage,
|
|
21
|
+
helperText,
|
|
22
|
+
status,
|
|
23
|
+
required,
|
|
24
|
+
inline
|
|
25
|
+
} = props;
|
|
26
|
+
const [theSelectedButton, setSelectedButton] = useState(value);
|
|
27
|
+
|
|
28
|
+
const thePConn = getPConnect();
|
|
29
|
+
const theConfigProps = thePConn.getConfigProps();
|
|
30
|
+
const actionsApi = thePConn.getActionsApi();
|
|
31
|
+
const propName = thePConn.getStateProps().value;
|
|
32
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
33
|
+
|
|
34
|
+
// theOptions will be an array of JSON objects that are literally key/value pairs.
|
|
35
|
+
// Ex: [ {key: "Basic", value: "Basic"} ]
|
|
36
|
+
const theOptions = Utils.getOptionList(theConfigProps, thePConn.getDataObject());
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
// This update theSelectedButton which will update the UI to show the selected button correctly
|
|
40
|
+
setSelectedButton(value);
|
|
41
|
+
}, [value]);
|
|
42
|
+
|
|
43
|
+
const handleChange = event => {
|
|
44
|
+
handleEvent(actionsApi, 'changeNblur', propName, event.target.value);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const handleBlur = event => {
|
|
48
|
+
thePConn.getValidationApi().validate(event.target.value);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<FormControl error={status === 'error'} required={required}>
|
|
53
|
+
<FormLabel component='legend'>{label}</FormLabel>
|
|
54
|
+
<RadioGroup
|
|
55
|
+
value={theSelectedButton}
|
|
56
|
+
onChange={handleChange}
|
|
57
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
58
|
+
row={inline}>
|
|
59
|
+
{theOptions.map(theOption => {
|
|
60
|
+
return (
|
|
61
|
+
<FormControlLabel
|
|
62
|
+
value={theOption.key}
|
|
63
|
+
key={theOption.key}
|
|
64
|
+
label={theOption.value}
|
|
65
|
+
control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
69
|
+
</RadioGroup>
|
|
70
|
+
<FormHelperText>{helperTextToDisplay}</FormHelperText>
|
|
71
|
+
</FormControl>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './RadioButtons';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import Typography from '@material-ui/core/Typography';
|
|
4
|
+
import Grid from '@material-ui/core/Grid';
|
|
5
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
6
|
+
|
|
7
|
+
/* although this is called the SemanticLink component, we are not yet displaying as a
|
|
8
|
+
SemanticLink in SDK and only showing the value as a read only text field. */
|
|
9
|
+
|
|
10
|
+
const useStyles = makeStyles((theme) => ({
|
|
11
|
+
root: {
|
|
12
|
+
paddingRight: theme.spacing(1),
|
|
13
|
+
paddingLeft: theme.spacing(1),
|
|
14
|
+
paddingTop: theme.spacing(1),
|
|
15
|
+
paddingBottom: theme.spacing(1),
|
|
16
|
+
marginRight: theme.spacing(1),
|
|
17
|
+
marginLeft: theme.spacing(1),
|
|
18
|
+
marginTop: theme.spacing(1),
|
|
19
|
+
marginBottom: theme.spacing(1),
|
|
20
|
+
},
|
|
21
|
+
fieldMargin: {
|
|
22
|
+
paddingRight: theme.spacing(1),
|
|
23
|
+
paddingLeft: theme.spacing(1),
|
|
24
|
+
paddingTop: theme.spacing(1),
|
|
25
|
+
paddingBottom: theme.spacing(1),
|
|
26
|
+
marginRight: theme.spacing(1),
|
|
27
|
+
marginLeft: theme.spacing(1),
|
|
28
|
+
marginTop: theme.spacing(1),
|
|
29
|
+
marginBottom: theme.spacing(1),
|
|
30
|
+
},
|
|
31
|
+
fieldLabel: {
|
|
32
|
+
fontWeight: 400,
|
|
33
|
+
color: theme.palette.text.secondary
|
|
34
|
+
},
|
|
35
|
+
fieldValue: {
|
|
36
|
+
fontWeight: 400,
|
|
37
|
+
color: theme.palette.text.primary
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
export default function SemanticLink(props) {
|
|
42
|
+
const {
|
|
43
|
+
text,
|
|
44
|
+
displayMode,
|
|
45
|
+
label,
|
|
46
|
+
} = props;
|
|
47
|
+
const classes = useStyles();
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if (displayMode === "LABELS_LEFT" || (!displayMode && label !== undefined)) {
|
|
51
|
+
const value = text || "---";
|
|
52
|
+
return (
|
|
53
|
+
<Grid container spacing={1} style={{padding: "4px 0px"}} id="semantic-link-grid">
|
|
54
|
+
<Grid item xs={6}>
|
|
55
|
+
<Typography variant="body2" component="span" className={`${classes.fieldLabel} ${classes.fieldMargin}`}>{label}</Typography>
|
|
56
|
+
</Grid>
|
|
57
|
+
<Grid item xs={6}>
|
|
58
|
+
<Typography variant="body2" component="span" className={classes.fieldValue}>{value}</Typography>
|
|
59
|
+
</Grid>
|
|
60
|
+
</Grid>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
SemanticLink.propTypes = {
|
|
66
|
+
text: PropTypes.string.isRequired,
|
|
67
|
+
displayMode: PropTypes.string,
|
|
68
|
+
label: PropTypes.string,
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SemanticLink';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare const PCore;
|
|
2
|
+
|
|
3
|
+
function getDataReferenceInfo(pConnect, dataRelationshipContext) {
|
|
4
|
+
if (!pConnect) {
|
|
5
|
+
throw Error("PConnect parameter is required");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let dataContext = "";
|
|
9
|
+
const payload = {};
|
|
10
|
+
const pageReference = pConnect.getPageReference();
|
|
11
|
+
const annotationUtils = PCore.getAnnotationUtils();
|
|
12
|
+
let fieldMetadata;
|
|
13
|
+
|
|
14
|
+
if (pageReference) {
|
|
15
|
+
/*
|
|
16
|
+
For page list the page refernce will be something like caseInfo.content.EmployeeRef[1].
|
|
17
|
+
Need to extract EmployeeRef from caseInfo.content.EmployeeRef[1]
|
|
18
|
+
*/
|
|
19
|
+
const propertySplit = pageReference.split(".");
|
|
20
|
+
|
|
21
|
+
// Regex to match if the property is list type. Eg: EmployeeRef[1]
|
|
22
|
+
const listPropertyRegex = /([a-z|A-Z]*[[][\d]*)[\]]$/gm;
|
|
23
|
+
// Regex to match [1] part of the property EmployeeRef[1]
|
|
24
|
+
const indexRegex = /([[][\d]*[\]])+/gm;
|
|
25
|
+
|
|
26
|
+
let contextProperty = dataRelationshipContext !== null ? dataRelationshipContext : propertySplit.pop();
|
|
27
|
+
const isListProperty = listPropertyRegex.test(contextProperty);
|
|
28
|
+
contextProperty = isListProperty
|
|
29
|
+
? contextProperty.replace(indexRegex, "")
|
|
30
|
+
: contextProperty;
|
|
31
|
+
fieldMetadata = pConnect.getFieldMetadata(contextProperty);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!!fieldMetadata && fieldMetadata.datasource) {
|
|
35
|
+
const { name, parameters } = fieldMetadata.datasource;
|
|
36
|
+
dataContext = name;
|
|
37
|
+
for (const [key, value] of Object.entries(parameters)) {
|
|
38
|
+
const property = dataRelationshipContext !== null ? annotationUtils.getPropertyName(value) : annotationUtils.getLeafPropertyName(value)
|
|
39
|
+
payload[key] = pConnect.getValue(`.${property}`);
|
|
40
|
+
}
|
|
41
|
+
return { dataContext, dataContextParameters: payload };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function isLinkTextEmpty(text) {
|
|
48
|
+
return text === "" || text === undefined || text === null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default { getDataReferenceInfo, isLinkTextEmpty };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextField } from '@material-ui/core';
|
|
3
|
+
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
|
|
4
|
+
|
|
5
|
+
export default function TextArea(props) {
|
|
6
|
+
const {
|
|
7
|
+
label,
|
|
8
|
+
required,
|
|
9
|
+
disabled,
|
|
10
|
+
value = '',
|
|
11
|
+
validatemessage,
|
|
12
|
+
status,
|
|
13
|
+
onChange,
|
|
14
|
+
onBlur,
|
|
15
|
+
readOnly,
|
|
16
|
+
testId,
|
|
17
|
+
fieldMetadata,
|
|
18
|
+
helperText,
|
|
19
|
+
displayMode
|
|
20
|
+
} = props;
|
|
21
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
22
|
+
|
|
23
|
+
const maxLength = fieldMetadata?.maxLength;
|
|
24
|
+
|
|
25
|
+
let readOnlyProp = {};
|
|
26
|
+
|
|
27
|
+
if(displayMode === 'LABELS_LEFT') {
|
|
28
|
+
const field = {
|
|
29
|
+
[label]: value
|
|
30
|
+
};
|
|
31
|
+
return <FieldValueList item={field} />
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (readOnly) {
|
|
35
|
+
// Not just emitting a read only Textfield like some other components do
|
|
36
|
+
// since we want to preserve the minRows, maxRows info.
|
|
37
|
+
readOnlyProp = { readOnly: true };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let testProp = {};
|
|
41
|
+
|
|
42
|
+
testProp = {
|
|
43
|
+
'data-test-id': testId
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<TextField
|
|
48
|
+
multiline
|
|
49
|
+
minRows={5}
|
|
50
|
+
maxRows={5}
|
|
51
|
+
fullWidth
|
|
52
|
+
variant={readOnly ? 'standard' : 'outlined'}
|
|
53
|
+
helperText={helperTextToDisplay}
|
|
54
|
+
placeholder=''
|
|
55
|
+
size='small'
|
|
56
|
+
required={required}
|
|
57
|
+
disabled={disabled}
|
|
58
|
+
onChange={onChange}
|
|
59
|
+
onBlur={!readOnly ? onBlur : undefined}
|
|
60
|
+
error={status === 'error'}
|
|
61
|
+
label={label}
|
|
62
|
+
value={value}
|
|
63
|
+
InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextArea';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Typography } from '@material-ui/core';
|
|
3
|
+
|
|
4
|
+
export default function TextContent(props) {
|
|
5
|
+
type ExpectedDisplayAs = 'Paragraph' | 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Heading 4';
|
|
6
|
+
type ExpectedVariants = 'body1' | 'h1' | 'h2' | 'h3' | 'h4';
|
|
7
|
+
|
|
8
|
+
const { content, displayAs }: { content: string; displayAs: ExpectedDisplayAs } = props;
|
|
9
|
+
|
|
10
|
+
let theVariant: ExpectedVariants = 'body1';
|
|
11
|
+
|
|
12
|
+
switch (displayAs) {
|
|
13
|
+
case 'Paragraph':
|
|
14
|
+
theVariant = 'body1';
|
|
15
|
+
break;
|
|
16
|
+
|
|
17
|
+
case 'Heading 1':
|
|
18
|
+
theVariant = 'h1';
|
|
19
|
+
break;
|
|
20
|
+
|
|
21
|
+
case 'Heading 2':
|
|
22
|
+
theVariant = 'h2';
|
|
23
|
+
break;
|
|
24
|
+
|
|
25
|
+
case 'Heading 3':
|
|
26
|
+
theVariant = 'h3';
|
|
27
|
+
break;
|
|
28
|
+
|
|
29
|
+
case 'Heading 4':
|
|
30
|
+
theVariant = 'h4';
|
|
31
|
+
break;
|
|
32
|
+
|
|
33
|
+
default:
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
console.error(`TextContent got an expected displayAs prop: ${displayAs}`);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return <Typography variant={theVariant}>{content}</Typography>;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextContent';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextField } from '@material-ui/core';
|
|
3
|
+
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
|
|
4
|
+
|
|
5
|
+
export default function TextInput(props) {
|
|
6
|
+
const {
|
|
7
|
+
label,
|
|
8
|
+
required,
|
|
9
|
+
disabled,
|
|
10
|
+
value = '',
|
|
11
|
+
validatemessage,
|
|
12
|
+
status,
|
|
13
|
+
onChange,
|
|
14
|
+
onBlur,
|
|
15
|
+
readOnly,
|
|
16
|
+
testId,
|
|
17
|
+
fieldMetadata,
|
|
18
|
+
helperText,
|
|
19
|
+
displayMode
|
|
20
|
+
} = props;
|
|
21
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
22
|
+
|
|
23
|
+
const maxLength = fieldMetadata?.maxLength;
|
|
24
|
+
|
|
25
|
+
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
26
|
+
|
|
27
|
+
if(displayMode === 'LABELS_LEFT') {
|
|
28
|
+
const field = {
|
|
29
|
+
[label]: value
|
|
30
|
+
};
|
|
31
|
+
return <FieldValueList item={field} />
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (readOnly) {
|
|
35
|
+
readOnlyProp = { readOnly: true };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let testProp = {};
|
|
39
|
+
|
|
40
|
+
testProp = {
|
|
41
|
+
'data-test-id': testId
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<TextField
|
|
46
|
+
fullWidth
|
|
47
|
+
variant={readOnly ? 'standard' : 'outlined'}
|
|
48
|
+
helperText={helperTextToDisplay}
|
|
49
|
+
placeholder=''
|
|
50
|
+
size='small'
|
|
51
|
+
required={required}
|
|
52
|
+
disabled={disabled}
|
|
53
|
+
onChange={onChange}
|
|
54
|
+
onBlur={!readOnly ? onBlur : undefined}
|
|
55
|
+
error={status === 'error'}
|
|
56
|
+
label={label}
|
|
57
|
+
value={value}
|
|
58
|
+
InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextInput';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KeyboardTimePicker } from '@material-ui/pickers';
|
|
3
|
+
import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import AccessTimeIcon from '@material-ui/icons/AccessTime';
|
|
6
|
+
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
|
|
7
|
+
|
|
8
|
+
export default function Time(props) {
|
|
9
|
+
const {
|
|
10
|
+
label,
|
|
11
|
+
required,
|
|
12
|
+
disabled,
|
|
13
|
+
value,
|
|
14
|
+
validatemessage,
|
|
15
|
+
status,
|
|
16
|
+
onChange,
|
|
17
|
+
readOnly,
|
|
18
|
+
helperText,
|
|
19
|
+
displayMode
|
|
20
|
+
} = props;
|
|
21
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
22
|
+
|
|
23
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
24
|
+
const field = {
|
|
25
|
+
[label]: value
|
|
26
|
+
};
|
|
27
|
+
return <FieldValueList item={field} />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (readOnly) {
|
|
31
|
+
return <TextInput {...props} />;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const handleChange = date => {
|
|
35
|
+
const theValue = date && date.isValid() ? date.format('HH:mm') : null;
|
|
36
|
+
onChange({ value: theValue });
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
let timeValue: any = null;
|
|
40
|
+
if (value) {
|
|
41
|
+
const timeArray = value.split(':').map(itm => Number(itm));
|
|
42
|
+
timeValue = dayjs().hour(timeArray[0]).minute(timeArray[1]);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//
|
|
46
|
+
// TODO: Keyboard doesn't work in the minute field, it updates one digit then jump to am/pm field
|
|
47
|
+
// try an older version of the lib or use DateTimePicker
|
|
48
|
+
//
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<KeyboardTimePicker
|
|
52
|
+
variant='inline'
|
|
53
|
+
inputVariant='outlined'
|
|
54
|
+
placeholder='hh:mm am'
|
|
55
|
+
keyboardIcon={<AccessTimeIcon />}
|
|
56
|
+
fullWidth
|
|
57
|
+
required={required}
|
|
58
|
+
disabled={disabled}
|
|
59
|
+
error={status === 'error'}
|
|
60
|
+
helperText={helperTextToDisplay}
|
|
61
|
+
minutesStep={5}
|
|
62
|
+
size='small'
|
|
63
|
+
label={label}
|
|
64
|
+
autoOk
|
|
65
|
+
mask='__:__ _m'
|
|
66
|
+
format='hh:mm a'
|
|
67
|
+
value={timeValue}
|
|
68
|
+
onChange={handleChange}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Time';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextField } from '@material-ui/core';
|
|
3
|
+
import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
|
|
4
|
+
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
|
|
5
|
+
|
|
6
|
+
// NOTE: that we had to change the name from URL to URLComponent
|
|
7
|
+
// Otherwise, we were getting all kinds of weird errors when we
|
|
8
|
+
// referred to URL as a component.
|
|
9
|
+
export default function URLComponent(props) {
|
|
10
|
+
const {
|
|
11
|
+
label,
|
|
12
|
+
required,
|
|
13
|
+
disabled,
|
|
14
|
+
value = '',
|
|
15
|
+
validatemessage,
|
|
16
|
+
status,
|
|
17
|
+
onChange,
|
|
18
|
+
onBlur,
|
|
19
|
+
readOnly,
|
|
20
|
+
helperText,
|
|
21
|
+
displayMode
|
|
22
|
+
} = props;
|
|
23
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
24
|
+
|
|
25
|
+
if(displayMode === 'LABELS_LEFT') {
|
|
26
|
+
const field = {
|
|
27
|
+
[label]: value
|
|
28
|
+
};
|
|
29
|
+
return <FieldValueList item={field} />
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (readOnly) {
|
|
33
|
+
return <TextInput {...props} />;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<TextField
|
|
38
|
+
type='url'
|
|
39
|
+
fullWidth
|
|
40
|
+
variant='outlined'
|
|
41
|
+
helperText={helperTextToDisplay}
|
|
42
|
+
placeholder=''
|
|
43
|
+
size='small'
|
|
44
|
+
required={required}
|
|
45
|
+
disabled={disabled}
|
|
46
|
+
onChange={onChange}
|
|
47
|
+
onBlur={!readOnly ? onBlur : undefined}
|
|
48
|
+
error={status === 'error'}
|
|
49
|
+
label={label}
|
|
50
|
+
value={value}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './URL';
|