@pega/react-sdk-overrides 8.23.11 → 23.1.10

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 (132) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +13 -9
  2. package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
  4. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
  5. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
  6. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -3
  7. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
  8. package/lib/designSystemExtension/Operator/Operator.tsx +16 -12
  9. package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
  10. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
  11. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +10 -1
  13. package/lib/field/AutoComplete/AutoComplete.tsx +38 -19
  14. package/lib/field/CancelAlert/CancelAlert.tsx +9 -4
  15. package/lib/field/Checkbox/Checkbox.tsx +39 -7
  16. package/lib/field/Currency/Currency.tsx +24 -16
  17. package/lib/field/Currency/currency-utils.ts +1 -5
  18. package/lib/field/Date/Date.tsx +23 -16
  19. package/lib/field/DateTime/DateTime.tsx +26 -15
  20. package/lib/field/Decimal/Decimal.tsx +26 -15
  21. package/lib/field/Dropdown/Dropdown.tsx +34 -28
  22. package/lib/field/Email/Email.tsx +17 -9
  23. package/lib/field/Integer/Integer.tsx +15 -7
  24. package/lib/field/Percentage/Percentage.tsx +15 -7
  25. package/lib/field/Phone/Phone.tsx +19 -11
  26. package/lib/field/RadioButtons/RadioButtons.tsx +28 -38
  27. package/lib/field/RichText/RichText.tsx +95 -0
  28. package/lib/field/RichText/index.tsx +1 -0
  29. package/lib/field/ScalarList/ScalarList.tsx +73 -0
  30. package/lib/field/ScalarList/config-ext.json +8 -0
  31. package/lib/field/ScalarList/index.tsx +1 -0
  32. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  33. package/lib/field/TextArea/TextArea.tsx +14 -5
  34. package/lib/field/TextContent/TextContent.tsx +10 -1
  35. package/lib/field/TextInput/TextInput.tsx +16 -7
  36. package/lib/field/Time/Time.tsx +22 -27
  37. package/lib/field/URL/URL.tsx +16 -8
  38. package/lib/field/UserReference/UserReference.tsx +50 -60
  39. package/lib/helpers/attachmentHelpers.ts +4 -4
  40. package/lib/helpers/auth.js +752 -401
  41. package/lib/helpers/authManager.ts +933 -0
  42. package/lib/helpers/case-utils.tsx +8 -9
  43. package/lib/helpers/common-utils.ts +1 -1
  44. package/lib/helpers/config_access.js +0 -73
  45. package/lib/helpers/date-format-utils.ts +1 -1
  46. package/lib/helpers/event-utils.ts +1 -1
  47. package/lib/helpers/field-group-utils.ts +7 -9
  48. package/lib/helpers/formatters/Currency.ts +11 -11
  49. package/lib/helpers/formatters/CurrencyMap.ts +8 -5
  50. package/lib/helpers/formatters/Date.ts +1 -1
  51. package/lib/helpers/formatters/common.ts +2 -6
  52. package/lib/helpers/formatters/index.ts +3 -3
  53. package/lib/helpers/simpleTableHelpers.ts +7 -7
  54. package/lib/helpers/state-utils.tsx +0 -3
  55. package/lib/helpers/template-utils.ts +3 -6
  56. package/lib/helpers/versionHelpers.ts +0 -3
  57. package/lib/infra/ActionButtons/ActionButtons.tsx +9 -19
  58. package/lib/infra/Assignment/Assignment.tsx +28 -32
  59. package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
  60. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +57 -58
  61. package/lib/infra/Containers/FlowContainer/helpers.ts +0 -3
  62. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +14 -17
  63. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +20 -27
  64. package/lib/infra/DashboardFilter/DashboardFilter.tsx +13 -21
  65. package/lib/infra/DashboardFilter/filterUtils.tsx +2 -1
  66. package/lib/infra/DeferLoad/DeferLoad.tsx +14 -20
  67. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +11 -15
  68. package/lib/infra/MultiStep/MultiStep.tsx +22 -22
  69. package/lib/infra/NavBar/NavBar.tsx +14 -21
  70. package/lib/infra/Reference/Reference.tsx +14 -18
  71. package/lib/infra/Region/Region.tsx +8 -6
  72. package/lib/infra/RootContainer/RootContainer.tsx +16 -25
  73. package/lib/infra/Stages/Stages.tsx +10 -8
  74. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
  75. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  76. package/lib/infra/View/View.tsx +23 -23
  77. package/lib/template/AppShell/AppShell.tsx +36 -25
  78. package/lib/template/BannerPage/BannerPage.tsx +26 -31
  79. package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
  80. package/lib/template/CaseView/CaseView.tsx +24 -25
  81. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +10 -19
  82. package/lib/template/Confirmation/Confirmation.tsx +27 -53
  83. package/lib/template/DataReference/DataReference.tsx +49 -53
  84. package/lib/template/DefaultForm/DefaultForm.tsx +14 -12
  85. package/lib/template/Details/Details/Details.tsx +16 -17
  86. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
  87. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
  88. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
  89. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +78 -0
  90. package/lib/template/Details/DynamicTabs/config.json +36 -0
  91. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  92. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +22 -28
  93. package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
  94. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +20 -18
  95. package/lib/template/ListPage/ListPage.tsx +14 -13
  96. package/lib/template/ListView/ListView.tsx +242 -314
  97. package/lib/template/ListView/utils.ts +170 -23
  98. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +10 -19
  99. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
  100. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
  101. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
  102. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  103. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
  104. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  105. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
  106. package/lib/template/PromotedFilters/PromotedFilters.tsx +16 -14
  107. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +102 -8
  108. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +25 -8
  109. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +23 -33
  110. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +33 -36
  111. package/lib/template/SubTabs/SubTabs.tsx +10 -11
  112. package/lib/template/SubTabs/tabUtils.ts +0 -4
  113. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
  114. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  115. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
  116. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
  117. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
  118. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
  119. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
  120. package/lib/template/WssNavBar/WssNavBar.tsx +18 -1
  121. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
  122. package/lib/widget/Attachment/Attachment.tsx +28 -16
  123. package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
  124. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
  125. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +35 -22
  126. package/lib/widget/Followers/Followers.tsx +10 -11
  127. package/lib/widget/QuickCreate/QuickCreate.tsx +11 -5
  128. package/lib/widget/SummaryItem/SummaryItem.tsx +11 -1
  129. package/lib/widget/SummaryList/SummaryList.tsx +17 -3
  130. package/lib/widget/ToDo/ToDo.tsx +62 -105
  131. package/package.json +1 -1
  132. package/lib/helpers/authManager.js +0 -634
