@pega/react-sdk-overrides 8.23.11 → 23.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +13 -9
  2. package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
  4. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
  5. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
  6. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -3
  7. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
  8. package/lib/designSystemExtension/Operator/Operator.tsx +16 -12
  9. package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
  10. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
  11. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +10 -1
  13. package/lib/field/AutoComplete/AutoComplete.tsx +38 -19
  14. package/lib/field/CancelAlert/CancelAlert.tsx +9 -4
  15. package/lib/field/Checkbox/Checkbox.tsx +39 -7
  16. package/lib/field/Currency/Currency.tsx +24 -16
  17. package/lib/field/Currency/currency-utils.ts +1 -5
  18. package/lib/field/Date/Date.tsx +23 -16
  19. package/lib/field/DateTime/DateTime.tsx +26 -15
  20. package/lib/field/Decimal/Decimal.tsx +26 -15
  21. package/lib/field/Dropdown/Dropdown.tsx +34 -28
  22. package/lib/field/Email/Email.tsx +17 -9
  23. package/lib/field/Integer/Integer.tsx +15 -7
  24. package/lib/field/Percentage/Percentage.tsx +15 -7
  25. package/lib/field/Phone/Phone.tsx +19 -11
  26. package/lib/field/RadioButtons/RadioButtons.tsx +28 -38
  27. package/lib/field/RichText/RichText.tsx +95 -0
  28. package/lib/field/RichText/index.tsx +1 -0
  29. package/lib/field/ScalarList/ScalarList.tsx +73 -0
  30. package/lib/field/ScalarList/config-ext.json +8 -0
  31. package/lib/field/ScalarList/index.tsx +1 -0
  32. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  33. package/lib/field/TextArea/TextArea.tsx +14 -5
  34. package/lib/field/TextContent/TextContent.tsx +10 -1
  35. package/lib/field/TextInput/TextInput.tsx +16 -7
  36. package/lib/field/Time/Time.tsx +22 -27
  37. package/lib/field/URL/URL.tsx +16 -8
  38. package/lib/field/UserReference/UserReference.tsx +50 -60
  39. package/lib/helpers/attachmentHelpers.ts +4 -4
  40. package/lib/helpers/auth.js +752 -401
  41. package/lib/helpers/authManager.ts +933 -0
  42. package/lib/helpers/case-utils.tsx +8 -9
  43. package/lib/helpers/common-utils.ts +1 -1
  44. package/lib/helpers/config_access.js +0 -73
  45. package/lib/helpers/date-format-utils.ts +1 -1
  46. package/lib/helpers/event-utils.ts +1 -1
  47. package/lib/helpers/field-group-utils.ts +7 -9
  48. package/lib/helpers/formatters/Currency.ts +11 -11
  49. package/lib/helpers/formatters/CurrencyMap.ts +8 -5
  50. package/lib/helpers/formatters/Date.ts +1 -1
  51. package/lib/helpers/formatters/common.ts +2 -6
  52. package/lib/helpers/formatters/index.ts +3 -3
  53. package/lib/helpers/simpleTableHelpers.ts +7 -7
  54. package/lib/helpers/state-utils.tsx +0 -3
  55. package/lib/helpers/template-utils.ts +3 -6
  56. package/lib/helpers/versionHelpers.ts +0 -3
  57. package/lib/infra/ActionButtons/ActionButtons.tsx +9 -19
  58. package/lib/infra/Assignment/Assignment.tsx +28 -32
  59. package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
  60. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +57 -58
  61. package/lib/infra/Containers/FlowContainer/helpers.ts +0 -3
  62. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +14 -17
  63. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +20 -27
  64. package/lib/infra/DashboardFilter/DashboardFilter.tsx +13 -21
  65. package/lib/infra/DashboardFilter/filterUtils.tsx +2 -1
  66. package/lib/infra/DeferLoad/DeferLoad.tsx +14 -20
  67. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +11 -15
  68. package/lib/infra/MultiStep/MultiStep.tsx +22 -22
  69. package/lib/infra/NavBar/NavBar.tsx +14 -21
  70. package/lib/infra/Reference/Reference.tsx +14 -18
  71. package/lib/infra/Region/Region.tsx +8 -6
  72. package/lib/infra/RootContainer/RootContainer.tsx +16 -25
  73. package/lib/infra/Stages/Stages.tsx +10 -8
  74. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
  75. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  76. package/lib/infra/View/View.tsx +23 -23
  77. package/lib/template/AppShell/AppShell.tsx +36 -25
  78. package/lib/template/BannerPage/BannerPage.tsx +26 -31
  79. package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
  80. package/lib/template/CaseView/CaseView.tsx +24 -25
  81. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +10 -19
  82. package/lib/template/Confirmation/Confirmation.tsx +27 -53
  83. package/lib/template/DataReference/DataReference.tsx +49 -53
  84. package/lib/template/DefaultForm/DefaultForm.tsx +14 -12
  85. package/lib/template/Details/Details/Details.tsx +16 -17
  86. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
  87. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
  88. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
  89. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +78 -0
  90. package/lib/template/Details/DynamicTabs/config.json +36 -0
  91. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  92. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +22 -28
  93. package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
  94. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +20 -18
  95. package/lib/template/ListPage/ListPage.tsx +14 -13
  96. package/lib/template/ListView/ListView.tsx +242 -314
  97. package/lib/template/ListView/utils.ts +170 -23
  98. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +10 -19
  99. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
  100. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
  101. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
  102. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  103. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
  104. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  105. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
  106. package/lib/template/PromotedFilters/PromotedFilters.tsx +16 -14
  107. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +102 -8
  108. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +25 -8
  109. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +23 -33
  110. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +33 -36
  111. package/lib/template/SubTabs/SubTabs.tsx +10 -11
  112. package/lib/template/SubTabs/tabUtils.ts +0 -4
  113. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
  114. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  115. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
  116. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
  117. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
  118. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
  119. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
  120. package/lib/template/WssNavBar/WssNavBar.tsx +18 -1
  121. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
  122. package/lib/widget/Attachment/Attachment.tsx +28 -16
  123. package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
  124. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
  125. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +35 -22
  126. package/lib/widget/Followers/Followers.tsx +10 -11
  127. package/lib/widget/QuickCreate/QuickCreate.tsx +11 -5
  128. package/lib/widget/SummaryItem/SummaryItem.tsx +11 -1
  129. package/lib/widget/SummaryList/SummaryList.tsx +17 -3
  130. package/lib/widget/ToDo/ToDo.tsx +62 -105
  131. package/package.json +1 -1
  132. package/lib/helpers/authManager.js +0 -634
