@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 @@
1
+ export { default } from './ListView';
@@ -0,0 +1,42 @@
1
+ import PropTypes from "prop-types";
2
+ import React from "react";
3
+
4
+ declare const PCore;
5
+ export default function MultiReferenceReadOnly(props) {
6
+ const { getPConnect, label, hideLabel, config } = props;
7
+ const { referenceList, readonlyContextList } = config;
8
+
9
+ // When referenceList does not contain selected values, it should be replaced with readonlyContextList while calling SimpleTableManual
10
+ let readonlyContextObject;
11
+ if ( !PCore.getAnnotationUtils().isProperty(referenceList)) {
12
+ readonlyContextObject = {
13
+ referenceList: readonlyContextList
14
+ };
15
+ }
16
+
17
+ const component = getPConnect().createComponent({
18
+ type: "SimpleTable",
19
+ config: {
20
+ ...config,
21
+ ...readonlyContextObject,
22
+ label,
23
+ hideLabel
24
+ }
25
+ });
26
+
27
+ return (
28
+ <React.Fragment>{component}</React.Fragment>
29
+ )
30
+ }
31
+
32
+ MultiReferenceReadOnly.defaultProps = {
33
+ label: "",
34
+ hideLabel: false
35
+ };
36
+
37
+ MultiReferenceReadOnly.propTypes = {
38
+ config: PropTypes.object.isRequired,
39
+ getPConnect: PropTypes.func.isRequired,
40
+ label: PropTypes.string,
41
+ hideLabel: PropTypes.bool
42
+ };
@@ -0,0 +1 @@
1
+ export { default } from './MultiReferenceReadOnly';
@@ -0,0 +1,21 @@
1
+ .psdk-narrow-wide-column {
2
+ display: flow-root;
3
+ height: 100%;
4
+ }
5
+
6
+ /* Create two equal columns that floats next to each other */
7
+ .psdk-narrow-wide-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
+ .psdk-narrow-wide-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,35 @@
1
+ import React from "react";
2
+
3
+ import './NarrowWide.css';
4
+
5
+ export default function NarrowWide(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-narrow-wide-column">
13
+ <div className="psdk-narrow-column-column">
14
+ {children[0]}
15
+ </div>
16
+ <div className="psdk-wide-column-column">
17
+ {children[1]}
18
+ </div>
19
+ </div>
20
+ }
21
+ {a && b &&
22
+ <div className="psdk-narrow-wide-column">
23
+ <div className="psdk-narrow-column-column">
24
+ {a}
25
+ </div>
26
+ <div className="psdk-wide-column-column">
27
+ {b}
28
+ </div>
29
+ </div>
30
+ }
31
+ </React.Fragment>
32
+
33
+ )
34
+
35
+ }
@@ -0,0 +1 @@
1
+ export { default } from './NarrowWide';
@@ -0,0 +1,53 @@
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 NarrowWideDetails(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(`NarrowWideDetails expects 2 children and received ${arFields.length}`);
19
+ }
20
+
21
+
22
+ return (
23
+ <React.Fragment>
24
+ {children && children.length === 2 &&
25
+ <div className="psdk-narrow-wide-column">
26
+ <div className="psdk-narrow-column-column">
27
+ <DetailsFields fields={arFields[0]} />
28
+ </div>
29
+ <div className="psdk-wide-column-column">
30
+ <DetailsFields fields={arFields[1]} />
31
+ </div>
32
+ </div>
33
+ }
34
+ {a && b &&
35
+ <div className="psdk-narrow-wide-column">
36
+ <div className="psdk-narrow-column-column">
37
+ {a}
38
+ </div>
39
+ <div className="psdk-wide-column-column">
40
+ {b}
41
+ </div>
42
+ </div>
43
+ }
44
+ </React.Fragment>
45
+ )
46
+ }
47
+
48
+ NarrowWideDetails.propTypes = {
49
+ // showLabel: PropTypes.bool,
50
+ // label: PropTypes.string,
51
+ // getPConnect: PropTypes.func.isRequired,
52
+ // template: PropTypes.string.isRequired
53
+ };
@@ -0,0 +1 @@
1
+ export { default } from './NarrowWideDetails';
@@ -0,0 +1,21 @@
1
+ .psdk-narrow-wide-column {
2
+ display: flow-root;
3
+ height: 100%;
4
+ }
5
+
6
+ /* Create two equal columns that floats next to each other */
7
+ .psdk-narrow-wide-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
+ .psdk-narrow-wide-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 './NarrowWideForm.css';
4
+
5
+ export default function NarrowWideForm(props) {
6
+ const {children} = props;
7
+
8
+ return (
9
+ <React.Fragment>
10
+ {children && children.length === 2 &&
11
+ <div className="psdk-narrow-wide-column">
12
+ <div className="psdk-narrow-column-column">
13
+ {children[0]}
14
+ </div>
15
+ <div className="psdk-wide-column-column">
16
+ {children[1]}
17
+ </div>
18
+ </div>
19
+ }
20
+ </React.Fragment>
21
+
22
+ )
23
+
24
+ }
@@ -0,0 +1 @@
1
+ export { default } from './NarrowWideForm';
@@ -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 NarrowWide from '@pega/react-sdk-components/lib/components/templates/NarrowWide';
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 NarrowWidePage(props) {
12
+ const { children, title, templateCol, icon } = props;
13
+ const childArray = Children.toArray(children);
14
+
15
+ return (
16
+ <div>
17
+ <NarrowWide
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
+ NarrowWidePage.propTypes = {
29
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
30
+ title: PropTypes.string.isRequired,
31
+ templateCol: PropTypes.string,
32
+ icon: PropTypes.string
33
+ };
34
+
35
+ NarrowWidePage.defaultProps = {
36
+ templateCol: "1fr 1fr",
37
+ icon: ""
38
+ };
@@ -0,0 +1 @@
1
+ export { default } from './NarrowWidePage';
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { Grid } from "@material-ui/core";
4
+ import { makeStyles } from '@material-ui/core/styles';
5
+
6
+ const useStyles = makeStyles((/* theme */) => ({
7
+ colStyles: {
8
+ display: "grid",
9
+ gap: "1rem",
10
+ alignContent: "baseline",
11
+ },
12
+ }));
13
+
14
+
15
+ export default function OneColumn(props) {
16
+ const classes = useStyles();
17
+
18
+ const { children} = props;
19
+
20
+ return (
21
+ <Grid container spacing={2}>
22
+ <Grid item xs={12} className={classes.colStyles}>
23
+ {children.map(child => { return child; } )}
24
+ </Grid>
25
+ </Grid>
26
+ )
27
+ }
28
+
29
+ OneColumn.propTypes = {
30
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
31
+ // template: PropTypes.string.isRequired
32
+ };
@@ -0,0 +1 @@
1
+ export { default } from './OneColumn';
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ import OneColumn from '@pega/react-sdk-components/lib/components/templates/OneColumn';
5
+
6
+ /*
7
+ * The wrapper handles knowing how to take in just children
8
+ * and mapping to the TwoColumn template.
9
+ */
10
+ export default function OneColumnPage(props) {
11
+
12
+ return (
13
+ <OneColumn
14
+ {...props}
15
+ />
16
+ );
17
+ }
18
+
19
+ OneColumnPage.propTypes = {
20
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
21
+ };
22
+
23
+ OneColumnPage.defaultProps = {
24
+ };
@@ -0,0 +1 @@
1
+ export { default } from './OneColumnPage';
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ export default function OneColumnTab(props) {
5
+ const { children} = props;
6
+
7
+ return (
8
+ <div id="OneColumnTab">
9
+ {children}
10
+ </div>
11
+ )
12
+ }
13
+
14
+ OneColumnTab.propTypes = {
15
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
16
+ // template: PropTypes.string.isRequired
17
+ };
@@ -0,0 +1 @@
1
+ export { default } from './OneColumnTab';
@@ -0,0 +1,7 @@
1
+ .psdk-grid-filter {
2
+ display: grid;
3
+ grid-template-columns: repeat(2,minmax(0,1fr));
4
+ column-gap: calc(2 * 0.5rem);
5
+ row-gap: calc(2 * 0.5rem);
6
+ align-items: start;
7
+ }
@@ -0,0 +1,160 @@
1
+ import React, { useCallback, useMemo, useState, createElement, Fragment } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Button from '@material-ui/core/Button';
4
+
5
+ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
6
+ import ListView from '@pega/react-sdk-components/lib/components/templates/ListView';
7
+ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
8
+ import './PromotedFilters.css';
9
+
10
+ declare const PCore;
11
+ const localeCategory = 'SimpleTable';
12
+ const SUPPORTED_TYPES_IN_PROMOTED_FILTERS = [
13
+ 'TextInput',
14
+ 'Percentage',
15
+ 'Email',
16
+ 'Integer',
17
+ 'Decimal',
18
+ 'Checkbox',
19
+ 'DateTime',
20
+ 'Date',
21
+ 'Time',
22
+ 'Text',
23
+ 'TextArea',
24
+ 'Currency',
25
+ 'URL',
26
+ 'RichText'
27
+ ];
28
+
29
+ function Filters({ filters, transientItemID, localeReference }) {
30
+ return filters.map((filter, index) => {
31
+ const filterClone = { ...filter };
32
+ // convert any field which is not supported to TextInput and delete the placeholder as it may contain placeholder specific to original type.
33
+ if (!SUPPORTED_TYPES_IN_PROMOTED_FILTERS.includes(filterClone.type)) {
34
+ filterClone.type = 'TextInput';
35
+ delete filterClone.config.placeholder;
36
+ }
37
+ filterClone.config.contextName = transientItemID;
38
+ filterClone.config.readOnly = false;
39
+ filterClone.config.context = transientItemID;
40
+ filterClone.config.localeReference = localeReference;
41
+ const c11nEnv = PCore.createPConnect({
42
+ meta: filterClone,
43
+ options: {
44
+ hasForm: true,
45
+ contextName: transientItemID
46
+ }
47
+ });
48
+
49
+ // eslint-disable-next-line react/no-array-index-key
50
+ return <React.Fragment key={index}>{createElement(createPConnectComponent(), c11nEnv)}</React.Fragment>;
51
+ });
52
+ }
53
+
54
+ function isValidInput(input) {
55
+ return Object.values(input).findIndex((v) => v) >= 0;
56
+ }
57
+
58
+ export default function PromotedFilters(props) {
59
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
60
+ const { getPConnect, viewName, filters, listViewProps, pageClass } = props;
61
+ const [initTable, setInitTable] = useState(false);
62
+ const [payload, setPayload] = useState({});
63
+ const filtersProperties = {};
64
+
65
+ filters.forEach((filter) => {
66
+ filtersProperties[PCore.getAnnotationUtils().getPropertyName(filter.config.value)] = '';
67
+ });
68
+
69
+ const transientItemID = useMemo(() => {
70
+ const filtersWithClassID = {
71
+ ...filtersProperties,
72
+ classID: pageClass
73
+ };
74
+ return getPConnect().getContainerManager().addTransientItem({
75
+ id: viewName,
76
+ data: filtersWithClassID
77
+ });
78
+ }, []);
79
+
80
+ function formatPromotedFilters(promotedFilters) {
81
+ return Object.entries(promotedFilters).reduce((acc, [field, value]) => {
82
+ if (value) {
83
+ acc[field] = {
84
+ lhs: {
85
+ field
86
+ },
87
+ comparator: "EQ",
88
+ rhs: {
89
+ value
90
+ }
91
+ };
92
+ }
93
+ return acc;
94
+ }, {});
95
+ }
96
+
97
+ const getFilterData = useCallback(
98
+ (e) => {
99
+ e.preventDefault(); // to prevent un-intended forms submission.
100
+
101
+ const changes = PCore.getFormUtils().getChanges(transientItemID);
102
+ const formValues = {};
103
+ Object.keys(changes).forEach((key) => {
104
+ if (!['context_data', 'pageInstructions'].includes(key)) {
105
+ formValues[key] = changes[key];
106
+ }
107
+ });
108
+ const promotedFilters = formatPromotedFilters(formValues);
109
+ if (PCore.getFormUtils().isFormValid(transientItemID) && isValidInput(formValues)) {
110
+ setInitTable(true);
111
+ const Query: any = {
112
+ dataViewParameters: {}
113
+ };
114
+
115
+ if (!Utils.isEmptyObject(promotedFilters)) {
116
+ Query.query = { filter: { filterConditions: promotedFilters } };
117
+ }
118
+ setPayload(Query);
119
+ }
120
+ },
121
+ [transientItemID]
122
+ );
123
+
124
+ const clearFilterData = useCallback(() => {
125
+ PCore.getContainerUtils().clearTransientData(transientItemID);
126
+ setInitTable(false);
127
+ getPConnect()?.getListActions?.()?.setSelectedRows([]); // Clear the selection (if any made by user)
128
+ }, [transientItemID]);
129
+
130
+ return (
131
+ <Fragment>
132
+ <div>{listViewProps.title}</div>
133
+ <div className="psdk-grid-filter">
134
+ <Filters filters={filters} transientItemID={transientItemID} localeReference={listViewProps.localeReference}/>
135
+ </div>
136
+ <div>
137
+ <Button key='1' type='button' onClick={clearFilterData} data-testid='clear' variant='contained' color='primary'>
138
+ {localizedVal('Clear', localeCategory)}
139
+ </Button>
140
+ <Button style={{float: 'right'}} key='2' type='submit' onClick={getFilterData} data-testid='search' variant='contained' color='primary'>
141
+ {localizedVal('Search', localeCategory)}
142
+ </Button>
143
+ </div>
144
+ {initTable && <ListView {...listViewProps} title='' payload={payload}
145
+ isSearchable
146
+ tableDisplay={{
147
+ show: initTable
148
+ }}
149
+ />}
150
+ </Fragment>
151
+ );
152
+ }
153
+
154
+ PromotedFilters.propTypes = {
155
+ getPConnect: PropTypes.func.isRequired,
156
+ viewName: PropTypes.string.isRequired,
157
+ filters: PropTypes.arrayOf(PropTypes.object).isRequired,
158
+ listViewProps: PropTypes.objectOf(PropTypes.any).isRequired,
159
+ pageClass: PropTypes.string.isRequired
160
+ };
@@ -0,0 +1 @@
1
+ export { default } from './PromotedFilters';
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import FieldGroupTemplate from '@pega/react-sdk-components/lib/components/templates/FieldGroupTemplate/';
3
+ import SimpleTableManual from '@pega/react-sdk-components/lib/components/templates/SimpleTableManual';
4
+
5
+ declare const PCore: any;
6
+
7
+ export default function SimpleTable(props) {
8
+ const { getPConnect, multiRecordDisplayAs, allowTableEdit } = props;
9
+
10
+ let { contextClass } = props;
11
+ if (!contextClass) {
12
+ let listName = getPConnect().getComponentConfig().referenceList;
13
+ listName = PCore.getAnnotationUtils().getPropertyName(listName);
14
+ contextClass = getPConnect().getFieldMetadata(listName)?.pageClass;
15
+ }
16
+ if (multiRecordDisplayAs === 'fieldGroup') {
17
+ const fieldGroupProps = { ...props, contextClass };
18
+ return <FieldGroupTemplate {...fieldGroupProps} />;
19
+ } else {
20
+ const simpleTableManualProps = {...props, contextClass};
21
+ if (allowTableEdit === false) {
22
+ simpleTableManualProps.hideAddRow = true;
23
+ simpleTableManualProps.hideDeleteRow = true;
24
+ simpleTableManualProps.disableDragDrop = true;
25
+ }
26
+ return <SimpleTableManual {...simpleTableManualProps} />;
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ export { default } from './SimpleTable';