@pega/react-sdk-overrides 0.23.26 → 8.8.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
  2. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  3. package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
  9. package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
  12. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  13. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
  14. package/lib/field/AutoComplete/AutoComplete.tsx +37 -18
  15. package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
  16. package/lib/field/Checkbox/Checkbox.tsx +41 -17
  17. package/lib/field/Currency/Currency.tsx +23 -15
  18. package/lib/field/Currency/currency-utils.ts +1 -2
  19. package/lib/field/Date/Date.tsx +31 -17
  20. package/lib/field/DateTime/DateTime.tsx +26 -15
  21. package/lib/field/Decimal/Decimal.tsx +82 -19
  22. package/lib/field/Dropdown/Dropdown.tsx +57 -14
  23. package/lib/field/Email/Email.tsx +17 -9
  24. package/lib/field/Integer/Integer.tsx +15 -7
  25. package/lib/field/Percentage/Percentage.tsx +15 -7
  26. package/lib/field/Phone/Phone.tsx +21 -12
  27. package/lib/field/RadioButtons/RadioButtons.tsx +54 -27
  28. package/lib/field/RichText/RichText.tsx +93 -0
  29. package/lib/field/RichText/index.tsx +1 -0
  30. package/lib/field/ScalarList/ScalarList.tsx +64 -0
  31. package/lib/field/ScalarList/config-ext.json +8 -0
  32. package/lib/field/ScalarList/index.tsx +1 -0
  33. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  34. package/lib/field/SemanticLink/utils.ts +2 -1
  35. package/lib/field/TextArea/TextArea.tsx +14 -5
  36. package/lib/field/TextContent/TextContent.tsx +10 -1
  37. package/lib/field/TextInput/TextInput.tsx +40 -11
  38. package/lib/field/Time/Time.tsx +29 -26
  39. package/lib/field/URL/URL.tsx +24 -8
  40. package/lib/field/UserReference/UserReference.tsx +52 -60
  41. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
  42. package/lib/helpers/auth.js +741 -390
  43. package/lib/helpers/authManager.ts +933 -0
  44. package/lib/helpers/case-utils.tsx +103 -0
  45. package/lib/helpers/common-utils.ts +4 -0
  46. package/lib/helpers/config_access.js +63 -145
  47. package/lib/helpers/data_page.ts +2 -1
  48. package/lib/helpers/date-format-utils.ts +29 -19
  49. package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
  50. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
  51. package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
  52. package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
  53. package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
  54. package/lib/helpers/formatters/{common.js → common.ts} +4 -4
  55. package/lib/helpers/formatters/{index.js → index.ts} +3 -3
  56. package/lib/helpers/simpleTableHelpers.ts +10 -6
  57. package/lib/helpers/state-utils.tsx +47 -0
  58. package/lib/helpers/template-utils.ts +3 -4
  59. package/lib/helpers/utils.ts +12 -4
  60. package/lib/helpers/versionHelpers.ts +0 -1
  61. package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
  62. package/lib/infra/Assignment/Assignment.tsx +38 -32
  63. package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
  64. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
  65. package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
  66. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -27
  67. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +19 -28
  68. package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
  69. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -1
  70. package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
  71. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +20 -19
  72. package/lib/infra/MultiStep/MultiStep.tsx +24 -24
  73. package/lib/infra/NavBar/NavBar.tsx +23 -24
  74. package/lib/infra/Reference/Reference.tsx +13 -18
  75. package/lib/infra/Region/Region.tsx +8 -6
  76. package/lib/infra/RootContainer/RootContainer.tsx +32 -39
  77. package/lib/infra/Stages/Stages.tsx +15 -9
  78. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
  79. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  80. package/lib/infra/View/View.tsx +28 -56
  81. package/lib/template/AppShell/AppShell.tsx +51 -34
  82. package/lib/template/BannerPage/BannerPage.tsx +26 -31
  83. package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
  84. package/lib/template/CaseView/CaseView.tsx +137 -100
  85. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
  86. package/lib/template/Confirmation/Confirmation.tsx +29 -52
  87. package/lib/template/DataReference/DataReference.tsx +50 -52
  88. package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
  89. package/lib/template/DefaultForm/utils/index.ts +33 -0
  90. package/lib/template/Details/Details/Details.tsx +16 -17
  91. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
  92. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
  93. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
  94. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
  95. package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
  96. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -17
  97. package/lib/template/ListPage/ListPage.tsx +14 -13
  98. package/lib/template/ListView/ListView.tsx +140 -152
  99. package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
  100. package/lib/template/ListView/{utils.js → utils.ts} +172 -23
  101. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
  102. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
  103. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
  104. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
  105. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  106. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
  107. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  108. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
  109. package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
  110. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
  111. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +28 -7
  112. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
  113. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +34 -36
  114. package/lib/template/SubTabs/SubTabs.tsx +10 -11
  115. package/lib/template/SubTabs/tabUtils.ts +0 -2
  116. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
  117. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  118. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
  119. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
  120. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
  121. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
  122. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
  123. package/lib/template/WssNavBar/WssNavBar.tsx +20 -3
  124. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
  125. package/lib/widget/Attachment/Attachment.css +15 -3
  126. package/lib/widget/Attachment/Attachment.tsx +51 -32
  127. package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
  128. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
  129. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
  130. package/lib/widget/Followers/Followers.tsx +10 -11
  131. package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
  132. package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
  133. package/lib/widget/SummaryList/SummaryList.tsx +17 -3
  134. package/lib/widget/ToDo/ToDo.tsx +69 -104
  135. package/package.json +1 -1
  136. package/lib/helpers/authManager.js +0 -631
  137. /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
  138. /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
  139. /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
