@pega/react-sdk-overrides 0.23.25 → 8.8.20

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 (141) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
  2. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  3. package/lib/designSystemExtension/Banner/Banner.css +4 -0
  4. package/lib/designSystemExtension/Banner/Banner.tsx +25 -11
  5. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
  6. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
  7. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
  8. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
  9. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
  10. package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
  11. package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
  12. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
  13. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  14. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +6 -2
  15. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
  16. package/lib/field/AutoComplete/AutoComplete.tsx +37 -18
  17. package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
  18. package/lib/field/Checkbox/Checkbox.tsx +41 -17
  19. package/lib/field/Currency/Currency.tsx +23 -15
  20. package/lib/field/Currency/currency-utils.ts +1 -2
  21. package/lib/field/Date/Date.tsx +31 -17
  22. package/lib/field/DateTime/DateTime.tsx +26 -15
  23. package/lib/field/Decimal/Decimal.tsx +82 -19
  24. package/lib/field/Dropdown/Dropdown.tsx +57 -14
  25. package/lib/field/Email/Email.tsx +17 -9
  26. package/lib/field/Integer/Integer.tsx +15 -7
  27. package/lib/field/Percentage/Percentage.tsx +15 -7
  28. package/lib/field/Phone/Phone.tsx +21 -12
  29. package/lib/field/RadioButtons/RadioButtons.tsx +54 -27
  30. package/lib/field/RichText/RichText.tsx +93 -0
  31. package/lib/field/RichText/index.tsx +1 -0
  32. package/lib/field/ScalarList/ScalarList.tsx +64 -0
  33. package/lib/field/ScalarList/config-ext.json +8 -0
  34. package/lib/field/ScalarList/index.tsx +1 -0
  35. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  36. package/lib/field/SemanticLink/utils.ts +2 -1
  37. package/lib/field/TextArea/TextArea.tsx +14 -5
  38. package/lib/field/TextContent/TextContent.tsx +10 -1
  39. package/lib/field/TextInput/TextInput.tsx +40 -11
  40. package/lib/field/Time/Time.tsx +29 -26
  41. package/lib/field/URL/URL.tsx +24 -8
  42. package/lib/field/UserReference/UserReference.tsx +52 -60
  43. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
  44. package/lib/helpers/auth.js +741 -390
  45. package/lib/helpers/authManager.ts +933 -0
  46. package/lib/helpers/case-utils.tsx +103 -0
  47. package/lib/helpers/common-utils.ts +4 -0
  48. package/lib/helpers/config_access.js +63 -145
  49. package/lib/helpers/data_page.ts +2 -1
  50. package/lib/helpers/date-format-utils.ts +29 -19
  51. package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
  52. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
  53. package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
  54. package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
  55. package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
  56. package/lib/helpers/formatters/{common.js → common.ts} +4 -4
  57. package/lib/helpers/formatters/{index.js → index.ts} +3 -3
  58. package/lib/helpers/simpleTableHelpers.ts +10 -6
  59. package/lib/helpers/state-utils.tsx +47 -0
  60. package/lib/helpers/template-utils.ts +3 -4
  61. package/lib/helpers/utils.ts +12 -4
  62. package/lib/helpers/versionHelpers.ts +0 -1
  63. package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
  64. package/lib/infra/Assignment/Assignment.tsx +38 -32
  65. package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
  66. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
  67. package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
  68. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -27
  69. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +19 -28
  70. package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
  71. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -1
  72. package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
  73. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +20 -19
  74. package/lib/infra/MultiStep/MultiStep.tsx +24 -24
  75. package/lib/infra/NavBar/NavBar.tsx +23 -24
  76. package/lib/infra/Reference/Reference.tsx +13 -18
  77. package/lib/infra/Region/Region.tsx +8 -6
  78. package/lib/infra/RootContainer/RootContainer.tsx +32 -39
  79. package/lib/infra/Stages/Stages.tsx +15 -9
  80. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
  81. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  82. package/lib/infra/View/View.tsx +30 -58
  83. package/lib/template/AppShell/AppShell.tsx +51 -34
  84. package/lib/template/BannerPage/BannerPage.tsx +26 -31
  85. package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
  86. package/lib/template/CaseView/CaseView.tsx +137 -100
  87. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
  88. package/lib/template/Confirmation/Confirmation.tsx +29 -52
  89. package/lib/template/DataReference/DataReference.tsx +50 -52
  90. package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
  91. package/lib/template/DefaultForm/utils/index.ts +33 -0
  92. package/lib/template/Details/Details/Details.tsx +16 -17
  93. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
  94. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
  95. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
  96. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
  97. package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
  98. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -17
  99. package/lib/template/ListPage/ListPage.tsx +14 -13
  100. package/lib/template/ListView/ListView.tsx +140 -152
  101. package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
  102. package/lib/template/ListView/{utils.js → utils.ts} +172 -23
  103. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
  104. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
  105. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
  106. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
  107. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  108. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
  109. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  110. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
  111. package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
  112. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
  113. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +28 -7
  114. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
  115. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +34 -36
  116. package/lib/template/SubTabs/SubTabs.tsx +10 -11
  117. package/lib/template/SubTabs/tabUtils.ts +0 -2
  118. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
  119. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  120. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
  121. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
  122. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
  123. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
  124. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
  125. package/lib/template/WssNavBar/WssNavBar.tsx +36 -14
  126. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
  127. package/lib/widget/Attachment/Attachment.css +15 -3
  128. package/lib/widget/Attachment/Attachment.tsx +51 -32
  129. package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
  130. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
  131. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
  132. package/lib/widget/Followers/Followers.tsx +10 -11
  133. package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
  134. package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
  135. package/lib/widget/SummaryList/SummaryList.tsx +17 -3
  136. package/lib/widget/ToDo/ToDo.tsx +69 -104
  137. package/package.json +1 -1
  138. package/lib/helpers/authManager.js +0 -631
  139. /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
  140. /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
  141. /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
@@ -1,31 +1,57 @@
1
1
  import React, { Fragment, memo, useEffect, useState } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { Typography } from '@material-ui/core';
4
- import AutoComplete from '@pega/react-sdk-components/lib/components/field/AutoComplete';
5
- import Dropdown from '@pega/react-sdk-components/lib/components/field/Dropdown';
6
3
  import { getUserId, isUserNameAvailable } from './UserReferenceUtils';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
6
 
7
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 errors)
8
8
  declare const PCore: any;
9
+
9
10
  const DROPDOWN_LIST = 'Drop-down list';
10
11
  const SEARCH_BOX = 'Search box';
11
12
 
12
- const UserReference = props => {
13
+ interface UserReferenceProps extends PConnProps {
14
+ // If any, enter additional props that only exist on URLComponent here
15
+ displayAs?: string;
16
+ label?: string;
17
+ value?: any;
18
+ testId?: string;
19
+ placeholder?: string;
20
+ helperText?: string;
21
+ disabled?: boolean;
22
+ readOnly?: boolean;
23
+ required?: boolean;
24
+ validatemessage?: string;
25
+ showAsFormattedText?: boolean;
26
+ additionalProps?: object;
27
+ hideLabel?: boolean;
28
+ variant?: string;
29
+ onChange?: any;
30
+ }
31
+
32
+ const UserReference = (props: UserReferenceProps) => {
33
+ // Get emitted components from map (so we can get any override that may exist)
34
+ const AutoComplete = getComponentFromMap('AutoComplete');
35
+ const Dropdown = getComponentFromMap('Dropdown');
36
+
13
37
  const {
14
- label,
15
- displayAs,
38
+ label = '',
39
+ displayAs = '',
16
40
  getPConnect,
17
- value,
18
- testId,
19
- helperText,
20
- validatemessage,
21
- placeholder,
22
- showAsFormattedText,
23
- additionalProps,
24
- hideLabel,
25
- readOnly,
26
- required,
27
- disabled,
28
- onChange
41
+ value = '',
42
+ testId = '',
43
+ helperText = '',
44
+ validatemessage = '',
45
+ placeholder = '',
46
+ showAsFormattedText = false,
47
+ additionalProps = {},
48
+ hideLabel = false,
49
+ readOnly = false,
50
+ required = false,
51
+ disabled = false,
52
+ onChange,
53
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
54
+ variant = 'inline'
29
55
  } = props;
30
56
  const [dropDownDataSource, setDropDownDataSource] = useState([]);
31
57
  const [userName, setUserName] = useState('');
@@ -40,7 +66,7 @@ const UserReference = props => {
40
66
  // if same user ref field is referred in view as editable & readonly formatted text
41
67
  // referenced users won't be available, so get user details from dx api
42
68
  const { getOperatorDetails } = PCore.getUserApi();
43
- getOperatorDetails(userId).then(res => {
69
+ getOperatorDetails(userId).then((res) => {
44
70
  if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
45
71
  setUserName(res.data.pyOperatorInfo.pyUserName);
46
72
  }
@@ -52,14 +78,14 @@ const UserReference = props => {
52
78
  };
53
79
  PCore.getRestClient()
54
80
  .invokeRestApi('getListData', { queryPayload })
55
- .then(res => {
56
- const ddDataSource = res.data.data.map(listItem => ({
81
+ .then((res) => {
82
+ const ddDataSource = res.data.data.map((listItem) => ({
57
83
  key: listItem.pyUserIdentifier,
58
84
  value: listItem.pyUserName
59
85
  }));
60
86
  setDropDownDataSource(ddDataSource);
61
87
  })
62
- .catch(err => {
88
+ .catch((err) => {
63
89
  // eslint-disable-next-line no-console
64
90
  console.error(err);
65
91
  });
@@ -76,8 +102,8 @@ const UserReference = props => {
76
102
  TODO: This has to be replaced with Operator Component
77
103
  */}
78
104
  <div>
79
- <Typography variant='caption'>{label}</Typography>
80
- <Typography variant='body1'>{userName}</Typography>
105
+ <Typography variant="caption">{label}</Typography>
106
+ <Typography variant="body1">{userName}</Typography>
81
107
  </div>
82
108
  </Fragment>
83
109
  );
@@ -107,7 +133,7 @@ const UserReference = props => {
107
133
  label={label}
108
134
  getPConnect={getPConnect}
109
135
  datasource={OPERATORS_DP}
110
- listType='datapage'
136
+ listType="datapage"
111
137
  columns={columns}
112
138
  testId={testId}
113
139
  placeholder={placeholder}
@@ -127,7 +153,7 @@ const UserReference = props => {
127
153
  <Dropdown
128
154
  additionalProps={additionalProps}
129
155
  datasource={dropDownDataSource}
130
- listType='associated'
156
+ listType="associated"
131
157
  getPConnect={getPConnect}
132
158
  label={label}
133
159
  value={userId}
@@ -148,40 +174,6 @@ const UserReference = props => {
148
174
  return userReferenceComponent;
149
175
  };
150
176
 
151
- UserReference.propTypes = {
152
- getPConnect: PropTypes.func.isRequired,
153
- displayAs: PropTypes.string,
154
- label: PropTypes.string,
155
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.objectOf(PropTypes.any)]),
156
- testId: PropTypes.string,
157
- placeholder: PropTypes.string,
158
- helperText: PropTypes.string,
159
- disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
160
- readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
161
- required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
162
- validatemessage: PropTypes.string,
163
- showAsFormattedText: PropTypes.bool,
164
- additionalProps: PropTypes.objectOf(PropTypes.any),
165
- hideLabel: PropTypes.bool
166
- };
167
-
168
- UserReference.defaultProps = {
169
- displayAs: null,
170
- label: null,
171
- value: null,
172
- readOnly: false,
173
- testId: null,
174
- placeholder: null,
175
- helperText: null,
176
- disabled: false,
177
- required: false,
178
- validatemessage: null,
179
- showAsFormattedText: false,
180
- additionalProps: {},
181
- variant: 'inline',
182
- hideLabel: false
183
- };
184
-
185
177
  // as objects are there in props, shallow comparision fails & re-rendering of comp happens even with
186
178
  // same key value pairs in obj. hence using custom comparison function on when to re-render
187
179
  const comparisonFn = (prevProps, nextProps) => {
@@ -1,6 +1,6 @@
1
1
  import download from 'downloadjs';
2
2
 
3
- export const validateMaxSize = (fileObj, maxSizeInMB) => {
3
+ export const validateMaxSize = (fileObj: any, maxSizeInMB: string): boolean => {
4
4
  const fileSize = (fileObj.size / 1048576).toFixed(2);
5
5
  return parseFloat(fileSize) < parseFloat(maxSizeInMB);
6
6
  };
@@ -15,7 +15,7 @@ export const fileDownload = (data, fileName, ext) => {
15
15
  }
16
16
  };
17
17
 
18
- export const getIconFromFileType = (fileType) => {
18
+ export const getIconFromFileType = (fileType): string => {
19
19
  let icon = 'document-doc';
20
20
  if (!fileType) return icon;
21
21
  if (fileType.startsWith('audio')) {
@@ -42,11 +42,11 @@ export const getIconFromFileType = (fileType) => {
42
42
  return icon;
43
43
  };
44
44
 
45
- export const getIconForAttachment = (attachment) => {
45
+ export const getIconForAttachment = (inThis:any , attachment:any): string => {
46
46
  let icon;
47
47
  switch (attachment.type) {
48
48
  case "FILE":
49
- icon = this.getIconFromFileType(attachment.mimeType);
49
+ icon = inThis.getIconFromFileType(attachment.mimeType);
50
50
  break;
51
51
  case "URL":
52
52
  icon = "chain";
@@ -57,7 +57,7 @@ export const getIconForAttachment = (attachment) => {
57
57
  return icon;
58
58
  };
59
59
 
60
- export const buildFilePropsFromResponse = (respObj) => {
60
+ export const buildFilePropsFromResponse = (respObj): { props: { meta: string, name: string, icon: string}, responseProps: any} => {
61
61
  return {
62
62
  props: {
63
63
  meta: `${respObj.pyCategoryName}, ${respObj.pxCreateOperator}`,