@pega/react-sdk-overrides 0.23.6

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 (220) hide show
  1. package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.css +19 -0
  2. package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.tsx +156 -0
  3. package/lib/designSystemExtensions/CaseSummaryFields/index.tsx +1 -0
  4. package/lib/designSystemExtensions/DetailsFields/DetailsFields.tsx +154 -0
  5. package/lib/designSystemExtensions/DetailsFields/index.tsx +1 -0
  6. package/lib/designSystemExtensions/FieldGroup/FieldGroup.tsx +113 -0
  7. package/lib/designSystemExtensions/FieldGroup/index.tsx +1 -0
  8. package/lib/designSystemExtensions/FieldGroupList/FieldGroupList.tsx +53 -0
  9. package/lib/designSystemExtensions/FieldGroupList/index.tsx +1 -0
  10. package/lib/designSystemExtensions/FieldValueList/FieldValueList.tsx +106 -0
  11. package/lib/designSystemExtensions/FieldValueList/index.tsx +1 -0
  12. package/lib/designSystemExtensions/Operator/Operator.tsx +195 -0
  13. package/lib/designSystemExtensions/Operator/index.tsx +1 -0
  14. package/lib/designSystemExtensions/Pulse/Pulse.tsx +31 -0
  15. package/lib/designSystemExtensions/Pulse/index.tsx +1 -0
  16. package/lib/forms/AutoComplete/AutoComplete.tsx +183 -0
  17. package/lib/forms/AutoComplete/index.tsx +1 -0
  18. package/lib/forms/CancelAlert/CancelAlert.css +24 -0
  19. package/lib/forms/CancelAlert/CancelAlert.tsx +126 -0
  20. package/lib/forms/CancelAlert/index.tsx +1 -0
  21. package/lib/forms/Checkbox/Checkbox.tsx +68 -0
  22. package/lib/forms/Checkbox/index.tsx +1 -0
  23. package/lib/forms/Currency/Currency.tsx +89 -0
  24. package/lib/forms/Currency/index.tsx +1 -0
  25. package/lib/forms/Date/Date.tsx +79 -0
  26. package/lib/forms/Date/index.tsx +1 -0
  27. package/lib/forms/DateTime/DateTime.tsx +75 -0
  28. package/lib/forms/DateTime/index.tsx +1 -0
  29. package/lib/forms/Decimal/Decimal.tsx +51 -0
  30. package/lib/forms/Decimal/index.tsx +1 -0
  31. package/lib/forms/Dropdown/Dropdown.tsx +82 -0
  32. package/lib/forms/Dropdown/index.tsx +1 -0
  33. package/lib/forms/Email/Email.tsx +68 -0
  34. package/lib/forms/Email/index.tsx +1 -0
  35. package/lib/forms/Integer/Integer.tsx +77 -0
  36. package/lib/forms/Integer/index.tsx +1 -0
  37. package/lib/forms/Percentage/Percentage.tsx +82 -0
  38. package/lib/forms/Percentage/index.tsx +1 -0
  39. package/lib/forms/Phone/Phone.tsx +90 -0
  40. package/lib/forms/Phone/index.tsx +1 -0
  41. package/lib/forms/RadioButtons/RadioButtons.tsx +73 -0
  42. package/lib/forms/RadioButtons/index.tsx +1 -0
  43. package/lib/forms/SemanticLink/SemanticLink.tsx +69 -0
  44. package/lib/forms/SemanticLink/index.tsx +1 -0
  45. package/lib/forms/SemanticLink/utils.ts +51 -0
  46. package/lib/forms/TextArea/TextArea.tsx +66 -0
  47. package/lib/forms/TextArea/index.tsx +1 -0
  48. package/lib/forms/TextContent/TextContent.tsx +40 -0
  49. package/lib/forms/TextContent/index.tsx +1 -0
  50. package/lib/forms/TextInput/TextInput.tsx +61 -0
  51. package/lib/forms/TextInput/index.tsx +1 -0
  52. package/lib/forms/Time/Time.tsx +71 -0
  53. package/lib/forms/Time/index.tsx +1 -0
  54. package/lib/forms/URL/URL.tsx +53 -0
  55. package/lib/forms/URL/index.tsx +1 -0
  56. package/lib/forms/UserReference/UserReference.tsx +197 -0
  57. package/lib/forms/UserReference/UserReferenceUtils.ts +13 -0
  58. package/lib/forms/UserReference/index.tsx +1 -0
  59. package/lib/helpers/auth.js +483 -0
  60. package/lib/helpers/authManager.js +630 -0
  61. package/lib/helpers/config_access.js +268 -0
  62. package/lib/helpers/data_page.ts +24 -0
  63. package/lib/helpers/event-utils.js +20 -0
  64. package/lib/helpers/field-group-utils.js +61 -0
  65. package/lib/helpers/formatters/Boolean.js +38 -0
  66. package/lib/helpers/formatters/Currency.js +74 -0
  67. package/lib/helpers/formatters/CurrencyMap.js +908 -0
  68. package/lib/helpers/formatters/Date.js +77 -0
  69. package/lib/helpers/formatters/common.js +10 -0
  70. package/lib/helpers/formatters/index.js +120 -0
  71. package/lib/helpers/utils.ts +334 -0
  72. package/lib/helpers/versionHelpers.ts +50 -0
  73. package/lib/infra/ActionButtons/ActionButtons.tsx +70 -0
  74. package/lib/infra/ActionButtons/index.tsx +1 -0
  75. package/lib/infra/Assignment/Assignment.tsx +301 -0
  76. package/lib/infra/Assignment/index.tsx +1 -0
  77. package/lib/infra/AssignmentCard/AssignmentCard.tsx +47 -0
  78. package/lib/infra/AssignmentCard/index.tsx +1 -0
  79. package/lib/infra/Attachment/Attachment.css +18 -0
  80. package/lib/infra/Attachment/Attachment.tsx +404 -0
  81. package/lib/infra/Attachment/AttachmentUtils.js +71 -0
  82. package/lib/infra/Attachment/index.tsx +1 -0
  83. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +511 -0
  84. package/lib/infra/Containers/FlowContainer/helpers.js +147 -0
  85. package/lib/infra/Containers/FlowContainer/index.tsx +1 -0
  86. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +320 -0
  87. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -0
  88. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +216 -0
  89. package/lib/infra/Containers/ViewContainer/index.tsx +1 -0
  90. package/lib/infra/DashboardFilter/DashboardFilter.tsx +180 -0
  91. package/lib/infra/DashboardFilter/filterUtils.tsx +188 -0
  92. package/lib/infra/DashboardFilter/index.tsx +1 -0
  93. package/lib/infra/DeferLoad/DeferLoad.tsx +175 -0
  94. package/lib/infra/DeferLoad/index.tsx +1 -0
  95. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +103 -0
  96. package/lib/infra/ErrorBoundary/index.tsx +1 -0
  97. package/lib/infra/MultiStep/MultiStep.css +261 -0
  98. package/lib/infra/MultiStep/MultiStep.tsx +225 -0
  99. package/lib/infra/MultiStep/index.tsx +1 -0
  100. package/lib/infra/NavBar/NavBar.css +170 -0
  101. package/lib/infra/NavBar/NavBar.tsx +393 -0
  102. package/lib/infra/NavBar/index.tsx +1 -0
  103. package/lib/infra/Reference/Reference.tsx +58 -0
  104. package/lib/infra/Reference/index.tsx +1 -0
  105. package/lib/infra/Region/Region.tsx +17 -0
  106. package/lib/infra/Region/index.tsx +1 -0
  107. package/lib/infra/RootContainer/RootContainer.tsx +336 -0
  108. package/lib/infra/RootContainer/index.tsx +1 -0
  109. package/lib/infra/Stages/Stages.tsx +120 -0
  110. package/lib/infra/Stages/index.tsx +1 -0
  111. package/lib/infra/ToDo/ToDo.css +87 -0
  112. package/lib/infra/ToDo/ToDo.tsx +285 -0
  113. package/lib/infra/ToDo/index.tsx +1 -0
  114. package/lib/infra/VerticalTabs/LeftAlignVerticalTab.tsx +27 -0
  115. package/lib/infra/VerticalTabs/VerticalTabs.tsx +75 -0
  116. package/lib/infra/VerticalTabs/index.tsx +1 -0
  117. package/lib/infra/View/View.css +8 -0
  118. package/lib/infra/View/View.tsx +175 -0
  119. package/lib/infra/View/index.tsx +1 -0
  120. package/lib/templates/AppShell/AppShell.css +40 -0
  121. package/lib/templates/AppShell/AppShell.tsx +439 -0
  122. package/lib/templates/AppShell/index.tsx +1 -0
  123. package/lib/templates/CaseSummary/CaseSummary.tsx +50 -0
  124. package/lib/templates/CaseSummary/index.tsx +1 -0
  125. package/lib/templates/CaseView/CaseView.tsx +261 -0
  126. package/lib/templates/CaseView/CaseViewActionsMenu.tsx +73 -0
  127. package/lib/templates/CaseView/index.tsx +1 -0
  128. package/lib/templates/DataReference/DataReference.tsx +290 -0
  129. package/lib/templates/DataReference/index.tsx +1 -0
  130. package/lib/templates/DefaultForm/DefaultForm.css +25 -0
  131. package/lib/templates/DefaultForm/DefaultForm.tsx +52 -0
  132. package/lib/templates/DefaultForm/index.tsx +1 -0
  133. package/lib/templates/Details/Details/Details.tsx +35 -0
  134. package/lib/templates/Details/Details/index.tsx +1 -0
  135. package/lib/templates/Details/DetailsSubTabs/DetailsSubTabs.tsx +65 -0
  136. package/lib/templates/Details/DetailsSubTabs/index.tsx +1 -0
  137. package/lib/templates/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +45 -0
  138. package/lib/templates/Details/DetailsThreeColumn/index.tsx +1 -0
  139. package/lib/templates/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +43 -0
  140. package/lib/templates/Details/DetailsTwoColumn/index.tsx +1 -0
  141. package/lib/templates/FieldGroupTemplate/FieldGroupTemplate.tsx +94 -0
  142. package/lib/templates/FieldGroupTemplate/index.tsx +1 -0
  143. package/lib/templates/InlineDashboard/InlineDashboard.tsx +72 -0
  144. package/lib/templates/InlineDashboard/index.tsx +1 -0
  145. package/lib/templates/InlineDashboardPage/InlineDashboardPage.tsx +41 -0
  146. package/lib/templates/InlineDashboardPage/index.tsx +1 -0
  147. package/lib/templates/ListPage/ListPage.tsx +20 -0
  148. package/lib/templates/ListPage/index.tsx +1 -0
  149. package/lib/templates/ListView/ListView.css +10 -0
  150. package/lib/templates/ListView/ListView.tsx +1230 -0
  151. package/lib/templates/ListView/index.tsx +1 -0
  152. package/lib/templates/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +42 -0
  153. package/lib/templates/MultiReferenceReadOnly/index.tsx +1 -0
  154. package/lib/templates/NarrowWide/NarrowWide/NarrowWide.css +21 -0
  155. package/lib/templates/NarrowWide/NarrowWide/NarrowWide.tsx +35 -0
  156. package/lib/templates/NarrowWide/NarrowWide/index.tsx +1 -0
  157. package/lib/templates/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +53 -0
  158. package/lib/templates/NarrowWide/NarrowWideDetails/index.tsx +1 -0
  159. package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.css +21 -0
  160. package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +24 -0
  161. package/lib/templates/NarrowWide/NarrowWideForm/index.tsx +1 -0
  162. package/lib/templates/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +38 -0
  163. package/lib/templates/NarrowWide/NarrowWidePage/index.tsx +1 -0
  164. package/lib/templates/OneColumn/OneColumn/OneColumn.tsx +32 -0
  165. package/lib/templates/OneColumn/OneColumn/index.tsx +1 -0
  166. package/lib/templates/OneColumn/OneColumnPage/OneColumnPage.tsx +24 -0
  167. package/lib/templates/OneColumn/OneColumnPage/index.tsx +1 -0
  168. package/lib/templates/OneColumn/OneColumnTab/OneColumnTab.tsx +17 -0
  169. package/lib/templates/OneColumn/OneColumnTab/index.tsx +1 -0
  170. package/lib/templates/PromotedFilters/PromotedFilters.css +7 -0
  171. package/lib/templates/PromotedFilters/PromotedFilters.tsx +160 -0
  172. package/lib/templates/PromotedFilters/index.tsx +1 -0
  173. package/lib/templates/SimpleTable/SimpleTable/SimpleTable.tsx +28 -0
  174. package/lib/templates/SimpleTable/SimpleTable/index.tsx +1 -0
  175. package/lib/templates/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +719 -0
  176. package/lib/templates/SimpleTable/SimpleTableManual/index.tsx +1 -0
  177. package/lib/templates/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +129 -0
  178. package/lib/templates/SimpleTable/SimpleTableSelect/index.tsx +1 -0
  179. package/lib/templates/SimpleTable/helpers.ts +360 -0
  180. package/lib/templates/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +66 -0
  181. package/lib/templates/SingleReferenceReadOnly/index.tsx +1 -0
  182. package/lib/templates/SubTabs/SubTabs.tsx +65 -0
  183. package/lib/templates/SubTabs/index.tsx +1 -0
  184. package/lib/templates/SubTabs/tabUtils.ts +73 -0
  185. package/lib/templates/TwoColumn/TwoColumn/TwoColumn.css +13 -0
  186. package/lib/templates/TwoColumn/TwoColumn/TwoColumn.tsx +58 -0
  187. package/lib/templates/TwoColumn/TwoColumn/index.tsx +1 -0
  188. package/lib/templates/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +25 -0
  189. package/lib/templates/TwoColumn/TwoColumnPage/index.tsx +1 -0
  190. package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
  191. package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +55 -0
  192. package/lib/templates/TwoColumn/TwoColumnTab/index.tsx +1 -0
  193. package/lib/templates/WideNarrow/WideNarrow/WideNarrow.css +21 -0
  194. package/lib/templates/WideNarrow/WideNarrow/WideNarrow.tsx +35 -0
  195. package/lib/templates/WideNarrow/WideNarrow/index.tsx +1 -0
  196. package/lib/templates/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +54 -0
  197. package/lib/templates/WideNarrow/WideNarrowDetails/index.tsx +1 -0
  198. package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.css +21 -0
  199. package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +24 -0
  200. package/lib/templates/WideNarrow/WideNarrowForm/index.tsx +1 -0
  201. package/lib/templates/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +38 -0
  202. package/lib/templates/WideNarrow/WideNarrowPage/index.tsx +1 -0
  203. package/lib/templates/utils.ts +23 -0
  204. package/lib/widgets/AppAnnouncement/AppAnnouncement.tsx +67 -0
  205. package/lib/widgets/AppAnnouncement/index.tsx +1 -0
  206. package/lib/widgets/CaseHistory/CaseHistory.tsx +169 -0
  207. package/lib/widgets/CaseHistory/index.tsx +1 -0
  208. package/lib/widgets/FileUtility/ActionButtonsForFileUtil.css +27 -0
  209. package/lib/widgets/FileUtility/ActionButtonsForFileUtil.tsx +22 -0
  210. package/lib/widgets/FileUtility/FileUtility.css +117 -0
  211. package/lib/widgets/FileUtility/FileUtility.tsx +567 -0
  212. package/lib/widgets/FileUtility/index.tsx +0 -0
  213. package/lib/widgets/Followers/Followers.tsx +43 -0
  214. package/lib/widgets/Followers/index.tsx +1 -0
  215. package/lib/widgets/SummaryItem/SummaryItem.css +78 -0
  216. package/lib/widgets/SummaryItem/SummaryItem.tsx +80 -0
  217. package/lib/widgets/SummaryItem/index.tsx +1 -0
  218. package/lib/widgets/SummaryList/SummaryList.tsx +12 -0
  219. package/lib/widgets/SummaryList/index.tsx +1 -0
  220. package/package.json +14 -0
