@pega/dx-component-builder-sdk 0.23.16 → 0.23.18

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 (154) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +3 -2
  3. package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.tsx.mustache +8 -1
  4. package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +3 -9
  5. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +7 -15
  6. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +38 -37
  7. package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +3 -3
  8. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +5 -3
  9. package/src/tasks/map/map.js +29 -8
  10. package/src/tasks/publish/index.js +3 -1
  11. package/src/tasks/publish-all/index.js +7 -5
  12. package/tests/assets/sdk-r/components/create/override-sdk/designSystemExtension/Operator/Operator.tsx +5 -3
  13. package/tests/assets/sdk-r/components/create/override-sdk/field/CancelAlert/CancelAlert.tsx +95 -78
  14. package/tests/assets/sdk-r/components/create/override-sdk/field/Checkbox/Checkbox.tsx +3 -1
  15. package/tests/assets/sdk-r/components/create/override-sdk/field/Currency/Currency.tsx +7 -15
  16. package/tests/assets/sdk-r/components/create/override-sdk/field/DateTime/config-ext.json +8 -8
  17. package/tests/assets/sdk-r/components/create/override-sdk/field/Decimal/Decimal.tsx +3 -9
  18. package/tests/assets/sdk-r/components/create/override-sdk/field/Decimal/config-ext.json +8 -8
  19. package/tests/assets/sdk-r/components/create/override-sdk/field/Dropdown/config-ext.json +8 -8
  20. package/tests/assets/sdk-r/components/create/override-sdk/field/Email/config-ext.json +8 -8
  21. package/tests/assets/sdk-r/components/create/override-sdk/field/Group/Group.tsx +2 -0
  22. package/tests/assets/sdk-r/components/create/override-sdk/field/Group/config-ext.json +7 -7
  23. package/tests/assets/sdk-r/components/create/override-sdk/field/Integer/config-ext.json +8 -8
  24. package/tests/assets/sdk-r/components/create/override-sdk/field/Percentage/Percentage.tsx +38 -36
  25. package/tests/assets/sdk-r/components/create/override-sdk/field/Percentage/config-ext.json +8 -8
  26. package/tests/assets/sdk-r/components/create/override-sdk/field/RadioButtons/config-ext.json +8 -8
  27. package/tests/assets/sdk-r/components/create/override-sdk/field/SemanticLink/config-ext.json +8 -8
  28. package/tests/assets/sdk-r/components/create/override-sdk/field/TextArea/config-ext.json +8 -8
  29. package/tests/assets/sdk-r/components/create/override-sdk/field/TextContent/config-ext.json +8 -8
  30. package/tests/assets/sdk-r/components/create/override-sdk/field/TextInput/config-ext.json +8 -8
  31. package/tests/assets/sdk-r/components/create/override-sdk/field/Time/config-ext.json +8 -8
  32. package/tests/assets/sdk-r/components/create/override-sdk/field/URL/config-ext.json +8 -8
  33. package/tests/assets/sdk-r/components/create/override-sdk/field/UserReference/config-ext.json +8 -8
  34. package/tests/assets/sdk-r/components/create/override-sdk/infra/Assignment/Assignment.tsx +21 -7
  35. package/tests/assets/sdk-r/components/create/override-sdk/infra/NavBar/NavBar.tsx +5 -3
  36. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseSummary/CaseSummary.tsx +43 -1
  37. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseSummary/config-ext.json +8 -8
  38. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseView/CaseView.tsx +1 -1
  39. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseView/config-ext.json +8 -8
  40. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +34 -1
  41. package/tests/assets/sdk-r/components/create/override-sdk/template/Confirmation/config-ext.json +11 -11
  42. package/tests/assets/sdk-r/components/create/override-sdk/template/DataReference/config-ext.json +9 -9
  43. package/tests/assets/sdk-r/components/create/override-sdk/template/DefaultForm/config-ext.json +8 -8
  44. package/tests/assets/sdk-r/components/create/override-sdk/template/DetailsSubTabs/config-ext.json +8 -8
  45. package/tests/assets/sdk-r/components/create/override-sdk/template/DetailsThreeColumn/config-ext.json +8 -8
  46. package/tests/assets/sdk-r/components/create/override-sdk/template/DetailsTwoColumn/config-ext.json +8 -8
  47. package/tests/assets/sdk-r/components/create/override-sdk/template/ListPage/config-ext.json +7 -7
  48. package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/config-ext.json +8 -8
  49. package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/utils.ts +3 -1
  50. package/tests/assets/sdk-r/components/create/override-sdk/template/NarrowWideDetails/config-ext.json +8 -8
  51. package/tests/assets/sdk-r/components/create/override-sdk/template/NarrowWideForm/config-ext.json +8 -8
  52. package/tests/assets/sdk-r/components/create/override-sdk/template/NarrowWidePage/config-ext.json +8 -8
  53. package/tests/assets/sdk-r/components/create/override-sdk/template/OneColumn/config-ext.json +8 -8
  54. package/tests/assets/sdk-r/components/create/override-sdk/template/OneColumnPage/config-ext.json +8 -8
  55. package/tests/assets/sdk-r/components/create/override-sdk/template/OneColumnTab/config-ext.json +8 -8
  56. package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTable/config-ext.json +8 -8
  57. package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +28 -12
  58. package/tests/assets/sdk-r/components/create/override-sdk/template/SubTabs/config-ext.json +8 -8
  59. package/tests/assets/sdk-r/components/create/override-sdk/template/TwoColumn/config-ext.json +8 -8
  60. package/tests/assets/sdk-r/components/create/override-sdk/template/TwoColumnPage/config-ext.json +8 -8
  61. package/tests/assets/sdk-r/components/create/override-sdk/template/TwoColumnTab/config-ext.json +8 -8
  62. package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrow/WideNarrow.tsx +1 -1
  63. package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrowDetails/config-ext.json +8 -8
  64. package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrowForm/config-ext.json +8 -8
  65. package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrowPage/config-ext.json +8 -8
  66. package/tests/assets/sdk-r/components/create/override-sdk/template/WssNavBar/WssNavBar.tsx +4 -1
  67. package/tests/assets/sdk-r/components/create/override-sdk/widget/AppAnnouncement/config-ext.json +8 -8
  68. package/tests/assets/sdk-r/components/create/override-sdk/widget/Attachment/Attachment.tsx +17 -3
  69. package/tests/assets/sdk-r/components/create/override-sdk/widget/CaseHistory/config-ext.json +8 -8
  70. package/tests/assets/sdk-r/components/create/override-sdk/widget/FileUtility/config-ext.json +8 -8
  71. package/tests/assets/sdk-r/components/create/override-sdk/widget/Followers/config-ext.json +8 -8
  72. package/tests/assets/sdk-r/components/create/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
  73. package/tests/assets/sdk-r/components/create/override-sdk/widget/ToDo/config-ext.json +8 -8
  74. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyBoolean/index.tsx +3 -2
  75. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/index.tsx +7 -15
  76. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/demo.stories.tsx +8 -1
  77. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDecimal/index.tsx +3 -9
  78. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/index.tsx +38 -37
  79. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyCaseWidget/index.tsx +3 -3
  80. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageCaseWidget/index.tsx +5 -3
  81. package/tests/assets/sdk-r/components/createAll/override-sdk/designSystemExtension/Operator/Operator.tsx +5 -3
  82. package/tests/assets/sdk-r/components/createAll/override-sdk/field/CancelAlert/CancelAlert.tsx +95 -78
  83. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Checkbox/Checkbox.tsx +3 -1
  84. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Currency/Currency.tsx +7 -15
  85. package/tests/assets/sdk-r/components/createAll/override-sdk/field/DateTime/config-ext.json +8 -8
  86. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Decimal/Decimal.tsx +3 -9
  87. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Decimal/config-ext.json +8 -8
  88. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Dropdown/config-ext.json +8 -8
  89. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Email/config-ext.json +8 -8
  90. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/Group.tsx +2 -0
  91. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/config-ext.json +7 -7
  92. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Integer/config-ext.json +8 -8
  93. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Percentage/Percentage.tsx +38 -36
  94. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Percentage/config-ext.json +8 -8
  95. package/tests/assets/sdk-r/components/createAll/override-sdk/field/RadioButtons/config-ext.json +8 -8
  96. package/tests/assets/sdk-r/components/createAll/override-sdk/field/SemanticLink/config-ext.json +8 -8
  97. package/tests/assets/sdk-r/components/createAll/override-sdk/field/TextArea/config-ext.json +8 -8
  98. package/tests/assets/sdk-r/components/createAll/override-sdk/field/TextContent/config-ext.json +8 -8
  99. package/tests/assets/sdk-r/components/createAll/override-sdk/field/TextInput/config-ext.json +8 -8
  100. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Time/config-ext.json +8 -8
  101. package/tests/assets/sdk-r/components/createAll/override-sdk/field/URL/config-ext.json +8 -8
  102. package/tests/assets/sdk-r/components/createAll/override-sdk/field/UserReference/config-ext.json +8 -8
  103. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Assignment/Assignment.tsx +21 -7
  104. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/NavBar/NavBar.tsx +5 -3
  105. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseSummary/CaseSummary.tsx +43 -1
  106. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseSummary/config-ext.json +8 -8
  107. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseView/CaseView.tsx +1 -1
  108. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseView/config-ext.json +8 -8
  109. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +34 -1
  110. package/tests/assets/sdk-r/components/createAll/override-sdk/template/Confirmation/config-ext.json +11 -11
  111. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DataReference/config-ext.json +9 -9
  112. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DefaultForm/config-ext.json +8 -8
  113. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DetailsSubTabs/config-ext.json +8 -8
  114. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DetailsThreeColumn/config-ext.json +8 -8
  115. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DetailsTwoColumn/config-ext.json +8 -8
  116. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListPage/config-ext.json +7 -7
  117. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/config-ext.json +8 -8
  118. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/utils.ts +3 -1
  119. package/tests/assets/sdk-r/components/createAll/override-sdk/template/NarrowWideDetails/config-ext.json +8 -8
  120. package/tests/assets/sdk-r/components/createAll/override-sdk/template/NarrowWideForm/config-ext.json +8 -8
  121. package/tests/assets/sdk-r/components/createAll/override-sdk/template/NarrowWidePage/config-ext.json +8 -8
  122. package/tests/assets/sdk-r/components/createAll/override-sdk/template/OneColumn/config-ext.json +8 -8
  123. package/tests/assets/sdk-r/components/createAll/override-sdk/template/OneColumnPage/config-ext.json +8 -8
  124. package/tests/assets/sdk-r/components/createAll/override-sdk/template/OneColumnTab/config-ext.json +8 -8
  125. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTable/config-ext.json +8 -8
  126. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +28 -12
  127. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SubTabs/config-ext.json +8 -8
  128. package/tests/assets/sdk-r/components/createAll/override-sdk/template/TwoColumn/config-ext.json +8 -8
  129. package/tests/assets/sdk-r/components/createAll/override-sdk/template/TwoColumnPage/config-ext.json +8 -8
  130. package/tests/assets/sdk-r/components/createAll/override-sdk/template/TwoColumnTab/config-ext.json +8 -8
  131. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrow/WideNarrow.tsx +1 -1
  132. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrowDetails/config-ext.json +8 -8
  133. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrowForm/config-ext.json +8 -8
  134. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrowPage/config-ext.json +8 -8
  135. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WssNavBar/WssNavBar.tsx +4 -1
  136. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/AppAnnouncement/config-ext.json +8 -8
  137. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/Attachment/Attachment.tsx +17 -3
  138. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/CaseHistory/config-ext.json +8 -8
  139. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/FileUtility/config-ext.json +8 -8
  140. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/Followers/config-ext.json +8 -8
  141. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
  142. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/ToDo/config-ext.json +8 -8
  143. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/PConnProps.d.ts +0 -46
  144. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/demo.stories.tsx +0 -54
  145. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/index.tsx +0 -73
  146. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/mock.ts +0 -15
  147. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/styles.ts +0 -15
  148. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/config.json +0 -83
  149. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/demo.stories.tsx +0 -59
  150. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/index.tsx +0 -101
  151. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/mock.ts +0 -16
  152. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/styles.js +0 -7
  153. /package/src/tasks/create/templates/Constellation/field/Boolean/{demo.stories.jsx.mustache → demo.stories.tsx.mustache} +0 -0
  154. /package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/{demo.stories.jsx → demo.stories.tsx} +0 -0
