@pega/react-sdk-overrides 0.23.25 → 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 (240) 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.css +4 -0
  7. package/lib/designSystemExtension/Banner/Banner.tsx +33 -16
  8. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  9. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  10. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  11. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  12. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  13. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
  14. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  15. package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
  16. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  17. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  18. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  19. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +6 -2
  20. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  21. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  22. package/lib/field/AutoComplete/config-ext.json +2 -3
  23. package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
  24. package/lib/field/CancelAlert/index.tsx +1 -1
  25. package/lib/field/Checkbox/Checkbox.tsx +29 -19
  26. package/lib/field/Checkbox/config-ext.json +2 -3
  27. package/lib/field/Currency/Currency.tsx +27 -38
  28. package/lib/field/Currency/config-ext.json +2 -3
  29. package/lib/field/Currency/currency-utils.ts +10 -18
  30. package/lib/field/Date/Date.tsx +33 -15
  31. package/lib/field/Date/config-ext.json +2 -3
  32. package/lib/field/DateTime/DateTime.tsx +22 -11
  33. package/lib/field/DateTime/config-ext.json +1 -2
  34. package/lib/field/Decimal/Decimal.tsx +64 -17
  35. package/lib/field/Decimal/config-ext.json +1 -2
  36. package/lib/field/Decimal/index.tsx +1 -1
  37. package/lib/field/Dropdown/Dropdown.tsx +154 -18
  38. package/lib/field/Dropdown/config-ext.json +1 -2
  39. package/lib/field/Email/Email.tsx +16 -7
  40. package/lib/field/Email/config-ext.json +1 -2
  41. package/lib/field/Email/index.tsx +1 -1
  42. package/lib/field/Group/Group.tsx +37 -0
  43. package/lib/field/Group/config-ext.json +7 -0
  44. package/lib/field/Group/index.tsx +1 -0
  45. package/lib/field/Integer/Integer.tsx +15 -6
  46. package/lib/field/Integer/config-ext.json +1 -2
  47. package/lib/field/Percentage/Percentage.tsx +14 -6
  48. package/lib/field/Percentage/config-ext.json +1 -2
  49. package/lib/field/Phone/Phone.tsx +17 -7
  50. package/lib/field/Phone/index.tsx +1 -1
  51. package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
  52. package/lib/field/RadioButtons/config-ext.json +1 -2
  53. package/lib/field/RichText/RichText.tsx +96 -0
  54. package/lib/field/RichText/index.tsx +1 -0
  55. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  56. package/lib/field/ScalarList/config-ext.json +7 -0
  57. package/lib/field/ScalarList/index.tsx +1 -0
  58. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  59. package/lib/field/SemanticLink/config-ext.json +1 -2
  60. package/lib/field/SemanticLink/utils.ts +8 -10
  61. package/lib/field/TextArea/TextArea.tsx +15 -5
  62. package/lib/field/TextArea/config-ext.json +1 -2
  63. package/lib/field/TextContent/TextContent.tsx +9 -2
  64. package/lib/field/TextContent/config-ext.json +1 -2
  65. package/lib/field/TextInput/TextInput.tsx +41 -10
  66. package/lib/field/TextInput/config-ext.json +1 -2
  67. package/lib/field/TextInput/index.tsx +1 -1
  68. package/lib/field/Time/Time.tsx +21 -18
  69. package/lib/field/Time/config-ext.json +1 -2
  70. package/lib/field/URL/URL.tsx +23 -6
  71. package/lib/field/URL/config-ext.json +1 -2
  72. package/lib/field/URL/index.tsx +1 -1
  73. package/lib/field/UserReference/UserReference.tsx +52 -58
  74. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  75. package/lib/field/UserReference/config-ext.json +1 -2
  76. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
  77. package/lib/helpers/case-utils.tsx +99 -0
  78. package/lib/helpers/common-utils.ts +8 -0
  79. package/lib/helpers/data_page.ts +3 -6
  80. package/lib/helpers/date-format-utils.ts +29 -19
  81. package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
  82. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
  83. package/lib/helpers/formatters/Boolean.ts +21 -0
  84. package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
  85. package/lib/helpers/formatters/CurrencyMap.ts +915 -0
  86. package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
  87. package/lib/helpers/formatters/{common.js → common.ts} +3 -4
  88. package/lib/helpers/formatters/{index.js → index.ts} +22 -22
  89. package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
  90. package/lib/helpers/simpleTableHelpers.ts +65 -85
  91. package/lib/helpers/state-utils.tsx +43 -0
  92. package/lib/helpers/template-utils.ts +4 -8
  93. package/lib/helpers/utils.ts +16 -8
  94. package/lib/helpers/versionHelpers.ts +1 -5
  95. package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
  96. package/lib/infra/ActionButtons/index.tsx +1 -1
  97. package/lib/infra/Assignment/Assignment.tsx +99 -84
  98. package/lib/infra/Assignment/index.tsx +1 -1
  99. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  100. package/lib/infra/AssignmentCard/index.tsx +1 -1
  101. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
  102. package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
  103. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  104. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
  105. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  106. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
  107. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  108. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  109. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  110. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  111. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
  112. package/lib/infra/Containers/helpers.ts +6 -0
  113. package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
  114. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
  115. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
  116. package/lib/infra/DeferLoad/index.tsx +1 -1
  117. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
  118. package/lib/infra/MultiStep/MultiStep.css +11 -15
  119. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  120. package/lib/infra/MultiStep/index.tsx +1 -1
  121. package/lib/infra/NavBar/NavBar.css +103 -105
  122. package/lib/infra/NavBar/NavBar.tsx +28 -43
  123. package/lib/infra/Reference/Reference.tsx +16 -22
  124. package/lib/infra/Region/Region.tsx +9 -9
  125. package/lib/infra/RootContainer/RootContainer.tsx +82 -125
  126. package/lib/infra/RootContainer/index.tsx +1 -1
  127. package/lib/infra/Stages/Stages.tsx +38 -39
  128. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  129. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  130. package/lib/infra/View/View.tsx +34 -65
  131. package/lib/template/AppShell/AppShell.css +22 -23
  132. package/lib/template/AppShell/AppShell.tsx +51 -69
  133. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  134. package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
  135. package/lib/template/CaseSummary/config-ext.json +1 -2
  136. package/lib/template/CaseView/CaseView.tsx +122 -114
  137. package/lib/template/CaseView/config-ext.json +1 -2
  138. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
  139. package/lib/template/Confirmation/Confirmation.tsx +25 -53
  140. package/lib/template/Confirmation/config-ext.json +1 -2
  141. package/lib/template/DataReference/DataReference.tsx +112 -140
  142. package/lib/template/DataReference/config-ext.json +1 -2
  143. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  144. package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
  145. package/lib/template/DefaultForm/config-ext.json +1 -2
  146. package/lib/template/DefaultForm/utils/index.ts +33 -0
  147. package/lib/template/Details/Details/Details.tsx +24 -28
  148. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  149. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  151. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  152. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  153. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  154. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  155. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  156. package/lib/template/Details/DynamicTabs/config.json +36 -0
  157. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  158. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
  159. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  160. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  161. package/lib/template/ListPage/ListPage.tsx +12 -16
  162. package/lib/template/ListPage/config-ext.json +1 -2
  163. package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
  164. package/lib/template/ListView/ListView.tsx +245 -306
  165. package/lib/template/ListView/config-ext.json +1 -2
  166. package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
  167. package/lib/template/ListView/{utils.js → utils.ts} +202 -91
  168. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
  169. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  170. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  171. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  172. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  173. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  174. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  175. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  176. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  177. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  179. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  180. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  181. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  182. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  183. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  184. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  185. package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
  186. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
  187. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  188. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
  189. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
  190. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  191. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  192. package/lib/template/SubTabs/config-ext.json +1 -2
  193. package/lib/template/SubTabs/tabUtils.ts +2 -7
  194. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  195. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  196. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  197. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  198. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  199. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  200. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  201. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  202. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  203. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  204. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  205. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  206. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  207. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  208. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  209. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  210. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  211. package/lib/template/WssNavBar/WssNavBar.tsx +33 -17
  212. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  213. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  214. package/lib/widget/Attachment/Attachment.css +75 -4
  215. package/lib/widget/Attachment/Attachment.tsx +370 -388
  216. package/lib/widget/Attachment/index.tsx +1 -1
  217. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  218. package/lib/widget/CaseHistory/config-ext.json +1 -2
  219. package/lib/widget/CaseHistory/index.tsx +1 -1
  220. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  221. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  222. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
  223. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  224. package/lib/widget/Followers/Followers.tsx +27 -25
  225. package/lib/widget/Followers/config-ext.json +1 -2
  226. package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
  227. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  228. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
  229. package/lib/widget/SummaryItem/index.tsx +1 -1
  230. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  231. package/lib/widget/ToDo/ToDo.css +4 -4
  232. package/lib/widget/ToDo/ToDo.tsx +80 -116
  233. package/lib/widget/ToDo/config-ext.json +1 -2
  234. package/package.json +5 -2
  235. package/lib/helpers/auth.js +0 -483
  236. package/lib/helpers/authManager.js +0 -631
  237. package/lib/helpers/config_access.js +0 -268
  238. package/lib/helpers/formatters/Boolean.js +0 -38
  239. package/lib/helpers/formatters/CurrencyMap.js +0 -908
  240. package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
