@pega/dx-component-builder-sdk 23.1.12 → 23.1.14

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 (75) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +3 -2
  4. package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.tsx.mustache +8 -1
  5. package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +3 -9
  6. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +7 -15
  7. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/demo.stories.tsx.mustache +20 -0
  8. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +38 -37
  9. package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +3 -3
  10. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.tsx.mustache +7 -0
  11. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +5 -3
  12. package/src/tasks/map/map.js +29 -8
  13. package/src/tasks/publish/index.js +3 -1
  14. package/src/tasks/publish-all/index.js +7 -5
  15. package/tests/assets/sdk-a/components/create/override-sdk/template/list-view/utils.ts +4 -2
  16. package/tests/assets/sdk-a/components/createAll/override-sdk/template/list-view/utils.ts +4 -2
  17. package/tests/assets/sdk-r/components/create/override-sdk/designSystemExtension/Operator/Operator.tsx +5 -3
  18. package/tests/assets/sdk-r/components/create/override-sdk/field/CancelAlert/CancelAlert.tsx +95 -78
  19. package/tests/assets/sdk-r/components/create/override-sdk/field/Checkbox/Checkbox.tsx +3 -1
  20. package/tests/assets/sdk-r/components/create/override-sdk/field/Currency/Currency.tsx +10 -16
  21. package/tests/assets/sdk-r/components/create/override-sdk/field/Decimal/Decimal.tsx +6 -10
  22. package/tests/assets/sdk-r/components/create/override-sdk/field/Group/Group.tsx +2 -0
  23. package/tests/assets/sdk-r/components/create/override-sdk/field/Percentage/Percentage.tsx +41 -36
  24. package/tests/assets/sdk-r/components/create/override-sdk/infra/Assignment/Assignment.tsx +21 -7
  25. package/tests/assets/sdk-r/components/create/override-sdk/infra/NavBar/NavBar.tsx +5 -3
  26. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseSummary/CaseSummary.tsx +43 -1
  27. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseView/CaseView.tsx +1 -1
  28. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +34 -1
  29. package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/ListView.tsx +2 -1
  30. package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/utils.ts +3 -1
  31. package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +28 -12
  32. package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrow/WideNarrow.tsx +1 -1
  33. package/tests/assets/sdk-r/components/create/override-sdk/template/WssNavBar/WssNavBar.tsx +4 -1
  34. package/tests/assets/sdk-r/components/create/override-sdk/widget/Attachment/Attachment.tsx +12 -2
  35. package/tests/assets/sdk-r/components/create/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
  36. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyBoolean/index.tsx +3 -2
  37. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/index.tsx +7 -15
  38. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/demo.stories.tsx +8 -1
  39. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDecimal/index.tsx +3 -9
  40. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/demo.stories.tsx +20 -0
  41. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/index.tsx +38 -37
  42. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyCaseWidget/index.tsx +3 -3
  43. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +7 -0
  44. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageCaseWidget/index.tsx +5 -3
  45. package/tests/assets/sdk-r/components/createAll/override-sdk/designSystemExtension/Operator/Operator.tsx +5 -3
  46. package/tests/assets/sdk-r/components/createAll/override-sdk/field/CancelAlert/CancelAlert.tsx +95 -78
  47. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Checkbox/Checkbox.tsx +3 -1
  48. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Currency/Currency.tsx +10 -16
  49. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Decimal/Decimal.tsx +6 -10
  50. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/Group.tsx +2 -0
  51. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Percentage/Percentage.tsx +41 -36
  52. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Assignment/Assignment.tsx +21 -7
  53. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/NavBar/NavBar.tsx +5 -3
  54. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseSummary/CaseSummary.tsx +43 -1
  55. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseView/CaseView.tsx +1 -1
  56. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +34 -1
  57. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/ListView.tsx +2 -1
  58. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/utils.ts +3 -1
  59. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +28 -12
  60. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrow/WideNarrow.tsx +1 -1
  61. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WssNavBar/WssNavBar.tsx +4 -1
  62. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/Attachment/Attachment.tsx +12 -2
  63. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
  64. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/PConnProps.d.ts +0 -46
  65. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/demo.stories.tsx +0 -54
  66. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/index.tsx +0 -73
  67. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/mock.ts +0 -15
  68. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/styles.ts +0 -15
  69. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/config.json +0 -83
  70. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/demo.stories.tsx +0 -59
  71. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/index.tsx +0 -101
  72. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/mock.ts +0 -16
  73. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/styles.js +0 -7
  74. /package/src/tasks/create/templates/Constellation/field/Boolean/{demo.stories.jsx.mustache → demo.stories.tsx.mustache} +0 -0
  75. /package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/{demo.stories.jsx → demo.stories.tsx} +0 -0