@@ -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,11 +1,9 @@
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
9
  // Using control from: https://github.com/unicef/material-ui-currency-textfield
@@ -48,17 +46,11 @@ export default function Currency(props: CurrrencyProps) {
48
46
  'data-test-id': testId
49
47
  };
50
48
 
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]);
49
+ // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
50
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
51
+ const theCurrSym = theSymbols.theCurrencySymbol;
52
+ const theCurrDec = theSymbols.theDecimalIndicator;
53
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
62
54
 
63
55
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
64
56
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "DateTime",
3
- "name": "DateTime",
4
- "label": "Date & time",
5
- "description": "Date & time",
6
- "type": "Field",
7
- "subtype": "DateTime",
8
- "properties": []
9
- }
2
+ "componentKey": "DateTime",
3
+ "name": "DateTime",
4
+ "label": "Date & time",
5
+ "description": "Date & time",
6
+ "type": "Field",
7
+ "subtype": "DateTime",
8
+ "properties": []
9
+ }
@@ -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';
@@ -45,14 +44,9 @@ export default function Decimal(props: DecimalProps) {
45
44
  const propName = (pConn.getStateProps() as any).value;
46
45
  const helperTextToDisplay = validatemessage || helperText;
47
46
 
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]);
47
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
48
+ const theCurrDec = theSymbols.theDecimalIndicator;
49
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
56
50
 
