@pega/react-sdk-overrides 0.23.26 → 0.23.28

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 (238) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +17 -0
  3. package/SECURITY.md +10 -0
  4. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +39 -0
  5. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  6. package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  8. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  9. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  10. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  11. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  12. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
  13. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  14. package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
  15. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  16. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  17. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  18. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  19. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  20. package/lib/field/AutoComplete/config-ext.json +2 -3
  21. package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
  22. package/lib/field/CancelAlert/index.tsx +1 -1
  23. package/lib/field/Checkbox/Checkbox.tsx +29 -19
  24. package/lib/field/Checkbox/config-ext.json +2 -3
  25. package/lib/field/Currency/Currency.tsx +27 -38
  26. package/lib/field/Currency/config-ext.json +2 -3
  27. package/lib/field/Currency/currency-utils.ts +10 -18
  28. package/lib/field/Date/Date.tsx +33 -15
  29. package/lib/field/Date/config-ext.json +2 -3
  30. package/lib/field/DateTime/DateTime.tsx +22 -11
  31. package/lib/field/DateTime/config-ext.json +1 -2
  32. package/lib/field/Decimal/Decimal.tsx +64 -17
  33. package/lib/field/Decimal/config-ext.json +1 -2
  34. package/lib/field/Decimal/index.tsx +1 -1
  35. package/lib/field/Dropdown/Dropdown.tsx +154 -18
  36. package/lib/field/Dropdown/config-ext.json +1 -2
  37. package/lib/field/Email/Email.tsx +16 -7
  38. package/lib/field/Email/config-ext.json +1 -2
  39. package/lib/field/Email/index.tsx +1 -1
  40. package/lib/field/Group/Group.tsx +37 -0
  41. package/lib/field/Group/config-ext.json +7 -0
  42. package/lib/field/Group/index.tsx +1 -0
  43. package/lib/field/Integer/Integer.tsx +15 -6
  44. package/lib/field/Integer/config-ext.json +1 -2
  45. package/lib/field/Percentage/Percentage.tsx +14 -6
  46. package/lib/field/Percentage/config-ext.json +1 -2
  47. package/lib/field/Phone/Phone.tsx +17 -7
  48. package/lib/field/Phone/index.tsx +1 -1
  49. package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
  50. package/lib/field/RadioButtons/config-ext.json +1 -2
  51. package/lib/field/RichText/RichText.tsx +96 -0
  52. package/lib/field/RichText/index.tsx +1 -0
  53. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  54. package/lib/field/ScalarList/config-ext.json +7 -0
  55. package/lib/field/ScalarList/index.tsx +1 -0
  56. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  57. package/lib/field/SemanticLink/config-ext.json +1 -2
  58. package/lib/field/SemanticLink/utils.ts +8 -10
  59. package/lib/field/TextArea/TextArea.tsx +15 -5
  60. package/lib/field/TextArea/config-ext.json +1 -2
  61. package/lib/field/TextContent/TextContent.tsx +9 -2
  62. package/lib/field/TextContent/config-ext.json +1 -2
  63. package/lib/field/TextInput/TextInput.tsx +41 -10
  64. package/lib/field/TextInput/config-ext.json +1 -2
  65. package/lib/field/TextInput/index.tsx +1 -1
  66. package/lib/field/Time/Time.tsx +21 -18
  67. package/lib/field/Time/config-ext.json +1 -2
  68. package/lib/field/URL/URL.tsx +23 -6
  69. package/lib/field/URL/config-ext.json +1 -2
  70. package/lib/field/URL/index.tsx +1 -1
  71. package/lib/field/UserReference/UserReference.tsx +52 -58
  72. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  73. package/lib/field/UserReference/config-ext.json +1 -2
  74. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
  75. package/lib/helpers/case-utils.tsx +99 -0
  76. package/lib/helpers/common-utils.ts +8 -0
  77. package/lib/helpers/data_page.ts +3 -6
  78. package/lib/helpers/date-format-utils.ts +29 -19
  79. package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
  80. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
  81. package/lib/helpers/formatters/Boolean.ts +21 -0
  82. package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
  83. package/lib/helpers/formatters/CurrencyMap.ts +915 -0
  84. package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
  85. package/lib/helpers/formatters/{common.js → common.ts} +3 -4
  86. package/lib/helpers/formatters/{index.js → index.ts} +22 -22
  87. package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
  88. package/lib/helpers/simpleTableHelpers.ts +65 -85
  89. package/lib/helpers/state-utils.tsx +43 -0
  90. package/lib/helpers/template-utils.ts +4 -8
  91. package/lib/helpers/utils.ts +16 -8
  92. package/lib/helpers/versionHelpers.ts +1 -5
  93. package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
  94. package/lib/infra/ActionButtons/index.tsx +1 -1
  95. package/lib/infra/Assignment/Assignment.tsx +99 -84
  96. package/lib/infra/Assignment/index.tsx +1 -1
  97. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  98. package/lib/infra/AssignmentCard/index.tsx +1 -1
  99. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
  100. package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
  101. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
  103. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  104. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
  105. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  106. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  107. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  108. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  109. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
  110. package/lib/infra/Containers/helpers.ts +6 -0
  111. package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
  112. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
  113. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
  114. package/lib/infra/DeferLoad/index.tsx +1 -1
  115. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
  116. package/lib/infra/MultiStep/MultiStep.css +11 -15
  117. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  118. package/lib/infra/MultiStep/index.tsx +1 -1
  119. package/lib/infra/NavBar/NavBar.css +103 -105
  120. package/lib/infra/NavBar/NavBar.tsx +28 -43
  121. package/lib/infra/Reference/Reference.tsx +16 -22
  122. package/lib/infra/Region/Region.tsx +9 -9
  123. package/lib/infra/RootContainer/RootContainer.tsx +82 -125
  124. package/lib/infra/RootContainer/index.tsx +1 -1
  125. package/lib/infra/Stages/Stages.tsx +38 -39
  126. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  127. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  128. package/lib/infra/View/View.tsx +32 -63
  129. package/lib/template/AppShell/AppShell.css +22 -23
  130. package/lib/template/AppShell/AppShell.tsx +51 -69
  131. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  132. package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
  133. package/lib/template/CaseSummary/config-ext.json +1 -2
  134. package/lib/template/CaseView/CaseView.tsx +122 -114
  135. package/lib/template/CaseView/config-ext.json +1 -2
  136. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
  137. package/lib/template/Confirmation/Confirmation.tsx +25 -53
  138. package/lib/template/Confirmation/config-ext.json +1 -2
  139. package/lib/template/DataReference/DataReference.tsx +112 -140
  140. package/lib/template/DataReference/config-ext.json +1 -2
  141. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  142. package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
  143. package/lib/template/DefaultForm/config-ext.json +1 -2
  144. package/lib/template/DefaultForm/utils/index.ts +33 -0
  145. package/lib/template/Details/Details/Details.tsx +24 -28
  146. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  147. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  148. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  149. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  151. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  152. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  153. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  154. package/lib/template/Details/DynamicTabs/config.json +36 -0
  155. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  156. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
  157. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  158. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  159. package/lib/template/ListPage/ListPage.tsx +12 -16
  160. package/lib/template/ListPage/config-ext.json +1 -2
  161. package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
  162. package/lib/template/ListView/ListView.tsx +245 -306
  163. package/lib/template/ListView/config-ext.json +1 -2
  164. package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
  165. package/lib/template/ListView/{utils.js → utils.ts} +202 -91
  166. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
  167. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  168. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  169. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  170. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  171. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  172. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  173. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  174. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  175. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  176. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  177. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  179. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  180. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  181. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  182. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  183. package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
  184. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
  185. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  186. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
  187. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
  188. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  189. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  190. package/lib/template/SubTabs/config-ext.json +1 -2
  191. package/lib/template/SubTabs/tabUtils.ts +2 -7
  192. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  193. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  194. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  195. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  196. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  197. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  198. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  199. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  200. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  201. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  202. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  203. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  204. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  205. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  206. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  207. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  208. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  209. package/lib/template/WssNavBar/WssNavBar.tsx +20 -9
  210. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  211. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  212. package/lib/widget/Attachment/Attachment.css +75 -4
  213. package/lib/widget/Attachment/Attachment.tsx +370 -388
  214. package/lib/widget/Attachment/index.tsx +1 -1
  215. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  216. package/lib/widget/CaseHistory/config-ext.json +1 -2
  217. package/lib/widget/CaseHistory/index.tsx +1 -1
  218. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  219. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  220. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
  221. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  222. package/lib/widget/Followers/Followers.tsx +27 -25
  223. package/lib/widget/Followers/config-ext.json +1 -2
  224. package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
  225. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  226. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
  227. package/lib/widget/SummaryItem/index.tsx +1 -1
  228. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  229. package/lib/widget/ToDo/ToDo.css +4 -4
  230. package/lib/widget/ToDo/ToDo.tsx +80 -116
  231. package/lib/widget/ToDo/config-ext.json +1 -2
  232. package/package.json +5 -2
  233. package/lib/helpers/auth.js +0 -483
  234. package/lib/helpers/authManager.js +0 -631
  235. package/lib/helpers/config_access.js +0 -268
  236. package/lib/helpers/formatters/Boolean.js +0 -38
  237. package/lib/helpers/formatters/CurrencyMap.js +0 -908
  238. package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