@@ -1,53 +1,116 @@
1
- import React from 'react';
2
- import { TextField } from '@material-ui/core';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
1
+ import React, { useState, useEffect } from 'react';
2
+ import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
+ import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
4
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
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';
8
+
9
+ // Using control from: https://github.com/unicef/material-ui-currency-textfield
10
+
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');
5
21
 
6
- export default function Decimal(props) {
7
22
  const {
23
+ getPConnect,
8
24
  label,
9
25
  required,
10
26
  disabled,
11
27
  value = '',
12
28
  validatemessage,
13
29
  status,
14
- onChange,
15
- onBlur,
30
+ /* onChange, onBlur, */
16
31
  readOnly,
17
32
  helperText,
18
33
  displayMode,
19
- hideLabel
34
+ hideLabel,
35
+ currencyISOCode = 'USD',
36
+ decimalPrecision = 2,
37
+ showGroupSeparators = true,
38
+ testId
20
39
  } = props;
40
+
41
+ const pConn = getPConnect();
42
+ const actions = pConn.getActionsApi();
43
+ const propName = pConn.getStateProps().value;
21
44
  const helperTextToDisplay = validatemessage || helperText;
22
45
 
46
+ const [decValue, setDecimalvalue] = useState('');
47
+ const [theCurrDec, setCurrDec] = useState('.');
48
+ const [theCurrSep, setCurrSep] = useState(',');
49
+
50
+ useEffect(() => {
51
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
52
+ setCurrDec(theSymbols.theDecimalIndicator);
53
+ setCurrSep(theSymbols.theDigitGroupSeparator);
54
+ }, [currencyISOCode]);
55
+
56
+ useEffect(() => {
57
+ setDecimalvalue(value.toString());
58
+ }, [value]);
59
+
60
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
61
+ const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
62
+
23
63
  if (displayMode === 'LABELS_LEFT') {
24
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
64
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
25
65
  }
26
66
 
27
67
  if (displayMode === 'STACKED_LARGE_VAL') {
28
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
68
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant="stacked" />;
29
69
  }
30
70
 
71
+ let readOnlyProp = {}; // Note: empty if NOT ReadOnly
72
+
31
73
  if (readOnly) {
32
- return <TextInput {...props} />;
74
+ readOnlyProp = { readOnly: true };
75
+ }
76
+
77
+ let testProp = {};
78
+
79
+ testProp = {
80
+ 'data-test-id': testId
81
+ };
82
+
83
+ function decimalOnChange(event) {
84
+ // update internal value
85
+ setDecimalvalue(event?.target?.value);
86
+ }
87
+
88
+ function decimalOnBlur(event, inValue) {
89
+ handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
33
90
  }
34
91
 
35
92
  return (
36
- <TextField
93
+ <CurrencyTextField
37
94
  fullWidth
38
95
  variant={readOnly ? 'standard' : 'outlined'}
39
96
  helperText={helperTextToDisplay}
40
- placeholder=''
41
- size='small'
97
+ placeholder=""
98
+ size="small"
42
99
  required={required}
43
100
  disabled={disabled}
44
- onChange={onChange}
45
- onBlur={!readOnly ? onBlur : undefined}
101
+ onChange={decimalOnChange}
102
+ onBlur={!readOnly ? decimalOnBlur : undefined}
46
103
  error={status === 'error'}
47
104
  label={label}
48
- value={value}
49
- type='text'
50
- inputProps={{ inputMode: 'decimal', pattern: '[0-9]*' }}
105
+ value={decValue}
106
+ type="text"
107
+ outputFormat="number"
108
+ textAlign="left"
109
+ InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: decValue } }}
110
+ currencySymbol=""
111
+ decimalCharacter={theCurrDec}
112
+ digitGroupSeparator={showGroupSeparators ? theCurrSep : ''}
113
+ decimalPlaces={decimalPrecision}
51
114
  />