57
51
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
58
52
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "Decimal",
3
- "name": "Decimal",
4
- "label": "Decimal",
5
- "description": "Decimal",
6
- "type": "Field",
7
- "subtype": "Decimal",
8
- "properties": []
9
- }
2
+ "componentKey": "Decimal",
3
+ "name": "Decimal",
4
+ "label": "Decimal",
5
+ "description": "Decimal",
6
+ "type": "Field",
7
+ "subtype": "Decimal",
8
+ "properties": []
9
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "Dropdown",
3
- "name": "Dropdown",
4
- "label": "Dropdown",
5
- "description": "Picklist",
6
- "type": "Field",
7
- "subtype": "Picklist",
8
- "properties": []
9
- }
2
+ "componentKey": "Dropdown",
3
+ "name": "Dropdown",
4
+ "label": "Dropdown",
5
+ "description": "Picklist",
6
+ "type": "Field",
7
+ "subtype": "Picklist",
8
+ "properties": []
9
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "Email",
3
- "name": "Email",
4
- "label": "Email",
5
- "description": "Email",
6
- "type": "Field",
7
- "subtype": "Text-Email",
8
- "properties": []
9
- }
2
+ "componentKey": "Email",
3
+ "name": "Email",
4
+ "label": "Email",
5
+ "description": "Email",
6
+ "type": "Field",
7
+ "subtype": "Text-Email",
8
+ "properties": []
9
+ }
@@ -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,8 +1,8 @@
1
1
  {
2
- "componentKey": "Group",
3
- "name": "Group",
4
- "label": "Field Group",
5
- "description": "Field Group",
6
- "type": "Group",
7
- "properties": []
8
- }
2
+ "componentKey": "Group",
3
+ "name": "Group",
4
+ "label": "Field Group",
5
+ "description": "Field Group",
6
+ "type": "Group",
7
+ "properties": []
8
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "Integer",
3
- "name": "Integer",
4
- "label": "Integer",
5
- "description": "Integer",
6
- "type": "Field",
7
- "subtype": "Integer",
8
- "properties": []
9
- }
2
+ "componentKey": "Integer",
3
+ "name": "Integer",
4
+ "label": "Integer",
5
+ "description": "Integer",
6
+ "type": "Field",
7
+ "subtype": "Integer",
8
+ "properties": []
9
+ }
@@ -1,67 +1,55 @@
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';
6
-
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
- }));
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';
23
8
 