@@ -7,9 +7,39 @@ import {
7
7
  FormHelperText
8
8
  } from '@material-ui/core';
9
9
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
10
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
10
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
11
+ // import type { PConnProps } from '../../../types/PConnProps';
12
+
13
+ // Checkbox passes in 'value' as a boolean. So can't use the default
14
+ // PConnFieldProps since it expects value to be a string.
15
+ // But can't use CheckBoxProps until getValidationApi() knows about validate method
16
+ // Currently just thinks that returns an "object"
17
+ // interface CheckboxProps extends PConnProps {
18
+ // // If any, enter additional props that only exist on Checkbox here
19
+ // // Everything from PConnFieldProps except value and change type of value to boolean
20
+
21
+ // value?: boolean,
22
+ // label: string,
23
+ // required: boolean,
24
+ // disabled: boolean,
25
+ // validatemessage: string,
26
+ // status?: string,
27
+ // // eslint-disable-next-line react/no-unused-prop-types
28
+ // onChange: any,
29
+ // // eslint-disable-next-line react/no-unused-prop-types
30
+ // onBlur?: any,
31
+ // readOnly: boolean,
32
+ // testId: string,
33
+ // helperText: string,
34
+ // displayMode?: string,
35
+ // hideLabel: boolean,
36
+ // // eslint-disable-next-line react/no-unused-prop-types
37
+ // placeholder?: string
38
+ // }
39
+ export default function CheckboxComponent(props /* : CheckboxProps */) {
40
+ // Get emitted components from map (so we can get any override that may exist)
41
+ const FieldValueList = getComponentFromMap('FieldValueList');
11
42
 
12
- export default function CheckboxComponent(props) {
13
43
  const {
14
44
  getPConnect,
15
45
  label,
@@ -28,9 +58,9 @@ export default function CheckboxComponent(props) {
28
58
 
29
59
  const thePConn = getPConnect();
30
60
  const theConfigProps = thePConn.getConfigProps();
31
- const { caption } = theConfigProps;
61
+ const caption = theConfigProps['caption'];
32
62
  const actionsApi = thePConn.getActionsApi();
33
- const propName = thePConn.getStateProps().value;
63
+ const propName = thePConn.getStateProps()['value'];
34
64
 
35
65
  const [checked, setChecked] = useState(false);
36
66
  useEffect(() => {
@@ -39,11 +69,13 @@ export default function CheckboxComponent(props) {
39
69
  }, [value]);
40
70
 
41
71
  if (displayMode === 'LABELS_LEFT') {
42
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
72
+ return <FieldValueList name={hideLabel ? '' : label} value={value.toString()} />;
43
73
  }
44
74
 
45
75
  if (displayMode === 'STACKED_LARGE_VAL') {
46
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
76
+ return (
77
+ <FieldValueList name={hideLabel ? '' : label} value={value.toString()} variant='stacked' />
78
+ );
47
79
  }
48
80
 
49
81
  const handleChange = event => {
@@ -51,7 +83,7 @@ export default function CheckboxComponent(props) {
51
83
  };
52
84
 
53
85
  const handleBlur = event => {
54
- thePConn.getValidationApi().validate(event.target.checked);
86
+ thePConn.getValidationApi().validate(event.target.checked, ''); // 2nd arg empty string until typedef marked correctly as optional
55
87
  };
56
88
 
57
89
  let theCheckbox = <Checkbox color='primary' disabled={disabled} />;
@@ -1,14 +1,22 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- // import { TextField } from "@material-ui/core";
3
2
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
4
3
  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";
4
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
5
  import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
8
 
9
9
  // Using control from: https://github.com/unicef/material-ui-currency-textfield
10
10
 
11
- export default function Currency(props) {
11
+ interface CurrrencyProps extends PConnFieldProps {
12
+ // If any, enter additional props that only exist on Currency here
13
+ currencyISOCode?: string;
14
+ }
15
+
16
+ export default function Currency(props: CurrrencyProps) {
17
+ // Get emitted components from map (so we can get any override that may exist)
18
+ const FieldValueList = getComponentFromMap('FieldValueList');
19
+
12
20
  const {
13
21
  getPConnect,
14
22
  label,
@@ -23,12 +31,12 @@ export default function Currency(props) {
23
31
  helperText,
24
32
  displayMode,
25
33
  hideLabel,
26
- currencyISOCode = "USD"
34
+ currencyISOCode = 'USD'
27
35
  } = props;
28
36
 
29
37
  const pConn = getPConnect();
30
38
  const actions = pConn.getActionsApi();
31
- const propName = pConn.getStateProps().value;
39
+ const propName = pConn.getStateProps()["value"];
32
40
  const helperTextToDisplay = validatemessage || helperText;
33
41
 
34
42
  // console.log(`Currency: label: ${label} value: ${value}`);
@@ -45,10 +53,10 @@ export default function Currency(props) {
45
53
  'data-test-id': testId
46
54
  };
47
55
 
48
- const [currValue, setCurrValue] = useState();
49
- const [theCurrSym, setCurrSym] = useState("$");
50
- const [theCurrDec, setCurrDec] = useState(".");
51
- const [theCurrSep, setCurrSep] = useState(",");
56
+ const [currValue, setCurrValue] = useState('');
57
+ const [theCurrSym, setCurrSym] = useState('$');
58
+ const [theCurrDec, setCurrDec] = useState('.');
59
+ const [theCurrSep, setCurrSep] = useState(',');
52
60
 
53
61
  useEffect(() => {
54
62
  // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
@@ -71,7 +79,7 @@ export default function Currency(props) {
71
79
  }
72
80
 
73
81
  if (displayMode === 'STACKED_LARGE_VAL') {
74
- return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
82
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant="stacked" />;
75
83
  }
76
84
 
77
85
  // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
@@ -94,8 +102,8 @@ export default function Currency(props) {
94
102
  fullWidth
95
103
  variant={readOnly ? 'standard' : 'outlined'}
96
104
  helperText={helperTextToDisplay}
97
- placeholder=''
98
- size='small'
105
+ placeholder=""
106
+ size="small"
99
107
  required={required}
100
108
  disabled={disabled}
101
109
  onChange={currOnChange}
@@ -103,9 +111,9 @@ export default function Currency(props) {
103
111
  error={status === 'error'}
104
112
  label={label}
105
113
  value={currValue}
106
- type='text'
107
- outputFormat='number'
108
- textAlign='left'
114
+ type="text"
115
+ outputFormat="number"
116
+ textAlign="left"
109
117
  InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: currValue } }}
110
118
  currencySymbol={theCurrSym}
111
119
  decimalCharacter={theCurrDec}
@@ -3,14 +3,10 @@ import { default as CurrencyAlias} from '@pega/react-sdk-components/lib/componen
3
3
  // eslint-disable-next-line import/no-named-default
4
4
  import { default as CurrencyMapAlias } from '@pega/react-sdk-components/lib/components/helpers/formatters/CurrencyMap';
5
5
 
6
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
7
-
8
- declare const PCore: typeof PCoreType;
9
-
10
6
 
11
7
  export const getCurrencyOptions = (inISOCode: string) => {
12
8
 
13
- const operatorLocale = PCore.getEnvironmentInfo().getUseLocale() || 'en-US';
9
+ const operatorLocale = PCore.getEnvironmentInfo().getUseLocale() || PCore.getEnvironmentInfo().getLocale() || 'en-US';
14
10
 
15
11
  let currMapToUse = CurrencyMapAlias.US;
16
12
  let localeToUse = operatorLocale;
@@ -1,17 +1,25 @@
1
1
  import React from 'react';
2
2
  import { KeyboardDatePicker } from '@material-ui/pickers';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
3
  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
4
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
- import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
5
+ import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
8
 
9
9
  // Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server
10
- function getFormattedDate(date){
10
+ function getFormattedDate(date) {
11
11
  return `${date.$y.toString()}-${(date.$M + 1).toString().padStart(2, '0')}-${date.$D.toString().padStart(2, '0')}`;
12
12
  }
13
13
 
14
- export default function Date(props) {
14
+ interface DateProps extends PConnFieldProps {
15
+ // If any, enter additional props that only exist on Date here
16
+ }
17
+
18
+ export default function Date(props: DateProps) {
19
+ // Get emitted components from map (so we can get any override that may exist)
20
+ const TextInput = getComponentFromMap('TextInput');
21
+ const FieldValueList = getComponentFromMap('FieldValueList');
22
+
15
23
  const {
16
24
  getPConnect,
17
25
  label,
@@ -31,18 +39,17 @@ export default function Date(props) {
31
39
 
32
40
  const pConn = getPConnect();
33
41
  const actions = pConn.getActionsApi();
34
- const propName = pConn.getStateProps().value;
42
+ const propName = pConn.getStateProps()["value"];
35
43
  const helperTextToDisplay = validatemessage || helperText;
36
44
 
37
45
  // Start with default dateFormatInfo
38
46
  const dateFormatInfo = dateFormatInfoDefault;
39
47
  // and then update, as needed, based on locale, etc.
40
- const theDateFormat = getDateFormatInfo()
48
+ const theDateFormat = getDateFormatInfo();
41
49
  dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
42
50
  dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
43
51
  dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
44
52
 
45
-
46
53
  if (displayMode === 'LABELS_LEFT') {
47
54
  const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
48
55
  return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
@@ -50,7 +57,7 @@ export default function Date(props) {
50
57
 
51
58
  if (displayMode === 'STACKED_LARGE_VAL') {
52
59
  const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
53
- return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant='stacked' />;
60
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant="stacked" />;
54
61
  }
55
62
 
56
63
  if (readOnly) {
@@ -64,14 +71,14 @@ export default function Date(props) {
64
71
  'data-test-id': testId
65
72
  };
66
73
 
67
- const handleChange = date => {
68
- if(date && date.isValid()){
74
+ const handleChange = (date) => {
75
+ if (date && date.isValid()) {
69
76
  onChange({ value: getFormattedDate(date) });
70
77
  }
71
78
  };
72
79
 
73
- const handleAccept = date => {
74
- if(date && date.isValid()){
80
+ const handleAccept = (date) => {
81
+ if (date && date.isValid()) {
75
82
  handleEvent(actions, 'changeNblur', propName, getFormattedDate(date));
76
83
  }
77
84
  };
@@ -79,8 +86,8 @@ export default function Date(props) {
79
86
  return (
80
87
  <KeyboardDatePicker
81
88
  disableToolbar
82
- variant='inline'
83
- inputVariant='outlined'
89
+ variant="inline"
90
+ inputVariant="outlined"
84
91
  placeholder={dateFormatInfo.dateFormatStringLC}
85
92
  format={dateFormatInfo.dateFormatString}
86
93
  mask={dateFormatInfo.dateFormatMask}
@@ -90,7 +97,7 @@ export default function Date(props) {
90
97
  disabled={disabled}
91
98
  error={status === 'error'}
92
99
  helperText={helperTextToDisplay}
93
- size='small'
100
+ size="small"
94
101
  label={label}
95
102
  value={value || null}
96
103
  onChange={handleChange}
@@ -1,12 +1,20 @@
1
1
  import React from 'react';
2
2
  import { KeyboardDateTimePicker } from '@material-ui/pickers';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
3
  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
4
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
- import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
5
+ import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+
9
+ interface DateTimeProps extends PConnFieldProps {
10
+ // If any, enter additional props that only exist on DateTime here
11
+ }
12
+
13
+ export default function DateTime(props: DateTimeProps) {
14
+ // Get emitted components from map (so we can get any override that may exist)
15
+ const TextInput = getComponentFromMap('TextInput');
16
+ const FieldValueList = getComponentFromMap('FieldValueList');
8
17
 
9
- export default function DateTime(props) {
10
18
  const {
11
19
  getPConnect,
12
20
  label,
@@ -25,26 +33,29 @@ export default function DateTime(props) {
25
33
 
26
34
  const pConn = getPConnect();
27
35
  const actions = pConn.getActionsApi();
28
- const propName = pConn.getStateProps().value;
36
+ const propName = pConn.getStateProps()["value"];
29
37
  const helperTextToDisplay = validatemessage || helperText;
30
38
 
31
39
  // Start with default dateFormatInfo
32
40
  const dateFormatInfo = dateFormatInfoDefault;
33
41
  // and then update, as needed, based on locale, etc.
34
- const theDateFormat = getDateFormatInfo()
42
+ const theDateFormat = getDateFormatInfo();
35
43
  dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
36
44
  dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
37
45
  dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
38
46
 
39
-
40
47
  if (displayMode === 'LABELS_LEFT') {
41
- const formattedDateTime = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
48
+ const formattedDateTime = format(props.value, 'datetime', {
49
+ format: `${dateFormatInfo.dateFormatString} hh:mm a`
50
+ });
42
51
  return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} />;
43
52
  }
44
53
 
45
54
  if (displayMode === 'STACKED_LARGE_VAL') {
46
- const formattedDateTime = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
47
- return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant='stacked' />;
55
+ const formattedDateTime = format(props.value, 'datetime', {
56
+ format: `${dateFormatInfo.dateFormatString} hh:mm a`
57
+ });
58
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant="stacked" />;
48
59
  }
49
60
 
50
61
  if (readOnly) {
@@ -52,12 +63,12 @@ export default function DateTime(props) {
52
63
  return <TextInput {...props} value={formattedDateTime} />;
53
64
  }
54
65
 
55
- const handleChange = date => {
66
+ const handleChange = (date) => {
56
67
  const changeValue = date && date.isValid() ? date.toISOString() : null;
57
68
  onChange({ value: changeValue });
58
69
  };
59
70
 
60
- const handleAccept = date => {
71
+ const handleAccept = (date) => {
61
72
  const changeValue = date && date.isValid() ? date.toISOString() : null;
62
73
  handleEvent(actions, 'changeNblur', propName, changeValue);
63
74
  };
@@ -69,8 +80,8 @@ export default function DateTime(props) {
69
80
 
70
81
  return (
71
82
  <KeyboardDateTimePicker
72
- variant='inline'
73
- inputVariant='outlined'
83
+ variant="inline"
84
+ inputVariant="outlined"
74
85
  fullWidth
75
86
  autoOk
76
87
  required={required}
@@ -81,7 +92,7 @@ export default function DateTime(props) {
81
92
  minutesStep={5}
82
93
  error={status === 'error'}
83
94
  helperText={helperTextToDisplay}
84
- size='small'
95
+ size="small"
85
96
  label={label}
86
97
  value={value || null}
87
98
  onChange={handleChange}
@@ -1,13 +1,24 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
4
3
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
5
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
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 type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
8
 
8
9
  // Using control from: https://github.com/unicef/material-ui-currency-textfield
9
10
 
10
- export default function Decimal(props) {
11
+ interface DecimalProps extends PConnFieldProps {
12
+ // If any, enter additional props that only exist on Decimal here
13
+ currencyISOCode?: string;
14
+ decimalPrecision?: number;
15
+ showGroupSeparators?: string;
16
+ }
17
+
18
+ export default function Decimal(props: DecimalProps) {
19
+ // Get emitted components from map (so we can get any override that may exist)
20
+ const FieldValueList = getComponentFromMap('FieldValueList');
21
+
11
22
  const {
12
23
  getPConnect,
13
24
  label,
@@ -21,7 +32,7 @@ export default function Decimal(props) {
21
32
  helperText,
22
33
  displayMode,
23
34
  hideLabel,
24
- currencyISOCode = "USD",
35
+ currencyISOCode = 'USD',
25
36
  decimalPrecision = 2,
26
37
  showGroupSeparators = true,
27
38
  testId
@@ -29,12 +40,12 @@ export default function Decimal(props) {
29
40
 
30
41
  const pConn = getPConnect();
31
42
  const actions = pConn.getActionsApi();
32
- const propName = pConn.getStateProps().value;
43
+ const propName = pConn.getStateProps()["value"];
33
44
  const helperTextToDisplay = validatemessage || helperText;
34
45
 
35
- const [decValue, setDecimalvalue] = useState();
36
- const [theCurrDec, setCurrDec] = useState(".");
37
- const [theCurrSep, setCurrSep] = useState(",");
46
+ const [decValue, setDecimalvalue] = useState('');
47
+ const [theCurrDec, setCurrDec] = useState('.');
48
+ const [theCurrSep, setCurrSep] = useState(',');
38
49
 
39
50
  useEffect(() => {
40
51
  const theSymbols = getCurrencyCharacters(currencyISOCode);
@@ -54,7 +65,7 @@ export default function Decimal(props) {
54
65
  }
55
66
 
56
67
  if (displayMode === 'STACKED_LARGE_VAL') {
57
- return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
68
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant="stacked" />;
58
69
  }
59
70
 
60
71
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
@@ -83,8 +94,8 @@ export default function Decimal(props) {
83
94
  fullWidth
84
95
  variant={readOnly ? 'standard' : 'outlined'}
85
96
  helperText={helperTextToDisplay}
86
- placeholder=''
87
- size='small'
97
+ placeholder=""
98
+ size="small"
88
99
  required={required}
89
100
  disabled={disabled}
90
101
  onChange={decimalOnChange}
@@ -92,11 +103,11 @@ export default function Decimal(props) {
92
103
  error={status === 'error'}
93
104
  label={label}
94
105
  value={decValue}
95
- type='text'
96
- outputFormat='number'
97
- textAlign='left'
106
+ type="text"
107
+ outputFormat="number"
108
+ textAlign="left"
98
109
  InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: decValue } }}
99
- currencySymbol=''
110
+ currencySymbol=""
100
111
  decimalCharacter={theCurrDec}
101
112
  digitGroupSeparator={showGroupSeparators ? theCurrSep : ''}
102
113
  decimalPlaces={decimalPrecision}
@@ -3,14 +3,31 @@ import { TextField } from '@material-ui/core';
3
3
  import MenuItem from '@material-ui/core/MenuItem';
4
4
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ // import type { PConnFieldProps } from '../../../types/PConnProps';
7
8
 
8
9
  interface IOption {
9
10
  key: string;
10
11
  value: string;
11
12
  }
12
13
 
13
- export default function Dropdown(props) {
14
+ // Can't use DropdownProps with 8.23 until getLocaleRuleNameFromKeys is NOT private
15
+ // interface DropdownProps extends PConnFieldProps {
16
+ // // If any, enter additional props that only exist on Dropdown here
17
+ // datasource?: Array<any>,
18
+ // onRecordChange?: any,
19
+ // fieldMetadata?: any,
20
+ // // eslint-disable-next-line react/no-unused-prop-types
21
+ // listType: string,
22
+ // // eslint-disable-next-line react/no-unused-prop-types
23
+ // additionalProps?: object
24
+ // }
25
+
26
+
27
+ export default function Dropdown(props /* : DropdownProps */) {
28
+ // Get emitted components from map (so we can get any override that may exist)
29
+ const FieldValueList = getComponentFromMap('FieldValueList');
30
+
14
31
  const {
15
32
  getPConnect,
16
33
  label,
@@ -28,27 +45,28 @@ export default function Dropdown(props) {
28
45
  onRecordChange,
29
46
  fieldMetadata
30
47
  } = props;
31
- let { placeholder } = props;
48
+ let { placeholder = "" } = props;
32
49
  placeholder = placeholder || 'Select...';
33
50
  const [options, setOptions] = useState<Array<IOption>>([]);
34
51
  const helperTextToDisplay = validatemessage || helperText;
35
52
 
36
53
  const thePConn = getPConnect();
37
54
  const actionsApi = thePConn.getActionsApi();
38
- const propName = thePConn.getStateProps().value;
55
+ const propName = thePConn.getStateProps()["value"];
39
56
  const className = thePConn.getCaseInfo().getClassName();
40
57
  const refName = propName?.slice(propName.lastIndexOf('.') + 1);
41
58
 
42
59
  useEffect(() => {
43
- const list = Utils.getOptionList(props, getPConnect().getDataObject());
60
+ const list = Utils.getOptionList(props, getPConnect().getDataObject('')); // 1st arg empty string until typedef marked correctly
44
61
  const optionsList = [...list];
45
- optionsList.unshift({ key: placeholder, value: thePConn.getLocalizedValue(placeholder) });
62
+ optionsList.unshift({
63
+ key: placeholder,
64
+ value: thePConn.getLocalizedValue(placeholder, '', '')
65
+ }); // 2nd and 3rd args empty string until typedef marked correctly
46
66
  setOptions(optionsList);
47
67
  }, [datasource]);
48
68
 
49
- const metaData = Array.isArray(fieldMetadata)
50
- ? fieldMetadata.filter(field => field?.classID === className)[0]
51
- : fieldMetadata;
69
+ const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter((field) => field?.classID === className)[0] : fieldMetadata;
52
70
 
53
71
  let displayName = metaData?.datasource?.propertyForDisplayText;
54
72
  displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
@@ -63,11 +81,7 @@ export default function Dropdown(props) {
63
81
  return (
64
82
  <FieldValueList
65
83
  name={hideLabel ? '' : label}
66
- value={thePConn.getLocalizedValue(
67
- value,
68
- localePath,
69
- thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
70
- )}
84
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
71
85
  />
72
86
  );
73
87
  }
@@ -76,12 +90,8 @@ export default function Dropdown(props) {
76
90
  return (
77
91
  <FieldValueList
78
92
  name={hideLabel ? '' : label}
79
- value={thePConn.getLocalizedValue(
80
- value,
81
- localePath,
82
- thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
83
- )}
84
- variant='stacked'
93
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
94
+ variant="stacked"
85
95
  />
86
96
  );
87
97
  }
@@ -96,7 +106,7 @@ export default function Dropdown(props) {
96
106
  'data-test-id': testId
97
107
  };
98
108
 
99
- const handleChange = evt => {
109
+ const handleChange = (evt) => {
100
110
  const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;
101
111
  handleEvent(actionsApi, 'changeNblur', propName, selectedValue);
102
112
  if (onRecordChange) {
@@ -111,8 +121,8 @@ export default function Dropdown(props) {
111
121
  fullWidth
112
122
  variant={readOnly ? 'standard' : 'outlined'}
113
123
  helperText={helperTextToDisplay}
114
- placeholder={thePConn.getLocalizedValue(placeholder)}
115
- size='small'
124
+ placeholder={thePConn.getLocalizedValue(placeholder, '', '')} // 2nd and 3rd args empty string until typedef marked correctly
125
+ size="small"
116
126
  required={required}
117
127
  disabled={disabled}
118
128
  onChange={!readOnly ? handleChange : undefined}
@@ -124,11 +134,7 @@ export default function Dropdown(props) {
124
134
  >
125
135
  {options.map((option: any) => (
126
136
  <MenuItem key={option.key} value={option.key}>
127
- {thePConn.getLocalizedValue(
128
- option.value,
129
- localePath,
130
- thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
131
- )}
137
+ {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
132
138
  </MenuItem>
133
139
  ))}
134
140
  </TextField>
@@ -1,10 +1,18 @@
1
1
  import React from 'react';
2
2
  import { TextField, InputAdornment } from '@material-ui/core';
3
3
  import MailOutlineIcon from '@material-ui/icons/MailOutline';
4
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
5
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+
7
+ interface EmailProps extends PConnFieldProps {
8
+ // If any, enter additional props that only exist on Date here
9
+ }
10
+
11
+ export default function Email(props: EmailProps) {
12
+ // Get emitted components from map (so we can get any override that may exist)
13
+ const TextInput = getComponentFromMap('TextInput');
14
+ const FieldValueList = getComponentFromMap('FieldValueList');
6
15
 
7
- export default function Email(props) {
8
16
  const {
9
17
  label,
10
18
  required,
@@ -27,7 +35,7 @@ export default function Email(props) {
27
35
  }
28
36
 
29
37
  if (displayMode === 'STACKED_LARGE_VAL') {
30
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
38
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
31
39
  }
32
40
 
33
41
  if (readOnly) {
@@ -43,10 +51,10 @@ export default function Email(props) {
43
51
  return (
44
52
  <TextField
45
53
  fullWidth
46
- variant='outlined'
54
+ variant="outlined"
47
55
  helperText={helperTextToDisplay}
48
- placeholder=''
49
- size='small'
56
+ placeholder=""
57
+ size="small"
50
58
  required={required}
51
59
  disabled={disabled}
52
60
  onChange={onChange}
@@ -54,10 +62,10 @@ export default function Email(props) {
54
62
  error={status === 'error'}
55
63
  label={label}
56
64
  value={value}
57
- type='email'
65
+ type="email"
58
66
  InputProps={{
59
67
  startAdornment: (
60
- <InputAdornment position='start'>
68
+ <InputAdornment position="start">
61
69
  <MailOutlineIcon />
62
70
  </InputAdornment>
63
71
  ),