@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,18 +1,7 @@
1
1
  import React from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import { Alert } from '@material-ui/lab';
3
4
 
4
-
5
- // AlertBanner is one of the few components that does NOT have getPConnect.
6
- // So, no need to extend PConnProps
7
- interface AlertBannerProps {
8
- // If any, enter additional props that only exist on Date here
9
- id: string,
10
- variant: string,
11
- messages: Array<string>,
12
- onDismiss?: any
13
- }
14
-
15
-
16
5
  const SEVERITY_MAP = {
17
6
  urgent: 'error',
18
7
  warning: 'warning',
@@ -20,7 +9,7 @@ const SEVERITY_MAP = {
20
9
  info: 'info'
21
10
  };
22
11
 
23
- export default function AlertBanner(props:AlertBannerProps) {
12
+ export default function AlertBanner(props) {
24
13
  const { id, variant, messages, onDismiss } = props;
25
14
  let additionalProps = {};
26
15
 
@@ -45,3 +34,10 @@ export default function AlertBanner(props:AlertBannerProps) {
45
34
  </div>
46
35
  );
47
36
  }
37
+
38
+ AlertBanner.propTypes = {
39
+ id: PropTypes.string,
40
+ variant: PropTypes.string,
41
+ messages: PropTypes.arrayOf(PropTypes.string),
42
+ onDismiss: PropTypes.any
43
+ };
@@ -2,18 +2,7 @@ import React from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
3
  import './Banner.css';
4
4
 
5
- // AlertBanner is one of the few components that does NOT have getPConnect.
6
- // So, no need to extend PConnProps
7
-
8
- interface BannerProps {
9
- // If any, enter additional props that only exist on this component
10
- a: any,
11
- b: any,
12
- banner: { variant: any, backgroundColor: any, title: any, message: any, backgroundImage: any, tintImage: any },
13
- variant: any
14
- }
15
-
16
- export default function Banner(props:BannerProps) {
5
+ export default function Banner(props) {
17
6
  const { a, b, banner, variant} = props;
18
7
  const { title, message, backgroundImage } = banner;
19
8
  const variantMap = {
@@ -1,29 +1,18 @@
1
1
  import React, { useState, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import isDeepEqual from 'fast-deep-equal/react';
4
+
3
5
  import Grid from '@material-ui/core/Grid';
4
6
  import TextField from '@material-ui/core/TextField';
7
+ import Operator from '@pega/react-sdk-components/lib/components/designSystemExtension/Operator';
5
8
  import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
6
9
  import { getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
7
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
10
 
9
11
  import './CaseSummaryFields.css';
10
12
 
11
13
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
12
14
 
13
- // CaseSummaryFields is one of the few components that does NOT have getPConnect.
14
- // So, no need to extend PConnProps
15
- interface CaseSummaryFieldsProps{
16
- // If any, enter additional props that only exist on this component
17
- status?: string,
18
- showStatus?: boolean,
19
- theFields: Array<any> | any | never
20
- }
21
-
22
-
23
- export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
24
- // Get emitted components from map (so we can get any override that may exist)
25
- const Operator = getComponentFromMap("Operator");
26
-
15
+ export default function CaseSummaryFields(props) {
27
16
  const { status, showStatus, theFields } = props;
28
17
 
29
18
  const [theFieldsToRender, setFieldsToRender] = useState([]);
@@ -238,3 +227,9 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
238
227
  </React.Fragment>
239
228
  );
240
229
  }
230
+
231
+ CaseSummaryFields.propTypes = {
232
+ status: PropTypes.string,
233
+ showStatus: PropTypes.bool,
234
+ theFields: PropTypes.arrayOf(PropTypes.object)
235
+ };
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
2
  import React, { createElement, isValidElement } from 'react';
3
+ import PropTypes from 'prop-types';
3
4
  import Grid from '@material-ui/core/Grid';
4
5
  import Typography from '@material-ui/core/Typography';
5
6
  import { makeStyles } from '@material-ui/core/styles';
@@ -8,14 +9,6 @@ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react
8
9
 
9
10
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
10
11
 
11
- // DetailsFields is one of the few components that does NOT have getPConnect.
12
- // So, no need to extend PConnProps
13
- interface DetailsFieldsProps{
14
- // If any, enter additional props that only exist on this component
15
- fields: Array<any>
16
- }
17
-
18
-
19
12
  const useStyles = makeStyles(theme => ({
20
13
  root: {
21
14
  paddingRight: theme.spacing(1),
@@ -38,9 +31,9 @@ const useStyles = makeStyles(theme => ({
38
31
  }
39
32
  }));
40
33
 
41
- export default function DetailsFields(props: DetailsFieldsProps) {
34
+ export default function DetailsFields(props) {
42
35
  // const componentName = "DetailsFields";
43
- const { fields = [] } = props;
36
+ const { fields } = props;
44
37
  const classes = useStyles();
45
38
  const fieldComponents: Array<any> = [];
46
39
 
@@ -145,3 +138,11 @@ export default function DetailsFields(props: DetailsFieldsProps) {
145
138
 
146
139
  return <React.Fragment>{getGridItems()}</React.Fragment>;
147
140
  }
141
+
142
+ DetailsFields.defaultProps = {
143
+ fields: []
144
+ };
145
+
146
+ DetailsFields.propTypes = {
147
+ fields: PropTypes.arrayOf(PropTypes.any)
148
+ };
@@ -2,15 +2,6 @@ import React from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
3
  import { makeStyles } from '@material-ui/core/styles';
4
4
 
5
- // FieldGroupProps is one of the few components that does NOT have getPConnect.
6
- // So, no need to extend PConnProps
7
- interface FieldGroupProps {
8
- // If any, enter additional props that only exist on this component
9
- children: Array<any> | any,
10
- name: string | object,
11
- }
12
-
13
-
14
5
  const useStyles = makeStyles(theme => ({
15
6
  root: {
16
7
  marginRight: theme.spacing(1),
@@ -28,7 +19,7 @@ const useStyles = makeStyles(theme => ({
28
19
  }
29
20
  }));
30
21
 
31
- export default function FieldGroup(props: FieldGroupProps) {
22
+ const FieldGroup = props => {
32
23
  const { children, name } = props;
33
24
  const classes = useStyles();
34
25
 
@@ -53,3 +44,5 @@ export default function FieldGroup(props: FieldGroupProps) {
53
44
  </React.Fragment>
54
45
  );
55
46
  };
47
+
48
+ export default FieldGroup;
@@ -6,17 +6,7 @@ import Link from '@material-ui/core/Link';
6
6
 
7
7
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
8
8
 
9
- // FieldGroupList is one of the few components that does NOT have getPConnect.
10
- // So, no need to extend PConnProps
11
- interface FieldGroupListProps {
12
- // If any, enter additional props that only exist on this component
13
- items: Array<any> | any,
14
- onDelete: any,
15
- onAdd: any
16
- }
17
-
18
-
19
- export default function FieldGroupList(props: FieldGroupListProps) {
9
+ const FieldGroupList = props => {
20
10
  let menuIconOverride$ = 'trash';
21
11
  if (menuIconOverride$) {
22
12
  menuIconOverride$ = Utils.getImageSrc(
@@ -61,3 +51,5 @@ export default function FieldGroupList(props: FieldGroupListProps) {
61
51
  </Grid>
62
52
  );
63
53
  };
54
+
55
+ export default FieldGroupList;
@@ -4,16 +4,6 @@ import Grid from '@material-ui/core/Grid';
4
4
  import Typography from '@material-ui/core/Typography';
5
5
  import { makeStyles } from '@material-ui/core/styles';
6
6
 
7
- // FieldValueList is one of the few components that does NOT have getPConnect.
8
- // So, no need to extend PConnProps
9
- interface FieldValueListProps{
10
- // If any, enter additional props that only exist on this component
11
- name?: string,
12
- value: any,
13
- variant?: string
14
- }
15
-
16
-
17
7
  const useStyles = makeStyles(theme => ({
18
8
  root: {
19
9
  marginRight: theme.spacing(1),
@@ -47,7 +37,7 @@ function formatItemValue(value) {
47
37
  return formattedVal;
48
38
  }
49
39
 
50
- export default function FieldValueList(props: FieldValueListProps) {
40
+ const FieldValueList = props => {
51
41
  const { name, value, variant = 'inline' } = props;
52
42
  const classes = useStyles();
53
43
 
@@ -94,3 +84,5 @@ export default function FieldValueList(props: FieldValueListProps) {
94
84
  </React.Fragment>
95
85
  );
96
86
  };
87
+
88
+ export default FieldValueList;
@@ -1,4 +1,5 @@
1
1
  import React, {useState} from "react";
2
+ import PropTypes from "prop-types";
2
3
  import TextField from '@material-ui/core/TextField';
3
4
  import Popover from '@material-ui/core/Popover';
4
5
  import Grid from '@material-ui/core/Grid';
@@ -8,21 +9,9 @@ import { makeStyles } from '@material-ui/core/styles';
8
9
 
9
10
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
10
11
 
11
- // Operator is one of the few components that does NOT have getPConnect.
12
- // So, no need to extend PConnProps
13
- interface OperatorProps{
14
- // If any, enter additional props that only exist on this component
15
- caseOpConfig: {
16
- label: string,
17
- createDateTime: string,
18
- createLabel: string,
19
- createOperator: { userName: string, userId: string },
20
- updateDateTime: string,
21
- updateLabel: string,
22
- updateOperator: { userName: string, userId: string }
23
- }
24
- }
12
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
25
13
 
14
+ declare const PCore: typeof PCoreType;
26
15
 
27
16
 
28
17
  const useStyles = makeStyles((theme) => ({
@@ -36,7 +25,7 @@ const useStyles = makeStyles((theme) => ({
36
25
  }
37
26
  }));
38
27
 
39
- export default function Operator(props: OperatorProps) {
28
+ export default function Operator(props) {
40
29
  // const componentName = "Operator";
41
30
  const { caseOpConfig } = props;
42
31
  const classes = useStyles();
@@ -45,7 +34,7 @@ export default function Operator(props: OperatorProps) {
45
34
  let caseOpLabel = "---";
46
35
  let caseOpName = "---";
47
36
  let caseOpId = "";
48
- let caseTime = "";
37
+ let caseTime = null;
49
38
 
50
39
  if (fieldLabel === "create operator") {
51
40
  caseOpLabel = caseOpConfig.createLabel;
@@ -203,3 +192,10 @@ export default function Operator(props: OperatorProps) {
203
192
  </React.Fragment>;
204
193
 
205
194
  }
195
+
196
+ Operator.defaultProps = {
197
+ }
198
+
199
+ Operator.propTypes = {
200
+ caseOpConfig: PropTypes.object.isRequired,
201
+ };
@@ -1,15 +1,8 @@
1
1
  import React from "react";
2
+ // import PropTypes from "prop-types";
2
3
  import { Card, CardContent, CardHeader, Typography } from "@material-ui/core";
3
4
  import { makeStyles } from '@material-ui/core/styles';
4
5
 
5
- // Pulse is one of the few components that does NOT have getPConnect.
6
- // So, no need to extend PConnProps
7
- interface PulseProps {
8
- // If any, enter additional props that only exist on this component
9
- children?: Array<any>
10
- }
11
-
12
-
13
6
  const useStyles = makeStyles((theme) => ({
14
7
  root: {
15
8
  marginTop: theme.spacing(1),
@@ -19,9 +12,8 @@ const useStyles = makeStyles((theme) => ({
19
12
  },
20
13
  }));
21
14
 
22
- export default function Pulse(props: PulseProps) {
23
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
24
- const { children } = props;
15
+ export default function Pulse(/* props */) {
16
+ // const { children } = props;
25
17
  const classes = useStyles();
26
18
 
27
19
  return (
@@ -33,3 +25,7 @@ export default function Pulse(props: PulseProps) {
33
25
  </Card>
34
26
  );
35
27
  }
28
+
29
+ // Pulse.propTypes = {
30
+ // children: PropTypes.arrayOf(PropTypes.node).isRequired
31
+ // };
@@ -2,16 +2,7 @@ import React from 'react';
2
2
  import { Button } from '@material-ui/core';
3
3
  import './WssQuickCreate.css';
4
4
 
5
- // WssQuickCreate is one of the few components that does NOT have getPConnect.
6
- // So, no need to extend PConnProps
7
- interface WssQuickCreateProps {
8
- // If any, enter additional props that only exist on this component
9
- heading: string,
10
- actions?: Array<any>
11
- }
12
-
13
-
14
- export default function WssQuickCreate(props: WssQuickCreateProps) {
5
+ export default function WssQuickCreate(props) {
15
6
  const { heading, actions } = props;
16
7
 
17
8
  return (
@@ -1,30 +1,30 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { TextField } from '@material-ui/core';
3
3
  import Autocomplete from '@material-ui/lab/Autocomplete';
4
- import isDeepEqual from 'fast-deep-equal/react';
5
4
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
5
+ import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
6
+ import isDeepEqual from 'fast-deep-equal/react';
6
7
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
7
8
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
8
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
9
- import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
10
10
 
11
11
  interface IOption {
12
12
  key: string;
13
13
  value: string;
14
14
  }
15
15
 
16
- const preProcessColumns = (columnList) => {
17
- return columnList.map((col) => {
16
+ const preProcessColumns = columnList => {
17
+ return columnList.map(col => {
18
18
  const tempColObj = { ...col };
19
19
  tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
20
20
  return tempColObj;
21
21
  });
22
22
  };
23
23
 
24
- const getDisplayFieldsMetaData = (columnList) => {
25
- const displayColumns = columnList.filter((col) => col.display === 'true');
24
+ const getDisplayFieldsMetaData = columnList => {
25
+ const displayColumns = columnList.filter(col => col.display === 'true');
26
26
  const metaDataObj: any = { key: '', primary: '', secondary: [] };
27
- const keyCol = columnList.filter((col) => col.key === 'true');
27
+ const keyCol = columnList.filter(col => col.key === 'true');
28
28
  metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
29
29
  for (let index = 0; index < displayColumns.length; index += 1) {
30
30
  if (displayColumns[index].primary === 'true') {
@@ -36,25 +36,7 @@ const getDisplayFieldsMetaData = (columnList) => {
36
36
  return metaDataObj;
37
37
  };
38
38
 
39
- interface AutoCompleteProps extends PConnFieldProps {
40
- // If any, enter additional props that only exist on AutoComplete here'
41
- displayMode?: string;
42
- deferDatasource?: boolean;
43
- datasourceMetadata?: any;
44
- status?: string;
45
- onRecordChange?: any;
46
- additionalProps?: object;
47
- listType: string;
48
- parameters?: any;
49
- datasource: any;
50
- columns: Array<any>;
51
- }
52
-
53
- export default function AutoComplete(props: AutoCompleteProps) {
54
- // Get emitted components from map (so we can get any override that may exist)
55
- const TextInput = getComponentFromMap('TextInput');
56
- const FieldValueList = getComponentFromMap('FieldValueList');
57
-
39
+ export default function AutoComplete(props) {
58
40
  const {
59
41
  getPConnect,
60
42
  label,
@@ -72,7 +54,6 @@ export default function AutoComplete(props: AutoCompleteProps) {
72
54
  hideLabel,
73
55
  onRecordChange
74
56
  } = props;
75
-
76
57
  const context = getPConnect().getContextName();
77
58
  let { listType, parameters, datasource = [], columns = [] } = props;
78
59
  const [inputValue, setInputValue] = useState('');
@@ -92,7 +73,7 @@ export default function AutoComplete(props: AutoCompleteProps) {
92
73
 
93
74
  const flattenParameters = (params = {}) => {
94
75
  const flatParams = {};
95
- Object.keys(params).forEach((key) => {
76
+ Object.keys(params).forEach(key => {
96
77
  const { name, value: theVal } = params[key];
97
78
  flatParams[name] = theVal;
98
79
  });
@@ -130,7 +111,7 @@ export default function AutoComplete(props: AutoCompleteProps) {
130
111
 
131
112
  useEffect(() => {
132
113
  if (listType === 'associated') {
133
- setOptions(Utils.getOptionList(props, getPConnect().getDataObject(context)));
114
+ setOptions(Utils.getOptionList(props, getPConnect().getDataObject()));
134
115
  }
135
116
  }, [theDatasource]);
136
117
 
@@ -139,7 +120,7 @@ export default function AutoComplete(props: AutoCompleteProps) {
139
120
  getDataPage(datasource, parameters, context).then((results: any) => {
140
121
  const optionsData: Array<any> = [];
141
122
  const displayColumn = getDisplayFieldsMetaData(columns);
142
- results?.forEach((element) => {
123
+ results?.forEach(element => {
143
124
  const val = element[displayColumn.primary]?.toString();
144
125
  const obj = {
145
126
  key: element[displayColumn.key] || element.pyGUID,
@@ -157,11 +138,11 @@ export default function AutoComplete(props: AutoCompleteProps) {
157
138
  }
158
139
 
159
140
  if (displayMode === 'STACKED_LARGE_VAL') {
160
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
141
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
161
142
  }
162
143
 
163
144
  if (value) {
164
- const index = options?.findIndex((element) => element.key === value);
145
+ const index = options?.findIndex(element => element.key === value);
165
146
  if (index > -1) {
166
147
  selectedValue = options[index].value;
167
148
  } else {
@@ -182,7 +163,7 @@ export default function AutoComplete(props: AutoCompleteProps) {
182
163
  };
183
164
 
184
165
  if (readOnly) {
185
- const theValAsString = options?.find((opt) => opt.key === value)?.value;
166
+ const theValAsString = options?.find(opt => opt.key === value)?.value;
186
167
  return <TextInput {...props} value={theValAsString} />;
187
168
  }
188
169
  // Need to use both getOptionLabel and getOptionSelected to map our
@@ -201,14 +182,14 @@ export default function AutoComplete(props: AutoCompleteProps) {
201
182
  value={selectedValue}
202
183
  inputValue={inputValue || selectedValue}
203
184
  onInputChange={handleInputValue}
204
- renderInput={(params) => (
185
+ renderInput={params => (
205
186
  <TextField
206
187
  {...params}
207
188
  fullWidth
208
- variant="outlined"
189
+ variant='outlined'
209
190
  helperText={helperTextToDisplay}
210
191
  placeholder={placeholder}
211
- size="small"
192
+ size='small'
212
193
  required={required}
213
194
  error={status === 'error'}
214
195
  label={label}
@@ -1,21 +1,14 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Button, Grid, IconButton, Snackbar } from '@material-ui/core';
3
3
  import CloseIcon from '@material-ui/icons/Close';
4
- import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
+
5
5
  import './CancelAlert.css';
6
6
 
7
7
  // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
8
8
  declare const PCore: any;
9
9
 
10
10
 
11
- interface CancelAlertProps extends PConnFieldProps {
12
- // If any, enter additional props that only exist on CancelAlert here
13
- pConn: any,
14
- updateAlertState: any
15
- }
16
-
17
-
18
- export default function CancelAlert(props: CancelAlertProps) {
11
+ const CancelAlert = props => {
19
12
  const { pConn, updateAlertState } = props;
20
13
  const [showSnackbar, setShowSnackbar] = useState(false);
21
14
  const [snackbarMessage, setSnackbarMessage] = useState('');
@@ -133,3 +126,5 @@ export default function CancelAlert(props: CancelAlertProps) {
133
126
  </>
134
127
  );
135
128
  };
129
+
130
+ export default CancelAlert;
@@ -1,38 +1,15 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText } from '@material-ui/core';
2
+ import {
3
+ Checkbox,
4
+ FormControl,
5
+ FormControlLabel,
6
+ FormGroup,
7
+ FormHelperText
8
+ } from '@material-ui/core';
3
9
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
4
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
-
7
- // Checkbox passes in 'value' as a boolean. So can't use the default
8
- // PConnFieldProps since it expects value to be a string.
9
- interface CheckboxProps extends PConnProps {
10
- // If any, enter additional props that only exist on Checkbox here
11
- // Everything from PConnFieldProps except value and change type of value to boolean
12
-
13
- value?: boolean;
14
- label: string;
15
- required: boolean;
16
- disabled: boolean;
17
- validatemessage: string;
18
- status?: string;
19
- // eslint-disable-next-line react/no-unused-prop-types
20
- onChange: any;
21
- // eslint-disable-next-line react/no-unused-prop-types
22
- onBlur?: any;
23
- readOnly: boolean;
24
- testId: string;
25
- helperText: string;
26
- displayMode?: string;
27
- hideLabel: boolean;
28
- // eslint-disable-next-line react/no-unused-prop-types
29
- placeholder?: string;
30
- }
31
-
32
- export default function CheckboxComponent(props: CheckboxProps) {
33
- // Get emitted components from map (so we can get any override that may exist)
34
- const FieldValueList = getComponentFromMap('FieldValueList');
10
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
35
11
 
12
+ export default function CheckboxComponent(props) {
36
13
  const {
37
14
  getPConnect,
38
15
  label,
@@ -62,22 +39,22 @@ export default function CheckboxComponent(props: CheckboxProps) {
62
39
  }, [value]);
63
40
 
64
41
  if (displayMode === 'LABELS_LEFT') {
65
- return <FieldValueList name={hideLabel ? '' : label} value={value.toString()} />;
42
+ return <FieldValueList name={hideLabel ? '' : label} value={value} />;
66
43
  }
67
44
 
68
45
  if (displayMode === 'STACKED_LARGE_VAL') {
69
- return <FieldValueList name={hideLabel ? '' : label} value={value.toString()} variant="stacked" />;
46
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
70
47
  }
71
48
 
72
- const handleChange = (event) => {
49
+ const handleChange = event => {
73
50
  handleEvent(actionsApi, 'changeNblur', propName, event.target.checked);
74
51
  };
75
52
 
76
- const handleBlur = (event) => {
77
- thePConn.getValidationApi().validate(event.target.checked, ''); // 2nd arg empty string until typedef marked correctly as optional
53
+ const handleBlur = event => {
54
+ thePConn.getValidationApi().validate(event.target.checked);
78
55
  };
79
56
 
80
- let theCheckbox = <Checkbox color="primary" disabled={disabled} />;
57
+ let theCheckbox = <Checkbox color='primary' disabled={disabled} />;
81
58
 
82
59
  if (readOnly) {
83
60
  // Workaround for lack of InputProps readOnly from https://github.com/mui-org/material-ui/issues/17043
@@ -94,7 +71,7 @@ export default function CheckboxComponent(props: CheckboxProps) {
94
71
  onChange={!readOnly ? handleChange : undefined}
95
72
  onBlur={!readOnly ? handleBlur : undefined}
96
73
  label={caption}
97
- labelPlacement="end"
74
+ labelPlacement='end'
98
75
  data-test-id={testId}
99
76
  />
100
77
  </FormGroup>