24
9
  interface PercentageProps extends PConnFieldProps {
25
10
  // If any, enter additional props that only exist on Percentage here
11
+ currencyISOCode?: string;
26
12
  }
27
13
 
28
14
  export default function Percentage(props: PercentageProps) {
29
15
  // Get emitted components from map (so we can get any override that may exist)
30
- const TextInput = getComponentFromMap('TextInput');
31
16
  const FieldValueList = getComponentFromMap('FieldValueList');
32
17
 
33
- const classes = useStyles();
34
-
35
18
  const {
19
+ getPConnect,
36
20
  label,
37
21
  required,
38
22
  disabled,
39
23
  value = '',
40
24
  validatemessage,
41
25
  status,
42
- onChange,
43
- onBlur,
26
+ // onChange,
27
+ // onBlur,
44
28
  readOnly,
29
+ currencyISOCode = 'USD',
45
30
  testId,
46
31
  helperText,
47
32
  displayMode,
48
33
  hideLabel,
49
34
  placeholder
50
35
  } = props;
36
+
37
+ const pConn = getPConnect();
38
+ const actions = pConn.getActionsApi();
39
+ const propName = (pConn.getStateProps() as any).value;
51
40
  const helperTextToDisplay = validatemessage || helperText;
52
41
 
42
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
43
+ const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
44
+
53
45
  // console.log(`Percentage: label: ${label} value: ${value}`);
54
46
 
55
47
  if (displayMode === 'LABELS_LEFT') {
56
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
48
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
57
49
  }
58
50
 
59
51
  if (displayMode === 'STACKED_LARGE_VAL') {
60
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
61
- }
62
-
63
- if (readOnly) {
64
- return <TextInput {...props} />;
52
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
65
53
  }
66
54
 
67
55
  let testProp = {};
@@ -70,9 +58,16 @@ export default function Percentage(props: PercentageProps) {
70
58
  'data-test-id': testId
71
59
  };
72
60
 
61
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
62
+ const theCurrDec = theSymbols.theDecimalIndicator;
63
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
64
+
65
+ function PercentageOnBlur(event, inValue) {
66
+ handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
67
+ }
68
+
73
69
  return (
74
- <TextField
75
- className={classes.input}
70
+ <CurrencyTextField
76
71
  fullWidth
77
72
  variant={readOnly ? 'standard' : 'outlined'}
78
73
  helperText={helperTextToDisplay}
@@ -80,13 +75,20 @@ export default function Percentage(props: PercentageProps) {
80
75
  size='small'
81
76
  required={required}
82
77
  disabled={disabled}
83
- onChange={onChange}
84
- onBlur={!readOnly ? onBlur : undefined}
78
+ readOnly={!!readOnly}
85
79
  error={status === 'error'}
86
80
  label={label}
87
81
  value={value}
88
- type='number'
89
- inputProps={{ ...testProp }}
82
+ type='text'
83
+ outputFormat='number'
84
+ textAlign='left'
85
+ InputProps={{
86
+ inputProps: { ...testProp }
87
+ }}
88
+ currencySymbol=''
89
+ decimalCharacter={theCurrDec}
90
+ digitGroupSeparator={theCurrSep}
91
+ onBlur={!readOnly ? PercentageOnBlur : undefined}
90
92
  />
91
93
  );
92
94
  }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "Percentage",
3
- "name": "Percentage",
4
- "label": "Percentage",
5
- "description": "Percentage",
6
- "type": "Field",
7
- "subtype": "Decimal-Percentage",
8
- "properties": []
9
- }
2
+ "componentKey": "Percentage",
3
+ "name": "Percentage",
4
+ "label": "Percentage",
5
+ "description": "Percentage",
6
+ "type": "Field",
7
+ "subtype": "Decimal-Percentage",
8
+ "properties": []
9
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "RadioButtons",
3
- "name": "RadioButtons",
4
- "label": "Radio buttons",
5
- "description": "Picklist",
6
- "type": "Field",
7
- "subtype": "Picklist",
8
- "properties": []
9
- }
2
+ "componentKey": "RadioButtons",
3
+ "name": "RadioButtons",
4
+ "label": "Radio buttons",
5
+ "description": "Picklist",
6
+ "type": "Field",
7
+ "subtype": "Picklist",
8
+ "properties": []
9
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "label": "SemanticLink",
3
- "componentKey": "SemanticLink",
4
- "name": "SemanticLink",
5
- "description": "SemanticLink",
6
- "type": "Field",
7
- "subtype": "ACTION",
8
- "properties": []
9
- }
2
+ "label": "SemanticLink",
3
+ "componentKey": "SemanticLink",
4
+ "name": "SemanticLink",
5
+ "description": "SemanticLink",
6
+ "type": "Field",
7
+ "subtype": "ACTION",
8
+ "properties": []
9
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "TextArea",
3
- "name": "TextArea",
4
- "label": "Text area",
5
- "description": "Text (paragraph)",
6
- "type": "Field",
7
- "subtype": "Text-Paragraph",
8
- "properties": []
9
- }
2
+ "componentKey": "TextArea",
3
+ "name": "TextArea",
4
+ "label": "Text area",
5
+ "description": "Text (paragraph)",
6
+ "type": "Field",
7
+ "subtype": "Text-Paragraph",
8
+ "properties": []
9
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "label": "TextContent",
3
- "componentKey": "TextContent",
4
- "name": "TextContent",
5
- "description": "Text",
6
- "type": "Field",
7
- "subtype": "DATA_CAPTURE",
8
- "properties": []
9
- }
2
+ "label": "TextContent",
3
+ "componentKey": "TextContent",
4
+ "name": "TextContent",
5
+ "description": "Text",
6
+ "type": "Field",
7
+ "subtype": "DATA_CAPTURE",
8
+ "properties": []
9
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "TextInput",
3
- "name": "TextInput",
4
- "label": "Text input",
5
- "description": "Text (single line)",
6
- "type": "Field",
7
- "subtype": "Text",
8
- "properties": []
9
- }
2
+ "componentKey": "TextInput",
3
+ "name": "TextInput",
4
+ "label": "Text input",
5
+ "description": "Text (single line)",
6
+ "type": "Field",
7
+ "subtype": "Text",
8
+ "properties": []
9
+ }