@pega/react-sdk-overrides 8.23.11 → 23.1.11

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 (233) 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 +12 -16
  5. package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
  6. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  8. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  9. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  10. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  11. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +14 -11
  12. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  13. package/lib/designSystemExtension/Operator/Operator.tsx +100 -84
  14. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  15. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  16. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  17. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  18. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  19. package/lib/field/AutoComplete/config-ext.json +2 -3
  20. package/lib/field/CancelAlert/CancelAlert.tsx +100 -81
  21. package/lib/field/CancelAlert/index.tsx +1 -1
  22. package/lib/field/Checkbox/Checkbox.tsx +27 -16
  23. package/lib/field/Checkbox/config-ext.json +2 -3
  24. package/lib/field/Currency/Currency.tsx +30 -47
  25. package/lib/field/Currency/config-ext.json +2 -3
  26. package/lib/field/Currency/currency-utils.ts +10 -21
  27. package/lib/field/Date/Date.tsx +24 -13
  28. package/lib/field/Date/config-ext.json +2 -3
  29. package/lib/field/DateTime/DateTime.tsx +21 -10
  30. package/lib/field/DateTime/config-ext.json +1 -2
  31. package/lib/field/Decimal/Decimal.tsx +31 -40
  32. package/lib/field/Decimal/config-ext.json +1 -2
  33. package/lib/field/Decimal/index.tsx +1 -1
  34. package/lib/field/Dropdown/Dropdown.tsx +128 -31
  35. package/lib/field/Dropdown/config-ext.json +1 -2
  36. package/lib/field/Email/Email.tsx +16 -7
  37. package/lib/field/Email/config-ext.json +1 -2
  38. package/lib/field/Email/index.tsx +1 -1
  39. package/lib/field/Group/Group.tsx +39 -0
  40. package/lib/field/Group/config-ext.json +7 -0
  41. package/lib/field/Group/index.tsx +1 -0
  42. package/lib/field/Integer/Integer.tsx +15 -6
  43. package/lib/field/Integer/config-ext.json +1 -2
  44. package/lib/field/Percentage/Percentage.tsx +52 -39
  45. package/lib/field/Percentage/config-ext.json +1 -2
  46. package/lib/field/Phone/Phone.tsx +15 -6
  47. package/lib/field/Phone/index.tsx +1 -1
  48. package/lib/field/RadioButtons/RadioButtons.tsx +26 -34
  49. package/lib/field/RadioButtons/config-ext.json +1 -2
  50. package/lib/field/RichText/RichText.tsx +96 -0
  51. package/lib/field/RichText/index.tsx +1 -0
  52. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  53. package/lib/field/ScalarList/config-ext.json +7 -0
  54. package/lib/field/ScalarList/index.tsx +1 -0
  55. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  56. package/lib/field/SemanticLink/config-ext.json +1 -2
  57. package/lib/field/SemanticLink/utils.ts +8 -11
  58. package/lib/field/TextArea/TextArea.tsx +15 -5
  59. package/lib/field/TextArea/config-ext.json +1 -2
  60. package/lib/field/TextContent/TextContent.tsx +9 -2
  61. package/lib/field/TextContent/config-ext.json +1 -2
  62. package/lib/field/TextInput/TextInput.tsx +18 -7
  63. package/lib/field/TextInput/config-ext.json +1 -2
  64. package/lib/field/TextInput/index.tsx +1 -1
  65. package/lib/field/Time/Time.tsx +14 -19
  66. package/lib/field/Time/config-ext.json +1 -2
  67. package/lib/field/URL/URL.tsx +15 -6
  68. package/lib/field/URL/config-ext.json +1 -2
  69. package/lib/field/URL/index.tsx +1 -1
  70. package/lib/field/UserReference/UserReference.tsx +52 -60
  71. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  72. package/lib/field/UserReference/config-ext.json +1 -2
  73. package/lib/helpers/attachmentHelpers.ts +15 -10
  74. package/lib/helpers/case-utils.tsx +5 -10
  75. package/lib/helpers/common-utils.ts +6 -2
  76. package/lib/helpers/data_page.ts +3 -7
  77. package/lib/helpers/date-format-utils.ts +4 -4
  78. package/lib/helpers/event-utils.ts +4 -4
  79. package/lib/helpers/field-group-utils.ts +6 -8
  80. package/lib/helpers/formatters/Boolean.ts +9 -26
  81. package/lib/helpers/formatters/Currency.ts +22 -28
  82. package/lib/helpers/formatters/CurrencyMap.ts +512 -505
  83. package/lib/helpers/formatters/Date.ts +20 -26
  84. package/lib/helpers/formatters/common.ts +2 -7
  85. package/lib/helpers/formatters/index.ts +29 -22
  86. package/lib/helpers/reactContextHelpers.ts +2 -2
  87. package/lib/helpers/simpleTableHelpers.ts +63 -87
  88. package/lib/helpers/state-utils.tsx +5 -12
  89. package/lib/helpers/template-utils.ts +4 -10
  90. package/lib/helpers/utils.ts +5 -5
  91. package/lib/helpers/versionHelpers.ts +1 -7
  92. package/lib/infra/ActionButtons/ActionButtons.tsx +44 -45
  93. package/lib/infra/ActionButtons/index.tsx +1 -1
  94. package/lib/infra/Assignment/Assignment.tsx +102 -86
  95. package/lib/infra/Assignment/index.tsx +1 -1
  96. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  97. package/lib/infra/AssignmentCard/index.tsx +1 -1
  98. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +93 -240
  99. package/lib/infra/Containers/FlowContainer/helpers.ts +34 -48
  100. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  101. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  103. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +229 -223
  104. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  105. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  106. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  107. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  108. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +47 -64
  109. package/lib/infra/Containers/helpers.ts +6 -0
  110. package/lib/infra/DashboardFilter/DashboardFilter.tsx +25 -54
  111. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -42
  112. package/lib/infra/DeferLoad/DeferLoad.tsx +21 -33
  113. package/lib/infra/DeferLoad/index.tsx +1 -1
  114. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -39
  115. package/lib/infra/MultiStep/MultiStep.css +11 -15
  116. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  117. package/lib/infra/MultiStep/index.tsx +1 -1
  118. package/lib/infra/NavBar/NavBar.css +103 -105
  119. package/lib/infra/NavBar/NavBar.tsx +26 -45
  120. package/lib/infra/Reference/Reference.tsx +16 -22
  121. package/lib/infra/Region/Region.tsx +9 -9
  122. package/lib/infra/RootContainer/RootContainer.tsx +75 -120
  123. package/lib/infra/RootContainer/index.tsx +1 -1
  124. package/lib/infra/Stages/Stages.tsx +36 -41
  125. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  126. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  127. package/lib/infra/View/View.tsx +25 -29
  128. package/lib/template/AppShell/AppShell.css +22 -23
  129. package/lib/template/AppShell/AppShell.tsx +47 -71
  130. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  131. package/lib/template/CaseSummary/CaseSummary.tsx +66 -19
  132. package/lib/template/CaseSummary/config-ext.json +1 -2
  133. package/lib/template/CaseView/CaseView.tsx +44 -74
  134. package/lib/template/CaseView/config-ext.json +1 -2
  135. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +66 -31
  136. package/lib/template/Confirmation/Confirmation.tsx +24 -55
  137. package/lib/template/Confirmation/config-ext.json +1 -2
  138. package/lib/template/DataReference/DataReference.tsx +112 -142
  139. package/lib/template/DataReference/config-ext.json +1 -2
  140. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  141. package/lib/template/DefaultForm/DefaultForm.tsx +15 -16
  142. package/lib/template/DefaultForm/config-ext.json +1 -2
  143. package/lib/template/Details/Details/Details.tsx +24 -28
  144. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  145. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  146. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  147. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  148. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  149. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  151. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  152. package/lib/template/Details/DynamicTabs/config.json +36 -0
  153. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  154. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +22 -35
  155. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  156. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  157. package/lib/template/ListPage/ListPage.tsx +12 -16
  158. package/lib/template/ListPage/config-ext.json +1 -2
  159. package/lib/template/ListView/DefaultViewMeta.ts +1 -3
  160. package/lib/template/ListView/ListView.tsx +247 -309
  161. package/lib/template/ListView/config-ext.json +1 -2
  162. package/lib/template/ListView/hooks.ts +24 -26
  163. package/lib/template/ListView/utils.ts +205 -94
  164. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -34
  165. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  166. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  167. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  168. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  169. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  170. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  171. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  172. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  173. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  174. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  175. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  176. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  177. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  179. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  180. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  181. package/lib/template/PromotedFilters/PromotedFilters.tsx +39 -33
  182. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +113 -15
  183. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  184. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -104
  185. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -44
  186. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  187. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  188. package/lib/template/SubTabs/config-ext.json +1 -2
  189. package/lib/template/SubTabs/tabUtils.ts +2 -9
  190. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  191. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  192. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  193. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  194. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  195. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  196. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  197. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  198. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  199. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  200. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  201. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  202. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  203. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  204. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  205. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  206. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  207. package/lib/template/WssNavBar/WssNavBar.tsx +24 -10
  208. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  209. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  210. package/lib/widget/Attachment/Attachment.css +60 -1
  211. package/lib/widget/Attachment/Attachment.tsx +379 -394
  212. package/lib/widget/Attachment/index.tsx +1 -1
  213. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  214. package/lib/widget/CaseHistory/config-ext.json +1 -2
  215. package/lib/widget/CaseHistory/index.tsx +1 -1
  216. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  217. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  218. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +322 -245
  219. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  220. package/lib/widget/Followers/Followers.tsx +27 -25
  221. package/lib/widget/Followers/config-ext.json +1 -2
  222. package/lib/widget/QuickCreate/QuickCreate.tsx +71 -39
  223. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  224. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -52
  225. package/lib/widget/SummaryItem/index.tsx +1 -1
  226. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  227. package/lib/widget/ToDo/ToDo.css +4 -4
  228. package/lib/widget/ToDo/ToDo.tsx +72 -116
  229. package/lib/widget/ToDo/config-ext.json +1 -2
  230. package/package.json +5 -2
  231. package/lib/helpers/auth.js +0 -483
  232. package/lib/helpers/authManager.js +0 -634
  233. package/lib/helpers/config_access.js +0 -259
