@pega/react-sdk-overrides 0.23.26 → 0.23.27

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 (238) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +17 -0
  3. package/SECURITY.md +10 -0
  4. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +39 -0
  5. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  6. package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  8. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  9. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  10. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  11. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  12. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
  13. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  14. package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
  15. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  16. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  17. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  18. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  19. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  20. package/lib/field/AutoComplete/config-ext.json +2 -3
  21. package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
  22. package/lib/field/CancelAlert/index.tsx +1 -1
  23. package/lib/field/Checkbox/Checkbox.tsx +29 -19
  24. package/lib/field/Checkbox/config-ext.json +2 -3
  25. package/lib/field/Currency/Currency.tsx +27 -38
  26. package/lib/field/Currency/config-ext.json +2 -3
  27. package/lib/field/Currency/currency-utils.ts +10 -18
  28. package/lib/field/Date/Date.tsx +33 -15
  29. package/lib/field/Date/config-ext.json +2 -3
  30. package/lib/field/DateTime/DateTime.tsx +22 -11
  31. package/lib/field/DateTime/config-ext.json +1 -2
  32. package/lib/field/Decimal/Decimal.tsx +64 -17
  33. package/lib/field/Decimal/config-ext.json +1 -2
  34. package/lib/field/Decimal/index.tsx +1 -1
  35. package/lib/field/Dropdown/Dropdown.tsx +154 -18
  36. package/lib/field/Dropdown/config-ext.json +1 -2
  37. package/lib/field/Email/Email.tsx +16 -7
  38. package/lib/field/Email/config-ext.json +1 -2
  39. package/lib/field/Email/index.tsx +1 -1
  40. package/lib/field/Group/Group.tsx +37 -0
  41. package/lib/field/Group/config-ext.json +7 -0
  42. package/lib/field/Group/index.tsx +1 -0
  43. package/lib/field/Integer/Integer.tsx +15 -6
  44. package/lib/field/Integer/config-ext.json +1 -2
  45. package/lib/field/Percentage/Percentage.tsx +14 -6
  46. package/lib/field/Percentage/config-ext.json +1 -2
  47. package/lib/field/Phone/Phone.tsx +17 -7
  48. package/lib/field/Phone/index.tsx +1 -1
  49. package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
  50. package/lib/field/RadioButtons/config-ext.json +1 -2
  51. package/lib/field/RichText/RichText.tsx +96 -0
  52. package/lib/field/RichText/index.tsx +1 -0
  53. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  54. package/lib/field/ScalarList/config-ext.json +7 -0
  55. package/lib/field/ScalarList/index.tsx +1 -0
  56. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  57. package/lib/field/SemanticLink/config-ext.json +1 -2
  58. package/lib/field/SemanticLink/utils.ts +8 -10
  59. package/lib/field/TextArea/TextArea.tsx +15 -5
  60. package/lib/field/TextArea/config-ext.json +1 -2
  61. package/lib/field/TextContent/TextContent.tsx +9 -2
  62. package/lib/field/TextContent/config-ext.json +1 -2
  63. package/lib/field/TextInput/TextInput.tsx +41 -10
  64. package/lib/field/TextInput/config-ext.json +1 -2
  65. package/lib/field/TextInput/index.tsx +1 -1
  66. package/lib/field/Time/Time.tsx +21 -18
  67. package/lib/field/Time/config-ext.json +1 -2
  68. package/lib/field/URL/URL.tsx +23 -6
  69. package/lib/field/URL/config-ext.json +1 -2
  70. package/lib/field/URL/index.tsx +1 -1
  71. package/lib/field/UserReference/UserReference.tsx +52 -58
  72. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  73. package/lib/field/UserReference/config-ext.json +1 -2
  74. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
  75. package/lib/helpers/case-utils.tsx +99 -0
  76. package/lib/helpers/common-utils.ts +8 -0
  77. package/lib/helpers/data_page.ts +3 -6
  78. package/lib/helpers/date-format-utils.ts +29 -19
  79. package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
  80. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
  81. package/lib/helpers/formatters/Boolean.ts +21 -0
  82. package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
  83. package/lib/helpers/formatters/CurrencyMap.ts +915 -0
  84. package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
  85. package/lib/helpers/formatters/{common.js → common.ts} +3 -4
  86. package/lib/helpers/formatters/{index.js → index.ts} +22 -22
  87. package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
  88. package/lib/helpers/simpleTableHelpers.ts +65 -85
  89. package/lib/helpers/state-utils.tsx +43 -0
  90. package/lib/helpers/template-utils.ts +4 -8
  91. package/lib/helpers/utils.ts +16 -8
  92. package/lib/helpers/versionHelpers.ts +1 -5
  93. package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
  94. package/lib/infra/ActionButtons/index.tsx +1 -1
  95. package/lib/infra/Assignment/Assignment.tsx +99 -84
  96. package/lib/infra/Assignment/index.tsx +1 -1
  97. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  98. package/lib/infra/AssignmentCard/index.tsx +1 -1
  99. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
  100. package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
  101. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
  103. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  104. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
  105. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  106. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  107. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  108. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  109. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
  110. package/lib/infra/Containers/helpers.ts +6 -0
  111. package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
  112. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
  113. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
  114. package/lib/infra/DeferLoad/index.tsx +1 -1
  115. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
  116. package/lib/infra/MultiStep/MultiStep.css +11 -15
  117. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  118. package/lib/infra/MultiStep/index.tsx +1 -1
  119. package/lib/infra/NavBar/NavBar.css +103 -105
  120. package/lib/infra/NavBar/NavBar.tsx +28 -43
  121. package/lib/infra/Reference/Reference.tsx +16 -22
  122. package/lib/infra/Region/Region.tsx +9 -9
  123. package/lib/infra/RootContainer/RootContainer.tsx +82 -125
  124. package/lib/infra/RootContainer/index.tsx +1 -1
  125. package/lib/infra/Stages/Stages.tsx +38 -39
  126. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  127. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  128. package/lib/infra/View/View.tsx +32 -63
  129. package/lib/template/AppShell/AppShell.css +22 -23
  130. package/lib/template/AppShell/AppShell.tsx +51 -69
  131. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  132. package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
  133. package/lib/template/CaseSummary/config-ext.json +1 -2
  134. package/lib/template/CaseView/CaseView.tsx +122 -114
  135. package/lib/template/CaseView/config-ext.json +1 -2
  136. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
  137. package/lib/template/Confirmation/Confirmation.tsx +25 -53
  138. package/lib/template/Confirmation/config-ext.json +1 -2
  139. package/lib/template/DataReference/DataReference.tsx +112 -140
  140. package/lib/template/DataReference/config-ext.json +1 -2
  141. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  142. package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
  143. package/lib/template/DefaultForm/config-ext.json +1 -2
  144. package/lib/template/DefaultForm/utils/index.ts +33 -0
  145. package/lib/template/Details/Details/Details.tsx +24 -28
  146. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  147. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  148. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  149. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  151. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  152. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  153. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  154. package/lib/template/Details/DynamicTabs/config.json +36 -0
  155. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  156. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
  157. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  158. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  159. package/lib/template/ListPage/ListPage.tsx +12 -16
  160. package/lib/template/ListPage/config-ext.json +1 -2
  161. package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
  162. package/lib/template/ListView/ListView.tsx +245 -306
  163. package/lib/template/ListView/config-ext.json +1 -2
  164. package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
  165. package/lib/template/ListView/{utils.js → utils.ts} +202 -91
  166. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
  167. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  168. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  169. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  170. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  171. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  172. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  173. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  174. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  175. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  176. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  177. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  179. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  180. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  181. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  182. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  183. package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
  184. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
  185. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  186. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
  187. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
  188. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  189. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  190. package/lib/template/SubTabs/config-ext.json +1 -2
  191. package/lib/template/SubTabs/tabUtils.ts +2 -7
  192. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  193. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  194. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  195. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  196. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  197. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  198. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  199. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  200. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  201. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  202. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  203. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  204. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  205. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  206. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  207. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  208. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  209. package/lib/template/WssNavBar/WssNavBar.tsx +20 -9
  210. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  211. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  212. package/lib/widget/Attachment/Attachment.css +75 -4
  213. package/lib/widget/Attachment/Attachment.tsx +370 -388
  214. package/lib/widget/Attachment/index.tsx +1 -1
  215. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  216. package/lib/widget/CaseHistory/config-ext.json +1 -2
  217. package/lib/widget/CaseHistory/index.tsx +1 -1
  218. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  219. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  220. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
  221. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  222. package/lib/widget/Followers/Followers.tsx +27 -25
  223. package/lib/widget/Followers/config-ext.json +1 -2
  224. package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
  225. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  226. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
  227. package/lib/widget/SummaryItem/index.tsx +1 -1
  228. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  229. package/lib/widget/ToDo/ToDo.css +4 -4
  230. package/lib/widget/ToDo/ToDo.tsx +80 -116
  231. package/lib/widget/ToDo/config-ext.json +1 -2
  232. package/package.json +5 -2
  233. package/lib/helpers/auth.js +0 -483
  234. package/lib/helpers/authManager.js +0 -631
  235. package/lib/helpers/config_access.js +0 -268
  236. package/lib/helpers/formatters/Boolean.js +0 -38
  237. package/lib/helpers/formatters/CurrencyMap.js +0 -908
  238. package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
