@pega/react-sdk-overrides 8.23.10 → 8.23.11-debug2

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 (84) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +43 -0
  2. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  3. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +1 -3
  4. package/lib/designSystemExtension/Operator/Operator.tsx +16 -11
  5. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +2 -2
  6. package/lib/field/CancelAlert/CancelAlert.tsx +12 -8
  7. package/lib/field/Checkbox/Checkbox.tsx +3 -2
  8. package/lib/field/Currency/currency-utils.ts +4 -1
  9. package/lib/field/Date/Date.tsx +12 -5
  10. package/lib/field/DateTime/DateTime.tsx +1 -1
  11. package/lib/field/Decimal/Decimal.tsx +66 -14
  12. package/lib/field/Dropdown/Dropdown.tsx +49 -10
  13. package/lib/field/Phone/Phone.tsx +2 -1
  14. package/lib/field/RadioButtons/RadioButtons.tsx +43 -4
  15. package/lib/field/SemanticLink/utils.ts +2 -1
  16. package/lib/field/TextInput/TextInput.tsx +26 -6
  17. package/lib/field/Time/Time.tsx +9 -1
  18. package/lib/field/URL/URL.tsx +8 -0
  19. package/lib/field/UserReference/UserReference.tsx +2 -0
  20. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +2 -2
  21. package/lib/helpers/auth.js +12 -3
  22. package/lib/helpers/authManager.js +16 -13
  23. package/lib/helpers/case-utils.tsx +104 -0
  24. package/lib/helpers/common-utils.ts +4 -0
  25. package/lib/helpers/config_access.js +122 -131
  26. package/lib/helpers/data_page.ts +2 -1
  27. package/lib/helpers/date-format-utils.ts +28 -18
  28. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
  29. package/lib/helpers/formatters/{Currency.js → Currency.ts} +4 -3
  30. package/lib/helpers/formatters/{Date.js → Date.ts} +1 -1
  31. package/lib/helpers/formatters/common.ts +18 -0
  32. package/lib/helpers/simpleTableHelpers.ts +6 -2
  33. package/lib/helpers/state-utils.tsx +50 -0
  34. package/lib/helpers/template-utils.ts +3 -1
  35. package/lib/helpers/utils.ts +12 -4
  36. package/lib/helpers/versionHelpers.ts +3 -1
  37. package/lib/infra/ActionButtons/ActionButtons.tsx +7 -2
  38. package/lib/infra/Assignment/Assignment.tsx +23 -10
  39. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +24 -11
  40. package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +21 -16
  41. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +28 -9
  42. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +7 -5
  43. package/lib/infra/DashboardFilter/DashboardFilter.tsx +5 -1
  44. package/lib/infra/DashboardFilter/filterUtils.tsx +2 -0
  45. package/lib/infra/DeferLoad/DeferLoad.tsx +4 -1
  46. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +10 -5
  47. package/lib/infra/MultiStep/MultiStep.tsx +2 -2
  48. package/lib/infra/NavBar/NavBar.tsx +11 -5
  49. package/lib/infra/RootContainer/RootContainer.tsx +16 -14
  50. package/lib/infra/Stages/Stages.tsx +5 -1
  51. package/lib/infra/View/View.tsx +7 -34
  52. package/lib/template/AppShell/AppShell.tsx +15 -9
  53. package/lib/template/CaseView/CaseView.tsx +116 -78
  54. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +26 -17
  55. package/lib/template/Confirmation/Confirmation.tsx +4 -1
  56. package/lib/template/DataReference/DataReference.tsx +2 -0
  57. package/lib/template/DefaultForm/DefaultForm.tsx +15 -8
  58. package/lib/template/DefaultForm/utils/index.ts +33 -0
  59. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +5 -2
  60. package/lib/template/ListView/ListView.tsx +3 -1
  61. package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
  62. package/lib/template/ListView/{utils.js → utils.ts} +12 -10
  63. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +5 -1
  64. package/lib/template/PromotedFilters/PromotedFilters.tsx +9 -5
  65. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +4 -1
  66. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +8 -4
  67. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +6 -1
  68. package/lib/template/SubTabs/tabUtils.ts +3 -1
  69. package/lib/template/WssNavBar/WssNavBar.tsx +2 -2
  70. package/lib/widget/Attachment/Attachment.css +15 -3
  71. package/lib/widget/Attachment/Attachment.tsx +32 -25
  72. package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
  73. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +20 -19
  74. package/lib/widget/QuickCreate/QuickCreate.tsx +6 -3
  75. package/lib/widget/SummaryItem/SummaryItem.tsx +2 -4
  76. package/lib/widget/ToDo/ToDo.tsx +17 -9
  77. package/package.json +1 -1
  78. package/lib/helpers/formatters/common.js +0 -14
  79. /package/lib/helpers/{event-utils.js → event-utils.ts} +0 -0
  80. /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
  81. /package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +0 -0
  82. /package/lib/helpers/formatters/{index.js → index.ts} +0 -0
  83. /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
  84. /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Alert } from '@material-ui/lab';
