@pega/react-sdk-overrides 8.8.21 → 8.23.11-debug

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 (128) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +9 -13
  2. package/lib/designSystemExtension/Banner/Banner.tsx +1 -12
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +10 -15
  4. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -10
  5. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +3 -10
  6. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +3 -11
  7. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +3 -11
  8. package/lib/designSystemExtension/Operator/Operator.tsx +12 -16
  9. package/lib/designSystemExtension/Pulse/Pulse.tsx +7 -11
  10. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -10
  11. package/lib/field/AutoComplete/AutoComplete.tsx +18 -37
  12. package/lib/field/CancelAlert/CancelAlert.tsx +4 -9
  13. package/lib/field/Checkbox/Checkbox.tsx +16 -39
  14. package/lib/field/Currency/Currency.tsx +15 -23
  15. package/lib/field/Currency/currency-utils.ts +5 -1
  16. package/lib/field/Date/Date.tsx +15 -22
  17. package/lib/field/DateTime/DateTime.tsx +14 -25
  18. package/lib/field/Decimal/Decimal.tsx +14 -25
  19. package/lib/field/Dropdown/Dropdown.tsx +26 -30
  20. package/lib/field/Email/Email.tsx +9 -17
  21. package/lib/field/Integer/Integer.tsx +7 -15
  22. package/lib/field/Percentage/Percentage.tsx +7 -15
  23. package/lib/field/Phone/Phone.tsx +11 -19
  24. package/lib/field/RadioButtons/RadioButtons.tsx +37 -25
  25. package/lib/field/SemanticLink/SemanticLink.tsx +25 -26
  26. package/lib/field/TextArea/TextArea.tsx +5 -14
  27. package/lib/field/TextContent/TextContent.tsx +1 -10
  28. package/lib/field/TextInput/TextInput.tsx +6 -15
  29. package/lib/field/Time/Time.tsx +27 -22
  30. package/lib/field/URL/URL.tsx +8 -16
  31. package/lib/field/UserReference/UserReference.tsx +60 -50
  32. package/lib/helpers/attachmentHelpers.ts +4 -4
  33. package/lib/helpers/auth.js +397 -741
  34. package/lib/helpers/authManager.js +634 -0
  35. package/lib/helpers/case-utils.tsx +9 -8
  36. package/lib/helpers/common-utils.ts +1 -1
  37. package/lib/helpers/config_access.js +73 -0
  38. package/lib/helpers/date-format-utils.ts +1 -1
  39. package/lib/helpers/event-utils.ts +1 -1
  40. package/lib/helpers/formatters/Currency.ts +11 -11
  41. package/lib/helpers/formatters/CurrencyMap.ts +5 -8
  42. package/lib/helpers/formatters/Date.ts +1 -1
  43. package/lib/helpers/formatters/common.ts +6 -2
  44. package/lib/helpers/formatters/index.ts +3 -3
  45. package/lib/helpers/simpleTableHelpers.ts +7 -7
  46. package/lib/helpers/state-utils.tsx +3 -0
  47. package/lib/helpers/template-utils.ts +6 -3
  48. package/lib/helpers/versionHelpers.ts +3 -0
  49. package/lib/infra/ActionButtons/ActionButtons.tsx +19 -9
  50. package/lib/infra/Assignment/Assignment.tsx +28 -21
  51. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -15
  52. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +58 -57
  53. package/lib/infra/Containers/FlowContainer/helpers.ts +3 -0
  54. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +19 -14
  55. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +25 -14
  56. package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -13
  57. package/lib/infra/DashboardFilter/filterUtils.tsx +1 -1
  58. package/lib/infra/DeferLoad/DeferLoad.tsx +20 -14
  59. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +14 -10
  60. package/lib/infra/MultiStep/MultiStep.tsx +22 -22
  61. package/lib/infra/NavBar/NavBar.tsx +21 -14
  62. package/lib/infra/Reference/Reference.tsx +18 -13
  63. package/lib/infra/Region/Region.tsx +6 -8
  64. package/lib/infra/RootContainer/RootContainer.tsx +25 -16
  65. package/lib/infra/Stages/Stages.tsx +8 -10
  66. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +1 -8
  67. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  68. package/lib/infra/View/View.tsx +22 -21
  69. package/lib/template/AppShell/AppShell.tsx +25 -36
  70. package/lib/template/BannerPage/BannerPage.tsx +31 -26
  71. package/lib/template/CaseSummary/CaseSummary.tsx +8 -15
  72. package/lib/template/CaseView/CaseView.tsx +25 -24
  73. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +19 -10
  74. package/lib/template/Confirmation/Confirmation.tsx +53 -27
  75. package/lib/template/DataReference/DataReference.tsx +52 -48
  76. package/lib/template/DefaultForm/DefaultForm.tsx +12 -14
  77. package/lib/template/Details/Details/Details.tsx +17 -16
  78. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +16 -13
  79. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +18 -19
  80. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +18 -20
  81. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +28 -22
  82. package/lib/template/InlineDashboard/InlineDashboard.tsx +7 -11
  83. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +17 -19
  84. package/lib/template/ListPage/ListPage.tsx +13 -14
  85. package/lib/template/ListView/ListView.tsx +186 -189
  86. package/lib/template/ListView/utils.ts +23 -170
  87. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +19 -10
  88. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +1 -16
  89. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +18 -19
  90. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +1 -9
  91. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  92. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -8
  93. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  94. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +7 -5
  95. package/lib/template/PromotedFilters/PromotedFilters.tsx +14 -16
  96. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +8 -102
  97. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +7 -24
  98. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -23
  99. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +36 -34
  100. package/lib/template/SubTabs/SubTabs.tsx +11 -10
  101. package/lib/template/SubTabs/tabUtils.ts +4 -0
  102. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +15 -10
  103. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  104. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +12 -10
  105. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +3 -17
  106. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +25 -35
  107. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +1 -7
  108. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +17 -15
  109. package/lib/template/WssNavBar/WssNavBar.tsx +1 -18
  110. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +21 -13
  111. package/lib/widget/Attachment/Attachment.tsx +16 -28
  112. package/lib/widget/CaseHistory/CaseHistory.tsx +10 -12
  113. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -13
  114. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +22 -35
  115. package/lib/widget/Followers/Followers.tsx +11 -10
  116. package/lib/widget/QuickCreate/QuickCreate.tsx +5 -11
  117. package/lib/widget/SummaryItem/SummaryItem.tsx +1 -11
  118. package/lib/widget/SummaryList/SummaryList.tsx +3 -17
  119. package/lib/widget/ToDo/ToDo.tsx +105 -62
  120. package/package.json +1 -1
  121. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +0 -121
  122. package/lib/designSystemExtension/RichTextEditor/index.tsx +0 -1
  123. package/lib/field/RichText/RichText.tsx +0 -93
  124. package/lib/field/RichText/index.tsx +0 -1
  125. package/lib/field/ScalarList/ScalarList.tsx +0 -64
  126. package/lib/field/ScalarList/config-ext.json +0 -8
  127. package/lib/field/ScalarList/index.tsx +0 -1
  128. package/lib/helpers/authManager.ts +0 -933
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable react/jsx-boolean-value */
2
2
 
