@pega/react-sdk-overrides 8.23.10 → 23.1.10
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 +38 -19
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
- package/lib/field/Checkbox/Checkbox.tsx +42 -9
- package/lib/field/Currency/Currency.tsx +24 -16
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +32 -18
- package/lib/field/DateTime/DateTime.tsx +27 -16
- package/lib/field/Decimal/Decimal.tsx +82 -19
- package/lib/field/Dropdown/Dropdown.tsx +60 -15
- 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 +57 -28
- package/lib/field/RichText/RichText.tsx +95 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +73 -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 +752 -401
- 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} +10 -11
- 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 +44 -35
- 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 -25
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +25 -30
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
- package/lib/infra/DashboardFilter/filterUtils.tsx +4 -1
- package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -20
- package/lib/infra/MultiStep/MultiStep.tsx +24 -24
- package/lib/infra/NavBar/NavBar.tsx +23 -24
- package/lib/infra/Reference/Reference.tsx +14 -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 +30 -57
- 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 +51 -53
- 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/Details/DynamicTabs/DynamicTabs.tsx +78 -0
- package/lib/template/Details/DynamicTabs/config.json +36 -0
- package/lib/template/Details/DynamicTabs/index.tsx +1 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
- package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +20 -18
- package/lib/template/ListPage/ListPage.tsx +14 -13
- package/lib/template/ListView/ListView.tsx +244 -314
- 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 +29 -8
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +33 -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,30 +1,30 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { TextField } from '@material-ui/core';
|
|
3
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/field/TextInput';
|
|
6
4
|
import isDeepEqual from 'fast-deep-equal/react';
|
|
5
|
+
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
7
6
|
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
8
7
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
9
|
-
import
|
|
8
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
9
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
10
10
|
|
|
11
11
|
interface IOption {
|
|
12
12
|
key: string;
|
|
13
13
|
value: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const preProcessColumns = columnList => {
|
|
17
|
-
return columnList.map(col => {
|
|
16
|
+
const preProcessColumns = (columnList) => {
|
|
17
|
+
return columnList.map((col) => {
|
|
18
18
|
const tempColObj = { ...col };
|
|
19
19
|
tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
|
|
20
20
|
return tempColObj;
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const getDisplayFieldsMetaData = columnList => {
|
|
25
|
-
const displayColumns = columnList.filter(col => col.display === 'true');
|
|
24
|
+
const getDisplayFieldsMetaData = (columnList) => {
|
|
25
|
+
const displayColumns = columnList.filter((col) => col.display === 'true');
|
|
26
26
|
const metaDataObj: any = { key: '', primary: '', secondary: [] };
|
|
27
|
-
const keyCol = columnList.filter(col => col.key === 'true');
|
|
27
|
+
const keyCol = columnList.filter((col) => col.key === 'true');
|
|
28
28
|
metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
|
|
29
29
|
for (let index = 0; index < displayColumns.length; index += 1) {
|
|
30
30
|
if (displayColumns[index].primary === 'true') {
|
|
@@ -36,7 +36,25 @@ const getDisplayFieldsMetaData = columnList => {
|
|
|
36
36
|
return metaDataObj;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
interface AutoCompleteProps extends PConnFieldProps {
|
|
40
|
+
// If any, enter additional props that only exist on AutoComplete here'
|
|
41
|
+
displayMode?: string;
|
|
42
|
+
deferDatasource?: boolean;
|
|
43
|
+
datasourceMetadata?: any;
|
|
44
|
+
status?: string;
|
|
45
|
+
onRecordChange?: any;
|
|
46
|
+
additionalProps?: object;
|
|
47
|
+
listType: string;
|
|
48
|
+
parameters?: any;
|
|
49
|
+
datasource: any;
|
|
50
|
+
columns: Array<any>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default function AutoComplete(props: AutoCompleteProps) {
|
|
54
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
55
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
56
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
57
|
+
|
|
40
58
|
const {
|
|
41
59
|
getPConnect,
|
|
42
60
|
label,
|
|
@@ -54,6 +72,7 @@ export default function AutoComplete(props) {
|
|
|
54
72
|
hideLabel,
|
|
55
73
|
onRecordChange
|
|
56
74
|
} = props;
|
|
75
|
+
|
|
57
76
|
const context = getPConnect().getContextName();
|
|
58
77
|
let { listType, parameters, datasource = [], columns = [] } = props;
|
|
59
78
|
const [inputValue, setInputValue] = useState('');
|
|
@@ -64,7 +83,7 @@ export default function AutoComplete(props) {
|
|
|
64
83
|
|
|
65
84
|
const thePConn = getPConnect();
|
|
66
85
|
const actionsApi = thePConn.getActionsApi();
|
|
67
|
-
const propName = thePConn.getStateProps()
|
|
86
|
+
const propName = thePConn.getStateProps()["value"];
|
|
68
87
|
|
|
69
88
|
if (!isDeepEqual(datasource, theDatasource)) {
|
|
70
89
|
// inbound datasource is different, so update theDatasource (to trigger useEffect)
|
|
@@ -73,7 +92,7 @@ export default function AutoComplete(props) {
|
|
|
73
92
|
|
|
74
93
|
const flattenParameters = (params = {}) => {
|
|
75
94
|
const flatParams = {};
|
|
76
|
-
Object.keys(params).forEach(key => {
|
|
95
|
+
Object.keys(params).forEach((key) => {
|
|
77
96
|
const { name, value: theVal } = params[key];
|
|
78
97
|
flatParams[name] = theVal;
|
|
79
98
|
});
|
|
@@ -111,7 +130,7 @@ export default function AutoComplete(props) {
|
|
|
111
130
|
|
|
112
131
|
useEffect(() => {
|
|
113
132
|
if (listType === 'associated') {
|
|
114
|
-
setOptions(Utils.getOptionList(props, getPConnect().getDataObject()));
|
|
133
|
+
setOptions(Utils.getOptionList(props, getPConnect().getDataObject('')));
|
|
115
134
|
}
|
|
116
135
|
}, [theDatasource]);
|
|
117
136
|
|
|
@@ -120,7 +139,7 @@ export default function AutoComplete(props) {
|
|
|
120
139
|
getDataPage(datasource, parameters, context).then((results: any) => {
|
|
121
140
|
const optionsData: Array<any> = [];
|
|
122
141
|
const displayColumn = getDisplayFieldsMetaData(columns);
|
|
123
|
-
results?.forEach(element => {
|
|
142
|
+
results?.forEach((element) => {
|
|
124
143
|
const val = element[displayColumn.primary]?.toString();
|
|
125
144
|
const obj = {
|
|
126
145
|
key: element[displayColumn.key] || element.pyGUID,
|
|
@@ -138,11 +157,11 @@ export default function AutoComplete(props) {
|
|
|
138
157
|
}
|
|
139
158
|
|
|
140
159
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
141
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant=
|
|
160
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
142
161
|
}
|
|
143
162
|
|
|
144
163
|
if (value) {
|
|
145
|
-
const index = options?.findIndex(element => element.key === value);
|
|
164
|
+
const index = options?.findIndex((element) => element.key === value);
|
|
146
165
|
if (index > -1) {
|
|
147
166
|
selectedValue = options[index].value;
|
|
148
167
|
} else {
|
|
@@ -163,7 +182,7 @@ export default function AutoComplete(props) {
|
|
|
163
182
|
};
|
|
164
183
|
|
|
165
184
|
if (readOnly) {
|
|
166
|
-
const theValAsString = options?.find(opt => opt.key === value)?.value;
|
|
185
|
+
const theValAsString = options?.find((opt) => opt.key === value)?.value;
|
|
167
186
|
return <TextInput {...props} value={theValAsString} />;
|
|
168
187
|
}
|
|
169
188
|
// Need to use both getOptionLabel and getOptionSelected to map our
|
|
@@ -182,14 +201,14 @@ export default function AutoComplete(props) {
|
|
|
182
201
|
value={selectedValue}
|
|
183
202
|
inputValue={inputValue || selectedValue}
|
|
184
203
|
onInputChange={handleInputValue}
|
|
185
|
-
renderInput={params => (
|
|
204
|
+
renderInput={(params) => (
|
|
186
205
|
<TextField
|
|
187
206
|
{...params}
|
|
188
207
|
fullWidth
|
|
189
|
-
variant=
|
|
208
|
+
variant="outlined"
|
|
190
209
|
helperText={helperTextToDisplay}
|
|
191
210
|
placeholder={placeholder}
|
|
192
|
-
size=
|
|
211
|
+
size="small"
|
|
193
212
|
required={required}
|
|
194
213
|
error={status === 'error'}
|
|
195
214
|
label={label}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Button, Grid, IconButton, Snackbar } from '@material-ui/core';
|
|
3
3
|
import CloseIcon from '@material-ui/icons/Close';
|
|
4
|
-
|
|
4
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
5
|
import './CancelAlert.css';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
|
|
8
|
+
declare const PCore: any;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
interface CancelAlertProps extends PConnFieldProps {
|
|
12
|
+
// If any, enter additional props that only exist on CancelAlert here
|
|
13
|
+
pConn: any,
|
|
14
|
+
updateAlertState: any
|
|
15
|
+
}
|
|
8
16
|
|
|
9
|
-
|
|
17
|
+
|
|
18
|
+
export default function CancelAlert(props: CancelAlertProps) {
|
|
10
19
|
const { pConn, updateAlertState } = props;
|
|
11
20
|
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
12
21
|
const [snackbarMessage, setSnackbarMessage] = useState('');
|
|
@@ -15,6 +24,8 @@ const CancelAlert = props => {
|
|
|
15
24
|
const caseInfo = pConn.getCaseInfo();
|
|
16
25
|
const caseName = caseInfo.getName();
|
|
17
26
|
const ID = caseInfo.getID();
|
|
27
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
28
|
+
const localeCategory = 'ModalContainer';
|
|
18
29
|
|
|
19
30
|
function showToast(message: string) {
|
|
20
31
|
setSnackbarMessage(message);
|
|
@@ -53,7 +64,7 @@ const CancelAlert = props => {
|
|
|
53
64
|
);
|
|
54
65
|
})
|
|
55
66
|
.catch(() => {
|
|
56
|
-
showToast('Save failed');
|
|
67
|
+
showToast(localizedVal('Save failed', localeCategory));
|
|
57
68
|
});
|
|
58
69
|
break;
|
|
59
70
|
|
|
@@ -71,7 +82,7 @@ const CancelAlert = props => {
|
|
|
71
82
|
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
|
|
72
83
|
})
|
|
73
84
|
.catch(() => {
|
|
74
|
-
showToast('Delete failed.');
|
|
85
|
+
showToast(localizedVal('Delete failed.', localeCategory));
|
|
75
86
|
});
|
|
76
87
|
break;
|
|
77
88
|
|
|
@@ -86,22 +97,22 @@ const CancelAlert = props => {
|
|
|
86
97
|
<div className='cancel-alert-top'>
|
|
87
98
|
<h3>{`Delete ${caseName}(${ID})`}</h3>
|
|
88
99
|
<div>
|
|
89
|
-
<p>{
|
|
90
|
-
<p>Alternatively, you can continue working or save your work for later
|
|
100
|
+
<p>{`${localizedVal('Are you sure you want to delete', localeCategory)} ${caseName} (${ID})?`}</p>
|
|
101
|
+
<p>{localizedVal('Alternatively, you can continue working or save your work for later.', localeCategory)}</p>
|
|
91
102
|
</div>
|
|
92
103
|
<div className='action-controls'>
|
|
93
104
|
<Grid container spacing={4} justifyContent='space-between'>
|
|
94
105
|
<Grid item>
|
|
95
106
|
<Button variant='outlined' color='primary' onClick={() => buttonClick('save')}>
|
|
96
|
-
Save for later
|
|
107
|
+
{localizedVal('Save for later', localeCategory)}
|
|
97
108
|
</Button>
|
|
98
109
|
</Grid>
|
|
99
110
|
<Grid item>
|
|
100
111
|
<Button variant='outlined' color='primary' onClick={() => buttonClick('continue')}>
|
|
101
|
-
Continue Working
|
|
112
|
+
{localizedVal('Continue Working', localeCategory)}
|
|
102
113
|
</Button>
|
|
103
114
|
<Button variant='contained' color='primary' onClick={() => buttonClick('delete')}>
|
|
104
|
-
Delete
|
|
115
|
+
{localizedVal('Delete', localeCategory)}
|
|
105
116
|
</Button>
|
|
106
117
|
</Grid>
|
|
107
118
|
</Grid>
|
|
@@ -122,5 +133,3 @@ const CancelAlert = props => {
|
|
|
122
133
|
</>
|
|
123
134
|
);
|
|
124
135
|
};
|
|
125
|
-
|
|
126
|
-
export default CancelAlert;
|
|
@@ -7,9 +7,39 @@ import {
|
|
|
7
7
|
FormHelperText
|
|
8
8
|
} from '@material-ui/core';
|
|
9
9
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
10
|
-
import
|
|
10
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
11
|
+
// import type { PConnProps } from '../../../types/PConnProps';
|
|
12
|
+
|
|
13
|
+
// Checkbox passes in 'value' as a boolean. So can't use the default
|
|
14
|
+
// PConnFieldProps since it expects value to be a string.
|
|
15
|
+
// But can't use CheckBoxProps until getValidationApi() knows about validate method
|
|
16
|
+
// Currently just thinks that returns an "object"
|
|
17
|
+
// interface CheckboxProps extends PConnProps {
|
|
18
|
+
// // If any, enter additional props that only exist on Checkbox here
|
|
19
|
+
// // Everything from PConnFieldProps except value and change type of value to boolean
|
|
20
|
+
|
|
21
|
+
// value?: boolean,
|
|
22
|
+
// label: string,
|
|
23
|
+
// required: boolean,
|
|
24
|
+
// disabled: boolean,
|
|
25
|
+
// validatemessage: string,
|
|
26
|
+
// status?: string,
|
|
27
|
+
// // eslint-disable-next-line react/no-unused-prop-types
|
|
28
|
+
// onChange: any,
|
|
29
|
+
// // eslint-disable-next-line react/no-unused-prop-types
|
|
30
|
+
// onBlur?: any,
|
|
31
|
+
// readOnly: boolean,
|
|
32
|
+
// testId: string,
|
|
33
|
+
// helperText: string,
|
|
34
|
+
// displayMode?: string,
|
|
35
|
+
// hideLabel: boolean,
|
|
36
|
+
// // eslint-disable-next-line react/no-unused-prop-types
|
|
37
|
+
// placeholder?: string
|
|
38
|
+
// }
|
|
39
|
+
export default function CheckboxComponent(props /* : CheckboxProps */) {
|
|
40
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
41
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
11
42
|
|
|
12
|
-
export default function CheckboxComponent(props) {
|
|
13
43
|
const {
|
|
14
44
|
getPConnect,
|
|
15
45
|
label,
|
|
@@ -17,6 +47,7 @@ export default function CheckboxComponent(props) {
|
|
|
17
47
|
readOnly,
|
|
18
48
|
testId,
|
|
19
49
|
required,
|
|
50
|
+
disabled,
|
|
20
51
|
status,
|
|
21
52
|
helperText,
|
|
22
53
|
validatemessage,
|
|
@@ -27,9 +58,9 @@ export default function CheckboxComponent(props) {
|
|
|
27
58
|
|
|
28
59
|
const thePConn = getPConnect();
|
|
29
60
|
const theConfigProps = thePConn.getConfigProps();
|
|
30
|
-
const
|
|
61
|
+
const caption = theConfigProps['caption'];
|
|
31
62
|
const actionsApi = thePConn.getActionsApi();
|
|
32
|
-
const propName = thePConn.getStateProps()
|
|
63
|
+
const propName = thePConn.getStateProps()['value'];
|
|
33
64
|
|
|
34
65
|
const [checked, setChecked] = useState(false);
|
|
35
66
|
useEffect(() => {
|
|
@@ -38,11 +69,13 @@ export default function CheckboxComponent(props) {
|
|
|
38
69
|
}, [value]);
|
|
39
70
|
|
|
40
71
|
if (displayMode === 'LABELS_LEFT') {
|
|
41
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
72
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value.toString()} />;
|
|
42
73
|
}
|
|
43
74
|
|
|
44
75
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
45
|
-
return
|
|
76
|
+
return (
|
|
77
|
+
<FieldValueList name={hideLabel ? '' : label} value={value.toString()} variant='stacked' />
|
|
78
|
+
);
|
|
46
79
|
}
|
|
47
80
|
|
|
48
81
|
const handleChange = event => {
|
|
@@ -50,15 +83,15 @@ export default function CheckboxComponent(props) {
|
|
|
50
83
|
};
|
|
51
84
|
|
|
52
85
|
const handleBlur = event => {
|
|
53
|
-
thePConn.getValidationApi().validate(event.target.checked);
|
|
86
|
+
thePConn.getValidationApi().validate(event.target.checked, ''); // 2nd arg empty string until typedef marked correctly as optional
|
|
54
87
|
};
|
|
55
88
|
|
|
56
|
-
let theCheckbox = <Checkbox color='primary' />;
|
|
89
|
+
let theCheckbox = <Checkbox color='primary' disabled={disabled} />;
|
|
57
90
|
|
|
58
91
|
if (readOnly) {
|
|
59
92
|
// Workaround for lack of InputProps readOnly from https://github.com/mui-org/material-ui/issues/17043
|
|
60
93
|
// Also note that we need to turn off the onChange call in the FormControlLabel wrapper, too. See below!
|
|
61
|
-
theCheckbox = <Checkbox value={value || false}
|
|
94
|
+
theCheckbox = <Checkbox value={value || false} readOnly={readOnly} />;
|
|
62
95
|
}
|
|
63
96
|
|
|
64
97
|
return (
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
// import { TextField } from "@material-ui/core";
|
|
3
2
|
import CurrencyTextField from '@unicef/material-ui-currency-textfield';
|
|
4
3
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
|
-
import
|
|
6
|
-
import { format } from "@pega/react-sdk-components/lib/components/helpers/formatters";
|
|
4
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
7
5
|
import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
8
|
|
|
9
9
|
// Using control from: https://github.com/unicef/material-ui-currency-textfield
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
interface CurrrencyProps extends PConnFieldProps {
|
|
12
|
+
// If any, enter additional props that only exist on Currency here
|
|
13
|
+
currencyISOCode?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function Currency(props: CurrrencyProps) {
|
|
17
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
18
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
19
|
+
|
|
12
20
|
const {
|
|
13
21
|
getPConnect,
|
|
14
22
|
label,
|
|
@@ -23,12 +31,12 @@ export default function Currency(props) {
|
|
|
23
31
|
helperText,
|
|
24
32
|
displayMode,
|
|
25
33
|
hideLabel,
|
|
26
|
-
currencyISOCode =
|
|
34
|
+
currencyISOCode = 'USD'
|
|
27
35
|
} = props;
|
|
28
36
|
|
|
29
37
|
const pConn = getPConnect();
|
|
30
38
|
const actions = pConn.getActionsApi();
|
|
31
|
-
const propName = pConn.getStateProps()
|
|
39
|
+
const propName = pConn.getStateProps()["value"];
|
|
32
40
|
const helperTextToDisplay = validatemessage || helperText;
|
|
33
41
|
|
|
34
42
|
// console.log(`Currency: label: ${label} value: ${value}`);
|
|
@@ -45,10 +53,10 @@ export default function Currency(props) {
|
|
|
45
53
|
'data-test-id': testId
|
|
46
54
|
};
|
|
47
55
|
|
|
48
|
-
const [currValue, setCurrValue] = useState();
|
|
49
|
-
const [theCurrSym, setCurrSym] = useState(
|
|
50
|
-
const [theCurrDec, setCurrDec] = useState(
|
|
51
|
-
const [theCurrSep, setCurrSep] = useState(
|
|
56
|
+
const [currValue, setCurrValue] = useState('');
|
|
57
|
+
const [theCurrSym, setCurrSym] = useState('$');
|
|
58
|
+
const [theCurrDec, setCurrDec] = useState('.');
|
|
59
|
+
const [theCurrSep, setCurrSep] = useState(',');
|
|
52
60
|
|
|
53
61
|
useEffect(() => {
|
|
54
62
|
// currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
|
|
@@ -71,7 +79,7 @@ export default function Currency(props) {
|
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
74
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant=
|
|
82
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant="stacked" />;
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
@@ -94,8 +102,8 @@ export default function Currency(props) {
|
|
|
94
102
|
fullWidth
|
|
95
103
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
96
104
|
helperText={helperTextToDisplay}
|
|
97
|
-
placeholder=
|
|
98
|
-
size=
|
|
105
|
+
placeholder=""
|
|
106
|
+
size="small"
|
|
99
107
|
required={required}
|
|
100
108
|
disabled={disabled}
|
|
101
109
|
onChange={currOnChange}
|
|
@@ -103,9 +111,9 @@ export default function Currency(props) {
|
|
|
103
111
|
error={status === 'error'}
|
|
104
112
|
label={label}
|
|
105
113
|
value={currValue}
|
|
106
|
-
type=
|
|
107
|
-
outputFormat=
|
|
108
|
-
textAlign=
|
|
114
|
+
type="text"
|
|
115
|
+
outputFormat="number"
|
|
116
|
+
textAlign="left"
|
|
109
117
|
InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: currValue } }}
|
|
110
118
|
currencySymbol={theCurrSym}
|
|
111
119
|
decimalCharacter={theCurrDec}
|
|
@@ -3,11 +3,10 @@ import { default as CurrencyAlias} from '@pega/react-sdk-components/lib/componen
|
|
|
3
3
|
// eslint-disable-next-line import/no-named-default
|
|
4
4
|
import { default as CurrencyMapAlias } from '@pega/react-sdk-components/lib/components/helpers/formatters/CurrencyMap';
|
|
5
5
|
|
|
6
|
-
declare const PCore: any;
|
|
7
6
|
|
|
8
7
|
export const getCurrencyOptions = (inISOCode: string) => {
|
|
9
8
|
|
|
10
|
-
const operatorLocale = PCore.getEnvironmentInfo().getUseLocale() || 'en-US';
|
|
9
|
+
const operatorLocale = PCore.getEnvironmentInfo().getUseLocale() || PCore.getEnvironmentInfo().getLocale() || 'en-US';
|
|
11
10
|
|
|
12
11
|
let currMapToUse = CurrencyMapAlias.US;
|
|
13
12
|
let localeToUse = operatorLocale;
|
package/lib/field/Date/Date.tsx
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { KeyboardDatePicker } from '@material-ui/pickers';
|
|
3
|
-
import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
|
|
4
3
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
5
|
+
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
|
+
|
|
9
|
+
// Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server
|
|
10
|
+
function getFormattedDate(date) {
|
|
11
|
+
return `${date.$y.toString()}-${(date.$M + 1).toString().padStart(2, '0')}-${date.$D.toString().padStart(2, '0')}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface DateProps extends PConnFieldProps {
|
|
15
|
+
// If any, enter additional props that only exist on Date here
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function Date(props: DateProps) {
|
|
19
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
20
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
21
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
8
22
|
|
|
9
|
-
export default function Date(props) {
|
|
10
23
|
const {
|
|
11
24
|
getPConnect,
|
|
12
25
|
label,
|
|
@@ -26,18 +39,17 @@ export default function Date(props) {
|
|
|
26
39
|
|
|
27
40
|
const pConn = getPConnect();
|
|
28
41
|
const actions = pConn.getActionsApi();
|
|
29
|
-
const propName = pConn.getStateProps()
|
|
42
|
+
const propName = pConn.getStateProps()["value"];
|
|
30
43
|
const helperTextToDisplay = validatemessage || helperText;
|
|
31
44
|
|
|
32
45
|
// Start with default dateFormatInfo
|
|
33
46
|
const dateFormatInfo = dateFormatInfoDefault;
|
|
34
47
|
// and then update, as needed, based on locale, etc.
|
|
35
|
-
const theDateFormat = getDateFormatInfo()
|
|
48
|
+
const theDateFormat = getDateFormatInfo();
|
|
36
49
|
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
37
50
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
38
51
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
39
52
|
|
|
40
|
-
|
|
41
53
|
if (displayMode === 'LABELS_LEFT') {
|
|
42
54
|
const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
|
|
43
55
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
|
|
@@ -45,7 +57,7 @@ export default function Date(props) {
|
|
|
45
57
|
|
|
46
58
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
47
59
|
const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
|
|
48
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant=
|
|
60
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant="stacked" />;
|
|
49
61
|
}
|
|
50
62
|
|
|
51
63
|
if (readOnly) {
|
|
@@ -59,21 +71,23 @@ export default function Date(props) {
|
|
|
59
71
|
'data-test-id': testId
|
|
60
72
|
};
|
|
61
73
|
|
|
62
|
-
const handleChange = date => {
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
const handleChange = (date) => {
|
|
75
|
+
if (date && date.isValid()) {
|
|
76
|
+
onChange({ value: getFormattedDate(date) });
|
|
77
|
+
}
|
|
65
78
|
};
|
|
66
79
|
|
|
67
|
-
const handleAccept = date => {
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
const handleAccept = (date) => {
|
|
81
|
+
if (date && date.isValid()) {
|
|
82
|
+
handleEvent(actions, 'changeNblur', propName, getFormattedDate(date));
|
|
83
|
+
}
|
|
70
84
|
};
|
|
71
85
|
|
|
72
86
|
return (
|
|
73
87
|
<KeyboardDatePicker
|
|
74
88
|
disableToolbar
|
|
75
|
-
variant=
|
|
76
|
-
inputVariant=
|
|
89
|
+
variant="inline"
|
|
90
|
+
inputVariant="outlined"
|
|
77
91
|
placeholder={dateFormatInfo.dateFormatStringLC}
|
|
78
92
|
format={dateFormatInfo.dateFormatString}
|
|
79
93
|
mask={dateFormatInfo.dateFormatMask}
|
|
@@ -83,7 +97,7 @@ export default function Date(props) {
|
|
|
83
97
|
disabled={disabled}
|
|
84
98
|
error={status === 'error'}
|
|
85
99
|
helperText={helperTextToDisplay}
|
|
86
|
-
size=
|
|
100
|
+
size="small"
|
|
87
101
|
label={label}
|
|
88
102
|
value={value || null}
|
|
89
103
|
onChange={handleChange}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { KeyboardDateTimePicker } from '@material-ui/pickers';
|
|
3
|
-
import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
|
|
4
3
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
5
|
+
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
|
+
|
|
9
|
+
interface DateTimeProps extends PConnFieldProps {
|
|
10
|
+
// If any, enter additional props that only exist on DateTime here
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function DateTime(props: DateTimeProps) {
|
|
14
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
15
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
16
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
8
17
|
|
|
9
|
-
export default function DateTime(props) {
|
|
10
18
|
const {
|
|
11
19
|
getPConnect,
|
|
12
20
|
label,
|
|
@@ -25,26 +33,29 @@ export default function DateTime(props) {
|
|
|
25
33
|
|
|
26
34
|
const pConn = getPConnect();
|
|
27
35
|
const actions = pConn.getActionsApi();
|
|
28
|
-
const propName = pConn.getStateProps()
|
|
36
|
+
const propName = pConn.getStateProps()["value"];
|
|
29
37
|
const helperTextToDisplay = validatemessage || helperText;
|
|
30
38
|
|
|
31
39
|
// Start with default dateFormatInfo
|
|
32
40
|
const dateFormatInfo = dateFormatInfoDefault;
|
|
33
41
|
// and then update, as needed, based on locale, etc.
|
|
34
|
-
const theDateFormat = getDateFormatInfo()
|
|
42
|
+
const theDateFormat = getDateFormatInfo();
|
|
35
43
|
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
36
44
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
37
45
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
38
46
|
|
|
39
|
-
|
|
40
47
|
if (displayMode === 'LABELS_LEFT') {
|
|
41
|
-
const formattedDateTime = format(props.value, 'datetime', {
|
|
48
|
+
const formattedDateTime = format(props.value, 'datetime', {
|
|
49
|
+
format: `${dateFormatInfo.dateFormatString} hh:mm a`
|
|
50
|
+
});
|
|
42
51
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} />;
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
46
|
-
const formattedDateTime = format(props.value, 'datetime', {
|
|
47
|
-
|
|
55
|
+
const formattedDateTime = format(props.value, 'datetime', {
|
|
56
|
+
format: `${dateFormatInfo.dateFormatString} hh:mm a`
|
|
57
|
+
});
|
|
58
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant="stacked" />;
|
|
48
59
|
}
|
|
49
60
|
|
|
50
61
|
if (readOnly) {
|
|
@@ -52,12 +63,12 @@ export default function DateTime(props) {
|
|
|
52
63
|
return <TextInput {...props} value={formattedDateTime} />;
|
|
53
64
|
}
|
|
54
65
|
|
|
55
|
-
const handleChange = date => {
|
|
66
|
+
const handleChange = (date) => {
|
|
56
67
|
const changeValue = date && date.isValid() ? date.toISOString() : null;
|
|
57
68
|
onChange({ value: changeValue });
|
|
58
69
|
};
|
|
59
70
|
|
|
60
|
-
const handleAccept = date => {
|
|
71
|
+
const handleAccept = (date) => {
|
|
61
72
|
const changeValue = date && date.isValid() ? date.toISOString() : null;
|
|
62
73
|
handleEvent(actions, 'changeNblur', propName, changeValue);
|
|
63
74
|
};
|
|
@@ -69,8 +80,8 @@ export default function DateTime(props) {
|
|
|
69
80
|
|
|
70
81
|
return (
|
|
71
82
|
<KeyboardDateTimePicker
|
|
72
|
-
variant=
|
|
73
|
-
inputVariant=
|
|
83
|
+
variant="inline"
|
|
84
|
+
inputVariant="outlined"
|
|
74
85
|
fullWidth
|
|
75
86
|
autoOk
|
|
76
87
|
required={required}
|
|
@@ -81,7 +92,7 @@ export default function DateTime(props) {
|
|
|
81
92
|
minutesStep={5}
|
|
82
93
|
error={status === 'error'}
|
|
83
94
|
helperText={helperTextToDisplay}
|
|
84
|
-
size=
|
|
95
|
+
size="small"
|
|
85
96
|
label={label}
|
|
86
97
|
value={value || null}
|
|
87
98
|
onChange={handleChange}
|