@pega/dx-component-builder-sdk 0.1.25 → 0.1.27
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/package.json +1 -1
- package/src/auth.js +2 -2
- package/src/cli.js +6 -0
- package/src/constants.js +30 -1
- package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +14 -2
- package/src/tasks/create/templates/SDK-React/field/Date/demo.stories.jsx.mustache +13 -0
- package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +26 -11
- package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.jsx.mustache +12 -0
- package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +32 -12
- package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +9 -7
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/demo.stories.jsx.mustache +3 -0
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +29 -8
- package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +10 -8
- package/src/tasks/create/templates/SDK-React/field/Integer/index.tsx.mustache +10 -7
- package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +16 -6
- package/src/tasks/create/templates/SDK-React/field/Text/index.tsx.mustache +9 -7
- package/src/tasks/create/templates/SDK-React/field/Text-Email/index.tsx.mustache +9 -9
- package/src/tasks/create/templates/SDK-React/field/Text-Input/index.tsx.mustache +9 -7
- package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/index.tsx.mustache +9 -7
- package/src/tasks/create/templates/SDK-React/field/Text-Phone/index.tsx.mustache +9 -9
- package/src/tasks/create/templates/SDK-React/field/Text-URL/index.tsx.mustache +9 -7
- package/src/tasks/create/templates/SDK-React/field/TimeofDay/index.tsx.mustache +7 -5
- package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +0 -6
- package/src/tasks/create/templates/SDK-React/widget/PAGE/index.tsx.mustache +0 -1
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.jsx.mustache +1 -8
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +14 -42
- package/src/tasks/create-all/index.js +456 -0
- package/src/tasks/delete-all/helper.js +8 -10
- package/src/tasks/index.js +1 -0
- package/src/tasks/linter/index.js +55 -30
package/package.json
CHANGED
package/src/auth.js
CHANGED
|
@@ -285,10 +285,10 @@ class PegaAuth {
|
|
|
285
285
|
const nSlash = redirectUri.indexOf('/', nLocalhost + 10);
|
|
286
286
|
const nPort = parseInt(redirectUri.substring(nLocalhost + 10, nSlash));
|
|
287
287
|
if (-1 !== nLocalhost) {
|
|
288
|
-
const options = isHttp ? {
|
|
288
|
+
const options = key && cert && !isHttp ? {
|
|
289
289
|
key: fs.readFileSync(key),
|
|
290
290
|
cert: fs.readFileSync(cert)
|
|
291
|
-
};
|
|
291
|
+
} : {};
|
|
292
292
|
const server = (isHttp ? http : https).createServer(options, (req, res) => {
|
|
293
293
|
const { method, url } = req;
|
|
294
294
|
const { winTitle, winBodyHtml } = this.config;
|
package/src/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
buildComponent,
|
|
7
7
|
buildAllComponents,
|
|
8
8
|
createComponent,
|
|
9
|
+
createAllComponents,
|
|
9
10
|
deleteComponent,
|
|
10
11
|
deleteAllComponents,
|
|
11
12
|
generateMissingCompanions,
|
|
@@ -22,6 +23,7 @@ import {
|
|
|
22
23
|
|
|
23
24
|
const TASKS = {
|
|
24
25
|
CREATE: 'create',
|
|
26
|
+
CREATE_ALL: 'createAll',
|
|
25
27
|
OVERRIDE: 'override',
|
|
26
28
|
OVERRIDE_ALL: 'overrideAll',
|
|
27
29
|
BUILD: 'buildComponent',
|
|
@@ -66,6 +68,10 @@ export default async (args = []) => {
|
|
|
66
68
|
createComponent(options);
|
|
67
69
|
break;
|
|
68
70
|
}
|
|
71
|
+
case TASKS.CREATE_ALL: {
|
|
72
|
+
createAllComponents(options);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
69
75
|
case TASKS.OVERRIDE: {
|
|
70
76
|
overrideComponent(options);
|
|
71
77
|
break;
|
package/src/constants.js
CHANGED
|
@@ -44,6 +44,14 @@ export const SERVER_TYPE = "serverType";
|
|
|
44
44
|
export const SERVER_REST_URL = "infinityRestServerUrl";
|
|
45
45
|
export const LP_SERVER_REST_URL = "launchpadRestServerUrl";
|
|
46
46
|
|
|
47
|
+
/* dxcbConfig.componentDefaults LINT setting/value constants */
|
|
48
|
+
export const LINT_SETTING_KEY = "lintAction"; // LINT_SETTING_KEY is expected to be in sdk-config's dxcbConfig.componentDefaults
|
|
49
|
+
export const LINT_OFF = "off"; // LINT_OFF: don't run lint
|
|
50
|
+
export const LINT_SHOW = "show"; // LINT_SHOW: run lint, show results, but don't block processing from continuing if there are lint errors/warnings
|
|
51
|
+
export const LINT_BLOCK = "block"; // LINT_BLOCK: run lint, show results, block processing from continuing if there are lint errors/warnings
|
|
52
|
+
export const LINT_DEFAULT = LINT_BLOCK; // LINT_DEFAULT: the default value to use if the key isn't found or key value isn't valid
|
|
53
|
+
/* END of dxcb.componentdefaults LINT setting/value constants */
|
|
54
|
+
|
|
47
55
|
export const AUTHENTICATE_SCHEMA = {
|
|
48
56
|
serverType: [
|
|
49
57
|
{
|
|
@@ -177,7 +185,28 @@ export const COMPONENT_SCHEMA = {
|
|
|
177
185
|
value: 'Picklist'
|
|
178
186
|
}
|
|
179
187
|
],
|
|
180
|
-
template: [
|
|
188
|
+
template: [
|
|
189
|
+
{
|
|
190
|
+
name: 'DETAILS',
|
|
191
|
+
value: 'DETAILS'
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'DETAILS region',
|
|
195
|
+
value: 'DETAILS-region'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'FORM',
|
|
199
|
+
value: 'FORM'
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'FORM region',
|
|
203
|
+
value: 'FORM-region'
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'PAGE',
|
|
207
|
+
value: 'PAGE'
|
|
208
|
+
}
|
|
209
|
+
],
|
|
181
210
|
widget: [
|
|
182
211
|
{
|
|
183
212
|
name: 'CASE',
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
FormHelperText
|
|
9
9
|
} from '@material-ui/core';
|
|
10
10
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
11
|
+
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
11
12
|
import PropTypes from 'prop-types';
|
|
12
13
|
|
|
13
14
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
@@ -20,13 +21,16 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
|
20
21
|
export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
21
22
|
const {
|
|
22
23
|
getPConnect,
|
|
24
|
+
label,
|
|
23
25
|
value = false,
|
|
24
26
|
readOnly,
|
|
25
27
|
testId,
|
|
26
28
|
required,
|
|
27
29
|
status,
|
|
28
30
|
helperText,
|
|
29
|
-
validatemessage
|
|
31
|
+
validatemessage,
|
|
32
|
+
displayMode,
|
|
33
|
+
hideLabel
|
|
30
34
|
} = props;
|
|
31
35
|
const helperTextToDisplay = validatemessage || helperText;
|
|
32
36
|
|
|
@@ -42,6 +46,14 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
42
46
|
setChecked(value);
|
|
43
47
|
}, [value]);
|
|
44
48
|
|
|
49
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
50
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
54
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
55
|
+
}
|
|
56
|
+
|
|
45
57
|
const handleChange = event => {
|
|
46
58
|
handleEvent(actionsApi, 'changeNblur', propName, event.target.checked);
|
|
47
59
|
};
|
|
@@ -67,7 +79,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
67
79
|
control={theCheckbox}
|
|
68
80
|
checked={checked}
|
|
69
81
|
onChange={!readOnly ? handleChange : undefined}
|
|
70
|
-
onBlur={handleBlur}
|
|
82
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
71
83
|
label={caption}
|
|
72
84
|
labelPlacement='end'
|
|
73
85
|
data-test-id={testId}
|
|
@@ -11,6 +11,19 @@ export default {
|
|
|
11
11
|
component: {{COMPONENT_CLASS_NAME}}
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
if (!window.PCore) {
|
|
15
|
+
window.PCore = {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
window.PCore.getEnvironmentInfo = () => {
|
|
19
|
+
return {
|
|
20
|
+
getUseLocale: () => {
|
|
21
|
+
return 'en-GB';
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
|
|
14
27
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
15
28
|
const [value, setValue] = useState(configProps.value);
|
|
16
29
|
|
|
@@ -5,7 +5,8 @@ import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput
|
|
|
5
5
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
6
|
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
8
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
9
|
+
import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
9
10
|
|
|
10
11
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
11
12
|
|
|
@@ -28,18 +29,32 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
28
29
|
readOnly,
|
|
29
30
|
testId,
|
|
30
31
|
helperText,
|
|
31
|
-
displayMode
|
|
32
|
+
displayMode,
|
|
33
|
+
hideLabel
|
|
32
34
|
} = props;
|
|
35
|
+
|
|
33
36
|
const pConn = getPConnect();
|
|
34
37
|
const actions = pConn.getActionsApi();
|
|
35
38
|
const propName = pConn.getStateProps().value;
|
|
36
39
|
const helperTextToDisplay = validatemessage || helperText;
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
// Start with default dateFormatInfo
|
|
42
|
+
const dateFormatInfo = dateFormatInfoDefault;
|
|
43
|
+
// and then update, as needed, based on locale, etc.
|
|
44
|
+
const theDateFormat = getDateFormatInfo()
|
|
45
|
+
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
46
|
+
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
47
|
+
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
51
|
+
const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
|
|
52
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
56
|
+
const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
|
|
57
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant='stacked' />;
|
|
43
58
|
}
|
|
44
59
|
|
|
45
60
|
if (readOnly) {
|
|
@@ -70,20 +85,20 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
70
85
|
disableToolbar
|
|
71
86
|
variant='inline'
|
|
72
87
|
inputVariant='outlined'
|
|
73
|
-
placeholder=
|
|
88
|
+
placeholder={dateFormatInfo.dateFormatStringLC}
|
|
89
|
+
format={dateFormatInfo.dateFormatString}
|
|
90
|
+
mask={dateFormatInfo.dateFormatMask}
|
|
74
91
|
fullWidth
|
|
75
92
|
autoOk
|
|
76
93
|
required={required}
|
|
77
94
|
disabled={disabled}
|
|
78
|
-
format='MM/DD/YYYY'
|
|
79
|
-
mask='__/__/____'
|
|
80
95
|
error={status === 'error'}
|
|
81
96
|
helperText={helperTextToDisplay}
|
|
82
97
|
size='small'
|
|
83
98
|
label={label}
|
|
84
99
|
value={value || null}
|
|
85
100
|
onChange={handleChange}
|
|
86
|
-
onBlur={onBlur}
|
|
101
|
+
onBlur={!readOnly ? onBlur : undefined}
|
|
87
102
|
onAccept={handleAccept}
|
|
88
103
|
{{! pick new delimiteres for mustache }}
|
|
89
104
|
{{=<% %>=}}
|
|
@@ -11,6 +11,18 @@ export default {
|
|
|
11
11
|
component: {{COMPONENT_CLASS_NAME}}
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
if (!window.PCore) {
|
|
15
|
+
window.PCore = {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
window.PCore.getEnvironmentInfo = () => {
|
|
19
|
+
return {
|
|
20
|
+
getUseLocale: () => {
|
|
21
|
+
return 'en-GB';
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
14
26
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
15
27
|
const [value, setValue] = useState(configProps.value);
|
|
16
28
|
|
|
@@ -5,7 +5,8 @@ import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput
|
|
|
5
5
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
6
|
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
8
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters/';
|
|
9
|
+
import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
9
10
|
|
|
10
11
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
11
12
|
|
|
@@ -27,26 +28,40 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
27
28
|
readOnly,
|
|
28
29
|
testId,
|
|
29
30
|
helperText,
|
|
30
|
-
displayMode
|
|
31
|
+
displayMode,
|
|
32
|
+
hideLabel
|
|
31
33
|
} = props;
|
|
34
|
+
|
|
32
35
|
const pConn = getPConnect();
|
|
33
36
|
const actions = pConn.getActionsApi();
|
|
34
37
|
const propName = pConn.getStateProps().value;
|
|
35
38
|
const helperTextToDisplay = validatemessage || helperText;
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
// Start with default dateFormatInfo
|
|
41
|
+
const dateFormatInfo = dateFormatInfoDefault;
|
|
42
|
+
// and then update, as needed, based on locale, etc.
|
|
43
|
+
const theDateFormat = getDateFormatInfo()
|
|
44
|
+
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
45
|
+
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
46
|
+
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
50
|
+
const formattedDate = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
|
|
51
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
55
|
+
const formattedDate = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
|
|
56
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant='stacked' />;
|
|
42
57
|
}
|
|
43
58
|
|
|
44
59
|
if (readOnly) {
|
|
45
|
-
|
|
60
|
+
const formattedDate = format(props.value, 'datetime');
|
|
61
|
+
props.value = formattedDate;
|
|
46
62
|
return <TextInput {...props} />;
|
|
47
63
|
}
|
|
48
64
|
|
|
49
|
-
|
|
50
65
|
const handleChange = date => {
|
|
51
66
|
const changeValue = date && date.isValid() ? date.toISOString() : null;
|
|
52
67
|
onChange({ value: changeValue });
|
|
@@ -57,6 +72,11 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
57
72
|
handleEvent(actions, 'changeNblur', propName, changeValue);
|
|
58
73
|
};
|
|
59
74
|
|
|
75
|
+
//
|
|
76
|
+
// TODO: Keyboard doesn't work in the minute field, it updates one digit then jump to am/pm field
|
|
77
|
+
// try an older version of the lib or use DateTimePicker
|
|
78
|
+
//
|
|
79
|
+
|
|
60
80
|
return (
|
|
61
81
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
62
82
|
<MuiPickersUtilsProvider utils={DayjsUtils}>
|
|
@@ -67,9 +87,9 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
67
87
|
autoOk
|
|
68
88
|
required={required}
|
|
69
89
|
disabled={disabled}
|
|
70
|
-
placeholder=
|
|
71
|
-
format=
|
|
72
|
-
mask=
|
|
90
|
+
placeholder={`${dateFormatInfo.dateFormatStringLC} hh:mm a`}
|
|
91
|
+
format={`${dateFormatInfo.dateFormatString} hh:mm a`}
|
|
92
|
+
mask={`${dateFormatInfo.dateFormatMask} __:__ _m`}
|
|
73
93
|
minutesStep={5}
|
|
74
94
|
error={status === 'error'}
|
|
75
95
|
helperText={helperTextToDisplay}
|
|
@@ -25,15 +25,17 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
25
25
|
onBlur,
|
|
26
26
|
readOnly,
|
|
27
27
|
helperText,
|
|
28
|
-
displayMode
|
|
28
|
+
displayMode,
|
|
29
|
+
hideLabel
|
|
29
30
|
} = props;
|
|
30
31
|
const helperTextToDisplay = validatemessage || helperText;
|
|
31
32
|
|
|
32
|
-
if(displayMode === 'LABELS_LEFT'){
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
34
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
38
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
if (readOnly) {
|
|
@@ -52,7 +54,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
52
54
|
required={required}
|
|
53
55
|
disabled={disabled}
|
|
54
56
|
onChange={onChange}
|
|
55
|
-
onBlur={onBlur}
|
|
57
|
+
onBlur={!readOnly ? onBlur : undefined}
|
|
56
58
|
error={status === 'error'}
|
|
57
59
|
label={label}
|
|
58
60
|
value={value}
|
|
@@ -4,7 +4,8 @@ import CurrencyTextField from '@unicef/material-ui-currency-textfield';
|
|
|
4
4
|
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
5
5
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
|
|
7
|
+
import { format } from "@pega/react-sdk-components/lib/components/helpers/formatters";
|
|
8
|
+
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils.js';
|
|
8
9
|
|
|
9
10
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
10
11
|
|
|
@@ -27,7 +28,9 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
27
28
|
readOnly,
|
|
28
29
|
testId,
|
|
29
30
|
helperText,
|
|
30
|
-
displayMode
|
|
31
|
+
displayMode,
|
|
32
|
+
hideLabel,
|
|
33
|
+
currencyISOCode = "USD"
|
|
31
34
|
} = props;
|
|
32
35
|
const pConn = getPConnect();
|
|
33
36
|
const actions = pConn.getActionsApi();
|
|
@@ -47,17 +50,32 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
47
50
|
};
|
|
48
51
|
|
|
49
52
|
const [currValue, setCurrValue] = useState();
|
|
53
|
+
const [theCurrSym, setCurrSym] = useState("$");
|
|
54
|
+
const [theCurrDec, setCurrDec] = useState(".");
|
|
55
|
+
const [theCurrSep, setCurrSep] = useState(",");
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
// currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
|
|
59
|
+
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
60
|
+
setCurrSym(theSymbols.theCurrencySymbol);
|
|
61
|
+
setCurrDec(theSymbols.theDecimalIndicator);
|
|
62
|
+
setCurrSep(theSymbols.theDigitGroupSeparator);
|
|
63
|
+
}, [currencyISOCode]);
|
|
50
64
|
|
|
51
65
|
useEffect(() => {
|
|
52
66
|
// const testVal = value;
|
|
53
67
|
setCurrValue(value.toString());
|
|
54
68
|
}, [value]);
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return <FieldValueList
|
|
70
|
+
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
71
|
+
const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
|
|
72
|
+
|
|
73
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
74
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
78
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
|
|
61
79
|
}
|
|
62
80
|
|
|
63
81
|
function currOnChange(event, inValue) {
|
|
@@ -84,7 +102,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
84
102
|
required={required}
|
|
85
103
|
disabled={disabled}
|
|
86
104
|
onChange={currOnChange}
|
|
87
|
-
onBlur={currOnBlur}
|
|
105
|
+
onBlur={!readOnly ? currOnBlur : undefined}
|
|
88
106
|
error={status === 'error'}
|
|
89
107
|
label={label}
|
|
90
108
|
value={currValue}
|
|
@@ -95,6 +113,9 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
95
113
|
{{=<% %>=}}
|
|
96
114
|
InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: currValue } }}
|
|
97
115
|
<%={{ }}=%> {{! revert delimiteres for mustache }}
|
|
116
|
+
currencySymbol={theCurrSym}
|
|
117
|
+
decimalCharacter={theCurrDec}
|
|
118
|
+
digitGroupSeparator={theCurrSep}
|
|
98
119
|
/>
|
|
99
120
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
100
121
|
);
|
|
@@ -46,16 +46,19 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
46
46
|
readOnly,
|
|
47
47
|
testId,
|
|
48
48
|
helperText,
|
|
49
|
-
displayMode
|
|
49
|
+
displayMode,
|
|
50
|
+
hideLabel
|
|
50
51
|
} = props;
|
|
51
52
|
const helperTextToDisplay = validatemessage || helperText;
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
|
|
56
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
57
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
61
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
if (readOnly) {
|
|
@@ -68,7 +71,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
68
71
|
'data-test-id': testId
|
|
69
72
|
};
|
|
70
73
|
|
|
71
|
-
|
|
72
74
|
return (
|
|
73
75
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
74
76
|
<TextField
|
|
@@ -81,7 +83,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
81
83
|
required={required}
|
|
82
84
|
disabled={disabled}
|
|
83
85
|
onChange={onChange}
|
|
84
|
-
onBlur={onBlur}
|
|
86
|
+
onBlur={!readOnly ? onBlur : undefined}
|
|
85
87
|
error={status === 'error'}
|
|
86
88
|
label={label}
|
|
87
89
|
value={value}
|
|
@@ -26,15 +26,18 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
26
26
|
readOnly,
|
|
27
27
|
testId,
|
|
28
28
|
helperText,
|
|
29
|
-
displayMode
|
|
29
|
+
displayMode,
|
|
30
|
+
hideLabel
|
|
30
31
|
} = props;
|
|
31
32
|
const helperTextToDisplay = validatemessage || helperText;
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
|
|
35
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
36
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
40
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
if (readOnly) {
|
|
@@ -75,7 +78,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
75
78
|
required={required}
|
|
76
79
|
disabled={disabled}
|
|
77
80
|
onChange={intOnChange}
|
|
78
|
-
onBlur={onBlur}
|
|
81
|
+
onBlur={!readOnly ? onBlur : undefined}
|
|
79
82
|
error={status === 'error'}
|
|
80
83
|
label={label}
|
|
81
84
|
value={value}
|
|
@@ -5,7 +5,7 @@ import MenuItem from '@material-ui/core/MenuItem';
|
|
|
5
5
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
6
|
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
8
|
+
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
9
9
|
|
|
10
10
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
11
11
|
|
|
@@ -31,7 +31,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
31
31
|
status,
|
|
32
32
|
readOnly,
|
|
33
33
|
testId,
|
|
34
|
-
helperText
|
|
34
|
+
helperText,
|
|
35
|
+
displayMode,
|
|
36
|
+
hideLabel,
|
|
37
|
+
onRecordChange
|
|
35
38
|
} = props;
|
|
36
39
|
const [options, setOptions] = useState<Array<IOption>>([]);
|
|
37
40
|
const helperTextToDisplay = validatemessage || helperText;
|
|
@@ -48,6 +51,14 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
48
51
|
|
|
49
52
|
let readOnlyProp = {};
|
|
50
53
|
|
|
54
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
55
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
59
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
if (readOnly) {
|
|
52
63
|
readOnlyProp = { readOnly: true };
|
|
53
64
|
}
|
|
@@ -61,12 +72,11 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
61
72
|
const handleChange = evt => {
|
|
62
73
|
const selectedValue = evt.target.value === 'Select' ? '' : evt.target.value;
|
|
63
74
|
handleEvent(actionsApi, 'changeNblur', propName, selectedValue);
|
|
75
|
+
if (onRecordChange) {
|
|
76
|
+
onRecordChange(evt);
|
|
77
|
+
}
|
|
64
78
|
};
|
|
65
79
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
80
|
// Material UI shows a warning if the component is rendered before options are set.
|
|
71
81
|
// So, hold off on rendering anything until options are available...
|
|
72
82
|
return options.length === 0 ? null : (
|
|
@@ -26,7 +26,8 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
26
26
|
testId,
|
|
27
27
|
fieldMetadata,
|
|
28
28
|
helperText,
|
|
29
|
-
displayMode
|
|
29
|
+
displayMode,
|
|
30
|
+
hideLabel
|
|
30
31
|
} = props;
|
|
31
32
|
const helperTextToDisplay = validatemessage || helperText;
|
|
32
33
|
|
|
@@ -34,11 +35,12 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
34
35
|
|
|
35
36
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
36
37
|
|
|
37
|
-
if(displayMode === 'LABELS_LEFT'){
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
39
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
43
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
if (readOnly) {
|
|
@@ -63,7 +65,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
63
65
|
required={required}
|
|
64
66
|
disabled={disabled}
|
|
65
67
|
onChange={onChange}
|
|
66
|
-
onBlur={onBlur}
|
|
68
|
+
onBlur={!readOnly ? onBlur : undefined}
|
|
67
69
|
error={status === 'error'}
|
|
68
70
|
label={label}
|
|
69
71
|
value={value}
|
|
@@ -27,23 +27,23 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
27
27
|
readOnly,
|
|
28
28
|
testId,
|
|
29
29
|
helperText,
|
|
30
|
-
displayMode
|
|
30
|
+
displayMode,
|
|
31
|
+
hideLabel
|
|
31
32
|
} = props;
|
|
32
33
|
const helperTextToDisplay = validatemessage || helperText;
|
|
33
34
|
|
|
34
|
-
if(displayMode === 'LABELS_LEFT'){
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
36
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
40
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
if (readOnly) {
|
|
42
44
|
return <TextInput {...props} />;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
47
|
let testProp = {};
|
|
48
48
|
|
|
49
49
|
testProp = {
|
|
@@ -61,7 +61,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
61
61
|
required={required}
|
|
62
62
|
disabled={disabled}
|
|
63
63
|
onChange={onChange}
|
|
64
|
-
onBlur={onBlur}
|
|
64
|
+
onBlur={!readOnly ? onBlur : undefined}
|
|
65
65
|
error={status === 'error'}
|
|
66
66
|
label={label}
|
|
67
67
|
value={value}
|