3
3
  import React, { useState, useEffect, useContext } from 'react';
4
+ import PropTypes from 'prop-types';
4
5
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
5
6
  import { Card, CardHeader, Avatar, Typography, Divider } from '@material-ui/core';
6
7
  import { makeStyles } from '@material-ui/core/styles';
@@ -9,20 +10,9 @@ import Button from '@material-ui/core/Button';
9
10
  import Grid from '@material-ui/core/Grid';
10
11
 
11
12
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
12
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
13
-
14
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
15
-
16
- interface CaseViewProps extends PConnProps {
17
- // If any, enter additional props that only exist on this component
18
- icon: string,
19
- children: Array<any>,
20
- subheader: string,
21
- header: string,
22
- showIconInHeader: boolean,
23
- caseInfo: any,
24
- }
25
-
13
+ import CaseViewActionsMenu from '@pega/react-sdk-components/lib/components/template/CaseViewActionsMenu';
14
+ import VerticalTabs from '@pega/react-sdk-components/lib/components/infra/VerticalTabs/VerticalTabs';
15
+ import DeferLoad from '@pega/react-sdk-components/lib/components/infra/DeferLoad';
26
16
 
27
17
  // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
28
18
  declare const PCore: any;
@@ -55,20 +45,13 @@ const useStyles = makeStyles(theme => ({
55
45
  }
56
46
  }));
57
47
 
