@pega/react-sdk-overrides 0.23.25 → 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 (240) 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.css +4 -0
  7. package/lib/designSystemExtension/Banner/Banner.tsx +33 -16
  8. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  9. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  10. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  11. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  12. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  13. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
  14. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  15. package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
  16. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  17. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  18. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  19. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +6 -2
  20. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  21. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  22. package/lib/field/AutoComplete/config-ext.json +2 -3
  23. package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
  24. package/lib/field/CancelAlert/index.tsx +1 -1
  25. package/lib/field/Checkbox/Checkbox.tsx +29 -19
  26. package/lib/field/Checkbox/config-ext.json +2 -3
  27. package/lib/field/Currency/Currency.tsx +27 -38
  28. package/lib/field/Currency/config-ext.json +2 -3
  29. package/lib/field/Currency/currency-utils.ts +10 -18
  30. package/lib/field/Date/Date.tsx +33 -15
  31. package/lib/field/Date/config-ext.json +2 -3
  32. package/lib/field/DateTime/DateTime.tsx +22 -11
  33. package/lib/field/DateTime/config-ext.json +1 -2
  34. package/lib/field/Decimal/Decimal.tsx +64 -17
  35. package/lib/field/Decimal/config-ext.json +1 -2
  36. package/lib/field/Decimal/index.tsx +1 -1
  37. package/lib/field/Dropdown/Dropdown.tsx +154 -18
  38. package/lib/field/Dropdown/config-ext.json +1 -2
  39. package/lib/field/Email/Email.tsx +16 -7
  40. package/lib/field/Email/config-ext.json +1 -2
  41. package/lib/field/Email/index.tsx +1 -1
  42. package/lib/field/Group/Group.tsx +37 -0
  43. package/lib/field/Group/config-ext.json +7 -0
  44. package/lib/field/Group/index.tsx +1 -0
  45. package/lib/field/Integer/Integer.tsx +15 -6
  46. package/lib/field/Integer/config-ext.json +1 -2
  47. package/lib/field/Percentage/Percentage.tsx +14 -6
  48. package/lib/field/Percentage/config-ext.json +1 -2
  49. package/lib/field/Phone/Phone.tsx +17 -7
  50. package/lib/field/Phone/index.tsx +1 -1
  51. package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
  52. package/lib/field/RadioButtons/config-ext.json +1 -2
  53. package/lib/field/RichText/RichText.tsx +96 -0
  54. package/lib/field/RichText/index.tsx +1 -0
  55. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  56. package/lib/field/ScalarList/config-ext.json +7 -0
  57. package/lib/field/ScalarList/index.tsx +1 -0
  58. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  59. package/lib/field/SemanticLink/config-ext.json +1 -2
  60. package/lib/field/SemanticLink/utils.ts +8 -10
  61. package/lib/field/TextArea/TextArea.tsx +15 -5
  62. package/lib/field/TextArea/config-ext.json +1 -2
  63. package/lib/field/TextContent/TextContent.tsx +9 -2
  64. package/lib/field/TextContent/config-ext.json +1 -2
  65. package/lib/field/TextInput/TextInput.tsx +41 -10
  66. package/lib/field/TextInput/config-ext.json +1 -2
  67. package/lib/field/TextInput/index.tsx +1 -1
  68. package/lib/field/Time/Time.tsx +21 -18
  69. package/lib/field/Time/config-ext.json +1 -2
  70. package/lib/field/URL/URL.tsx +23 -6
  71. package/lib/field/URL/config-ext.json +1 -2
  72. package/lib/field/URL/index.tsx +1 -1
  73. package/lib/field/UserReference/UserReference.tsx +52 -58
  74. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  75. package/lib/field/UserReference/config-ext.json +1 -2
  76. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
  77. package/lib/helpers/case-utils.tsx +99 -0
  78. package/lib/helpers/common-utils.ts +8 -0
  79. package/lib/helpers/data_page.ts +3 -6
  80. package/lib/helpers/date-format-utils.ts +29 -19
  81. package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
  82. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
  83. package/lib/helpers/formatters/Boolean.ts +21 -0
  84. package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
  85. package/lib/helpers/formatters/CurrencyMap.ts +915 -0
  86. package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
  87. package/lib/helpers/formatters/{common.js → common.ts} +3 -4
  88. package/lib/helpers/formatters/{index.js → index.ts} +22 -22
  89. package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
  90. package/lib/helpers/simpleTableHelpers.ts +65 -85
  91. package/lib/helpers/state-utils.tsx +43 -0
  92. package/lib/helpers/template-utils.ts +4 -8
  93. package/lib/helpers/utils.ts +16 -8
  94. package/lib/helpers/versionHelpers.ts +1 -5
  95. package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
  96. package/lib/infra/ActionButtons/index.tsx +1 -1
  97. package/lib/infra/Assignment/Assignment.tsx +99 -84
  98. package/lib/infra/Assignment/index.tsx +1 -1
  99. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  100. package/lib/infra/AssignmentCard/index.tsx +1 -1
  101. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
  102. package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
  103. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  104. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
  105. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  106. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
  107. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  108. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  109. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  110. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  111. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
  112. package/lib/infra/Containers/helpers.ts +6 -0
  113. package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
  114. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
  115. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
  116. package/lib/infra/DeferLoad/index.tsx +1 -1
  117. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
  118. package/lib/infra/MultiStep/MultiStep.css +11 -15
  119. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  120. package/lib/infra/MultiStep/index.tsx +1 -1
  121. package/lib/infra/NavBar/NavBar.css +103 -105
  122. package/lib/infra/NavBar/NavBar.tsx +28 -43
  123. package/lib/infra/Reference/Reference.tsx +16 -22
  124. package/lib/infra/Region/Region.tsx +9 -9
  125. package/lib/infra/RootContainer/RootContainer.tsx +82 -125
  126. package/lib/infra/RootContainer/index.tsx +1 -1
  127. package/lib/infra/Stages/Stages.tsx +38 -39
  128. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  129. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  130. package/lib/infra/View/View.tsx +34 -65
  131. package/lib/template/AppShell/AppShell.css +22 -23
  132. package/lib/template/AppShell/AppShell.tsx +51 -69
  133. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  134. package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
  135. package/lib/template/CaseSummary/config-ext.json +1 -2
  136. package/lib/template/CaseView/CaseView.tsx +122 -114
  137. package/lib/template/CaseView/config-ext.json +1 -2
  138. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
  139. package/lib/template/Confirmation/Confirmation.tsx +25 -53
  140. package/lib/template/Confirmation/config-ext.json +1 -2
  141. package/lib/template/DataReference/DataReference.tsx +112 -140
  142. package/lib/template/DataReference/config-ext.json +1 -2
  143. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  144. package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
  145. package/lib/template/DefaultForm/config-ext.json +1 -2
  146. package/lib/template/DefaultForm/utils/index.ts +33 -0
  147. package/lib/template/Details/Details/Details.tsx +24 -28
  148. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  149. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  151. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  152. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  153. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  154. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  155. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  156. package/lib/template/Details/DynamicTabs/config.json +36 -0
  157. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  158. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
  159. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  160. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  161. package/lib/template/ListPage/ListPage.tsx +12 -16
  162. package/lib/template/ListPage/config-ext.json +1 -2
  163. package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
  164. package/lib/template/ListView/ListView.tsx +245 -306
  165. package/lib/template/ListView/config-ext.json +1 -2
  166. package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
  167. package/lib/template/ListView/{utils.js → utils.ts} +202 -91
  168. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
  169. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  170. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  171. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  172. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  173. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  174. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  175. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  176. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  177. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  179. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  180. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  181. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  182. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  183. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  184. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  185. package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
  186. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
  187. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  188. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
  189. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
  190. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  191. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  192. package/lib/template/SubTabs/config-ext.json +1 -2
  193. package/lib/template/SubTabs/tabUtils.ts +2 -7
  194. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  195. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  196. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  197. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  198. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  199. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  200. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  201. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  202. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  203. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  204. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  205. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  206. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  207. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  208. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  209. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  210. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  211. package/lib/template/WssNavBar/WssNavBar.tsx +33 -17
  212. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  213. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  214. package/lib/widget/Attachment/Attachment.css +75 -4
  215. package/lib/widget/Attachment/Attachment.tsx +370 -388
  216. package/lib/widget/Attachment/index.tsx +1 -1
  217. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  218. package/lib/widget/CaseHistory/config-ext.json +1 -2
  219. package/lib/widget/CaseHistory/index.tsx +1 -1
  220. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  221. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  222. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
  223. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  224. package/lib/widget/Followers/Followers.tsx +27 -25
  225. package/lib/widget/Followers/config-ext.json +1 -2
  226. package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
  227. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  228. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
  229. package/lib/widget/SummaryItem/index.tsx +1 -1
  230. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  231. package/lib/widget/ToDo/ToDo.css +4 -4
  232. package/lib/widget/ToDo/ToDo.tsx +80 -116
  233. package/lib/widget/ToDo/config-ext.json +1 -2
  234. package/package.json +5 -2
  235. package/lib/helpers/auth.js +0 -483
  236. package/lib/helpers/authManager.js +0 -631
  237. package/lib/helpers/config_access.js +0 -268
  238. package/lib/helpers/formatters/Boolean.js +0 -38
  239. package/lib/helpers/formatters/CurrencyMap.js +0 -908
  240. package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
