@pega/react-sdk-overrides 23.1.10 → 23.1.12
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/LICENSE +201 -0
- package/README.md +17 -0
- package/SECURITY.md +10 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +6 -14
- package/lib/designSystemExtension/Banner/Banner.tsx +14 -11
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +27 -22
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +14 -20
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +44 -19
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +7 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +21 -32
- package/lib/designSystemExtension/Operator/Operator.tsx +94 -82
- package/lib/designSystemExtension/Pulse/Pulse.tsx +14 -16
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +6 -5
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +14 -14
- package/lib/field/AutoComplete/AutoComplete.tsx +24 -26
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +98 -84
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +120 -63
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +25 -50
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +9 -16
- package/lib/field/Date/Date.tsx +15 -11
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +9 -9
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +33 -44
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +122 -31
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +11 -10
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +39 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +8 -7
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/MultiSelect/Multiselect.tsx +244 -0
- package/lib/field/MultiSelect/index.tsx +1 -0
- package/lib/field/MultiSelect/utils.ts +230 -0
- package/lib/field/Percentage/Percentage.tsx +46 -41
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +13 -12
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +20 -18
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +8 -7
- package/lib/field/ScalarList/ScalarList.tsx +3 -13
- package/lib/field/ScalarList/config-ext.json +1 -2
- package/lib/field/SemanticLink/SemanticLink.tsx +7 -7
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -11
- package/lib/field/TextArea/TextArea.tsx +7 -6
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +4 -6
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +9 -7
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +11 -11
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +9 -8
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +18 -16
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/attachmentHelpers.ts +13 -8
- package/lib/helpers/case-utils.tsx +4 -8
- package/lib/helpers/common-utils.ts +5 -1
- package/lib/helpers/data_page.ts +3 -7
- package/lib/helpers/date-format-utils.ts +3 -3
- package/lib/helpers/event-utils.ts +3 -3
- package/lib/helpers/field-group-utils.ts +1 -1
- package/lib/helpers/formatters/Boolean.ts +9 -26
- package/lib/helpers/formatters/Currency.ts +15 -21
- package/lib/helpers/formatters/CurrencyMap.ts +505 -501
- package/lib/helpers/formatters/Date.ts +20 -26
- package/lib/helpers/formatters/common.ts +1 -2
- package/lib/helpers/formatters/index.ts +26 -19
- package/lib/helpers/instructions-utils.ts +38 -0
- package/lib/helpers/reactContextHelpers.ts +2 -2
- package/lib/helpers/simpleTableHelpers.ts +59 -83
- package/lib/helpers/state-utils.tsx +5 -9
- package/lib/helpers/template-utils.ts +3 -6
- package/lib/helpers/utils.ts +5 -5
- package/lib/helpers/versionHelpers.ts +1 -4
- package/lib/infra/ActionButtons/ActionButtons.tsx +38 -29
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -79
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +13 -16
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +67 -213
- package/lib/infra/Containers/FlowContainer/helpers.ts +34 -45
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +227 -218
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
- package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
- package/lib/infra/Containers/SimpleView/helper.ts +125 -0
- package/lib/infra/Containers/SimpleView/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +36 -46
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -42
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -43
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -28
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +16 -30
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +176 -212
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +19 -31
- package/lib/infra/Reference/Reference.tsx +16 -18
- package/lib/infra/Region/Region.tsx +4 -6
- package/lib/infra/RootContainer/RootContainer.tsx +75 -111
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +32 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +11 -11
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +21 -28
- package/lib/infra/View/View.tsx +17 -21
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +39 -74
- package/lib/template/BannerPage/BannerPage.tsx +12 -14
- package/lib/template/CaseSummary/CaseSummary.tsx +58 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +34 -63
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +63 -19
- package/lib/template/Confirmation/Confirmation.tsx +12 -17
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +95 -121
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +13 -16
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/Details/Details/Details.tsx +19 -22
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +9 -13
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -24
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +19 -25
- package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +15 -14
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +15 -22
- package/lib/template/InlineDashboard/InlineDashboard.tsx +12 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +12 -16
- package/lib/template/ListPage/ListPage.tsx +5 -10
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/DefaultViewMeta.ts +1 -3
- package/lib/template/ListView/ListView.tsx +185 -175
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/hooks.ts +24 -26
- package/lib/template/ListView/utils.ts +51 -87
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +20 -20
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +25 -38
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +20 -25
- package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +14 -24
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +9 -19
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +14 -15
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +3 -10
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +6 -10
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +32 -28
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +37 -33
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -121
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +24 -25
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +30 -30
- package/lib/template/SubTabs/SubTabs.tsx +22 -40
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -5
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +30 -28
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +3 -10
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +30 -28
- package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +22 -34
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +24 -28
- package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +13 -21
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +8 -16
- package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +18 -21
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +29 -28
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +60 -1
- package/lib/widget/Attachment/Attachment.tsx +378 -405
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +64 -66
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +16 -18
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +310 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +23 -20
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +68 -42
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +58 -58
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +7 -10
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +52 -53
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -834
- package/lib/helpers/authManager.ts +0 -933
- package/lib/helpers/config_access.js +0 -186
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { TextField } from '@material-ui/core';
|
|
3
3
|
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
4
4
|
import isDeepEqual from 'fast-deep-equal/react';
|
|
5
|
+
|
|
5
6
|
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
6
7
|
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
7
8
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
8
9
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
9
|
-
import
|
|
10
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
10
11
|
|
|
11
12
|
interface IOption {
|
|
12
13
|
key: string;
|
|
13
14
|
value: string;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
const preProcessColumns =
|
|
17
|
-
return columnList.map(
|
|
17
|
+
const preProcessColumns = columnList => {
|
|
18
|
+
return columnList.map(col => {
|
|
18
19
|
const tempColObj = { ...col };
|
|
19
20
|
tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
|
|
20
21
|
return tempColObj;
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
const getDisplayFieldsMetaData =
|
|
25
|
-
const displayColumns = columnList.filter(
|
|
25
|
+
const getDisplayFieldsMetaData = columnList => {
|
|
26
|
+
const displayColumns = columnList.filter(col => col.display === 'true');
|
|
26
27
|
const metaDataObj: any = { key: '', primary: '', secondary: [] };
|
|
27
|
-
const keyCol = columnList.filter(
|
|
28
|
+
const keyCol = columnList.filter(col => col.key === 'true');
|
|
28
29
|
metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
|
|
29
30
|
for (let index = 0; index < displayColumns.length; index += 1) {
|
|
30
31
|
if (displayColumns[index].primary === 'true') {
|
|
@@ -47,7 +48,7 @@ interface AutoCompleteProps extends PConnFieldProps {
|
|
|
47
48
|
listType: string;
|
|
48
49
|
parameters?: any;
|
|
49
50
|
datasource: any;
|
|
50
|
-
columns:
|
|
51
|
+
columns: any[];
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
export default function AutoComplete(props: AutoCompleteProps) {
|
|
@@ -76,14 +77,14 @@ export default function AutoComplete(props: AutoCompleteProps) {
|
|
|
76
77
|
const context = getPConnect().getContextName();
|
|
77
78
|
let { listType, parameters, datasource = [], columns = [] } = props;
|
|
78
79
|
const [inputValue, setInputValue] = useState('');
|
|
79
|
-
const [options, setOptions] = useState<
|
|
80
|
+
const [options, setOptions] = useState<IOption[]>([]);
|
|
80
81
|
const [theDatasource, setDatasource] = useState(null);
|
|
81
82
|
let selectedValue: any = '';
|
|
82
83
|
const helperTextToDisplay = validatemessage || helperText;
|
|
83
84
|
|
|
84
85
|
const thePConn = getPConnect();
|
|
85
86
|
const actionsApi = thePConn.getActionsApi();
|
|
86
|
-
const propName = thePConn.getStateProps()
|
|
87
|
+
const propName = (thePConn.getStateProps() as any).value;
|
|
87
88
|
|
|
88
89
|
if (!isDeepEqual(datasource, theDatasource)) {
|
|
89
90
|
// inbound datasource is different, so update theDatasource (to trigger useEffect)
|
|
@@ -92,7 +93,7 @@ export default function AutoComplete(props: AutoCompleteProps) {
|
|
|
92
93
|
|
|
93
94
|
const flattenParameters = (params = {}) => {
|
|
94
95
|
const flatParams = {};
|
|
95
|
-
Object.keys(params).forEach(
|
|
96
|
+
Object.keys(params).forEach(key => {
|
|
96
97
|
const { name, value: theVal } = params[key];
|
|
97
98
|
flatParams[name] = theVal;
|
|
98
99
|
});
|
|
@@ -105,13 +106,10 @@ export default function AutoComplete(props: AutoCompleteProps) {
|
|
|
105
106
|
if (deferDatasource && datasourceMetadata?.datasource?.name) {
|
|
106
107
|
listType = 'datapage';
|
|
107
108
|
datasource = datasourceMetadata.datasource.name;
|
|
108
|
-
parameters =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const valueProp = datasourceMetadata.datasource.propertyForValue.startsWith('@P')
|
|
113
|
-
? datasourceMetadata.datasource.propertyForValue.substring(3)
|
|
114
|
-
: datasourceMetadata.datasource.propertyForValue;
|
|
109
|
+
const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;
|
|
110
|
+
parameters = flattenParameters(dataSourceParameters);
|
|
111
|
+
const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;
|
|
112
|
+
const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;
|
|
115
113
|
columns = [
|
|
116
114
|
{
|
|
117
115
|
key: 'true',
|
|
@@ -137,9 +135,9 @@ export default function AutoComplete(props: AutoCompleteProps) {
|
|
|
137
135
|
useEffect(() => {
|
|
138
136
|
if (!displayMode && listType !== 'associated') {
|
|
139
137
|
getDataPage(datasource, parameters, context).then((results: any) => {
|
|
140
|
-
const optionsData:
|
|
138
|
+
const optionsData: any[] = [];
|
|
141
139
|
const displayColumn = getDisplayFieldsMetaData(columns);
|
|
142
|
-
results?.forEach(
|
|
140
|
+
results?.forEach(element => {
|
|
143
141
|
const val = element[displayColumn.primary]?.toString();
|
|
144
142
|
const obj = {
|
|
145
143
|
key: element[displayColumn.key] || element.pyGUID,
|
|
@@ -157,11 +155,11 @@ export default function AutoComplete(props: AutoCompleteProps) {
|
|
|
157
155
|
}
|
|
158
156
|
|
|
159
157
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
160
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant=
|
|
158
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
161
159
|
}
|
|
162
160
|
|
|
163
161
|
if (value) {
|
|
164
|
-
const index = options?.findIndex(
|
|
162
|
+
const index = options?.findIndex(element => element.key === value);
|
|
165
163
|
if (index > -1) {
|
|
166
164
|
selectedValue = options[index].value;
|
|
167
165
|
} else {
|
|
@@ -182,7 +180,7 @@ export default function AutoComplete(props: AutoCompleteProps) {
|
|
|
182
180
|
};
|
|
183
181
|
|
|
184
182
|
if (readOnly) {
|
|
185
|
-
const theValAsString = options?.find(
|
|
183
|
+
const theValAsString = options?.find(opt => opt.key === value)?.value;
|
|
186
184
|
return <TextInput {...props} value={theValAsString} />;
|
|
187
185
|
}
|
|
188
186
|
// Need to use both getOptionLabel and getOptionSelected to map our
|
|
@@ -201,14 +199,14 @@ export default function AutoComplete(props: AutoCompleteProps) {
|
|
|
201
199
|
value={selectedValue}
|
|
202
200
|
inputValue={inputValue || selectedValue}
|
|
203
201
|
onInputChange={handleInputValue}
|
|
204
|
-
renderInput={
|
|
202
|
+
renderInput={params => (
|
|
205
203
|
<TextField
|
|
206
204
|
{...params}
|
|
207
205
|
fullWidth
|
|
208
|
-
variant=
|
|
206
|
+
variant='outlined'
|
|
209
207
|
helperText={helperTextToDisplay}
|
|
210
208
|
placeholder={placeholder}
|
|
211
|
-
size=
|
|
209
|
+
size='small'
|
|
212
210
|
required={required}
|
|
213
211
|
error={status === 'error'}
|
|
214
212
|
label={label}
|
|
@@ -1,44 +1,91 @@
|
|
|
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
|
-
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
-
import './CancelAlert.css';
|
|
6
|
-
|
|
7
|
-
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
|
|
8
|
-
declare const PCore: any;
|
|
9
4
|
|
|
5
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
|
+
import './CancelAlert.css';
|
|
10
7
|
|
|
11
8
|
interface CancelAlertProps extends PConnFieldProps {
|
|
12
9
|
// If any, enter additional props that only exist on CancelAlert here
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
heading: string;
|
|
11
|
+
content: string;
|
|
12
|
+
itemKey: string;
|
|
13
|
+
hideDelete: boolean;
|
|
14
|
+
isDataObject: boolean;
|
|
15
|
+
skipReleaseLockRequest: any;
|
|
16
|
+
dismiss: Function;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
|
|
18
19
|
export default function CancelAlert(props: CancelAlertProps) {
|
|
19
|
-
const {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const caseInfo = pConn.getCaseInfo();
|
|
25
|
-
const caseName = caseInfo.getName();
|
|
26
|
-
const ID = caseInfo.getID();
|
|
20
|
+
const { heading, content, getPConnect, itemKey: containerItemID, hideDelete, isDataObject, skipReleaseLockRequest, dismiss } = props;
|
|
21
|
+
const actionsAPI = getPConnect().getActionsApi();
|
|
22
|
+
const containerManagerAPI = getPConnect().getContainerManager();
|
|
23
|
+
const isLocalAction = getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION);
|
|
24
|
+
const isBulkAction = getPConnect()?.options?.isBulkAction;
|
|
27
25
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
26
|
+
const broadCastUtils: any = PCore.getCoexistenceManager().getBroadcastUtils();
|
|
27
|
+
const isReverseCoexistence = broadCastUtils.isReverseCoexistenceCaseLoaded();
|
|
28
28
|
const localeCategory = 'ModalContainer';
|
|
29
|
+
const btnIds = {
|
|
30
|
+
SAVE_AND_CLOSE: 'saveAndClose',
|
|
31
|
+
CONTINUE_WORKING: 'continueWorking',
|
|
32
|
+
DELETE: 'delete'
|
|
33
|
+
};
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
const [buttonsState, setButtonsState] = useState({
|
|
36
|
+
[btnIds.SAVE_AND_CLOSE]: false,
|
|
37
|
+
[btnIds.DELETE]: false
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
41
|
+
const [snackbarMessage, setSnackbarMessage] = useState('');
|
|
42
|
+
|
|
43
|
+
function disableButton(id) {
|
|
44
|
+
setButtonsState(prevState => ({
|
|
45
|
+
...prevState,
|
|
46
|
+
[id]: true
|
|
47
|
+
}));
|
|
33
48
|
}
|
|
34
49
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
function enableButton(id) {
|
|
51
|
+
setButtonsState(prevState => ({
|
|
52
|
+
...prevState,
|
|
53
|
+
[id]: false
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
function cancelHandler() {
|
|
58
|
+
if (isReverseCoexistence) {
|
|
59
|
+
dismiss(true);
|
|
60
|
+
// @ts-ignore - An argument for 'payload' was not provided.
|
|
61
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.REVERSE_COEXISTENCE_EVENTS.HANDLE_DISCARD);
|
|
62
|
+
} else if (!isDataObject && !isLocalAction && !isBulkAction) {
|
|
63
|
+
disableButton(btnIds.DELETE);
|
|
64
|
+
actionsAPI
|
|
65
|
+
.deleteCaseInCreateStage(containerItemID, hideDelete)
|
|
66
|
+
.then(() => {
|
|
67
|
+
// @ts-ignore - An argument for 'payload' was not provided.
|
|
68
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
|
|
69
|
+
})
|
|
70
|
+
.catch(() => {
|
|
71
|
+
setSnackbarMessage(localizedVal('Delete failed.', localeCategory));
|
|
72
|
+
setShowSnackbar(true);
|
|
73
|
+
})
|
|
74
|
+
.finally(() => {
|
|
75
|
+
enableButton(btnIds.DELETE);
|
|
76
|
+
dismiss(true);
|
|
77
|
+
});
|
|
78
|
+
} else if (isLocalAction) {
|
|
79
|
+
dismiss(true);
|
|
80
|
+
actionsAPI.cancelAssignment(containerItemID);
|
|
81
|
+
} else if (isBulkAction) {
|
|
82
|
+
dismiss(true);
|
|
83
|
+
actionsAPI.cancelBulkAction(containerItemID);
|
|
84
|
+
} else {
|
|
85
|
+
dismiss(true);
|
|
86
|
+
containerManagerAPI.removeContainerItem({ containerItemID, skipReleaseLockRequest });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
42
89
|
|
|
43
90
|
function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
|
|
44
91
|
if (reason === 'clickaway') {
|
|
@@ -47,74 +94,41 @@ export default function CancelAlert(props: CancelAlertProps) {
|
|
|
47
94
|
setShowSnackbar(false);
|
|
48
95
|
}
|
|
49
96
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.catch(() => {
|
|
67
|
-
showToast(localizedVal('Save failed', localeCategory));
|
|
68
|
-
});
|
|
69
|
-
break;
|
|
70
|
-
|
|
71
|
-
case 'continue':
|
|
72
|
-
dismissCancelAlertOnly();
|
|
73
|
-
break;
|
|
74
|
-
|
|
75
|
-
case 'delete':
|
|
76
|
-
// eslint-disable-next-line no-case-declarations
|
|
77
|
-
const deletePromise = actionsAPI.deleteCaseInCreateStage(itemKey);
|
|
78
|
-
|
|
79
|
-
deletePromise
|
|
80
|
-
.then(() => {
|
|
81
|
-
dismissModal();
|
|
82
|
-
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
|
|
83
|
-
})
|
|
84
|
-
.catch(() => {
|
|
85
|
-
showToast(localizedVal('Delete failed.', localeCategory));
|
|
86
|
-
});
|
|
87
|
-
break;
|
|
97
|
+
const leftButton = (
|
|
98
|
+
<Button
|
|
99
|
+
name={btnIds.CONTINUE_WORKING}
|
|
100
|
+
variant='contained'
|
|
101
|
+
color='secondary'
|
|
102
|
+
onClick={() => {
|
|
103
|
+
dismiss();
|
|
104
|
+
if (isReverseCoexistence) {
|
|
105
|
+
broadCastUtils.setCallBackFunction(null);
|
|
106
|
+
broadCastUtils.setIsDirtyDialogActive(false);
|
|
107
|
+
}
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
{localizedVal('Go back', localeCategory)}
|
|
111
|
+
</Button>
|
|
112
|
+
);
|
|
88
113
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
114
|
+
const rightButton = (
|
|
115
|
+
<Button name={btnIds.DELETE} variant='contained' color='primary' disabled={buttonsState[btnIds.DELETE]} onClick={cancelHandler}>
|
|
116
|
+
{localizedVal('Discard', localeCategory)}
|
|
117
|
+
</Button>
|
|
118
|
+
);
|
|
93
119
|
|
|
94
120
|
return (
|
|
95
121
|
<>
|
|
96
122
|
<div className='cancel-alert-background'>
|
|
97
123
|
<div className='cancel-alert-top'>
|
|
98
|
-
<h3>{
|
|
124
|
+
<h3>{localizedVal(heading, localeCategory)}</h3>
|
|
99
125
|
<div>
|
|
100
|
-
<p>{
|
|
101
|
-
<p>{localizedVal('Alternatively, you can continue working or save your work for later.', localeCategory)}</p>
|
|
126
|
+
<p>{localizedVal(content, localeCategory)}</p>
|
|
102
127
|
</div>
|
|
103
128
|
<div className='action-controls'>
|
|
104
129
|
<Grid container spacing={4} justifyContent='space-between'>
|
|
105
|
-
<Grid item>
|
|
106
|
-
|
|
107
|
-
{localizedVal('Save for later', localeCategory)}
|
|
108
|
-
</Button>
|
|
109
|
-
</Grid>
|
|
110
|
-
<Grid item>
|
|
111
|
-
<Button variant='outlined' color='primary' onClick={() => buttonClick('continue')}>
|
|
112
|
-
{localizedVal('Continue Working', localeCategory)}
|
|
113
|
-
</Button>
|
|
114
|
-
<Button variant='contained' color='primary' onClick={() => buttonClick('delete')}>
|
|
115
|
-
{localizedVal('Delete', localeCategory)}
|
|
116
|
-
</Button>
|
|
117
|
-
</Grid>
|
|
130
|
+
<Grid item>{leftButton}</Grid>
|
|
131
|
+
<Grid item>{rightButton}</Grid>
|
|
118
132
|
</Grid>
|
|
119
133
|
</div>
|
|
120
134
|
</div>
|
|
@@ -132,4 +146,4 @@ export default function CancelAlert(props: CancelAlertProps) {
|
|
|
132
146
|
/>
|
|
133
147
|
</>
|
|
134
148
|
);
|
|
135
|
-
}
|
|
149
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './CancelAlert';
|
|
1
|
+
export { default } from './CancelAlert';
|
|
@@ -1,49 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
FormControlLabel,
|
|
6
|
-
FormGroup,
|
|
7
|
-
FormHelperText
|
|
8
|
-
} from '@material-ui/core';
|
|
1
|
+
/* eslint-disable react/no-array-index-key */
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@material-ui/core';
|
|
4
|
+
|
|
9
5
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
10
6
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
11
|
-
|
|
7
|
+
import { insertInstruction, deleteInstruction, updateNewInstuctions } from '@pega/react-sdk-components/lib/components/helpers/instructions-utils';
|
|
8
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
|
|
12
|
+
// If any, enter additional props that only exist on Checkbox here
|
|
13
|
+
value?: boolean;
|
|
14
|
+
caption?: string;
|
|
15
|
+
trueLabel?: string;
|
|
16
|
+
falseLabel?: string;
|
|
17
|
+
selectionMode?: string;
|
|
18
|
+
datasource?: any;
|
|
19
|
+
selectionKey?: string;
|
|
20
|
+
selectionList?: any;
|
|
21
|
+
primaryField: string;
|
|
22
|
+
readonlyContextList: any;
|
|
23
|
+
referenceList: string;
|
|
24
|
+
}
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 */) {
|
|
26
|
+
const useStyles = makeStyles(() => ({
|
|
27
|
+
checkbox: {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column'
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
export default function CheckboxComponent(props: CheckboxProps) {
|
|
40
34
|
// Get emitted components from map (so we can get any override that may exist)
|
|
41
35
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
42
36
|
|
|
43
37
|
const {
|
|
44
38
|
getPConnect,
|
|
45
39
|
label,
|
|
46
|
-
|
|
40
|
+
caption,
|
|
41
|
+
value,
|
|
47
42
|
readOnly,
|
|
48
43
|
testId,
|
|
49
44
|
required,
|
|
@@ -52,30 +47,42 @@ export default function CheckboxComponent(props /* : CheckboxProps */) {
|
|
|
52
47
|
helperText,
|
|
53
48
|
validatemessage,
|
|
54
49
|
displayMode,
|
|
55
|
-
hideLabel
|
|
50
|
+
hideLabel,
|
|
51
|
+
trueLabel,
|
|
52
|
+
falseLabel,
|
|
53
|
+
selectionMode,
|
|
54
|
+
datasource,
|
|
55
|
+
selectionKey,
|
|
56
|
+
selectionList,
|
|
57
|
+
primaryField,
|
|
58
|
+
referenceList,
|
|
59
|
+
readonlyContextList: selectedvalues
|
|
56
60
|
} = props;
|
|
61
|
+
const classes = useStyles();
|
|
57
62
|
const helperTextToDisplay = validatemessage || helperText;
|
|
58
|
-
|
|
59
63
|
const thePConn = getPConnect();
|
|
60
|
-
const theConfigProps = thePConn.getConfigProps();
|
|
61
|
-
const caption = theConfigProps['caption'];
|
|
62
64
|
const actionsApi = thePConn.getActionsApi();
|
|
63
|
-
const propName = thePConn.getStateProps()
|
|
65
|
+
const propName = (thePConn.getStateProps() as any).value;
|
|
64
66
|
|
|
65
|
-
const [checked, setChecked] = useState(false);
|
|
67
|
+
const [checked, setChecked] = useState<any>(false);
|
|
66
68
|
useEffect(() => {
|
|
67
69
|
// This update theSelectedButton which will update the UI to show the selected button correctly
|
|
68
70
|
setChecked(value);
|
|
69
71
|
}, [value]);
|
|
70
72
|
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (referenceList?.length > 0) {
|
|
75
|
+
thePConn.setReferenceList(selectionList);
|
|
76
|
+
updateNewInstuctions(thePConn, selectionList);
|
|
77
|
+
}
|
|
78
|
+
}, [thePConn]);
|
|
79
|
+
|
|
71
80
|
if (displayMode === 'LABELS_LEFT') {
|
|
72
|
-
return <FieldValueList name={hideLabel ? '' :
|
|
81
|
+
return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} />;
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
76
|
-
return
|
|
77
|
-
<FieldValueList name={hideLabel ? '' : label} value={value.toString()} variant='stacked' />
|
|
78
|
-
);
|
|
85
|
+
return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} variant='stacked' />;
|
|
79
86
|
}
|
|
80
87
|
|
|
81
88
|
const handleChange = event => {
|
|
@@ -83,30 +90,80 @@ export default function CheckboxComponent(props /* : CheckboxProps */) {
|
|
|
83
90
|
};
|
|
84
91
|
|
|
85
92
|
const handleBlur = event => {
|
|
86
|
-
thePConn.getValidationApi().validate(event.target.checked
|
|
93
|
+
thePConn.getValidationApi().validate(event.target.checked);
|
|
87
94
|
};
|
|
88
95
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
const handleChangeMultiMode = (event, element) => {
|
|
97
|
+
if (event.target.checked) {
|
|
98
|
+
insertInstruction(thePConn, selectionList, selectionKey, primaryField, {
|
|
99
|
+
id: element.key,
|
|
100
|
+
primary: element.text ?? element.value
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
deleteInstruction(thePConn, selectionList, selectionKey, {
|
|
104
|
+
id: element.key,
|
|
105
|
+
primary: element.text ?? element.value
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
thePConn.clearErrorMessages({
|
|
109
|
+
property: selectionList,
|
|
110
|
+
category: '',
|
|
111
|
+
context: ''
|
|
112
|
+
});
|
|
113
|
+
};
|
|
96
114
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
115
|
+
let theCheckbox;
|
|
116
|
+
const listOfCheckboxes: any = [];
|
|
117
|
+
if (selectionMode === 'multi') {
|
|
118
|
+
const listSourceItems = datasource?.source ?? [];
|
|
119
|
+
const dataField: any = selectionKey?.split?.('.')[1];
|
|
120
|
+
listSourceItems.forEach((element, index) => {
|
|
121
|
+
listOfCheckboxes.push(
|
|
100
122
|
<FormControlLabel
|
|
101
|
-
control={
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
control={
|
|
124
|
+
<Checkbox
|
|
125
|
+
key={index}
|
|
126
|
+
checked={selectedvalues?.some?.(data => data[dataField] === element.key)}
|
|
127
|
+
onChange={event => handleChangeMultiMode(event, element)}
|
|
128
|
+
onBlur={() => {
|
|
129
|
+
thePConn.getValidationApi().validate(selectedvalues, selectionList);
|
|
130
|
+
}}
|
|
131
|
+
data-testid={`${testId}:${element.value}`}
|
|
132
|
+
/>
|
|
133
|
+
}
|
|
134
|
+
key={index}
|
|
135
|
+
label={element.text ?? element.value}
|
|
106
136
|
labelPlacement='end'
|
|
107
137
|
data-test-id={testId}
|
|
108
138
|
/>
|
|
109
|
-
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
theCheckbox = <div className={classes.checkbox}>{listOfCheckboxes}</div>;
|
|
142
|
+
} else {
|
|
143
|
+
theCheckbox = (
|
|
144
|
+
<FormControlLabel
|
|
145
|
+
control={
|
|
146
|
+
<Checkbox
|
|
147
|
+
color='primary'
|
|
148
|
+
checked={checked}
|
|
149
|
+
onChange={!readOnly ? handleChange : undefined}
|
|
150
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
151
|
+
value={value}
|
|
152
|
+
disabled={disabled}
|
|
153
|
+
readOnly={readOnly}
|
|
154
|
+
/>
|
|
155
|
+
}
|
|
156
|
+
label={caption}
|
|
157
|
+
labelPlacement='end'
|
|
158
|
+
data-test-id={testId}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<FormControl required={required} error={status === 'error'}>
|
|
165
|
+
{!hideLabel && <FormLabel component='legend'>{label}</FormLabel>}
|
|
166
|
+
<FormGroup>{theCheckbox}</FormGroup>
|
|
110
167
|
<FormHelperText>{helperTextToDisplay}</FormHelperText>
|
|
111
168
|
</FormControl>
|
|
112
169
|
);
|