@@ -0,0 +1,13 @@
1
+ .psdk-two-column {
2
+ display: flow-root;
3
+ height: 100%;
4
+ }
5
+
6
+ /* Create two equal columns that floats next to each other */
7
+ .psdk-two-column-column {
8
+ width: 50%;
9
+ float: left;
10
+ padding: 0rem 0.3125rem;
11
+ height: 100%;
12
+
13
+ }
@@ -0,0 +1,58 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { Grid, GridSize } from "@material-ui/core";
4
+ import { makeStyles } from '@material-ui/core/styles';
5
+
6
+ const useStyles = makeStyles(() => ({
7
+ colStyles: {
8
+ display: "grid",
9
+ gap: "1rem",
10
+ alignContent: "baseline",
11
+ },
12
+ }));
13
+
14
+ export default function TwoColumn(props) {
15
+ const classes = useStyles();
16
+
17
+ const {children, templateCol} = props;
18
+
19
+ if (children.length !== 2) {
20
+ // eslint-disable-next-line no-console
21
+ console.error( `TwoColumn template sees more than 2 columns: ${children.length}`);
22
+ }
23
+
24
+ // Calculate the size
25
+ // Default to assume the 2 columns are evenly split. However, override if templateCol
26
+ // (example value: "1fr 1fr")
27
+ let aSize: GridSize = 6;
28
+ let bSize: GridSize = 6;
29
+
30
+ const colAArray = templateCol.replaceAll(/[a-z]+/g, "").split(/\s/).map(itm => Number(itm));
31
+ const totalCols = colAArray.reduce((v, itm) => itm + v, 0);
32
+ const ratio = 12 / totalCols;
33
+ aSize = (ratio * colAArray[0]) as GridSize;
34
+ bSize = (ratio * colAArray[1]) as GridSize;
35
+
36
+ return (
37
+ <Grid container spacing={1}>
38
+ <Grid item xs={12} md={aSize} className={classes.colStyles}>
39
+ {children[0]}
40
+ </Grid>
41
+ <Grid item xs={12} md={bSize} className={classes.colStyles}>
42
+ {children[1]}
43
+ </Grid>
44
+ </Grid>
45
+ )
46
+ }
47
+
48
+ TwoColumn.propTypes = {
49
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
50
+ // title: PropTypes.string,
51
+ templateCol: PropTypes.string,
52
+ // icon: PropTypes.string
53
+ };
54
+
55
+ TwoColumn.defaultProps = {
56
+ templateCol: "1fr 1fr",
57
+ // icon: ""
58
+ };
@@ -0,0 +1 @@
1
+ export { default } from './TwoColumn';
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ // import { TwoColumnPage as TwoColumn } from "@pega/cosmos-react-core";
5
+ import TwoColumn from '@pega/react-sdk-components/lib/components/templates/TwoColumn';
6
+
7
+ /*
8
+ * The wrapper handles knowing how to take in just children
9
+ * and mapping to the TwoColumn template.
10
+ */
11
+ export default function TwoColumnPage(props) {
12
+
13
+ return (
14
+ <TwoColumn
15
+ {...props}
16
+ />
17
+ );
18
+ }
19
+
20
+ TwoColumnPage.propTypes = {
21
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
22
+ };
23
+
24
+ TwoColumnPage.defaultProps = {
25
+ };
@@ -0,0 +1 @@
1
+ export { default } from './TwoColumnPage';
@@ -0,0 +1,12 @@
1
+ .psdk-two-column {
2
+ display: flow-root;
3
+ height: 100%;
4
+ }
5
+
6
+ /* Create two equal columns that floats next to each other */
7
+ .psdk-two-column-column {
8
+ width: 50%;
9
+ float: left;
10
+ padding: 0rem 0.3125rem;
11
+ height: 100%;
12
+ }
@@ -0,0 +1,55 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { Grid, GridSize } from "@material-ui/core";
4
+ import { makeStyles } from '@material-ui/core/styles';
5
+
6
+ const useStyles = makeStyles(() => ({
7
+ colStyles: {
8
+ display: "grid",
9
+ gap: "1rem",
10
+ alignContent: "baseline",
11
+ },
12
+ }));
13
+
14
+ export default function TwoColumnTab(props) {
15
+ const classes = useStyles();
16
+
17
+ const {children, templateCol} = props;
18
+
19
+ if (children.length !== 2) {
20
+ // eslint-disable-next-line no-console
21
+ console.error( `TwoColumn template sees more than 2 columns: ${children.length}`);
22
+ }
23
+
24
+ // Calculate the size
25
+ // Default to assume the 2 columns are evenly split. However, override if templateCol
26
+ // (example value: "1fr 1fr")
27
+ let aSize: GridSize = 6;
28
+ let bSize: GridSize = 6;
29
+
30
+ const colAArray = templateCol.replaceAll(/[a-z]+/g, "").split(/\s/).map(itm => Number(itm));
31
+ const totalCols = colAArray.reduce((v, itm) => itm + v, 0);
32
+ const ratio = 12 / totalCols;
33
+ aSize = (ratio * colAArray[0]) as GridSize;
34
+ bSize = (ratio * colAArray[1]) as GridSize;
35
+
36
+ return (
37
+ <Grid container spacing={1}>
38
+ <Grid item xs={12} md={aSize} className={classes.colStyles}>
39
+ {children[0]}
40
+ </Grid>
41
+ <Grid item xs={12} md={bSize} className={classes.colStyles}>
42
+ {children[1]}
43
+ </Grid>
44
+ </Grid>
45
+ )
46
+ }
47
+
48
+ TwoColumnTab.propTypes = {
49
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
50
+ templateCol: PropTypes.string,
51
+ };
52
+
53
+ TwoColumnTab.defaultProps = {
54
+ templateCol: "1fr 1fr",
55
+ };
@@ -0,0 +1 @@
1
+ export { default } from './TwoColumnTab';
@@ -0,0 +1,21 @@
1
+ .psdk-wide-narrow-column {
2
+ display: flow-root;
3
+ height: 100%;
4
+ }
5
+
6
+ /* Create two columns that float next to each other */
7
+ .psdk-wide-narrow-column .psdk-narrow-column-column {
8
+ width: 30%;
9
+ float: left;
10
+ padding: 0rem 0rem 0rem 0.3125rem;
11
+ height: 100%;
12
+
13
+ }
14
+
15
+ .psdk-wide-narrow-column .psdk-wide-column-column {
16
+ width: 70%;
17
+ float: left;
18
+ padding: 0rem 0.3125rem 0rem 0rem;
19
+ height: 100%;
20
+
21
+ }
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+
3
+ import './WideNarrow.css';
4
+
5
+ export default function WideNarrow(props) {
6
+ // const {a, b /*, cols, icon, title */ } = props;
7
+ const { a, b, children } = props;
8
+
9
+ return (
10
+ <React.Fragment>
11
+ {children && children.length === 2 &&
12
+ <div className="psdk-wide-narrow-column">
13
+ <div className="psdk-wide-column-column">
14
+ {children[0]}
15
+ </div>
16
+ <div className="psdk-narrow-column-column">
17
+ {children[1]}
18
+ </div>
19
+ </div>
20
+ }
21
+ {a && b &&
22
+ <div className="psdk-wide-narrow-column">
23
+ <div className="psdk-wide-column-column">
24
+ {a}
25
+ </div>
26
+ <div className="psdk-narrow-column-column">
27
+ {b}
28
+ </div>
29
+ </div>
30
+ }
31
+ </React.Fragment>
32
+
33
+ )
34
+
35
+ }
@@ -0,0 +1 @@
1
+ export { default } from './WideNarrow';
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ // import PropTypes from "prop-types";
3
+ // import Grid from '@material-ui/core/Grid';
4
+ import DetailsFields from '@pega/react-sdk-components/lib/components/designSystemExtensions/DetailsFields';
5
+
6
+ export default function WideNarrowDetails(props) {
7
+ const { a, b, children } = props;
8
+ const arFields: Array<any> = [];
9
+
10
+ for (const child of children) {
11
+ const theChildPConn = child.props.getPConnect();
12
+ const theChildrenOfChild = theChildPConn.getChildren();
13
+ arFields.push(theChildrenOfChild);
14
+ }
15
+
16
+ if (arFields.length !== 2) {
17
+ // eslint-disable-next-line no-console
18
+ console.error(`WideNarrowDetails expects 2 children and received ${arFields.length}`);
19
+ }
20
+
21
+
22
+ return (
23
+ <React.Fragment>
24
+ {children && children.length === 2 &&
25
+ <div className="psdk-wide-narrow-column">
26
+ <div className="psdk-wide-column-column">
27
+ <DetailsFields fields={arFields[0]} />
28
+ </div>
29
+ <div className="psdk-narrow-column-column">
30
+ <DetailsFields fields={arFields[1]} />
31
+ </div>
32
+ </div>
33
+ }
34
+ {a && b &&
35
+ <div className="psdk-wide-narrow-column">
36
+ <div className="psdk-wide-column-column">
37
+ {a}
38
+ </div>
39
+ <div className="psdk-narrow-column-column">
40
+ {b}
41
+ </div>
42
+ </div>
43
+ }
44
+ </React.Fragment>
45
+ )
46
+
47
+ }
48
+
49
+ WideNarrowDetails.propTypes = {
50
+ // showLabel: PropTypes.bool,
51
+ // label: PropTypes.string,
52
+ // getPConnect: PropTypes.func.isRequired,
53
+ // template: PropTypes.string.isRequired
54
+ };
@@ -0,0 +1 @@
1
+ export { default } from './WideNarrowDetails';
@@ -0,0 +1,21 @@
1
+ .psd-wide-narrow-column {
2
+ display: flow-root;
3
+ height: 100%;
4
+ }
5
+
6
+ /* Create two equal columns that floats next to each other */
7
+ .psd-wide-narrow-column .psdk-narrow-column-column {
8
+ width: 30%;
9
+ float: left;
10
+ padding: 0rem 0.3125rem 0rem 0rem;
11
+ height: 100%;
12
+
13
+ }
14
+
15
+ .psd-wide-narrow-column .psdk-wide-column-column {
16
+ width: 70%;
17
+ float: left;
18
+ padding: 0rem 0rem 0rem 0.3125rem;
19
+ height: 100%;
20
+
21
+ }
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+
3
+ import './WideNarrowForm.css';
4
+
5
+ export default function WideNarrowForm(props) {
6
+ const {children} = props;
7
+
8
+ return (
9
+ <React.Fragment>
10
+ {children && children.length === 2 &&
11
+ <div className="psdk-wide-narrow-column">
12
+ <div className="psdk-wide-column-column">
13
+ {children[0]}
14
+ </div>
15
+ <div className="psdk-narrow-column-column">
16
+ {children[1]}
17
+ </div>
18
+ </div>
19
+ }
20
+ </React.Fragment>
21
+
22
+ )
23
+
24
+ }
@@ -0,0 +1 @@
1
+ export { default } from './WideNarrowForm';
@@ -0,0 +1,38 @@
1
+ import React, { Children } from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ // import { TwoColumnPage as TwoColumn } from "@pega/cosmos-react-core";
5
+ import WideNarrow from '@pega/react-sdk-components/lib/components/templates/WideNarrow';
6
+
7
+ /*
8
+ * The wrapper handles knowing how to take in just children and mapping
9
+ * to the Cosmos template.
10
+ */
11
+ export default function WideNarrowPage(props) {
12
+ const { children, title, templateCol, icon } = props;
13
+ const childArray = Children.toArray(children);
14
+
15
+ return (
16
+ <div>
17
+ <WideNarrow
18
+ a={childArray[0]}
19
+ b={childArray[1]}
20
+ title={title}
21
+ cols={templateCol}
22
+ icon={icon?.replace("pi pi-", "")}
23
+ />
24
+ </div>
25
+ );
26
+ }
27
+
28
+ WideNarrowPage.propTypes = {
29
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
30
+ title: PropTypes.string.isRequired,
31
+ templateCol: PropTypes.string,
32
+ icon: PropTypes.string
33
+ };
34
+
35
+ WideNarrowPage.defaultProps = {
36
+ templateCol: "1fr 1fr",
37
+ icon: ""
38
+ };
@@ -0,0 +1 @@
1
+ export { default } from './WideNarrowPage';
@@ -0,0 +1,23 @@
1
+ // This file is adapted from React DX components/Templates/utils.js
2
+
3
+ export function getAllFields(pConnect: any) {
4
+ const metadata = pConnect.getRawMetadata();
5
+ let allFields = [];
6
+ if (metadata.children && metadata.children.map) {
7
+ allFields = metadata.children.map((fields) => {
8
+ const children = fields.children instanceof Array ? fields.children : [];
9
+ return children.map((field) => field.config);
10
+ });
11
+ }
12
+ return allFields;
13
+ }
14
+
15
+ export function filterForFieldValueList(fields : any) {
16
+ return fields
17
+ .filter(({ visibility }) => visibility !== false)
18
+ .map(({ value, label }) => ({
19
+ id: label.toLowerCase(),
20
+ name: label,
21
+ value
22
+ }));
23
+ }
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { Card, CardContent, CardHeader, Typography, CardActions, Button } from "@material-ui/core";
4
+ import { makeStyles } from '@material-ui/core/styles';
5
+
6
+ const useStyles = makeStyles((theme) => ({
7
+ root: {
8
+ marginTop: theme.spacing(1),
9
+ marginBottom: theme.spacing(1),
10
+ borderLeft: "6px solid",
11
+ borderLeftColor: theme.palette.primary.light
12
+ },
13
+ }));
14
+
15
+ const AppAnnouncement = (props) => {
16
+ const { header, description, datasource, whatsnewlink } = props;
17
+ let details = [];
18
+ if (datasource && datasource.source) {
19
+ details = datasource.source.map((item) => {
20
+ return item.name;
21
+ });
22
+ }
23
+
24
+ const classes = useStyles();
25
+
26
+ const handleClick = () => {
27
+ window.open(whatsnewlink);
28
+ }
29
+
30
+ return (
31
+ <Card title="AppAnnouncement" className={classes.root}>
32
+ <CardHeader title={<Typography variant="h6">{header}</Typography>} />
33
+ <CardContent>
34
+ <Typography variant="body1" gutterBottom>{description}</Typography>
35
+ {
36
+ details.map((itm, idx) => {
37
+ const theKey = `AppAnn-item-${idx}`;
38
+ return (
39
+ <Typography key={theKey} variant="body2">- {itm}</Typography>
40
+ )
41
+ })
42
+ }
43
+ </CardContent>
44
+ <CardActions>
45
+ <Button color="primary" onClick={handleClick} size="small">See what&apos;s new</Button>
46
+ </CardActions>
47
+ </Card>
48
+ );
49
+ };
50
+
51
+ AppAnnouncement.propTypes = {
52
+ header: PropTypes.string,
53
+ description: PropTypes.string,
54
+ datasource: PropTypes.instanceOf(Object),
55
+ whatsnewlink: PropTypes.string,
56
+ // image: PropTypes.string
57
+ };
58
+
59
+ AppAnnouncement.defaultProps = {
60
+ header: "",
61
+ description: "",
62
+ // image: "",
63
+ datasource: [],
64
+ whatsnewlink: ""
65
+ };
66
+
67
+ export default AppAnnouncement;
@@ -0,0 +1 @@
1
+ export { default } from './AppAnnouncement';
@@ -0,0 +1,169 @@
1
+ import React, { useState, useRef, useEffect } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { withStyles, Theme, createStyles } from '@material-ui/core/styles';
4
+ import Table from '@material-ui/core/Table';
5
+ import TableBody from '@material-ui/core/TableBody';
6
+ import TableCell from '@material-ui/core/TableCell';
7
+ import TableContainer from '@material-ui/core/TableContainer';
8
+ import TableHead from '@material-ui/core/TableHead';
9
+ import TableRow from '@material-ui/core/TableRow';
10
+ import isDeepEqual from 'fast-deep-equal/react';
11
+ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
12
+
13
+ declare const PCore;
14
+
15
+
16
+ const StyledTableCell = withStyles((theme: Theme) =>
17
+ createStyles({
18
+ head: {
19
+ borderWidth: "1px",
20
+ borderStyle: "solid",
21
+ borderColor: "silver",
22
+ backgroundColor: theme.palette.text.disabled,
23
+ color: theme.palette.getContrastText(theme.palette.text.disabled),
24
+ },
25
+ body: {
26
+ borderWidth: "1px",
27
+ borderStyle: "solid",
28
+ borderColor: "silver",
29
+ // fontSize: 14,
30
+ },
31
+ }),
32
+ )(TableCell);
33
+
34
+
35
+ export default function CaseHistory(props) {
36
+ const { getPConnect } = props;
37
+ const thePConn = getPConnect();
38
+ // let waitingForData = true;
39
+
40
+ const displayedColumns = [
41
+ { label: "Date", type: "DateTime", fieldName: "pxTimeCreated" },
42
+ { label: "Description", type: "TextInput", fieldName: "pyMessageKey" },
43
+ { label: "User", type: "TextInput", fieldName: "pyPerformer" }
44
+ ];
45
+
46
+ const rowData: any = useRef([]);
47
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
48
+ const [waitingForData, setWaitingForData] = useState<boolean>(true);
49
+
50
+
51
+ const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
52
+ const dataViewName = "D_pyWorkHistory";
53
+ const context = thePConn.getContextName();
54
+
55
+
56
+ function computeRowData(rows: Array<Object>): void {
57
+ const theRowData: Array<Object> = [];
58
+
59
+ rows.forEach((row: any, rowIndex: number) => {
60
+ // Now, for each property in the index of row properties (displayedColumns), add an object
61
+ // to a new array of values
62
+ const rowDisplayValues: any = [];
63
+
64
+ displayedColumns.forEach((column: Object, rowValIndex) => {
65
+ const theType = column["type"];
66
+ const theFieldName = column["fieldName"];
67
+ const theValue = ((theType === "Date" || theType === "DateTime")) ? Utils.generateDateTime(row[theFieldName], "DateTime-Short") : row[theFieldName];
68
+ rowDisplayValues[rowValIndex] = theValue;
69
+ });
70
+
71
+ theRowData[rowIndex] = rowDisplayValues;
72
+ })
73
+
74
+ if (!isDeepEqual(theRowData, rowData.current)) {
75
+ // Only update rowData.current when it actually changes (to prevent infinite loop)
76
+ rowData.current = theRowData;
77
+ }
78
+ }
79
+
80
+ // Get the case history data when component mounted/initialized
81
+ useEffect( () => {
82
+
83
+ let bCallSetWaitingForData = true;
84
+
85
+ const historyData = PCore.getDataApiUtils().getData(
86
+ dataViewName, `{"dataViewParameters":[{"CaseInstanceKey":"${caseID}"}]}`,
87
+ context
88
+ );
89
+
90
+ historyData.then( (historyJSON: Object) => {
91
+
92
+ const tableDataResults = historyJSON["data"].data;
93
+
94
+ // compute the rowData using the tableDataResults
95
+ computeRowData(tableDataResults);
96
+
97
+ // At this point, if we have data ready to render and haven't been asked
98
+ // to NOT call setWaitingForData, we can stop progress indicator
99
+ if (bCallSetWaitingForData) {
100
+ setWaitingForData(false);
101
+ }
102
+
103
+ });
104
+
105
+ return () => {
106
+ // Inspired by https://juliangaramendy.dev/blog/use-promise-subscription
107
+ // The useEffect closure lets us have access to the bCallSetWaitingForData
108
+ // variable inside the useEffect and inside the "then" clause of the
109
+ // historyData promise
110
+ // So, if this cleanup code gets run before the promise .then is called,
111
+ // we can avoid calling the useState setter which would otherwise show a warning
112
+ bCallSetWaitingForData = false;
113
+ }
114
+
115
+ }, []);
116
+
117
+
118
+ function getTableHeader() {
119
+ const theRowKey = "CaseHistory.TableHeader";
120
+
121
+ const theHeaderCells: Array<any> = displayedColumns.map((headerCol, index) => {
122
+ const theCellKey = `${theRowKey}.${index}`;
123
+ return <StyledTableCell key={theCellKey}>{headerCol.label}</StyledTableCell>
124
+ })
125
+
126
+ return <TableRow key={theRowKey}>{theHeaderCells}</TableRow>;
127
+ }
128
+
129
+
130
+ function getTableData() {
131
+ const theDataRows: Array<any> = [];
132
+
133
+ // Note: using rowData.current since we're using useRef as a mutatable
134
+ // value that's only updated when it changes.
135
+ if (rowData.current.length > 0) {
136
+ rowData.current.forEach((dataRow: Array<Object>, index) => {
137
+ // using dataRow[0]-dataRow[1] as the array key since it's a unique value
138
+ const theKey = `CaseHistory-${index}`;
139
+ theDataRows.push( <TableRow key={theKey}>
140
+ <StyledTableCell>{dataRow[0] ? dataRow[0] : "---"}</StyledTableCell>
141
+ <StyledTableCell>{dataRow[1] ? dataRow[1] : "---"}</StyledTableCell>
142
+ <StyledTableCell>{dataRow[2] ? dataRow[2] : "---"}</StyledTableCell>
143
+ </TableRow>
144
+ )
145
+ });
146
+ }
147
+
148
+ return theDataRows;
149
+ }
150
+
151
+ return (
152
+ <div id="CaseHistory">
153
+ <TableContainer>
154
+ <Table>
155
+ <TableHead>
156
+ {getTableHeader()}
157
+ </TableHead>
158
+ <TableBody>
159
+ {getTableData()}
160
+ </TableBody>
161
+ </Table>
162
+ </TableContainer>
163
+ </div>
164
+ )
165
+ }
166
+
167
+ CaseHistory.propTypes = {
168
+ getPConnect: PropTypes.func.isRequired
169
+ };
@@ -0,0 +1 @@
1
+ export { default } from './CaseHistory';
@@ -0,0 +1,27 @@
1
+ .psdk-actions {
2
+ height: 6.25rem;
3
+ display: flex;
4
+ position: relative;
5
+ align-items: center;
6
+ width: 100%;
7
+ }
8
+
9
+ .psdk-action-buttons {
10
+ width: 50%;
11
+ justify-content: center;
12
+ display: flex;
13
+ }
14
+
15
+ .primary-button {
16
+ background-color: #3f51b5 !important;
17
+ color: white !important;
18
+ padding: 6px 14px !important;
19
+ text-transform: unset !important;
20
+ font-size: 14px;
21
+ }
22
+
23
+ .secondary-button {
24
+ box-shadow: 0px 5px 10px 0px rgb(0 0 0 / 20%);
25
+ text-transform: unset !important;
26
+ padding: 6px 14px !important;
27
+ }