@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,19 @@
1
+
2
+ .psdk-csf-status-style {
3
+ /* background-color: #e9eef3;
4
+ border-radius: calc(0.25 * 0.5rem);
5
+ color: #4c5a67; */
6
+ display: inline-block;
7
+ font-size: 0.75rem;
8
+ font-weight: bold;
9
+ line-height: calc(0.5rem * 2.5);
10
+ height: calc(0.5rem * 2.5);
11
+ padding: 0 0.5rem;
12
+ text-transform: uppercase;
13
+ }
14
+
15
+ .psdk-case-summary-fields {
16
+ padding: calc(2 * 0.5rem);
17
+ display: grid;
18
+ grid-row-gap: calc(2 * 0.5rem);
19
+ }
@@ -0,0 +1,156 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import PropTypes from "prop-types";
3
+ import isDeepEqual from 'fast-deep-equal/react';
4
+
5
+ import Grid from '@material-ui/core/Grid';
6
+ import TextField from '@material-ui/core/TextField';
7
+ import Operator from '@pega/react-sdk-components/lib/components/designSystemExtensions/Operator';
8
+
9
+ import './CaseSummaryFields.css';
10
+
11
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
12
+
13
+ export default function CaseSummaryFields(props) {
14
+ const { status, showStatus, theFields } = props;
15
+
16
+ const [theFieldsToRender, setFieldsToRender] = useState([]);
17
+ const [theFieldsAsGridItems, setFieldsAsGridItems] = useState<Array<any>>([]);
18
+
19
+
20
+ function getFieldValue(field: any): any {
21
+ const fieldTypeLower = field.type.toLowerCase();
22
+
23
+ if (field.config.value === null || field.config.value === "") {
24
+ // Special handling for missing value
25
+ // eslint-disable-next-line sonarjs/no-small-switch
26
+ switch(fieldTypeLower) {
27
+ case "caseoperator" :
28
+ return <Operator caseOpConfig={field.config} />;
29
+ break;
30
+
31
+ default:
32
+ return <TextField
33
+ value="---"
34
+ label={field.config.label}
35
+ InputProps={{
36
+ readOnly: true
37
+ }} />;
38
+ }
39
+ }
40
+
41
+ switch(fieldTypeLower) {
42
+ case "textinput" :
43
+ return <TextField
44
+ value={field.config.value}
45
+ label={field.config.label}
46
+ InputProps={{
47
+ readOnly: true
48
+ }} />;
49
+
50
+ case "status" :
51
+ return <TextField
52
+ className="psdk-csf-status-style"
53
+ value={field.config.value}
54
+ label={field.config.label}
55
+ InputProps={{
56
+ readOnly: true
57
+ }} />;
58
+
59
+ case "phone":
60
+ {
61
+ const displayPhone = (field.config.value !== "") ? field.config.value : "---";
62
+ return <a href={`tel:${displayPhone}`}>
63
+ <TextField
64
+ value={field.config.value}
65
+ label={field.config.label}
66
+ InputProps={{
67
+ readOnly: true,
68
+ inputProps: {style: {cursor: 'pointer'}}
69
+ }}
70
+ />
71
+ </a>;
72
+ }
73
+
74
+ case "email":
75
+ {
76
+ const displayEmail = format(field.config.value, field.type);
77
+ return <a href={`mailto:${displayEmail}`}>
78
+ <TextField
79
+ value={field.config.value}
80
+ label={field.config.label}
81
+ InputProps={{
82
+ readOnly: true,
83
+ inputProps: {style: {cursor: 'pointer'}}
84
+ }}
85
+ />
86
+ </a>;
87
+
88
+ }
89
+
90
+ case "date":
91
+ return <TextField
92
+ value={format(field.config.value, field.type)}
93
+ label={field.config.label}
94
+ InputProps={{
95
+ readOnly: true
96
+ }} />;
97
+
98
+ case "caseoperator":
99
+ return <Operator caseOpConfig={field.config} />;
100
+ break;
101
+
102
+ default:
103
+ return (
104
+ <span>{field.type.toLowerCase()} {field.config.value}</span>
105
+ );
106
+
107
+ }
108
+
109
+ }
110
+
111
+
112
+ // Whenever theFieldsToRender changes, update theFieldsAsGridItems that's used during render
113
+ useEffect(() => {
114
+ const arGridItems = theFieldsToRender.map((field: any) => {
115
+ return ( <Grid item xs={6} key={field.config.label}>{getFieldValue(field)}</Grid> );
116
+ });
117
+ setFieldsAsGridItems(arGridItems);
118
+ },
119
+ [theFieldsToRender]);
120
+
121
+
122
+ const theFieldsModifiable = theFields;
123
+
124
+ // Special Case: if showStatus is true, splice the status value to be 2nd in theFields
125
+ // if it's not already there
126
+ if (showStatus && theFields?.[1].type !== "status") {
127
+ const oStatus = { type: "status", config: { value: status, label: "Status" }};
128
+
129
+ const count = theFieldsModifiable.length;
130
+ if (count < 2) {
131
+ theFieldsModifiable.push(oStatus);
132
+ }
133
+ else {
134
+ theFieldsModifiable.splice(1, 0, oStatus);
135
+ }
136
+ }
137
+
138
+ // At this point, we know what fields we want to render...
139
+ // So, update our state if it's changed
140
+ if (!isDeepEqual(theFieldsToRender, theFieldsModifiable)) {
141
+ setFieldsToRender(theFieldsModifiable);
142
+ }
143
+
144
+
145
+ return <React.Fragment>
146
+ <Grid container className="psdk-case-summary-fields">
147
+ {theFieldsAsGridItems}
148
+ </Grid>
149
+ </React.Fragment>;
150
+ }
151
+
152
+ CaseSummaryFields.propTypes = {
153
+ status: PropTypes.string,
154
+ showStatus: PropTypes.bool,
155
+ theFields: PropTypes.arrayOf(PropTypes.object)
156
+ };
@@ -0,0 +1 @@
1
+ export { default } from './CaseSummaryFields';
@@ -0,0 +1,154 @@
1
+ /* eslint-disable react/no-array-index-key */
2
+ import React, { createElement, isValidElement } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import Grid from '@material-ui/core/Grid';
5
+ import Typography from '@material-ui/core/Typography';
6
+ import { makeStyles } from '@material-ui/core/styles';
7
+
8
+ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
9
+
10
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
11
+
12
+ const useStyles = makeStyles(theme => ({
13
+ root: {
14
+ paddingRight: theme.spacing(1),
15
+ paddingLeft: theme.spacing(1),
16
+ paddingTop: theme.spacing(1),
17
+ paddingBottom: theme.spacing(1),
18
+ marginRight: theme.spacing(1),
19
+ marginLeft: theme.spacing(1),
20
+ marginTop: theme.spacing(1),
21
+ marginBottom: theme.spacing(1)
22
+ },
23
+ fieldLabel: {
24
+ display: 'block',
25
+ fontWeight: 400,
26
+ color: theme.palette.text.secondary
27
+ },
28
+ fieldValue: {
29
+ fontWeight: 400,
30
+ color: theme.palette.text.primary
31
+ }
32
+ }));
33
+
34
+ export default function DetailsFields(props) {
35
+ // const componentName = "DetailsFields";
36
+ const { fields } = props;
37
+ const classes = useStyles();
38
+ const fieldComponents: Array<any> = [];
39
+
40
+ fields?.forEach((field, index) => {
41
+ const thePConn = field.getPConnect();
42
+ const theCompType = thePConn.getComponentName().toLowerCase();
43
+ const { label, value } = thePConn.getConfigProps();
44
+ // If value is "" then also we would have to get viewMetadata using getReferencedView.
45
+ if (theCompType === 'reference' || value === '') {
46
+ const configObj = thePConn?.getReferencedView();
47
+ configObj.config.readOnly = theCompType === 'reference';
48
+ configObj.config.displayMode = 'LABELS_LEFT';
49
+ const propToUse = { ...thePConn.getInheritedProps() };
50
+ configObj.config.label = theCompType === 'reference' ? propToUse?.label : label;
51
+ fieldComponents.push({
52
+ type: theCompType,
53
+ label,
54
+ value: (
55
+ <React.Fragment key={index}>
56
+ {createElement(createPConnectComponent(), thePConn.getReferencedViewPConnect())}
57
+ </React.Fragment>
58
+ )
59
+ });
60
+ } else {
61
+ fieldComponents.push({ type: theCompType, value, label });
62
+ }
63
+ });
64
+
65
+ function getGridItemLabel(field: any, keyVal: string) {
66
+ const dispValue = field.label;
67
+
68
+ return (
69
+ <Grid item xs={6} key={keyVal}>
70
+ <Typography variant='body2' component='span' className={`${classes.fieldLabel}`}>
71
+ {dispValue}
72
+ </Typography>
73
+ </Grid>
74
+ );
75
+ }
76
+
77
+ function formatItemValue(inField: any) {
78
+ const { type, value } = inField;
79
+ let formattedVal = value;
80
+
81
+ // eslint-disable-next-line sonarjs/no-small-switch
82
+ switch (type) {
83
+ case 'date':
84
+ formattedVal = format(value, type);
85
+ break;
86
+
87
+ default:
88
+ // No match means we return the value as we received it
89
+ break;
90
+ }
91
+
92
+ // Finally, if the value is undefined or an empty string, we want to display it as "---"
93
+ if (formattedVal === undefined || formattedVal === '') {
94
+ formattedVal = '---';
95
+ }
96
+
97
+ return formattedVal;
98
+ }
99
+
100
+ function getGridItemValue(field: any, keyVal: string) {
101
+ const formattedValue = formatItemValue(field);
102
+
103
+ return (
104
+ <Grid item xs={6} key={keyVal}>
105
+ <Typography variant='body2' component='span' className={classes.fieldValue}>
106
+ {formattedValue}
107
+ </Typography>
108
+ </Grid>
109
+ );
110
+ }
111
+
112
+ function getGridItem(field: any, keyVal: string) {
113
+
114
+ return (
115
+ <Grid item xs={12} key={keyVal}>
116
+ <Typography variant='body2' component='span' className={classes.fieldValue}>
117
+ {field?.value}
118
+ </Typography>
119
+ </Grid>
120
+ );
121
+ }
122
+
123
+ function getGridItems() {
124
+ const gridItems: Array<any> = fieldComponents.map((field, index) => {
125
+ if (field?.type === 'reference') {
126
+ return field?.value;
127
+ } else if (isValidElement(field?.value)) {
128
+ return (
129
+ <Grid container spacing={1} style={{ padding: '4px 0px' }} key={index}>
130
+ {getGridItem(field, `${index}-item`)}
131
+ </Grid>
132
+ );
133
+ } else {
134
+ return (
135
+ <Grid container spacing={1} style={{ padding: '4px 0px' }} key={index}>
136
+ {getGridItemLabel(field, `${index}-label`)}
137
+ {getGridItemValue(field, `${index}-value`)}
138
+ </Grid>
139
+ );
140
+ }
141
+ });
142
+ return gridItems;
143
+ }
144
+
145
+ return <React.Fragment>{getGridItems()}</React.Fragment>;
146
+ }
147
+
148
+ DetailsFields.defaultProps = {
149
+ fields: []
150
+ };
151
+
152
+ DetailsFields.propTypes = {
153
+ fields: PropTypes.arrayOf(PropTypes.any)
154
+ };
@@ -0,0 +1 @@
1
+ export { default } from './DetailsFields';
@@ -0,0 +1,113 @@
1
+ import React from 'react';
2
+ import Grid from '@material-ui/core/Grid';
3
+ import Typography from '@material-ui/core/Typography';
4
+ import { makeStyles } from '@material-ui/core/styles';
5
+ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
6
+
7
+ function generateFields(item, fields) {
8
+ for (const label in item) {
9
+ if (Utils.isObject(item[label])) {
10
+ generateFields(item[label], fields);
11
+ } else if (label !== 'classID') {
12
+ fields.push({ label, value: item[label] });
13
+ }
14
+ }
15
+ }
16
+
17
+ const useStyles = makeStyles(theme => ({
18
+ root: {
19
+ marginRight: theme.spacing(1),
20
+ marginLeft: theme.spacing(1),
21
+ marginTop: theme.spacing(1),
22
+ marginBottom: theme.spacing(1)
23
+ },
24
+ fieldMargin: {
25
+ paddingTop: theme.spacing(1),
26
+ paddingBottom: theme.spacing(1),
27
+ marginTop: theme.spacing(1),
28
+ marginBottom: theme.spacing(1)
29
+ },
30
+ fieldLabel: {
31
+ fontWeight: 400,
32
+ color: theme.palette.text.secondary
33
+ },
34
+ fieldValue: {
35
+ fontWeight: 400,
36
+ color: theme.palette.text.primary
37
+ }
38
+ }));
39
+
40
+ const FieldGroup = props => {
41
+ const classes = useStyles();
42
+
43
+ const fields: any = [];
44
+ generateFields(props.item, fields);
45
+
46
+ function getGridItemLabel(label) {
47
+ const dispValue = label;
48
+
49
+ return (
50
+ <Grid item xs={6}>
51
+ <Typography
52
+ variant='body2'
53
+ component='span'
54
+ className={`${classes.fieldLabel} ${classes.fieldMargin}`}
55
+ >
56
+ {dispValue}
57
+ </Typography>
58
+ </Grid>
59
+ );
60
+ }
61
+
62
+ function formatItemValue(value) {
63
+ let formattedVal = value;
64
+
65
+ // if the value is an empty string, we want to display it as "---"
66
+ if (formattedVal === '') {
67
+ formattedVal = '---';
68
+ }
69
+
70
+ return formattedVal;
71
+ }
72
+
73
+ function getGridItemValue(value) {
74
+ const formattedValue = formatItemValue(value);
75
+
76
+ return (
77
+ <Grid item xs={6}>
78
+ <Typography variant='body2' component='span' className={classes.fieldValue}>
79
+ {formattedValue}
80
+ </Typography>
81
+ </Grid>
82
+ );
83
+ }
84
+
85
+ function getGridItems() {
86
+ const gridItems = fields.map((item) => {
87
+ return (
88
+ <Grid key={`${item.label}-${item.value}`} container spacing={1}>
89
+ {getGridItemLabel(item.label)}
90
+ {getGridItemValue(item.value)}
91
+ </Grid>
92
+ );
93
+ });
94
+ return gridItems;
95
+ }
96
+
97
+ return (
98
+ <React.Fragment>
99
+ <Grid container spacing={4} justifyContent='space-between'>
100
+ <Grid item style={{ width: '100%' }}>
101
+ {fields.length > 0 && (
102
+ <div className={classes.fieldMargin}>
103
+ <b>{props.name}</b>
104
+ </div>
105
+ )}
106
+ {getGridItems()}
107
+ </Grid>
108
+ </Grid>
109
+ </React.Fragment>
110
+ );
111
+ };
112
+
113
+ export default FieldGroup;
@@ -0,0 +1 @@
1
+ export { default } from './FieldGroup';
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+
3
+ import Grid from '@material-ui/core/Grid';
4
+ import Divider from '@material-ui/core/Divider';
5
+ import Link from '@material-ui/core/Link';
6
+
7
+ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
8
+
9
+ declare const PCore: any;
10
+
11
+ const FieldGroupList = props => {
12
+ let menuIconOverride$ = 'trash';
13
+ if (menuIconOverride$) {
14
+ menuIconOverride$ = Utils.getImageSrc(
15
+ menuIconOverride$,
16
+ PCore.getAssetLoader().getStaticServerUrl()
17
+ );
18
+ }
19
+
20
+ return (
21
+ <Grid container spacing={4} justifyContent='space-between'>
22
+ <Grid item style={{ width: '100%' }}>
23
+ <Grid container spacing={1}>
24
+ {props.items.map(item => (
25
+ <Grid item style={{ width: '100%' }}>
26
+ <b>{item.name}</b>
27
+ <button
28
+ type='button'
29
+ style={{ float: 'right' }}
30
+ className='psdk-utility-button'
31
+ id={`delete-row-${Utils.getLastChar(item.name)}`}
32
+ onClick={() => {
33
+ props.onDelete(item.id);
34
+ }}
35
+ >
36
+ <img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$}></img>
37
+ </button>
38
+ {item.children}
39
+ <br />
40
+ <Divider />
41
+ <br />
42
+ </Grid>
43
+ ))}
44
+ <Link onClick={props.onAdd} style={{ cursor: 'pointer' }}>
45
+ +Add
46
+ </Link>
47
+ </Grid>
48
+ </Grid>
49
+ </Grid>
50
+ );
51
+ };
52
+
53
+ export default FieldGroupList;
@@ -0,0 +1 @@
1
+ export { default } from './FieldGroupList';
@@ -0,0 +1,106 @@
1
+ import React from 'react';
2
+
3
+ import Grid from '@material-ui/core/Grid';
4
+ import Typography from '@material-ui/core/Typography';
5
+ import { makeStyles } from '@material-ui/core/styles';
6
+
7
+ const useStyles = makeStyles(theme => ({
8
+ root: {
9
+ marginRight: theme.spacing(1),
10
+ marginLeft: theme.spacing(1),
11
+ marginTop: theme.spacing(1),
12
+ marginBottom: theme.spacing(1)
13
+ },
14
+ fieldMargin: {
15
+ // paddingRight: theme.spacing(1),
16
+ // paddingLeft: theme.spacing(1),
17
+ // paddingTop: theme.spacing(1),
18
+ // paddingBottom: theme.spacing(1),
19
+ // marginRight: theme.spacing(1),
20
+ // marginLeft: theme.spacing(1),
21
+ // marginTop: theme.spacing(1),
22
+ // marginBottom: theme.spacing(1)
23
+ },
24
+ fieldLabel: {
25
+ fontWeight: 400,
26
+ color: theme.palette.text.secondary
27
+ },
28
+ fieldValue: {
29
+ fontWeight: 400,
30
+ color: theme.palette.text.primary
31
+ }
32
+ }));
33
+
34
+ const FieldValueList = props => {
35
+ const classes = useStyles();
36
+
37
+ const fields: any = [];
38
+
39
+ // eslint-disable-next-line guard-for-in
40
+ for (const label in props.item) {
41
+ fields.push({ label, value: props.item[label] });
42
+ }
43
+
44
+ function getGridItemLabel(label) {
45
+ const dispValue = label;
46
+
47
+ return (
48
+ <Grid item xs={6}>
49
+ <Typography
50
+ variant='body2'
51
+ component='span'
52
+ className={`${classes.fieldLabel} ${classes.fieldMargin}`}
53
+ >
54
+ {dispValue}
55
+ </Typography>
56
+ </Grid>
57
+ );
58
+ }
59
+
60
+ function formatItemValue(value) {
61
+ let formattedVal = value;
62
+
63
+ // if the value is undefined or an empty string, we want to display it as "---"
64
+ if (formattedVal === undefined || formattedVal === '') {
65
+ formattedVal = '---';
66
+ }
67
+
68
+ return formattedVal;
69
+ }
70
+
71
+ function getGridItemValue(value) {
72
+ const formattedValue = formatItemValue(value);
73
+
74
+ return (
75
+ <Grid item xs={6}>
76
+ <Typography variant='body2' component='span' className={classes.fieldValue}>
77
+ {formattedValue}
78
+ </Typography>
79
+ </Grid>
80
+ );
81
+ }
82
+
83
+ function getGridItems() {
84
+ const gridItems = fields.map(item => {
85
+ return (
86
+ <Grid container spacing={1} key={item.label}>
87
+ {getGridItemLabel(item.label)}
88
+ {getGridItemValue(item.value)}
89
+ </Grid>
90
+ );
91
+ });
92
+ return gridItems;
93
+ }
94
+
95
+ return (
96
+ <React.Fragment>
97
+ <Grid container spacing={4} justifyContent='space-between'>
98
+ <Grid item style={{ width: '100%' }}>
99
+ {getGridItems()}
100
+ </Grid>
101
+ </Grid>
102
+ </React.Fragment>
103
+ );
104
+ };
105
+
106
+ export default FieldValueList;
@@ -0,0 +1 @@
1
+ export { default } from './FieldValueList';