@@ -0,0 +1,122 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Editor } from '@tinymce/tinymce-react';
3
+ import { FormControl, FormHelperText, InputLabel, makeStyles } from '@material-ui/core';
4
+
5
+ import { useAfterInitialEffect, useConsolidatedRef, useUID } from '@pega/react-sdk-components/lib/hooks';
6
+
7
+ const useStyles = makeStyles(theme => ({
8
+ fieldLabel: {
9
+ position: 'relative',
10
+ transform: 'translate(0, 0px) scale(1)',
11
+ marginBottom: '5px',
12
+ color: theme.palette.text.secondary
13
+ }
14
+ }));
15
+
16
+ interface RichTextEditorProps {
17
+ id?: string;
18
+ defaultValue: string;
19
+ label: string;
20
+ labelHidden: boolean;
21
+ info: string;
22
+ testId: string;
23
+ placeholder: string;
24
+ disabled: boolean;
25
+ required: boolean;
26
+ readOnly: boolean;
27
+ error: boolean;
28
+ onBlur: React.EventHandler<any>;
29
+ onChange: React.EventHandler<any>;
30
+ }
31
+
32
+ const RichTextEditor = forwardRef(function RichTextEditor(props: RichTextEditorProps, ref) {
33
+ const classes = useStyles();
34
+ const uid = useUID();
35
+ const { id = uid, defaultValue, label, labelHidden, info, testId, placeholder, disabled, required, readOnly, error, onBlur, onChange } = props;
36
+
37
+ const editorRef: any = useConsolidatedRef(ref);
38
+ let richTextComponent: any = null;
39
+
40
+ useAfterInitialEffect(() => {
41
+ editorRef?.current.mode.set(readOnly || disabled ? 'readonly' : 'design');
42
+ }, [readOnly, disabled]);
43
+
44
+ const filePickerCallback = cb => {
45
+ const input = document.createElement('input');
46
+ input.setAttribute('type', 'file');
47
+ input.setAttribute('accept', 'image/*');
48
+
49
+ input.addEventListener('change', (e: any) => {
50
+ const file = e.target.files[0];
51
+
52
+ const reader: any = new FileReader();
53
+ reader.addEventListener('load', () => {
54
+ /*
55
+ Note: Now we need to register the blob in TinyMCEs image blob
56
+ registry. In the next release this part hopefully won't be
57
+ necessary, as we are looking to handle it internally.
58
+ */
59
+ const blobId = `blobid${new Date().getTime()}`;
60
+ const blobCache = editorRef.current.editorUpload.blobCache;
61
+ const base64 = reader.result.split(',')[1];
62
+ const blobInfo = blobCache.create(blobId, file, base64);
63
+ blobCache.add(blobInfo);
64
+
65
+ /* call the callback and populate the Title field with the file name */
66
+ cb(blobInfo.blobUri(), { title: file.name });
67
+ });
68
+ reader.readAsDataURL(file);
69
+ });
70
+
71
+ input.click();
72
+ };
73
+
74
+ if (readOnly) {
75
+ const value = defaultValue || '--';
76
+ // eslint-disable-next-line react/no-danger
77
+ richTextComponent = <div key={id} id={id} className='readonly-richtext-editor' dangerouslySetInnerHTML={{ __html: value }} />;
78
+ } else {
79
+ richTextComponent = (
80
+ <Editor
81
+ tinymceScriptSrc='tinymce/tinymce.min.js'
82
+ onInit={(_evt, editor) => {
83
+ editorRef.current = editor;
84
+ }}
85
+ id={id}
86
+ initialValue={defaultValue}
87
+ disabled={disabled}
88
+ init={{
89
+ placeholder,
90
+ menubar: false,
91
+ statusbar: false,
92
+ min_height: 130,
93
+ plugins: ['lists', 'advlist', 'autolink', 'image', 'link', 'autoresize'],
94
+ autoresize_bottom_margin: 0,
95
+ toolbar: disabled ? false : 'blocks | bold italic strikethrough | bullist numlist outdent indent | link image',
96
+ toolbar_location: 'bottom',
97
+ content_style: 'body { font-family:Helvetica, Arial,sans-serif; font-size:14px }',
98
+ branding: false,
99
+ paste_data_images: true,
100
+ file_picker_types: 'image',
101
+ file_picker_callback: filePickerCallback
102
+ }}
103
+ onBlur={onBlur}
104
+ onEditorChange={onChange}
105
+ />
106
+ );
107
+ }
108
+
109
+ return (
110
+ <FormControl data-test-id={testId} error={error} required={required}>
111
+ {!labelHidden && (
112
+ <InputLabel id='demo-simple-select-error-label' className={classes.fieldLabel}>
113
+ {label}
114
+ </InputLabel>
115
+ )}
116
+ {richTextComponent}
117
+ {info && <FormHelperText>{info}</FormHelperText>}
118
+ </FormControl>
119
+ );
120
+ });
121
+
122
+ export default RichTextEditor;
@@ -0,0 +1 @@
1
+ export { default } from './RichTextEditor';
@@ -1,7 +1,7 @@
1
1
  .quick-link-ul-list {
2
2
  list-style: none;
3
3
  padding: 0;
4
- grid-template-columns: repeat(3, 1fr);
4
+ grid-template-columns: repeat(auto-fill, minmax(min(40ch, 100%), 1fr));
5
5
  display: grid;
6
6
  gap: calc(1rem);
7
7
  }
