@pega/react-sdk-overrides 0.24.3 → 0.25.1
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 +1 -1
- package/lib/designSystemExtension/Banner/Banner.tsx +1 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +11 -2
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +4 -4
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +4 -4
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +6 -6
- package/lib/designSystemExtension/Operator/Operator.tsx +6 -5
- package/lib/designSystemExtension/Pulse/Pulse.tsx +2 -2
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
- package/lib/field/AutoComplete/AutoComplete.tsx +4 -4
- package/lib/field/CancelAlert/CancelAlert.tsx +4 -7
- package/lib/field/Checkbox/Checkbox.tsx +4 -4
- package/lib/field/Currency/Currency.tsx +10 -7
- package/lib/field/Date/Date.tsx +27 -42
- package/lib/field/DateTime/DateTime.tsx +39 -36
- package/lib/field/Decimal/Decimal.tsx +9 -4
- package/lib/field/Dropdown/Dropdown.tsx +29 -22
- package/lib/field/Email/Email.tsx +29 -8
- package/lib/field/Group/Group.tsx +2 -2
- package/lib/field/Integer/Integer.tsx +22 -8
- package/lib/field/Multiselect/Multiselect.tsx +8 -14
- package/lib/field/Multiselect/utils.ts +1 -1
- package/lib/field/Percentage/Percentage.tsx +8 -4
- package/lib/field/Phone/Phone.tsx +22 -12
- package/lib/field/Phone/config-ext.json +8 -0
- package/lib/field/RadioButtons/RadioButtons.tsx +3 -6
- package/lib/field/RichText/RichText.tsx +1 -1
- package/lib/field/RichText/config-ext.json +10 -0
- package/lib/field/ScalarList/ScalarList.tsx +3 -4
- package/lib/field/SemanticLink/SemanticLink.tsx +4 -4
- package/lib/field/TextArea/TextArea.tsx +26 -8
- package/lib/field/TextContent/TextContent.tsx +1 -1
- package/lib/field/TextInput/TextInput.tsx +2 -2
- package/lib/field/Time/Time.tsx +28 -21
- package/lib/field/URL/URL.tsx +26 -7
- package/lib/field/UserReference/UserReference.tsx +3 -5
- package/lib/helpers/common-utils.ts +24 -1
- package/lib/helpers/field-group-utils.ts +2 -2
- package/lib/helpers/formatters/Currency.ts +11 -16
- package/lib/helpers/formatters/common.ts +2 -1
- package/lib/helpers/formatters/index.ts +2 -4
- package/lib/helpers/simpleTableHelpers.ts +1 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +3 -3
- package/lib/infra/Assignment/Assignment.tsx +38 -12
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +16 -28
- package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +9 -4
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +8 -8
- package/lib/infra/Containers/SimpleView/helper.ts +1 -1
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +1 -1
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +4 -6
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
- package/lib/infra/DeferLoad/DeferLoad.tsx +8 -8
- package/lib/infra/MultiStep/MultiStep.tsx +15 -14
- package/lib/infra/NavBar/NavBar.css +1 -0
- package/lib/infra/NavBar/NavBar.tsx +25 -17
- package/lib/infra/RootContainer/RootContainer.tsx +5 -6
- package/lib/infra/Stages/Stages.tsx +4 -4
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +4 -3
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
- package/lib/infra/View/View.tsx +37 -3
- package/lib/template/AdvancedSearch/AdvancedSearch.tsx +87 -0
- package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +58 -0
- package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +245 -0
- package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
- package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
- package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
- package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
- package/lib/template/AdvancedSearch/config-ext.json +9 -0
- package/lib/template/AdvancedSearch/index.tsx +1 -0
- package/lib/template/AppShell/AppShell.tsx +60 -10
- package/lib/template/BannerPage/config-ext.json +9 -0
- package/lib/template/CaseView/CaseView.tsx +10 -9
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +7 -7
- package/lib/template/Confirmation/Confirmation.tsx +3 -2
- package/lib/template/DataReference/DataReference.tsx +317 -107
- package/lib/template/DataReference/DataReferenceAdvancedSearchContext.js +10 -0
- package/lib/template/DataReference/SearchForm.tsx +148 -0
- package/lib/template/DataReference/utils.js +90 -0
- package/lib/template/DefaultForm/utils/index.ts +1 -3
- package/lib/template/Details/Details/Details.tsx +2 -2
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +3 -3
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +2 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +2 -2
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +4 -4
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +10 -5
- package/lib/template/InlineDashboard/InlineDashboard.tsx +2 -2
- package/lib/template/InlineDashboardPage/config-ext.json +9 -0
- package/lib/template/ListView/ListView.tsx +216 -123
- package/lib/template/ListView/utils.ts +38 -6
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +2 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +2 -2
- package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -2
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +0 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +110 -86
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +2 -4
- package/lib/template/SubTabs/SubTabs.tsx +2 -2
- package/lib/template/SubTabs/tabUtils.ts +118 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +2 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +2 -2
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +2 -2
- package/lib/template/WssNavBar/WssNavBar.tsx +9 -9
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +2 -2
- package/lib/widget/Attachment/Attachment.css +1 -0
- package/lib/widget/Attachment/Attachment.tsx +7 -9
- package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -1
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +5 -4
- package/lib/widget/Followers/Followers.tsx +2 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +0 -1
- package/lib/widget/QuickCreate/config-ext.json +9 -0
- package/lib/widget/SummaryItem/SummaryItem.tsx +4 -3
- package/lib/widget/ToDo/ToDo.tsx +92 -22
- package/package.json +1 -1
- /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { TextField } from '@mui/material';
|
|
2
3
|
|
|
4
|
+
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
3
5
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
6
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
7
|
|
|
@@ -13,14 +15,13 @@ export default function TextArea(props: TextAreaProps) {
|
|
|
13
15
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
14
16
|
|
|
15
17
|
const {
|
|
18
|
+
getPConnect,
|
|
16
19
|
label,
|
|
17
20
|
required,
|
|
18
21
|
disabled,
|
|
19
22
|
value = '',
|
|
20
23
|
validatemessage,
|
|
21
24
|
status,
|
|
22
|
-
onChange,
|
|
23
|
-
onBlur,
|
|
24
25
|
readOnly,
|
|
25
26
|
testId,
|
|
26
27
|
fieldMetadata,
|
|
@@ -30,12 +31,20 @@ export default function TextArea(props: TextAreaProps) {
|
|
|
30
31
|
placeholder
|
|
31
32
|
} = props;
|
|
32
33
|
const helperTextToDisplay = validatemessage || helperText;
|
|
33
|
-
|
|
34
|
+
const pConn = getPConnect();
|
|
35
|
+
const actions = pConn.getActionsApi();
|
|
36
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
34
37
|
const maxLength = fieldMetadata?.maxLength;
|
|
35
38
|
|
|
39
|
+
const [inputValue, setInputValue] = useState('');
|
|
40
|
+
|
|
36
41
|
let readOnlyProp = {};
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setInputValue(value);
|
|
45
|
+
}, [value]);
|
|
46
|
+
|
|
47
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
39
48
|
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
40
49
|
}
|
|
41
50
|
|
|
@@ -55,6 +64,15 @@ export default function TextArea(props: TextAreaProps) {
|
|
|
55
64
|
'data-test-id': testId
|
|
56
65
|
};
|
|
57
66
|
|
|
67
|
+
function handleChange(event) {
|
|
68
|
+
// update internal value
|
|
69
|
+
setInputValue(event?.target?.value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function handleBlur() {
|
|
73
|
+
handleEvent(actions, 'changeNblur', propName, inputValue);
|
|
74
|
+
}
|
|
75
|
+
|
|
58
76
|
return (
|
|
59
77
|
<TextField
|
|
60
78
|
multiline
|
|
@@ -67,11 +85,11 @@ export default function TextArea(props: TextAreaProps) {
|
|
|
67
85
|
size='small'
|
|
68
86
|
required={required}
|
|
69
87
|
disabled={disabled}
|
|
70
|
-
onChange={
|
|
71
|
-
onBlur={!readOnly ?
|
|
88
|
+
onChange={handleChange}
|
|
89
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
72
90
|
error={status === 'error'}
|
|
73
91
|
label={label}
|
|
74
|
-
value={
|
|
92
|
+
value={inputValue}
|
|
75
93
|
InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}
|
|
76
94
|
/>
|
|
77
95
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
|
-
import { TextField } from '@material
|
|
2
|
+
import { TextField } from '@mui/material';
|
|
3
3
|
|
|
4
4
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
5
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
@@ -47,7 +47,7 @@ export default function TextInput(props: TextInputProps) {
|
|
|
47
47
|
setInputValue(value);
|
|
48
48
|
}, [value]);
|
|
49
49
|
|
|
50
|
-
if (displayMode === '
|
|
50
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
51
51
|
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
52
52
|
}
|
|
53
53
|
|
package/lib/field/Time/Time.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import AccessTimeIcon from '@
|
|
1
|
+
import { TimePicker } from '@mui/x-date-pickers/TimePicker';
|
|
2
|
+
// import AccessTimeIcon from '@mui/icons-material/AccessTime';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
|
|
5
|
+
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
6
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
7
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
8
|
|
|
@@ -14,10 +15,12 @@ export default function Time(props: TimeProps) {
|
|
|
14
15
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
15
16
|
const TextInput = getComponentFromMap('TextInput');
|
|
16
17
|
|
|
17
|
-
const { label, required, disabled, value = '', validatemessage, status,
|
|
18
|
+
const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, helperText, displayMode, hideLabel, testId } = props;
|
|
18
19
|
const helperTextToDisplay = validatemessage || helperText;
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const pConn = getPConnect();
|
|
21
|
+
const actions = pConn.getActionsApi();
|
|
22
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
23
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
21
24
|
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -36,12 +39,12 @@ export default function Time(props: TimeProps) {
|
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
const handleChange = date => {
|
|
39
|
-
const theValue = date && date.isValid() ? date.format('HH:mm') : null;
|
|
40
|
-
|
|
42
|
+
const theValue = date && date.isValid() ? date.format('HH:mm:ss') : null;
|
|
43
|
+
handleEvent(actions, 'changeNblur', propName, theValue);
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
let timeValue: any = null;
|
|
44
|
-
if (value) {
|
|
47
|
+
if (value && Object.keys(value).length) {
|
|
45
48
|
const timeArray = value.split(':').map(itm => Number(itm));
|
|
46
49
|
timeValue = dayjs().hour(timeArray[0]).minute(timeArray[1]);
|
|
47
50
|
}
|
|
@@ -52,25 +55,29 @@ export default function Time(props: TimeProps) {
|
|
|
52
55
|
//
|
|
53
56
|
|
|
54
57
|
return (
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
keyboardIcon={<AccessTimeIcon />}
|
|
60
|
-
fullWidth
|
|
61
|
-
required={required}
|
|
58
|
+
<TimePicker
|
|
59
|
+
// keyboardIcon={<AccessTimeIcon />}
|
|
60
|
+
// fullWidth
|
|
61
|
+
|
|
62
62
|
disabled={disabled}
|
|
63
|
-
error={status === 'error'}
|
|
64
|
-
helperText={helperTextToDisplay}
|
|
65
63
|
minutesStep={5}
|
|
66
|
-
size='small'
|
|
67
64
|
label={label}
|
|
68
|
-
autoOk
|
|
69
|
-
mask='__:__ _m'
|
|
65
|
+
// autoOk
|
|
66
|
+
// mask='__:__ _m'
|
|
70
67
|
format='hh:mm a'
|
|
71
68
|
value={timeValue}
|
|
72
69
|
onChange={handleChange}
|
|
73
|
-
|
|
70
|
+
slotProps={{
|
|
71
|
+
textField: {
|
|
72
|
+
variant: 'outlined',
|
|
73
|
+
placeholder: 'hh:mm am',
|
|
74
|
+
required,
|
|
75
|
+
error: status === 'error',
|
|
76
|
+
helperText: helperTextToDisplay,
|
|
77
|
+
size: 'small',
|
|
78
|
+
InputProps: { ...testProp }
|
|
79
|
+
}
|
|
80
|
+
}}
|
|
74
81
|
/>
|
|
75
82
|
);
|
|
76
83
|
}
|
package/lib/field/URL/URL.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { TextField } from '@mui/material';
|
|
2
3
|
|
|
4
|
+
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
3
5
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
6
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
7
|
|
|
@@ -16,14 +18,13 @@ export default function URLComponent(props: URLComponentProps) {
|
|
|
16
18
|
const TextInput = getComponentFromMap('TextInput');
|
|
17
19
|
|
|
18
20
|
const {
|
|
21
|
+
getPConnect,
|
|
19
22
|
label,
|
|
20
23
|
required,
|
|
21
24
|
disabled,
|
|
22
25
|
value = '',
|
|
23
26
|
validatemessage,
|
|
24
27
|
status,
|
|
25
|
-
onChange,
|
|
26
|
-
onBlur,
|
|
27
28
|
readOnly,
|
|
28
29
|
testId,
|
|
29
30
|
helperText,
|
|
@@ -33,7 +34,17 @@ export default function URLComponent(props: URLComponentProps) {
|
|
|
33
34
|
} = props;
|
|
34
35
|
const helperTextToDisplay = validatemessage || helperText;
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
const [inputValue, setInputValue] = useState('');
|
|
38
|
+
|
|
39
|
+
const pConn = getPConnect();
|
|
40
|
+
const actions = pConn.getActionsApi();
|
|
41
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setInputValue(value);
|
|
45
|
+
}, [value]);
|
|
46
|
+
|
|
47
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
37
48
|
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
38
49
|
}
|
|
39
50
|
|
|
@@ -51,6 +62,14 @@ export default function URLComponent(props: URLComponentProps) {
|
|
|
51
62
|
'data-test-id': testId
|
|
52
63
|
};
|
|
53
64
|
|
|
65
|
+
const handleChange = event => {
|
|
66
|
+
setInputValue(event?.target?.value);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
function handleBlur() {
|
|
70
|
+
handleEvent(actions, 'changeNblur', propName, inputValue);
|
|
71
|
+
}
|
|
72
|
+
|
|
54
73
|
return (
|
|
55
74
|
<TextField
|
|
56
75
|
type='url'
|
|
@@ -61,11 +80,11 @@ export default function URLComponent(props: URLComponentProps) {
|
|
|
61
80
|
size='small'
|
|
62
81
|
required={required}
|
|
63
82
|
disabled={disabled}
|
|
64
|
-
onChange={
|
|
65
|
-
onBlur={!readOnly ?
|
|
83
|
+
onChange={handleChange}
|
|
84
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
66
85
|
error={status === 'error'}
|
|
67
86
|
label={label}
|
|
68
|
-
value={
|
|
87
|
+
value={inputValue}
|
|
69
88
|
InputProps={{ inputProps: { ...testProp } }}
|
|
70
89
|
/>
|
|
71
90
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo, useEffect, useState } from 'react';
|
|
2
|
-
import { Typography } from '@material
|
|
2
|
+
import { Typography } from '@mui/material';
|
|
3
3
|
|
|
4
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
5
|
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
@@ -80,10 +80,8 @@ const UserReference = (props: UserReferenceProps) => {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
PCore.getRestClient()
|
|
83
|
-
// @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
|
|
84
|
-
// @ts-ignore - Expected 3 arguments, but got 2
|
|
85
83
|
.invokeRestApi('getListData', { queryPayload })
|
|
86
|
-
.then(
|
|
84
|
+
.then(res => {
|
|
87
85
|
const ddDataSource = res.data.data.map(listItem => ({
|
|
88
86
|
key: listItem.pyUserIdentifier,
|
|
89
87
|
value: listItem.pyUserName
|
|
@@ -99,7 +97,7 @@ const UserReference = (props: UserReferenceProps) => {
|
|
|
99
97
|
|
|
100
98
|
let userReferenceComponent: any = null;
|
|
101
99
|
|
|
102
|
-
if (displayMode === '
|
|
100
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
103
101
|
return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} />;
|
|
104
102
|
}
|
|
105
103
|
|
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
1
|
export function isEmptyObject(obj: Object): boolean {
|
|
3
2
|
return Object.keys(obj).length === 0;
|
|
4
3
|
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get a localized value from the Generic Fields
|
|
7
|
+
* @param path - The path within Generic Fields (e.g., 'CosmosFields.fields.lists')
|
|
8
|
+
* @param key - The key of the string to localize
|
|
9
|
+
* @returns The localized string or the key itself if no translation is found
|
|
10
|
+
*/
|
|
11
|
+
export function getGenericFieldsLocalizedValue(path: string, key: string): string {
|
|
12
|
+
const GENERIC_BUNDLE_KEY = PCore.getLocaleUtils().GENERIC_BUNDLE_KEY;
|
|
13
|
+
const localeStore = PCore.getLocaleUtils().localeStore[GENERIC_BUNDLE_KEY];
|
|
14
|
+
|
|
15
|
+
if (!localeStore) return key;
|
|
16
|
+
|
|
17
|
+
// Split the path and traverse the object
|
|
18
|
+
const pathParts = path.split('.');
|
|
19
|
+
let currentObj = localeStore;
|
|
20
|
+
|
|
21
|
+
for (const part of pathParts) {
|
|
22
|
+
if (!currentObj[part]) return key;
|
|
23
|
+
currentObj = currentObj[part];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return currentObj[key] || key;
|
|
27
|
+
}
|
|
@@ -49,8 +49,8 @@ export function buildView(pConn, index, viewConfigPath): ReactElement {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const view = PCore.createPConnect(config);
|
|
52
|
-
if (pConn.getConfigProps()?.displayMode === '
|
|
53
|
-
view.getPConnect()?.setInheritedProp('displayMode', '
|
|
52
|
+
if (pConn.getConfigProps()?.displayMode === 'DISPLAY_ONLY') {
|
|
53
|
+
view.getPConnect()?.setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
54
54
|
}
|
|
55
55
|
return createElement(createPConnectComponent(), view);
|
|
56
56
|
}
|
|
@@ -5,10 +5,7 @@ import CurrencyMap from './CurrencyMap';
|
|
|
5
5
|
function NumberFormatter(value, { locale = 'en-US', decPlaces = 2, style = '', currency = 'USD' } = {}): string {
|
|
6
6
|
const currentLocale: string | undefined = getLocale(locale);
|
|
7
7
|
if (value !== null && value !== undefined) {
|
|
8
|
-
return Number(value).toLocaleString(currentLocale, {
|
|
9
|
-
minimumFractionDigits: decPlaces,
|
|
10
|
-
maximumFractionDigits: decPlaces
|
|
11
|
-
});
|
|
8
|
+
return Number(value).toLocaleString(currentLocale, { minimumFractionDigits: decPlaces, maximumFractionDigits: decPlaces });
|
|
12
9
|
}
|
|
13
10
|
return value;
|
|
14
11
|
}
|
|
@@ -20,14 +17,16 @@ function CurrencyFormatter(
|
|
|
20
17
|
const currentLocale: string | undefined = getLocale(locale);
|
|
21
18
|
let formattedValue: string = value;
|
|
22
19
|
if (value !== null && value !== undefined && value !== '') {
|
|
23
|
-
formattedValue = NumberFormatter(value, {
|
|
24
|
-
locale: currentLocale,
|
|
25
|
-
decPlaces,
|
|
26
|
-
style,
|
|
27
|
-
currency
|
|
28
|
-
});
|
|
20
|
+
formattedValue = NumberFormatter(value, { locale: currentLocale, decPlaces, style, currency });
|
|
29
21
|
|
|
30
|
-
|
|
22
|
+
// For currency other than EUR, we need to determine the country code from currency code
|
|
23
|
+
// If currency is EUR, we use the locale to determine the country code
|
|
24
|
+
let countryCode: string | undefined;
|
|
25
|
+
if (currency !== 'EUR') {
|
|
26
|
+
countryCode = currency.substring(0, 2);
|
|
27
|
+
} else {
|
|
28
|
+
countryCode = currentLocale?.split('-')[1].toUpperCase();
|
|
29
|
+
}
|
|
31
30
|
|
|
32
31
|
// If countryCode is still undefined, setting it as US
|
|
33
32
|
if (!countryCode) {
|
|
@@ -67,11 +66,7 @@ export default {
|
|
|
67
66
|
Currency: (value, options) => CurrencyFormatter(value, options),
|
|
68
67
|
'Currency-Code': (value, options) => CurrencyFormatter(value, { ...options, symbol: false }),
|
|
69
68
|
Decimal: (value, options) => NumberFormatter(value, options),
|
|
70
|
-
'Decimal-Auto': (value, options) =>
|
|
71
|
-
NumberFormatter(value, {
|
|
72
|
-
...options,
|
|
73
|
-
decPlaces: Number.isInteger(value) ? 0 : 2
|
|
74
|
-
}),
|
|
69
|
+
'Decimal-Auto': (value, options) => NumberFormatter(value, { ...options, decPlaces: Number.isInteger(value) ? 0 : 2 }),
|
|
75
70
|
Integer: (value, options) => NumberFormatter(value, { ...options, decPlaces: 0 }),
|
|
76
71
|
Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' })
|
|
77
72
|
};
|
|
@@ -7,7 +7,8 @@ export function getLocale(locale: string = '') {
|
|
|
7
7
|
return Intl.DateTimeFormat().resolvedOptions().locale;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function getCurrentTimezone(timezone
|
|
10
|
+
export function getCurrentTimezone(timezone?: string) {
|
|
11
|
+
// use timezone if specified
|
|
11
12
|
if (timezone) return timezone;
|
|
12
13
|
return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
|
|
13
14
|
}
|
|
@@ -18,10 +18,8 @@ function getDateObject(text): Date {
|
|
|
18
18
|
const day = parseInt(timeStamp.substr(6, 2), 10);
|
|
19
19
|
|
|
20
20
|
const date = new Date();
|
|
21
|
-
|
|
22
|
-
date.
|
|
23
|
-
date.setMonth(month);
|
|
24
|
-
date.setFullYear(year);
|
|
21
|
+
// Fix to handle all the dates, raised via https://github.com/pegasystems/react-sdk-components/issues/442
|
|
22
|
+
date.setFullYear(year, month, day);
|
|
25
23
|
|
|
26
24
|
if (isDateTime) {
|
|
27
25
|
const hours = parseInt(timeStamp.substr(9, 2), 10);
|
|
@@ -231,7 +231,7 @@ export const filterData = filterByColumns => {
|
|
|
231
231
|
case 'Date':
|
|
232
232
|
case 'DateTime':
|
|
233
233
|
case 'Time':
|
|
234
|
-
value = item[filterObj.ref] !== null ?? item[filterObj.ref] !== '' ? Utils.getSeconds(item[filterObj.ref]) : null;
|
|
234
|
+
value = (item[filterObj.ref] !== null ?? item[filterObj.ref] !== '') ? Utils.getSeconds(item[filterObj.ref]) : null;
|
|
235
235
|
filterValue =
|
|
236
236
|
filterObj.containsFilterValue !== null && filterObj.containsFilterValue !== '' ? Utils.getSeconds(filterObj.containsFilterValue) : null;
|
|
237
237
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Button from '@material
|
|
3
|
-
import { Grid, Divider } from '@material
|
|
1
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
2
|
+
import Button from '@mui/material/Button';
|
|
3
|
+
import { Grid, Divider } from '@mui/material';
|
|
4
4
|
|
|
5
5
|
// ActionButtons does NOT have getPConnect. So, no need to extend from PConnProps
|
|
6
6
|
interface ActionButtonsProps {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
-
import Snackbar from '@material
|
|
3
|
-
import IconButton from '@material
|
|
4
|
-
import CloseIcon from '@
|
|
2
|
+
import Snackbar from '@mui/material/Snackbar';
|
|
3
|
+
import IconButton from '@mui/material/IconButton';
|
|
4
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
5
5
|
|
|
6
6
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
+
import { useFocusFirstField, useScrolltoTop } from '@pega/react-sdk-components/lib/hooks';
|
|
7
8
|
|
|
8
9
|
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
10
|
|
|
@@ -41,6 +42,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
41
42
|
const cancelAssignment = actionsAPI.cancelAssignment.bind(actionsAPI);
|
|
42
43
|
const saveAssignment = actionsAPI.saveAssignment?.bind(actionsAPI);
|
|
43
44
|
const cancelCreateStageAssignment = actionsAPI.cancelCreateStageAssignment.bind(actionsAPI);
|
|
45
|
+
const approveCase = actionsAPI.approveCase?.bind(actionsAPI);
|
|
46
|
+
const rejectCase = actionsAPI.rejectCase?.bind(actionsAPI);
|
|
44
47
|
// const showPage = actionsAPI.showPage.bind(actionsAPI);
|
|
45
48
|
|
|
46
49
|
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
@@ -84,6 +87,10 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
84
87
|
return formedSteps;
|
|
85
88
|
}
|
|
86
89
|
|
|
90
|
+
const scrollId = window.location.href.includes('embedded') ? '#pega-part-of-page' : '#portal';
|
|
91
|
+
useScrolltoTop(scrollId, children);
|
|
92
|
+
useFocusFirstField('Assignment', children);
|
|
93
|
+
|
|
87
94
|
useEffect(() => {
|
|
88
95
|
if (children) {
|
|
89
96
|
const firstChild = Array.isArray(children) ? children[0] : children;
|
|
@@ -92,7 +99,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
92
99
|
const oData: any = thePConn.getDataObject(''); // 1st arg empty string until typedefs allow it to be optional
|
|
93
100
|
|
|
94
101
|
if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
|
|
95
|
-
const oCaseInfo = oData
|
|
102
|
+
const oCaseInfo = oData?.caseInfo;
|
|
96
103
|
|
|
97
104
|
if (oCaseInfo && oCaseInfo.actionButtons) {
|
|
98
105
|
setActionButtons(oCaseInfo.actionButtons);
|
|
@@ -132,7 +139,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
132
139
|
setShowSnackbar(true);
|
|
133
140
|
}
|
|
134
141
|
|
|
135
|
-
function handleSnackbarClose(event: React.SyntheticEvent |
|
|
142
|
+
function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {
|
|
136
143
|
if (reason === 'clickaway') {
|
|
137
144
|
return;
|
|
138
145
|
}
|
|
@@ -140,7 +147,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
140
147
|
}
|
|
141
148
|
|
|
142
149
|
function onSaveActionSuccess(data) {
|
|
143
|
-
actionsAPI.cancelAssignment(itemKey).then(() => {
|
|
150
|
+
actionsAPI.cancelAssignment(itemKey, false).then(() => {
|
|
144
151
|
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
|
|
145
152
|
});
|
|
146
153
|
}
|
|
@@ -167,7 +174,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
167
174
|
|
|
168
175
|
savePromise
|
|
169
176
|
.then(() => {
|
|
170
|
-
// @ts-ignore - Property 'c11nEnv' is private and only accessible within class 'CaseInfo'.
|
|
171
177
|
const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
|
|
172
178
|
onSaveActionSuccess({ caseType, caseID, assignmentID });
|
|
173
179
|
})
|
|
@@ -182,10 +188,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
182
188
|
// check if create stage (modal)
|
|
183
189
|
const { PUB_SUB_EVENTS } = PCore.getConstants();
|
|
184
190
|
const { publish } = PCore.getPubSubUtils();
|
|
185
|
-
// @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
|
|
186
191
|
const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
|
|
187
192
|
const isLocalAction =
|
|
188
|
-
// @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
|
|
189
193
|
thePConn.getCaseInfo().isLocalAction() ||
|
|
190
194
|
(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
|
|
191
195
|
if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
|
|
@@ -199,7 +203,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
199
203
|
showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
|
|
200
204
|
});
|
|
201
205
|
} else {
|
|
202
|
-
const cancelPromise = cancelAssignment(itemKey);
|
|
206
|
+
const cancelPromise = cancelAssignment(itemKey, false);
|
|
203
207
|
|
|
204
208
|
cancelPromise
|
|
205
209
|
.then(data => {
|
|
@@ -212,11 +216,22 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
212
216
|
break;
|
|
213
217
|
}
|
|
214
218
|
|
|
219
|
+
case 'rejectCase': {
|
|
220
|
+
const rejectPromise = rejectCase(itemKey);
|
|
221
|
+
|
|
222
|
+
rejectPromise
|
|
223
|
+
.then(() => {})
|
|
224
|
+
.catch(() => {
|
|
225
|
+
showToast(`${localizedVal('Rejection failed!', localeCategory)}`);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
|
|
215
231
|
default:
|
|
216
232
|
break;
|
|
217
233
|
}
|
|
218
234
|
} else if (sButtonType === 'primary') {
|
|
219
|
-
// eslint-disable-next-line sonarjs/no-small-switch
|
|
220
235
|
switch (sAction) {
|
|
221
236
|
case 'finishAssignment': {
|
|
222
237
|
const finishPromise = finishAssignment(itemKey);
|
|
@@ -230,6 +245,18 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
230
245
|
break;
|
|
231
246
|
}
|
|
232
247
|
|
|
248
|
+
case 'approveCase': {
|
|
249
|
+
const approvePromise = approveCase(itemKey);
|
|
250
|
+
|
|
251
|
+
approvePromise
|
|
252
|
+
.then(() => {})
|
|
253
|
+
.catch(() => {
|
|
254
|
+
showToast(`${localizedVal('Approve failed!', localeCategory)}`);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
|
|
233
260
|
default:
|
|
234
261
|
break;
|
|
235
262
|
}
|
|
@@ -245,7 +272,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
245
272
|
}
|
|
246
273
|
|
|
247
274
|
// expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
|
|
248
|
-
// @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
|
|
249
275
|
const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
|
|
250
276
|
const context = thePConn.getContextName();
|
|
251
277
|
const pageReference = thePConn.getPageReference();
|