@pega/react-sdk-overrides 0.23.17 → 0.23.18
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.
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +37 -3
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +1 -2
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +38 -56
- package/lib/field/AutoComplete/AutoComplete.tsx +6 -4
- package/lib/field/Checkbox/Checkbox.tsx +7 -5
- package/lib/field/Currency/Currency.tsx +31 -6
- package/lib/field/Currency/currency-utils.ts +76 -0
- package/lib/field/Date/Date.tsx +25 -9
- package/lib/field/DateTime/DateTime.tsx +24 -10
- package/lib/field/Decimal/Decimal.tsx +8 -6
- package/lib/field/Dropdown/Dropdown.tsx +6 -4
- package/lib/field/Email/Email.tsx +8 -8
- package/lib/field/Integer/Integer.tsx +8 -6
- package/lib/field/Percentage/Percentage.tsx +8 -6
- package/lib/field/Phone/Phone.tsx +8 -7
- package/lib/field/RadioButtons/RadioButtons.tsx +7 -5
- package/lib/field/SemanticLink/SemanticLink.tsx +6 -0
- package/lib/field/TextArea/TextArea.tsx +8 -6
- package/lib/field/TextInput/TextInput.tsx +8 -6
- package/lib/field/Time/Time.tsx +7 -5
- package/lib/field/URL/URL.tsx +8 -6
- package/lib/helpers/date-format-utils.ts +66 -0
- package/lib/helpers/formatters/Currency.js +13 -5
- package/lib/helpers/formatters/common.js +5 -1
- package/lib/helpers/formatters/index.js +5 -0
- package/lib/helpers/template-utils.ts +80 -0
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +66 -70
- package/lib/infra/MultiStep/MultiStep.css +4 -18
- package/lib/infra/NavBar/NavBar.tsx +129 -219
- package/lib/infra/View/View.tsx +27 -20
- package/lib/template/CaseView/CaseView.tsx +2 -5
- package/lib/template/DefaultForm/DefaultForm.tsx +4 -0
- package/lib/template/Details/Details/Details.tsx +52 -21
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +63 -31
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +64 -30
- package/lib/template/ListView/DefaultViewMeta.js +222 -0
- package/lib/template/ListView/ListView.tsx +152 -48
- package/lib/template/ListView/hooks.js +97 -0
- package/lib/template/ListView/utils.js +636 -0
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +69 -42
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +69 -43
- package/lib/widget/Attachment/Attachment.css +7 -0
- package/lib/widget/Attachment/Attachment.tsx +37 -3
- package/lib/widget/SummaryItem/SummaryItem.tsx +1 -1
- package/package.json +1 -1
- package/lib/.DS_Store +0 -0
- package/lib/field/AutoComplete/.DS_Store +0 -0
- package/lib/field/Checkbox/.DS_Store +0 -0
- package/lib/field/Currency/.DS_Store +0 -0
- package/lib/field/Date/.DS_Store +0 -0
- package/lib/field/TextContent/.DS_Store +0 -0
- package/lib/infra/.DS_Store +0 -0
- package/lib/template/.DS_Store +0 -0
- package/lib/template/CaseView/.DS_Store +0 -0
- package/lib/template/SimpleTable/.DS_Store +0 -0
- package/lib/template/SimpleTable/SimpleTable/.DS_Store +0 -0
- package/lib/template/utils.ts +0 -23
|
@@ -5,6 +5,8 @@ import isDeepEqual from 'fast-deep-equal/react';
|
|
|
5
5
|
import Grid from '@material-ui/core/Grid';
|
|
6
6
|
import TextField from '@material-ui/core/TextField';
|
|
7
7
|
import Operator from '@pega/react-sdk-components/lib/components/designSystemExtension/Operator';
|
|
8
|
+
import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
9
|
+
import { getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
8
10
|
|
|
9
11
|
import './CaseSummaryFields.css';
|
|
10
12
|
|
|
@@ -121,9 +123,42 @@ export default function CaseSummaryFields(props) {
|
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
case 'date':
|
|
124
|
-
case 'datetime':
|
|
125
|
-
|
|
126
|
+
case 'datetime': {
|
|
127
|
+
const theDateFormatInfo = getDateFormatInfo();
|
|
128
|
+
// eslint-disable-next-line no-console
|
|
129
|
+
console.log(`theDateFormatInfo: ${theDateFormatInfo}`);
|
|
130
|
+
const theFormat = (fieldTypeLower === 'datetime') ? `${theDateFormatInfo.dateFormatStringLong} hh:mm a` : theDateFormatInfo.dateFormatStringLong
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<TextField
|
|
134
|
+
value={format(field.config.value, field.type, { format: theFormat })}
|
|
135
|
+
label={field.config.label}
|
|
136
|
+
InputProps={{
|
|
137
|
+
readOnly: true,
|
|
138
|
+
disableUnderline: true
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
case 'currency': {
|
|
145
|
+
const theCurrencyOptions = getCurrencyOptions(field.config?.currencyISOCode);
|
|
146
|
+
return (
|
|
147
|
+
<TextField
|
|
148
|
+
value={format(field.config.value, field.type, theCurrencyOptions)}
|
|
149
|
+
label={field.config.label}
|
|
150
|
+
InputProps={{
|
|
151
|
+
readOnly: true,
|
|
152
|
+
disableUnderline: true
|
|
153
|
+
}}
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
126
160
|
case 'boolean':
|
|
161
|
+
case 'userreference':
|
|
127
162
|
return (
|
|
128
163
|
<TextField
|
|
129
164
|
value={format(field.config.value, field.type)}
|
|
@@ -137,7 +172,6 @@ export default function CaseSummaryFields(props) {
|
|
|
137
172
|
|
|
138
173
|
case 'caseoperator':
|
|
139
174
|
return <Operator caseOpConfig={field.config} />;
|
|
140
|
-
break;
|
|
141
175
|
|
|
142
176
|
default:
|
|
143
177
|
return (
|
|
@@ -12,8 +12,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
12
12
|
fieldMargin: {
|
|
13
13
|
paddingTop: theme.spacing(1),
|
|
14
14
|
paddingBottom: theme.spacing(1),
|
|
15
|
-
marginTop: theme.spacing(1)
|
|
16
|
-
marginBottom: theme.spacing(1)
|
|
15
|
+
marginTop: theme.spacing(1)
|
|
17
16
|
},
|
|
18
17
|
fullWidth: {
|
|
19
18
|
width: '100%'
|
|
@@ -11,93 +11,75 @@ const useStyles = makeStyles(theme => ({
|
|
|
11
11
|
marginTop: theme.spacing(1),
|
|
12
12
|
marginBottom: theme.spacing(1)
|
|
13
13
|
},
|
|
14
|
-
fieldMargin: {
|
|
15
|
-
// paddingRight: theme.spacing(1),
|
|
16
|
-
// paddingLeft: theme.spacing(1),
|
|
17
|
-
// paddingTop: theme.spacing(1),
|
|
18
|
-
// paddingBottom: theme.spacing(1),
|
|
19
|
-
// marginRight: theme.spacing(1),
|
|
20
|
-
// marginLeft: theme.spacing(1),
|
|
21
|
-
// marginTop: theme.spacing(1),
|
|
22
|
-
// marginBottom: theme.spacing(1)
|
|
23
|
-
},
|
|
24
14
|
fieldLabel: {
|
|
25
15
|
fontWeight: 400,
|
|
26
16
|
color: theme.palette.text.secondary
|
|
27
17
|
},
|
|
28
18
|
fieldValue: {
|
|
29
|
-
fontWeight: 400,
|
|
30
19
|
color: theme.palette.text.primary
|
|
20
|
+
},
|
|
21
|
+
noPaddingTop: {
|
|
22
|
+
paddingTop: '0 !important'
|
|
23
|
+
},
|
|
24
|
+
noPaddingBottom: {
|
|
25
|
+
paddingBottom: '0 !important'
|
|
31
26
|
}
|
|
32
27
|
}));
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
function formatItemValue(value) {
|
|
30
|
+
let formattedVal = value;
|
|
36
31
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for (const label in props.item) {
|
|
41
|
-
fields.push({ label, value: props.item[label] });
|
|
32
|
+
// if the value is undefined or an empty string, we want to display it as "---"
|
|
33
|
+
if (formattedVal === undefined || formattedVal === '') {
|
|
34
|
+
formattedVal = '---';
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
return formattedVal;
|
|
38
|
+
}
|
|
46
39
|
|
|
40
|
+
const FieldValueList = props => {
|
|
41
|
+
const { name, value, variant = 'inline' } = props;
|
|
42
|
+
const classes = useStyles();
|
|
43
|
+
|
|
44
|
+
function getGridItemLabel() {
|
|
47
45
|
return (
|
|
48
|
-
<Grid
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
>
|
|
54
|
-
{
|
|
46
|
+
<Grid
|
|
47
|
+
item
|
|
48
|
+
xs={variant === 'stacked' ? 12 : 6}
|
|
49
|
+
className={variant === 'stacked' ? classes.noPaddingBottom : ''}
|
|
50
|
+
>
|
|
51
|
+
<Typography variant='body2' component='span' className={`${classes.fieldLabel}`}>
|
|
52
|
+
{name}
|
|
55
53
|
</Typography>
|
|
56
54
|
</Grid>
|
|
57
55
|
);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
function
|
|
61
|
-
let formattedVal = value;
|
|
62
|
-
|
|
63
|
-
// if the value is undefined or an empty string, we want to display it as "---"
|
|
64
|
-
if (formattedVal === undefined || formattedVal === '') {
|
|
65
|
-
formattedVal = '---';
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return formattedVal;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function getGridItemValue(value) {
|
|
58
|
+
function getGridItemValue() {
|
|
72
59
|
const formattedValue = formatItemValue(value);
|
|
73
60
|
|
|
74
61
|
return (
|
|
75
|
-
<Grid
|
|
76
|
-
|
|
62
|
+
<Grid
|
|
63
|
+
item
|
|
64
|
+
xs={variant === 'stacked' ? 12 : 6}
|
|
65
|
+
className={variant === 'stacked' ? classes.noPaddingTop : ''}
|
|
66
|
+
>
|
|
67
|
+
<Typography
|
|
68
|
+
variant={variant === 'stacked' ? 'h6' : 'body2'}
|
|
69
|
+
component='span'
|
|
70
|
+
className={classes.fieldValue}
|
|
71
|
+
>
|
|
77
72
|
{formattedValue}
|
|
78
73
|
</Typography>
|
|
79
74
|
</Grid>
|
|
80
75
|
);
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
function getGridItems() {
|
|
84
|
-
const gridItems = fields.map(item => {
|
|
85
|
-
return (
|
|
86
|
-
<Grid container spacing={1} key={item.label}>
|
|
87
|
-
{getGridItemLabel(item.label)}
|
|
88
|
-
{getGridItemValue(item.value)}
|
|
89
|
-
</Grid>
|
|
90
|
-
);
|
|
91
|
-
});
|
|
92
|
-
return gridItems;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
78
|
return (
|
|
96
79
|
<React.Fragment>
|
|
97
80
|
<Grid container spacing={4} justifyContent='space-between'>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
</Grid>
|
|
81
|
+
{getGridItemLabel()}
|
|
82
|
+
{getGridItemValue()}
|
|
101
83
|
</Grid>
|
|
102
84
|
</React.Fragment>
|
|
103
85
|
);
|
|
@@ -51,6 +51,7 @@ export default function AutoComplete(props) {
|
|
|
51
51
|
datasourceMetadata,
|
|
52
52
|
status,
|
|
53
53
|
helperText,
|
|
54
|
+
hideLabel,
|
|
54
55
|
onRecordChange
|
|
55
56
|
} = props;
|
|
56
57
|
const context = getPConnect().getContextName();
|
|
@@ -133,10 +134,11 @@ export default function AutoComplete(props) {
|
|
|
133
134
|
}, []);
|
|
134
135
|
|
|
135
136
|
if (displayMode === 'LABELS_LEFT') {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
141
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
if (value) {
|
|
@@ -20,7 +20,8 @@ export default function CheckboxComponent(props) {
|
|
|
20
20
|
status,
|
|
21
21
|
helperText,
|
|
22
22
|
validatemessage,
|
|
23
|
-
displayMode
|
|
23
|
+
displayMode,
|
|
24
|
+
hideLabel
|
|
24
25
|
} = props;
|
|
25
26
|
const helperTextToDisplay = validatemessage || helperText;
|
|
26
27
|
|
|
@@ -37,10 +38,11 @@ export default function CheckboxComponent(props) {
|
|
|
37
38
|
}, [value]);
|
|
38
39
|
|
|
39
40
|
if (displayMode === 'LABELS_LEFT') {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
45
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
const handleChange = event => {
|
|
@@ -3,6 +3,8 @@ import React, { useState, useEffect } from 'react';
|
|
|
3
3
|
import CurrencyTextField from '@unicef/material-ui-currency-textfield';
|
|
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";
|
|
7
|
+
import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
|
|
6
8
|
|
|
7
9
|
// Using control from: https://github.com/unicef/material-ui-currency-textfield
|
|
8
10
|
|
|
@@ -19,8 +21,11 @@ export default function Currency(props) {
|
|
|
19
21
|
readOnly,
|
|
20
22
|
testId,
|
|
21
23
|
helperText,
|
|
22
|
-
displayMode
|
|
24
|
+
displayMode,
|
|
25
|
+
hideLabel,
|
|
26
|
+
currencyISOCode = "USD"
|
|
23
27
|
} = props;
|
|
28
|
+
|
|
24
29
|
const pConn = getPConnect();
|
|
25
30
|
const actions = pConn.getActionsApi();
|
|
26
31
|
const propName = pConn.getStateProps().value;
|
|
@@ -41,17 +46,32 @@ export default function Currency(props) {
|
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
const [currValue, setCurrValue] = useState();
|
|
49
|
+
const [theCurrSym, setCurrSym] = useState("$");
|
|
50
|
+
const [theCurrDec, setCurrDec] = useState(".");
|
|
51
|
+
const [theCurrSep, setCurrSep] = useState(",");
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
// currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
|
|
55
|
+
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
56
|
+
setCurrSym(theSymbols.theCurrencySymbol);
|
|
57
|
+
setCurrDec(theSymbols.theDecimalIndicator);
|
|
58
|
+
setCurrSep(theSymbols.theDigitGroupSeparator);
|
|
59
|
+
}, [currencyISOCode]);
|
|
44
60
|
|
|
45
61
|
useEffect(() => {
|
|
46
62
|
// const testVal = value;
|
|
47
63
|
setCurrValue(value.toString());
|
|
48
64
|
}, [value]);
|
|
49
65
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return <FieldValueList
|
|
66
|
+
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
67
|
+
const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
|
|
68
|
+
|
|
69
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
70
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
74
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
|
|
55
75
|
}
|
|
56
76
|
|
|
57
77
|
function currOnChange(event, inValue) {
|
|
@@ -66,6 +86,8 @@ export default function Currency(props) {
|
|
|
66
86
|
handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
|
|
67
87
|
}
|
|
68
88
|
|
|
89
|
+
// console.log(`theCurrSym: ${theCurrSym} | theCurrDec: ${theCurrDec} | theCurrSep: ${theCurrSep}`);
|
|
90
|
+
|
|
69
91
|
return (
|
|
70
92
|
<CurrencyTextField
|
|
71
93
|
fullWidth
|
|
@@ -84,6 +106,9 @@ export default function Currency(props) {
|
|
|
84
106
|
outputFormat='number'
|
|
85
107
|
textAlign='left'
|
|
86
108
|
InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: currValue } }}
|
|
109
|
+
currencySymbol={theCurrSym}
|
|
110
|
+
decimalCharacter={theCurrDec}
|
|
111
|
+
digitGroupSeparator={theCurrSep}
|
|
87
112
|
/>
|
|
88
113
|
);
|
|
89
114
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-named-default
|
|
2
|
+
import { default as CurrencyAlias} from '@pega/react-sdk-components/lib/components/helpers/formatters/Currency';
|
|
3
|
+
// eslint-disable-next-line import/no-named-default
|
|
4
|
+
import { default as CurrencyMapAlias } from '@pega/react-sdk-components/lib/components/helpers/formatters/CurrencyMap';
|
|
5
|
+
|
|
6
|
+
declare const PCore: any;
|
|
7
|
+
|
|
8
|
+
export const getCurrencyOptions = (inISOCode: string) => {
|
|
9
|
+
|
|
10
|
+
const operatorLocale = PCore.getEnvironmentInfo().getUseLocale() || 'en-US';
|
|
11
|
+
|
|
12
|
+
let currMapToUse = CurrencyMapAlias.US;
|
|
13
|
+
let localeToUse = operatorLocale;
|
|
14
|
+
|
|
15
|
+
// Determine CurrencyMap lookup based on ISO code (if specified).
|
|
16
|
+
// If no ISO code, use locale
|
|
17
|
+
// If no locale, default to US
|
|
18
|
+
if (inISOCode) {
|
|
19
|
+
if (inISOCode === "EUR") {
|
|
20
|
+
currMapToUse = CurrencyMapAlias.NL;
|
|
21
|
+
localeToUse = "nl-NL";
|
|
22
|
+
} else {
|
|
23
|
+
// For all other ISO codes, use first 2 characters as the lookup from CurrencyMap
|
|
24
|
+
const countryCode = inISOCode.substring(0,2);
|
|
25
|
+
currMapToUse = CurrencyMapAlias[countryCode];
|
|
26
|
+
}
|
|
27
|
+
} else if (operatorLocale) {
|
|
28
|
+
// No ISO Code so check for operator locale (and force upper case for lookup)
|
|
29
|
+
const countryCode = operatorLocale.substring(3).toUpperCase();
|
|
30
|
+
currMapToUse = CurrencyMapAlias[countryCode];
|
|
31
|
+
} else {
|
|
32
|
+
// no ISO code and no operator locale, default to US
|
|
33
|
+
currMapToUse = CurrencyMapAlias.US;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// If no currMapToUse at this point, default to US as a failsafe
|
|
37
|
+
if (!currMapToUse) {
|
|
38
|
+
currMapToUse = CurrencyMapAlias['US'];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const theCode = currMapToUse.currencyCode.substring(0, 3);
|
|
42
|
+
const currencyOptions = { locale: localeToUse, style: "currency", currency: theCode }
|
|
43
|
+
|
|
44
|
+
return currencyOptions;
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
export const getCurrencyCharacters = (inISOCode: string) => {
|
|
50
|
+
const theCurrencyChars = {
|
|
51
|
+
theCurrencySymbol: '$',
|
|
52
|
+
theDecimalIndicator: '.',
|
|
53
|
+
theDigitGroupSeparator: ','
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const theCurrencyOptions = getCurrencyOptions(inISOCode);
|
|
57
|
+
|
|
58
|
+
const testValue = 1234.56;
|
|
59
|
+
const formattedString = CurrencyAlias.Currency(testValue, theCurrencyOptions);
|
|
60
|
+
|
|
61
|
+
// console.log(`formattedString: ${formattedString}`);
|
|
62
|
+
|
|
63
|
+
// Here, we have the formatted string (ex: $1,234.56) where:
|
|
64
|
+
// Currency symbol = formattedString[0]
|
|
65
|
+
// Separator = formattedString[2]
|
|
66
|
+
// DecimalIndicator = formattedString[6];
|
|
67
|
+
|
|
68
|
+
theCurrencyChars.theCurrencySymbol = formattedString[0];
|
|
69
|
+
theCurrencyChars.theDigitGroupSeparator = formattedString[2];
|
|
70
|
+
theCurrencyChars.theDecimalIndicator = formattedString[6];
|
|
71
|
+
|
|
72
|
+
// console.log(`theCurrencyChars: symbol: ${theCurrencyChars.theCurrencySymbol} | theDigitGroupSeparator: ${theCurrencyChars.theDigitGroupSeparator} | theDecimalIndicator: ${theCurrencyChars.theDecimalIndicator}`);
|
|
73
|
+
|
|
74
|
+
return theCurrencyChars;
|
|
75
|
+
|
|
76
|
+
}
|
package/lib/field/Date/Date.tsx
CHANGED
|
@@ -3,6 +3,8 @@ 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/';
|
|
7
|
+
import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
6
8
|
|
|
7
9
|
export default function Date(props) {
|
|
8
10
|
const {
|
|
@@ -18,18 +20,32 @@ export default function Date(props) {
|
|
|
18
20
|
readOnly,
|
|
19
21
|
testId,
|
|
20
22
|
helperText,
|
|
21
|
-
displayMode
|
|
23
|
+
displayMode,
|
|
24
|
+
hideLabel
|
|
22
25
|
} = props;
|
|
26
|
+
|
|
23
27
|
const pConn = getPConnect();
|
|
24
28
|
const actions = pConn.getActionsApi();
|
|
25
29
|
const propName = pConn.getStateProps().value;
|
|
26
30
|
const helperTextToDisplay = validatemessage || helperText;
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
// Start with default dateFormatInfo
|
|
33
|
+
const dateFormatInfo = dateFormatInfoDefault;
|
|
34
|
+
// and then update, as needed, based on locale, etc.
|
|
35
|
+
const theDateFormat = getDateFormatInfo()
|
|
36
|
+
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
37
|
+
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
38
|
+
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
42
|
+
const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
|
|
43
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
47
|
+
const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
|
|
48
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant='stacked' />;
|
|
33
49
|
}
|
|
34
50
|
|
|
35
51
|
if (readOnly) {
|
|
@@ -58,13 +74,13 @@ export default function Date(props) {
|
|
|
58
74
|
disableToolbar
|
|
59
75
|
variant='inline'
|
|
60
76
|
inputVariant='outlined'
|
|
61
|
-
placeholder=
|
|
77
|
+
placeholder={dateFormatInfo.dateFormatStringLC}
|
|
78
|
+
format={dateFormatInfo.dateFormatString}
|
|
79
|
+
mask={dateFormatInfo.dateFormatMask}
|
|
62
80
|
fullWidth
|
|
63
81
|
autoOk
|
|
64
82
|
required={required}
|
|
65
83
|
disabled={disabled}
|
|
66
|
-
format='MM/DD/YYYY'
|
|
67
|
-
mask='__/__/____'
|
|
68
84
|
error={status === 'error'}
|
|
69
85
|
helperText={helperTextToDisplay}
|
|
70
86
|
size='small'
|
|
@@ -4,6 +4,7 @@ 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
6
|
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';
|
|
7
8
|
|
|
8
9
|
export default function DateTime(props) {
|
|
9
10
|
const {
|
|
@@ -18,19 +19,32 @@ export default function DateTime(props) {
|
|
|
18
19
|
readOnly,
|
|
19
20
|
testId,
|
|
20
21
|
helperText,
|
|
21
|
-
displayMode
|
|
22
|
+
displayMode,
|
|
23
|
+
hideLabel
|
|
22
24
|
} = props;
|
|
25
|
+
|
|
23
26
|
const pConn = getPConnect();
|
|
24
27
|
const actions = pConn.getActionsApi();
|
|
25
28
|
const propName = pConn.getStateProps().value;
|
|
26
29
|
const helperTextToDisplay = validatemessage || helperText;
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
// Start with default dateFormatInfo
|
|
32
|
+
const dateFormatInfo = dateFormatInfoDefault;
|
|
33
|
+
// and then update, as needed, based on locale, etc.
|
|
34
|
+
const theDateFormat = getDateFormatInfo()
|
|
35
|
+
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
36
|
+
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
37
|
+
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
41
|
+
const formattedDate = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
|
|
42
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
46
|
+
const formattedDate = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
|
|
47
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant='stacked' />;
|
|
34
48
|
}
|
|
35
49
|
|
|
36
50
|
if (readOnly) {
|
|
@@ -62,9 +76,9 @@ export default function DateTime(props) {
|
|
|
62
76
|
autoOk
|
|
63
77
|
required={required}
|
|
64
78
|
disabled={disabled}
|
|
65
|
-
placeholder=
|
|
66
|
-
format=
|
|
67
|
-
mask=
|
|
79
|
+
placeholder={`${dateFormatInfo.dateFormatStringLC} hh:mm a`}
|
|
80
|
+
format={`${dateFormatInfo.dateFormatString} hh:mm a`}
|
|
81
|
+
mask={`${dateFormatInfo.dateFormatMask} __:__ _m`}
|
|
68
82
|
minutesStep={5}
|
|
69
83
|
error={status === 'error'}
|
|
70
84
|
helperText={helperTextToDisplay}
|
|
@@ -15,15 +15,17 @@ export default function Decimal(props) {
|
|
|
15
15
|
onBlur,
|
|
16
16
|
readOnly,
|
|
17
17
|
helperText,
|
|
18
|
-
displayMode
|
|
18
|
+
displayMode,
|
|
19
|
+
hideLabel
|
|
19
20
|
} = props;
|
|
20
21
|
const helperTextToDisplay = validatemessage || helperText;
|
|
21
22
|
|
|
22
|
-
if(displayMode === 'LABELS_LEFT') {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
24
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
28
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
if (readOnly) {
|
|
@@ -25,6 +25,7 @@ export default function Dropdown(props) {
|
|
|
25
25
|
testId,
|
|
26
26
|
helperText,
|
|
27
27
|
displayMode,
|
|
28
|
+
hideLabel,
|
|
28
29
|
onRecordChange
|
|
29
30
|
} = props;
|
|
30
31
|
const [options, setOptions] = useState<Array<IOption>>([]);
|
|
@@ -43,10 +44,11 @@ export default function Dropdown(props) {
|
|
|
43
44
|
let readOnlyProp = {};
|
|
44
45
|
|
|
45
46
|
if (displayMode === 'LABELS_LEFT') {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
51
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
if (readOnly) {
|
|
@@ -17,23 +17,23 @@ export default function Email(props) {
|
|
|
17
17
|
readOnly,
|
|
18
18
|
testId,
|
|
19
19
|
helperText,
|
|
20
|
-
displayMode
|
|
20
|
+
displayMode,
|
|
21
|
+
hideLabel
|
|
21
22
|
} = props;
|
|
22
23
|
const helperTextToDisplay = validatemessage || helperText;
|
|
23
24
|
|
|
24
|
-
if(displayMode === 'LABELS_LEFT') {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
26
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
30
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
if (readOnly) {
|
|
32
34
|
return <TextInput {...props} />;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
37
|
let testProp = {};
|
|
38
38
|
|
|
39
39
|
testProp = {
|
|
@@ -16,17 +16,19 @@ export default function Integer(props) {
|
|
|
16
16
|
readOnly,
|
|
17
17
|
testId,
|
|
18
18
|
helperText,
|
|
19
|
-
displayMode
|
|
19
|
+
displayMode,
|
|
20
|
+
hideLabel
|
|
20
21
|
} = props;
|
|
21
22
|
const helperTextToDisplay = validatemessage || helperText;
|
|
22
23
|
|
|
23
24
|
// console.log(`Integer: label: ${label} value: ${value}`);
|
|
24
25
|
|
|
25
|
-
if(displayMode === 'LABELS_LEFT') {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
27
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
31
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
if (readOnly) {
|
|
@@ -37,17 +37,19 @@ export default function Percentage(props) {
|
|
|
37
37
|
readOnly,
|
|
38
38
|
testId,
|
|
39
39
|
helperText,
|
|
40
|
-
displayMode
|
|
40
|
+
displayMode,
|
|
41
|
+
hideLabel
|
|
41
42
|
} = props;
|
|
42
43
|
const helperTextToDisplay = validatemessage || helperText;
|
|
43
44
|
|
|
44
45
|
// console.log(`Percentage: label: ${label} value: ${value}`);
|
|
45
46
|
|
|
46
|
-
if(displayMode === 'LABELS_LEFT') {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
48
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
52
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
if (readOnly) {
|