@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.
Files changed (118) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +1 -1
  2. package/lib/designSystemExtension/Banner/Banner.tsx +1 -1
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +11 -2
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +4 -4
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +4 -4
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +6 -6
  9. package/lib/designSystemExtension/Operator/Operator.tsx +6 -5
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +2 -2
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
  13. package/lib/field/AutoComplete/AutoComplete.tsx +4 -4
  14. package/lib/field/CancelAlert/CancelAlert.tsx +4 -7
  15. package/lib/field/Checkbox/Checkbox.tsx +4 -4
  16. package/lib/field/Currency/Currency.tsx +10 -7
  17. package/lib/field/Date/Date.tsx +27 -42
  18. package/lib/field/DateTime/DateTime.tsx +39 -36
  19. package/lib/field/Decimal/Decimal.tsx +9 -4
  20. package/lib/field/Dropdown/Dropdown.tsx +29 -22
  21. package/lib/field/Email/Email.tsx +29 -8
  22. package/lib/field/Group/Group.tsx +2 -2
  23. package/lib/field/Integer/Integer.tsx +22 -8
  24. package/lib/field/Multiselect/Multiselect.tsx +8 -14
  25. package/lib/field/Multiselect/utils.ts +1 -1
  26. package/lib/field/Percentage/Percentage.tsx +8 -4
  27. package/lib/field/Phone/Phone.tsx +22 -12
  28. package/lib/field/Phone/config-ext.json +8 -0
  29. package/lib/field/RadioButtons/RadioButtons.tsx +3 -6
  30. package/lib/field/RichText/RichText.tsx +1 -1
  31. package/lib/field/RichText/config-ext.json +10 -0
  32. package/lib/field/ScalarList/ScalarList.tsx +3 -4
  33. package/lib/field/SemanticLink/SemanticLink.tsx +4 -4
  34. package/lib/field/TextArea/TextArea.tsx +26 -8
  35. package/lib/field/TextContent/TextContent.tsx +1 -1
  36. package/lib/field/TextInput/TextInput.tsx +2 -2
  37. package/lib/field/Time/Time.tsx +28 -21
  38. package/lib/field/URL/URL.tsx +26 -7
  39. package/lib/field/UserReference/UserReference.tsx +3 -5
  40. package/lib/helpers/common-utils.ts +24 -1
  41. package/lib/helpers/field-group-utils.ts +2 -2
  42. package/lib/helpers/formatters/Currency.ts +11 -16
  43. package/lib/helpers/formatters/common.ts +2 -1
  44. package/lib/helpers/formatters/index.ts +2 -4
  45. package/lib/helpers/simpleTableHelpers.ts +1 -1
  46. package/lib/infra/ActionButtons/ActionButtons.tsx +3 -3
  47. package/lib/infra/Assignment/Assignment.tsx +38 -12
  48. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +16 -28
  49. package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
  50. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +9 -4
  51. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +8 -8
  52. package/lib/infra/Containers/SimpleView/helper.ts +1 -1
  53. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +1 -1
  54. package/lib/infra/DashboardFilter/DashboardFilter.tsx +4 -6
  55. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
  56. package/lib/infra/DeferLoad/DeferLoad.tsx +8 -8
  57. package/lib/infra/MultiStep/MultiStep.tsx +15 -14
  58. package/lib/infra/NavBar/NavBar.css +1 -0
  59. package/lib/infra/NavBar/NavBar.tsx +25 -17
  60. package/lib/infra/RootContainer/RootContainer.tsx +5 -6
  61. package/lib/infra/Stages/Stages.tsx +4 -4
  62. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +4 -3
  63. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
  64. package/lib/infra/View/View.tsx +37 -3
  65. package/lib/template/AdvancedSearch/AdvancedSearch.tsx +87 -0
  66. package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +58 -0
  67. package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +245 -0
  68. package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
  69. package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
  70. package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
  71. package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
  72. package/lib/template/AdvancedSearch/config-ext.json +9 -0
  73. package/lib/template/AdvancedSearch/index.tsx +1 -0
  74. package/lib/template/AppShell/AppShell.tsx +60 -10
  75. package/lib/template/BannerPage/config-ext.json +9 -0
  76. package/lib/template/CaseView/CaseView.tsx +10 -9
  77. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +7 -7
  78. package/lib/template/Confirmation/Confirmation.tsx +3 -2
  79. package/lib/template/DataReference/DataReference.tsx +317 -107
  80. package/lib/template/DataReference/DataReferenceAdvancedSearchContext.js +10 -0
  81. package/lib/template/DataReference/SearchForm.tsx +148 -0
  82. package/lib/template/DataReference/utils.js +90 -0
  83. package/lib/template/DefaultForm/utils/index.ts +1 -3
  84. package/lib/template/Details/Details/Details.tsx +2 -2
  85. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +3 -3
  86. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +2 -2
  87. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +2 -2
  88. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +4 -4
  89. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +10 -5
  90. package/lib/template/InlineDashboard/InlineDashboard.tsx +2 -2
  91. package/lib/template/InlineDashboardPage/config-ext.json +9 -0
  92. package/lib/template/ListView/ListView.tsx +216 -123
  93. package/lib/template/ListView/utils.ts +38 -6
  94. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +2 -2
  95. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +2 -2
  96. package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -2
  97. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +0 -2
  98. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +110 -86
  99. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +2 -4
  100. package/lib/template/SubTabs/SubTabs.tsx +2 -2
  101. package/lib/template/SubTabs/tabUtils.ts +118 -1
  102. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +2 -2
  103. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +2 -2
  104. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +2 -2
  105. package/lib/template/WssNavBar/WssNavBar.tsx +9 -9
  106. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +2 -2
  107. package/lib/widget/Attachment/Attachment.css +1 -0
  108. package/lib/widget/Attachment/Attachment.tsx +7 -9
  109. package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
  110. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -1
  111. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +5 -4
  112. package/lib/widget/Followers/Followers.tsx +2 -2
  113. package/lib/widget/QuickCreate/QuickCreate.tsx +0 -1
  114. package/lib/widget/QuickCreate/config-ext.json +9 -0
  115. package/lib/widget/SummaryItem/SummaryItem.tsx +4 -3
  116. package/lib/widget/ToDo/ToDo.tsx +92 -22
  117. package/package.json +1 -1
  118. /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