@@ -1,7 +1,18 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { Alert } from '@material-ui/lab';
4
3
 
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
+
5
16
  const SEVERITY_MAP = {
6
17
  urgent: 'error',
7
18
  warning: 'warning',
@@ -9,7 +20,7 @@ const SEVERITY_MAP = {
9
20
  info: 'info'
10
21
  };
11
22
 
12
- export default function AlertBanner(props) {
23
+ export default function AlertBanner(props:AlertBannerProps) {
13
24
  const { id, variant, messages, onDismiss } = props;
14
25
  let additionalProps = {};
15
26
 
@@ -34,10 +45,3 @@ export default function AlertBanner(props) {
34
45
  </div>
35
46
  );
36
47
  }
37
-
38
- AlertBanner.propTypes = {
39
- id: PropTypes.string,
40
- variant: PropTypes.string,
41
- messages: PropTypes.arrayOf(PropTypes.string),
42
- onDismiss: PropTypes.any
43
- };
@@ -2,7 +2,18 @@ import React from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
3
  import './Banner.css';
4
4
 
5
- export default function Banner(props) {
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) {
6
17
  const { a, b, banner, variant} = props;
7
18
  const { title, message, backgroundImage } = banner;
8
19
  const variantMap = {
@@ -1,18 +1,29 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import isDeepEqual from 'fast-deep-equal/react';
4
-
5
3
  import Grid from '@material-ui/core/Grid';
6
4
  import TextField from '@material-ui/core/TextField';
7
- import Operator from '@pega/react-sdk-components/lib/components/designSystemExtension/Operator';
8
5
  import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
9
6
  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';
10
8
 
11
9
  import './CaseSummaryFields.css';
12
10
 
13
11
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
14
12
 
15
- export default function CaseSummaryFields(props) {
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
+
16
27
  const { status, showStatus, theFields } = props;
17
28
 
18
29
  const [theFieldsToRender, setFieldsToRender] = useState([]);
@@ -227,9 +238,3 @@ export default function CaseSummaryFields(props) {
227
238
  </React.Fragment>
228
239
  );
229
240
  }
230
-
231
- CaseSummaryFields.propTypes = {
232
- status: PropTypes.string,
233
- showStatus: PropTypes.bool,
234
- theFields: PropTypes.arrayOf(PropTypes.object)
235
- };
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
2
  import React, { createElement, isValidElement } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import Grid from '@material-ui/core/Grid';
5
4
  import Typography from '@material-ui/core/Typography';
6
5
  import { makeStyles } from '@material-ui/core/styles';
@@ -9,6 +8,14 @@ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react
9
8
 
10
9
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
11
10
 
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
+
12
19
  const useStyles = makeStyles(theme => ({
13
20
  root: {
14
21
  paddingRight: theme.spacing(1),
@@ -31,9 +38,9 @@ const useStyles = makeStyles(theme => ({
31
38
  }
32
39
  }));
33
40
 
34
- export default function DetailsFields(props) {
41
+ export default function DetailsFields(props: DetailsFieldsProps) {
35
42
  // const componentName = "DetailsFields";
36
- const { fields } = props;
43
+ const { fields = [] } = props;
37
44
  const classes = useStyles();
38
45
  const fieldComponents: Array<any> = [];
39
46
 
@@ -138,11 +145,3 @@ export default function DetailsFields(props) {
138
145
 
139
146
  return <React.Fragment>{getGridItems()}</React.Fragment>;
140
147
  }
141
-
142
- DetailsFields.defaultProps = {
143
- fields: []
144
- };
145
-
146
- DetailsFields.propTypes = {
147
- fields: PropTypes.arrayOf(PropTypes.any)
148
- };
@@ -2,6 +2,15 @@ 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
+
5
14
  const useStyles = makeStyles(theme => ({
6
15
  root: {
7
16
  marginRight: theme.spacing(1),
@@ -19,7 +28,7 @@ const useStyles = makeStyles(theme => ({
19
28
  }
20
29
  }));
21
30
 
22
- const FieldGroup = props => {
31
+ export default function FieldGroup(props: FieldGroupProps) {
23
32
  const { children, name } = props;
24
33
  const classes = useStyles();
25
34
 
@@ -44,5 +53,3 @@ const FieldGroup = props => {
44
53
  </React.Fragment>
45
54
  );
46
55
  };
47
-
48
- export default FieldGroup;
@@ -6,7 +6,17 @@ 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
- const FieldGroupList = props => {
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) {
10
20
  let menuIconOverride$ = 'trash';
11
21
  if (menuIconOverride$) {
12
22
  menuIconOverride$ = Utils.getImageSrc(
@@ -51,5 +61,3 @@ const FieldGroupList = props => {
51
61
  </Grid>
52
62
  );
53
63
  };
54
-
55
- export default FieldGroupList;
@@ -4,6 +4,16 @@ 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
+
7
17
  const useStyles = makeStyles(theme => ({
8
18
  root: {
9
19
  marginRight: theme.spacing(1),
@@ -37,7 +47,7 @@ function formatItemValue(value) {
37
47
  return formattedVal;
38
48
  }
39
49
 
40
- const FieldValueList = props => {
50
+ export default function FieldValueList(props: FieldValueListProps) {
41
51
  const { name, value, variant = 'inline' } = props;
42
52
  const classes = useStyles();
43
53
 
@@ -84,5 +94,3 @@ const FieldValueList = props => {
84
94
  </React.Fragment>
85
95
  );
86
96
  };
87
-
88
- export default FieldValueList;
@@ -1,5 +1,4 @@
1
1
  import React, {useState} from "react";
2
- import PropTypes from "prop-types";
3
2
  import TextField from '@material-ui/core/TextField';
4
3
  import Popover from '@material-ui/core/Popover';
5
4
  import Grid from '@material-ui/core/Grid';
@@ -9,9 +8,21 @@ import { makeStyles } from '@material-ui/core/styles';
9
8
 
10
9
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
11
10
 
12
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
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
+ }
13
25
 
14
- declare const PCore: typeof PCoreType;
15
26
 
16
27
 
17
28
  const useStyles = makeStyles((theme) => ({
@@ -25,7 +36,7 @@ const useStyles = makeStyles((theme) => ({
25
36
  }
26
37
  }));
27
38
 
28
- export default function Operator(props) {
39
+ export default function Operator(props: OperatorProps) {
29
40
  // const componentName = "Operator";
30
41
  const { caseOpConfig } = props;
31
42
  const classes = useStyles();
@@ -34,7 +45,7 @@ export default function Operator(props) {
34
45
  let caseOpLabel = "---";
35
46
  let caseOpName = "---";
36
47
  let caseOpId = "";
37
- let caseTime = null;
48
+ let caseTime = "";
38
49
 
39
50
  if (fieldLabel === "create operator") {
40
51
  caseOpLabel = caseOpConfig.createLabel;
@@ -192,10 +203,3 @@ export default function Operator(props) {
192
203
  </React.Fragment>;
193
204
 
194
205
  }
195
-
196
- Operator.defaultProps = {
197
- }
198
-
199
- Operator.propTypes = {
200
- caseOpConfig: PropTypes.object.isRequired,
201
- };
@@ -1,8 +1,15 @@
1
1
  import React from "react";
2
- // import PropTypes from "prop-types";
3
2
  import { Card, CardContent, CardHeader, Typography } from "@material-ui/core";
4
3
  import { makeStyles } from '@material-ui/core/styles';
5
4
 
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
+
6
13
  const useStyles = makeStyles((theme) => ({
7
14
  root: {
8
15
  marginTop: theme.spacing(1),
@@ -12,8 +19,9 @@ const useStyles = makeStyles((theme) => ({
12
19
  },
13
20
  }));
14
21
 
15
- export default function Pulse(/* props */) {
16
- // const { children } = props;
22
+ export default function Pulse(props: PulseProps) {
23
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
24
+ const { children } = props;
17
25
  const classes = useStyles();
18
26
 
19
27
  return (
@@ -25,7 +33,3 @@ export default function Pulse(/* props */) {
25
33
  </Card>
26
34
  );
27
35
  }
28
-
29
- // Pulse.propTypes = {
30
- // children: PropTypes.arrayOf(PropTypes.node).isRequired
31
- // };
@@ -0,0 +1,121 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Editor } from '@tinymce/tinymce-react';
3
+ import { FormControl, FormHelperText, InputLabel, makeStyles } from '@material-ui/core';
4
+ import { useAfterInitialEffect, useConsolidatedRef, useUID } from '@pega/react-sdk-components/lib/hooks';
5
+
6
+ const useStyles = makeStyles((theme) => ({
7
+ fieldLabel: {
8
+ position: 'relative',
9
+ transform: 'translate(0, 0px) scale(1)',
10
+ marginBottom: '5px',
11
+ color: theme.palette.text.secondary
12
+ }
13
+ }));
14
+
15
+ interface RichTextEditorProps {
16
+ id?: string;
17
+ defaultValue: string;
18
+ label: string;
19
+ labelHidden: boolean;
20
+ info: string;
21
+ testId: string;
22
+ placeholder: string;
23
+ disabled: boolean;
24
+ required: boolean;
25
+ readOnly: boolean;
26
+ error: boolean;
27
+ onBlur: React.EventHandler<any>;
28
+ onChange: React.EventHandler<any>;
29
+ }
30
+
31
+ const RichTextEditor = forwardRef(function RichTextEditor(props: RichTextEditorProps, ref) {
32
+ const classes = useStyles();
33
+ const uid = useUID();
34
+ const { id = uid, defaultValue, label, labelHidden, info, testId, placeholder, disabled, required, readOnly, error, onBlur, onChange } = props;
35
+
36
+ const editorRef: any = useConsolidatedRef(ref);
37
+ let richTextComponent: any = null;
38
+
39
+ useAfterInitialEffect(() => {
40
+ editorRef?.current.mode.set(readOnly || disabled ? 'readonly' : 'design');
41
+ }, [readOnly, disabled]);
42
+
43
+ const filePickerCallback = (cb) => {
44
+ const input = document.createElement('input');
45
+ input.setAttribute('type', 'file');
46
+ input.setAttribute('accept', 'image/*');
47
+
48
+ input.addEventListener('change', (e: any) => {
49
+ const file = e.target.files[0];
50
+
51
+ const reader: any = new FileReader();
52
+ reader.addEventListener('load', () => {
53
+ /*
54
+ Note: Now we need to register the blob in TinyMCEs image blob
55
+ registry. In the next release this part hopefully won't be
56
+ necessary, as we are looking to handle it internally.
57
+ */
58
+ const blobId = `blobid${new Date().getTime()}`;
59
+ const blobCache = editorRef.current.editorUpload.blobCache;
60
+ const base64 = reader.result.split(',')[1];
61
+ const blobInfo = blobCache.create(blobId, file, base64);
62
+ blobCache.add(blobInfo);
63
+
64
+ /* call the callback and populate the Title field with the file name */
65
+ cb(blobInfo.blobUri(), { title: file.name });
66
+ });
67
+ reader.readAsDataURL(file);
68
+ });
69
+
70
+ input.click();
71
+ };
72
+
73
+ if (readOnly) {
74
+ const value = defaultValue || '--';
75
+ // eslint-disable-next-line react/no-danger
76
+ richTextComponent = <div key={id} id={id} className="readonly-richtext-editor" dangerouslySetInnerHTML={{ __html: value }} />;
77
+ } else {
78
+ richTextComponent = (
79
+ <Editor
80
+ tinymceScriptSrc="tinymce/tinymce.min.js"
81
+ onInit={(_evt, editor) => {
82
+ editorRef.current = editor;
83
+ }}
84
+ id={id}
85
+ initialValue={defaultValue}
86
+ disabled={disabled}
87
+ init={{
88
+ placeholder,
89
+ menubar: false,
90
+ statusbar: false,
91
+ min_height: 130,
92
+ plugins: ['lists', 'advlist', 'autolink', 'image', 'link', 'autoresize'],
93
+ autoresize_bottom_margin: 0,
94
+ toolbar: disabled ? false : 'blocks | bold italic strikethrough | bullist numlist outdent indent | link image',
95
+ toolbar_location: 'bottom',
96
+ content_style: 'body { font-family:Helvetica, Arial,sans-serif; font-size:14px }',
97
+ branding: false,
98
+ paste_data_images: true,
99
+ file_picker_types: 'image',
100
+ file_picker_callback: filePickerCallback
101
+ }}
102
+ onBlur={onBlur}
103
+ onEditorChange={onChange}
104
+ />
105
+ );
106
+ }
107
+
108
+ return (
109
+ <FormControl data-test-id={testId} error={error} required={required}>
110
+ {!labelHidden && (
111
+ <InputLabel id="demo-simple-select-error-label" className={classes.fieldLabel}>
112
+ {label}
113
+ </InputLabel>
114
+ )}
115
+ {richTextComponent}
116
+ {info && <FormHelperText>{info}</FormHelperText>}
117
+ </FormControl>
118
+ );
119
+ });
120
+
121
+ export default RichTextEditor;
@@ -0,0 +1 @@
1
+ export { default } from './RichTextEditor';
@@ -2,7 +2,16 @@ import React from 'react';
2
2
  import { Button } from '@material-ui/core';
3
3
  import './WssQuickCreate.css';
4
4
 
5
- export default function WssQuickCreate(props) {
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) {
6
15
  const { heading, actions } = props;
7
16
 
8
17
  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 Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
5
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
6
4
  import isDeepEqual from 'fast-deep-equal/react';
5
+ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
7
6
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
8
7
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
9
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
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';
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,7 +36,25 @@ const getDisplayFieldsMetaData = columnList => {
36
36
  return metaDataObj;
37
37
  };
38
38
 
39
- export default function AutoComplete(props) {
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
+
40
58
  const {
41
59
  getPConnect,
42
60
  label,
@@ -54,6 +72,7 @@ export default function AutoComplete(props) {
54
72
  hideLabel,
55
73
  onRecordChange
56
74
  } = props;
75
+
57
76
  const context = getPConnect().getContextName();
58
77
  let { listType, parameters, datasource = [], columns = [] } = props;
59
78
  const [inputValue, setInputValue] = useState('');
@@ -64,7 +83,7 @@ export default function AutoComplete(props) {
64
83
 
65
84
  const thePConn = getPConnect();
66
85
  const actionsApi = thePConn.getActionsApi();
67
- const propName = thePConn.getStateProps().value;
86
+ const propName = thePConn.getStateProps()["value"];
68
87
 
69
88
  if (!isDeepEqual(datasource, theDatasource)) {
70
89
  // inbound datasource is different, so update theDatasource (to trigger useEffect)
@@ -73,7 +92,7 @@ export default function AutoComplete(props) {
73
92
 
74
93
  const flattenParameters = (params = {}) => {
75
94
  const flatParams = {};
76
- Object.keys(params).forEach(key => {
95
+ Object.keys(params).forEach((key) => {
77
96
  const { name, value: theVal } = params[key];
78
97
  flatParams[name] = theVal;
79
98
  });
@@ -111,7 +130,7 @@ export default function AutoComplete(props) {
111
130
 
112
131
  useEffect(() => {
113
132
  if (listType === 'associated') {
114
- setOptions(Utils.getOptionList(props, getPConnect().getDataObject()));
133
+ setOptions(Utils.getOptionList(props, getPConnect().getDataObject('')));
115
134
  }
116
135
  }, [theDatasource]);
117
136
 
@@ -120,7 +139,7 @@ export default function AutoComplete(props) {
120
139
  getDataPage(datasource, parameters, context).then((results: any) => {
121
140
  const optionsData: Array<any> = [];
122
141
  const displayColumn = getDisplayFieldsMetaData(columns);
123
- results?.forEach(element => {
142
+ results?.forEach((element) => {
124
143
  const val = element[displayColumn.primary]?.toString();
125
144
  const obj = {
126
145
  key: element[displayColumn.key] || element.pyGUID,
@@ -138,11 +157,11 @@ export default function AutoComplete(props) {
138
157
  }
139
158
 
140
159
  if (displayMode === 'STACKED_LARGE_VAL') {
141
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
160
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
142
161
  }
143
162
 
144
163
  if (value) {
145
- const index = options?.findIndex(element => element.key === value);
164
+ const index = options?.findIndex((element) => element.key === value);
146
165
  if (index > -1) {
147
166
  selectedValue = options[index].value;
148
167
  } else {
@@ -163,7 +182,7 @@ export default function AutoComplete(props) {
163
182
  };
164
183
 
165
184
  if (readOnly) {
166
- const theValAsString = options?.find(opt => opt.key === value)?.value;
185
+ const theValAsString = options?.find((opt) => opt.key === value)?.value;
167
186
  return <TextInput {...props} value={theValAsString} />;
168
187
  }
169
188
  // Need to use both getOptionLabel and getOptionSelected to map our
@@ -182,14 +201,14 @@ export default function AutoComplete(props) {
182
201
  value={selectedValue}
183
202
  inputValue={inputValue || selectedValue}
184
203
  onInputChange={handleInputValue}
185
- renderInput={params => (
204
+ renderInput={(params) => (
186
205
  <TextField
187
206
  {...params}
188
207
  fullWidth
189
- variant='outlined'
208
+ variant="outlined"
190
209
  helperText={helperTextToDisplay}
191
210
  placeholder={placeholder}
192
- size='small'
211
+ size="small"
193
212
  required={required}
194
213
  error={status === 'error'}
195
214
  label={label}
@@ -1,14 +1,21 @@
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
-
4
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
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
- const CancelAlert = props => {
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) {
12
19
  const { pConn, updateAlertState } = props;
13
20
  const [showSnackbar, setShowSnackbar] = useState(false);
14
21
  const [snackbarMessage, setSnackbarMessage] = useState('');
@@ -126,5 +133,3 @@ const CancelAlert = props => {
126
133
  </>
127
134
  );
128
135
  };
129
-
130
- export default CancelAlert;