@@ -1,12 +1,13 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { TextField } from '@material-ui/core';
3
3
  import Autocomplete from '@material-ui/lab/Autocomplete';
4
- import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
5
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
6
4
  import isDeepEqual from 'fast-deep-equal/react';
5
+
6
+ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
7
7
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
8
8
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
9
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
9
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
10
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
11
 
11
12
  interface IOption {
12
13
  key: string;
@@ -36,7 +37,25 @@ const getDisplayFieldsMetaData = columnList => {
36
37
  return metaDataObj;
37
38
  };
38
39
 
39
- export default function AutoComplete(props) {
40
+ interface AutoCompleteProps extends PConnFieldProps {
41
+ // If any, enter additional props that only exist on AutoComplete here'
42
+ displayMode?: string;
43
+ deferDatasource?: boolean;
44
+ datasourceMetadata?: any;
45
+ status?: string;
46
+ onRecordChange?: any;
47
+ additionalProps?: object;
48
+ listType: string;
49
+ parameters?: any;
50
+ datasource: any;
51
+ columns: any[];
52
+ }
53
+
54
+ export default function AutoComplete(props: AutoCompleteProps) {
55
+ // Get emitted components from map (so we can get any override that may exist)
56
+ const TextInput = getComponentFromMap('TextInput');
57
+ const FieldValueList = getComponentFromMap('FieldValueList');
58
+
40
59
  const {
41
60
  getPConnect,
42
61
  label,
@@ -54,17 +73,18 @@ export default function AutoComplete(props) {
54
73
  hideLabel,
55
74
  onRecordChange
56
75
  } = props;
76
+
57
77
  const context = getPConnect().getContextName();
58
78
  let { listType, parameters, datasource = [], columns = [] } = props;
59
79
  const [inputValue, setInputValue] = useState('');
60
- const [options, setOptions] = useState<Array<IOption>>([]);
80
+ const [options, setOptions] = useState<IOption[]>([]);
61
81
  const [theDatasource, setDatasource] = useState(null);
62
82
  let selectedValue: any = '';
63
83
  const helperTextToDisplay = validatemessage || helperText;
64
84
 
65
85
  const thePConn = getPConnect();
66
86
  const actionsApi = thePConn.getActionsApi();
67
- const propName = thePConn.getStateProps().value;
87
+ const propName = (thePConn.getStateProps() as any).value;
68
88
 
69
89
  if (!isDeepEqual(datasource, theDatasource)) {
70
90
  // inbound datasource is different, so update theDatasource (to trigger useEffect)
@@ -86,13 +106,10 @@ export default function AutoComplete(props) {
86
106
  if (deferDatasource && datasourceMetadata?.datasource?.name) {
87
107
  listType = 'datapage';
88
108
  datasource = datasourceMetadata.datasource.name;
89
- parameters = flattenParameters(datasourceMetadata?.datasource?.parameters);
90
- const displayProp = datasourceMetadata.datasource.propertyForDisplayText.startsWith('@P')
91
- ? datasourceMetadata.datasource.propertyForDisplayText.substring(3)
92
- : datasourceMetadata.datasource.propertyForDisplayText;
93
- const valueProp = datasourceMetadata.datasource.propertyForValue.startsWith('@P')
94
- ? datasourceMetadata.datasource.propertyForValue.substring(3)
95
- : datasourceMetadata.datasource.propertyForValue;
109
+ const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;
110
+ parameters = flattenParameters(dataSourceParameters);
111
+ const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;
112
+ const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;
96
113
  columns = [
97
114
  {
98
115
  key: 'true',
@@ -111,14 +128,14 @@ export default function AutoComplete(props) {
111
128
 
112
129
  useEffect(() => {
113
130
  if (listType === 'associated') {
114
- setOptions(Utils.getOptionList(props, getPConnect().getDataObject()));
131
+ setOptions(Utils.getOptionList(props, getPConnect().getDataObject('')));
115
132
  }
116
133
  }, [theDatasource]);
117
134
 
118
135
  useEffect(() => {
119
136
  if (!displayMode && listType !== 'associated') {
120
137
  getDataPage(datasource, parameters, context).then((results: any) => {
121
- const optionsData: Array<any> = [];
138
+ const optionsData: any[] = [];
122
139
  const displayColumn = getDisplayFieldsMetaData(columns);
123
140
  results?.forEach(element => {
124
141
  const val = element[displayColumn.primary]?.toString();
@@ -4,8 +4,7 @@
4
4
  "description": "Picklist",
5
5
  "type": "Field",
6
6
  "subtype": "Picklist",
7
- "componentKey" : "AutoComplete",
7
+ "componentKey": "AutoComplete",
8
8
  "icon": "",
9
- "properties": [
10
- ]
9
+ "properties": []
11
10
  }
@@ -2,11 +2,16 @@ import React, { useState } from 'react';
2
2
  import { Button, Grid, IconButton, Snackbar } from '@material-ui/core';
3
3
  import CloseIcon from '@material-ui/icons/Close';
4
4
 
5
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
6
  import './CancelAlert.css';
6
7
 
7
- declare const PCore;
8
+ interface CancelAlertProps extends PConnFieldProps {
9
+ // If any, enter additional props that only exist on CancelAlert here
10
+ pConn: any;
11
+ updateAlertState: any;
12
+ }
8
13
 
9
- const CancelAlert = props => {
14
+ export default function CancelAlert(props: CancelAlertProps) {
10
15
  const { pConn, updateAlertState } = props;
11
16
  const [showSnackbar, setShowSnackbar] = useState(false);
12
17
  const [snackbarMessage, setSnackbarMessage] = useState('');
@@ -15,6 +20,8 @@ const CancelAlert = props => {
15
20
  const caseInfo = pConn.getCaseInfo();
16
21
  const caseName = caseInfo.getName();
17
22
  const ID = caseInfo.getID();
23
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
24
+ const localeCategory = 'ModalContainer';
18
25
 
19
26
  function showToast(message: string) {
20
27
  setSnackbarMessage(message);
@@ -48,12 +55,11 @@ const CancelAlert = props => {
48
55
  .then(() => {
49
56
  dismissModal();
50
57
 
51
- PCore.getPubSubUtils().publish(
52
- PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED
53
- );
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);
54
60
  })
55
61
  .catch(() => {
56
- showToast('Save failed');
62
+ showToast(localizedVal('Save failed', localeCategory));
57
63
  });
58
64
  break;
59
65
 
@@ -68,10 +74,12 @@ const CancelAlert = props => {
68
74
  deletePromise
69
75
  .then(() => {
70
76
  dismissModal();
77
+
78
+ // @ts-ignore - second parameter “payload” for publish method should be optional
71
79
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
72
80
  })
73
81
  .catch(() => {
74
- showToast('Delete failed.');
82
+ showToast(localizedVal('Delete failed.', localeCategory));
75
83
  });
76
84
  break;
77
85
 
@@ -86,22 +94,22 @@ const CancelAlert = props => {
86
94
  <div className='cancel-alert-top'>
87
95
  <h3>{`Delete ${caseName}(${ID})`}</h3>
88
96
  <div>
89
- <p>{`Are you sure you want to delete ${caseName} (${ID})?`}</p>
90
- <p>Alternatively, you can continue working or save your work for later.</p>
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>
91
99
  </div>
92
100
  <div className='action-controls'>
93
101
  <Grid container spacing={4} justifyContent='space-between'>
94
102
  <Grid item>
95
103
  <Button variant='outlined' color='primary' onClick={() => buttonClick('save')}>
96
- Save for later
104
+ {localizedVal('Save for later', localeCategory)}
97
105
  </Button>
98
106
  </Grid>
99
107
  <Grid item>
100
108
  <Button variant='outlined' color='primary' onClick={() => buttonClick('continue')}>
101
- Continue Working
109
+ {localizedVal('Continue Working', localeCategory)}
102
110
  </Button>
103
111
  <Button variant='contained' color='primary' onClick={() => buttonClick('delete')}>
104
- Delete
112
+ {localizedVal('Delete', localeCategory)}
105
113
  </Button>
106
114
  </Grid>
107
115
  </Grid>
@@ -121,6 +129,4 @@ const CancelAlert = props => {
121
129
  />
122
130
  </>
123
131
  );
124
- };
125
-
126
- export default CancelAlert;
132
+ }
@@ -1 +1 @@
1
- export { default } from './CancelAlert';
1
+ export { default } from './CancelAlert';
@@ -1,35 +1,45 @@
1
- import React, { useState, useEffect } from 'react';
2
- import {
3
- Checkbox,
4
- FormControl,
5
- FormControlLabel,
6
- FormGroup,
7
- FormHelperText
8
- } from '@material-ui/core';
1
+ import { useState, useEffect } from 'react';
2
+ import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText } from '@material-ui/core';
3
+
9
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
10
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+
8
+ interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
9
+ // If any, enter additional props that only exist on Checkbox here
10
+ value?: boolean;
11
+ // eslint-disable-next-line react/no-unused-prop-types
12
+ caption?: string;
13
+ trueLabel?: string;
14
+ falseLabel?: string;
15
+ }
16
+
17
+ export default function CheckboxComponent(props: CheckboxProps) {
18
+ // Get emitted components from map (so we can get any override that may exist)
19
+ const FieldValueList = getComponentFromMap('FieldValueList');
11
20
 
12
- export default function CheckboxComponent(props) {
13
21
  const {
14
22
  getPConnect,
15
- label,
16
23
  value = false,
17
24
  readOnly,
18
25
  testId,
19
26
  required,
27
+ disabled,
20
28
  status,
21
29
  helperText,
22
30
  validatemessage,
23
31
  displayMode,
24
- hideLabel
32
+ hideLabel,
33
+ trueLabel,
34
+ falseLabel
25
35
  } = props;
26
36
  const helperTextToDisplay = validatemessage || helperText;
27
37
 
28
38
  const thePConn = getPConnect();
29
- const theConfigProps = thePConn.getConfigProps();
30
- const { caption } = theConfigProps;
39
+ const theConfigProps = thePConn.getConfigProps() as CheckboxProps;
40
+ const caption = theConfigProps.caption;
31
41
  const actionsApi = thePConn.getActionsApi();
32
- const propName = thePConn.getStateProps().value;
42
+ const propName = (thePConn.getStateProps() as any).value;
33
43
 
34
44
  const [checked, setChecked] = useState(false);
35
45
  useEffect(() => {
@@ -38,11 +48,11 @@ export default function CheckboxComponent(props) {
38
48
  }, [value]);
39
49
 
40
50
  if (displayMode === 'LABELS_LEFT') {
41
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
51
+ return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} />;
42
52
  }
43
53
 
44
54
  if (displayMode === 'STACKED_LARGE_VAL') {
45
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
55
+ return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} variant='stacked' />;
46
56
  }
47
57
 
48
58
  const handleChange = event => {
@@ -53,12 +63,12 @@ export default function CheckboxComponent(props) {
53
63
  thePConn.getValidationApi().validate(event.target.checked);
54
64
  };
55
65
 
56
- let theCheckbox = <Checkbox color='primary' />;
66
+ let theCheckbox = <Checkbox color='primary' disabled={disabled} />;
57
67
 
58
68
  if (readOnly) {
59
69
  // Workaround for lack of InputProps readOnly from https://github.com/mui-org/material-ui/issues/17043
60
70
  // Also note that we need to turn off the onChange call in the FormControlLabel wrapper, too. See below!
61
- theCheckbox = <Checkbox value={value || false} onChange={handleChange} readOnly={readOnly} />;
71
+ theCheckbox = <Checkbox value={value || false} readOnly={readOnly} />;
62
72
  }
63
73
 
64
74
  return (
@@ -4,7 +4,6 @@
4
4
  "description": "Boolean",
5
5
  "type": "Field",
6
6
  "subtype": "Boolean",
7
- "componentKey" : "Checkbox",
8
- "properties": [
9
- ]
7
+ "componentKey": "Checkbox",
8
+ "properties": []
10
9
  }
@@ -1,14 +1,24 @@
1
- import React, { useState, useEffect } from 'react';
2
- // import { TextField } from "@material-ui/core";
1
+ import { useState, useEffect } from 'react';
3
2
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
+
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
6
- import { format } from "@pega/react-sdk-components/lib/components/helpers/formatters";
5
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+
7
9
  import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
8
10
 
9
11
  // Using control from: https://github.com/unicef/material-ui-currency-textfield
10
12
 
11
- export default function Currency(props) {
13
+ interface CurrrencyProps extends PConnFieldProps {
14
+ // If any, enter additional props that only exist on Currency here
15
+ currencyISOCode?: string;
16
+ }
17
+
18
+ export default function Currency(props: CurrrencyProps) {
19
+ // Get emitted components from map (so we can get any override that may exist)
20
+ const FieldValueList = getComponentFromMap('FieldValueList');
21
+
12
22
  const {
13
23
  getPConnect,
14
24
  label,
@@ -23,32 +33,24 @@ export default function Currency(props) {
23
33
  helperText,
24
34
  displayMode,
25
35
  hideLabel,
26
- currencyISOCode = "USD"
36
+ currencyISOCode = 'USD',
37
+ placeholder
27
38
  } = props;
28
39
 
29
40
  const pConn = getPConnect();
30
41
  const actions = pConn.getActionsApi();
31
- const propName = pConn.getStateProps().value;
42
+ const propName = (pConn.getStateProps() as any).value;
32
43
  const helperTextToDisplay = validatemessage || helperText;
33
44
 
34
45
  // console.log(`Currency: label: ${label} value: ${value}`);
35
46
 
36
- let readOnlyProp = {}; // Note: empty if NOT ReadOnly
37
-
38
- if (readOnly) {
39
- readOnlyProp = { readOnly: true };
40
- }
41
-
42
- let testProp = {};
43
-
44
- testProp = {
47
+ const testProp = {
45
48
  'data-test-id': testId
46
49
  };
47
50
 
48
- const [currValue, setCurrValue] = useState();
49
- const [theCurrSym, setCurrSym] = useState("$");
50
- const [theCurrDec, setCurrDec] = useState(".");
51
- const [theCurrSep, setCurrSep] = useState(",");
51
+ const [theCurrSym, setCurrSym] = useState('$');
52
+ const [theCurrDec, setCurrDec] = useState('.');
53
+ const [theCurrSep, setCurrSep] = useState(',');
52
54
 
53
55
  useEffect(() => {
54
56
  // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
@@ -58,11 +60,6 @@ export default function Currency(props) {
58
60
  setCurrSep(theSymbols.theDigitGroupSeparator);
59
61
  }, [currencyISOCode]);
60
62
 
61
- useEffect(() => {
62
- // const testVal = value;
63
- setCurrValue(value.toString());
64
- }, [value]);
65
-
66
63
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
67
64
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
68
65
 
@@ -74,14 +71,6 @@ export default function Currency(props) {
74
71
  return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
75
72
  }
76
73
 
77
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
78
- function currOnChange(event, inValue) {
79
- // console.log(`Currency currOnChange inValue: ${inValue}`);
80
-
81
- // update internal value
82
- setCurrValue(event?.target?.value);
83
- }
84
-
85
74
  function currOnBlur(event, inValue) {
86
75
  // console.log(`Currency currOnBlur inValue: ${inValue}`);
87
76
  handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
@@ -94,22 +83,22 @@ export default function Currency(props) {
94
83
  fullWidth
95
84
  variant={readOnly ? 'standard' : 'outlined'}
96
85
  helperText={helperTextToDisplay}
97
- placeholder=''
86
+ placeholder={placeholder ?? ''}
98
87
  size='small'
99
88
  required={required}
100
89
  disabled={disabled}
101
- onChange={currOnChange}
102
- onBlur={!readOnly ? currOnBlur : undefined}
90
+ readOnly={!!readOnly}
103
91
  error={status === 'error'}
104
92
  label={label}
105
- value={currValue}
93
+ value={value}
106
94
  type='text'
107
95
  outputFormat='number'
108
96
  textAlign='left'
109
- InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: currValue } }}
97
+ InputProps={{ inputProps: { ...testProp } }}
110
98
  currencySymbol={theCurrSym}
111
99
  decimalCharacter={theCurrDec}
112
100
  digitGroupSeparator={theCurrSep}
101
+ onBlur={!readOnly ? currOnBlur : undefined}
113
102
  />
114
103
  );
115
104
  }
@@ -4,7 +4,6 @@
4
4
  "description": "Currency",
5
5
  "type": "Field",
6
6
  "subtype": "Decimal-Currency",
7
- "componentKey" : "Currency",
8
- "properties": [
9
- ]
7
+ "componentKey": "Currency",
8
+ "properties": []
10
9
  }
@@ -1,13 +1,10 @@
1
1
  // eslint-disable-next-line import/no-named-default
2
- import { default as CurrencyAlias} from '@pega/react-sdk-components/lib/components/helpers/formatters/Currency';
2
+ import { default as CurrencyAlias } from '@pega/react-sdk-components/lib/components/helpers/formatters/Currency';
3
3
  // eslint-disable-next-line import/no-named-default
4
4
  import { default as CurrencyMapAlias } from '@pega/react-sdk-components/lib/components/helpers/formatters/CurrencyMap';
5
5
 
6
- declare const PCore: any;
7
-
8
6
  export const getCurrencyOptions = (inISOCode: string) => {
9
-
10
- const operatorLocale = PCore.getEnvironmentInfo().getUseLocale() || 'en-US';
7
+ const operatorLocale = PCore.getEnvironmentInfo().getUseLocale() || PCore.getEnvironmentInfo().getLocale() || 'en-US';
11
8
 
12
9
  let currMapToUse = CurrencyMapAlias.US;
13
10
  let localeToUse = operatorLocale;
@@ -16,12 +13,12 @@ export const getCurrencyOptions = (inISOCode: string) => {
16
13
  // If no ISO code, use locale
17
14
  // If no locale, default to US
18
15
  if (inISOCode) {
19
- if (inISOCode === "EUR") {
16
+ if (inISOCode === 'EUR') {
20
17
  currMapToUse = CurrencyMapAlias.NL;
21
- localeToUse = "nl-NL";
18
+ localeToUse = 'nl-NL';
22
19
  } else {
23
20
  // For all other ISO codes, use first 2 characters as the lookup from CurrencyMap
24
- const countryCode = inISOCode.substring(0,2);
21
+ const countryCode = inISOCode.substring(0, 2);
25
22
  currMapToUse = CurrencyMapAlias[countryCode];
26
23
  }
27
24
  } else if (operatorLocale) {
@@ -35,23 +32,19 @@ export const getCurrencyOptions = (inISOCode: string) => {
35
32
 
36
33
  // If no currMapToUse at this point, default to US as a failsafe
37
34
  if (!currMapToUse) {
38
- currMapToUse = CurrencyMapAlias['US'];
35
+ currMapToUse = CurrencyMapAlias.US;
39
36
  }
40
37
 
41
38
  const theCode = currMapToUse.currencyCode.substring(0, 3);
42
- const currencyOptions = { locale: localeToUse, style: "currency", currency: theCode }
43
-
44
- return currencyOptions;
45
-
46
- }
47
-
39
+ return { locale: localeToUse, style: 'currency', currency: theCode };
40
+ };
48
41
 
49
42
  export const getCurrencyCharacters = (inISOCode: string) => {
50
43
  const theCurrencyChars = {
51
44
  theCurrencySymbol: '$',
52
45
  theDecimalIndicator: '.',
53
46
  theDigitGroupSeparator: ','
54
- }
47
+ };
55
48
 
56
49
  const theCurrencyOptions = getCurrencyOptions(inISOCode);
57
50
 
@@ -72,5 +65,4 @@ export const getCurrencyCharacters = (inISOCode: string) => {
72
65
  // console.log(`theCurrencyChars: symbol: ${theCurrencyChars.theCurrencySymbol} | theDigitGroupSeparator: ${theCurrencyChars.theDigitGroupSeparator} | theDecimalIndicator: ${theCurrencyChars.theDecimalIndicator}`);
73
66
 
74
67
  return theCurrencyChars;
75
-
76
- }
68
+ };
@@ -1,12 +1,25 @@
1
- import React from 'react';
2
1
  import { KeyboardDatePicker } from '@material-ui/pickers';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
2
+
4
3
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
6
- import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters/';
7
- import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
4
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
5
+ import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+
9
+ // Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server
10
+ function getFormattedDate(date) {
11
+ return `${date.$y.toString()}-${(date.$M + 1).toString().padStart(2, '0')}-${date.$D.toString().padStart(2, '0')}`;
12
+ }
13
+
14
+ interface DateProps extends PConnFieldProps {
15
+ // If any, enter additional props that only exist on Date here
16
+ }
17
+
18
+ export default function Date(props: DateProps) {
19
+ // Get emitted components from map (so we can get any override that may exist)
20
+ const TextInput = getComponentFromMap('TextInput');
21
+ const FieldValueList = getComponentFromMap('FieldValueList');
8
22
 
9
- export default function Date(props) {
10
23
  const {
11
24
  getPConnect,
12
25
  label,
@@ -26,25 +39,28 @@ export default function Date(props) {
26
39
 
27
40
  const pConn = getPConnect();
28
41
  const actions = pConn.getActionsApi();
29
- const propName = pConn.getStateProps().value;
42
+ const propName = (pConn.getStateProps() as any).value;
30
43
  const helperTextToDisplay = validatemessage || helperText;
31
44
 
32
45
  // Start with default dateFormatInfo
33
46
  const dateFormatInfo = dateFormatInfoDefault;
34
47
  // and then update, as needed, based on locale, etc.
35
- const theDateFormat = getDateFormatInfo()
48
+ const theDateFormat = getDateFormatInfo();
36
49
  dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
37
50
  dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
38
51
  dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
39
52
 
40
-
41
53
  if (displayMode === 'LABELS_LEFT') {
42
- const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
54
+ const formattedDate = format(props.value, 'date', {
55
+ format: dateFormatInfo.dateFormatString
56
+ });
43
57
  return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
44
58
  }
45
59
 
46
60
  if (displayMode === 'STACKED_LARGE_VAL') {
47
- const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
61
+ const formattedDate = format(props.value, 'date', {
62
+ format: dateFormatInfo.dateFormatString
63
+ });
48
64
  return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant='stacked' />;
49
65
  }
50
66
 
@@ -60,13 +76,15 @@ export default function Date(props) {
60
76
  };
61
77
 
62
78
  const handleChange = date => {
63
- const changeValue = date && date.isValid() ? date.toISOString() : null;
64
- onChange({ value: changeValue });
79
+ if (date && date.isValid()) {
80
+ onChange({ value: getFormattedDate(date) });
81
+ }
65
82
  };
66
83
 
67
84
  const handleAccept = date => {
68
- const changeValue = date && date.isValid() ? date.toISOString() : null;
69
- handleEvent(actions, 'changeNblur', propName, changeValue);
85
+ if (date && date.isValid()) {
86
+ handleEvent(actions, 'changeNblur', propName, getFormattedDate(date));
87
+ }
70
88
  };
71
89
 
72
90
  return (
@@ -4,7 +4,6 @@
4
4
  "description": "Date only",
5
5
  "type": "Field",
6
6
  "subtype": "Date",
7
- "componentKey" : "Date",
8
- "properties": [
9
- ]
7
+ "componentKey": "Date",
8
+ "properties": []
10
9
  }