@@ -1,18 +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
- const FieldGroupList = props => {
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
+ }
15
+
16
+ export default function FieldGroupList(props: FieldGroupListProps) {
10
17
  let menuIconOverride$ = 'trash';
11
18
  if (menuIconOverride$) {
12
- menuIconOverride$ = Utils.getImageSrc(
13
- menuIconOverride$,
14
- Utils.getSDKStaticConentUrl()
15
- );
19
+ menuIconOverride$ = Utils.getImageSrc(menuIconOverride$, Utils.getSDKStaticConentUrl());
16
20
  }
17
21
 
18
22
  return (
@@ -28,11 +32,12 @@ const FieldGroupList = props => {
28
32
  style={{ float: 'right' }}
29
33
  className='psdk-utility-button'
30
34
  id={`delete-row-${item.id}`}
35
+ aria-label='Delete Row'
31
36
  onClick={() => {
32
37
  props.onDelete(item.id);
33
38
  }}
34
39
  >
35
- <img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$}></img>
40
+ <img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$} />
36
41
  </button>
37
42
  )}
38
43
  {item.children}
@@ -50,6 +55,4 @@ const FieldGroupList = props => {
50
55
  </Grid>
51
56
  </Grid>
52
57
  );
53
- };
54
-
55
- 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,131 +1,144 @@
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
+ displayLabel?: any;
23
+ }
11
24
 
