@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,8 +1,16 @@
1
- import React from 'react';
2
1
  import MuiPhoneNumber from 'material-ui-phone-number';
3
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
4
2
 
5
- export default function Phone(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 PhoneProps extends PConnFieldProps {
7
+ // If any, enter additional props that only exist on Phone here
8
+ }
9
+
10
+ export default function Phone(props: PhoneProps) {
11
+ // Get emitted components from map (so we can get any override that may exist)
12
+ const FieldValueList = getComponentFromMap('FieldValueList');
13
+
6
14
  const {
7
15
  label,
8
16
  required,
@@ -16,7 +24,8 @@ export default function Phone(props) {
16
24
  testId,
17
25
  helperText,
18
26
  displayMode,
19
- hideLabel
27
+ hideLabel,
28
+ placeholder
20
29
  } = props;
21
30
  const helperTextToDisplay = validatemessage || helperText;
22
31
 
@@ -41,7 +50,7 @@ export default function Phone(props) {
41
50
  <MuiPhoneNumber
42
51
  fullWidth
43
52
  helperText={helperTextToDisplay}
44
- placeholder=''
53
+ placeholder={placeholder ?? ''}
45
54
  size='small'
46
55
  required={required}
47
56
  disabled={disabled}
@@ -50,7 +59,8 @@ export default function Phone(props) {
50
59
  label={label}
51
60
  value={value}
52
61
  InputProps={{
53
- readOnly: true
62
+ readOnly: true,
63
+ inputProps: { ...testProp }
54
64
  }}
55
65
  disableDropdown={disableDropdown}
56
66
  />
@@ -75,7 +85,7 @@ export default function Phone(props) {
75
85
  fullWidth
76
86
  variant='outlined'
77
87
  helperText={helperTextToDisplay}
78
- placeholder=''
88
+ placeholder={placeholder ?? ''}
79
89
  size='small'
80
90
  defaultCountry='us'
81
91
  required={required}
@@ -1 +1 @@
1
- export { default } from './Phone';
1
+ export { default } from './Phone';
@@ -1,18 +1,22 @@
1
- import React, { useState, useEffect } from 'react';
2
- import {
3
- Radio,
4
- RadioGroup,
5
- FormControl,
6
- FormControlLabel,
7
- FormLabel,
8
- FormHelperText
9
- } from '@material-ui/core';
1
+ import { useState, useEffect } from 'react';
2
+ import { Radio, RadioGroup, FormControl, FormControlLabel, FormLabel, FormHelperText } from '@material-ui/core';
10
3
 
11
4
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
12
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
13
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
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
+ // Can't use RadioButtonProps until getLocaleRuleNameFromKeys is NOT private
10
+ interface RadioButtonsProps extends PConnFieldProps {
11
+ // If any, enter additional props that only exist on RadioButtons here
12
+ inline: boolean;
13
+ fieldMetadata?: any;
14
+ }
15
+
16
+ export default function RadioButtons(props: RadioButtonsProps) {
17
+ // Get emitted components from map (so we can get any override that may exist)
18
+ const FieldValueList = getComponentFromMap('FieldValueList');
14
19
 
15
- export default function RadioButtons(props) {
16
20
  const {
17
21
  getPConnect,
18
22
  label,
@@ -24,19 +28,33 @@ export default function RadioButtons(props) {
24
28
  required,
25
29
  inline,
26
30
  displayMode,
27
- hideLabel
31
+ hideLabel,
32
+ fieldMetadata
28
33
  } = props;
29
34
  const [theSelectedButton, setSelectedButton] = useState(value);
30
35
 
31
36
  const thePConn = getPConnect();
32
37
  const theConfigProps = thePConn.getConfigProps();
33
38
  const actionsApi = thePConn.getActionsApi();
34
- const propName = thePConn.getStateProps().value;
39
+ const propName = (thePConn.getStateProps() as any).value;
35
40
  const helperTextToDisplay = validatemessage || helperText;
41
+ const className = thePConn.getCaseInfo().getClassName();
42
+
43
+ let configProperty = (thePConn.getRawMetadata() as any)?.config?.value || '';
44
+ configProperty = configProperty.startsWith('@P') ? configProperty.substring(3) : configProperty;
45
+ configProperty = configProperty.startsWith('.') ? configProperty.substring(1) : configProperty;
46
+
47
+ const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;
48
+ let displayName = metaData?.datasource?.propertyForDisplayText;
49
+ displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
50
+ const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
51
+ const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
52
+ const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : configProperty;
53
+ const localePath = localeContext === 'datapage' ? displayName : localeName;
36
54
 
37
55
  // theOptions will be an array of JSON objects that are literally key/value pairs.
38
56
  // Ex: [ {key: "Basic", value: "Basic"} ]
39
- const theOptions = Utils.getOptionList(theConfigProps, thePConn.getDataObject());
57
+ const theOptions = Utils.getOptionList(theConfigProps, thePConn.getDataObject(''));
40
58
 
41
59
  useEffect(() => {
42
60
  // This update theSelectedButton which will update the UI to show the selected button correctly
@@ -44,11 +62,24 @@ export default function RadioButtons(props) {
44
62
  }, [value]);
45
63
 
46
64
  if (displayMode === 'LABELS_LEFT') {
47
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
65
+ return (
66
+ <FieldValueList
67
+ name={hideLabel ? '' : label}
68
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
69
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
70
+ />
71
+ );
48
72
  }
49
73
 
50
74
  if (displayMode === 'STACKED_LARGE_VAL') {
51
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
75
+ return (
76
+ <FieldValueList
77
+ name={hideLabel ? '' : label}
78
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
79
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
80
+ variant='stacked'
81
+ />
82
+ );
52
83
  }
53
84
 
54
85
  const handleChange = event => {
@@ -56,24 +87,24 @@ export default function RadioButtons(props) {
56
87
  };
57
88
 
58
89
  const handleBlur = event => {
59
- thePConn.getValidationApi().validate(event.target.value);
90
+ thePConn.getValidationApi().validate(event.target.value, ''); // 2nd arg empty string until typedef marked correctly as optional
60
91
  };
61
92
 
62
93
  return (
63
94
  <FormControl error={status === 'error'} required={required}>
64
95
  <FormLabel component='legend'>{label}</FormLabel>
65
- <RadioGroup
66
- value={theSelectedButton}
67
- onChange={handleChange}
68
- onBlur={!readOnly ? handleBlur : undefined}
69
- row={inline}
70
- >
96
+ <RadioGroup value={theSelectedButton} onChange={handleChange} onBlur={!readOnly ? handleBlur : undefined} row={inline}>
71
97
  {theOptions.map(theOption => {
72
98
  return (
73
99
  <FormControlLabel
74
100
  value={theOption.key}
75
101
  key={theOption.key}
76
- label={theOption.value}
102
+ label={thePConn.getLocalizedValue(
103
+ theOption.value,
104
+ localePath,
105
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
106
+ thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
107
+ )}
77
108
  control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
78
109
  />
79
110
  );
@@ -4,6 +4,5 @@
4
4
  "description": "Picklist",
5
5
  "type": "Field",
6
6
  "subtype": "Picklist",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -0,0 +1,96 @@
1
+ import { useRef } from 'react';
2
+
3
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
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 RichTextProps extends PConnFieldProps {
8
+ // If any, enter additional props that only exist on TextArea here
9
+ additionalProps?: object;
10
+ }
11
+
12
+ export default function RichText(props: RichTextProps) {
13
+ // Get emitted components from map (so we can get any override that may exist)
14
+ const FieldValueList = getComponentFromMap('FieldValueList');
15
+ const RichTextEditor = getComponentFromMap('RichTextEditor');
16
+
17
+ const { getPConnect, value, placeholder, validatemessage, label, hideLabel, helperText, testId, displayMode, additionalProps } = props;
18
+ const pConn = getPConnect();
19
+ const editorRef: any = useRef(null);
20
+
21
+ let { readOnly, required, disabled } = props;
22
+ [readOnly, required, disabled] = [readOnly, required, disabled].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
23
+
24
+ const helperTextToDisplay = validatemessage || helperText;
25
+
26
+ if (displayMode === 'LABELS_LEFT') {
27
+ return <FieldValueList name={hideLabel ? '' : label} value={value} />;
28
+ }
29
+
30
+ if (displayMode === 'STACKED_LARGE_VAL') {
31
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
32
+ }
33
+
34
+ let richTextComponent;
35
+
36
+ if (readOnly) {
37
+ // Rich Text read-only component
38
+ richTextComponent = (
39
+ <RichTextEditor
40
+ {...additionalProps}
41
+ label={label}
42
+ labelHidden={hideLabel}
43
+ defaultValue={value}
44
+ testId={testId}
45
+ info={helperTextToDisplay}
46
+ ref={editorRef}
47
+ readOnly
48
+ />
49
+ );
50
+ } else {
51
+ // Rich Text editable component
52
+ const actionsApi = pConn.getActionsApi();
53
+ let status = '';
54
+ if (validatemessage !== '') {
55
+ status = 'error';
56
+ }
57
+ const handleChange = () => {
58
+ if (status === 'error') {
59
+ const property = (pConn.getStateProps() as any).value;
60
+ pConn.clearErrorMessages({
61
+ property,
62
+ category: '',
63
+ context: ''
64
+ });
65
+ }
66
+ };
67
+
68
+ const handleBlur = () => {
69
+ if (editorRef.current) {
70
+ const editorValue = editorRef.current.getContent({ format: 'html' });
71
+ const property = (pConn.getStateProps() as any).value;
72
+ handleEvent(actionsApi, 'changeNblur', property, editorValue);
73
+ }
74
+ };
75
+
76
+ richTextComponent = (
77
+ <RichTextEditor
78
+ {...additionalProps}
79
+ label={label}
80
+ labelHidden={hideLabel}
81
+ info={helperTextToDisplay}
82
+ defaultValue={value}
83
+ placeholder={placeholder}
84
+ disabled={disabled}
85
+ required={required}
86
+ testId={testId}
87
+ ref={editorRef}
88
+ error={status === 'error'}
89
+ onBlur={handleBlur}
90
+ onChange={handleChange}
91
+ />
92
+ );
93
+ }
94
+
95
+ return richTextComponent;
96
+ }
@@ -0,0 +1 @@
1
+ export { default } from './RichText';
@@ -0,0 +1,63 @@
1
+ /* eslint-disable react/no-array-index-key */
2
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
+
5
+ // ScalarListProps can't extend PConnFieldProps because its 'value' has a different type
6
+ interface ScalarListProps extends PConnProps {
7
+ // If any, enter additional props that only exist on this component
8
+ displayInModal: boolean;
9
+ hideLabel: boolean;
10
+ value: any[];
11
+ componentType: string;
12
+ label: string;
13
+ displayMode: string;
14
+ }
15
+
16
+ function CommaSeparatedList(props) {
17
+ const { items } = props;
18
+
19
+ return (
20
+ <ul style={{ padding: '0', margin: '0' }}>
21
+ {items.map((value, index) => {
22
+ return <span key={index}>{value}</span>;
23
+ })}
24
+ </ul>
25
+ );
26
+ }
27
+
28
+ export default function ScalarList(props: ScalarListProps) {
29
+ // Get emitted components from map (so we can get any override that may exist)
30
+ const FieldValueList = getComponentFromMap('FieldValueList');
31
+
32
+ const { label, getPConnect, componentType, value: scalarValues, displayMode, hideLabel, ...restProps } = props;
33
+
34
+ const items = scalarValues?.map(scalarValue => {
35
+ return getPConnect().createComponent(
36
+ {
37
+ type: componentType,
38
+ config: {
39
+ value: scalarValue,
40
+ displayMode: 'LABELS_LEFT',
41
+ label,
42
+ ...restProps,
43
+ readOnly: 'true'
44
+ }
45
+ },
46
+ '',
47
+ '',
48
+ {}
49
+ ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
50
+ });
51
+
52
+ if (['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode)) {
53
+ return (
54
+ <div>
55
+ <CommaSeparatedList items={items} />
56
+ </div>
57
+ );
58
+ }
59
+
60
+ const displayComp = <CommaSeparatedList items={items} />;
61
+
62
+ return <FieldValueList name={hideLabel ? '' : label} value={displayComp} variant='stacked' />;
63
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "label": "ScalarList",
3
+ "componentKey": "ScalarList",
4
+ "name": "ScalarList",
5
+ "type": "Field",
6
+ "properties": []
7
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ScalarList';
@@ -1,14 +1,14 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
1
  import Typography from '@material-ui/core/Typography';
4
2
  import Grid from '@material-ui/core/Grid';
5
3
  import { makeStyles } from '@material-ui/core/styles';
6
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
4
+
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
7
 
8
8
  /* although this is called the SemanticLink component, we are not yet displaying as a
9
9
  SemanticLink in SDK and only showing the value as a read only text field. */
10
10
 
11
- const useStyles = makeStyles((theme) => ({
11
+ const useStyles = makeStyles(theme => ({
12
12
  root: {
13
13
  paddingRight: theme.spacing(1),
14
14
  paddingLeft: theme.spacing(1),
@@ -17,7 +17,7 @@ const useStyles = makeStyles((theme) => ({
17
17
  marginRight: theme.spacing(1),
18
18
  marginLeft: theme.spacing(1),
19
19
  marginTop: theme.spacing(1),
20
- marginBottom: theme.spacing(1),
20
+ marginBottom: theme.spacing(1)
21
21
  },
22
22
  fieldMargin: {
23
23
  paddingRight: theme.spacing(1),
@@ -27,7 +27,7 @@ const useStyles = makeStyles((theme) => ({
27
27
  marginRight: theme.spacing(1),
28
28
  marginLeft: theme.spacing(1),
29
29
  marginTop: theme.spacing(1),
30
- marginBottom: theme.spacing(1),
30
+ marginBottom: theme.spacing(1)
31
31
  },
32
32
  fieldLabel: {
33
33
  fontWeight: 400,
@@ -39,25 +39,32 @@ const useStyles = makeStyles((theme) => ({
39
39
  }
40
40
  }));
41
41
 
42
- export default function SemanticLink(props) {
43
- const {
44
- text,
45
- displayMode,
46
- label,
47
- hideLabel
48
- } = props;
49
- const classes = useStyles();
42
+ interface SemanticLinkProps extends PConnFieldProps {
43
+ // If any, enter additional props that only exist on SemanticLink here
44
+ // from previous PropTypes
45
+ text: string;
46
+ }
50
47
 
48
+ export default function SemanticLink(props: SemanticLinkProps) {
49
+ // Get emitted components from map (so we can get any override that may exist)
50
+ const FieldValueList = getComponentFromMap('FieldValueList');
51
51
 
52
- if (displayMode === "LABELS_LEFT" || (!displayMode && label !== undefined)) {
53
- const value = text || "---";
52
+ const { text, displayMode, label, hideLabel } = props;
53
+ const classes = useStyles();
54
+
55
+ if (displayMode === 'LABELS_LEFT' || (!displayMode && label !== undefined)) {
56
+ const value = text || '---';
54
57
  return (
55
- <Grid container spacing={1} style={{padding: "4px 0px"}} id="semantic-link-grid">
58
+ <Grid container spacing={1} style={{ padding: '4px 0px' }} id='semantic-link-grid'>
56
59
  <Grid item xs={6}>
57
- <Typography variant="body2" component="span" className={`${classes.fieldLabel} ${classes.fieldMargin}`}>{label}</Typography>
60
+ <Typography variant='body2' component='span' className={`${classes.fieldLabel} ${classes.fieldMargin}`}>
61
+ {label}
62
+ </Typography>
58
63
  </Grid>
59
64
  <Grid item xs={6}>
60
- <Typography variant="body2" component="span" className={classes.fieldValue}>{value}</Typography>
65
+ <Typography variant='body2' component='span' className={classes.fieldValue}>
66
+ {value}
67
+ </Typography>
61
68
  </Grid>
62
69
  </Grid>
63
70
  );
@@ -67,9 +74,3 @@ export default function SemanticLink(props) {
67
74
  return <FieldValueList name={hideLabel ? '' : label} value={text} variant='stacked' />;
68
75
  }
69
76
  }
70
-
71
- SemanticLink.propTypes = {
72
- text: PropTypes.string.isRequired,
73
- displayMode: PropTypes.string,
74
- label: PropTypes.string,
75
- };
@@ -3,6 +3,5 @@
3
3
  "description": "SemanticLink",
4
4
  "type": "Field",
5
5
  "subtype": "ACTION",
6
- "properties": [
7
- ]
6
+ "properties": []
8
7
  }
@@ -1,11 +1,9 @@
1
- declare const PCore;
2
-
3
1
  function getDataReferenceInfo(pConnect, dataRelationshipContext) {
4
2
  if (!pConnect) {
5
- throw Error("PConnect parameter is required");
3
+ throw Error('PConnect parameter is required');
6
4
  }
7
5
 
8
- let dataContext = "";
6
+ let dataContext = '';
9
7
  const payload = {};
10
8
  const pageReference = pConnect.getPageReference();
11
9
  const annotationUtils = PCore.getAnnotationUtils();
@@ -16,7 +14,7 @@ function getDataReferenceInfo(pConnect, dataRelationshipContext) {
16
14
  For page list the page refernce will be something like caseInfo.content.EmployeeRef[1].
17
15
  Need to extract EmployeeRef from caseInfo.content.EmployeeRef[1]
18
16
  */
19
- const propertySplit = pageReference.split(".");
17
+ const propertySplit = pageReference.split('.');
20
18
 
21
19
  // Regex to match if the property is list type. Eg: EmployeeRef[1]
22
20
  const listPropertyRegex = /([a-z|A-Z]*[[][\d]*)[\]]$/gm;
@@ -25,9 +23,7 @@ function getDataReferenceInfo(pConnect, dataRelationshipContext) {
25
23
 
26
24
  let contextProperty = dataRelationshipContext !== null ? dataRelationshipContext : propertySplit.pop();
27
25
  const isListProperty = listPropertyRegex.test(contextProperty);
28
- contextProperty = isListProperty
29
- ? contextProperty.replace(indexRegex, "")
30
- : contextProperty;
26
+ contextProperty = isListProperty ? contextProperty.replace(indexRegex, '') : contextProperty;
31
27
  fieldMetadata = pConnect.getFieldMetadata(contextProperty);
32
28
  }
33
29
 
@@ -35,7 +31,9 @@ function getDataReferenceInfo(pConnect, dataRelationshipContext) {
35
31
  const { name, parameters } = fieldMetadata.datasource;
36
32
  dataContext = name;
37
33
  for (const [key, value] of Object.entries(parameters)) {
38
- const property = dataRelationshipContext !== null ? annotationUtils.getPropertyName(value) : annotationUtils.getLeafPropertyName(value)
34
+ const property =
35
+ // @ts-ignore - Property 'getLeafPropertyName' is private and only accessible within class 'AnnotationUtils'
36
+ dataRelationshipContext !== null ? annotationUtils.getPropertyName(value as string) : annotationUtils.getLeafPropertyName(value);
39
37
  payload[key] = pConnect.getValue(`.${property}`);
40
38
  }
41
39
  return { dataContext, dataContextParameters: payload };
@@ -45,7 +43,7 @@ function getDataReferenceInfo(pConnect, dataRelationshipContext) {
45
43
  }
46
44
 
47
45
  function isLinkTextEmpty(text) {
48
- return text === "" || text === undefined || text === null;
46
+ return text === '' || text === undefined || text === null;
49
47
  }
50
48
 
51
49
  export default { getDataReferenceInfo, isLinkTextEmpty };
@@ -1,8 +1,17 @@
1
- import React from 'react';
2
1
  import { TextField } from '@material-ui/core';
3
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
4
2
 
5
- export default function TextArea(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 TextAreaProps extends PConnFieldProps {
7
+ // If any, enter additional props that only exist on TextArea here
8
+ fieldMetadata?: any;
9
+ }
10
+
11
+ export default function TextArea(props: TextAreaProps) {
12
+ // Get emitted components from map (so we can get any override that may exist)
13
+ const FieldValueList = getComponentFromMap('FieldValueList');
14
+
6
15
  const {
7
16
  label,
8
17
  required,
@@ -17,7 +26,8 @@ export default function TextArea(props) {
17
26
  fieldMetadata,
18
27
  helperText,
19
28
  displayMode,
20
- hideLabel
29
+ hideLabel,
30
+ placeholder
21
31
  } = props;
22
32
  const helperTextToDisplay = validatemessage || helperText;
23
33
 
@@ -53,7 +63,7 @@ export default function TextArea(props) {
53
63
  fullWidth
54
64
  variant={readOnly ? 'standard' : 'outlined'}
55
65
  helperText={helperTextToDisplay}
56
- placeholder=''
66
+ placeholder={placeholder ?? ''}
57
67
  size='small'
58
68
  required={required}
59
69
  disabled={disabled}
@@ -4,6 +4,5 @@
4
4
  "description": "Text (paragraph)",
5
5
  "type": "Field",
6
6
  "subtype": "Text-Paragraph",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,7 +1,14 @@
1
- import React from 'react';
2
1
  import { Typography } from '@material-ui/core';
3
2
 
4
- export default function TextContent(props) {
3
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
+
5
+ interface TextContentProps extends PConnProps {
6
+ // If any, enter additional props that only exist on TextContent here
7
+ content: string;
8
+ displayAs: 'Paragraph' | 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Heading 4';
9
+ }
10
+
11
+ export default function TextContent(props: TextContentProps) {
5
12
  type ExpectedDisplayAs = 'Paragraph' | 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Heading 4';
6
13
  type ExpectedVariants = 'body1' | 'h1' | 'h2' | 'h3' | 'h4';
7
14
 
@@ -3,6 +3,5 @@
3
3
  "description": "Text",
4
4
  "type": "Field",
5
5
  "subtype": "DATA_CAPTURE",
6
- "properties": [
7
- ]
6
+ "properties": []
8
7
  }