58
- export default function CaseView(props: CaseViewProps) {
59
- // Get emitted components from map (so we can get any override that may exist)
60
- const CaseViewActionsMenu = getComponentFromMap("CaseViewActionsMenu");
61
- const VerticalTabs = getComponentFromMap("VerticalTabs");
62
- const DeferLoad = getComponentFromMap("DeferLoad");
63
-
48
+ export default function CaseView(props) {
64
49
  const {
65
50
  getPConnect,
66
- icon = '',
51
+ icon,
67
52
  header,
68
53
  subheader,
69
- children = [],
70
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
71
- showIconInHeader = true,
54
+ children,
72
55
  caseInfo: {
73
56
  availableActions = [],
74
57
  availableProcesses = [],
@@ -293,3 +276,21 @@ export default function CaseView(props: CaseViewProps) {
293
276
 
294
277
  return getContainerContents();
295
278
  }
279
+
280
+ CaseView.defaultProps = {
281
+ icon: '',
282
+ children: [],
283
+ caseInfo: {},
284
+ showIconInHeader: true,
285
+ getPConnect: null
286
+ };
287
+
288
+ CaseView.propTypes = {
289
+ icon: PropTypes.string,
290
+ children: PropTypes.arrayOf(PropTypes.node),
291
+ subheader: PropTypes.string.isRequired,
292
+ header: PropTypes.string.isRequired,
293
+ showIconInHeader: PropTypes.bool,
294
+ caseInfo: PropTypes.objectOf(PropTypes.any),
295
+ getPConnect: PropTypes.func
296
+ };
@@ -1,19 +1,15 @@
1
1
  import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import Button from '@material-ui/core/Button';
3
4
  import Menu from '@material-ui/core/Menu';
4
5
  import MenuItem from '@material-ui/core/MenuItem';
5
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
-
7
- interface CaseViewActionsMenuProps extends PConnProps {
8
- // If any, enter additional props that only exist on this component
9
- availableActions: Array<any>,
10
- availableProcesses: Array<any>,
11
- caseTypeID: string,
12
- caseTypeName: string
13
- }
6
+
7
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
8
+
9
+ declare const PCore: typeof PCoreType;
14
10
 
15
11
 
16
- export default function CaseViewActionsMenu(props:CaseViewActionsMenuProps) {
12
+ export default function CaseViewActionsMenu(props) {
17
13
  const { getPConnect, availableActions, availableProcesses, caseTypeID, caseTypeName } = props;
18
14
  const thePConn = getPConnect();
19
15
 
@@ -71,3 +67,16 @@ export default function CaseViewActionsMenu(props:CaseViewActionsMenuProps) {
71
67
  </React.Fragment>
72
68
  );
73
69
  }
70
+
71
+ CaseViewActionsMenu.defaultProps = {
72
+ availableActions: [],
73
+ availableProcesses: []
74
+ };
75
+
76
+ CaseViewActionsMenu.propTypes = {
77
+ getPConnect: PropTypes.func.isRequired,
78
+ availableActions: PropTypes.arrayOf(PropTypes.object),
79
+ availableProcesses: PropTypes.arrayOf(PropTypes.any),
80
+ caseTypeID: PropTypes.string,
81
+ caseTypeName: PropTypes.string
82
+ };
@@ -1,25 +1,20 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  /* eslint-disable no-unused-vars */
3
3
  /* eslint-disable no-nested-ternary */
4
- import React, { useState } from 'react';
5
- import { Button, Card, makeStyles } from '@material-ui/core';
4
+ import { Fragment, useState } from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import React from 'react';
6
7
  import { getToDoAssignments } from '@pega/react-sdk-components/lib/components/infra/Containers/FlowContainer/helpers';
7
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
+ import ToDo from '@pega/react-sdk-components/lib/components/widget/ToDo';
9
+ import Details from '@pega/react-sdk-components/lib/components/template/Details/Details';
10
+ import { Button, Card, makeStyles } from '@material-ui/core';
8
11
 
9
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
12
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
10
13
 
11
- // Confirmation does NOT have getPConnect. So, no need to extend from PConnProps
14
+ declare const PCore: typeof PCoreType;
12
15
 
13
- interface ConfirmationProps extends PConnProps {
14
- // If any, enter additional props that only exist on this component
15
- children: Array<any>;
16
- datasource: { source: any };
17
- label: string;
18
- showLabel: boolean;
19
- showTasks: boolean;
20
- }
21
16
 
22
- const useStyles = makeStyles((theme) => ({
17
+ const useStyles = makeStyles(theme => ({
23
18
  root: {
24
19
  paddingRight: theme.spacing(1),
25
20
  paddingLeft: theme.spacing(1),
@@ -32,11 +27,7 @@ const useStyles = makeStyles((theme) => ({
32
27
  }
33
28
  }));
34
29
 
35
- export default function Confirmation(props: ConfirmationProps) {
36
- // Get emitted components from map (so we can get any override that may exist)
37
- const ToDo = getComponentFromMap('Todo'); // NOTE: ConstellationJS Engine uses "Todo" and not "ToDo"!!!
38
- const Details = getComponentFromMap('Details');
39
-
30
+ export default function Confirmation(props) {
40
31
  const classes = useStyles();
41
32
  const CONSTS = PCore.getConstants();
42
33
  const [showConfirmView, setShowConfirmView] = useState(true);
@@ -44,12 +35,20 @@ export default function Confirmation(props: ConfirmationProps) {
44
35
  // Get the inherited props from the parent to determine label settings
45
36
  // Not using whatsNext at the moment, need to figure out the use of it
46
37
  const whatsNext = datasource?.source;
47
- const items = whatsNext.length > 0 ? whatsNext.map((item) => item.label) : '';
48
- const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget());
49
- const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), activeContainerItemID);
38
+ const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
39
+ const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(
40
+ getPConnect().getTarget()
41
+ );
42
+ const rootInfo = PCore.getContainerUtils().getContainerItemData(
43
+ getPConnect().getTarget(),
44
+ activeContainerItemID
45
+ );
50
46
  const onConfirmViewClose = () => {
51
47
  setShowConfirmView(false);
52
- PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CLOSE_CONFIRM_VIEW, rootInfo);
48
+ PCore.getPubSubUtils().publish(
49
+ PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CLOSE_CONFIRM_VIEW,
50
+ rootInfo
51
+ );
53
52
  };
54
53
  const todoProps = { ...props, renderTodoInConfirm: true };
55
54
  const toDoList = getToDoAssignments(getPConnect());
@@ -57,22 +56,49 @@ export default function Confirmation(props: ConfirmationProps) {
57
56
  const showDetails = detailProps?.children?.[0]?.props?.getPConnect()?.getChildren()?.length > 0;
58
57
  return showConfirmView ? (
59
58
  <Card className={classes.root}>
60
- <h2 id="confirm-label">{props.showLabel ? props.label : ''}</h2>
59
+ <h2 id='confirm-label'>{props.showLabel ? props.label : ''}</h2>
61
60
  {showDetails ? <Details {...detailProps} /> : undefined}
62
61
  {showTasks ? (
63
62
  toDoList && toDoList.length > 0 ? (
64
- <ToDo {...todoProps} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText="Open Tasks" isConfirm />
63
+ <ToDo
64
+ {...todoProps}
65
+ datasource={{ source: toDoList }}
66
+ getPConnect={getPConnect}
67
+ type={CONSTS.TODO}
68
+ headerText='Open Tasks'
69
+ isConfirm
70
+ />
65
71
  ) : undefined
66
72
  ) : undefined}
67
73
  <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
68
- <Button variant="contained" color="primary" onClick={onConfirmViewClose}>
74
+ <Button variant='contained' color='primary' onClick={onConfirmViewClose}>
69
75
  Done
70
76
  </Button>
71
77
  </div>
72
78
  </Card>
73
79
  ) : toDoList && toDoList.length > 0 ? (
74
80
  <Card className={classes.root}>
75
- <ToDo {...props} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText="Tasks" isConfirm />
81
+ <ToDo
82
+ {...props}
83
+ datasource={{ source: toDoList }}
84
+ getPConnect={getPConnect}
85
+ type={CONSTS.TODO}
86
+ headerText='Tasks'
87
+ isConfirm
88
+ />
76
89
  </Card>
77
90
  ) : null;
78
91
  }
92
+
93
+ Confirmation.defaultProps = {
94
+ datasource: undefined,
95
+ label: '',
96
+ showLabel: true
97
+ };
98
+
99
+ Confirmation.propTypes = {
100
+ getPConnect: PropTypes.func.isRequired,
101
+ datasource: PropTypes.objectOf(PropTypes.any),
102
+ label: PropTypes.string,
103
+ showLabel: PropTypes.bool
104
+ };
@@ -1,24 +1,7 @@
1
1
  import React, { useMemo, useState, useEffect } from 'react';
2
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
-
4
- // import type { PConnProps } from '../../../types/PConnProps';
5
-
6
- // ReferenceProps can't be used until getComponentConfig() is NOT private
7
- // interface DataReferenceProps extends PConnProps {
8
- // // If any, enter additional props that only exist on this component
9
- // children: Array<any>,
10
- // label: string,
11
- // showLabel: any,
12
- // displayMode: string,
13
- // allowAndPersistChangesInReviewMode: boolean,
14
- // referenceType: string,
15
- // selectionMode: string,
16
- // displayAs: string,
17
- // ruleClass: string,
18
- // parameters: Array<string>, // need to fix
19
- // hideLabel: boolean
20
- // }
21
-
2
+ import PropTypes from 'prop-types';
3
+ import SingleReferenceReadonly from '@pega/react-sdk-components/lib/components/template/SingleReferenceReadOnly';
4
+ import MultiReferenceReadonly from '@pega/react-sdk-components/lib/components/template/MultiReferenceReadOnly';
22
5
 
23
6
  const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
24
7
 
@@ -26,11 +9,7 @@ const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
26
9
  declare const PCore: any;
27
10
 
28
11
 
29
- export default function DataReference(props /*: DataReferenceProps */) {
30
- // Get emitted components from map (so we can get any override that may exist)
31
- const SingleReferenceReadonly = getComponentFromMap('SingleReferenceReadOnly');
32
- const MultiReferenceReadonly = getComponentFromMap('MultiReferenceReadOnly');
33
-
12
+ export default function DataReference(props) {
34
13
  const {
35
14
  children,
36
15
  getPConnect,
@@ -48,14 +27,14 @@ export default function DataReference(props /*: DataReferenceProps */) {
48
27
  let childrenToRender = children;
49
28
  const pConn = getPConnect();
50
29
  const [dropDownDataSource, setDropDownDataSource] = useState(null);
51
- const propsToUse: any = { label, showLabel, ...pConn.getInheritedProps() };
30
+ const propsToUse = { label, showLabel, ...pConn.getInheritedProps() };
52
31
  if (propsToUse.showLabel === false) {
53
32
  propsToUse.label = '';
54
33
  }
55
34
  const rawViewMetadata = pConn.getRawMetadata();
56
- const viewName = rawViewMetadata["name"];
57
- const [firstChildMeta] = rawViewMetadata["children"];
58
- const refList = rawViewMetadata["config"].referenceList;
35
+ const viewName = rawViewMetadata.name;
36
+ const [firstChildMeta] = rawViewMetadata.children;
37
+ const refList = rawViewMetadata.config.referenceList;
59
38
  const canBeChangedInReviewMode = allowAndPersistChangesInReviewMode && (displayAs === 'autocomplete' || displayAs === 'dropdown');
60
39
  let propName;
61
40
  const isDisplayModeEnabled = ['LABELS_LEFT', 'STACKED_LARGE_VAL'].includes(displayMode);
@@ -65,7 +44,7 @@ export default function DataReference(props /*: DataReferenceProps */) {
65
44
  useEffect(() => {
66
45
  if (
67
46
  firstChildMeta?.type === "Dropdown" &&
68
- rawViewMetadata["config"]?.parameters
47
+ rawViewMetadata.config?.parameters
69
48
  ) {
70
49
  const { value, key, text } = firstChildMeta.config.datasource.fields;
71
50
  PCore.getDataApiUtils()
@@ -105,14 +84,14 @@ export default function DataReference(props /*: DataReferenceProps */) {
105
84
  delete firstChildMeta.config.readOnly;
106
85
  }
107
86
  if (firstChildMeta?.type === 'Dropdown') {
108
- firstChildMeta.config.datasource.source = rawViewMetadata["config"]?.parameters
87
+ firstChildMeta.config.datasource.source = rawViewMetadata.config?.parameters
109
88
  ? dropDownDataSource
110
89
  : '@DATASOURCE '.concat(refList).concat('.pxResults');
111
90
  } else if (firstChildMeta?.type === 'AutoComplete') {
112
91
  firstChildMeta.config.datasource = refList;
113
92
 
114
93
  /* Insert the parameters to the component only if present */
115
- if (rawViewMetadata["config"]?.parameters) {
94
+ if (rawViewMetadata.config?.parameters) {
116
95
  firstChildMeta.config.parameters = parameters;
117
96
  }
118
97
  }
@@ -130,10 +109,10 @@ export default function DataReference(props /*: DataReferenceProps */) {
130
109
  const handleSelection = event => {
131
110
  const caseKey = pConn.getCaseInfo().getKey();
132
111
  const refreshOptions = { autoDetectRefresh: true };
133
- if (canBeChangedInReviewMode && pConn.getValue('__currentPageTabViewName', '')) { // 2nd arg empty string until typedef marked correctly
112
+ if (canBeChangedInReviewMode && pConn.getValue('__currentPageTabViewName')) {
134
113
  getPConnect()
135
114
  .getActionsApi()
136
- .refreshCaseView(caseKey, pConn.getValue('__currentPageTabViewName', ''), null, refreshOptions); // 2nd arg empty string until typedef marked correctly
115
+ .refreshCaseView(caseKey, pConn.getValue('__currentPageTabViewName'), null, refreshOptions);
137
116
  PCore.getDeferLoadManager().refreshActiveComponents(pConn.getContextName());
138
117
  } else {
139
118
  const pgRef = pConn.getPageReference().replace('caseInfo.content', '');
@@ -191,10 +170,8 @@ export default function DataReference(props /*: DataReferenceProps */) {
191
170
  const recreatedFirstChild = useMemo(() => {
192
171
  const { type, config } = firstChildMeta;
193
172
  if (firstChildMeta?.type !== 'Region') {
194
- pConn.clearErrorMessages({ // Need to add empty string for category and context to match typdef
195
- property: propName,
196
- category: '',
197
- context: ''
173
+ pConn.clearErrorMessages({
174
+ property: propName
198
175
  });
199
176
  if (!canBeChangedInReviewMode && isDisplayModeEnabled && selectionMode === SELECTION_MODE.SINGLE) {
200
177
  return (
@@ -209,7 +186,7 @@ export default function DataReference(props /*: DataReferenceProps */) {
209
186
  referenceType={referenceType}
210
187
  hideLabel={hideLabel}
211
188
  dataRelationshipContext={
212
- rawViewMetadata["config"].contextClass && rawViewMetadata["config"].name ? rawViewMetadata["config"].name : null
189
+ rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null
213
190
  }
214
191
  />
215
192
  );
@@ -229,7 +206,7 @@ export default function DataReference(props /*: DataReferenceProps */) {
229
206
  // In the case of a datasource with parameters you cannot load the dropdown before the parameters
230
207
  if (
231
208
  type === 'Dropdown' &&
232
- rawViewMetadata["config"]?.parameters &&
209
+ rawViewMetadata.config?.parameters &&
233
210
  dropDownDataSource === null
234
211
  ) {
235
212
  return null;
@@ -244,19 +221,18 @@ export default function DataReference(props /*: DataReferenceProps */) {
244
221
  disabled: propsToUse.disabled,
245
222
  label: propsToUse.label,
246
223
  viewName: getPConnect().getCurrentView(),
247
- parameters: rawViewMetadata["config"].parameters,
224
+ parameters: rawViewMetadata.config.parameters,
248
225
  readOnly: false,
249
- localeReference: rawViewMetadata["config"].localeReference,
226
+ localeReference: rawViewMetadata.config.localeReference,
250
227
  ...(selectionMode === SELECTION_MODE.SINGLE ? { referenceType } : ''),
251
228
  dataRelationshipContext:
252
- rawViewMetadata["config"].contextClass && rawViewMetadata["config"].name
253
- ? rawViewMetadata["config"].name
229
+ rawViewMetadata.config.contextClass && rawViewMetadata.config.name
230
+ ? rawViewMetadata.config.name
254
231
  : null,
255
232
  hideLabel,
256
233
  onRecordChange: handleSelection
257
- },
258
- },
259
- '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
234
+ }
235
+ });
260
236
  }
261
237
  }, [
262
238
  firstChildMeta.config?.datasource?.source,
@@ -268,7 +244,7 @@ export default function DataReference(props /*: DataReferenceProps */) {
268
244
 
269
245
  // Only include the views region for rendering when it has content
270
246
  if (firstChildMeta?.type !== 'Region') {
271
- const viewsRegion = rawViewMetadata["children"][1];
247
+ const viewsRegion = rawViewMetadata.children[1];
272
248
  if (viewsRegion?.name === 'Views' && viewsRegion.children.length) {
273
249
  childrenToRender = [recreatedFirstChild, ...children.slice(1)];
274
250
  } else {
@@ -286,3 +262,31 @@ export default function DataReference(props /*: DataReferenceProps */) {
286
262
  </div>
287
263
  );
288
264
  }
265
+
266
+ DataReference.defaultProps = {
267
+ label: undefined,
268
+ showLabel: undefined,
269
+ displayMode: undefined,
270
+ allowAndPersistChangesInReviewMode: false,
271
+ referenceType: '',
272
+ selectionMode: '',
273
+ displayAs: '',
274
+ ruleClass: '',
275
+ parameters: undefined,
276
+ hideLabel: false
277
+ };
278
+
279
+ DataReference.propTypes = {
280
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
281
+ getPConnect: PropTypes.func.isRequired,
282
+ label: PropTypes.string,
283
+ showLabel: PropTypes.func,
284
+ displayMode: PropTypes.string,
285
+ allowAndPersistChangesInReviewMode: PropTypes.bool,
286
+ referenceType: PropTypes.string,
287
+ selectionMode: PropTypes.string,
288
+ displayAs: PropTypes.string,
289
+ ruleClass: PropTypes.string,
290
+ parameters: PropTypes.arrayOf(PropTypes.string), // need to fix
291
+ hideLabel: PropTypes.bool
292
+ };
@@ -1,31 +1,20 @@
1
1
  import React, { createElement } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import { getInstructions } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
3
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
5
  import connectToState from '@pega/react-sdk-components/lib/components/helpers/state-utils';
5
6
  import { getKeyForMappedField, mapStateToProps } from './utils';
6
- // import type { PConnProps } from '../../../types/PConnProps';
7
-
8
7
 
9
8
  import './DefaultForm.css';
10
9
 
11
-
12
- // Can't use PConn props until proper props for getPConnect().getChildren()[0].getPConnect;
13
- // interface DefaultFormProps extends PConnProps {
14
- // // If any, enter additional props that only exist on this component
15
- // children: Array<any>,
16
- // NumCols: string
17
-
18
- // }
19
-
20
-
21
10
  const Child = connectToState(mapStateToProps)(props => {
22
11
  const { key, visibility, ...rest } = props;
23
12
 
24
13
  return createElement(createPConnectComponent(), { ...rest, key, visibility });
25
14
  });
26
15
 
27
- export default function DefaultForm(props /* : DefaultFormProps */) {
28
- const { getPConnect, NumCols = '1' } = props;
16
+ export default function DefaultForm(props) {
17
+ const { getPConnect, NumCols } = props;
29
18
  const instructions = getInstructions(getPConnect(), props.instructions);
30
19
 
31
20
  let divClass: string;
@@ -67,3 +56,12 @@ export default function DefaultForm(props /* : DefaultFormProps */) {
67
56
  </>
68
57
  );
69
58
  }
59
+
60
+ DefaultForm.propTypes = {
61
+ // children: PropTypes.arrayOf(PropTypes.node).isRequired,
62
+ NumCols: PropTypes.string
63
+ };
64
+
65
+ DefaultForm.defaultProps = {
66
+ NumCols: '1'
67
+ };
@@ -1,21 +1,10 @@
1
1
  import React, { createElement } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import Grid from '@material-ui/core/Grid';
3
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
-
6
- // import type { PConnProps } from '../../../../types/PConnProps';
7
-
8
-
9
- // Can't use PConnProps until getPConnect().getChildren() type is ok
10
- // interface DetailsProps extends PConnProps {
11
- // // If any, enter additional props that only exist on this component
12
- // }
13
-
14
-
15
- export default function Details(props /* : DetailsProps */) {
16
- // Get emitted components from map (so we can get any override that may exist)
17
- const FieldGroup = getComponentFromMap('FieldGroup');
5
+ import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
18
6
 
7
+ export default function Details(props) {
19
8
  const { label, showLabel, getPConnect, showHighlightedData } = props;
20
9
 
21
10
  // Get the inherited props from the parent to determine label settings
@@ -48,8 +37,7 @@ export default function Details(props /* : DetailsProps */) {
48
37
  field.config.displayAsStatus = true;
49
38
  }
50
39
 
51
- return getPConnect().createComponent(field,
52
- '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
40
+ return getPConnect().createComponent(field);
53
41
  });
54
42
  }
55
43
 
@@ -74,3 +62,16 @@ export default function Details(props /* : DetailsProps */) {
74
62
  </FieldGroup>
75
63
  );
76
64
  }
65
+
66
+ Details.defaultProps = {
67
+ label: undefined,
68
+ showLabel: true,
69
+ showHighlightedData: false
70
+ };
71
+
72
+ Details.propTypes = {
73
+ showLabel: PropTypes.bool,
74
+ label: PropTypes.string,
75
+ getPConnect: PropTypes.func.isRequired,
76
+ showHighlightedData: PropTypes.bool
77
+ };
@@ -1,22 +1,12 @@
1
1
  import { useState, useEffect, Fragment } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import { getTransientTabs, getVisibleTabs, tabClick } from '@pega/react-sdk-components/lib/components/template/SubTabs/tabUtils';
3
4
  import React from 'react';
4
5
  import { Tab, Tabs, TextField } from '@material-ui/core';
5
6
  import { TabContext, TabPanel } from '@material-ui/lab';
6
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
 
8
-
9
- interface DetailsSubTabsProps extends PConnProps {
10
- // If any, enter additional props that only exist on this component
11
- children: Array<any>,
12
- showLabel: boolean,
13
- label: string
14
-
15
- }
16
-
17
-
18
- export default function DetailsSubTabs(props: DetailsSubTabsProps) {
19
- const { children = [], label, showLabel = true, getPConnect } = props;
8
+ export default function DetailsSubTabs(props) {
9
+ const { children, label, showLabel, getPConnect } = props;
20
10
  // Get the inherited props from the parent to determine label settings
21
11
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
22
12
 
@@ -60,3 +50,16 @@ export default function DetailsSubTabs(props: DetailsSubTabsProps) {
60
50
  </Fragment>
61
51
  );
62
52
  }
53
+
54
+ DetailsSubTabs.defaultProps = {
55
+ children: [],
56
+ label: undefined,
57
+ showLabel: true
58
+ };
59
+
60
+ DetailsSubTabs.propTypes = {
61
+ children: PropTypes.arrayOf(PropTypes.node),
62
+ showLabel: PropTypes.bool,
63
+ label: PropTypes.string,
64
+ getPConnect: PropTypes.func.isRequired
65
+ };
@@ -1,24 +1,11 @@
1
1
  import React, { createElement } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import Grid from '@material-ui/core/Grid';
3
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+ import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
5
6
 
6
- // import type { PConnProps } from '../../../../types/PConnProps';
7
-
8
- // Can't use PConnProps until getPConnect().getChildren() type is ok
9
- // interface DetailsThreeColumnProps extends PConnProps {
10
- // // If any, enter additional props that only exist on this component
11
- // showLabel: boolean,
12
- // label: string,
13
- // showHighlightedData: boolean
14
- // }
15
-
16
-
17
- export default function DetailsThreeColumn(props /* : DetailsThreeColumnProps */) {
18
- // Get emitted components from map (so we can get any override that may exist)
19
- const FieldGroup = getComponentFromMap('FieldGroup');
20
-
21
- const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
7
+ export default function DetailsThreeColumn(props) {
8
+ const { label, showLabel, getPConnect, showHighlightedData } = props;
22
9
 
23
10
  // Get the inherited props from the parent to determine label settings
24
11
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
@@ -50,8 +37,7 @@ export default function DetailsThreeColumn(props /* : DetailsThreeColumnProps */
50
37
  field.config.displayAsStatus = true;
51
38
  }
52
39
 
53
- return getPConnect().createComponent(field,
54
- '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
40
+ return getPConnect().createComponent(field);
55
41
  });
56
42
  }
57
43
 
@@ -76,3 +62,16 @@ export default function DetailsThreeColumn(props /* : DetailsThreeColumnProps */
76
62
  </FieldGroup>
77
63
  );
78
64
  }
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
+ };