@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,336 @@
1
+ import React, { useMemo, useRef, useState, useEffect, useContext, createElement } from "react";
2
+ // import { Banner, ModalManager } from "@pega/cosmos-react-core";
3
+ import PropTypes, { object } from "prop-types";
4
+ import isEqual from 'lodash.isequal';
5
+ // import ReAuthMessageModal from "../ReAuthenticationModal";
6
+ import { Box, CircularProgress } from "@material-ui/core";
7
+ import createPConnectComponent from "@pega/react-sdk-components/lib/bridge/react_pconnect";
8
+ import { LazyMap as LazyComponentMap } from "@pega/react-sdk-components/lib/components_map";
9
+ import StoreContext from "@pega/react-sdk-components/lib/bridge/Context/StoreContext";
10
+ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
11
+
12
+ declare const PCore;
13
+
14
+ //
15
+ // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
16
+ // Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
17
+ // is totally at your own risk.
18
+ //
19
+
20
+
21
+ const renderingModes = ["portal", "view"];
22
+
23
+ function usePrevious(value) {
24
+ const ref = useRef(null);
25
+ useEffect(() => {
26
+ ref.current = value;
27
+ });
28
+ return ref.current;
29
+ }
30
+
31
+ function getItemView(routingInfo, renderingMode) {
32
+ const viewConfigs: any = [];
33
+ if (routingInfo && renderingModes.includes(renderingMode)) {
34
+ const { accessedOrder, items }: {accessedOrder: any, items:any } = routingInfo;
35
+ if (accessedOrder && items) {
36
+ const key = accessedOrder[accessedOrder.length - 1];
37
+ if (
38
+ items[key] &&
39
+ items[key].view &&
40
+ !Utils.isEmptyObject(items[key].view)
41
+ ) {
42
+ viewConfigs.push(items[key]);
43
+ }
44
+ }
45
+ }
46
+ return viewConfigs;
47
+ }
48
+
49
+ const RootContainer = (props) => {
50
+ const {
51
+ getPConnect,
52
+ renderingMode,
53
+ children,
54
+ skeleton,
55
+ httpMessages,
56
+ routingInfo
57
+ } = props;
58
+
59
+ const { displayOnlyFA, isMashup } = useContext(StoreContext);
60
+
61
+
62
+ const pConn = getPConnect();
63
+
64
+ const options = { "context": "app" };
65
+ if (isMashup) {
66
+ options["context"] = "root";
67
+ }
68
+
69
+ // Used for embedded mode
70
+ // let newPConn: any;
71
+ const [componentName, setComponentName] = useState("");
72
+
73
+ useEffect( () => {
74
+ // debugging/investigation help
75
+ // console.log(`componentName change: ${componentName} triggering a re-render`);
76
+ }, [componentName] );
77
+
78
+ // debugging/investigation help
79
+ // console.log(`RootContainer props.routingInfo: ${JSON.stringify(routingInfo)}`);
80
+
81
+ // const bannerRef = useRef(null);
82
+ let hasBanner = false;
83
+ let banners: any = null;
84
+ const messages = httpMessages
85
+ ? httpMessages.map((msg) => msg.message)
86
+ : httpMessages;
87
+
88
+ hasBanner = messages && messages.length > 0;
89
+ banners = hasBanner && (<div>RootContainer: trying to emit Banner with {messages}</div>);
90
+ // && (
91
+ // <Banner
92
+ // ref={bannerRef}
93
+ // id="appShellBanner"
94
+ // variant="urgent"
95
+ // heading="Error"
96
+ // onDismiss={() =>
97
+ // pConn.clearErrorMessages({
98
+ // category: "HTTP",
99
+ // context: "root"
100
+ // })
101
+ // }
102
+ // messages={messages}
103
+ // />
104
+ // );
105
+
106
+ const MemoizedModalViewContainer = useMemo(() => {
107
+ return createElement(
108
+ createPConnectComponent(),
109
+ PCore.createPConnect({
110
+ meta: {
111
+ type: "ModalViewContainer",
112
+ config: {
113
+ name: "modal"
114
+ }
115
+ },
116
+ options
117
+ })
118
+ );
119
+ }, []);
120
+
121
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
122
+ const MemoizedPreviewViewContainer = useMemo(() => {
123
+ return createElement(
124
+ createPConnectComponent(),
125
+ PCore.createPConnect({
126
+ meta: {
127
+ type: "PreviewViewContainer",
128
+ config: {
129
+ name: "preview"
130
+ }
131
+ },
132
+ options
133
+ })
134
+ );
135
+ }, []);
136
+
137
+
138
+ //
139
+ function getNoPortalContent() {
140
+ let noPortalContent: any;
141
+
142
+ switch (componentName) {
143
+ case "View":
144
+ noPortalContent = <div>getNoPortalContent: RootContainer wants to render View in noPortal mode</div>
145
+ break;
146
+
147
+ case "ViewContainer": {
148
+ const configProps = pConn.getConfigProps();
149
+ const viewContConfig = {
150
+ "meta": {
151
+ "type": "ViewContainer",
152
+ "config": configProps
153
+ },
154
+ options
155
+ };
156
+ const theViewCont = PCore.createPConnect(viewContConfig);
157
+ // Add in displayOnlyFA if prop is on RootContainer
158
+ if (displayOnlyFA) {
159
+ theViewCont["displayOnlyFA"] = true;
160
+ }
161
+
162
+ const theViewContainerAsReact = createElement(createPConnectComponent(), theViewCont);
163
+
164
+ noPortalContent = theViewContainerAsReact;
165
+ break;
166
+ }
167
+
168
+ default:
169
+ noPortalContent = <div>getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode</div>
170
+ break;
171
+
172
+ }
173
+
174
+ return noPortalContent;
175
+ }
176
+
177
+
178
+ // const rootViewRef: any = useRef(null);
179
+ let rootView : any;
180
+ let rootViewConfig: any = null;
181
+
182
+ useEffect(() => {
183
+ const { containers } = PCore.getStore().getState();
184
+ const items = Object.keys(containers).filter((item) =>
185
+ item.includes("root")
186
+ );
187
+ PCore.getContainerUtils().getContainerAPI().addContainerItems(items);
188
+ }, [routingInfo]);
189
+
190
+ // const { store } = useConstellationContext();
191
+ const items: any = getItemView(routingInfo, renderingMode);
192
+
193
+ if (items.length > 0) {
194
+ rootViewConfig = {
195
+ meta: items[0].view,
196
+ options: {
197
+ context: items[0].context
198
+ }
199
+ };
200
+ }
201
+ const prevRootConfig = usePrevious(rootViewConfig);
202
+
203
+ if (
204
+ renderingModes.includes(renderingMode) &&
205
+ messages &&
206
+ routingInfo &&
207
+ routingInfo?.accessedOrder.length === 0
208
+ ) {
209
+ return <div id="root-container">{banners}</div>;
210
+ }
211
+
212
+ if (items.length > 0) {
213
+ const itemView = items[0].view;
214
+ const currentRootConfig = {
215
+ meta: itemView,
216
+ options: {
217
+ context: items[0].context
218
+ }
219
+ };
220
+
221
+ if (!isEqual(currentRootConfig, prevRootConfig)) {
222
+ rootView = createElement(
223
+ createPConnectComponent(),
224
+ PCore.createPConnect(currentRootConfig)
225
+ );
226
+ }
227
+
228
+ // interior was
229
+ // <ModalManager>
230
+ // {rootViewRef.current}
231
+ // {MemoisedModalViewContainer}
232
+ // {MemoizedPreviewViewContainer}
233
+ // <ReAuthMessageModal openModal={false} key="reauthMessageModel" />
234
+ // </ModalManager> */}
235
+
236
+ // debugging/investigation help
237
+ // console.log(`rootView.props.getPConnect().getComponentName(): ${rootView.props.getPConnect().getComponentName()}`);
238
+
239
+ return (
240
+ <div id="ModalManager">
241
+ {rootView}
242
+ {MemoizedModalViewContainer}
243
+ <div id="MemoizedPreviewViewContainer"></div>
244
+ <div id="ReAuthMessageModal"></div>
245
+ </div>
246
+ );
247
+
248
+ }
249
+ else if (renderingMode === "noPortal") {
250
+ // eslint-disable-next-line no-console
251
+ console.log(`RootContainer rendering in noPortal mode`);
252
+
253
+ const theChildren = pConn.getChildren();
254
+ if (theChildren && (theChildren.length === 1)) {
255
+ // this.createdPConnect = theChildren[0];
256
+ // this.createdPConnect = null;
257
+ const localPConn = theChildren[0].getPConnect();
258
+ // newPConn = pConn;
259
+ const localCompName = localPConn.getComponentName()
260
+ if (componentName !== localCompName) {
261
+ setComponentName(localCompName);
262
+ }
263
+ }
264
+
265
+ const noPortalContent = getNoPortalContent();
266
+
267
+ return noPortalContent;
268
+ }
269
+ else if (children && children.length > 0) {
270
+ // interior was
271
+ // <ModalManager>
272
+ // {httpMessages ? <div id="root-container">{banners}</div> : ""}
273
+ // {children}
274
+ // {MemoizedModalViewContainer}
275
+ // <ReAuthMessageModal openModal={false} key="reauthMessageModel" />
276
+ // {MemoizedPreviewViewContainer}
277
+ // </ModalManager>
278
+
279
+ return (
280
+ <React.Fragment>
281
+ <div>RootContainer: Has children. Trying to show ModalManager with children, etc.</div>
282
+ {children}
283
+ {MemoizedModalViewContainer}
284
+ </React.Fragment>
285
+
286
+ );
287
+ } else if (skeleton) {
288
+ // TODO: need to update once skeletons are available
289
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
290
+ const LoadingComponent = LazyComponentMap[skeleton];
291
+ // interior was
292
+ // <ModalManager>
293
+ // <ReAuthMessageModal openModal={false} key="reauthMessageModel" />
294
+ // <LoadingComponent />
295
+ // </ModalManager>
296
+
297
+ return (
298
+ <div id="root-container">
299
+ {/* <div>RootContainer: Trying to show skeleton</div> */}
300
+ <Box textAlign="center"><CircularProgress /></Box>
301
+ </div>
302
+ );
303
+ } else {
304
+ // interior was
305
+ // <ModalManager>
306
+ // {MemoisedModalViewContainer}
307
+ // {MemoizedPreviewViewContainer}
308
+ // <ReAuthMessageModal openModal={false} key="reauthMessageModel" />
309
+ // </ModalManager>
310
+ return (
311
+ <div id="root-container">
312
+ <div>RootContainer: Should be ModalManager, etc.</div>
313
+ </div>
314
+ );
315
+ }
316
+ };
317
+
318
+ RootContainer.defaultProps = {
319
+ getPConnect: null,
320
+ renderingMode: null,
321
+ children: null,
322
+ routingInfo: object
323
+ };
324
+
325
+ RootContainer.propTypes = {
326
+ getPConnect: PropTypes.func,
327
+ renderingMode: PropTypes.string,
328
+ routingInfo: PropTypes.shape({
329
+ type: PropTypes.string,
330
+ accessedOrder: PropTypes.array,
331
+ items: PropTypes.object
332
+ }),
333
+ children: PropTypes.arrayOf(PropTypes.oneOfType( [PropTypes.object, PropTypes.string ]))
334
+ };
335
+
336
+ export default RootContainer;
@@ -0,0 +1 @@
1
+ export { default } from './RootContainer';
@@ -0,0 +1,120 @@
1
+ import React from "react";
2
+ // import { Stages as CosmosStages } from "@pega/cosmos-react-work";
3
+ import PropTypes from "prop-types";
4
+ import { Breadcrumbs, Card, Typography } from "@material-ui/core";
5
+ import DoubleArrowIcon from '@material-ui/icons/DoubleArrow';
6
+ import DoneIcon from '@material-ui/icons/Done';
7
+ import { makeStyles } from '@material-ui/core/styles';
8
+
9
+ declare const PCore: any;
10
+
11
+ const useStyles = makeStyles((theme) => ({
12
+ root: {
13
+ paddingRight: theme.spacing(1),
14
+ paddingLeft: theme.spacing(1),
15
+ paddingTop: theme.spacing(1),
16
+ paddingBottom: theme.spacing(1),
17
+ marginRight: theme.spacing(1),
18
+ marginLeft: theme.spacing(1),
19
+ marginTop: theme.spacing(1),
20
+ marginBottom: theme.spacing(1),
21
+ },
22
+ completedStage: {
23
+ color: theme.palette.text.primary,
24
+ },
25
+ currentStage: {
26
+ color: theme.palette.info.dark,
27
+ fontWeight: 600,
28
+ },
29
+ futureStage: {
30
+ color: theme.palette.text.secondary,
31
+ },
32
+ separatorIcon: {
33
+ color: theme.palette.text.disabled,
34
+ }
35
+
36
+ }));
37
+
38
+
39
+ /**
40
+ * API to filter out the alternate stages which are not in active and return all other stages
41
+ * @param {Array} stages - Stages of a case type
42
+ *
43
+ * @returns {Array} - Returns stages which are non alternate stages and alternate stage which is active.
44
+ */
45
+ function getFilteredStages(stages) {
46
+ if (!Array.isArray(stages)) {
47
+ return [];
48
+ }
49
+
50
+ return stages.filter(
51
+ (stage) =>
52
+ stage.type !== "Alternate" ||
53
+ (stage.type === "Alternate" && stage.visited_status === "active")
54
+ );
55
+ }
56
+
57
+ /* TODO - this component should be refactored and not exposed as top level Nebula component -
58
+ the stages should be created as part of the CaseView */
59
+ export default function Stages(props) {
60
+ const classes = useStyles();
61
+
62
+ const { getPConnect, stages } = props;
63
+ const pConn = getPConnect();
64
+
65
+ const filteredStages = getFilteredStages(stages);
66
+ const currentStageID = pConn.getValue(PCore.getConstants().CASE_INFO.STAGEID);
67
+ const stagesObj = filteredStages.map((stage, index, arr) => {
68
+ const theID = stage.ID || stage.id;
69
+ return {
70
+ name: stage.name,
71
+ id: theID,
72
+ complete: stage.visited_status === "completed",
73
+ current: (theID === currentStageID),
74
+ last: (index === arr.length - 1),
75
+ };
76
+ });
77
+
78
+ // debugging/investigation help
79
+ // console.log(`Stages: current: ${currentStageID} stagesObj: ${JSON.stringify(stagesObj)}`);
80
+
81
+ function getStage(stage, index) {
82
+ // Removing nested ternary for lint
83
+ // const theClass = stage.current ? classes.currentStage : (stage.complete ? classes.completedStage : classes.futureStage);
84
+ let theClass;
85
+ if (stage.current) {
86
+ theClass = classes.currentStage;
87
+ } else if (stage.complete) {
88
+ theClass = classes.completedStage;
89
+ } else {
90
+ theClass = classes.futureStage;
91
+ }
92
+
93
+ return <span key={index}>
94
+ {stage.complete ? <DoneIcon color="disabled" fontSize="small" /> : null}
95
+ <Typography variant="h5" component="span" display="inline" className={theClass}>{stage.name}</Typography>
96
+ </span>;
97
+ }
98
+
99
+ function getStages(inStages) {
100
+ return <Breadcrumbs aria-label="stages" separator={<DoubleArrowIcon className={classes.separatorIcon} />}>
101
+ {inStages.map((stage, index) => {
102
+ return getStage(stage, index);
103
+ })}
104
+ </Breadcrumbs>
105
+ }
106
+
107
+ return (
108
+ <Card id="Stages" className={classes.root}>
109
+ {/* Stages<br />
110
+ currentStageID: {currentStageID}<br />
111
+ {JSON.stringify(stagesObj)}<br /><br /> */}
112
+ {getStages(stagesObj)}
113
+ </Card>
114
+ )
115
+ }
116
+
117
+ Stages.propTypes = {
118
+ getPConnect: PropTypes.func.isRequired,
119
+ stages: PropTypes.arrayOf(PropTypes.object).isRequired
120
+ };
@@ -0,0 +1 @@
1
+ export { default } from './Stages';
@@ -0,0 +1,87 @@
1
+ .psdk-display-divider {
2
+ border-bottom: 0.0625rem solid var(--app-neutral-light-color);
3
+ }
4
+
5
+ .psdk-todo {
6
+ padding: 0.5rem;
7
+ }
8
+
9
+ .psdk-todo-header {
10
+ display: inline-flex;
11
+ }
12
+
13
+ .psdk-todo-text {
14
+ padding: 0.5rem 0.625rem;
15
+ font-size: 1.1rem;
16
+ font-weight: bold;
17
+ }
18
+
19
+ .psdk-assignment-count {
20
+ background-color: var(--app-primary-light-color);
21
+ margin: .5rem;
22
+ border-radius: 45%;
23
+ padding: 0.15rem .4rem;
24
+ }
25
+
26
+ .psdk-todo-id {
27
+ color: var(--app-primary-color);
28
+ cursor: pointer;
29
+ }
30
+
31
+ .psdk-avatar {
32
+ margin: 0rem;
33
+ padding: 0rem;
34
+ min-width: 2.5rem;
35
+ min-height: 2.5rem;
36
+ max-width: 2.5rem;
37
+ max-height: 2.5rem;
38
+ border-radius: 50%;
39
+ justify-content: center;
40
+ align-items: center;
41
+ text-align: center;
42
+ display: flex;
43
+ background: var(--app-primary-color);
44
+ color: white;
45
+ font-weight: bold;
46
+ font-size: 1.25rem;
47
+ }
48
+
49
+ .psdk-todo-assignment {
50
+ display: inline-flex;
51
+ width:100%;
52
+ padding: 0.625rem 0rem;
53
+ }
54
+
55
+ .psdk-todo-assignment-data {
56
+ display: inline-flex;
57
+ }
58
+
59
+ .psdk-todo-assignment-status {
60
+ background-color: var(--app-neutral-light-color);
61
+ border-radius: 0.125rem;
62
+ color: darkslategray;
63
+ font-size: 0.75rem;
64
+ font-weight: bold;
65
+ line-height: calc(0.5rem * 2.5);
66
+ height: calc(0.5rem * 2.5);
67
+ padding: 0 0.5rem;
68
+ text-transform: uppercase;
69
+ }
70
+
71
+ .psdk-todo-assignment-task {
72
+ color: var(--app-neutral-color);
73
+ }
74
+
75
+ .psdk-todo-assignment-action {
76
+ display: inline-flex;
77
+ }
78
+
79
+ .psdk-todo-card {
80
+ width: 100%;
81
+ padding-left: 0.625rem;
82
+ }
83
+
84
+ .psdk-todo-show-more {
85
+ width: 100%;
86
+ text-align: center;
87
+ }