@pega/react-sdk-overrides 0.23.26 → 0.23.28

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,20 @@
1
- import React from 'react';
2
1
  import { KeyboardDateTimePicker } 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
+ interface DateTimeProps extends PConnFieldProps {
10
+ // If any, enter additional props that only exist on DateTime here
11
+ }
12
+
13
+ export default function DateTime(props: DateTimeProps) {
14
+ // Get emitted components from map (so we can get any override that may exist)
15
+ const TextInput = getComponentFromMap('TextInput');
16
+ const FieldValueList = getComponentFromMap('FieldValueList');
8
17
 
9
- export default function DateTime(props) {
10
18
  const {
11
19
  getPConnect,
12
20
  label,
@@ -25,25 +33,28 @@ export default function DateTime(props) {
25
33
 
26
34
  const pConn = getPConnect();
27
35
  const actions = pConn.getActionsApi();
28
- const propName = pConn.getStateProps().value;
36
+ const propName = (pConn.getStateProps() as any).value;
29
37
  const helperTextToDisplay = validatemessage || helperText;
30
38
 
31
39
  // Start with default dateFormatInfo
32
40
  const dateFormatInfo = dateFormatInfoDefault;
33
41
  // and then update, as needed, based on locale, etc.
34
- const theDateFormat = getDateFormatInfo()
42
+ const theDateFormat = getDateFormatInfo();
35
43
  dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
36
44
  dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
37
45
  dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
38
46
 
39
-
40
47
  if (displayMode === 'LABELS_LEFT') {
41
- const formattedDateTime = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
48
+ const formattedDateTime = format(props.value, 'datetime', {
49
+ format: `${dateFormatInfo.dateFormatString} hh:mm a`
50
+ });
42
51
  return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} />;
43
52
  }
44
53
 
45
54
  if (displayMode === 'STACKED_LARGE_VAL') {
46
- const formattedDateTime = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
55
+ const formattedDateTime = format(props.value, 'datetime', {
56
+ format: `${dateFormatInfo.dateFormatString} hh:mm a`
57
+ });
47
58
  return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant='stacked' />;
48
59
  }
49
60
 
@@ -4,6 +4,5 @@
4
4
  "description": "Date & time",
5
5
  "type": "Field",
6
6
  "subtype": "DateTime",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,53 +1,100 @@
1
- import React from 'react';
2
- import { TextField } from '@material-ui/core';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
1
+ import { useState, useEffect } from 'react';
2
+ import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
+
4
+ import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
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';
7
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+
10
+ // Using control from: https://github.com/unicef/material-ui-currency-textfield
11
+
12
+ interface DecimalProps extends PConnFieldProps {
13
+ // If any, enter additional props that only exist on Decimal here
14
+ currencyISOCode?: string;
15
+ decimalPrecision?: number;
16
+ showGroupSeparators?: string;
17
+ }
18
+
19
+ export default function Decimal(props: DecimalProps) {
20
+ // Get emitted components from map (so we can get any override that may exist)
21
+ const FieldValueList = getComponentFromMap('FieldValueList');
5
22
 
6
- export default function Decimal(props) {
7
23
  const {
24
+ getPConnect,
8
25
  label,
9
26
  required,
10
27
  disabled,
11
28
  value = '',
12
29
  validatemessage,
13
30
  status,
14
- onChange,
15
- onBlur,
31
+ /* onChange, onBlur, */
16
32
  readOnly,
17
33
  helperText,
18
34
  displayMode,
19
- hideLabel
35
+ hideLabel,
36
+ currencyISOCode = 'USD',
37
+ decimalPrecision = 2,
38
+ showGroupSeparators = true,
39
+ testId,
40
+ placeholder
20
41
  } = props;
42
+
43
+ const pConn = getPConnect();
44
+ const actions = pConn.getActionsApi();
45
+ const propName = (pConn.getStateProps() as any).value;
21
46
  const helperTextToDisplay = validatemessage || helperText;
22
47
 
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]);
56
+
57
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
58
+ const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
59
+
23
60
  if (displayMode === 'LABELS_LEFT') {
24
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
61
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
25
62
  }
26
63
 
27
64
  if (displayMode === 'STACKED_LARGE_VAL') {
28
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
65
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
29
66
  }
30
67
 
31
- if (readOnly) {
32
- return <TextInput {...props} />;
68
+ const testProp = {
69
+ 'data-test-id': testId
70
+ };
71
+
72
+ function decimalOnBlur(event, inValue) {
73
+ handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
33
74
  }
34
75
 
35
76
  return (
36
- <TextField
77
+ <CurrencyTextField
37
78
  fullWidth
38
79
  variant={readOnly ? 'standard' : 'outlined'}
39
80
  helperText={helperTextToDisplay}
40
- placeholder=''
81
+ placeholder={placeholder ?? ''}
41
82
  size='small'
42
83
  required={required}
43
84
  disabled={disabled}
44
- onChange={onChange}
45
- onBlur={!readOnly ? onBlur : undefined}
46
85
  error={status === 'error'}
47
86
  label={label}
48
87
  value={value}
88
+ readOnly={!!readOnly}
49
89
  type='text'
50
- inputProps={{ inputMode: 'decimal', pattern: '[0-9]*' }}
90
+ outputFormat='number'
91
+ textAlign='left'
92
+ InputProps={{ inputProps: { ...testProp } }}
93
+ currencySymbol=''
94
+ decimalCharacter={theCurrDec}
95
+ digitGroupSeparator={showGroupSeparators ? theCurrSep : ''}
96
+ decimalPlaces={decimalPrecision}
97
+ onBlur={!readOnly ? decimalOnBlur : undefined}
51
98
  />
52
99
  );
53
100
  }
@@ -4,6 +4,5 @@
4
4
  "description": "Decimal",
5
5
  "type": "Field",
6
6
  "subtype": "Decimal",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1 +1 @@
1
- export { default } from './Decimal';
1
+ export { default } from './Decimal';
@@ -1,54 +1,189 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { TextField } from '@material-ui/core';
3
3
  import MenuItem from '@material-ui/core/MenuItem';
4
+ import isDeepEqual from 'fast-deep-equal/react';
4
5
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
6
+ import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
5
7
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
8
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
9
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
10
 
8
11
  interface IOption {
9
12
  key: string;
10
13
  value: string;
11
14
  }
12
15
 
13
- export default function Dropdown(props) {
16
+ const flattenParameters = (params = {}) => {
17
+ const flatParams = {};
18
+ Object.keys(params).forEach(key => {
19
+ const { name, value: theVal } = params[key];
20
+ flatParams[name] = theVal;
21
+ });
22
+
23
+ return flatParams;
24
+ };
25
+
26
+ const preProcessColumns = columnList => {
27
+ return columnList.map(col => {
28
+ const tempColObj = { ...col };
29
+ tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
30
+ return tempColObj;
31
+ });
32
+ };
33
+
34
+ const getDisplayFieldsMetaData = columnList => {
35
+ const displayColumns = columnList.filter(col => col.display === 'true');
36
+ const metaDataObj: any = { key: '', primary: '', secondary: [] };
37
+ const keyCol = columnList.filter(col => col.key === 'true');
38
+ metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
39
+ for (let index = 0; index < displayColumns.length; index += 1) {
40
+ if (displayColumns[index].primary === 'true') {
41
+ metaDataObj.primary = displayColumns[index].value;
42
+ } else {
43
+ metaDataObj.secondary.push(displayColumns[index].value);
44
+ }
45
+ }
46
+ return metaDataObj;
47
+ };
48
+
49
+ interface DropdownProps extends PConnFieldProps {
50
+ // If any, enter additional props that only exist on Dropdown here
51
+ datasource?: any[];
52
+ onRecordChange?: any;
53
+ fieldMetadata?: any;
54
+ listType: string;
55
+ deferDatasource?: boolean;
56
+ datasourceMetadata?: any;
57
+ parameters?: any;
58
+ columns: any[];
59
+ }
60
+
61
+ export default function Dropdown(props: DropdownProps) {
62
+ // Get emitted components from map (so we can get any override that may exist)
63
+ const FieldValueList = getComponentFromMap('FieldValueList');
64
+
14
65
  const {
15
66
  getPConnect,
16
67
  label,
17
68
  required,
18
69
  disabled,
19
- placeholder,
20
70
  value = '',
21
- datasource = [],
22
71
  validatemessage,
23
72
  status,
24
73
  readOnly,
25
74
  testId,
26
75
  helperText,
27
76
  displayMode,
77
+ deferDatasource,
78
+ datasourceMetadata,
28
79
  hideLabel,
29
- onRecordChange
80
+ onRecordChange,
81
+ fieldMetadata
30
82
  } = props;
31
- const [options, setOptions] = useState<Array<IOption>>([]);
83
+ let { placeholder = '' } = props;
84
+ const context = getPConnect().getContextName();
85
+ let { listType, parameters, datasource = [], columns = [] } = props;
86
+ placeholder = placeholder || 'Select...';
87
+ const [options, setOptions] = useState<IOption[]>([]);
88
+ const [theDatasource, setDatasource] = useState<any[] | null>(null);
32
89
  const helperTextToDisplay = validatemessage || helperText;
33
90
 
34
91
  const thePConn = getPConnect();
35
92
  const actionsApi = thePConn.getActionsApi();
36
- const propName = thePConn.getStateProps().value;
93
+ const propName = (thePConn.getStateProps() as any).value;
94
+ const className = thePConn.getCaseInfo().getClassName();
95
+ const refName = propName?.slice(propName.lastIndexOf('.') + 1);
96
+
97
+ if (!isDeepEqual(datasource, theDatasource)) {
98
+ // inbound datasource is different, so update theDatasource (to trigger useEffect)
99
+ setDatasource(datasource);
100
+ }
101
+
102
+ // convert associated to datapage listtype and transform props
103
+ // Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList
104
+ if (deferDatasource && datasourceMetadata?.datasource?.name) {
105
+ listType = 'datapage';
106
+ datasource = datasourceMetadata.datasource.name;
107
+ const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;
108
+ parameters = flattenParameters(dataSourceParameters);
109
+ const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;
110
+ const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;
111
+ columns = [
112
+ {
113
+ key: 'true',
114
+ setProperty: 'Associated property',
115
+ value: valueProp
116
+ },
117
+ {
118
+ display: 'true',
119
+ primary: 'true',
120
+ useForSearch: true,
121
+ value: displayProp
122
+ }
123
+ ];
124
+ }
125
+ columns = preProcessColumns(columns);
37
126
 
38
127
  useEffect(() => {
39
- const optionsList = Utils.getOptionList(props, getPConnect().getDataObject());
40
- optionsList.unshift({ key: 'Select', value: 'Select...' });
41
- setOptions(optionsList);
42
- }, [datasource]);
128
+ if (theDatasource) {
129
+ const list = Utils.getOptionList(props, getPConnect().getDataObject('')); // 1st arg empty string until typedef marked correctly
130
+ const optionsList = [...list];
131
+ optionsList.unshift({
132
+ key: placeholder,
133
+ value: thePConn.getLocalizedValue(placeholder, '', '')
134
+ }); // 2nd and 3rd args empty string until typedef marked correctly
135
+ setOptions(optionsList);
136
+ }
137
+ }, [theDatasource]);
138
+
139
+ useEffect(() => {
140
+ if (!displayMode && listType !== 'associated' && typeof datasource === 'string') {
141
+ getDataPage(datasource, parameters, context).then((results: any) => {
142
+ const optionsData: any[] = [];
143
+ const displayColumn = getDisplayFieldsMetaData(columns);
144
+ results?.forEach(element => {
145
+ const val = element[displayColumn.primary]?.toString();
146
+ const obj = {
147
+ key: element[displayColumn.key] || element.pyGUID,
148
+ value: val
149
+ };
150
+ optionsData.push(obj);
151
+ });
152
+ setOptions(optionsData);
153
+ });
154
+ }
155
+ }, []);
156
+
157
+ const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;
158
+
159
+ let displayName = metaData?.datasource?.propertyForDisplayText;
160
+ displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
161
+ const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
162
+ const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
163
+ const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;
164
+ const localePath = localeContext === 'datapage' ? displayName : localeName;
43
165
 
44
166
  let readOnlyProp = {};
45
167
 
46
168
  if (displayMode === 'LABELS_LEFT') {
47
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
169
+ return (
170
+ <FieldValueList
171
+ name={hideLabel ? '' : label}
172
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
173
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
174
+ />
175
+ );
48
176
  }
49
177
 
50
178
  if (displayMode === 'STACKED_LARGE_VAL') {
51
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
179
+ return (
180
+ <FieldValueList
181
+ name={hideLabel ? '' : label}
182
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
183
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
184
+ variant='stacked'
185
+ />
186
+ );
52
187
  }
53
188
 
54
189
  if (readOnly) {
@@ -62,7 +197,7 @@ export default function Dropdown(props) {
62
197
  };
63
198
 
64
199
  const handleChange = evt => {
65
- const selectedValue = evt.target.value === 'Select' ? '' : evt.target.value;
200
+ const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;
66
201
  handleEvent(actionsApi, 'changeNblur', propName, selectedValue);
67
202
  if (onRecordChange) {
68
203
  onRecordChange(evt);
@@ -76,20 +211,21 @@ export default function Dropdown(props) {
76
211
  fullWidth
77
212
  variant={readOnly ? 'standard' : 'outlined'}
78
213
  helperText={helperTextToDisplay}
79
- placeholder={placeholder}
214
+ placeholder={thePConn.getLocalizedValue(placeholder, '', '')} // 2nd and 3rd args empty string until typedef marked correctly
80
215
  size='small'
81
216
  required={required}
82
217
  disabled={disabled}
83
218
  onChange={!readOnly ? handleChange : undefined}
84
219
  error={status === 'error'}
85
220
  label={label}
86
- value={value === '' && !readOnly ? 'Select' : value}
221
+ value={value === '' && !readOnly ? placeholder : value}
87
222
  select
88
223
  InputProps={{ ...readOnlyProp, ...testProp }}
89
224
  >
90
225
  {options.map((option: any) => (
91
226
  <MenuItem key={option.key} value={option.key}>
92
- {option.value}
227
+ {/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}
228
+ {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
93
229
  </MenuItem>
94
230
  ))}
95
231
  </TextField>
@@ -4,6 +4,5 @@
4
4
  "description": "Picklist",
5
5
  "type": "Field",
6
6
  "subtype": "Picklist",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,10 +1,18 @@
1
- import React from 'react';
2
- import { TextField, InputAdornment } from '@material-ui/core';
1
+ import { InputAdornment, TextField } from '@material-ui/core';
3
2
  import MailOutlineIcon from '@material-ui/icons/MailOutline';
4
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
5
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
6
3
 
7
- export default function Email(props) {
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+
7
+ interface EmailProps extends PConnFieldProps {
8
+ // If any, enter additional props that only exist on Date here
9
+ }
10
+
11
+ export default function Email(props: EmailProps) {
12
+ // Get emitted components from map (so we can get any override that may exist)
13
+ const TextInput = getComponentFromMap('TextInput');
14
+ const FieldValueList = getComponentFromMap('FieldValueList');
15
+
8
16
  const {
9
17
  label,
10
18
  required,
@@ -18,7 +26,8 @@ export default function Email(props) {
18
26
  testId,
19
27
  helperText,
20
28
  displayMode,
21
- hideLabel
29
+ hideLabel,
30
+ placeholder
22
31
  } = props;
23
32
  const helperTextToDisplay = validatemessage || helperText;
24
33
 
@@ -45,7 +54,7 @@ export default function Email(props) {
45
54
  fullWidth
46
55
  variant='outlined'
47
56
  helperText={helperTextToDisplay}
48
- placeholder=''
57
+ placeholder={placeholder ?? ''}
49
58
  size='small'
50
59
  required={required}
51
60
  disabled={disabled}
@@ -4,6 +4,5 @@
4
4
  "description": "Email",
5
5
  "type": "Field",
6
6
  "subtype": "Text-Email",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1 +1 @@
1
- export { default } from './Email';
1
+ export { default } from './Email';
@@ -0,0 +1,37 @@
1
+ import { ReactElement, useMemo } from 'react';
2
+ import { Grid } from '@material-ui/core';
3
+ import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
4
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+
6
+ interface GroupProps extends PConnFieldProps {
7
+ children: ReactElement[];
8
+ heading: string;
9
+ showHeading: boolean;
10
+ instructions?: string;
11
+ collapsible: boolean;
12
+ type: string;
13
+ }
14
+
15
+ export default function Group(props: GroupProps) {
16
+ const { children, heading, showHeading, instructions, collapsible, displayMode, type } = props;
17
+
18
+ const isReadOnly = displayMode === 'LABELS_LEFT';
19
+
20
+ const content = useMemo(() => {
21
+ return (
22
+ <Grid container spacing={2}>
23
+ {children?.map(child => (
24
+ <Grid item xs={12} key={child.key}>
25
+ {child}
26
+ </Grid>
27
+ ))}
28
+ </Grid>
29
+ );
30
+ }, [children, type, isReadOnly]);
31
+
32
+ return (
33
+ <FieldGroup name={showHeading ? heading : undefined} collapsible={collapsible} instructions={instructions}>
34
+ {content}
35
+ </FieldGroup>
36
+ );
37
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "Group",
3
+ "label": "Field Group",
4
+ "description": "Field Group",
5
+ "type": "Group",
6
+ "properties": []
7
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Group';
@@ -1,9 +1,17 @@
1
- import React from 'react';
2
1
  import { TextField } from '@material-ui/core';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
5
2
 
6
- export default function Integer(props) {
3
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+
6
+ interface IntegerProps extends PConnFieldProps {
7
+ // If any, enter additional props that only exist on Integer here
8
+ }
9
+
10
+ export default function Integer(props: IntegerProps) {
11
+ // Get emitted components from map (so we can get any override that may exist)
12
+ const TextInput = getComponentFromMap('TextInput');
13
+ const FieldValueList = getComponentFromMap('FieldValueList');
14
+
7
15
  const {
8
16
  label,
9
17
  required,
@@ -17,7 +25,8 @@ export default function Integer(props) {
17
25
  testId,
18
26
  helperText,
19
27
  displayMode,
20
- hideLabel
28
+ hideLabel,
29
+ placeholder
21
30
  } = props;
22
31
  const helperTextToDisplay = validatemessage || helperText;
23
32
 
@@ -63,7 +72,7 @@ export default function Integer(props) {
63
72
  fullWidth
64
73
  variant={readOnly ? 'standard' : 'outlined'}
65
74
  helperText={helperTextToDisplay}
66
- placeholder=''
75
+ placeholder={placeholder ?? ''}
67
76
  size='small'
68
77
  required={required}
69
78
  disabled={disabled}
@@ -4,6 +4,5 @@
4
4
  "description": "Integer",
5
5
  "type": "Field",
6
6
  "subtype": "Integer",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
1
  import { TextField } from '@material-ui/core';
3
2
  import { makeStyles } from '@material-ui/core/styles';
4
3
 
5
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
6
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
6
 
8
7
  // Inspired by https://stackoverflow.com/questions/50823182/material-ui-remove-up-down-arrow-dials-from-textview
9
8
  const useStyles = makeStyles((/* theme */) => ({
@@ -22,7 +21,15 @@ const useStyles = makeStyles((/* theme */) => ({
22
21
  }
23
22
  }));
24
23
 
25
- export default function Percentage(props) {
24
+ interface PercentageProps extends PConnFieldProps {
25
+ // If any, enter additional props that only exist on Percentage here
26
+ }
27
+
28
+ export default function Percentage(props: PercentageProps) {
29
+ // Get emitted components from map (so we can get any override that may exist)
30
+ const TextInput = getComponentFromMap('TextInput');
31
+ const FieldValueList = getComponentFromMap('FieldValueList');
32
+
26
33
  const classes = useStyles();
27
34
 
28
35
  const {
@@ -38,7 +45,8 @@ export default function Percentage(props) {
38
45
  testId,
39
46
  helperText,
40
47
  displayMode,
41
- hideLabel
48
+ hideLabel,
49
+ placeholder
42
50
  } = props;
43
51
  const helperTextToDisplay = validatemessage || helperText;
44
52
 
@@ -68,7 +76,7 @@ export default function Percentage(props) {
68
76
  fullWidth
69
77
  variant={readOnly ? 'standard' : 'outlined'}
70
78
  helperText={helperTextToDisplay}
71
- placeholder=''
79
+ placeholder={placeholder ?? ''}
72
80
  size='small'
73
81
  required={required}
74
82
  disabled={disabled}
@@ -4,6 +4,5 @@
4
4
  "description": "Percentage",
5
5
  "type": "Field",
6
6
  "subtype": "Decimal-Percentage",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }