@pega/react-sdk-overrides 0.23.26 → 0.23.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +17 -0
  3. package/SECURITY.md +10 -0
  4. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +39 -0
  5. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  6. package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  8. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  9. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  10. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  11. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  12. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
  13. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  14. package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
  15. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  16. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  17. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  18. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  19. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  20. package/lib/field/AutoComplete/config-ext.json +2 -3
  21. package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
  22. package/lib/field/CancelAlert/index.tsx +1 -1
  23. package/lib/field/Checkbox/Checkbox.tsx +29 -19
  24. package/lib/field/Checkbox/config-ext.json +2 -3
  25. package/lib/field/Currency/Currency.tsx +27 -38
  26. package/lib/field/Currency/config-ext.json +2 -3
  27. package/lib/field/Currency/currency-utils.ts +10 -18
  28. package/lib/field/Date/Date.tsx +33 -15
  29. package/lib/field/Date/config-ext.json +2 -3
  30. package/lib/field/DateTime/DateTime.tsx +22 -11
  31. package/lib/field/DateTime/config-ext.json +1 -2
  32. package/lib/field/Decimal/Decimal.tsx +64 -17
  33. package/lib/field/Decimal/config-ext.json +1 -2
  34. package/lib/field/Decimal/index.tsx +1 -1
  35. package/lib/field/Dropdown/Dropdown.tsx +154 -18
  36. package/lib/field/Dropdown/config-ext.json +1 -2
  37. package/lib/field/Email/Email.tsx +16 -7
  38. package/lib/field/Email/config-ext.json +1 -2
  39. package/lib/field/Email/index.tsx +1 -1
  40. package/lib/field/Group/Group.tsx +37 -0
  41. package/lib/field/Group/config-ext.json +7 -0
  42. package/lib/field/Group/index.tsx +1 -0
  43. package/lib/field/Integer/Integer.tsx +15 -6
  44. package/lib/field/Integer/config-ext.json +1 -2
  45. package/lib/field/Percentage/Percentage.tsx +14 -6
  46. package/lib/field/Percentage/config-ext.json +1 -2
  47. package/lib/field/Phone/Phone.tsx +17 -7
  48. package/lib/field/Phone/index.tsx +1 -1
  49. package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
  50. package/lib/field/RadioButtons/config-ext.json +1 -2
  51. package/lib/field/RichText/RichText.tsx +96 -0
  52. package/lib/field/RichText/index.tsx +1 -0
  53. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  54. package/lib/field/ScalarList/config-ext.json +7 -0
  55. package/lib/field/ScalarList/index.tsx +1 -0
  56. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  57. package/lib/field/SemanticLink/config-ext.json +1 -2
  58. package/lib/field/SemanticLink/utils.ts +8 -10
  59. package/lib/field/TextArea/TextArea.tsx +15 -5
  60. package/lib/field/TextArea/config-ext.json +1 -2
  61. package/lib/field/TextContent/TextContent.tsx +9 -2
  62. package/lib/field/TextContent/config-ext.json +1 -2
  63. package/lib/field/TextInput/TextInput.tsx +41 -10
  64. package/lib/field/TextInput/config-ext.json +1 -2
  65. package/lib/field/TextInput/index.tsx +1 -1
  66. package/lib/field/Time/Time.tsx +21 -18
  67. package/lib/field/Time/config-ext.json +1 -2
  68. package/lib/field/URL/URL.tsx +23 -6
  69. package/lib/field/URL/config-ext.json +1 -2
  70. package/lib/field/URL/index.tsx +1 -1
  71. package/lib/field/UserReference/UserReference.tsx +52 -58
  72. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  73. package/lib/field/UserReference/config-ext.json +1 -2
  74. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
  75. package/lib/helpers/case-utils.tsx +99 -0
  76. package/lib/helpers/common-utils.ts +8 -0
  77. package/lib/helpers/data_page.ts +3 -6
  78. package/lib/helpers/date-format-utils.ts +29 -19
  79. package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
  80. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
  81. package/lib/helpers/formatters/Boolean.ts +21 -0
  82. package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
  83. package/lib/helpers/formatters/CurrencyMap.ts +915 -0
  84. package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
  85. package/lib/helpers/formatters/{common.js → common.ts} +3 -4
  86. package/lib/helpers/formatters/{index.js → index.ts} +22 -22
  87. package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
  88. package/lib/helpers/simpleTableHelpers.ts +65 -85
  89. package/lib/helpers/state-utils.tsx +43 -0
  90. package/lib/helpers/template-utils.ts +4 -8
  91. package/lib/helpers/utils.ts +16 -8
  92. package/lib/helpers/versionHelpers.ts +1 -5
  93. package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
  94. package/lib/infra/ActionButtons/index.tsx +1 -1
  95. package/lib/infra/Assignment/Assignment.tsx +99 -84
  96. package/lib/infra/Assignment/index.tsx +1 -1
  97. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  98. package/lib/infra/AssignmentCard/index.tsx +1 -1
  99. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
  100. package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
  101. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
  103. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  104. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
  105. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  106. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  107. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  108. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  109. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
  110. package/lib/infra/Containers/helpers.ts +6 -0
  111. package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
  112. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
  113. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
  114. package/lib/infra/DeferLoad/index.tsx +1 -1
  115. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
  116. package/lib/infra/MultiStep/MultiStep.css +11 -15
  117. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  118. package/lib/infra/MultiStep/index.tsx +1 -1
  119. package/lib/infra/NavBar/NavBar.css +103 -105
  120. package/lib/infra/NavBar/NavBar.tsx +28 -43
  121. package/lib/infra/Reference/Reference.tsx +16 -22
  122. package/lib/infra/Region/Region.tsx +9 -9
  123. package/lib/infra/RootContainer/RootContainer.tsx +82 -125
  124. package/lib/infra/RootContainer/index.tsx +1 -1
  125. package/lib/infra/Stages/Stages.tsx +38 -39
  126. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  127. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  128. package/lib/infra/View/View.tsx +32 -63
  129. package/lib/template/AppShell/AppShell.css +22 -23
  130. package/lib/template/AppShell/AppShell.tsx +51 -69
  131. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  132. package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
  133. package/lib/template/CaseSummary/config-ext.json +1 -2
  134. package/lib/template/CaseView/CaseView.tsx +122 -114
  135. package/lib/template/CaseView/config-ext.json +1 -2
  136. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
  137. package/lib/template/Confirmation/Confirmation.tsx +25 -53
  138. package/lib/template/Confirmation/config-ext.json +1 -2
  139. package/lib/template/DataReference/DataReference.tsx +112 -140
  140. package/lib/template/DataReference/config-ext.json +1 -2
  141. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  142. package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
  143. package/lib/template/DefaultForm/config-ext.json +1 -2
  144. package/lib/template/DefaultForm/utils/index.ts +33 -0
  145. package/lib/template/Details/Details/Details.tsx +24 -28
  146. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  147. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  148. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  149. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  151. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  152. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  153. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  154. package/lib/template/Details/DynamicTabs/config.json +36 -0
  155. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  156. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
  157. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  158. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  159. package/lib/template/ListPage/ListPage.tsx +12 -16
  160. package/lib/template/ListPage/config-ext.json +1 -2
  161. package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
  162. package/lib/template/ListView/ListView.tsx +245 -306
  163. package/lib/template/ListView/config-ext.json +1 -2
  164. package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
  165. package/lib/template/ListView/{utils.js → utils.ts} +202 -91
  166. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
  167. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  168. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  169. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  170. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  171. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  172. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  173. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  174. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  175. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  176. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  177. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  179. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  180. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  181. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  182. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  183. package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
  184. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
  185. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  186. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
  187. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
  188. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  189. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  190. package/lib/template/SubTabs/config-ext.json +1 -2
  191. package/lib/template/SubTabs/tabUtils.ts +2 -7
  192. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  193. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  194. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  195. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  196. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  197. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  198. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  199. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  200. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  201. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  202. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  203. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  204. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  205. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  206. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  207. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  208. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  209. package/lib/template/WssNavBar/WssNavBar.tsx +20 -9
  210. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  211. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  212. package/lib/widget/Attachment/Attachment.css +75 -4
  213. package/lib/widget/Attachment/Attachment.tsx +370 -388
  214. package/lib/widget/Attachment/index.tsx +1 -1
  215. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  216. package/lib/widget/CaseHistory/config-ext.json +1 -2
  217. package/lib/widget/CaseHistory/index.tsx +1 -1
  218. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  219. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  220. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
  221. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  222. package/lib/widget/Followers/Followers.tsx +27 -25
  223. package/lib/widget/Followers/config-ext.json +1 -2
  224. package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
  225. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  226. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
  227. package/lib/widget/SummaryItem/index.tsx +1 -1
  228. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  229. package/lib/widget/ToDo/ToDo.css +4 -4
  230. package/lib/widget/ToDo/ToDo.tsx +80 -116
  231. package/lib/widget/ToDo/config-ext.json +1 -2
  232. package/package.json +5 -2
  233. package/lib/helpers/auth.js +0 -483
  234. package/lib/helpers/authManager.js +0 -631
  235. package/lib/helpers/config_access.js +0 -268
  236. package/lib/helpers/formatters/Boolean.js +0 -38
  237. package/lib/helpers/formatters/CurrencyMap.js +0 -908
  238. package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
@@ -1,30 +1,52 @@
1
- import React from 'react';
1
+ import { useState, useEffect } from 'react';
2
2
  import { TextField } from '@material-ui/core';
3
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
4
3
 
5
- export default function TextInput(props) {
4
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+
8
+ interface TextInputProps extends PConnFieldProps {
9
+ // If any, enter additional props that only exist on TextInput here
10
+ fieldMetadata?: any;
11
+ }
12
+
13
+ export default function TextInput(props: TextInputProps) {
14
+ // Get emitted components from map (so we can get any override that may exist)
15
+ const FieldValueList = getComponentFromMap('FieldValueList');
16
+
6
17
  const {
18
+ getPConnect,
7
19
  label,
8
20
  required,
9
21
  disabled,
10
22
  value = '',
11
23
  validatemessage,
12
24
  status,
13
- onChange,
14
- onBlur,
25
+ /* onChange, onBlur */
15
26
  readOnly,
16
27
  testId,
17
28
  fieldMetadata,
18
29
  helperText,
19
30
  displayMode,
20
- hideLabel
31
+ hideLabel,
32
+ placeholder
21
33
  } = props;
34
+
35
+ const pConn = getPConnect();
36
+ const actions = pConn.getActionsApi();
37
+ const propName = (pConn.getStateProps() as any).value;
38
+
22
39
  const helperTextToDisplay = validatemessage || helperText;
23
40
 
41
+ const [inputValue, setInputValue] = useState('');
24
42
  const maxLength = fieldMetadata?.maxLength;
25
43
 
26
44
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
27
45
 
46
+ useEffect(() => {
47
+ setInputValue(value);
48
+ }, [value]);
49
+
28
50
  if (displayMode === 'LABELS_LEFT') {
29
51
  return <FieldValueList name={hideLabel ? '' : label} value={value} />;
30
52
  }
@@ -43,20 +65,29 @@ export default function TextInput(props) {
43
65
  'data-test-id': testId
44
66
  };
45
67
 
68
+ function handleChange(event) {
69
+ // update internal value
70
+ setInputValue(event?.target?.value);
71
+ }
72
+
73
+ function handleBlur() {
74
+ handleEvent(actions, 'changeNblur', propName, inputValue);
75
+ }
76
+
46
77
  return (
47
78
  <TextField
48
79
  fullWidth
49
80
  variant={readOnly ? 'standard' : 'outlined'}
50
81
  helperText={helperTextToDisplay}
51
- placeholder=''
82
+ placeholder={placeholder ?? ''}
52
83
  size='small'
53
84
  required={required}
54
85
  disabled={disabled}
55
- onChange={onChange}
56
- onBlur={!readOnly ? onBlur : undefined}
86
+ onChange={handleChange}
87
+ onBlur={!readOnly ? handleBlur : undefined}
57
88
  error={status === 'error'}
58
89
  label={label}
59
- value={value}
90
+ value={inputValue}
60
91
  InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}
61
92
  />
62
93
  );
@@ -4,6 +4,5 @@
4
4
  "description": "Text (single line)",
5
5
  "type": "Field",
6
6
  "subtype": "Text",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1 +1 @@
1
- export { default } from './TextInput';
1
+ export { default } from './TextInput';
@@ -1,24 +1,20 @@
1
- import React from 'react';
2
1
  import { KeyboardTimePicker } from '@material-ui/pickers';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
- import dayjs from 'dayjs';
5
2
  import AccessTimeIcon from '@material-ui/icons/AccessTime';
6
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
3
+ import dayjs from 'dayjs';
4
+
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+
8
+ interface TimeProps extends PConnFieldProps {
9
+ // If any, enter additional props that only exist on Time here
10
+ }
7
11
 
8
- export default function Time(props) {
9
- const {
10
- label,
11
- required,
12
- disabled,
13
- value,
14
- validatemessage,
15
- status,
16
- onChange,
17
- readOnly,
18
- helperText,
19
- displayMode,
20
- hideLabel
21
- } = props;
12
+ export default function Time(props: TimeProps) {
13
+ // Get emitted components from map (so we can get any override that may exist)
14
+ const FieldValueList = getComponentFromMap('FieldValueList');
15
+ const TextInput = getComponentFromMap('TextInput');
16
+
17
+ const { label, required, disabled, value = '', validatemessage, status, onChange, readOnly, helperText, displayMode, hideLabel, testId } = props;
22
18
  const helperTextToDisplay = validatemessage || helperText;
23
19
 
24
20
  if (displayMode === 'LABELS_LEFT') {
@@ -33,6 +29,12 @@ export default function Time(props) {
33
29
  return <TextInput {...props} />;
34
30
  }
35
31
 
32
+ let testProp = {};
33
+
34
+ testProp = {
35
+ 'data-test-id': testId
36
+ };
37
+
36
38
  const handleChange = date => {
37
39
  const theValue = date && date.isValid() ? date.format('HH:mm') : null;
38
40
  onChange({ value: theValue });
@@ -68,6 +70,7 @@ export default function Time(props) {
68
70
  format='hh:mm a'
69
71
  value={timeValue}
70
72
  onChange={handleChange}
73
+ InputProps={{ inputProps: { ...testProp } }}
71
74
  />
72
75
  );
73
76
  }
@@ -4,6 +4,5 @@
4
4
  "description": "Time only",
5
5
  "type": "Field",
6
6
  "subtype": "TimeOfDay",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,12 +1,20 @@
1
- import React from 'react';
2
1
  import { TextField } from '@material-ui/core';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
2
+
3
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+
6
+ interface URLComponentProps extends PConnFieldProps {
7
+ // If any, enter additional props that only exist on URLComponent here
8
+ }
5
9
 
6
10
  // NOTE: that we had to change the name from URL to URLComponent
7
11
  // Otherwise, we were getting all kinds of weird errors when we
8
12
  // referred to URL as a component.
9
- export default function URLComponent(props) {
13
+ export default function URLComponent(props: URLComponentProps) {
14
+ // Get emitted components from map (so we can get any override that may exist)
15
+ const FieldValueList = getComponentFromMap('FieldValueList');
16
+ const TextInput = getComponentFromMap('TextInput');
17
+
10
18
  const {
11
19
  label,
12
20
  required,
@@ -17,9 +25,11 @@ export default function URLComponent(props) {
17
25
  onChange,
18
26
  onBlur,
19
27
  readOnly,
28
+ testId,
20
29
  helperText,
21
30
  displayMode,
22
- hideLabel
31
+ hideLabel,
32
+ placeholder
23
33
  } = props;
24
34
  const helperTextToDisplay = validatemessage || helperText;
25
35
 
@@ -35,13 +45,19 @@ export default function URLComponent(props) {
35
45
  return <TextInput {...props} />;
36
46
  }
37
47
 
48
+ let testProp = {};
49
+
50
+ testProp = {
51
+ 'data-test-id': testId
52
+ };
53
+
38
54
  return (
39
55
  <TextField
40
56
  type='url'
41
57
  fullWidth
42
58
  variant='outlined'
43
59
  helperText={helperTextToDisplay}
44
- placeholder=''
60
+ placeholder={placeholder ?? ''}
45
61
  size='small'
46
62
  required={required}
47
63
  disabled={disabled}
@@ -50,6 +66,7 @@ export default function URLComponent(props) {
50
66
  error={status === 'error'}
51
67
  label={label}
52
68
  value={value}
69
+ InputProps={{ inputProps: { ...testProp } }}
53
70
  />
54
71
  );
55
72
  }
@@ -4,6 +4,5 @@
4
4
  "description": "URL",
5
5
  "type": "Field",
6
6
  "subtype": "Text-URL",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1 +1 @@
1
- export { default } from './URL';
1
+ export { default } from './URL';
@@ -1,31 +1,56 @@
1
- import React, { Fragment, memo, useEffect, useState } from 'react';
2
- import PropTypes from 'prop-types';
1
+ import { memo, useEffect, useState } from 'react';
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';
3
+
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+
6
7
  import { getUserId, isUserNameAvailable } from './UserReferenceUtils';
7
8
 
8
- declare const PCore: any;
9
9
  const DROPDOWN_LIST = 'Drop-down list';
10
10
  const SEARCH_BOX = 'Search box';
11
11
 
12
- const UserReference = props => {
12
+ interface UserReferenceProps extends PConnProps {
13
+ // If any, enter additional props that only exist on URLComponent here
14
+ displayAs?: string;
15
+ label?: string;
16
+ value?: any;
17
+ testId?: string;
18
+ placeholder?: string;
19
+ helperText?: string;
20
+ disabled?: boolean;
21
+ readOnly?: boolean;
22
+ required?: boolean;
23
+ validatemessage?: string;
24
+ showAsFormattedText?: boolean;
25
+ additionalProps?: object;
26
+ hideLabel?: boolean;
27
+ variant?: string;
28
+ onChange?: any;
29
+ }
30
+
31
+ const UserReference = (props: UserReferenceProps) => {
32
+ // Get emitted components from map (so we can get any override that may exist)
33
+ const AutoComplete = getComponentFromMap('AutoComplete');
34
+ const Dropdown = getComponentFromMap('Dropdown');
35
+
13
36
  const {
14
- label,
15
- displayAs,
37
+ label = '',
38
+ displayAs = '',
16
39
  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
40
+ value = '',
41
+ testId = '',
42
+ helperText = '',
43
+ validatemessage = '',
44
+ placeholder = '',
45
+ showAsFormattedText = false,
46
+ additionalProps = {},
47
+ hideLabel = false,
48
+ readOnly = false,
49
+ required = false,
50
+ disabled = false,
51
+ onChange,
52
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
53
+ variant = 'inline'
29
54
  } = props;
30
55
  const [dropDownDataSource, setDropDownDataSource] = useState([]);
31
56
  const [userName, setUserName] = useState('');
@@ -40,7 +65,7 @@ const UserReference = props => {
40
65
  // if same user ref field is referred in view as editable & readonly formatted text
41
66
  // referenced users won't be available, so get user details from dx api
42
67
  const { getOperatorDetails } = PCore.getUserApi();
43
- getOperatorDetails(userId).then(res => {
68
+ getOperatorDetails(userId).then((res: any) => {
44
69
  if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
45
70
  setUserName(res.data.pyOperatorInfo.pyUserName);
46
71
  }
@@ -50,9 +75,12 @@ const UserReference = props => {
50
75
  const queryPayload = {
51
76
  dataViewName: OPERATORS_DP
52
77
  };
78
+
53
79
  PCore.getRestClient()
80
+ // @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
81
+ // @ts-ignore - Expected 3 arguments, but got 2
54
82
  .invokeRestApi('getListData', { queryPayload })
55
- .then(res => {
83
+ .then((res: any) => {
56
84
  const ddDataSource = res.data.data.map(listItem => ({
57
85
  key: listItem.pyUserIdentifier,
58
86
  value: listItem.pyUserName
@@ -71,7 +99,7 @@ const UserReference = props => {
71
99
  if (readOnly && showAsFormattedText) {
72
100
  if (userId) {
73
101
  userReferenceComponent = (
74
- <Fragment>
102
+ <>
75
103
  {/*
76
104
  TODO: This has to be replaced with Operator Component
77
105
  */}
@@ -79,7 +107,7 @@ const UserReference = props => {
79
107
  <Typography variant='caption'>{label}</Typography>
80
108
  <Typography variant='body1'>{userName}</Typography>
81
109
  </div>
82
- </Fragment>
110
+ </>
83
111
  );
84
112
  }
85
113
  } else {
@@ -148,40 +176,6 @@ const UserReference = props => {
148
176
  return userReferenceComponent;
149
177
  };
150
178
 
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
179
  // as objects are there in props, shallow comparision fails & re-rendering of comp happens even with
186
180
  // same key value pairs in obj. hence using custom comparison function on when to re-render
187
181
  const comparisonFn = (prevProps, nextProps) => {
@@ -1,4 +1,4 @@
1
- export const getUserId = (user) => {
1
+ export const getUserId = user => {
2
2
  let userId = '';
3
3
  if (typeof user === 'object' && user !== null && user.userId) {
4
4
  userId = user.userId;
@@ -8,6 +8,6 @@ export const getUserId = (user) => {
8
8
  return userId;
9
9
  };
10
10
 
11
- export const isUserNameAvailable = (user) => {
11
+ export const isUserNameAvailable = user => {
12
12
  return typeof user === 'object' && user !== null && user.userName;
13
13
  };
@@ -3,6 +3,5 @@
3
3
  "description": "User reference",
4
4
  "type": "Field",
5
5
  "subtype": "DATA_CAPTURE",
6
- "properties": [
7
- ]
6
+ "properties": []
8
7
  }
@@ -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')) {
@@ -28,8 +28,8 @@ export const getIconFromFileType = (fileType) => {
28
28
  icon = 'document-pdf';
29
29
  } else {
30
30
  const [, subtype] = fileType.split('/');
31
- const foundMatch = (sources) => {
32
- return sources.some((key) => subtype.includes(key));
31
+ const foundMatch = sources => {
32
+ return sources.some(key => subtype.includes(key));
33
33
  };
34
34
 
35
35
  if (foundMatch(['excel', 'spreadsheet'])) {
@@ -42,22 +42,27 @@ 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
- case "FILE":
49
- icon = this.getIconFromFileType(attachment.mimeType);
48
+ case 'FILE':
49
+ icon = inThis.getIconFromFileType(attachment.mimeType);
50
50
  break;
51
- case "URL":
52
- icon = "chain";
51
+ case 'URL':
52
+ icon = 'chain';
53
53
  break;
54
54
  default:
55
- icon = "document-doc";
55
+ icon = 'document-doc';
56
56
  }
57
57
  return icon;
58
58
  };
59
59
 
60
- export const buildFilePropsFromResponse = (respObj) => {
60
+ export const buildFilePropsFromResponse = (
61
+ respObj
62
+ ): {
63
+ props: { meta: string; name: string; icon: string };
64
+ responseProps: any;
65
+ } => {
61
66
  return {
62
67
  props: {
63
68
  meta: `${respObj.pyCategoryName}, ${respObj.pxCreateOperator}`,
@@ -0,0 +1,99 @@
1
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
2
+
3
+ /**
4
+ * Function that accepts array of messages as input and group them by their type and returns the resulting object
5
+ * @param {Array} inputMessages
6
+ * Eg: [
7
+ * {message: 'First Name is required', type: 'error'},
8
+ * {message: 'Last Name is required', type: 'error'},
9
+ * {message: 'Address field should be clear and precise', type: 'info'}
10
+ * ]
11
+ *
12
+ * @returns {object}
13
+ *
14
+ * Eg: {
15
+ * error: ['First Name is required', 'Last Name is required'],
16
+ * info: ['Address field should be clear and precise']
17
+ * }
18
+ */
19
+
20
+ function getMessagesGrouped(inputMessages) {
21
+ const messages = {};
22
+
23
+ if (inputMessages && inputMessages instanceof Array && inputMessages.length > 0) {
24
+ inputMessages.forEach(item => {
25
+ const { message, type } = item;
26
+ messages[type] = [...(messages[type] || []), message];
27
+ });
28
+ }
29
+ return messages;
30
+ }
31
+
32
+ /**
33
+ * Function accepts a error type and variant of the banner
34
+ * @param {string} type
35
+ * Eg: 'error'
36
+ * @returns {string}
37
+ * Eg: 'urgent'
38
+ */
39
+ function getVariant(type) {
40
+ const { BANNER_VARIANT_SUCCESS, BANNER_VARIANT_INFO, BANNER_VARIANT_URGENT, MESSAGES } = PCore.getConstants();
41
+ const { MESSAGES_TYPE_ERROR, MESSAGES_TYPE_INFO, MESSAGES_TYPE_SUCCESS } = MESSAGES;
42
+
43
+ let variant;
44
+ switch (type) {
45
+ case MESSAGES_TYPE_ERROR:
46
+ variant = BANNER_VARIANT_URGENT;
47
+ break;
48
+ case MESSAGES_TYPE_INFO:
49
+ variant = BANNER_VARIANT_INFO;
50
+ break;
51
+ case MESSAGES_TYPE_SUCCESS:
52
+ variant = BANNER_VARIANT_SUCCESS;
53
+ break;
54
+ default:
55
+ variant = '';
56
+ }
57
+ return variant;
58
+ }
59
+
60
+ function getBanners(config) {
61
+ const AlertBanner = getComponentFromMap('AlertBanner');
62
+ const { target, pageMessages, httpMessages } = config;
63
+ const { PAGE } = PCore.getConstants();
64
+ const { clearMessages } = PCore.getMessageManager();
65
+ const banners: any = [];
66
+ const groupedPageMessages = getMessagesGrouped(pageMessages);
67
+
68
+ Object.keys(groupedPageMessages).forEach(type => {
69
+ const messagesByType = groupedPageMessages[type];
70
+ const variant = getVariant(type);
71
+ const pageMessagesBannerID = `${target}_${PAGE}_${type}`.toLowerCase().replace('/', '_');
72
+ banners.push(
73
+ <AlertBanner
74
+ id={pageMessagesBannerID}
75
+ variant={variant}
76
+ messages={messagesByType}
77
+ onDismiss={
78
+ variant === 'urgent'
79
+ ? ''
80
+ : () => {
81
+ clearMessages({
82
+ category: PAGE,
83
+ type,
84
+ context: target
85
+ } as any);
86
+ }
87
+ }
88
+ />
89
+ );
90
+ });
91
+
92
+ if (httpMessages && httpMessages.length > 0) {
93
+ banners.push(<AlertBanner id='modalViewContainerBanner' variant='urgent' messages={httpMessages} />);
94
+ }
95
+
96
+ return banners;
97
+ }
98
+
99
+ export { getMessagesGrouped, getBanners };
@@ -0,0 +1,8 @@
1
+ export function isEmptyObject(obj: Object): boolean {
2
+ return Object.keys(obj).length === 0;
3
+ }
4
+
5
+ export function isInfinity23OrHigher() {
6
+ const pCoreVersion = PCore.getPCoreVersion();
7
+ return ['8.23.0', '23.1.1'].includes(pCoreVersion);
8
+ }
@@ -1,16 +1,13 @@
1
- declare const PCore;
2
-
3
1
  // eslint-disable-next-line import/prefer-default-export
4
2
  export const getDataPage = (dataPageName, parameters, context) => {
5
3
  let dataViewParams;
6
- if(parameters){
4
+ if (parameters) {
7
5
  dataViewParams = {
8
- 'dataViewParameters': parameters
6
+ dataViewParameters: parameters
9
7
  };
10
8
  }
11
9
  return new Promise((resolve, reject) => {
12
- PCore.getDataApiUtils()
13
- .getData(dataPageName, dataViewParams, context)
10
+ (PCore.getDataApiUtils().getData(dataPageName, dataViewParams, context) as any)
14
11
  .then(response => {
15
12
  resolve(response.data.data);
16
13
  })