@@ -1,11 +1,22 @@
1
- import React, { createElement } from 'react';
2
- import PropTypes from 'prop-types';
1
+ import { createElement } from 'react';
3
2
  import Grid from '@material-ui/core/Grid';
3
+
4
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
- import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+
8
+ interface DetailsThreeColumnProps extends PConnProps {
9
+ // If any, enter additional props that only exist on this component
10
+ showLabel: boolean;
11
+ label: string;
12
+ showHighlightedData: boolean;
13
+ }
14
+
15
+ export default function DetailsThreeColumn(props: DetailsThreeColumnProps) {
16
+ // Get emitted components from map (so we can get any override that may exist)
17
+ const FieldGroup = getComponentFromMap('FieldGroup');
6
18
 
7
- export default function DetailsThreeColumn(props) {
8
- const { label, showLabel, getPConnect, showHighlightedData } = props;
19
+ const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
9
20
 
10
21
  // Get the inherited props from the parent to determine label settings
11
22
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
@@ -14,20 +25,18 @@ export default function DetailsThreeColumn(props) {
14
25
  // in a readonly (display) mode instead of a editable
15
26
  getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
16
27
  getPConnect().setInheritedProp('readOnly', true);
17
- const children = getPConnect()
18
- .getChildren()
19
- .map((configObject, index) =>
20
- createElement(createPConnectComponent(), {
21
- ...configObject,
22
- // eslint-disable-next-line react/no-array-index-key
23
- key: index.toString()
24
- })
25
- );
28
+ const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
+ createElement(createPConnectComponent(), {
30
+ ...configObject,
31
+ // eslint-disable-next-line react/no-array-index-key
32
+ key: index.toString()
33
+ })
34
+ );
26
35
 
27
36
  // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
28
37
  let highlightedDataArr = [];
29
38
  if (showHighlightedData) {
30
- const { highlightedData = [] } = getPConnect().getRawMetadata().config;
39
+ const { highlightedData = [] } = (getPConnect().getRawMetadata() as any).config;
31
40
  highlightedDataArr = highlightedData.map(field => {
32
41
  field.config.displayMode = 'STACKED_LARGE_VAL';
33
42
 
@@ -37,7 +46,7 @@ export default function DetailsThreeColumn(props) {
37
46
  field.config.displayAsStatus = true;
38
47
  }
39
48
 
40
- return getPConnect().createComponent(field);
49
+ return getPConnect().createComponent(field, '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
41
50
  });
42
51
  }
43
52
 
@@ -62,16 +71,3 @@ export default function DetailsThreeColumn(props) {
62
71
  </FieldGroup>
63
72
  );
64
73
  }
65
-
66
- DetailsThreeColumn.defaultProps = {
67
- label: undefined,
68
- showLabel: true,
69
- showHighlightedData: false
70
- };
71
-
72
- DetailsThreeColumn.propTypes = {
73
- showLabel: PropTypes.bool,
74
- label: PropTypes.string,
75
- getPConnect: PropTypes.func.isRequired,
76
- showHighlightedData: PropTypes.bool
77
- };
@@ -4,6 +4,5 @@
4
4
  "description": "Details (Three column)",
5
5
  "type": "Template",
6
6
  "subtype": "DETAILS",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,11 +1,22 @@
1
- import React, { createElement } from 'react';
2
- import PropTypes from 'prop-types';
1
+ import { createElement } from 'react';
3
2
  import Grid from '@material-ui/core/Grid';
3
+
4
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
- import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+
8
+ interface DetailsTwoColumnProps extends PConnProps {
9
+ // If any, enter additional props that only exist on this component
10
+ showLabel: boolean;
11
+ label: string;
12
+ showHighlightedData: boolean;
13
+ }
14
+
15
+ export default function DetailsTwoColumn(props: DetailsTwoColumnProps) {
16
+ // Get emitted components from map (so we can get any override that may exist)
17
+ const FieldGroup = getComponentFromMap('FieldGroup');
6
18
 
7
- export default function DetailsTwoColumn(props) {
8
- const { label, showLabel, getPConnect, showHighlightedData } = props;
19
+ const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
9
20
 
10
21
  // Get the inherited props from the parent to determine label settings
11
22
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
@@ -14,20 +25,18 @@ export default function DetailsTwoColumn(props) {
14
25
  // in a readonly (display) mode instead of a editable
15
26
  getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
16
27
  getPConnect().setInheritedProp('readOnly', true);
17
- const children = getPConnect()
18
- .getChildren()
19
- .map((configObject, index) =>
20
- createElement(createPConnectComponent(), {
21
- ...configObject,
22
- // eslint-disable-next-line react/no-array-index-key
23
- key: index.toString()
24
- })
25
- );
28
+ const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
+ createElement(createPConnectComponent(), {
30
+ ...configObject,
31
+ // eslint-disable-next-line react/no-array-index-key
32
+ key: index.toString()
33
+ })
34
+ );
26
35
 
27
36
  // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
28
37
  let highlightedDataArr = [];
29
38
  if (showHighlightedData) {
30
- const { highlightedData = [] } = getPConnect().getRawMetadata().config;
39
+ const { highlightedData = [] } = (getPConnect().getRawMetadata() as any).config;
31
40
  highlightedDataArr = highlightedData.map(field => {
32
41
  field.config.displayMode = 'STACKED_LARGE_VAL';
33
42
 
@@ -37,7 +46,7 @@ export default function DetailsTwoColumn(props) {
37
46
  field.config.displayAsStatus = true;
38
47
  }
39
48
 
40
- return getPConnect().createComponent(field);
49
+ return getPConnect().createComponent(field, '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
41
50
  });
42
51
  }
43
52
 
@@ -62,16 +71,3 @@ export default function DetailsTwoColumn(props) {
62
71
  </FieldGroup>
63
72
  );
64
73
  }
65
-
66
- DetailsTwoColumn.defaultProps = {
67
- label: undefined,
68
- showLabel: true,
69
- showHighlightedData: false
70
- };
71
-
72
- DetailsTwoColumn.propTypes = {
73
- showLabel: PropTypes.bool,
74
- label: PropTypes.string,
75
- getPConnect: PropTypes.func.isRequired,
76
- showHighlightedData: PropTypes.bool
77
- };
@@ -4,6 +4,5 @@
4
4
  "description": "Details (Two column)",
5
5
  "type": "Template",
6
6
  "subtype": "DETAILS",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1 +1 @@
1
- export { default } from './DetailsTwoColumn';
1
+ export { default } from './DetailsTwoColumn';
@@ -0,0 +1,79 @@
1
+ import React, { Children, useMemo, useState } from 'react';
2
+ import { makeStyles, Tab, Tabs } from '@material-ui/core';
3
+ import { TabContext, TabPanel } from '@material-ui/lab';
4
+
5
+ import { buildView } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
6
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+
8
+ const useStyles = makeStyles(() => ({
9
+ tab: {
10
+ minWidth: '72px'
11
+ }
12
+ }));
13
+
14
+ interface DynamicTabsProps extends PConnProps {
15
+ // If any, enter additional props that only exist on this component
16
+ showLabel: boolean;
17
+ label: string;
18
+ referenceList?: any[];
19
+ }
20
+
21
+ function DynamicTabs(props: DynamicTabsProps) {
22
+ const classes = useStyles();
23
+ const { referenceList, showLabel, label, getPConnect } = props;
24
+ const pConnect = getPConnect();
25
+ // Get the inherited props from the parent to determine label settings
26
+ const propsToUse = { label, showLabel, ...pConnect.getInheritedProps() };
27
+ const defaultTabIndex = 0;
28
+ // @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
29
+ const { tablabel } = pConnect.getComponentConfig();
30
+ const tablabelProp = PCore.getAnnotationUtils().getPropertyName(tablabel);
31
+ const referenceListData: any = pConnect.getValue(`${referenceList}.pxResults`, ''); // 2nd arg empty string until typedefs properly allow optional
32
+ const memoisedTabViews = useMemo(() => {
33
+ pConnect.setInheritedProp('displayMode', 'LABELS_LEFT');
34
+ pConnect.setInheritedProp('readOnly', true);
35
+
36
+ return (
37
+ referenceListData &&
38
+ Children.toArray(
39
+ referenceListData.map((item, index) => {
40
+ return <React.Fragment key={item[tablabelProp]}>{buildView(pConnect, index, '')}</React.Fragment>;
41
+ })
42
+ )
43
+ );
44
+ }, [referenceListData]);
45
+ const [panelShown, changePanel] = useState(defaultTabIndex);
46
+ const handleTabClick = (e, id) => {
47
+ changePanel(parseInt(id, 10));
48
+ };
49
+ // Loop over the tab contents and and pull out the labels for the navigation
50
+ const tabItems =
51
+ referenceListData?.map((item, i) => {
52
+ const currentTabLabel = item[tablabelProp] || PCore.getLocaleUtils().getLocaleValue('No label specified in config', 'Generic');
53
+ return {
54
+ name: currentTabLabel,
55
+ id: i
56
+ };
57
+ }) || [];
58
+
59
+ return (
60
+ <>
61
+ {propsToUse.label && <h3 id='dynamic-tabs-title'>{propsToUse.label}</h3>}
62
+ <TabContext value={panelShown.toString()}>
63
+ <Tabs onChange={handleTabClick} value={panelShown} variant='scrollable' scrollButtons='auto' indicatorColor='primary' id='dynamic-tabs'>
64
+ {tabItems.map((tab: any) => (
65
+ <Tab key={tab.id} label={tab.name} value={tab.id} className={classes.tab} />
66
+ ))}
67
+ </Tabs>
68
+
69
+ {tabItems.map((tab: any) => (
70
+ <TabPanel key={tab.id} value={tab.id.toString()} tabIndex={+tab.id} id='dynamic-tabpanel'>
71
+ <div>{memoisedTabViews[parseInt(tab.id, 10)] || 'No content exists'}</div>
72
+ </TabPanel>
73
+ ))}
74
+ </TabContext>
75
+ </>
76
+ );
77
+ }
78
+
79
+ export default DynamicTabs;
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "DynamicTabs",
3
+ "label": "Dynamic tabs (list)",
4
+ "description": "Dynamic tabs (list)",
5
+ "type": "Template",
6
+ "subtype": "DETAILS",
7
+ "icon": "DynamicTabs.svg",
8
+ "hideTemplateEdit": true,
9
+ "hideFromTemplatePicker": true,
10
+ "viewHeadingLabel": "Default heading",
11
+ "properties": [
12
+ {
13
+ "name": "referenceList",
14
+ "label": "Data page",
15
+ "format": "CONTENTPICKERSOURCE"
16
+ },
17
+ {
18
+ "name": "parameters",
19
+ "label": "Parameters",
20
+ "format": "PARAMETERS",
21
+ "showOverride": false
22
+ },
23
+ {
24
+ "name": "tablabel",
25
+ "label": "Tab label",
26
+ "format": "PROPERTY",
27
+ "ofContextClass": true
28
+ },
29
+ {
30
+ "format": "VIEWPICKER",
31
+ "name": "Views",
32
+ "label": "Tab content",
33
+ "ofContextClass": true
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1 @@
1
+ export { default } from './DynamicTabs';
@@ -1,21 +1,34 @@
1
1
  /* eslint-disable react-hooks/rules-of-hooks */
2
- import React, { useMemo } from 'react';
3
- import PropTypes from 'prop-types';
2
+ import { useMemo } from 'react';
4
3
 
5
- import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
6
- import FieldGroupList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroupList';
7
4
  import { getReferenceList, buildView } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
7
 
9
- declare const PCore: any;
8
+ interface FieldGroupTemplateProps extends PConnProps {
9
+ // If any, enter additional props that only exist on this component
10
+ referenceList?: any[];
11
+ contextClass: string;
12
+ renderMode?: string;
13
+ heading?: string;
14
+ lookForChildInConfig?: boolean;
15
+ displayMode?: string;
16
+ fieldHeader?: string;
17
+ allowTableEdit: boolean;
18
+ }
19
+
20
+ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
21
+ // Get emitted components from map (so we can get any override that may exist)
22
+ const FieldGroup = getComponentFromMap('FieldGroup');
23
+ const FieldGroupList = getComponentFromMap('FieldGroupList');
10
24
 
11
- export default function FieldGroupTemplate(props) {
12
25
  const {
13
- referenceList,
26
+ referenceList = [],
14
27
  renderMode,
15
28
  contextClass,
16
29
  getPConnect,
17
30
  lookForChildInConfig,
18
- heading,
31
+ heading = '',
19
32
  displayMode,
20
33
  fieldHeader,
21
34
  allowTableEdit: allowAddEdit
@@ -38,7 +51,7 @@ export default function FieldGroupTemplate(props) {
38
51
  if (PCore.getPCoreVersion()?.includes('8.7')) {
39
52
  pConn.getListActions().insert({ classID: contextClass }, referenceList.length, pageReference);
40
53
  } else {
41
- pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
54
+ pConn.getListActions().insert({}, referenceList.length);
42
55
  }
43
56
  };
44
57
 
@@ -60,10 +73,7 @@ export default function FieldGroupTemplate(props) {
60
73
  const MemoisedChildren = useMemo(() => {
61
74
  return referenceList.map((item, index) => ({
62
75
  id: index,
63
- name:
64
- fieldHeader === 'propertyRef'
65
- ? getDynamicHeaderProp(item, index)
66
- : `${HEADING} ${index + 1}`,
76
+ name: fieldHeader === 'propertyRef' ? getDynamicHeaderProp(item, index) : `${HEADING} ${index + 1}`,
67
77
  children: buildView(pConn, index, lookForChildInConfig)
68
78
  }));
69
79
  }, [referenceList?.length]);
@@ -82,10 +92,7 @@ export default function FieldGroupTemplate(props) {
82
92
  return referenceList.map((item, index) => {
83
93
  const key = item[heading] || `field-group-row-${index}`;
84
94
  return (
85
- <FieldGroup
86
- key={key}
87
- name={fieldHeader === 'propertyRef' ? getDynamicHeaderProp(item, index) : `${HEADING} ${index + 1}`}
88
- >
95
+ <FieldGroup key={key} name={fieldHeader === 'propertyRef' ? getDynamicHeaderProp(item, index) : `${HEADING} ${index + 1}`}>
89
96
  {buildView(pConn, index, lookForChildInConfig)}
90
97
  </FieldGroup>
91
98
  );
@@ -94,20 +101,3 @@ export default function FieldGroupTemplate(props) {
94
101
 
95
102
  return <div>{memoisedReadOnlyList}</div>;
96
103
  }
97
-
98
- FieldGroupTemplate.defaultProps = {
99
- referenceList: [],
100
- heading: undefined,
101
- contextClass: null,
102
- displayMode: undefined
103
- };
104
-
105
- FieldGroupTemplate.propTypes = {
106
- referenceList: PropTypes.arrayOf(Object),
107
- contextClass: PropTypes.string,
108
- getPConnect: PropTypes.func.isRequired,
109
- renderMode: PropTypes.string.isRequired,
110
- heading: PropTypes.string,
111
- lookForChildInConfig: PropTypes.bool,
112
- displayMode: PropTypes.string
113
- };
@@ -1,7 +1,13 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
1
+ import { PropsWithChildren, ReactElement } from 'react';
3
2
  import { Grid, Typography } from '@material-ui/core';
4
3
  import { makeStyles } from '@material-ui/core/styles';
4
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+
6
+ interface InlineDashboardProps extends PConnProps {
7
+ // If any, enter additional props that only exist on this component
8
+ title: string;
9
+ filterPosition?: string;
10
+ }
5
11
 
6
12
  const useStyles = makeStyles((/* theme */) => ({
7
13
  headerStyles: {
@@ -30,10 +36,11 @@ const useStyles = makeStyles((/* theme */) => ({
30
36
  }
31
37
  }));
32
38
 
33
- export default function InlineDashboard(props) {
39
+ export default function InlineDashboard(props: PropsWithChildren<InlineDashboardProps>) {
34
40
  const classes = useStyles();
35
41
 
36
42
  const { children, title, filterPosition } = props;
43
+ const childrenToRender = children as ReactElement[];
37
44
 
38
45
  const direction = filterPosition === 'inline-start' ? 'row-reverse' : 'row';
39
46
  return (
@@ -45,28 +52,23 @@ export default function InlineDashboard(props) {
45
52
  {filterPosition === 'block-start' && (
46
53
  <Grid container spacing={2} direction='column-reverse' className={classes.containerStyles}>
47
54
  <Grid item xs={12} className={classes.colStyles}>
48
- {children[0]}
55
+ {childrenToRender[0]}
49
56
  </Grid>
50
- <Grid item xs={12} className={classes.filterContainerStyles}>
51
- {children[1]}
57
+ <Grid id='filters' item xs={12} className={classes.filterContainerStyles}>
58
+ {childrenToRender[1]}
52
59
  </Grid>
53
60
  </Grid>
54
61
  )}
55
62
  {filterPosition !== 'block-start' && (
56
63
  <Grid container spacing={2} direction={direction} className={classes.containerStyles}>
57
64
  <Grid item xs={9}>
58
- {children[0]}
65
+ {childrenToRender[0]}
59
66
  </Grid>
60
- <Grid item xs={3} className={classes.inlineStyles}>
61
- {children[1]}
67
+ <Grid id='filters' item xs={3} className={classes.inlineStyles}>
68
+ {childrenToRender[1]}
62
69
  </Grid>
63
70
  </Grid>
64
71
  )}
65
72
  </>
66
73
  );
67
74
  }
68
-
69
- InlineDashboard.propTypes = {
70
- children: PropTypes.arrayOf(PropTypes.node).isRequired
71
- // template: PropTypes.string.isRequired
72
- };
@@ -1,24 +1,35 @@
1
- import React from 'react';
2
- import { useMemo, Children, useEffect, useState } from 'react';
3
- import PropTypes from 'prop-types';
1
+ import { useMemo, Children, useEffect, useState, PropsWithChildren } from 'react';
4
2
 
5
3
  import { buildFilterComponents } from '@pega/react-sdk-components/lib/components/infra/DashboardFilter/filterUtils';
6
- import InlineDashboard from '@pega/react-sdk-components/lib/components/template/InlineDashboard';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+
7
+ interface InlineDashboardPageProps extends PConnProps {
8
+ // If any, enter additional props that only exist on this component
9
+ title: string;
10
+ icon?: string;
11
+ filterPosition?: string;
12
+ }
13
+
14
+ export default function InlineDashboardPage(props: PropsWithChildren<InlineDashboardPageProps>) {
15
+ // Get emitted components from map (so we can get any override that may exist)
16
+ const InlineDashboard = getComponentFromMap('InlineDashboard');
7
17
 
8
- export default function InlineDashboardPage(props) {
9
- const { children, getPConnect } = props;
18
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
+ const { children, getPConnect, icon = '', filterPosition = 'block-start' } = props;
10
20
  const [filterComponents, setFilterComponents] = useState([]);
11
21
  const childArray = useMemo(() => {
12
22
  return Children.toArray(children);
13
23
  }, [children]);
14
24
 
15
- const allFilters = getPConnect().getRawMetadata().children[1];
25
+ const allFilters = (getPConnect().getRawMetadata() as any).children[1];
16
26
 
17
27
  useEffect(() => {
18
28
  setFilterComponents(buildFilterComponents(getPConnect, allFilters));
19
29
  }, []);
20
30
 
21
- const inlineProps = props;
31
+ const inlineProps = { ...props };
32
+ inlineProps.children = [];
22
33
  // Region layout views
23
34
  inlineProps.children[0] = childArray[0];
24
35
  // filter items
@@ -26,16 +37,3 @@ export default function InlineDashboardPage(props) {
26
37
 
27
38
  return <InlineDashboard {...inlineProps} />;
28
39
  }
29
-
30
- InlineDashboardPage.propTypes = {
31
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
32
- getPConnect: PropTypes.func.isRequired,
33
- title: PropTypes.string.isRequired,
34
- icon: PropTypes.string,
35
- filterPosition: PropTypes.string
36
- };
37
-
38
- InlineDashboardPage.defaultProps = {
39
- icon: '',
40
- filterPosition: 'block-start'
41
- };
@@ -1,20 +1,16 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
1
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
2
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
3
 
4
- import ListView from '@pega/react-sdk-components/lib/components/template/ListView';
5
-
6
- export default function ListPage(props) {
7
-
8
- return (
9
- <ListView {...props}></ListView>
10
- )
4
+ interface ListPageProps extends PConnProps {
5
+ // If any, enter additional props that only exist on this component
6
+ parameters: object;
11
7
  }
12
8
 
13
- ListPage.defaultProps = {
14
- parameters: undefined
15
- };
9
+ export default function ListPage(props: ListPageProps) {
10
+ // Get emitted components from map (so we can get any override that may exist)
11
+ const ListView = getComponentFromMap('ListView');
16
12
 
17
- ListPage.propTypes = {
18
- getPConnect: PropTypes.func.isRequired,
19
- parameters: PropTypes.objectOf(PropTypes.any)
20
- };
13
+ // special case for ListView - add in a prop
14
+ const listViewProps = { ...props, bInForm: false };
15
+ return <ListView {...listViewProps} />;
16
+ }
@@ -3,6 +3,5 @@
3
3
  "type": "Template",
4
4
  "subtype": "PAGE",
5
5
  "label": "List page",
6
- "properties": [
7
- ]
6
+ "properties": []
8
7
  }
@@ -34,10 +34,8 @@ const getDefaultConfig = (fieldMeta, classID, show) => {
34
34
  };
35
35
  };
36
36
 
37
-
38
37
  export default function getDefaultViewMeta(fieldMeta, classID, showField) {
39
- const { type, name, displayAs, fieldID, isUserReference, associationID, datasource, label, fieldType } =
40
- fieldMeta;
38
+ const { type, name, displayAs, fieldID, isUserReference, associationID, datasource, label, fieldType } = fieldMeta;
41
39
  const mapperKey = type && displayAs ? type.concat(':').concat(displayAs) : type;
42
40
  const defaultConfig = getDefaultConfig(fieldMeta, classID, showField);
43
41
  let viewMeta;