52
115
  );
53
116
  }
@@ -3,20 +3,34 @@ 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 '@pega/react-sdk-components/lib/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
+ interface DropdownProps extends PConnFieldProps {
15
+ // If any, enter additional props that only exist on Dropdown here
16
+ datasource?: Array<any>;
17
+ onRecordChange?: any;
18
+ fieldMetadata?: any;
19
+ // eslint-disable-next-line react/no-unused-prop-types
20
+ listType: string;
21
+ // eslint-disable-next-line react/no-unused-prop-types
22
+ additionalProps?: object;
23
+ }
24
+
25
+ export default function Dropdown(props: DropdownProps) {
26
+ // Get emitted components from map (so we can get any override that may exist)
27
+ const FieldValueList = getComponentFromMap('FieldValueList');
28
+
14
29
  const {
15
30
  getPConnect,
16
31
  label,
17
32
  required,
18
33
  disabled,
19
- placeholder,
20
34
  value = '',
21
35
  datasource = [],
22
36
  validatemessage,
@@ -26,29 +40,58 @@ export default function Dropdown(props) {
26
40
  helperText,
27
41
  displayMode,
28
42
  hideLabel,
29
- onRecordChange
43
+ onRecordChange,
44
+ fieldMetadata
30
45
  } = props;
46
+ let { placeholder } = props;
47
+ placeholder = placeholder || 'Select...';
31
48
  const [options, setOptions] = useState<Array<IOption>>([]);
32
49
  const helperTextToDisplay = validatemessage || helperText;
33
50
 
34
51
  const thePConn = getPConnect();
35
52
  const actionsApi = thePConn.getActionsApi();
36
53
  const propName = thePConn.getStateProps().value;
54
+ const className = thePConn.getCaseInfo().getClassName();
55
+ const refName = propName?.slice(propName.lastIndexOf('.') + 1);
37
56
 
38
57
  useEffect(() => {
39
- const optionsList = Utils.getOptionList(props, getPConnect().getDataObject());
40
- optionsList.unshift({ key: 'Select', value: 'Select...' });
58
+ const list = Utils.getOptionList(props, getPConnect().getDataObject(thePConn.getContextName()));
59
+ const optionsList = [...list];
60
+ optionsList.unshift({
61
+ key: placeholder,
62
+ value: thePConn.getLocalizedValue(placeholder, '', '')
63
+ }); // 2nd and 3rd args empty string until typedef marked correctly
41
64
  setOptions(optionsList);
42
65
  }, [datasource]);
43
66
 
67
+ const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter((field) => field?.classID === className)[0] : fieldMetadata;
68
+
69
+ let displayName = metaData?.datasource?.propertyForDisplayText;
70
+ displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
71
+ const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
72
+ const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
73
+ const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;
74
+ const localePath = localeContext === 'datapage' ? displayName : localeName;
75
+
44
76
  let readOnlyProp = {};
45
77
 
46
78
  if (displayMode === 'LABELS_LEFT') {
47
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
79
+ return (
80
+ <FieldValueList
81
+ name={hideLabel ? '' : label}
82
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
83
+ />
84
+ );
48
85
  }
49
86
 
50
87
  if (displayMode === 'STACKED_LARGE_VAL') {
51
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
88
+ return (
89
+ <FieldValueList
90
+ name={hideLabel ? '' : label}
91
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
92
+ variant="stacked"
93
+ />
94
+ );
52
95
  }
53
96
 
54
97
  if (readOnly) {
@@ -61,8 +104,8 @@ export default function Dropdown(props) {
61
104
  'data-test-id': testId
62
105
  };
63
106
 
64
- const handleChange = evt => {
65
- const selectedValue = evt.target.value === 'Select' ? '' : evt.target.value;
107
+ const handleChange = (evt) => {
108
+ const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;
66
109
  handleEvent(actionsApi, 'changeNblur', propName, selectedValue);
67
110
  if (onRecordChange) {
68
111
  onRecordChange(evt);
@@ -76,20 +119,20 @@ export default function Dropdown(props) {
76
119
  fullWidth
77
120
  variant={readOnly ? 'standard' : 'outlined'}
78
121
  helperText={helperTextToDisplay}
79
- placeholder={placeholder}
80
- size='small'
122
+ placeholder={thePConn.getLocalizedValue(placeholder, '', '')} // 2nd and 3rd args empty string until typedef marked correctly
123
+ size="small"
81
124
  required={required}
82
125
  disabled={disabled}
83
126
  onChange={!readOnly ? handleChange : undefined}
84
127
  error={status === 'error'}
85
128
  label={label}
86
- value={value === '' && !readOnly ? 'Select' : value}
129
+ value={value === '' && !readOnly ? placeholder : value}
87
130
  select
88
131
  InputProps={{ ...readOnlyProp, ...testProp }}
89
132
  >
90
133
  {options.map((option: any) => (
91
134
  <MenuItem key={option.key} value={option.key}>
92
- {option.value}
135
+ {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
93
136
  </MenuItem>
94
137
  ))}
95
138
  </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
  ),
@@ -1,9 +1,17 @@
1
1
  import React from 'react';
2
2
  import { TextField } from '@material-ui/core';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
3
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+
6
+ interface IntegerProps extends PConnFieldProps {
7
+ // If any, enter additional props that only exist on Integer here
8
+ }
9
+
10
+ export default function Integer(props: IntegerProps) {
11
+ // Get emitted components from map (so we can get any override that may exist)
12
+ const TextInput = getComponentFromMap('TextInput');
13
+ const FieldValueList = getComponentFromMap('FieldValueList');
5
14
 
6
- export default function Integer(props) {
7
15
  const {
8
16
  label,
9
17
  required,
@@ -28,7 +36,7 @@ export default function Integer(props) {
28
36
  }
29
37
 
30
38
  if (displayMode === 'STACKED_LARGE_VAL') {
31
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
39
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
32
40
  }
33
41
 
34
42
  if (readOnly) {
@@ -63,8 +71,8 @@ export default function Integer(props) {
63
71
  fullWidth
64
72
  variant={readOnly ? 'standard' : 'outlined'}
65
73
  helperText={helperTextToDisplay}
66
- placeholder=''
67
- size='small'
74
+ placeholder=""
75
+ size="small"
68
76
  required={required}
69
77
  disabled={disabled}
70
78
  onChange={intOnChange}
@@ -72,7 +80,7 @@ export default function Integer(props) {
72
80
  error={status === 'error'}
73
81
  label={label}
74
82
  value={value}
75
- type='text'
83
+ type="text"
76
84
  inputProps={{ inputMode: 'numeric', pattern: '[0-9]*', ...testProp }}
77
85
  />
78
86
  );
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { TextField } from '@material-ui/core';
3
3
  import { makeStyles } from '@material-ui/core/styles';
4
4
 
5
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
6
- 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 type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
 
8
8
  // Inspired by https://stackoverflow.com/questions/50823182/material-ui-remove-up-down-arrow-dials-from-textview
9
9
  const useStyles = makeStyles((/* theme */) => ({
@@ -22,7 +22,15 @@ const useStyles = makeStyles((/* theme */) => ({
22
22
  }
23
23
  }));
24
24
 
25
- export default function Percentage(props) {
25
+ interface PercentageProps extends PConnFieldProps {
26
+ // If any, enter additional props that only exist on Percentage here
27
+ }
28
+
29
+ export default function Percentage(props: PercentageProps) {
30
+ // Get emitted components from map (so we can get any override that may exist)
31
+ const TextInput = getComponentFromMap('TextInput');
32
+ const FieldValueList = getComponentFromMap('FieldValueList');
33
+
26
34
  const classes = useStyles();
27
35
 
28
36
  const {
@@ -49,7 +57,7 @@ export default function Percentage(props) {
49
57
  }
50
58
 
51
59
  if (displayMode === 'STACKED_LARGE_VAL') {
52
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
60
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
53
61
  }
54
62
 
55
63
  if (readOnly) {
@@ -68,8 +76,8 @@ export default function Percentage(props) {
68
76
  fullWidth
69
77
  variant={readOnly ? 'standard' : 'outlined'}
70
78
  helperText={helperTextToDisplay}
71
- placeholder=''
72
- size='small'
79
+ placeholder=""
80
+ size="small"
73
81
  required={required}
74
82
  disabled={disabled}
75
83
  onChange={onChange}
@@ -77,7 +85,7 @@ export default function Percentage(props) {
77
85
  error={status === 'error'}
78
86
  label={label}
79
87
  value={value}
80
- type='number'
88
+ type="number"
81
89
  inputProps={{ ...testProp }}
82
90
  />
83
91
  );
@@ -1,8 +1,16 @@
1
1
  import React from 'react';
2
2
  import MuiPhoneNumber from 'material-ui-phone-number';
3
- import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
3
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+
6
+ interface PhoneProps extends PConnFieldProps {
7
+ // If any, enter additional props that only exist on Phone here
8
+ }
9
+
10
+ export default function Phone(props: PhoneProps) {
11
+ // Get emitted components from map (so we can get any override that may exist)
12
+ const FieldValueList = getComponentFromMap('FieldValueList');
4
13
 
5
- export default function Phone(props) {
6
14
  const {
7
15
  label,
8
16
  required,
@@ -31,7 +39,7 @@ export default function Phone(props) {
31
39
  }
32
40
 
33
41
  if (displayMode === 'STACKED_LARGE_VAL') {
34
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
42
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
35
43
  }
36
44
 
37
45
  if (readOnly) {
@@ -41,8 +49,8 @@ export default function Phone(props) {
41
49
  <MuiPhoneNumber
42
50
  fullWidth
43
51
  helperText={helperTextToDisplay}
44
- placeholder=''
45
- size='small'
52
+ placeholder=""
53
+ size="small"
46
54
  required={required}
47
55
  disabled={disabled}
48
56
  onChange={onChange}
@@ -50,7 +58,8 @@ export default function Phone(props) {
50
58
  label={label}
51
59
  value={value}
52
60
  InputProps={{
53
- readOnly: true
61
+ readOnly: true,
62
+ inputProps: { ...testProp }
54
63
  }}
55
64
  disableDropdown={disableDropdown}
56
65
  />
@@ -58,13 +67,13 @@ export default function Phone(props) {
58
67
  );
59
68
  }
60
69
 
61
- const handleChange = inputVal => {
70
+ const handleChange = (inputVal) => {
62
71
  let phoneValue = inputVal && inputVal.replace(/\D+/g, '');
63
72
  phoneValue = `+${phoneValue}`;
64
73
  onChange({ value: phoneValue });
65
74
  };
66
75
 
67
- const handleBlur = event => {
76
+ const handleBlur = (event) => {
68
77
  const phoneValue = event?.target?.value;
69
78
  event.target.value = `+${phoneValue && phoneValue.replace(/\D+/g, '')}`;
70
79
  onBlur(event);
@@ -73,11 +82,11 @@ export default function Phone(props) {
73
82
  return (
74
83
  <MuiPhoneNumber
75
84
  fullWidth
76
- variant='outlined'
85
+ variant="outlined"
77
86
  helperText={helperTextToDisplay}
78
- placeholder=''
79
- size='small'
80
- defaultCountry='us'
87
+ placeholder=""
88
+ size="small"
89
+ defaultCountry="us"
81
90
  required={required}
82
91
  disabled={disabled}
83
92
  onChange={handleChange}
@@ -1,18 +1,21 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import {
3
- Radio,
4
- RadioGroup,
5
- FormControl,
6
- FormControlLabel,
7
- FormLabel,
8
- FormHelperText
9
- } from '@material-ui/core';
2
+ import { Radio, RadioGroup, FormControl, FormControlLabel, FormLabel, FormHelperText } from '@material-ui/core';
10
3
 
11
4
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
12
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
13
- 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 '@pega/react-sdk-components/lib/types/PConnProps';
8
+
9
+ interface RadioButtonsProps extends PConnFieldProps {
10
+ // If any, enter additional props that only exist on RadioButtons here
11
+ inline: boolean;
12
+ fieldMetadata?: any;
13
+ }
14
+
15
+ export default function RadioButtons(props: RadioButtonsProps) {
16
+ // Get emitted components from map (so we can get any override that may exist)
17
+ const FieldValueList = getComponentFromMap('FieldValueList');
14
18
 
15
- export default function RadioButtons(props) {
16
19
  const {
17
20
  getPConnect,
18
21
  label,
@@ -24,7 +27,8 @@ export default function RadioButtons(props) {
24
27
  required,
25
28
  inline,
26
29
  displayMode,
27
- hideLabel
30
+ hideLabel,
31
+ fieldMetadata
28
32
  } = props;
29
33
  const [theSelectedButton, setSelectedButton] = useState(value);
30
34
 
@@ -33,10 +37,23 @@ export default function RadioButtons(props) {
33
37
  const actionsApi = thePConn.getActionsApi();
34
38
  const propName = thePConn.getStateProps().value;
35
39
  const helperTextToDisplay = validatemessage || helperText;
40
+ const className = thePConn.getCaseInfo().getClassName();
41
+
42
+ let configProperty = thePConn.getRawMetadata()?.config?.value || '';
43
+ configProperty = configProperty.startsWith('@P') ? configProperty.substring(3) : configProperty;
44
+ configProperty = configProperty.startsWith('.') ? configProperty.substring(1) : configProperty;
45
+
46
+ const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter((field) => field?.classID === className)[0] : fieldMetadata;
47
+ let displayName = metaData?.datasource?.propertyForDisplayText;
48
+ displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
49
+ const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
50
+ const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
51
+ const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : configProperty;
52
+ const localePath = localeContext === 'datapage' ? displayName : localeName;
36
53
 
37
54
  // theOptions will be an array of JSON objects that are literally key/value pairs.
38
55
  // Ex: [ {key: "Basic", value: "Basic"} ]
39
- const theOptions = Utils.getOptionList(theConfigProps, thePConn.getDataObject());
56
+ const theOptions = Utils.getOptionList(theConfigProps, thePConn.getDataObject(thePConn.getContextName()));
40
57
 
41
58
  useEffect(() => {
42
59
  // This update theSelectedButton which will update the UI to show the selected button correctly
@@ -44,37 +61,47 @@ export default function RadioButtons(props) {
44
61
  }, [value]);
45
62
 
46
63
  if (displayMode === 'LABELS_LEFT') {
47
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
64
+ return (
65
+ <FieldValueList
66
+ name={hideLabel ? '' : label}
67
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
68
+ />
69
+ );
48
70
  }
49
71
 
50
72
  if (displayMode === 'STACKED_LARGE_VAL') {
51
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
73
+ return (
74
+ <FieldValueList
75
+ name={hideLabel ? '' : label}
76
+ value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
77
+ variant="stacked"
78
+ />
79
+ );
52
80
  }
53
81
 
54
- const handleChange = event => {
82
+ const handleChange = (event) => {
55
83
  handleEvent(actionsApi, 'changeNblur', propName, event.target.value);
56
84
  };
57
85
 
58
- const handleBlur = event => {
59
- thePConn.getValidationApi().validate(event.target.value);
86
+ const handleBlur = (event) => {
87
+ thePConn.getValidationApi().validate(event.target.value, ''); // 2nd arg empty string until typedef marked correctly as optional
60
88
  };
61
89
 
62
90
  return (
63
91
  <FormControl error={status === 'error'} required={required}>
64
- <FormLabel component='legend'>{label}</FormLabel>
65
- <RadioGroup
66
- value={theSelectedButton}
67
- onChange={handleChange}
68
- onBlur={!readOnly ? handleBlur : undefined}
69
- row={inline}
70
- >
71
- {theOptions.map(theOption => {
92
+ <FormLabel component="legend">{label}</FormLabel>
93
+ <RadioGroup value={theSelectedButton} onChange={handleChange} onBlur={!readOnly ? handleBlur : undefined} row={inline}>
94
+ {theOptions.map((theOption) => {
72
95
  return (
73
96
  <FormControlLabel
74
97
  value={theOption.key}
75
98
  key={theOption.key}
76
- label={theOption.value}
77
- control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
99
+ label={thePConn.getLocalizedValue(
100
+ theOption.value,
101
+ localePath,
102
+ thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
103
+ )}
104
+ control={<Radio key={theOption.key} color="primary" disabled={readOnly} />}
78
105
  />
79
106
  );
80
107
  })}