4
+
5
+ const SEVERITY_MAP = {
6
+ urgent: 'error',
7
+ warning: 'warning',
8
+ success: 'success',
9
+ info: 'info'
10
+ };
11
+
12
+ export default function AlertBanner(props) {
13
+ const { id, variant, messages, onDismiss } = props;
14
+ let additionalProps = {};
15
+
16
+ if (onDismiss) {
17
+ additionalProps = {
18
+ onClose: onDismiss
19
+ };
20
+ }
21
+
22
+ return (
23
+ <div id={id}>
24
+ {messages.map(message => (
25
+ <Alert
26
+ key={message}
27
+ variant='outlined'
28
+ severity={SEVERITY_MAP[variant]}
29
+ {...additionalProps}
30
+ >
31
+ {message}
32
+ </Alert>
33
+ ))}
34
+ </div>
35
+ );
36
+ }
37
+
38
+ AlertBanner.propTypes = {
39
+ id: PropTypes.string,
40
+ variant: PropTypes.string,
41
+ messages: PropTypes.arrayOf(PropTypes.string),
42
+ onDismiss: PropTypes.any
43
+ };
@@ -0,0 +1 @@
1
+ export { default } from './AlertBanner';
@@ -6,14 +6,12 @@ import Link from '@material-ui/core/Link';
6
6
 
7
7
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
8
8
 
