@pega/react-sdk-overrides 0.23.6

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 (220) hide show
  1. package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.css +19 -0
  2. package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.tsx +156 -0
  3. package/lib/designSystemExtensions/CaseSummaryFields/index.tsx +1 -0
  4. package/lib/designSystemExtensions/DetailsFields/DetailsFields.tsx +154 -0
  5. package/lib/designSystemExtensions/DetailsFields/index.tsx +1 -0
  6. package/lib/designSystemExtensions/FieldGroup/FieldGroup.tsx +113 -0
  7. package/lib/designSystemExtensions/FieldGroup/index.tsx +1 -0
  8. package/lib/designSystemExtensions/FieldGroupList/FieldGroupList.tsx +53 -0
  9. package/lib/designSystemExtensions/FieldGroupList/index.tsx +1 -0
  10. package/lib/designSystemExtensions/FieldValueList/FieldValueList.tsx +106 -0
  11. package/lib/designSystemExtensions/FieldValueList/index.tsx +1 -0
  12. package/lib/designSystemExtensions/Operator/Operator.tsx +195 -0
  13. package/lib/designSystemExtensions/Operator/index.tsx +1 -0
  14. package/lib/designSystemExtensions/Pulse/Pulse.tsx +31 -0
  15. package/lib/designSystemExtensions/Pulse/index.tsx +1 -0
  16. package/lib/forms/AutoComplete/AutoComplete.tsx +183 -0
  17. package/lib/forms/AutoComplete/index.tsx +1 -0
  18. package/lib/forms/CancelAlert/CancelAlert.css +24 -0
  19. package/lib/forms/CancelAlert/CancelAlert.tsx +126 -0
  20. package/lib/forms/CancelAlert/index.tsx +1 -0
  21. package/lib/forms/Checkbox/Checkbox.tsx +68 -0
  22. package/lib/forms/Checkbox/index.tsx +1 -0
  23. package/lib/forms/Currency/Currency.tsx +89 -0
  24. package/lib/forms/Currency/index.tsx +1 -0
  25. package/lib/forms/Date/Date.tsx +79 -0
  26. package/lib/forms/Date/index.tsx +1 -0
  27. package/lib/forms/DateTime/DateTime.tsx +75 -0
  28. package/lib/forms/DateTime/index.tsx +1 -0
  29. package/lib/forms/Decimal/Decimal.tsx +51 -0
  30. package/lib/forms/Decimal/index.tsx +1 -0
  31. package/lib/forms/Dropdown/Dropdown.tsx +82 -0
  32. package/lib/forms/Dropdown/index.tsx +1 -0
  33. package/lib/forms/Email/Email.tsx +68 -0
  34. package/lib/forms/Email/index.tsx +1 -0
  35. package/lib/forms/Integer/Integer.tsx +77 -0
  36. package/lib/forms/Integer/index.tsx +1 -0
  37. package/lib/forms/Percentage/Percentage.tsx +82 -0
  38. package/lib/forms/Percentage/index.tsx +1 -0
  39. package/lib/forms/Phone/Phone.tsx +90 -0
  40. package/lib/forms/Phone/index.tsx +1 -0
  41. package/lib/forms/RadioButtons/RadioButtons.tsx +73 -0
  42. package/lib/forms/RadioButtons/index.tsx +1 -0
  43. package/lib/forms/SemanticLink/SemanticLink.tsx +69 -0
  44. package/lib/forms/SemanticLink/index.tsx +1 -0
  45. package/lib/forms/SemanticLink/utils.ts +51 -0
  46. package/lib/forms/TextArea/TextArea.tsx +66 -0
  47. package/lib/forms/TextArea/index.tsx +1 -0
  48. package/lib/forms/TextContent/TextContent.tsx +40 -0
  49. package/lib/forms/TextContent/index.tsx +1 -0
  50. package/lib/forms/TextInput/TextInput.tsx +61 -0
  51. package/lib/forms/TextInput/index.tsx +1 -0
  52. package/lib/forms/Time/Time.tsx +71 -0
  53. package/lib/forms/Time/index.tsx +1 -0
  54. package/lib/forms/URL/URL.tsx +53 -0
  55. package/lib/forms/URL/index.tsx +1 -0
  56. package/lib/forms/UserReference/UserReference.tsx +197 -0
  57. package/lib/forms/UserReference/UserReferenceUtils.ts +13 -0
  58. package/lib/forms/UserReference/index.tsx +1 -0
  59. package/lib/helpers/auth.js +483 -0
  60. package/lib/helpers/authManager.js +630 -0
  61. package/lib/helpers/config_access.js +268 -0
  62. package/lib/helpers/data_page.ts +24 -0
  63. package/lib/helpers/event-utils.js +20 -0
  64. package/lib/helpers/field-group-utils.js +61 -0
  65. package/lib/helpers/formatters/Boolean.js +38 -0
  66. package/lib/helpers/formatters/Currency.js +74 -0
  67. package/lib/helpers/formatters/CurrencyMap.js +908 -0
  68. package/lib/helpers/formatters/Date.js +77 -0
  69. package/lib/helpers/formatters/common.js +10 -0
  70. package/lib/helpers/formatters/index.js +120 -0
  71. package/lib/helpers/utils.ts +334 -0
  72. package/lib/helpers/versionHelpers.ts +50 -0
  73. package/lib/infra/ActionButtons/ActionButtons.tsx +70 -0
  74. package/lib/infra/ActionButtons/index.tsx +1 -0
  75. package/lib/infra/Assignment/Assignment.tsx +301 -0
  76. package/lib/infra/Assignment/index.tsx +1 -0
  77. package/lib/infra/AssignmentCard/AssignmentCard.tsx +47 -0
  78. package/lib/infra/AssignmentCard/index.tsx +1 -0
  79. package/lib/infra/Attachment/Attachment.css +18 -0
  80. package/lib/infra/Attachment/Attachment.tsx +404 -0
  81. package/lib/infra/Attachment/AttachmentUtils.js +71 -0
  82. package/lib/infra/Attachment/index.tsx +1 -0
  83. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +511 -0
  84. package/lib/infra/Containers/FlowContainer/helpers.js +147 -0
  85. package/lib/infra/Containers/FlowContainer/index.tsx +1 -0
  86. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +320 -0
  87. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -0
  88. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +216 -0
  89. package/lib/infra/Containers/ViewContainer/index.tsx +1 -0
  90. package/lib/infra/DashboardFilter/DashboardFilter.tsx +180 -0
  91. package/lib/infra/DashboardFilter/filterUtils.tsx +188 -0
  92. package/lib/infra/DashboardFilter/index.tsx +1 -0
  93. package/lib/infra/DeferLoad/DeferLoad.tsx +175 -0
  94. package/lib/infra/DeferLoad/index.tsx +1 -0
  95. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +103 -0
  96. package/lib/infra/ErrorBoundary/index.tsx +1 -0
  97. package/lib/infra/MultiStep/MultiStep.css +261 -0
  98. package/lib/infra/MultiStep/MultiStep.tsx +225 -0
  99. package/lib/infra/MultiStep/index.tsx +1 -0
  100. package/lib/infra/NavBar/NavBar.css +170 -0
  101. package/lib/infra/NavBar/NavBar.tsx +393 -0
  102. package/lib/infra/NavBar/index.tsx +1 -0
  103. package/lib/infra/Reference/Reference.tsx +58 -0
  104. package/lib/infra/Reference/index.tsx +1 -0
  105. package/lib/infra/Region/Region.tsx +17 -0
  106. package/lib/infra/Region/index.tsx +1 -0
  107. package/lib/infra/RootContainer/RootContainer.tsx +336 -0
  108. package/lib/infra/RootContainer/index.tsx +1 -0
  109. package/lib/infra/Stages/Stages.tsx +120 -0
  110. package/lib/infra/Stages/index.tsx +1 -0
  111. package/lib/infra/ToDo/ToDo.css +87 -0
  112. package/lib/infra/ToDo/ToDo.tsx +285 -0
  113. package/lib/infra/ToDo/index.tsx +1 -0
  114. package/lib/infra/VerticalTabs/LeftAlignVerticalTab.tsx +27 -0
  115. package/lib/infra/VerticalTabs/VerticalTabs.tsx +75 -0
  116. package/lib/infra/VerticalTabs/index.tsx +1 -0
  117. package/lib/infra/View/View.css +8 -0
  118. package/lib/infra/View/View.tsx +175 -0
  119. package/lib/infra/View/index.tsx +1 -0
  120. package/lib/templates/AppShell/AppShell.css +40 -0
  121. package/lib/templates/AppShell/AppShell.tsx +439 -0
  122. package/lib/templates/AppShell/index.tsx +1 -0
  123. package/lib/templates/CaseSummary/CaseSummary.tsx +50 -0
  124. package/lib/templates/CaseSummary/index.tsx +1 -0
  125. package/lib/templates/CaseView/CaseView.tsx +261 -0
  126. package/lib/templates/CaseView/CaseViewActionsMenu.tsx +73 -0
  127. package/lib/templates/CaseView/index.tsx +1 -0
  128. package/lib/templates/DataReference/DataReference.tsx +290 -0
  129. package/lib/templates/DataReference/index.tsx +1 -0
  130. package/lib/templates/DefaultForm/DefaultForm.css +25 -0
  131. package/lib/templates/DefaultForm/DefaultForm.tsx +52 -0
  132. package/lib/templates/DefaultForm/index.tsx +1 -0
  133. package/lib/templates/Details/Details/Details.tsx +35 -0
  134. package/lib/templates/Details/Details/index.tsx +1 -0
  135. package/lib/templates/Details/DetailsSubTabs/DetailsSubTabs.tsx +65 -0
  136. package/lib/templates/Details/DetailsSubTabs/index.tsx +1 -0
  137. package/lib/templates/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +45 -0
  138. package/lib/templates/Details/DetailsThreeColumn/index.tsx +1 -0
  139. package/lib/templates/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +43 -0
  140. package/lib/templates/Details/DetailsTwoColumn/index.tsx +1 -0
  141. package/lib/templates/FieldGroupTemplate/FieldGroupTemplate.tsx +94 -0
  142. package/lib/templates/FieldGroupTemplate/index.tsx +1 -0
  143. package/lib/templates/InlineDashboard/InlineDashboard.tsx +72 -0
  144. package/lib/templates/InlineDashboard/index.tsx +1 -0
  145. package/lib/templates/InlineDashboardPage/InlineDashboardPage.tsx +41 -0
  146. package/lib/templates/InlineDashboardPage/index.tsx +1 -0
  147. package/lib/templates/ListPage/ListPage.tsx +20 -0
  148. package/lib/templates/ListPage/index.tsx +1 -0
  149. package/lib/templates/ListView/ListView.css +10 -0
  150. package/lib/templates/ListView/ListView.tsx +1230 -0
  151. package/lib/templates/ListView/index.tsx +1 -0
  152. package/lib/templates/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +42 -0
  153. package/lib/templates/MultiReferenceReadOnly/index.tsx +1 -0
  154. package/lib/templates/NarrowWide/NarrowWide/NarrowWide.css +21 -0
  155. package/lib/templates/NarrowWide/NarrowWide/NarrowWide.tsx +35 -0
  156. package/lib/templates/NarrowWide/NarrowWide/index.tsx +1 -0
  157. package/lib/templates/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +53 -0
  158. package/lib/templates/NarrowWide/NarrowWideDetails/index.tsx +1 -0
  159. package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.css +21 -0
  160. package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +24 -0
  161. package/lib/templates/NarrowWide/NarrowWideForm/index.tsx +1 -0
  162. package/lib/templates/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +38 -0
  163. package/lib/templates/NarrowWide/NarrowWidePage/index.tsx +1 -0
  164. package/lib/templates/OneColumn/OneColumn/OneColumn.tsx +32 -0
  165. package/lib/templates/OneColumn/OneColumn/index.tsx +1 -0
  166. package/lib/templates/OneColumn/OneColumnPage/OneColumnPage.tsx +24 -0
  167. package/lib/templates/OneColumn/OneColumnPage/index.tsx +1 -0
  168. package/lib/templates/OneColumn/OneColumnTab/OneColumnTab.tsx +17 -0
  169. package/lib/templates/OneColumn/OneColumnTab/index.tsx +1 -0
  170. package/lib/templates/PromotedFilters/PromotedFilters.css +7 -0
  171. package/lib/templates/PromotedFilters/PromotedFilters.tsx +160 -0
  172. package/lib/templates/PromotedFilters/index.tsx +1 -0
  173. package/lib/templates/SimpleTable/SimpleTable/SimpleTable.tsx +28 -0
  174. package/lib/templates/SimpleTable/SimpleTable/index.tsx +1 -0
  175. package/lib/templates/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +719 -0
  176. package/lib/templates/SimpleTable/SimpleTableManual/index.tsx +1 -0
  177. package/lib/templates/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +129 -0
  178. package/lib/templates/SimpleTable/SimpleTableSelect/index.tsx +1 -0
  179. package/lib/templates/SimpleTable/helpers.ts +360 -0
  180. package/lib/templates/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +66 -0
  181. package/lib/templates/SingleReferenceReadOnly/index.tsx +1 -0
  182. package/lib/templates/SubTabs/SubTabs.tsx +65 -0
  183. package/lib/templates/SubTabs/index.tsx +1 -0
  184. package/lib/templates/SubTabs/tabUtils.ts +73 -0
  185. package/lib/templates/TwoColumn/TwoColumn/TwoColumn.css +13 -0
  186. package/lib/templates/TwoColumn/TwoColumn/TwoColumn.tsx +58 -0
  187. package/lib/templates/TwoColumn/TwoColumn/index.tsx +1 -0
  188. package/lib/templates/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +25 -0
  189. package/lib/templates/TwoColumn/TwoColumnPage/index.tsx +1 -0
  190. package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
  191. package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +55 -0
  192. package/lib/templates/TwoColumn/TwoColumnTab/index.tsx +1 -0
  193. package/lib/templates/WideNarrow/WideNarrow/WideNarrow.css +21 -0
  194. package/lib/templates/WideNarrow/WideNarrow/WideNarrow.tsx +35 -0
  195. package/lib/templates/WideNarrow/WideNarrow/index.tsx +1 -0
  196. package/lib/templates/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +54 -0
  197. package/lib/templates/WideNarrow/WideNarrowDetails/index.tsx +1 -0
  198. package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.css +21 -0
  199. package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +24 -0
  200. package/lib/templates/WideNarrow/WideNarrowForm/index.tsx +1 -0
  201. package/lib/templates/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +38 -0
  202. package/lib/templates/WideNarrow/WideNarrowPage/index.tsx +1 -0
  203. package/lib/templates/utils.ts +23 -0
  204. package/lib/widgets/AppAnnouncement/AppAnnouncement.tsx +67 -0
  205. package/lib/widgets/AppAnnouncement/index.tsx +1 -0
  206. package/lib/widgets/CaseHistory/CaseHistory.tsx +169 -0
  207. package/lib/widgets/CaseHistory/index.tsx +1 -0
  208. package/lib/widgets/FileUtility/ActionButtonsForFileUtil.css +27 -0
  209. package/lib/widgets/FileUtility/ActionButtonsForFileUtil.tsx +22 -0
  210. package/lib/widgets/FileUtility/FileUtility.css +117 -0
  211. package/lib/widgets/FileUtility/FileUtility.tsx +567 -0
  212. package/lib/widgets/FileUtility/index.tsx +0 -0
  213. package/lib/widgets/Followers/Followers.tsx +43 -0
  214. package/lib/widgets/Followers/index.tsx +1 -0
  215. package/lib/widgets/SummaryItem/SummaryItem.css +78 -0
  216. package/lib/widgets/SummaryItem/SummaryItem.tsx +80 -0
  217. package/lib/widgets/SummaryItem/index.tsx +1 -0
  218. package/lib/widgets/SummaryList/SummaryList.tsx +12 -0
  219. package/lib/widgets/SummaryList/index.tsx +1 -0
  220. package/package.json +14 -0