@@ -20,6 +20,7 @@ interface PegaDxilMyPageCaseWidgetProps extends PConnProps {
20
20
  updateDateTime: string;
21
21
  updateLabel: string;
22
22
  updateOperator: { userName: string; userId: string };
23
+ displayLabel?: any;
23
24
  }
24
25
 
25
26
  const useStyles = makeStyles(theme => ({
@@ -42,18 +43,19 @@ export default function PegaDxilMyPageCaseWidget(props: PegaDxilMyPageCaseWidget
42
43
  // const componentName = "Operator";
43
44
  const classes = useStyles();
44
45
 
45
- const fieldLabel = props.label.toLowerCase();
46
+ const fieldLabel = props?.label?.toLowerCase();
47
+ const displayLabel = props?.displayLabel?.toLowerCase();
46
48
  let caseOpLabel = '---';
47
49
  let caseOpName = '---';
48
50
  let caseOpId = '';
49
51
  let caseTime = '';
50
52
 
51
- if (fieldLabel === 'create operator') {
53
+ if (fieldLabel === 'create operator' || displayLabel === 'create operator') {
52
54
  caseOpLabel = props.createLabel;
53
55
  caseOpName = props.createOperator.userName;
54
56
  caseTime = props.createDateTime;
55
57
  caseOpId = props.createOperator.userId;
56
- } else if (fieldLabel === 'update operator') {
58
+ } else if (fieldLabel === 'update operator' || displayLabel === 'update operator') {
57
59
  caseOpLabel = props.updateLabel;
58
60
  caseOpName = props.updateOperator.userName;
59
61
  caseTime = props.updateDateTime;
@@ -19,6 +19,7 @@ interface OperatorProps extends PConnProps {
19
19
  updateDateTime: string;
20
20
  updateLabel: string;
21
21
  updateOperator: { userName: string; userId: string };
22
+ displayLabel?: any;
22
23
  }
23
24
 
24
25
  const useStyles = makeStyles(theme => ({
@@ -36,18 +37,19 @@ export default function Operator(props: OperatorProps) {
36
37
  // const componentName = "Operator";
37
38
  const classes = useStyles();
38
39
 
39
- const fieldLabel = props.label.toLowerCase();
40
+ const fieldLabel = props?.label?.toLowerCase();
41
+ const displayLabel = props?.displayLabel?.toLowerCase();
40
42
  let caseOpLabel = '---';
41
43
  let caseOpName = '---';
42
44
  let caseOpId = '';
43
45
  let caseTime = '';
44
46
 
45
- if (fieldLabel === 'create operator') {
47
+ if (fieldLabel === 'create operator' || displayLabel === 'create operator') {
46
48
  caseOpLabel = props.createLabel;
47
49
  caseOpName = props.createOperator.userName;
48
50
  caseTime = props.createDateTime;
49
51
  caseOpId = props.createOperator.userId;
50
- } else if (fieldLabel === 'update operator') {
52
+ } else if (fieldLabel === 'update operator' || displayLabel === 'update operator') {
51
53
  caseOpLabel = props.updateLabel;
52
54
  caseOpName = props.updateOperator.userName;
53
55
  caseTime = props.updateDateTime;
@@ -7,34 +7,85 @@ import './CancelAlert.css';
7
7
 
8
8
  interface CancelAlertProps extends PConnFieldProps {
9
9
  // If any, enter additional props that only exist on CancelAlert here
10
- pConn: any;
11
- updateAlertState: any;
10
+ heading: string;
11
+ content: string;
12
+ itemKey: string;
13
+ hideDelete: boolean;
14
+ isDataObject: boolean;
15
+ skipReleaseLockRequest: any;
16
+ dismiss: Function;
12
17
  }
13
18
 
14
19
  export default function CancelAlert(props: CancelAlertProps) {
15
- const { pConn, updateAlertState } = props;
16
- const [showSnackbar, setShowSnackbar] = useState(false);
17
- const [snackbarMessage, setSnackbarMessage] = useState('');
18
-
19
- const itemKey = pConn.getContextName();
20
- const caseInfo = pConn.getCaseInfo();
21
- const caseName = caseInfo.getName();
22
- 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;
23
25
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
26
+ const broadCastUtils: any = PCore.getCoexistenceManager().getBroadcastUtils();
27
+ const isReverseCoexistence = broadCastUtils.isReverseCoexistenceCaseLoaded();
24
28
  const localeCategory = 'ModalContainer';
29
+ const btnIds = {
30
+ SAVE_AND_CLOSE: 'saveAndClose',
31
+ CONTINUE_WORKING: 'continueWorking',
32
+ DELETE: 'delete'
33
+ };
25
34
 
26
- function showToast(message: string) {
27
- setSnackbarMessage(message);
28
- setShowSnackbar(true);
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
+ }));
29
48
  }
30
49
 
31
- const dismissCancelAlertOnly = () => {
32
- updateAlertState(true);
33
- };
50
+ function enableButton(id) {
51
+ setButtonsState(prevState => ({
52
+ ...prevState,
53
+ [id]: false
54
+ }));
55
+ }
34
56
 
35
- const dismissModal = () => {
36
- updateAlertState(false);
37
- };
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
+ }
38
89
 
39
90
  function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
40
91
  if (reason === 'clickaway') {
@@ -43,75 +94,41 @@ export default function CancelAlert(props: CancelAlertProps) {
43
94
  setShowSnackbar(false);
44
95
  }
45
96
 
46
- const buttonClick = action => {
47
- const actionsAPI = pConn.getActionsApi();
48
-
49
- switch (action) {
50
- case 'save':
51
- // eslint-disable-next-line no-case-declarations
52
- const savePromise = actionsAPI.saveAndClose(itemKey);
53
-
54
- savePromise
55
- .then(() => {
56
- dismissModal();
57
-
58
- // @ts-ignore - second parameter “payload” for publish method should be optional
59
- PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED);
60
- })
61
- .catch(() => {
62
- showToast(localizedVal('Save failed', localeCategory));
63
- });
64
- break;
65
-
66
- case 'continue':
67
- dismissCancelAlertOnly();
68
- break;
69
-
70
- case 'delete':
71
- // eslint-disable-next-line no-case-declarations
72
- const deletePromise = actionsAPI.deleteCaseInCreateStage(itemKey);
73
-
74
- deletePromise
75
- .then(() => {
76
- dismissModal();
77
-
78
- // @ts-ignore - second parameter “payload” for publish method should be optional
79
- PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
80
- })
81
- .catch(() => {
82
- showToast(localizedVal('Delete failed.', localeCategory));
83
- });
84
- 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
+ );
85
113
 
86
- default:
87
- break;
88
- }
89
- };
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
+ );
90
119
 
91
120
  return (
92
121
  <>
93
122
  <div className='cancel-alert-background'>
94
123
  <div className='cancel-alert-top'>
95
- <h3>{`Delete ${caseName}(${ID})`}</h3>
124
+ <h3>{localizedVal(heading, localeCategory)}</h3>
96
125
  <div>
97
- <p>{`${localizedVal('Are you sure you want to delete', localeCategory)} ${caseName} (${ID})?`}</p>
98
- <p>{localizedVal('Alternatively, you can continue working or save your work for later.', localeCategory)}</p>
126
+ <p>{localizedVal(content, localeCategory)}</p>
99
127
  </div>
100
128
  <div className='action-controls'>
101
129
  <Grid container spacing={4} justifyContent='space-between'>
102
- <Grid item>
103
- <Button variant='outlined' color='primary' onClick={() => buttonClick('save')}>
104
- {localizedVal('Save for later', localeCategory)}
105
- </Button>
106
- </Grid>
107
- <Grid item>
108
- <Button variant='outlined' color='primary' onClick={() => buttonClick('continue')}>
109
- {localizedVal('Continue Working', localeCategory)}
110
- </Button>
111
- <Button variant='contained' color='primary' onClick={() => buttonClick('delete')}>
112
- {localizedVal('Delete', localeCategory)}
113
- </Button>
114
- </Grid>
130
+ <Grid item>{leftButton}</Grid>
131
+ <Grid item>{rightButton}</Grid>
115
132
  </Grid>
116
133
  </div>
117
134
  </div>
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from 'react';
2
- import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText } from '@material-ui/core';
2
+ import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@material-ui/core';
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';
@@ -20,6 +20,7 @@ export default function CheckboxComponent(props: CheckboxProps) {
20
20
 
21
21
  const {
22
22
  getPConnect,
23
+ label,
23
24
  value = false,
24
25
  readOnly,
25
26
  testId,
@@ -73,6 +74,7 @@ export default function CheckboxComponent(props: CheckboxProps) {
73
74
 
74
75
  return (
75
76
  <FormControl required={required} error={status === 'error'}>
77
+ {!hideLabel && <FormLabel component='legend'>{label}</FormLabel>}
76
78
  <FormGroup>
77
79
  <FormControlLabel
78
80
  control={theCheckbox}
@@ -1,14 +1,14 @@
1
- import { useState, useEffect } from 'react';
2
1
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
2
 
4
- import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
- import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
6
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
4
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
-
5
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
9
7
  import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
10
8
 
11
- // Using control from: https://github.com/unicef/material-ui-currency-textfield
9
+ /* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
10
+ as per the locale.
11
+ */
12
12
 
13
13
  interface CurrrencyProps extends PConnFieldProps {
14
14
  // If any, enter additional props that only exist on Currency here
@@ -48,17 +48,11 @@ export default function Currency(props: CurrrencyProps) {
48
48
  'data-test-id': testId
49
49
  };
50
50
 
51
- const [theCurrSym, setCurrSym] = useState('$');
52
- const [theCurrDec, setCurrDec] = useState('.');
53
- const [theCurrSep, setCurrSep] = useState(',');
54
-
55
- useEffect(() => {
56
- // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
57
- const theSymbols = getCurrencyCharacters(currencyISOCode);
58
- setCurrSym(theSymbols.theCurrencySymbol);
59
- setCurrDec(theSymbols.theDecimalIndicator);
60
- setCurrSep(theSymbols.theDigitGroupSeparator);
61
- }, [currencyISOCode]);
51
+ // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
52
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
53
+ const theCurrSym = theSymbols.theCurrencySymbol;
54
+ const theCurrDec = theSymbols.theDecimalIndicator;
55
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
62
56
 
63
57
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
64
58
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -1,4 +1,3 @@
1
- import { useState, useEffect } from 'react';
2
1
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
2
 
4
3
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
@@ -7,7 +6,9 @@ import { format } from '@pega/react-sdk-components/lib/components/helpers/format
7
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
7
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
8
 
10
- // Using control from: https://github.com/unicef/material-ui-currency-textfield
9
+ /* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
10
+ as per the locale.
11
+ */
11
12
 
12
13
  interface DecimalProps extends PConnFieldProps {
13
14
  // If any, enter additional props that only exist on Decimal here
@@ -45,14 +46,9 @@ export default function Decimal(props: DecimalProps) {
45
46
  const propName = (pConn.getStateProps() as any).value;
46
47
  const helperTextToDisplay = validatemessage || helperText;
47
48
 
48
- const [theCurrDec, setCurrDec] = useState('.');
49
- const [theCurrSep, setCurrSep] = useState(',');
50
-
51
- useEffect(() => {
52
- const theSymbols = getCurrencyCharacters(currencyISOCode);
53
- setCurrDec(theSymbols.theDecimalIndicator);
54
- setCurrSep(theSymbols.theDigitGroupSeparator);
55
- }, [currencyISOCode]);
49
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
50
+ const theCurrDec = theSymbols.theDecimalIndicator;
51
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
56
52
 
57
53
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
58
54
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -29,6 +29,8 @@ export default function Group(props: GroupProps) {
29
29
  );
30
30
  }, [children, type, isReadOnly]);
31
31
 
32
+ if (!children) return null;
33
+
32
34
  return (
33
35
  <FieldGroup name={showHeading ? heading : undefined} collapsible={collapsible} instructions={instructions}>
34
36
  {content}
@@ -1,67 +1,58 @@
1
- import { TextField } from '@material-ui/core';
2
- import { makeStyles } from '@material-ui/core/styles';
1
+ import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
2
 
4
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
4
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+ import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
6
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
7
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
6
8
 
7
- // Inspired by https://stackoverflow.com/questions/50823182/material-ui-remove-up-down-arrow-dials-from-textview
8
- const useStyles = makeStyles((/* theme */) => ({
9
- input: {
10
- '& input[type=number]': {
11
- '-moz-appearance': 'textfield'
12
- },
13
- '& input[type=number]::-webkit-outer-spin-button': {
14
- '-webkit-appearance': 'none',
15
- margin: 0
16
- },
17
- '& input[type=number]::-webkit-inner-spin-button': {
18
- '-webkit-appearance': 'none',
19
- margin: 0
20
- }
21
- }
22
- }));
23
-
9
+ /* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
10
+ as per the locale.
11
+ */
24
12
  interface PercentageProps extends PConnFieldProps {
25
13
  // If any, enter additional props that only exist on Percentage here
14
+ currencyISOCode?: string;
26
15
  }
27
16
 
28
17
  export default function Percentage(props: PercentageProps) {
29
18
  // Get emitted components from map (so we can get any override that may exist)
30
- const TextInput = getComponentFromMap('TextInput');
31
19
  const FieldValueList = getComponentFromMap('FieldValueList');
32
20
 
33
- const classes = useStyles();
34
-
35
21
  const {
22
+ getPConnect,
36
23
  label,
37
24
  required,
38
25
  disabled,
39
26
  value = '',
40
27
  validatemessage,
41
28
  status,
42
- onChange,
43
- onBlur,
29
+ // onChange,
30
+ // onBlur,
44
31
  readOnly,
32
+ currencyISOCode = 'USD',
45
33
  testId,
46
34
  helperText,
47
35
  displayMode,
48
36
  hideLabel,
49
37
  placeholder
50
38
  } = props;
39
+
40
+ const pConn = getPConnect();
41
+ const actions = pConn.getActionsApi();
42
+ const propName = (pConn.getStateProps() as any).value;
51
43
  const helperTextToDisplay = validatemessage || helperText;
52
44
 
45
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
46
+ const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
47
+
53
48
  // console.log(`Percentage: label: ${label} value: ${value}`);
54
49
 
55
50
  if (displayMode === 'LABELS_LEFT') {
56
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
51
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
57
52
  }
58
53
 
59
54
  if (displayMode === 'STACKED_LARGE_VAL') {
60
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
61
- }
62
-
63
- if (readOnly) {
64
- return <TextInput {...props} />;
55
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
65
56
  }
66
57
 
67
58
  let testProp = {};
@@ -70,9 +61,16 @@ export default function Percentage(props: PercentageProps) {
70
61
  'data-test-id': testId
71
62
  };
72
63
 
64
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
65
+ const theCurrDec = theSymbols.theDecimalIndicator;
66
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
67
+
68
+ function PercentageOnBlur(event, inValue) {
69
+ handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
70
+ }
71
+
73
72
  return (
74
- <TextField
75
- className={classes.input}
73
+ <CurrencyTextField
76
74
  fullWidth
77
75
  variant={readOnly ? 'standard' : 'outlined'}
78
76
  helperText={helperTextToDisplay}
@@ -80,13 +78,20 @@ export default function Percentage(props: PercentageProps) {
80
78
  size='small'
81
79
  required={required}
82
80
  disabled={disabled}
83
- onChange={onChange}
84
- onBlur={!readOnly ? onBlur : undefined}
81
+ readOnly={!!readOnly}
85
82
  error={status === 'error'}
86
83
  label={label}
87
84
  value={value}
88
- type='number'
89
- inputProps={{ ...testProp }}
85
+ type='text'
86
+ outputFormat='number'
87
+ textAlign='left'
88
+ InputProps={{
89
+ inputProps: { ...testProp }
90
+ }}
91
+ currencySymbol=''
92
+ decimalCharacter={theCurrDec}
93
+ digitGroupSeparator={theCurrSep}
94
+ onBlur={!readOnly ? PercentageOnBlur : undefined}
90
95
  />
91
96
  );
92
97
  }
@@ -70,6 +70,20 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
70
70
  return arIndicies;
71
71
  }
72
72
 
73
+ function getStepsInfo(steps, formedSteps: any = []) {
74
+ steps.forEach(step => {
75
+ if (step.name) {
76
+ step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
77
+ }
78
+ if (step.steps) {
79
+ formedSteps = getStepsInfo(step.steps, formedSteps);
80
+ } else {
81
+ formedSteps.push(step);
82
+ }
83
+ });
84
+ return formedSteps;
85
+ }
86
+
73
87
  useEffect(() => {
74
88
  if (children) {
75
89
  const firstChild = Array.isArray(children) ? children[0] : children;
@@ -97,13 +111,13 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
97
111
  } else {
98
112
  setIsVertical(false);
99
113
  }
100
- const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
101
- steps.forEach(step => {
102
- if (step.name) {
103
- step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
104
- }
105
- });
106
- setArNavigationSteps(steps);
114
+
115
+ if (oCaseInfo?.navigation?.steps) {
116
+ const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
117
+ const formedSteps = getStepsInfo(steps);
118
+ setArNavigationSteps(formedSteps);
119
+ }
120
+
107
121
  setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
108
122
  }
109
123
  }
@@ -116,6 +116,8 @@ export default function NavBar(props: NavBarProps) {
116
116
  const [bShowCaseTypes, setBShowCaseTypes] = useState(true);
117
117
  const [bShowOperatorButtons, setBShowOperatorButtons] = useState(false);
118
118
  const [anchorEl, setAnchorEl] = useState(null);
119
+ const localeUtils = PCore.getLocaleUtils();
120
+ const localeReference = pConn.getValue('.pyLocaleReference');
119
121
 
120
122
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
121
123
  const localeCategory = 'AppShell';
@@ -231,7 +233,7 @@ export default function NavBar(props: NavBarProps) {
231
233
  <ListItemIcon>
232
234
  <WorkOutlineIcon fontSize='large' />
233
235
  </ListItemIcon>
234
- <ListItemText primary={caseType.pyLabel} />
236
+ <ListItemText primary={localeUtils.getLocaleValue(caseType.pyLabel, '', localeReference)} />
235
237
  </ListItem>
236
238
  ))}
237
239
  </List>
@@ -240,7 +242,7 @@ export default function NavBar(props: NavBarProps) {
240
242
  {navPages.map(page => (
241
243
  <ListItem button onClick={() => navPanelButtonClick(page)} key={page.pyLabel}>
242
244
  <ListItemIcon>{iconMap[page.pxPageViewIcon]}</ListItemIcon>
243
- <ListItemText primary={page.pyLabel} />
245
+ <ListItemText primary={localeUtils.getLocaleValue(page.pyLabel, '', localeReference)} />
244
246
  </ListItem>
245
247
  ))}
246
248
  </List>
@@ -278,7 +280,7 @@ export default function NavBar(props: NavBarProps) {
278
280
  <ListItemIcon>
279
281
  <ArrowBackIcon fontSize='large' />
280
282
  </ListItemIcon>
281
- <Typography variant='inherit'>{localizedVal('Logout', localeCategory)}</Typography>
283
+ <Typography variant='inherit'>{localizedVal('Log off', localeCategory)}</Typography>
282
284
  </MenuItem>
283
285
  </Menu>
284
286
  </>
@@ -17,7 +17,8 @@ export default function CaseSummary(props: PropsWithChildren<CaseSummaryProps>)
17
17
  // const { status, showStatus } = theConfigProps;
18
18
  const status = theConfigProps.status;
19
19
  const showStatus = theConfigProps.showStatus;
20
-
20
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
21
+ const localeCategory = 'ModalContainer';
21
22
  // from Constellation DX Components
22
23
  // get the primary and secondary fields with the raw data (which has the non-resolved property values)
23
24
  // const regionsRaw = getPConnect().getRawMetadata().children;
@@ -29,13 +30,54 @@ export default function CaseSummary(props: PropsWithChildren<CaseSummaryProps>)
29
30
  let arPrimaryFields: any[] = [];
30
31
  let arSecondaryFields: any[] = [];
31
32
 
33
+ /* eslint-disable @typescript-eslint/no-shadow */
34
+ function prepareComponentInCaseSummary(pConnectMeta, getPConnect) {
35
+ const { config, children } = pConnectMeta;
36
+ const pConnect = getPConnect();
37
+
38
+ const caseSummaryComponentObject: any = {};
39
+
40
+ const { type } = pConnectMeta;
41
+ const createdComponent = pConnect.createComponent({
42
+ type,
43
+ children: children ? [...children] : [],
44
+ config: {
45
+ ...config
46
+ }
47
+ });
48
+
49
+ caseSummaryComponentObject.value = createdComponent;
50
+ return caseSummaryComponentObject;
51
+ }
52
+
53
+ function prepareCaseSummaryData(summaryFieldChildren) {
54
+ const convertChildrenToSummaryData = kid => {
55
+ return kid?.map((childItem, index) => {
56
+ const childMeta = childItem.getPConnect().meta;
57
+ const caseSummaryComponentObject = prepareComponentInCaseSummary(childMeta, childItem.getPConnect);
58
+ caseSummaryComponentObject.id = index + 1;
59
+ return caseSummaryComponentObject;
60
+ });
61
+ };
62
+ return summaryFieldChildren ? convertChildrenToSummaryData(summaryFieldChildren?.getChildren()) : undefined;
63
+ }
64
+
32
65
  for (const child of children as ReactElement[]) {
33
66
  const childPConn = (child as ReactElement).props.getPConnect();
34
67
  const childPConnData = childPConn.resolveConfigProps(childPConn.getRawMetadata());
35
68
  if (childPConnData.name.toLowerCase() === 'primary fields') {
36
69
  arPrimaryFields = childPConnData.children;
70
+ arPrimaryFields.forEach(field => {
71
+ if (field.config?.value && typeof field.config?.value === 'string') {
72
+ field.config.value = localizedVal(field.config.value, localeCategory);
73
+ }
74
+ });
37
75
  } else if (childPConnData.name.toLowerCase() === 'secondary fields') {
76
+ const secondarySummaryFields = prepareCaseSummaryData(childPConn);
38
77
  arSecondaryFields = childPConnData.children;
78
+ arSecondaryFields.forEach((field, index) => {
79
+ field.config.displayLabel = secondarySummaryFields[index]?.value?.props?.label;
80
+ });
39
81
  }
40
82
  }
41
83
 
@@ -178,7 +178,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
178
178
  const actionsAPI = thePConn.getActionsApi();
179
179
  const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
180
180
 
181
- openLocalAction(editAction.ID, { ...editAction });
181
+ openLocalAction(editAction.ID, { ...editAction, containerName: 'modal', type: 'express' });
182
182
  }
183
183
 
184
184
  function getActionButtonsHtml(): any {