9
- declare const PCore: any;
10
-
11
9
  const FieldGroupList = props => {
12
10
  let menuIconOverride$ = 'trash';
13
11
  if (menuIconOverride$) {
14
12
  menuIconOverride$ = Utils.getImageSrc(
15
13
  menuIconOverride$,
16
- PCore.getAssetLoader().getStaticServerUrl()
14
+ Utils.getSDKStaticConentUrl()
17
15
  );
18
16
  }
19
17
 
@@ -9,7 +9,10 @@ import { makeStyles } from '@material-ui/core/styles';
9
9
 
10
10
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
11
11
 
12
- declare const PCore: any;
12
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
13
+
14
+ declare const PCore: typeof PCoreType;
15
+
13
16
 
14
17
  const useStyles = makeStyles((theme) => ({
15
18
  root: {
@@ -59,6 +62,8 @@ export default function Operator(props) {
59
62
  function showOperatorDetails(event) {
60
63
 
61
64
  const operatorPreviewPromise = PCore.getUserApi().getOperatorDetails(caseOpId);
65
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
66
+ const localeCategory = 'Operator';
62
67
 
63
68
  operatorPreviewPromise.then((res) => {
64
69
  const fillerString = "---";
@@ -71,27 +76,27 @@ export default function Operator(props) {
71
76
  fields = [
72
77
  {
73
78
  id: "pyPosition",
74
- name: "Position",
79
+ name: localizedVal("Position", localeCategory),
75
80
  value: res.data.pyOperatorInfo.pyPosition ? res.data.pyOperatorInfo.pyPosition : fillerString
76
81
  },
77
82
  {
78
83
  id: "pyOrganization",
79
- name: "Organization",
84
+ name: localizedVal("Organization", localeCategory),
80
85
  value: res.data.pyOperatorInfo.pyOrganization ? res.data.pyOperatorInfo.pyOrganization : fillerString
81
86
  },
82
87
  {
83
88
  id: "ReportToUserName",
84
- name: "Reports to",
89
+ name: localizedVal('Reports to', localeCategory),
85
90
  value: res.data.pyOperatorInfo.pyReportToUserName ? res.data.pyOperatorInfo.pyReportToUserName : fillerString
86
91
  },
87
92
  {
88
93
  id: "pyTelephone",
89
- name: "Telephone",
94
+ name: localizedVal('Telephone', localeCategory),
90
95
  value: res.data.pyOperatorInfo.pyTelephone ? <a href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>{res.data.pyOperatorInfo.pyTelephone}</a> : fillerString
91
96
  },
92
97
  {
93
98
  id: "pyEmailAddress",
94
- name: "Email address",
99
+ name: localizedVal('Email address', localeCategory),
95
100
  value: res.data.pyOperatorInfo.pyEmailAddress ? <a href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>{res.data.pyOperatorInfo.pyEmailAddress}</a> : fillerString
96
101
  }
97
102
  ];
@@ -101,27 +106,27 @@ export default function Operator(props) {
101
106
  fields = [
102
107
  {
103
108
  id: "pyPosition",
104
- name: "Position",
109
+ name: localizedVal("Position", localeCategory),
105
110
  value: fillerString
106
111
  },
107
112
  {
108
113
  id: "pyOrganization",
109
- name: "Organization",
114
+ name: localizedVal("Organization", localeCategory),
110
115
  value: fillerString
111
116
  },
112
117
  {
113
118
  id: "ReportToUserName",
114
- name: "Reports to",
119
+ name: localizedVal('Reports to', localeCategory),
115
120
  value: fillerString
116
121
  },
117
122
  {
118
123
  id: "pyTelephone",
119
- name: "Telephone",
124
+ name: localizedVal('Telephone', localeCategory),
120
125
  value: fillerString
121
126
  },
122
127
  {
123
128
  id: "pyEmailAddress",
124
- name: "Email address",
129
+ name: localizedVal('Email address', localeCategory),
125
130
  value: fillerString
126
131
  }
127
132
  ];
@@ -7,8 +7,8 @@ export default function WssQuickCreate(props) {
7
7
 
8
8
  return (
9
9
  <div>
10
- <h1 className='quick-link-heading'>{heading}</h1>
11
- <ul className='quick-link-ul-list'>
10
+ <h1 id="quick-links-heading" className='quick-link-heading'>{heading}</h1>
11
+ <ul id="quick-links" className='quick-link-ul-list'>
12
12
  {actions &&
13
13
  actions.map(element => {
14
14
  return (
@@ -4,7 +4,9 @@ import CloseIcon from '@material-ui/icons/Close';
4
4
 
5
5
  import './CancelAlert.css';
6
6
 
7
- declare const PCore;
7
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
8
+ declare const PCore: any;
9
+
8
10
 
9
11
  const CancelAlert = props => {
10
12
  const { pConn, updateAlertState } = props;
@@ -15,6 +17,8 @@ const CancelAlert = props => {
15
17
  const caseInfo = pConn.getCaseInfo();
16
18
  const caseName = caseInfo.getName();
17
19
  const ID = caseInfo.getID();
20
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
21
+ const localeCategory = 'ModalContainer';
18
22
 
19
23
  function showToast(message: string) {
20
24
  setSnackbarMessage(message);
@@ -53,7 +57,7 @@ const CancelAlert = props => {
53
57
  );
54
58
  })
55
59
  .catch(() => {
56
- showToast('Save failed');
60
+ showToast(localizedVal('Save failed', localeCategory));
57
61
  });
58
62
  break;
59
63
 
@@ -71,7 +75,7 @@ const CancelAlert = props => {
71
75
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
72
76
  })
73
77
  .catch(() => {
74
- showToast('Delete failed.');
78
+ showToast(localizedVal('Delete failed.', localeCategory));
75
79
  });
76
80
  break;
77
81
 
@@ -86,22 +90,22 @@ const CancelAlert = props => {
86
90
  <div className='cancel-alert-top'>
87
91
  <h3>{`Delete ${caseName}(${ID})`}</h3>
88
92
  <div>
89
- <p>{`Are you sure you want to delete ${caseName} (${ID})?`}</p>
90
- <p>Alternatively, you can continue working or save your work for later.</p>
93
+ <p>{`${localizedVal('Are you sure you want to delete', localeCategory)} ${caseName} (${ID})?`}</p>
94
+ <p>{localizedVal('Alternatively, you can continue working or save your work for later.', localeCategory)}</p>
91
95
  </div>
92
96
  <div className='action-controls'>
93
97
  <Grid container spacing={4} justifyContent='space-between'>
94
98
  <Grid item>
95
99
  <Button variant='outlined' color='primary' onClick={() => buttonClick('save')}>
96
- Save for later
100
+ {localizedVal('Save for later', localeCategory)}
97
101
  </Button>
98
102
  </Grid>
99
103
  <Grid item>
100
104
  <Button variant='outlined' color='primary' onClick={() => buttonClick('continue')}>
101
- Continue Working
105
+ {localizedVal('Continue Working', localeCategory)}
102
106
  </Button>
103
107
  <Button variant='contained' color='primary' onClick={() => buttonClick('delete')}>
104
- Delete
108
+ {localizedVal('Delete', localeCategory)}
105
109
  </Button>
106
110
  </Grid>
107
111
  </Grid>
@@ -17,6 +17,7 @@ export default function CheckboxComponent(props) {
17
17
  readOnly,
18
18
  testId,
19
19
  required,
20
+ disabled,
20
21
  status,
21
22
  helperText,
22
23
  validatemessage,
@@ -53,12 +54,12 @@ export default function CheckboxComponent(props) {
53
54
  thePConn.getValidationApi().validate(event.target.checked);
54
55
  };
55
56
 
56
- let theCheckbox = <Checkbox color='primary' />;
57
+ let theCheckbox = <Checkbox color='primary' disabled={disabled} />;
57
58
 
58
59
  if (readOnly) {
59
60
  // Workaround for lack of InputProps readOnly from https://github.com/mui-org/material-ui/issues/17043
60
61
  // Also note that we need to turn off the onChange call in the FormControlLabel wrapper, too. See below!
61
- theCheckbox = <Checkbox value={value || false} onChange={handleChange} readOnly={readOnly} />;
62
+ theCheckbox = <Checkbox value={value || false} readOnly={readOnly} />;
62
63
  }
63
64
 
64
65
  return (
@@ -3,7 +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
- declare const PCore: any;
6
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
7
+
8
+ declare const PCore: typeof PCoreType;
9
+
7
10
 
8
11
  export const getCurrencyOptions = (inISOCode: string) => {
9
12
 
@@ -3,9 +3,14 @@ import { KeyboardDatePicker } from '@material-ui/pickers';
3
3
  import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
5
  import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
6
- import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters/';
6
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
7
  import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
8
8
 
9
+ // Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server
10
+ function getFormattedDate(date){
11
+ return `${date.$y.toString()}-${(date.$M + 1).toString().padStart(2, '0')}-${date.$D.toString().padStart(2, '0')}`;
12
+ }
13
+
9
14
  export default function Date(props) {
10
15
  const {
11
16
  getPConnect,
@@ -60,13 +65,15 @@ export default function Date(props) {
60
65
  };
61
66
 
62
67
  const handleChange = date => {
63
- const changeValue = date && date.isValid() ? date.toISOString() : null;
64
- onChange({ value: changeValue });
68
+ if(date && date.isValid()){
69
+ onChange({ value: getFormattedDate(date) });
70
+ }
65
71
  };
66
72
 
67
73
  const handleAccept = date => {
68
- const changeValue = date && date.isValid() ? date.toISOString() : null;
69
- handleEvent(actions, 'changeNblur', propName, changeValue);
74
+ if(date && date.isValid()){
75
+ handleEvent(actions, 'changeNblur', propName, getFormattedDate(date));
76
+ }
70
77
  };
71
78
 
72
79
  return (
@@ -3,7 +3,7 @@ import { KeyboardDateTimePicker } from '@material-ui/pickers';
3
3
  import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
5
  import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
6
- import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters/';
6
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
7
  import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
8
8
 
9
9
  export default function DateTime(props) {
@@ -1,39 +1,85 @@
1
- import React from 'react';
2
- import { TextField } from '@material-ui/core';
3
- import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
1
+ import React, { useState, useEffect } from 'react';
2
+ import CurrencyTextField from '@unicef/material-ui-currency-textfield';
4
3
  import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
4
+ import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
5
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
+ import { format } from "@pega/react-sdk-components/lib/components/helpers/formatters";
7
+
8
+ // Using control from: https://github.com/unicef/material-ui-currency-textfield
5
9
 
6
10
  export default function Decimal(props) {
7
11
  const {
12
+ getPConnect,
8
13
  label,
9
14
  required,
10
15
  disabled,
11
16
  value = '',
12
17
  validatemessage,
13
18
  status,
14
- onChange,
15
- onBlur,
19
+ /* onChange, onBlur, */
16
20
  readOnly,
17
21
  helperText,
18
22
  displayMode,
19
- hideLabel
23
+ hideLabel,
24
+ currencyISOCode = "USD",
25
+ decimalPrecision = 2,
26
+ showGroupSeparators = true,
27
+ testId
20
28
  } = props;
29
+
30
+ const pConn = getPConnect();
31
+ const actions = pConn.getActionsApi();
32
+ const propName = pConn.getStateProps().value;
21
33
  const helperTextToDisplay = validatemessage || helperText;
22
34
 
35
+ const [decValue, setDecimalvalue] = useState();
36
+ const [theCurrDec, setCurrDec] = useState(".");
37
+ const [theCurrSep, setCurrSep] = useState(",");
38
+
39
+ useEffect(() => {
40
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
41
+ setCurrDec(theSymbols.theDecimalIndicator);
42
+ setCurrSep(theSymbols.theDigitGroupSeparator);
43
+ }, [currencyISOCode]);
44
+
45
+ useEffect(() => {
46
+ setDecimalvalue(value.toString());
47
+ }, [value]);
48
+
49
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
50
+ const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
51
+
23
52
  if (displayMode === 'LABELS_LEFT') {
24
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
53
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
25
54
  }
26
55
 
27
56
  if (displayMode === 'STACKED_LARGE_VAL') {
28
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
57
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
29
58
  }
30
59
 
60
+ let readOnlyProp = {}; // Note: empty if NOT ReadOnly
61
+
31
62
  if (readOnly) {
32
- return <TextInput {...props} />;
63
+ readOnlyProp = { readOnly: true };
64
+ }
65
+
66
+ let testProp = {};
67
+
68
+ testProp = {
69
+ 'data-test-id': testId
70
+ };
71
+
72
+ function decimalOnChange(event) {
73
+ // update internal value
74
+ setDecimalvalue(event?.target?.value);
75
+ }
76
+
77
+ function decimalOnBlur(event, inValue) {
78
+ handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
33
79
  }
34
80
 
35
81
  return (
36
- <TextField
82
+ <CurrencyTextField
37
83
  fullWidth
38
84
  variant={readOnly ? 'standard' : 'outlined'}
39
85
  helperText={helperTextToDisplay}
@@ -41,13 +87,19 @@ export default function Decimal(props) {
41
87
  size='small'
42
88
  required={required}
43
89
  disabled={disabled}
44
- onChange={onChange}
45
- onBlur={!readOnly ? onBlur : undefined}
90
+ onChange={decimalOnChange}
91
+ onBlur={!readOnly ? decimalOnBlur : undefined}
46
92
  error={status === 'error'}
47
93
  label={label}
48
- value={value}
94
+ value={decValue}
49
95
  type='text'
50
- inputProps={{ inputMode: 'decimal', pattern: '[0-9]*' }}
96
+ outputFormat='number'
97
+ textAlign='left'
98
+ InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: decValue } }}
99
+ currencySymbol=''
100
+ decimalCharacter={theCurrDec}
101
+ digitGroupSeparator={showGroupSeparators ? theCurrSep : ''}
102
+ decimalPlaces={decimalPrecision}
51
103
  />
52
104
  );
53
105
  }
@@ -16,7 +16,6 @@ export default function Dropdown(props) {
16
16
  label,
17
17
  required,
18
18
  disabled,
19
- placeholder,
20
19
  value = '',
21
20
  datasource = [],
22
21
  validatemessage,
@@ -26,29 +25,65 @@ export default function Dropdown(props) {
26
25
  helperText,
27
26
  displayMode,
28
27
  hideLabel,
29
- onRecordChange
28
+ onRecordChange,
29
+ fieldMetadata
30
30
  } = props;
31
+ let { placeholder } = props;
32
+ placeholder = placeholder || 'Select...';
31
33
  const [options, setOptions] = useState<Array<IOption>>([]);
32
34
  const helperTextToDisplay = validatemessage || helperText;
33
35
 
34
36
  const thePConn = getPConnect();
35
37
  const actionsApi = thePConn.getActionsApi();
36
38
  const propName = thePConn.getStateProps().value;
39
+ const className = thePConn.getCaseInfo().getClassName();
40
+ const refName = propName?.slice(propName.lastIndexOf('.') + 1);
37
41
 
38
42
  useEffect(() => {
39
- const optionsList = Utils.getOptionList(props, getPConnect().getDataObject());
40
- optionsList.unshift({ key: 'Select', value: 'Select...' });
43
+ const list = Utils.getOptionList(props, getPConnect().getDataObject());
44
+ const optionsList = [...list];
45
+ optionsList.unshift({ key: placeholder, value: thePConn.getLocalizedValue(placeholder) });
41
46
  setOptions(optionsList);
42
47
  }, [datasource]);
43
48
 
49
+ const metaData = Array.isArray(fieldMetadata)
50
+ ? fieldMetadata.filter(field => field?.classID === className)[0]
51
+ : fieldMetadata;
52
+
53
+ let displayName = metaData?.datasource?.propertyForDisplayText;
54
+ displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
55
+ const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
56
+ const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
57
+ const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;
58
+ const localePath = localeContext === 'datapage' ? displayName : localeName;
59
+
44
60
  let readOnlyProp = {};
45
61
 
46
62
  if (displayMode === 'LABELS_LEFT') {
47
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
63
+ return (
64
+ <FieldValueList
65
+ name={hideLabel ? '' : label}
66
+ value={thePConn.getLocalizedValue(
67
+ value,
68
+ localePath,
69
+ thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
70
+ )}
71
+ />
72
+ );
48
73
  }
49
74
 
50
75
  if (displayMode === 'STACKED_LARGE_VAL') {
51
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
76
+ return (
77
+ <FieldValueList
78
+ name={hideLabel ? '' : label}
79
+ value={thePConn.getLocalizedValue(
80
+ value,
81
+ localePath,
82
+ thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
83
+ )}
84
+ variant='stacked'
85
+ />
86
+ );
52
87
  }
53
88
 
54
89
  if (readOnly) {
@@ -62,7 +97,7 @@ export default function Dropdown(props) {
62
97
  };
63
98
 
64
99
  const handleChange = evt => {
65
- const selectedValue = evt.target.value === 'Select' ? '' : evt.target.value;
100
+ const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;
66
101
  handleEvent(actionsApi, 'changeNblur', propName, selectedValue);
67
102
  if (onRecordChange) {
68
103
  onRecordChange(evt);
@@ -76,20 +111,24 @@ export default function Dropdown(props) {
76
111
  fullWidth
77
112
  variant={readOnly ? 'standard' : 'outlined'}
78
113
  helperText={helperTextToDisplay}
79
- placeholder={placeholder}
114
+ placeholder={thePConn.getLocalizedValue(placeholder)}
80
115
  size='small'
81
116
  required={required}
82
117
  disabled={disabled}
83
118
  onChange={!readOnly ? handleChange : undefined}
84
119
  error={status === 'error'}
85
120
  label={label}
86
- value={value === '' && !readOnly ? 'Select' : value}
121
+ value={value === '' && !readOnly ? placeholder : value}
87
122
  select
88
123
  InputProps={{ ...readOnlyProp, ...testProp }}
89
124
  >
90
125
  {options.map((option: any) => (
91
126
  <MenuItem key={option.key} value={option.key}>
92
- {option.value}
127
+ {thePConn.getLocalizedValue(
128
+ option.value,
129
+ localePath,
130
+ thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
131
+ )}
93
132
  </MenuItem>
94
133
  ))}
95
134
  </TextField>
@@ -50,7 +50,8 @@ export default function Phone(props) {
50
50
  label={label}
51
51
  value={value}
52
52
  InputProps={{
53
- readOnly: true
53
+ readOnly: true,
54
+ inputProps: { ...testProp }
54
55
  }}
55
56
  disableDropdown={disableDropdown}
56
57
  />
@@ -24,7 +24,8 @@ export default function RadioButtons(props) {
24
24
  required,
25
25
  inline,
26
26
  displayMode,
27
- hideLabel
27
+ hideLabel,
28
+ fieldMetadata
28
29
  } = props;
29
30
  const [theSelectedButton, setSelectedButton] = useState(value);
30
31
 
@@ -33,6 +34,21 @@ export default function RadioButtons(props) {
33
34
  const actionsApi = thePConn.getActionsApi();
34
35
  const propName = thePConn.getStateProps().value;
35
36
  const helperTextToDisplay = validatemessage || helperText;
37
+ const className = thePConn.getCaseInfo().getClassName();
38
+
39
+ let configProperty = thePConn.getRawMetadata()?.config?.value || '';
40
+ configProperty = configProperty.startsWith('@P') ? configProperty.substring(3) : configProperty;
41
+ configProperty = configProperty.startsWith('.') ? configProperty.substring(1) : configProperty;
42
+
43
+ const metaData = Array.isArray(fieldMetadata)
44
+ ? fieldMetadata.filter(field => field?.classID === className)[0]
45
+ : fieldMetadata;
46
+ let displayName = metaData?.datasource?.propertyForDisplayText;
47
+ displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
48
+ const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
49
+ const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
50
+ const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : configProperty;
51
+ const localePath = localeContext === 'datapage' ? displayName : localeName;
36
52
 
37
53
  // theOptions will be an array of JSON objects that are literally key/value pairs.
38
54
  // Ex: [ {key: "Basic", value: "Basic"} ]
@@ -44,11 +60,30 @@ export default function RadioButtons(props) {
44
60
  }, [value]);
45
61
 
46
62
  if (displayMode === 'LABELS_LEFT') {
47
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
63
+ return (
64
+ <FieldValueList
65
+ name={hideLabel ? '' : label}
66
+ value={thePConn.getLocalizedValue(
67
+ value,
68
+ localePath,
69
+ thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
70
+ )}
71
+ />
72
+ );
48
73
  }
49
74
 
50
75
  if (displayMode === 'STACKED_LARGE_VAL') {
51
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
76
+ return (
77
+ <FieldValueList
78
+ name={hideLabel ? '' : label}
79
+ value={thePConn.getLocalizedValue(
80
+ value,
81
+ localePath,
82
+ thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
83
+ )}
84
+ variant='stacked'
85
+ />
86
+ );
52
87
  }
53
88
 
54
89
  const handleChange = event => {
@@ -73,7 +108,11 @@ export default function RadioButtons(props) {
73
108
  <FormControlLabel
74
109
  value={theOption.key}
75
110
  key={theOption.key}
76
- label={theOption.value}
111
+ label={thePConn.getLocalizedValue(
112
+ theOption.value,
113
+ localePath,
114
+ thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
115
+ )}
77
116
  control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
78
117
  />
79
118
  );
@@ -1,4 +1,5 @@
1
- declare const PCore;
1
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
2
+ declare const PCore: any;
2
3
 
3
4
  function getDataReferenceInfo(pConnect, dataRelationshipContext) {
4
5
  if (!pConnect) {