@@ -33,4 +33,8 @@
33
33
  display: flex;
34
34
  align-items: center;
35
35
  gap: 0.5rem;
36
- }
36
+ }
37
+
38
+ .quick-link-heading {
39
+ margin-top: 8px;
40
+ }
@@ -1,25 +1,34 @@
1
- import React from 'react';
2
1
  import { Button } from '@material-ui/core';
3
2
  import './WssQuickCreate.css';
4
3
 
5
- export default function WssQuickCreate(props) {
4
+ // WssQuickCreate is one of the few components that does NOT have getPConnect.
5
+ // So, no need to extend PConnProps
6
+ interface WssQuickCreateProps {
7
+ // If any, enter additional props that only exist on this component
8
+ heading: string;
9
+ actions?: any[];
10
+ }
11
+
12
+ export default function WssQuickCreate(props: WssQuickCreateProps) {
6
13
  const { heading, actions } = props;
7
14
 
8
15
  return (
9
16
  <div>
10
- <h1>{heading}</h1>
11
- <ul className='quick-link-ul-list'>
17
+ <h1 id='quick-links-heading' className='quick-link-heading'>
18
+ {heading}
19
+ </h1>
20
+ <ul id='quick-links' className='quick-link-ul-list'>
12
21
  {actions &&
13
22
  actions.map(element => {
14
23
  return (
15
- <li className='quick-link-list' key={element.label}>
16
- <Button className='quick-link-button' onClick={element.onClick}>
17
- <span className='quick-link-button-span'>
18
- {element.icon && <img className='quick-link-icon' src={element.icon}/>}
19
- <span>{element.label}</span>
20
- </span>
21
- </Button>
22
- </li>
24
+ <li className='quick-link-list' key={element.label}>
25
+ <Button className='quick-link-button' onClick={element.onClick}>
26
+ <span className='quick-link-button-span'>
27
+ {element.icon && <img className='quick-link-icon' src={element.icon} />}
28
+ <span>{element.label}</span>
29
+ </span>
30
+ </Button>
31
+ </li>
23
32
  );
24
33
  })}
25
34
  </ul>
@@ -1,12 +1,13 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import { 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
+
6
+ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
7
7
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
8
8
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
9
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
9
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
10
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
11
 
11
12
  interface IOption {
12
13
  key: string;
@@ -36,7 +37,25 @@ const getDisplayFieldsMetaData = columnList => {
36
37
  return metaDataObj;
37
38
  };
38
39
 
39
- export default function AutoComplete(props) {
40
+ interface AutoCompleteProps extends PConnFieldProps {
41
+ // If any, enter additional props that only exist on AutoComplete here'
42
+ displayMode?: string;
43
+ deferDatasource?: boolean;
44
+ datasourceMetadata?: any;
45
+ status?: string;
46
+ onRecordChange?: any;
47
+ additionalProps?: object;
48
+ listType: string;
49
+ parameters?: any;
50
+ datasource: any;
51
+ columns: any[];
52
+ }
53
+
54
+ export default function AutoComplete(props: AutoCompleteProps) {
55
+ // Get emitted components from map (so we can get any override that may exist)
56
+ const TextInput = getComponentFromMap('TextInput');
57
+ const FieldValueList = getComponentFromMap('FieldValueList');
58
+
40
59
  const {
41
60
  getPConnect,
42
61
  label,
@@ -54,17 +73,18 @@ export default function AutoComplete(props) {
54
73
  hideLabel,
55
74
  onRecordChange
56
75
  } = props;
76
+
57
77
  const context = getPConnect().getContextName();
58
78
  let { listType, parameters, datasource = [], columns = [] } = props;
59
79
  const [inputValue, setInputValue] = useState('');
60
- const [options, setOptions] = useState<Array<IOption>>([]);
80
+ const [options, setOptions] = useState<IOption[]>([]);
61
81
  const [theDatasource, setDatasource] = useState(null);
62
82
  let selectedValue: any = '';
63
83
  const helperTextToDisplay = validatemessage || helperText;
64
84
 
65
85
  const thePConn = getPConnect();
66
86
  const actionsApi = thePConn.getActionsApi();
67
- const propName = thePConn.getStateProps().value;
87
+ const propName = (thePConn.getStateProps() as any).value;
68
88
 
69
89
  if (!isDeepEqual(datasource, theDatasource)) {
70
90
  // inbound datasource is different, so update theDatasource (to trigger useEffect)
@@ -86,13 +106,10 @@ export default function AutoComplete(props) {
86
106
  if (deferDatasource && datasourceMetadata?.datasource?.name) {
87
107
  listType = 'datapage';
88
108
  datasource = datasourceMetadata.datasource.name;
89
- parameters = flattenParameters(datasourceMetadata?.datasource?.parameters);
90
- const displayProp = datasourceMetadata.datasource.propertyForDisplayText.startsWith('@P')
91
- ? datasourceMetadata.datasource.propertyForDisplayText.substring(3)
92
- : datasourceMetadata.datasource.propertyForDisplayText;
93
- const valueProp = datasourceMetadata.datasource.propertyForValue.startsWith('@P')
94
- ? datasourceMetadata.datasource.propertyForValue.substring(3)
95
- : datasourceMetadata.datasource.propertyForValue;
109
+ const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;
110
+ parameters = flattenParameters(dataSourceParameters);
111
+ const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;
112
+ const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;
96
113
  columns = [
97
114
  {
98
115
  key: 'true',
@@ -111,14 +128,14 @@ export default function AutoComplete(props) {
111
128
 
112
129
  useEffect(() => {
113
130
  if (listType === 'associated') {
114
- setOptions(Utils.getOptionList(props, getPConnect().getDataObject()));
131
+ setOptions(Utils.getOptionList(props, getPConnect().getDataObject('')));
115
132
  }
116
133
  }, [theDatasource]);
117
134
 
118
135
  useEffect(() => {
119
136
  if (!displayMode && listType !== 'associated') {
120
137
  getDataPage(datasource, parameters, context).then((results: any) => {
121
- const optionsData: Array<any> = [];
138
+ const optionsData: any[] = [];
122
139
  const displayColumn = getDisplayFieldsMetaData(columns);
123
140
  results?.forEach(element => {
124
141
  const val = element[displayColumn.primary]?.toString();
@@ -4,8 +4,7 @@
4
4
  "description": "Picklist",
5
5
  "type": "Field",
6
6
  "subtype": "Picklist",
7
- "componentKey" : "AutoComplete",
7
+ "componentKey": "AutoComplete",
8
8
  "icon": "",
9
- "properties": [
10
- ]
9
+ "properties": []
11
10
  }
@@ -2,11 +2,16 @@ 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
 
5
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
6
  import './CancelAlert.css';
6
7
 
7
- declare const PCore;
8
+ interface CancelAlertProps extends PConnFieldProps {
9
+ // If any, enter additional props that only exist on CancelAlert here
10
+ pConn: any;
11
+ updateAlertState: any;
12
+ }
8
13
 
9
- const CancelAlert = props => {
14
+ export default function CancelAlert(props: CancelAlertProps) {
10
15
  const { pConn, updateAlertState } = props;
11
16
  const [showSnackbar, setShowSnackbar] = useState(false);
12
17
  const [snackbarMessage, setSnackbarMessage] = useState('');
@@ -15,6 +20,8 @@ const CancelAlert = props => {
15
20
  const caseInfo = pConn.getCaseInfo();
16
21
  const caseName = caseInfo.getName();
17
22
  const ID = caseInfo.getID();
23
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
24
+ const localeCategory = 'ModalContainer';
18
25
 
19
26
  function showToast(message: string) {
20
27
  setSnackbarMessage(message);
@@ -48,12 +55,11 @@ const CancelAlert = props => {
48
55
  .then(() => {
49
56
  dismissModal();
50
57
 
51
- PCore.getPubSubUtils().publish(
52
- PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED
53
- );
58
+ // @ts-ignore - second parameter “payload” for publish method should be optional
59
+ PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED);
54
60
  })
55
61
  .catch(() => {
56
- showToast('Save failed');
62
+ showToast(localizedVal('Save failed', localeCategory));
57
63
  });
58
64
  break;
59
65
 
@@ -68,10 +74,12 @@ const CancelAlert = props => {
68
74
  deletePromise
69
75
  .then(() => {
70
76
  dismissModal();
77
+
78
+ // @ts-ignore - second parameter “payload” for publish method should be optional
71
79
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
72
80
  })
73
81
  .catch(() => {
74
- showToast('Delete failed.');
82
+ showToast(localizedVal('Delete failed.', localeCategory));
75
83
  });
76
84
  break;
77
85
 
@@ -86,22 +94,22 @@ const CancelAlert = props => {
86
94
  <div className='cancel-alert-top'>
87
95
  <h3>{`Delete ${caseName}(${ID})`}</h3>
88
96
  <div>
89
- <p>{`Are you sure you want to delete ${caseName} (${ID})?`}</p>
90
- <p>Alternatively, you can continue working or save your work for later.</p>
97
+ <p>{`${localizedVal('Are you sure you want to delete', localeCategory)} ${caseName} (${ID})?`}</p>
98
+ <p>{localizedVal('Alternatively, you can continue working or save your work for later.', localeCategory)}</p>
91
99
  </div>
92
100
  <div className='action-controls'>
93
101
  <Grid container spacing={4} justifyContent='space-between'>
94
102
  <Grid item>
95
103
  <Button variant='outlined' color='primary' onClick={() => buttonClick('save')}>
96
- Save for later
104
+ {localizedVal('Save for later', localeCategory)}
97
105
  </Button>
98
106
  </Grid>
99
107
  <Grid item>
100
108
  <Button variant='outlined' color='primary' onClick={() => buttonClick('continue')}>
101
- Continue Working
109
+ {localizedVal('Continue Working', localeCategory)}
102
110
  </Button>
103
111
  <Button variant='contained' color='primary' onClick={() => buttonClick('delete')}>
104
- Delete
112
+ {localizedVal('Delete', localeCategory)}
105
113
  </Button>
106
114
  </Grid>
107
115
  </Grid>
@@ -121,6 +129,4 @@ const CancelAlert = props => {
121
129
  />
122
130
  </>
123
131
  );
124
- };
125
-
126
- export default CancelAlert;
132
+ }
@@ -1 +1 @@
1
- export { default } from './CancelAlert';
1
+ export { default } from './CancelAlert';
@@ -1,35 +1,45 @@
1
- import React, { useState, useEffect } from 'react';
2
- import {
3
- Checkbox,
4
- FormControl,
5
- FormControlLabel,
6
- FormGroup,
7
- FormHelperText
8
- } from '@material-ui/core';
1
+ import { useState, useEffect } from 'react';
2
+ import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText } from '@material-ui/core';
3
+
9
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
10
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
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 CheckboxProps extends Omit<PConnFieldProps, 'value'> {
9
+ // If any, enter additional props that only exist on Checkbox here
10
+ value?: boolean;
11
+ // eslint-disable-next-line react/no-unused-prop-types
12
+ caption?: string;
13
+ trueLabel?: string;
14
+ falseLabel?: string;
15
+ }
16
+
17
+ export default function CheckboxComponent(props: CheckboxProps) {
18
+ // Get emitted components from map (so we can get any override that may exist)
19
+ const FieldValueList = getComponentFromMap('FieldValueList');
11
20
 
12
- export default function CheckboxComponent(props) {
13
21
  const {
14
22
  getPConnect,
15
- label,
16
23
  value = false,
17
24
  readOnly,
18
25
  testId,
19
26
  required,
27
+ disabled,
20
28
  status,
21
29
  helperText,
22
30
  validatemessage,
23
31
  displayMode,
24
- hideLabel
32
+ hideLabel,
33
+ trueLabel,
34
+ falseLabel
25
35
  } = props;
26
36
  const helperTextToDisplay = validatemessage || helperText;
27
37
 
28
38
  const thePConn = getPConnect();
29
- const theConfigProps = thePConn.getConfigProps();
30
- const { caption } = theConfigProps;
39
+ const theConfigProps = thePConn.getConfigProps() as CheckboxProps;
40
+ const caption = theConfigProps.caption;
31
41
  const actionsApi = thePConn.getActionsApi();
32
- const propName = thePConn.getStateProps().value;
42
+ const propName = (thePConn.getStateProps() as any).value;
33
43
 
34
44
  const [checked, setChecked] = useState(false);
35
45
  useEffect(() => {
@@ -38,11 +48,11 @@ export default function CheckboxComponent(props) {
38
48
  }, [value]);
39
49
 
40
50
  if (displayMode === 'LABELS_LEFT') {
41
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
51
+ return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} />;
42
52
  }
43
53
 
44
54
  if (displayMode === 'STACKED_LARGE_VAL') {
45
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
55
+ return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} variant='stacked' />;
46
56
  }
47
57
 
48
58
  const handleChange = event => {
@@ -53,12 +63,12 @@ export default function CheckboxComponent(props) {
53
63
  thePConn.getValidationApi().validate(event.target.checked);
54
64
  };
55
65
 
56
- let theCheckbox = <Checkbox color='primary' />;
66
+ let theCheckbox = <Checkbox color='primary' disabled={disabled} />;
57
67
 
58
68
  if (readOnly) {
59
69
  // Workaround for lack of InputProps readOnly from https://github.com/mui-org/material-ui/issues/17043
60
70
  // Also note that we need to turn off the onChange call in the FormControlLabel wrapper, too. See below!
61
- theCheckbox = <Checkbox value={value || false} onChange={handleChange} readOnly={readOnly} />;
71
+ theCheckbox = <Checkbox value={value || false} readOnly={readOnly} />;
62
72
  }
63
73
 
64
74
  return (
@@ -4,7 +4,6 @@
4
4
  "description": "Boolean",
5
5
  "type": "Field",
6
6
  "subtype": "Boolean",
7
- "componentKey" : "Checkbox",
8
- "properties": [
9
- ]
7
+ "componentKey": "Checkbox",
8
+ "properties": []
10
9
  }
@@ -1,14 +1,24 @@
1
- import React, { useState, useEffect } from 'react';
2
- // import { TextField } from "@material-ui/core";
1
+ import { useState, useEffect } from 'react';
3
2
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
+
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
6
- import { format } from "@pega/react-sdk-components/lib/components/helpers/formatters";
5
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+
7
9
  import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
8
10
 
9
11
  // Using control from: https://github.com/unicef/material-ui-currency-textfield
10
12
 
11
- export default function Currency(props) {
13
+ interface CurrrencyProps extends PConnFieldProps {
14
+ // If any, enter additional props that only exist on Currency here
15
+ currencyISOCode?: string;
16
+ }
17
+
18
+ export default function Currency(props: CurrrencyProps) {
19
+ // Get emitted components from map (so we can get any override that may exist)
20
+ const FieldValueList = getComponentFromMap('FieldValueList');
21
+
12
22
  const {
13
23
  getPConnect,
14
24
  label,
@@ -23,32 +33,24 @@ export default function Currency(props) {
23
33
  helperText,
24
34
  displayMode,
25
35
  hideLabel,
26
- currencyISOCode = "USD"
36
+ currencyISOCode = 'USD',
37
+ placeholder
27
38
  } = props;
28
39
 
29
40
  const pConn = getPConnect();
30
41
  const actions = pConn.getActionsApi();
31
- const propName = pConn.getStateProps().value;
42
+ const propName = (pConn.getStateProps() as any).value;
32
43
  const helperTextToDisplay = validatemessage || helperText;
33
44
 
34
45
  // console.log(`Currency: label: ${label} value: ${value}`);
35
46
 
36
- let readOnlyProp = {}; // Note: empty if NOT ReadOnly
37
-
38
- if (readOnly) {
39
- readOnlyProp = { readOnly: true };
40
- }
41
-
42
- let testProp = {};
43
-
44
- testProp = {
47
+ const testProp = {
45
48
  'data-test-id': testId
46
49
  };
47
50
 
48
- const [currValue, setCurrValue] = useState();
49
- const [theCurrSym, setCurrSym] = useState("$");
50
- const [theCurrDec, setCurrDec] = useState(".");
51
- const [theCurrSep, setCurrSep] = useState(",");
51
+ const [theCurrSym, setCurrSym] = useState('$');
52
+ const [theCurrDec, setCurrDec] = useState('.');
53
+ const [theCurrSep, setCurrSep] = useState(',');
52
54
 
53
55
  useEffect(() => {
54
56
  // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
@@ -58,11 +60,6 @@ export default function Currency(props) {
58
60
  setCurrSep(theSymbols.theDigitGroupSeparator);
59
61
  }, [currencyISOCode]);
60
62
 
61
- useEffect(() => {
62
- // const testVal = value;
63
- setCurrValue(value.toString());
64
- }, [value]);
65
-
66
63
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
67
64
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
68
65
 
@@ -74,14 +71,6 @@ export default function Currency(props) {
74
71
  return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
75
72
  }
76
73
 
77
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
78
- function currOnChange(event, inValue) {
79
- // console.log(`Currency currOnChange inValue: ${inValue}`);
80
-
81
- // update internal value
82
- setCurrValue(event?.target?.value);
83
- }
84
-
85
74
  function currOnBlur(event, inValue) {
86
75
  // console.log(`Currency currOnBlur inValue: ${inValue}`);
87
76
  handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
@@ -94,22 +83,22 @@ export default function Currency(props) {
94
83
  fullWidth
95
84
  variant={readOnly ? 'standard' : 'outlined'}
96
85
  helperText={helperTextToDisplay}
97
- placeholder=''
86
+ placeholder={placeholder ?? ''}
98
87
  size='small'
99
88
  required={required}
100
89
  disabled={disabled}
101
- onChange={currOnChange}
102
- onBlur={!readOnly ? currOnBlur : undefined}
90
+ readOnly={!!readOnly}
103
91
  error={status === 'error'}
104
92
  label={label}
105
- value={currValue}
93
+ value={value}
106
94
  type='text'
107
95
  outputFormat='number'
108
96
  textAlign='left'
109
- InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: currValue } }}
97
+ InputProps={{ inputProps: { ...testProp } }}
110
98
  currencySymbol={theCurrSym}
111
99
  decimalCharacter={theCurrDec}
112
100
  digitGroupSeparator={theCurrSep}
101
+ onBlur={!readOnly ? currOnBlur : undefined}
113
102
  />
114
103
  );
115
104
  }
@@ -4,7 +4,6 @@
4
4
  "description": "Currency",
5
5
  "type": "Field",
6
6
  "subtype": "Decimal-Currency",
7
- "componentKey" : "Currency",
8
- "properties": [
9
- ]
7
+ "componentKey": "Currency",
8
+ "properties": []
10
9
  }