12
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
13
-
14
- declare const PCore: typeof PCoreType;
15
-
16
-
17
- const useStyles = makeStyles((theme) => ({
25
+ const useStyles = makeStyles(theme => ({
18
26
  root: {
19
27
  padding: theme.spacing(1),
20
- margin: theme.spacing(1),
28
+ margin: theme.spacing(1)
21
29
  },
22
30
  popover: {
23
31
  padding: theme.spacing(1),
24
- margin: theme.spacing(1),
32
+ margin: theme.spacing(1)
25
33
  }
26
34
  }));
27
35
 
28
- export default function Operator(props) {
36
+ export default function Operator(props: OperatorProps) {
29
37
  // const componentName = "Operator";
30
- const { caseOpConfig } = props;
31
38
  const classes = useStyles();
32
39
 
33
- const fieldLabel = caseOpConfig.label.toLowerCase();
34
- let caseOpLabel = "---";
35
- let caseOpName = "---";
36
- let caseOpId = "";
37
- let caseTime = null;
38
-
39
- if (fieldLabel === "create operator") {
40
- caseOpLabel = caseOpConfig.createLabel;
41
- caseOpName = caseOpConfig.createOperator.userName;
42
- caseTime = caseOpConfig.createDateTime;
43
- caseOpId = caseOpConfig.createOperator.userId;
44
- } else if (fieldLabel === "update operator") {
45
- caseOpLabel = caseOpConfig.updateLabel;
46
- caseOpName = caseOpConfig.updateOperator.userName;
47
- caseTime = caseOpConfig.updateDateTime;
48
- caseOpId = caseOpConfig.updateOperator.userId;
40
+ const fieldLabel = props?.label?.toLowerCase();
41
+ const displayLabel = props?.displayLabel?.toLowerCase();
42
+ let caseOpLabel = '---';
43
+ let caseOpName = '---';
44
+ let caseOpId = '';
45
+ let caseTime = '';
46
+
47
+ if (fieldLabel === 'create operator' || displayLabel === 'create operator') {
48
+ caseOpLabel = props.createLabel;
49
+ caseOpName = props.createOperator.userName;
50
+ caseTime = props.createDateTime;
51
+ caseOpId = props.createOperator.userId;
52
+ } else if (fieldLabel === 'update operator' || displayLabel === 'update operator') {
53
+ caseOpLabel = props.updateLabel;
54
+ caseOpName = props.updateOperator.userName;
55
+ caseTime = props.updateDateTime;
56
+ caseOpId = props.updateOperator.userId;
49
57
  }
50
58
 
51
59
  // Popover-related
52
60
  const [popoverAnchorEl, setPopoverAnchorEl] = useState(null);
53
- const [popoverFields, setPopoverFields] = useState<Array<any>>([]);
61
+ const [popoverFields, setPopoverFields] = useState<any[]>([]);
54
62
 
55
63
  const popoverOpen = Boolean(popoverAnchorEl);
56
64
  const popoverId = popoverOpen ? 'operator-details-popover' : undefined;
57
65
 
58
- const handlePopoverClose = (() => {
66
+ const handlePopoverClose = () => {
59
67
  setPopoverAnchorEl(null);
60
- })
68
+ };
61
69
 
62
70
  function showOperatorDetails(event) {
63
-
64
71
  const operatorPreviewPromise = PCore.getUserApi().getOperatorDetails(caseOpId);
65
72
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
66
73
  const localeCategory = 'Operator';
67
74
 
68
- operatorPreviewPromise.then((res) => {
69
- const fillerString = "---";
75
+ operatorPreviewPromise.then((res: any) => {
76
+ const fillerString = '---';
70
77
  let fields: any = [];
71
- if (
72
- res.data &&
73
- res.data.pyOperatorInfo &&
74
- res.data.pyOperatorInfo.pyUserName
75
- ) {
78
+ if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
76
79
  fields = [
77
80
  {
78
- id: "pyPosition",
79
- name: localizedVal("Position", localeCategory),
81
+ id: 'pyPosition',
82
+ name: localizedVal('Position', localeCategory),
80
83
  value: res.data.pyOperatorInfo.pyPosition ? res.data.pyOperatorInfo.pyPosition : fillerString
81
84
  },
82
85
  {
83
- id: "pyOrganization",
84
- name: localizedVal("Organization", localeCategory),
86
+ id: 'pyOrganization',
87
+ name: localizedVal('Organization', localeCategory),
85
88
  value: res.data.pyOperatorInfo.pyOrganization ? res.data.pyOperatorInfo.pyOrganization : fillerString
86
89
  },
87
90
  {
88
- id: "ReportToUserName",
91
+ id: 'ReportToUserName',
89
92
  name: localizedVal('Reports to', localeCategory),
90
93
  value: res.data.pyOperatorInfo.pyReportToUserName ? res.data.pyOperatorInfo.pyReportToUserName : fillerString
91
94
  },
92
95
  {
93
- id: "pyTelephone",
96
+ id: 'pyTelephone',
94
97
  name: localizedVal('Telephone', localeCategory),
95
- value: res.data.pyOperatorInfo.pyTelephone ? <a href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>{res.data.pyOperatorInfo.pyTelephone}</a> : fillerString
98
+ value: res.data.pyOperatorInfo.pyTelephone ? (
99
+ <a href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>{res.data.pyOperatorInfo.pyTelephone}</a>
100
+ ) : (
101
+ fillerString
102
+ )
96
103
  },
97
104
  {
98
- id: "pyEmailAddress",
105
+ id: 'pyEmailAddress',
99
106
  name: localizedVal('Email address', localeCategory),
100
- value: res.data.pyOperatorInfo.pyEmailAddress ? <a href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>{res.data.pyOperatorInfo.pyEmailAddress}</a> : fillerString
107
+ value: res.data.pyOperatorInfo.pyEmailAddress ? (
108
+ <a href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>{res.data.pyOperatorInfo.pyEmailAddress}</a>
109
+ ) : (
110
+ fillerString
111
+ )
101
112
  }
102
113
  ];
103
114
  } else {
104
115
  // eslint-disable-next-line no-console
105
- console.log(`Operator: PCore.getUserApi().getOperatorDetails(${caseOpId}); returned empty res.data.pyOperatorInfo.pyUserName - adding default`);
116
+ console.log(
117
+ `Operator: PCore.getUserApi().getOperatorDetails(${caseOpId}); returned empty res.data.pyOperatorInfo.pyUserName - adding default`
118
+ );
106
119
  fields = [
107
120
  {
108
- id: "pyPosition",
109
- name: localizedVal("Position", localeCategory),
121
+ id: 'pyPosition',
122
+ name: localizedVal('Position', localeCategory),
110
123
  value: fillerString
111
124
  },
112
125
  {
113
- id: "pyOrganization",
114
- name: localizedVal("Organization", localeCategory),
126
+ id: 'pyOrganization',
127
+ name: localizedVal('Organization', localeCategory),
115
128
  value: fillerString
116
129
  },
117
130
  {
118
- id: "ReportToUserName",
131
+ id: 'ReportToUserName',
119
132
  name: localizedVal('Reports to', localeCategory),
120
133
  value: fillerString
121
134
  },
122
135
  {
123
- id: "pyTelephone",
136
+ id: 'pyTelephone',
124
137
  name: localizedVal('Telephone', localeCategory),
125
138
  value: fillerString
126
139
  },
127
140
  {
128
- id: "pyEmailAddress",
141
+ id: 'pyEmailAddress',
129
142
  name: localizedVal('Email address', localeCategory),
130
143
  value: fillerString
131
144
  }
@@ -148,23 +161,33 @@ export default function Operator(props) {
148
161
  }
149
162
 
150
163
  // There are fields, so build the grid.
151
- return <Grid container className={classes.popover} spacing={1}>
152
- <Grid item xs={12}><Typography variant="h6">{caseOpName}</Typography></Grid>
153
- {popoverFields.map((field) => {
154
- return <React.Fragment key={field.id}>
155
- <Grid container item xs={12} spacing={1}>
156
- <Grid item xs={6}><Typography variant="caption">{field.name}</Typography></Grid>
157
- <Grid item xs={6}><Typography variant="subtitle2">{field.value}</Typography></Grid>
158
- </Grid>
159
- </React.Fragment>
160
- })}
161
- </Grid>
162
-
164
+ return (
165
+ <Grid container className={classes.popover} spacing={1}>
166
+ <Grid item xs={12}>
167
+ <Typography variant='h6'>{caseOpName}</Typography>
168
+ </Grid>
169
+ {popoverFields.map(field => {
170
+ return (
171
+ <React.Fragment key={field.id}>
172
+ <Grid container item xs={12} spacing={1}>
173
+ <Grid item xs={6}>
174
+ <Typography variant='caption'>{field.name}</Typography>
175
+ </Grid>
176
+ <Grid item xs={6}>
177
+ <Typography variant='subtitle2'>{field.value}</Typography>
178
+ </Grid>
179
+ </Grid>
180
+ </React.Fragment>
181
+ );
182
+ })}
183
+ </Grid>
184
+ );
163
185
  }
164
186
 
165
187
  // End of popover-related
166
188
 
167
- return <React.Fragment>
189
+ return (
190
+ <>
168
191
  <TextField
169
192
  defaultValue={caseOpName}
170
193
  label={caseOpLabel}
@@ -172,30 +195,23 @@ export default function Operator(props) {
172
195
  InputProps={{
173
196
  readOnly: true,
174
197
  disableUnderline: true,
175
- inputProps: {style: {cursor: 'pointer'}}
198
+ inputProps: { style: { cursor: 'pointer' } }
176
199
  }}
177
200
  />
178
201
  <br />
179
- {Utils.generateDateTime(caseTime, "DateTime-Since")}
202
+ {Utils.generateDateTime(caseTime, 'DateTime-Since')}
180
203
 
181
204
  <Popover
182
205
  id={popoverId}
183
206
  open={popoverOpen}
184
207
  anchorEl={popoverAnchorEl}
185
208
  onClose={handlePopoverClose}
186
- anchorOrigin={{ vertical: 'bottom', horizontal: 'center'}}
187
- transformOrigin={{ vertical: 'top', horizontal: 'center'}}
188
- PaperProps={{ style: {maxWidth: '45ch'}}}
209
+ anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
210
+ transformOrigin={{ vertical: 'top', horizontal: 'center' }}
211
+ PaperProps={{ style: { maxWidth: '45ch' } }}
189
212
  >
190
213
  {getPopoverGrid()}
191
214
  </Popover>
192
- </React.Fragment>;
193
-
215
+ </>
216
+ );
194
217
  }
195
-
196
- Operator.defaultProps = {
197
- }
198
-
199
- Operator.propTypes = {
200
- caseOpConfig: PropTypes.object.isRequired,
201
- };
@@ -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
- // };
@@ -0,0 +1,122 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Editor } from '@tinymce/tinymce-react';
3
+ import { FormControl, FormHelperText, InputLabel, makeStyles } from '@material-ui/core';
4
+
5
+ import { useAfterInitialEffect, useConsolidatedRef, useUID } from '@pega/react-sdk-components/lib/hooks';
6
+
7
+ const useStyles = makeStyles(theme => ({
8
+ fieldLabel: {
9
+ position: 'relative',
10
+ transform: 'translate(0, 0px) scale(1)',
11
+ marginBottom: '5px',
12
+ color: theme.palette.text.secondary
13
+ }
14
+ }));
15
+
16
+ interface RichTextEditorProps {
17
+ id?: string;
18
+ defaultValue: string;
19
+ label: string;
20
+ labelHidden: boolean;
21
+ info: string;
22
+ testId: string;
23
+ placeholder: string;
24
+ disabled: boolean;
25
+ required: boolean;
26
+ readOnly: boolean;
27
+ error: boolean;
28
+ onBlur: React.EventHandler<any>;
29
+ onChange: React.EventHandler<any>;
30
+ }
31
+
32
+ const RichTextEditor = forwardRef(function RichTextEditor(props: RichTextEditorProps, ref) {
33
+ const classes = useStyles();
34
+ const uid = useUID();
35
+ const { id = uid, defaultValue, label, labelHidden, info, testId, placeholder, disabled, required, readOnly, error, onBlur, onChange } = props;
36
+
37
+ const editorRef: any = useConsolidatedRef(ref);
38
+ let richTextComponent: any = null;
39
+
40
+ useAfterInitialEffect(() => {
41
+ editorRef?.current.mode.set(readOnly || disabled ? 'readonly' : 'design');
42
+ }, [readOnly, disabled]);
43
+
44
+ const filePickerCallback = cb => {
45
+ const input = document.createElement('input');
46
+ input.setAttribute('type', 'file');
47
+ input.setAttribute('accept', 'image/*');
48
+
49
+ input.addEventListener('change', (e: any) => {
50
+ const file = e.target.files[0];
51
+
52
+ const reader: any = new FileReader();
53
+ reader.addEventListener('load', () => {
54
+ /*
55
+ Note: Now we need to register the blob in TinyMCEs image blob
56
+ registry. In the next release this part hopefully won't be
57
+ necessary, as we are looking to handle it internally.
58
+ */
59
+ const blobId = `blobid${new Date().getTime()}`;
60
+ const blobCache = editorRef.current.editorUpload.blobCache;
61
+ const base64 = reader.result.split(',')[1];
62
+ const blobInfo = blobCache.create(blobId, file, base64);
63
+ blobCache.add(blobInfo);
64
+
65
+ /* call the callback and populate the Title field with the file name */
66
+ cb(blobInfo.blobUri(), { title: file.name });
67
+ });
68
+ reader.readAsDataURL(file);
69
+ });
70
+
71
+ input.click();
72
+ };
73
+
74
+ if (readOnly) {
75
+ const value = defaultValue || '--';
76
+ // eslint-disable-next-line react/no-danger
77
+ richTextComponent = <div key={id} id={id} className='readonly-richtext-editor' dangerouslySetInnerHTML={{ __html: value }} />;
78
+ } else {
79
+ richTextComponent = (
80
+ <Editor
81
+ tinymceScriptSrc='tinymce/tinymce.min.js'
82
+ onInit={(_evt, editor) => {
83
+ editorRef.current = editor;
84
+ }}
85
+ id={id}
86
+ initialValue={defaultValue}
87
+ disabled={disabled}
88
+ init={{
89
+ placeholder,
90
+ menubar: false,
91
+ statusbar: false,
92
+ min_height: 130,
93
+ plugins: ['lists', 'advlist', 'autolink', 'image', 'link', 'autoresize'],
94
+ autoresize_bottom_margin: 0,
95
+ toolbar: disabled ? false : 'blocks | bold italic strikethrough | bullist numlist outdent indent | link image',
96
+ toolbar_location: 'bottom',
97
+ content_style: 'body { font-family:Helvetica, Arial,sans-serif; font-size:14px }',
98
+ branding: false,
99
+ paste_data_images: true,
100
+ file_picker_types: 'image',
101
+ file_picker_callback: filePickerCallback
102
+ }}
103
+ onBlur={onBlur}
104
+ onEditorChange={onChange}
105
+ />
106
+ );
107
+ }
108
+
109
+ return (
110
+ <FormControl data-test-id={testId} error={error} required={required}>
111
+ {!labelHidden && (
112
+ <InputLabel id='demo-simple-select-error-label' className={classes.fieldLabel}>
113
+ {label}
114
+ </InputLabel>
115
+ )}
116
+ {richTextComponent}
117
+ {info && <FormHelperText>{info}</FormHelperText>}
118
+ </FormControl>
119
+ );
120
+ });
121
+
122
+ export default RichTextEditor;
@@ -0,0 +1 @@
1
+ export { default } from './RichTextEditor';
@@ -1,25 +1,34 @@
1
- import React from 'react';
2
1
  import { Button } from '@material-ui/core';
3
2
  import './WssQuickCreate.css';
4
3
 
5
- export default function WssQuickCreate(props) {
4
+ // WssQuickCreate is one of the few components that does NOT have getPConnect.
5
+ // So, no need to extend PConnProps
6
+ interface WssQuickCreateProps {
7
+ // If any, enter additional props that only exist on this component
8
+ heading: string;
9
+ actions?: any[];
10
+ }
11
+
12
+ export default function WssQuickCreate(props: WssQuickCreateProps) {
6
13
  const { heading, actions } = props;
7
14
 
8
15
  return (
9
16
  <div>
10
- <h1 id="quick-links-heading" className='quick-link-heading'>{heading}</h1>
11
- <ul id="quick-links" className='quick-link-ul-list'>
17
+ <h1 id='quick-links-heading' className='quick-link-heading'>
18
+ {heading}
19
+ </h1>
20
+ <ul id='quick-links' className='quick-link-ul-list'>
12
21
  {actions &&
13
22
  actions.map(element => {
14
23
  return (
15
- <li className='quick-link-list' key={element.label}>
16
- <Button className='quick-link-button' onClick={element.onClick}>
17
- <span className='quick-link-button-span'>
18
- {element.icon && <img className='quick-link-icon' src={element.icon}/>}
19
- <span>{element.label}</span>
20
- </span>
21
- </Button>
22
- </li>
24
+ <li className='quick-link-list' key={element.label}>
25
+ <Button className='quick-link-button' onClick={element.onClick}>
26
+ <span className='quick-link-button-span'>
27
+ {element.icon && <img className='quick-link-icon' src={element.icon} />}
28
+ <span>{element.label}</span>
29
+ </span>
30
+ </Button>
31
+ </li>
23
32
  );
24
33
  })}
25
34
  </ul>