@@ -1,6 +1,17 @@
1
- import React from 'react';
1
+ import { PropsWithChildren, useState } from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
3
  import { makeStyles } from '@material-ui/core/styles';
4
+ import KeyboardArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';
5
+ import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown';
6
+
7
+ // FieldGroupProps is one of the few components that does NOT have getPConnect.
8
+ // So, no need to extend PConnProps
9
+ interface FieldGroupProps {
10
+ // If any, enter additional props that only exist on this component
11
+ name?: string;
12
+ collapsible?: boolean;
13
+ instructions?: string;
14
+ }
4
15
 
5
16
  const useStyles = makeStyles(theme => ({
6
17
  root: {
@@ -16,12 +27,22 @@ const useStyles = makeStyles(theme => ({
16
27
  },
17
28
  fullWidth: {
18
29
  width: '100%'
30
+ },
31
+ fieldGroupHeader: {
32
+ display: 'flex',
33
+ alignItems: 'center',
34
+ gap: '5px',
35
+ cursor: collapsible => (collapsible ? 'pointer' : 'auto')
36
+ },
37
+ instructionText: {
38
+ padding: '5px 0'
19
39
  }
20
40
  }));
21
41
 
22
- const FieldGroup = props => {
23
- const { children, name } = props;
24
- const classes = useStyles();
42
+ export default function FieldGroup(props: PropsWithChildren<FieldGroupProps>) {
43
+ const { children, name, collapsible = false, instructions } = props;
44
+ const classes = useStyles(collapsible);
45
+ const [collapsed, setCollapsed] = useState(false);
25
46
 
26
47
  const descAndChildren = (
27
48
  <Grid container>
@@ -29,20 +50,31 @@ const FieldGroup = props => {
29
50
  </Grid>
30
51
  );
31
52
 
53
+ const headerClickHandler = () => {
54
+ setCollapsed(current => !current);
55
+ };
56
+
32
57
  return (
33
- <React.Fragment>
34
- <Grid container spacing={4} justifyContent='space-between'>
35
- <Grid item style={{ width: '100%' }}>
36
- {name && (
37
- <div className={classes.fieldMargin}>
38
- <b>{props.name}</b>
39
- </div>
40
- )}
41
- {descAndChildren}
42
- </Grid>
58
+ <Grid container spacing={4} justifyContent='space-between'>
59
+ <Grid item style={{ width: '100%' }}>
60
+ {name && (
61
+ <div className={classes.fieldMargin}>
62
+ {collapsible ? (
63
+ <span id='field-group-header' className={classes.fieldGroupHeader} onClick={headerClickHandler}>
64
+ {collapsed ? <KeyboardArrowRightIcon /> : <KeyboardArrowDownIcon />}
65
+ <b>{name}</b>
66
+ </span>
67
+ ) : (
68
+ <b>{name}</b>
69
+ )}
70
+ </div>
71
+ )}
72
+ {instructions && instructions !== 'none' && (
73
+ // eslint-disable-next-line react/no-danger
74
+ <div key='instructions' className={classes.instructionText} dangerouslySetInnerHTML={{ __html: instructions }} />
75
+ )}
76
+ {!collapsed && descAndChildren}
43
77
  </Grid>
44
- </React.Fragment>
78
+ </Grid>
45
79
  );
46
- };
47
-
48
- export default FieldGroup;
80
+ }
@@ -1,20 +1,22 @@
1
- import React from 'react';
2
-
3
1
  import Grid from '@material-ui/core/Grid';
4
2
  import Divider from '@material-ui/core/Divider';
5
3
  import Link from '@material-ui/core/Link';
6
4
 
7
5
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
8
6
 
9
- declare const PCore: any;
7
+ // FieldGroupList is one of the few components that does NOT have getPConnect.
8
+ // So, no need to extend PConnProps
9
+ interface FieldGroupListProps {
10
+ // If any, enter additional props that only exist on this component
11
+ items: any[] | any;
12
+ onDelete: any;
13
+ onAdd: any;
14
+ }
10
15
 
11
- const FieldGroupList = props => {
16
+ export default function FieldGroupList(props: FieldGroupListProps) {
12
17
  let menuIconOverride$ = 'trash';
13
18
  if (menuIconOverride$) {
14
- menuIconOverride$ = Utils.getImageSrc(
15
- menuIconOverride$,
16
- PCore.getAssetLoader().getStaticServerUrl()
17
- );
19
+ menuIconOverride$ = Utils.getImageSrc(menuIconOverride$, Utils.getSDKStaticConentUrl());
18
20
  }
19
21
 
20
22
  return (
@@ -30,11 +32,12 @@ const FieldGroupList = props => {
30
32
  style={{ float: 'right' }}
31
33
  className='psdk-utility-button'
32
34
  id={`delete-row-${item.id}`}
35
+ aria-label='Delete Row'
33
36
  onClick={() => {
34
37
  props.onDelete(item.id);
35
38
  }}
36
39
  >
37
- <img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$}></img>
40
+ <img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$} />
38
41
  </button>
39
42
  )}
40
43
  {item.children}
@@ -52,6 +55,4 @@ const FieldGroupList = props => {
52
55
  </Grid>
53
56
  </Grid>
54
57
  );
55
- };
56
-
57
- export default FieldGroupList;
58
+ }
@@ -1,9 +1,16 @@
1
- import React from 'react';
2
-
3
1
  import Grid from '@material-ui/core/Grid';
4
2
  import Typography from '@material-ui/core/Typography';
5
3
  import { makeStyles } from '@material-ui/core/styles';
6
4
 
5
+ // FieldValueList is one of the few components that does NOT have getPConnect.
6
+ // So, no need to extend PConnProps
7
+ interface FieldValueListProps {
8
+ // If any, enter additional props that only exist on this component
9
+ name?: string;
10
+ value: any;
11
+ variant?: string;
12
+ }
13
+
7
14
  const useStyles = makeStyles(theme => ({
8
15
  root: {
9
16
  marginRight: theme.spacing(1),
@@ -37,17 +44,13 @@ function formatItemValue(value) {
37
44
  return formattedVal;
38
45
  }
39
46
 
40
- const FieldValueList = props => {
47
+ export default function FieldValueList(props: FieldValueListProps) {
41
48
  const { name, value, variant = 'inline' } = props;
42
49
  const classes = useStyles();
43
50
 
44
51
  function getGridItemLabel() {
45
52
  return (
46
- <Grid
47
- item
48
- xs={variant === 'stacked' ? 12 : 6}
49
- className={variant === 'stacked' ? classes.noPaddingBottom : ''}
50
- >
53
+ <Grid item xs={variant === 'stacked' ? 12 : 6} className={variant === 'stacked' ? classes.noPaddingBottom : ''}>
51
54
  <Typography variant='body2' component='span' className={`${classes.fieldLabel}`}>
52
55
  {name}
53
56
  </Typography>
@@ -59,16 +62,8 @@ const FieldValueList = props => {
59
62
  const formattedValue = formatItemValue(value);
60
63
 
61
64
  return (
62
- <Grid
63
- item
64
- xs={variant === 'stacked' ? 12 : 6}
65
- className={variant === 'stacked' ? classes.noPaddingTop : ''}
66
- >
67
- <Typography
68
- variant={variant === 'stacked' ? 'h6' : 'body2'}
69
- component='span'
70
- className={classes.fieldValue}
71
- >
65
+ <Grid item xs={variant === 'stacked' ? 12 : 6} className={variant === 'stacked' ? classes.noPaddingTop : ''}>
66
+ <Typography variant={variant === 'stacked' ? 'h6' : 'body2'} component='span' className={classes.fieldValue}>
72
67
  {formattedValue}
73
68
  </Typography>
74
69
  </Grid>
@@ -76,13 +71,9 @@ const FieldValueList = props => {
76
71
  }
77
72
 
78
73
  return (
79
- <React.Fragment>
80
- <Grid container spacing={4} justifyContent='space-between'>
81
- {getGridItemLabel()}
82
- {getGridItemValue()}
83
- </Grid>
84
- </React.Fragment>
74
+ <Grid container spacing={4} justifyContent='space-between'>
75
+ {getGridItemLabel()}
76
+ {getGridItemValue()}
77
+ </Grid>
85
78
  );
86
- };
87
-
88
- export default FieldValueList;
79
+ }
@@ -1,127 +1,143 @@
1
- import React, {useState} from "react";
2
- import PropTypes from "prop-types";
1
+ import React, { useState } from 'react';
3
2
  import TextField from '@material-ui/core/TextField';
4
3
  import Popover from '@material-ui/core/Popover';
5
4
  import Grid from '@material-ui/core/Grid';
6
5
  import Typography from '@material-ui/core/Typography';
7
-
8
6
  import { makeStyles } from '@material-ui/core/styles';
9
7
 
10
8
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
9
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
+
11
+ // Operator is one of the few components that does NOT have getPConnect.
12
+ // So, no need to extend PConnProps
13
+ interface OperatorProps extends PConnProps {
14
+ // If any, enter additional props that only exist on this component
15
+ label: string;
16
+ createDateTime: string;
17
+ createLabel: string;
18
+ createOperator: { userName: string; userId: string };
19
+ updateDateTime: string;
20
+ updateLabel: string;
21
+ updateOperator: { userName: string; userId: string };
22
+ }
11
23
 
12
- declare const PCore: any;
13
-
14
- const useStyles = makeStyles((theme) => ({
24
+ const useStyles = makeStyles(theme => ({
15
25
  root: {
16
26
  padding: theme.spacing(1),
17
- margin: theme.spacing(1),
27
+ margin: theme.spacing(1)
18
28
  },
19
29
  popover: {
20
30
  padding: theme.spacing(1),
21
- margin: theme.spacing(1),
31
+ margin: theme.spacing(1)
22
32
  }
23
33
  }));
24
34
 
25
- export default function Operator(props) {
35
+ export default function Operator(props: OperatorProps) {
26
36
  // const componentName = "Operator";
27
- const { caseOpConfig } = props;
28
37
  const classes = useStyles();
29
38
 
30
- const fieldLabel = caseOpConfig.label.toLowerCase();
31
- let caseOpLabel = "---";
32
- let caseOpName = "---";
33
- let caseOpId = "";
34
- let caseTime = null;
35
-
36
- if (fieldLabel === "create operator") {
37
- caseOpLabel = caseOpConfig.createLabel;
38
- caseOpName = caseOpConfig.createOperator.userName;
39
- caseTime = caseOpConfig.createDateTime;
40
- caseOpId = caseOpConfig.createOperator.userId;
41
- } else if (fieldLabel === "update operator") {
42
- caseOpLabel = caseOpConfig.updateLabel;
43
- caseOpName = caseOpConfig.updateOperator.userName;
44
- caseTime = caseOpConfig.updateDateTime;
45
- caseOpId = caseOpConfig.updateOperator.userId;
39
+ const fieldLabel = props.label.toLowerCase();
40
+ let caseOpLabel = '---';
41
+ let caseOpName = '---';
42
+ let caseOpId = '';
43
+ let caseTime = '';
44
+
45
+ if (fieldLabel === 'create operator') {
46
+ caseOpLabel = props.createLabel;
47
+ caseOpName = props.createOperator.userName;
48
+ caseTime = props.createDateTime;
49
+ caseOpId = props.createOperator.userId;
50
+ } else if (fieldLabel === 'update operator') {
51
+ caseOpLabel = props.updateLabel;
52
+ caseOpName = props.updateOperator.userName;
53
+ caseTime = props.updateDateTime;
54
+ caseOpId = props.updateOperator.userId;
46
55
  }
47
56
 
48
57
  // Popover-related
49
58
  const [popoverAnchorEl, setPopoverAnchorEl] = useState(null);
50
- const [popoverFields, setPopoverFields] = useState<Array<any>>([]);
59
+ const [popoverFields, setPopoverFields] = useState<any[]>([]);
51
60
 
52
61
  const popoverOpen = Boolean(popoverAnchorEl);
53
62
  const popoverId = popoverOpen ? 'operator-details-popover' : undefined;
54
63
 
55
- const handlePopoverClose = (() => {
64
+ const handlePopoverClose = () => {
56
65
  setPopoverAnchorEl(null);
57
- })
66
+ };
58
67
 
59
68
  function showOperatorDetails(event) {
60
-
61
69
  const operatorPreviewPromise = PCore.getUserApi().getOperatorDetails(caseOpId);
70
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
71
+ const localeCategory = 'Operator';
62
72
 
63
- operatorPreviewPromise.then((res) => {
64
- const fillerString = "---";
73
+ operatorPreviewPromise.then((res: any) => {
74
+ const fillerString = '---';
65
75
  let fields: any = [];
66
- if (
67
- res.data &&
68
- res.data.pyOperatorInfo &&
69
- res.data.pyOperatorInfo.pyUserName
70
- ) {
76
+ if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
71
77
  fields = [
72
78
  {
73
- id: "pyPosition",
74
- name: "Position",
79
+ id: 'pyPosition',
80
+ name: localizedVal('Position', localeCategory),
75
81
  value: res.data.pyOperatorInfo.pyPosition ? res.data.pyOperatorInfo.pyPosition : fillerString
76
82
  },
77
83
  {
78
- id: "pyOrganization",
79
- name: "Organization",
84
+ id: 'pyOrganization',
85
+ name: localizedVal('Organization', localeCategory),
80
86
  value: res.data.pyOperatorInfo.pyOrganization ? res.data.pyOperatorInfo.pyOrganization : fillerString
81
87
  },
82
88
  {
83
- id: "ReportToUserName",
84
- name: "Reports to",
89
+ id: 'ReportToUserName',
90
+ name: localizedVal('Reports to', localeCategory),
85
91
  value: res.data.pyOperatorInfo.pyReportToUserName ? res.data.pyOperatorInfo.pyReportToUserName : fillerString
86
92
  },
87
93
  {
88
- id: "pyTelephone",
89
- name: "Telephone",
90
- value: res.data.pyOperatorInfo.pyTelephone ? <a href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>{res.data.pyOperatorInfo.pyTelephone}</a> : fillerString
94
+ id: 'pyTelephone',
95
+ name: localizedVal('Telephone', localeCategory),
96
+ value: res.data.pyOperatorInfo.pyTelephone ? (
97
+ <a href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>{res.data.pyOperatorInfo.pyTelephone}</a>
98
+ ) : (
99
+ fillerString
100
+ )
91
101
  },
92
102
  {
93
- id: "pyEmailAddress",
94
- name: "Email address",
95
- value: res.data.pyOperatorInfo.pyEmailAddress ? <a href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>{res.data.pyOperatorInfo.pyEmailAddress}</a> : fillerString
103
+ id: 'pyEmailAddress',
104
+ name: localizedVal('Email address', localeCategory),
105
+ value: res.data.pyOperatorInfo.pyEmailAddress ? (
106
+ <a href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>{res.data.pyOperatorInfo.pyEmailAddress}</a>
107
+ ) : (
108
+ fillerString
109
+ )
96
110
  }
97
111
  ];
98
112
  } else {
99
113
  // eslint-disable-next-line no-console
100
- console.log(`Operator: PCore.getUserApi().getOperatorDetails(${caseOpId}); returned empty res.data.pyOperatorInfo.pyUserName - adding default`);
114
+ console.log(
115
+ `Operator: PCore.getUserApi().getOperatorDetails(${caseOpId}); returned empty res.data.pyOperatorInfo.pyUserName - adding default`
116
+ );
101
117
  fields = [
102
118
  {
103
- id: "pyPosition",
104
- name: "Position",
119
+ id: 'pyPosition',
120
+ name: localizedVal('Position', localeCategory),
105
121
  value: fillerString
106
122
  },
107
123
  {
108
- id: "pyOrganization",
109
- name: "Organization",
124
+ id: 'pyOrganization',
125
+ name: localizedVal('Organization', localeCategory),
110
126
  value: fillerString
111
127
  },
112
128
  {
113
- id: "ReportToUserName",
114
- name: "Reports to",
129
+ id: 'ReportToUserName',
130
+ name: localizedVal('Reports to', localeCategory),
115
131
  value: fillerString
116
132
  },
117
133
  {
118
- id: "pyTelephone",
119
- name: "Telephone",
134
+ id: 'pyTelephone',
135
+ name: localizedVal('Telephone', localeCategory),
120
136
  value: fillerString
121
137
  },
122
138
  {
123
- id: "pyEmailAddress",
124
- name: "Email address",
139
+ id: 'pyEmailAddress',
140
+ name: localizedVal('Email address', localeCategory),
125
141
  value: fillerString
126
142
  }
127
143
  ];
@@ -143,23 +159,33 @@ export default function Operator(props) {
143
159
  }
144
160
 
145
161
  // There are fields, so build the grid.
146
- return <Grid container className={classes.popover} spacing={1}>
147
- <Grid item xs={12}><Typography variant="h6">{caseOpName}</Typography></Grid>
148
- {popoverFields.map((field) => {
149
- return <React.Fragment key={field.id}>
150
- <Grid container item xs={12} spacing={1}>
151
- <Grid item xs={6}><Typography variant="caption">{field.name}</Typography></Grid>
152
- <Grid item xs={6}><Typography variant="subtitle2">{field.value}</Typography></Grid>
153
- </Grid>
154
- </React.Fragment>
155
- })}
156
- </Grid>
157
-
162
+ return (
163
+ <Grid container className={classes.popover} spacing={1}>
164
+ <Grid item xs={12}>
165
+ <Typography variant='h6'>{caseOpName}</Typography>
166
+ </Grid>
167
+ {popoverFields.map(field => {
168
+ return (
169
+ <React.Fragment key={field.id}>
170
+ <Grid container item xs={12} spacing={1}>
171
+ <Grid item xs={6}>
172
+ <Typography variant='caption'>{field.name}</Typography>
173
+ </Grid>
174
+ <Grid item xs={6}>
175
+ <Typography variant='subtitle2'>{field.value}</Typography>
176
+ </Grid>
177
+ </Grid>
178
+ </React.Fragment>
179
+ );
180
+ })}
181
+ </Grid>
182
+ );
158
183
  }
159
184
 
160
185
  // End of popover-related
161
186
 
162
- return <React.Fragment>
187
+ return (
188
+ <>
163
189
  <TextField
164
190
  defaultValue={caseOpName}
165
191
  label={caseOpLabel}
@@ -167,30 +193,23 @@ export default function Operator(props) {
167
193
  InputProps={{
168
194
  readOnly: true,
169
195
  disableUnderline: true,
170
- inputProps: {style: {cursor: 'pointer'}}
196
+ inputProps: { style: { cursor: 'pointer' } }
171
197
  }}
172
198
  />
173
199
  <br />
174
- {Utils.generateDateTime(caseTime, "DateTime-Since")}
200
+ {Utils.generateDateTime(caseTime, 'DateTime-Since')}
175
201
 
176
202
  <Popover
177
203
  id={popoverId}
178
204
  open={popoverOpen}
179
205
  anchorEl={popoverAnchorEl}
180
206
  onClose={handlePopoverClose}
181
- anchorOrigin={{ vertical: 'bottom', horizontal: 'center'}}
182
- transformOrigin={{ vertical: 'top', horizontal: 'center'}}
183
- PaperProps={{ style: {maxWidth: '45ch'}}}
207
+ anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
208
+ transformOrigin={{ vertical: 'top', horizontal: 'center' }}
209
+ PaperProps={{ style: { maxWidth: '45ch' } }}
184
210
  >
185
211
  {getPopoverGrid()}
186
212
  </Popover>
187
- </React.Fragment>;
188
-
189
- }
190
-
191
- Operator.defaultProps = {
213
+ </>
214
+ );
192
215
  }
193
-
194
- Operator.propTypes = {
195
- caseOpConfig: PropTypes.object.isRequired,
196
- };
@@ -1,31 +1,33 @@
1
- import React from "react";
2
- // import PropTypes from "prop-types";
3
- import { Card, CardContent, CardHeader, Typography } from "@material-ui/core";
1
+ import { PropsWithChildren } from 'react';
2
+ import { Card, CardContent, CardHeader, Typography } from '@material-ui/core';
4
3
  import { makeStyles } from '@material-ui/core/styles';
5
4
 
6
- const useStyles = makeStyles((theme) => ({
5
+ // Pulse is one of the few components that does NOT have getPConnect.
6
+ // So, no need to extend PConnProps
7
+ interface PulseProps {
8
+ // If any, enter additional props that only exist on this component
9
+ }
10
+
11
+ const useStyles = makeStyles(theme => ({
7
12
  root: {
8
13
  marginTop: theme.spacing(1),
9
14
  marginBottom: theme.spacing(1),
10
- borderLeft: "6px solid",
15
+ borderLeft: '6px solid',
11
16
  borderLeftColor: theme.palette.primary.light
12
- },
17
+ }
13
18
  }));
14
19
 
15
- export default function Pulse(/* props */) {
16
- // const { children } = props;
20
+ export default function Pulse(props: PropsWithChildren<PulseProps>) {
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ const { children } = props;
17
23
  const classes = useStyles();
18
24
 
19
25
  return (
20
- <Card className={classes.root}>
21
- <CardHeader title={<Typography variant="h6">Pulse</Typography>} />
22
- <CardContent>
23
- <Typography>Pulse</Typography>
24
- </CardContent>
25
- </Card>
26
- );
26
+ <Card className={classes.root}>
27
+ <CardHeader title={<Typography variant='h6'>Pulse</Typography>} />
28
+ <CardContent>
29
+ <Typography>Pulse</Typography>
30
+ </CardContent>
31
+ </Card>
32
+ );
27
33
  }
28
-
29
- // Pulse.propTypes = {
30
- // children: PropTypes.arrayOf(PropTypes.node).isRequired
31
- // };