@pega/react-sdk-overrides 0.23.37 → 0.24.1

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.
@@ -109,9 +109,9 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
109
109
  label={field.config.label}
110
110
  InputProps={{
111
111
  readOnly: true,
112
- disableUnderline: true,
113
112
  inputProps: {
114
- style: { cursor: 'pointer' }
113
+ style: { cursor: 'pointer' },
114
+ disableUnderline: true
115
115
  }
116
116
  }}
117
117
  />
@@ -1,18 +1,19 @@
1
- import CurrencyTextField from '@unicef/material-ui-currency-textfield';
2
-
1
+ import { TextField } from '@material-ui/core';
2
+ import { useState } from 'react';
3
+ import { NumericFormat } from 'react-number-format';
3
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
5
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
6
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
7
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
8
  import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
8
9
 
9
- /* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
10
+ /* Using react-number-format component here, since it allows formatting decimal values,
10
11
  as per the locale.
11
12
  */
12
-
13
13
  interface CurrrencyProps extends PConnFieldProps {
14
14
  // If any, enter additional props that only exist on Currency here
15
15
  currencyISOCode?: string;
16
+ allowDecimals: boolean;
16
17
  }
17
18
 
18
19
  export default function Currency(props: CurrrencyProps) {
@@ -34,15 +35,15 @@ export default function Currency(props: CurrrencyProps) {
34
35
  displayMode,
35
36
  hideLabel,
36
37
  currencyISOCode = 'USD',
37
- placeholder
38
+ placeholder,
39
+ allowDecimals
38
40
  } = props;
39
41
 
40
42
  const pConn = getPConnect();
41
43
  const actions = pConn.getActionsApi();
42
44
  const propName = (pConn.getStateProps() as any).value;
43
45
  const helperTextToDisplay = validatemessage || helperText;
44
-
45
- // console.log(`Currency: label: ${label} value: ${value}`);
46
+ const [values, setValues] = useState(value.toString());
46
47
 
47
48
  const testProp = {
48
49
  'data-test-id': testId
@@ -57,6 +58,15 @@ export default function Currency(props: CurrrencyProps) {
57
58
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
58
59
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
59
60
 
61
+ let readOnlyProp = {}; // Note: empty if NOT ReadOnly
62
+
63
+ if (readOnly) {
64
+ readOnlyProp = { readOnly: true };
65
+ }
66
+
67
+ let currencyProp = {};
68
+ currencyProp = { prefix: theCurrSym, decimalSeparator: theCurrDec, thousandSeparator: theCurrSep };
69
+
60
70
  if (displayMode === 'LABELS_LEFT') {
61
71
  return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
62
72
  }
@@ -65,34 +75,34 @@ export default function Currency(props: CurrrencyProps) {
65
75
  return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
66
76
  }
67
77
 
68
- function currOnBlur(event, inValue) {
69
- // console.log(`Currency currOnBlur inValue: ${inValue}`);
70
- handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
78
+ function currOnBlur() {
79
+ handleEvent(actions, 'changeNblur', propName, values);
71
80
  }
72
81
 
73
- // console.log(`theCurrSym: ${theCurrSym} | theCurrDec: ${theCurrDec} | theCurrSep: ${theCurrSep}`);
82
+ const handleChange = val => {
83
+ setValues(val.value);
84
+ };
74
85
 
75
86
  return (
76
- <CurrencyTextField
77
- fullWidth
78
- variant={readOnly ? 'standard' : 'outlined'}
87
+ <NumericFormat
88
+ valueIsNumericString
89
+ label={label}
79
90
  helperText={helperTextToDisplay}
80
91
  placeholder={placeholder ?? ''}
81
- size='small'
82
92
  required={required}
83
93
  disabled={disabled}
84
- readOnly={!!readOnly}
85
- error={status === 'error'}
86
- label={label}
87
- value={value}
88
- type='text'
89
- outputFormat='number'
90
- textAlign='left'
91
- InputProps={{ inputProps: { ...testProp } }}
92
- currencySymbol={theCurrSym}
93
- decimalCharacter={theCurrDec}
94
- digitGroupSeparator={theCurrSep}
94
+ onValueChange={val => {
95
+ handleChange(val);
96
+ }}
95
97
  onBlur={!readOnly ? currOnBlur : undefined}
98
+ error={status === 'error'}
99
+ name='numberformat'
100
+ value={values}
101
+ {...currencyProp}
102
+ decimalScale={allowDecimals !== false ? 2 : 0}
103
+ fixedDecimalScale={allowDecimals}
104
+ InputProps={{ ...readOnlyProp, inputProps: { ...testProp } }}
105
+ customInput={TextField}
96
106
  />
97
107
  );
98
108
  }
@@ -1,12 +1,13 @@
1
- import CurrencyTextField from '@unicef/material-ui-currency-textfield';
2
-
1
+ import { TextField } from '@material-ui/core';
2
+ import { NumericFormat } from 'react-number-format';
3
+ import { useState } from 'react';
3
4
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
4
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
6
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
6
7
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
8
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
9
 
9
- /* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
10
+ /* Using react-number-format component here, since it allows formatting decimal values,
10
11
  as per the locale.
11
12
  */
12
13
 
@@ -14,7 +15,7 @@ interface DecimalProps extends PConnFieldProps {
14
15
  // If any, enter additional props that only exist on Decimal here
15
16
  currencyISOCode?: string;
16
17
  decimalPrecision?: number;
17
- showGroupSeparators?: string;
18
+ showGroupSeparators?: boolean;
18
19
  formatter?: string;
19
20
  }
20
21
 
@@ -36,13 +37,15 @@ export default function Decimal(props: DecimalProps) {
36
37
  displayMode,
37
38
  hideLabel,
38
39
  currencyISOCode = 'USD',
39
- decimalPrecision = 2,
40
- showGroupSeparators = true,
40
+ decimalPrecision,
41
+ showGroupSeparators,
41
42
  testId,
42
43
  placeholder,
43
44
  formatter
44
45
  } = props;
45
46
 
47
+ const [values, setValues] = useState(value.toString());
48
+
46
49
  const pConn = getPConnect();
47
50
  const actions = pConn.getActionsApi();
48
51
  const propName = (pConn.getStateProps() as any).value;
@@ -55,6 +58,12 @@ export default function Decimal(props: DecimalProps) {
55
58
 
56
59
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
57
60
 
61
+ let readOnlyProp = {}; // Note: empty if NOT ReadOnly
62
+
63
+ if (readOnly) {
64
+ readOnlyProp = { readOnly: true };
65
+ }
66
+
58
67
  let formattedValue = '';
59
68
  if (formatter === 'Currency') {
60
69
  formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);
@@ -74,12 +83,17 @@ export default function Decimal(props: DecimalProps) {
74
83
  'data-test-id': testId
75
84
  };
76
85
 
77
- function decimalOnBlur(event, inValue) {
78
- handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
86
+ function decimalOnBlur() {
87
+ handleEvent(actions, 'changeNblur', propName, values);
79
88
  }
80
89
 
90
+ const handleChange = val => {
91
+ setValues(val.value);
92
+ };
93
+
81
94
  return (
82
- <CurrencyTextField
95
+ <NumericFormat
96
+ valueIsNumericString
83
97
  fullWidth
84
98
  variant={readOnly ? 'standard' : 'outlined'}
85
99
  helperText={helperTextToDisplay}
@@ -89,17 +103,17 @@ export default function Decimal(props: DecimalProps) {
89
103
  disabled={disabled}
90
104
  error={status === 'error'}
91
105
  label={label}
92
- value={value}
93
- readOnly={!!readOnly}
94
- type='text'
95
- outputFormat='number'
96
- textAlign='left'
97
- InputProps={{ inputProps: { ...testProp } }}
98
- currencySymbol={readOnly && formatter === 'Currency' ? theCurrSym : ''}
99
- decimalCharacter={theCurrDec}
100
- digitGroupSeparator={showGroupSeparators ? theCurrSep : ''}
101
- decimalPlaces={decimalPrecision}
106
+ value={values}
107
+ onValueChange={val => {
108
+ handleChange(val);
109
+ }}
102
110
  onBlur={!readOnly ? decimalOnBlur : undefined}
111
+ prefix={readOnly && formatter === 'Currency' ? theCurrSym : ''}
112
+ decimalSeparator={theCurrDec}
113
+ thousandSeparator={showGroupSeparators ? theCurrSep : ''}
114
+ decimalScale={readOnly && formatter === 'Currency' ? undefined : decimalPrecision}
115
+ InputProps={{ ...readOnlyProp, inputProps: { ...testProp } }}
116
+ customInput={TextField}
103
117
  />
104
118
  );
105
119
  }
@@ -1,17 +1,20 @@
1
- import CurrencyTextField from '@unicef/material-ui-currency-textfield';
2
-
1
+ import { TextField } from '@material-ui/core';
2
+ import { NumericFormat } from 'react-number-format';
3
+ import { useState } from 'react';
3
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
5
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
6
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
6
7
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
7
8
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
8
9
 
9
- /* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
10
+ /* Using react-number-format component here, since it allows formatting decimal values,
10
11
  as per the locale.
11
12
  */
12
13
  interface PercentageProps extends PConnFieldProps {
13
14
  // If any, enter additional props that only exist on Percentage here
14
15
  currencyISOCode?: string;
16
+ showGroupSeparators?: string;
17
+ decimalPrecision?: number;
15
18
  }
16
19
 
17
20
  export default function Percentage(props: PercentageProps) {
@@ -34,9 +37,13 @@ export default function Percentage(props: PercentageProps) {
34
37
  helperText,
35
38
  displayMode,
36
39
  hideLabel,
37
- placeholder
40
+ placeholder,
41
+ showGroupSeparators,
42
+ decimalPrecision
38
43
  } = props;
39
44
 
45
+ const [values, setValues] = useState(value.toString());
46
+
40
47
  const pConn = getPConnect();
41
48
  const actions = pConn.getActionsApi();
42
49
  const propName = (pConn.getStateProps() as any).value;
@@ -45,7 +52,11 @@ export default function Percentage(props: PercentageProps) {
45
52
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
46
53
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
47
54
 
48
- // console.log(`Percentage: label: ${label} value: ${value}`);
55
+ let readOnlyProp = {}; // Note: empty if NOT ReadOnly
56
+
57
+ if (readOnly) {
58
+ readOnlyProp = { readOnly: true };
59
+ }
49
60
 
50
61
  if (displayMode === 'LABELS_LEFT') {
51
62
  return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
@@ -65,12 +76,17 @@ export default function Percentage(props: PercentageProps) {
65
76
  const theCurrDec = theSymbols.theDecimalIndicator;
66
77
  const theCurrSep = theSymbols.theDigitGroupSeparator;
67
78
 
68
- function PercentageOnBlur(event, inValue) {
69
- handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
79
+ function PercentageOnBlur() {
80
+ handleEvent(actions, 'changeNblur', propName, values);
70
81
  }
71
82
 
83
+ const handleChange = val => {
84
+ setValues(val.value);
85
+ };
86
+
72
87
  return (
73
- <CurrencyTextField
88
+ <NumericFormat
89
+ valueIsNumericString
74
90
  fullWidth
75
91
  variant={readOnly ? 'standard' : 'outlined'}
76
92
  helperText={helperTextToDisplay}
@@ -78,20 +94,19 @@ export default function Percentage(props: PercentageProps) {
78
94
  size='small'
79
95
  required={required}
80
96
  disabled={disabled}
81
- readOnly={!!readOnly}
82
97
  error={status === 'error'}
83
98
  label={label}
84
- value={value}
85
- type='text'
86
- outputFormat='number'
87
- textAlign='left'
88
- InputProps={{
89
- inputProps: { ...testProp }
99
+ value={values}
100
+ onValueChange={val => {
101
+ handleChange(val);
90
102
  }}
91
- currencySymbol=''
92
- decimalCharacter={theCurrDec}
93
- digitGroupSeparator={theCurrSep}
94
103
  onBlur={!readOnly ? PercentageOnBlur : undefined}
104
+ decimalSeparator={theCurrDec}
105
+ thousandSeparator={showGroupSeparators ? theCurrSep : ''}
106
+ decimalScale={decimalPrecision}
107
+ suffix='%'
108
+ InputProps={{ ...readOnlyProp, inputProps: { ...testProp } }}
109
+ customInput={TextField}
95
110
  />
96
111
  );
97
112
  }
@@ -4,6 +4,7 @@ import { Typography } from '@material-ui/core';
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
5
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
6
 
7
+ import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
7
8
  import { getUserId, isUserNameAvailable } from './UserReferenceUtils';
8
9
 
9
10
  const DROPDOWN_LIST = 'Drop-down list';
@@ -12,6 +13,7 @@ const SEARCH_BOX = 'Search box';
12
13
  interface UserReferenceProps extends PConnProps {
13
14
  // If any, enter additional props that only exist on URLComponent here
14
15
  displayAs?: string;
16
+ displayMode?: string;
15
17
  label?: string;
16
18
  value?: any;
17
19
  testId?: string;
@@ -36,6 +38,7 @@ const UserReference = (props: UserReferenceProps) => {
36
38
  const {
37
39
  label = '',
38
40
  displayAs = '',
41
+ displayMode = '',
39
42
  getPConnect,
40
43
  value = '',
41
44
  testId = '',
@@ -96,6 +99,14 @@ const UserReference = (props: UserReferenceProps) => {
96
99
 
97
100
  let userReferenceComponent: any = null;
98
101
 
102
+ if (displayMode === 'LABELS_LEFT') {
103
+ return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} />;
104
+ }
105
+
106
+ if (displayMode === 'STACKED_LARGE_VAL') {
107
+ return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} variant='stacked' />;
108
+ }
109
+
99
110
  if (readOnly && showAsFormattedText) {
100
111
  if (userId) {
101
112
  userReferenceComponent = (
@@ -172,7 +183,6 @@ const UserReference = (props: UserReferenceProps) => {
172
183
  );
173
184
  }
174
185
  }
175
-
176
186
  return userReferenceComponent;
177
187
  };
178
188
 
@@ -99,6 +99,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
99
99
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
100
100
  const localeCategory = 'Messages';
101
101
 
102
+ const key = `${thePConn.getCaseInfo().getClassName()}!CASE!${thePConn.getCaseInfo().getName()}`.toUpperCase();
102
103
  const classes = useStyles();
103
104
 
104
105
  function getBuildName(): string {
@@ -306,8 +307,9 @@ export const FlowContainer = (props: FlowContainerProps) => {
306
307
  !displayOnlyFA ? (
307
308
  <Card className={`${classes.root} psdk-root`}>
308
309
  <CardHeader
309
- title={<Typography variant='h6'>{containerName}</Typography>}
310
- subheader={`Task in ${caseId} \u2022 Priority ${urgency}`}
310
+ id='assignment-header'
311
+ title={<Typography variant='h6'>{localizedVal(containerName, undefined, key)}</Typography>}
312
+ subheader={`${localizedVal('Task in', 'Todo')} ${caseId} \u2022 ${localizedVal('Priority', 'Todo')} ${urgency}`}
311
313
  avatar={<Avatar className={`${classes.avatar} psdk-avatar`}>{operatorInitials}</Avatar>}
312
314
  />
313
315
  {displayPageMessages()}
@@ -319,7 +321,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
319
321
  </Card>
320
322
  ) : (
321
323
  <Card className={`${classes.root} psdk-root`}>
322
- <Typography variant='h6'>{containerName}</Typography>
324
+ <Typography variant='h6'>{localizedVal(containerName, undefined, key)}</Typography>
323
325
  {displayPageMessages()}
324
326
  <MuiPickersUtilsProvider utils={DayjsUtils}>
325
327
  <Assignment getPConnect={getPConnect} itemKey={itemKey}>
@@ -144,7 +144,9 @@ export default function MultiStep(props: PropsWithChildren<MultiStepProps>) {
144
144
  </div>
145
145
  </div>
146
146
  <div className={_getHLabelClass(mainStep.visited_status)}>
147
- <div className='psdk-horizontal-step-text-label'>{mainStep.name}</div>
147
+ <div className='psdk-horizontal-step-text-label' id='selected-label'>
148
+ {mainStep.name}
149
+ </div>
148
150
  </div>
149
151
  </div>
150
152
  {_showHLine(index) && <div className='psdk-horizontal-step-line' />}
@@ -249,8 +249,8 @@ export default function NavBar(props: NavBarProps) {
249
249
  <Divider />
250
250
  <List className='marginTopAuto'>
251
251
  <>
252
- <ListItem onClick={navPanelOperatorButtonClick} style={{ cursor: 'pointer' }}>
253
- <ListItemIcon>
252
+ <ListItem onClick={navPanelOperatorButtonClick}>
253
+ <ListItemIcon id='person-icon'>
254
254
  <PersonOutlineIcon fontSize='large' />
255
255
  </ListItemIcon>
256
256
  <ListItemText primary={portalOperator} />
@@ -186,6 +186,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
186
186
  <Box>
187
187
  {editAction && (
188
188
  <Button
189
+ id='edit'
189
190
  onClick={() => {
190
191
  _editClick();
191
192
  }}
@@ -217,7 +218,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
217
218
  <CardHeader
218
219
  className={classes.caseViewHeader}
219
220
  title={
220
- <Typography variant='h6' component='div'>
221
+ <Typography variant='h6' component='div' id='case-name'>
221
222
  {PCore.getLocaleUtils().getLocaleValue(header, '', localeKey)}
222
223
  </Typography>
223
224
  }
@@ -95,7 +95,7 @@ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
95
95
 
96
96
  return (
97
97
  <>
98
- <Button aria-controls='simple-menu' aria-haspopup='true' onClick={handleClick}>
98
+ <Button id='actions-menu' aria-controls='simple-menu' aria-haspopup='true' onClick={handleClick}>
99
99
  {localizedVal('Actions...', localeCategory)}
100
100
  </Button>
101
101
  <Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
@@ -20,13 +20,8 @@ export const getKeyForMappedField = field => {
20
20
 
21
21
  const pConnect = field?.getPConnect?.();
22
22
 
23
- if (pConnect?.meta?.type && pConnect?.meta?.config?.name) {
24
- return `${pConnect.meta.type}_${pConnect.meta.config.name}`;
25
- }
26
-
27
- // Using label as a fallback if name is not defined.
28
- if (pConnect?.meta?.type && pConnect?.meta?.config?.label) {
29
- return `${pConnect.meta.type}_${pConnect.meta.config.label}`;
23
+ if (pConnect?.meta) {
24
+ return JSON.stringify(pConnect.meta);
30
25
  }
31
26
 
32
27
  return uuidv4();
@@ -1047,7 +1047,7 @@ export default function ListView(props: ListViewProps) {
1047
1047
  .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
1048
1048
  .map(row => {
1049
1049
  return (
1050
- <TableRow key={row.pxRefObjectInsName || row.pyID || row.pyGUID}>
1050
+ <TableRow key={row.pxRefObjectInsName || row.pyID}>
1051
1051
  {arColumns.map(column => {
1052
1052
  const value = row[column.id];
1053
1053
  return (
@@ -1104,7 +1104,7 @@ export default function ListView(props: ListViewProps) {
1104
1104
  .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
1105
1105
  .map(row => {
1106
1106
  return (
1107
- <TableRow key={row.pxRefObjectInsName || row.pyGUID || row.pyID}>
1107
+ <TableRow key={row[rowID]}>
1108
1108
  {selectionMode === SELECTION_MODE.SINGLE && (
1109
1109
  <TableCell>
1110
1110
  <Radio
@@ -488,7 +488,7 @@ export default function FileUtility(props: FileUtilityProps) {
488
488
  }
489
489
 
490
490
  return (
491
- <div className='psdk-utility'>
491
+ <div className='psdk-utility' id='file-utility'>
492
492
  {inProgress && (
493
493
  <div className='progress-div'>
494
494
  <CircularProgress />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.37",
3
+ "version": "0.24.1",
4
4
  "description": "React SDK - Code for overriding components",
5
5
  "_filesComment": "During packing, npm ignores everything NOT in the files list",
6
6
  "files": [
File without changes