@@ -1,5 +1,7 @@
1
- import { TextField } from '@material-ui/core';
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
- if (displayMode === 'LABELS_LEFT') {
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={onChange}
71
- onBlur={!readOnly ? onBlur : undefined}
88
+ onChange={handleChange}
89
+ onBlur={!readOnly ? handleBlur : undefined}
72
90
  error={status === 'error'}
73
91
  label={label}
74
- value={value}
92
+ value={inputValue}
75
93
  InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}
76
94
  />
77
95
  );
@@ -1,4 +1,4 @@
1
- import { Typography } from '@material-ui/core';
1
+ import { Typography } from '@mui/material';
2
2
 
3
3
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from 'react';
2
- import { TextField } from '@material-ui/core';
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 === 'LABELS_LEFT') {
50
+ if (displayMode === 'DISPLAY_ONLY') {
51
51
  return <FieldValueList name={hideLabel ? '' : label} value={value} />;
52
52
  }
53
53
 
@@ -1,7 +1,8 @@
1
- import { KeyboardTimePicker } from '@material-ui/pickers';
2
- import AccessTimeIcon from '@material-ui/icons/AccessTime';
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, onChange, readOnly, helperText, displayMode, hideLabel, testId } = props;
18
+ const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, helperText, displayMode, hideLabel, testId } = props;
18
19
  const helperTextToDisplay = validatemessage || helperText;
19
-
20
- if (displayMode === 'LABELS_LEFT') {
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
- onChange({ value: theValue });
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
- <KeyboardTimePicker
56
- variant='inline'
57
- inputVariant='outlined'
58
- placeholder='hh:mm am'
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
- InputProps={{ inputProps: { ...testProp } }}
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
  }
@@ -1,5 +1,7 @@
1
- import { TextField } from '@material-ui/core';
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
- if (displayMode === 'LABELS_LEFT') {
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={onChange}
65
- onBlur={!readOnly ? onBlur : undefined}
83
+ onChange={handleChange}
84
+ onBlur={!readOnly ? handleBlur : undefined}
66
85
  error={status === 'error'}
67
86
  label={label}
68
- value={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-ui/core';
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((res: any) => {
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 === 'LABELS_LEFT') {
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 === 'LABELS_LEFT') {
53
- view.getPConnect()?.setInheritedProp('displayMode', 'LABELS_LEFT');
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
- let countryCode: string | undefined = currentLocale?.split('-')[1].toUpperCase();
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: string = 'America/New_York') {
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.setDate(day);
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 { makeStyles } from '@material-ui/core/styles';
2
- import Button from '@material-ui/core/Button';
3
- import { Grid, Divider } from '@material-ui/core';
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-ui/core/Snackbar';
3
- import IconButton from '@material-ui/core/IconButton';
4
- import CloseIcon from '@material-ui/icons/Close';
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.caseInfo;
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 | React.MouseEvent, reason?: string) {
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();