@@ -0,0 +1,89 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ // import { TextField } from "@material-ui/core";
3
+ import CurrencyTextField from '@unicef/material-ui-currency-textfield';
4
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
6
+
7
+ // Using control from: https://github.com/unicef/material-ui-currency-textfield
8
+
9
+ export default function Currency(props) {
10
+ const {
11
+ getPConnect,
12
+ label,
13
+ required,
14
+ disabled,
15
+ value = '',
16
+ validatemessage,
17
+ status,
18
+ /* onChange, onBlur, */
19
+ readOnly,
20
+ testId,
21
+ helperText,
22
+ displayMode
23
+ } = props;
24
+ const pConn = getPConnect();
25
+ const actions = pConn.getActionsApi();
26
+ const propName = pConn.getStateProps().value;
27
+ const helperTextToDisplay = validatemessage || helperText;
28
+
29
+ // console.log(`Currency: label: ${label} value: ${value}`);
30
+
31
+ let readOnlyProp = {}; // Note: empty if NOT ReadOnly
32
+
33
+ if (readOnly) {
34
+ readOnlyProp = { readOnly: true };
35
+ }
36
+
37
+ let testProp = {};
38
+
39
+ testProp = {
40
+ 'data-test-id': testId
41
+ };
42
+
43
+ const [currValue, setCurrValue] = useState();
44
+
45
+ useEffect(() => {
46
+ // const testVal = value;
47
+ setCurrValue(value.toString());
48
+ }, [value]);
49
+
50
+ if(displayMode === 'LABELS_LEFT') {
51
+ const field = {
52
+ [label]: value
53
+ };
54
+ return <FieldValueList item={field} />
55
+ }
56
+
57
+ function currOnChange(event, inValue) {
58
+ // console.log(`Currency currOnChange inValue: ${inValue}`);
59
+
60
+ // update internal value
61
+ setCurrValue(inValue);
62
+ }
63
+
64
+ function currOnBlur(event, inValue) {
65
+ // console.log(`Currency currOnBlur inValue: ${inValue}`);
66
+ handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
67
+ }
68
+
69
+ return (
70
+ <CurrencyTextField
71
+ fullWidth
72
+ variant={readOnly ? 'standard' : 'outlined'}
73
+ helperText={helperTextToDisplay}
74
+ placeholder=''
75
+ size='small'
76
+ required={required}
77
+ disabled={disabled}
78
+ onChange={currOnChange}
79
+ onBlur={!readOnly ? currOnBlur : undefined}
80
+ error={status === 'error'}
81
+ label={label}
82
+ value={currValue}
83
+ type='text'
84
+ outputFormat='number'
85
+ textAlign='left'
86
+ InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: currValue } }}
87
+ />
88
+ );
89
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Currency';
@@ -0,0 +1,79 @@
1
+ import React from 'react';
2
+ import { KeyboardDatePicker } from '@material-ui/pickers';
3
+ import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
4
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
6
+
7
+ export default function Date(props) {
8
+ const {
9
+ getPConnect,
10
+ label,
11
+ required,
12
+ disabled,
13
+ value = '',
14
+ validatemessage,
15
+ status,
16
+ onChange,
17
+ onBlur,
18
+ readOnly,
19
+ testId,
20
+ helperText,
21
+ displayMode
22
+ } = props;
23
+ const pConn = getPConnect();
24
+ const actions = pConn.getActionsApi();
25
+ const propName = pConn.getStateProps().value;
26
+ const helperTextToDisplay = validatemessage || helperText;
27
+
28
+ if(displayMode === 'LABELS_LEFT') {
29
+ const field = {
30
+ [label]: value
31
+ };
32
+ return <FieldValueList item={field} />
33
+ }
34
+
35
+ if (readOnly) {
36
+ // const theReadOnlyComp = <TextInput props />
37
+ return <TextInput {...props} />;
38
+ }
39
+
40
+ let testProp = {};
41
+
42
+ testProp = {
43
+ 'data-test-id': testId
44
+ };
45
+
46
+ const handleChange = date => {
47
+ const changeValue = date && date.isValid() ? date.toISOString() : null;
48
+ onChange({ value: changeValue });
49
+ };
50
+
51
+ const handleAccept = date => {
52
+ const changeValue = date && date.isValid() ? date.toISOString() : null;
53
+ handleEvent(actions, 'changeNblur', propName, changeValue);
54
+ };
55
+
56
+ return (
57
+ <KeyboardDatePicker
58
+ disableToolbar
59
+ variant='inline'
60
+ inputVariant='outlined'
61
+ placeholder='mm/dd/yyyy'
62
+ fullWidth
63
+ autoOk
64
+ required={required}
65
+ disabled={disabled}
66
+ format='MM/DD/YYYY'
67
+ mask='__/__/____'
68
+ error={status === 'error'}
69
+ helperText={helperTextToDisplay}
70
+ size='small'
71
+ label={label}
72
+ value={value || null}
73
+ onChange={handleChange}
74
+ onBlur={!readOnly ? onBlur : undefined}
75
+ onAccept={handleAccept}
76
+ InputProps={{ ...testProp }}
77
+ />
78
+ );
79
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Date';
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import { KeyboardDateTimePicker } from '@material-ui/pickers';
3
+ import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
4
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
6
+
7
+ export default function DateTime(props) {
8
+ const {
9
+ getPConnect,
10
+ label,
11
+ required,
12
+ disabled,
13
+ value = '',
14
+ validatemessage,
15
+ status,
16
+ onChange,
17
+ readOnly,
18
+ testId,
19
+ helperText,
20
+ displayMode
21
+ } = props;
22
+ const pConn = getPConnect();
23
+ const actions = pConn.getActionsApi();
24
+ const propName = pConn.getStateProps().value;
25
+ const helperTextToDisplay = validatemessage || helperText;
26
+
27
+ if(displayMode === 'LABELS_LEFT'){
28
+ const field = {
29
+ [label]: value
30
+ };
31
+ return <FieldValueList item={field}/>
32
+ }
33
+
34
+ if (readOnly) {
35
+ return <TextInput {...props} />;
36
+ }
37
+
38
+ const handleChange = date => {
39
+ const changeValue = date && date.isValid() ? date.toISOString() : null;
40
+ onChange({ value: changeValue });
41
+ };
42
+
43
+ const handleAccept = date => {
44
+ const changeValue = date && date.isValid() ? date.toISOString() : null;
45
+ handleEvent(actions, 'changeNblur', propName, changeValue);
46
+ };
47
+
48
+ //
49
+ // TODO: Keyboard doesn't work in the minute field, it updates one digit then jump to am/pm field
50
+ // try an older version of the lib or use DateTimePicker
51
+ //
52
+
53
+ return (
54
+ <KeyboardDateTimePicker
55
+ variant='inline'
56
+ inputVariant='outlined'
57
+ fullWidth
58
+ autoOk
59
+ required={required}
60
+ disabled={disabled}
61
+ placeholder='mm/dd/yyyy hh:mm am'
62
+ format='MM/DD/YYYY hh:mm a'
63
+ mask='__/__/____ __:__ _m'
64
+ minutesStep={5}
65
+ error={status === 'error'}
66
+ helperText={helperTextToDisplay}
67
+ size='small'
68
+ label={label}
69
+ value={value || null}
70
+ onChange={handleChange}
71
+ onAccept={handleAccept}
72
+ data-test-id={testId}
73
+ />
74
+ );
75
+ }
@@ -0,0 +1 @@
1
+ export { default } from './DateTime';
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { TextField } from '@material-ui/core';
3
+ import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
4
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
5
+
6
+ export default function Decimal(props) {
7
+ const {
8
+ label,
9
+ required,
10
+ disabled,
11
+ value = '',
12
+ validatemessage,
13
+ status,
14
+ onChange,
15
+ onBlur,
16
+ readOnly,
17
+ helperText,
18
+ displayMode
19
+ } = props;
20
+ const helperTextToDisplay = validatemessage || helperText;
21
+
22
+ if(displayMode === 'LABELS_LEFT') {
23
+ const field = {
24
+ [label]: value
25
+ };
26
+ return <FieldValueList item={field} />
27
+ }
28
+
29
+ if (readOnly) {
30
+ return <TextInput {...props} />;
31
+ }
32
+
33
+ return (
34
+ <TextField
35
+ fullWidth
36
+ variant={readOnly ? 'standard' : 'outlined'}
37
+ helperText={helperTextToDisplay}
38
+ placeholder=''
39
+ size='small'
40
+ required={required}
41
+ disabled={disabled}
42
+ onChange={onChange}
43
+ onBlur={!readOnly ? onBlur : undefined}
44
+ error={status === 'error'}
45
+ label={label}
46
+ value={value}
47
+ type='text'
48
+ inputProps={{ inputMode: 'decimal', pattern: '[0-9]*' }}
49
+ />
50
+ );
51
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Decimal';
@@ -0,0 +1,82 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { TextField } from '@material-ui/core';
3
+ import MenuItem from '@material-ui/core/MenuItem';
4
+ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
5
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
+
7
+ interface IOption {
8
+ key: string;
9
+ value: string;
10
+ }
11
+
12
+ export default function Dropdown(props) {
13
+ const {
14
+ getPConnect,
15
+ label,
16
+ required,
17
+ disabled,
18
+ placeholder,
19
+ value = '',
20
+ datasource = [],
21
+ validatemessage,
22
+ status,
23
+ readOnly,
24
+ testId,
25
+ helperText
26
+ } = props;
27
+ const [options, setOptions] = useState<Array<IOption>>([]);
28
+ const helperTextToDisplay = validatemessage || helperText;
29
+
30
+ const thePConn = getPConnect();
31
+ const actionsApi = thePConn.getActionsApi();
32
+ const propName = thePConn.getStateProps().value;
33
+
34
+ useEffect(() => {
35
+ const optionsList = Utils.getOptionList(props, getPConnect().getDataObject());
36
+ optionsList.unshift({ key: 'Select', value: 'Select...' });
37
+ setOptions(optionsList);
38
+ }, [datasource]);
39
+
40
+ let readOnlyProp = {};
41
+
42
+ if (readOnly) {
43
+ readOnlyProp = { readOnly: true };
44
+ }
45
+
46
+ let testProp = {};
47
+
48
+ testProp = {
49
+ 'data-test-id': testId
50
+ };
51
+
52
+ const handleChange = evt => {
53
+ const selectedValue = evt.target.value === 'Select' ? '' : evt.target.value;
54
+ handleEvent(actionsApi, 'changeNblur', propName, selectedValue);
55
+ };
56
+
57
+ // Material UI shows a warning if the component is rendered before options are set.
58
+ // So, hold off on rendering anything until options are available...
59
+ return options.length === 0 ? null : (
60
+ <TextField
61
+ fullWidth
62
+ variant={readOnly ? 'standard' : 'outlined'}
63
+ helperText={helperTextToDisplay}
64
+ placeholder={placeholder}
65
+ size='small'
66
+ required={required}
67
+ disabled={disabled}
68
+ onChange={!readOnly ? handleChange : undefined}
69
+ error={status === 'error'}
70
+ label={label}
71
+ value={value === '' && !readOnly ? 'Select' : value}
72
+ select
73
+ InputProps={{ ...readOnlyProp, ...testProp }}
74
+ >
75
+ {options.map((option: any) => (
76
+ <MenuItem key={option.key} value={option.key}>
77
+ {option.value}
78
+ </MenuItem>
79
+ ))}
80
+ </TextField>
81
+ );
82
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Dropdown';
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { TextField, InputAdornment } from '@material-ui/core';
3
+ import MailOutlineIcon from '@material-ui/icons/MailOutline';
4
+ import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
5
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
6
+
7
+ export default function Email(props) {
8
+ const {
9
+ label,
10
+ required,
11
+ disabled,
12
+ value = '',
13
+ validatemessage,
14
+ status,
15
+ onChange,
16
+ onBlur,
17
+ readOnly,
18
+ testId,
19
+ helperText,
20
+ displayMode
21
+ } = props;
22
+ const helperTextToDisplay = validatemessage || helperText;
23
+
24
+ if(displayMode === 'LABELS_LEFT') {
25
+ const field = {
26
+ [label]: value
27
+ };
28
+ return <FieldValueList item={field} />
29
+ }
30
+
31
+ if (readOnly) {
32
+ return <TextInput {...props} />;
33
+ }
34
+
35
+
36
+
37
+ let testProp = {};
38
+
39
+ testProp = {
40
+ 'data-test-id': testId
41
+ };
42
+
43
+ return (
44
+ <TextField
45
+ fullWidth
46
+ variant='outlined'
47
+ helperText={helperTextToDisplay}
48
+ placeholder=''
49
+ size='small'
50
+ required={required}
51
+ disabled={disabled}
52
+ onChange={onChange}
53
+ onBlur={!readOnly ? onBlur : undefined}
54
+ error={status === 'error'}
55
+ label={label}
56
+ value={value}
57
+ type='email'
58
+ InputProps={{
59
+ startAdornment: (
60
+ <InputAdornment position='start'>
61
+ <MailOutlineIcon />
62
+ </InputAdornment>
63
+ ),
64
+ inputProps: { ...testProp }
65
+ }}
66
+ />
67
+ );
68
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Email';
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ import { TextField } from '@material-ui/core';
3
+ import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
4
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
5
+
6
+ export default function Integer(props) {
7
+ const {
8
+ label,
9
+ required,
10
+ disabled,
11
+ value = '',
12
+ validatemessage,
13
+ status,
14
+ onChange,
15
+ onBlur,
16
+ readOnly,
17
+ testId,
18
+ helperText,
19
+ displayMode
20
+ } = props;
21
+ const helperTextToDisplay = validatemessage || helperText;
22
+
23
+ // console.log(`Integer: label: ${label} value: ${value}`);
24
+
25
+ if(displayMode === 'LABELS_LEFT') {
26
+ const field = {
27
+ [label]: value
28
+ };
29
+ return <FieldValueList item={field} />
30
+ }
31
+
32
+ if (readOnly) {
33
+ return <TextInput {...props} />;
34
+ }
35
+
36
+ let testProp = {};
37
+
38
+ testProp = {
39
+ 'data-test-id': testId
40
+ };
41
+
42
+ function intOnChange(event) {
43
+ // console.log(`Integer intOnChange inValue: ${event.target.value}`);
44
+
45
+ // Disallow "." and "," (separators) since this is an integer field
46
+ // Mimics Pega Integer behavior (where separator characters are "eaten" if they're typed)
47
+ const disallowedChars = ['.', ','];
48
+ const theAttemptedValue = event.target.value;
49
+ const lastChar = theAttemptedValue.slice(-1);
50
+
51
+ if (disallowedChars.includes(lastChar)) {
52
+ event.target.value = theAttemptedValue.slice(0, -1);
53
+ }
54
+
55
+ // Pass through to the Constellation change handler
56
+ onChange(event);
57
+ }
58
+
59
+ return (
60
+ <TextField
61
+ fullWidth
62
+ variant={readOnly ? 'standard' : 'outlined'}
63
+ helperText={helperTextToDisplay}
64
+ placeholder=''
65
+ size='small'
66
+ required={required}
67
+ disabled={disabled}
68
+ onChange={intOnChange}
69
+ onBlur={!readOnly ? onBlur : undefined}
70
+ error={status === 'error'}
71
+ label={label}
72
+ value={value}
73
+ type='text'
74
+ inputProps={{ inputMode: 'numeric', pattern: '[0-9]*', ...testProp }}
75
+ />
76
+ );
77
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Integer';
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+ import { TextField } from '@material-ui/core';
3
+ import { makeStyles } from '@material-ui/core/styles';
4
+
5
+ import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
6
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
7
+
8
+ // Inspired by https://stackoverflow.com/questions/50823182/material-ui-remove-up-down-arrow-dials-from-textview
9
+ const useStyles = makeStyles((/* theme */) => ({
10
+ input: {
11
+ '& input[type=number]': {
12
+ '-moz-appearance': 'textfield'
13
+ },
14
+ '& input[type=number]::-webkit-outer-spin-button': {
15
+ '-webkit-appearance': 'none',
16
+ margin: 0
17
+ },
18
+ '& input[type=number]::-webkit-inner-spin-button': {
19
+ '-webkit-appearance': 'none',
20
+ margin: 0
21
+ }
22
+ }
23
+ }));
24
+
25
+ export default function Percentage(props) {
26
+ const classes = useStyles();
27
+
28
+ const {
29
+ label,
30
+ required,
31
+ disabled,
32
+ value = '',
33
+ validatemessage,
34
+ status,
35
+ onChange,
36
+ onBlur,
37
+ readOnly,
38
+ testId,
39
+ helperText,
40
+ displayMode
41
+ } = props;
42
+ const helperTextToDisplay = validatemessage || helperText;
43
+
44
+ // console.log(`Percentage: label: ${label} value: ${value}`);
45
+
46
+ if(displayMode === 'LABELS_LEFT') {
47
+ const field = {
48
+ [label]: value
49
+ };
50
+ return <FieldValueList item={field} />
51
+ }
52
+
53
+ if (readOnly) {
54
+ return <TextInput {...props} />;
55
+ }
56
+
57
+ let testProp = {};
58
+
59
+ testProp = {
60
+ 'data-test-id': testId
61
+ };
62
+
63
+ return (
64
+ <TextField
65
+ className={classes.input}
66
+ fullWidth
67
+ variant={readOnly ? 'standard' : 'outlined'}
68
+ helperText={helperTextToDisplay}
69
+ placeholder=''
70
+ size='small'
71
+ required={required}
72
+ disabled={disabled}
73
+ onChange={onChange}
74
+ onBlur={!readOnly ? onBlur : undefined}
75
+ error={status === 'error'}
76
+ label={label}
77
+ value={value}
78
+ type='number'
79
+ inputProps={{ ...testProp }}
80
+ />
81
+ );
82
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Percentage';