@pega/dx-component-builder-sdk 0.23.17 → 0.23.19

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 (35) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +3 -2
  4. package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +3 -9
  5. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +7 -15
  6. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/demo.stories.tsx.mustache +20 -0
  7. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +38 -37
  8. package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +3 -3
  9. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.tsx.mustache +7 -0
  10. package/src/tasks/map/map.js +29 -8
  11. package/tests/assets/sdk-r/components/create/override-sdk/field/Checkbox/Checkbox.tsx +3 -1
  12. package/tests/assets/sdk-r/components/create/override-sdk/field/Currency/Currency.tsx +10 -16
  13. package/tests/assets/sdk-r/components/create/override-sdk/field/Decimal/Decimal.tsx +6 -10
  14. package/tests/assets/sdk-r/components/create/override-sdk/field/Group/Group.tsx +2 -0
  15. package/tests/assets/sdk-r/components/create/override-sdk/field/Percentage/Percentage.tsx +41 -36
  16. package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/ListView.tsx +2 -1
  17. package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/utils.ts +3 -1
  18. package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +19 -1
  19. package/tests/assets/sdk-r/components/create/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
  20. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyBoolean/index.tsx +3 -2
  21. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/index.tsx +7 -15
  22. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDecimal/index.tsx +3 -9
  23. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/demo.stories.tsx +20 -0
  24. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/index.tsx +38 -37
  25. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyCaseWidget/index.tsx +3 -3
  26. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +7 -0
  27. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Checkbox/Checkbox.tsx +3 -1
  28. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Currency/Currency.tsx +10 -16
  29. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Decimal/Decimal.tsx +6 -10
  30. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/Group.tsx +2 -0
  31. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Percentage/Percentage.tsx +41 -36
  32. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/ListView.tsx +2 -1
  33. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/utils.ts +3 -1
  34. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +19 -1
  35. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
package/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- This project provides you with an environment to extend SDK-R by giving you tools to create and publish custom components that are not available from the SDK-R release.
5
+ This project provides you with an environment to extend SDK-R/SDK-A by giving you tools to create and publish custom components that are not available from the SDK-R/SDK-A release.
6
6
 
7
7
  ## Prerequisites
8
8
 
9
9
  Ensure you have access to the following in your system:
10
10
 
11
- - Pega Infinity Server version 8.8 or later
11
+ - Pega Infinity Server version 23
12
12
 
13
13
  - Git version 2.30 or later
14
14
 
@@ -16,7 +16,7 @@ Ensure you have access to the following in your system:
16
16
 
17
17
  - System npm version 8
18
18
 
19
- - Installed SDK-R, as the below commands live in the package.json of the SDK-R an NOT in this npm module
19
+ - Installed SDK-R or SDK-A, as the below commands live in the package.json of the SDK-R/SDK-A an NOT in this npm module
20
20
 
21
21
 
22
22
  ## Create custom components
@@ -79,7 +79,7 @@ The *config.json* file contains the mapping of properties for configuring the au
79
79
 
80
80
 
81
81
  2. Enter the following command to start the storybook to view the demo.
82
- `npm start`
82
+ `npm run startStorybook (Angular) npm run storybookSDK (React) or npm run storybookConstellation (React)`
83
83
 
84
84
  3. Modify the source files to build your own component. You can also install and import third-party libraries if required for your component.
85
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/dx-component-builder-sdk",
3
- "version": "0.23.17",
3
+ "version": "0.23.19",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from 'react';
2
- import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText } from '@material-ui/core';
2
+ import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@material-ui/core';
3
3
 
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
@@ -24,6 +24,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
24
24
 
25
25
  const {
26
26
  getPConnect,
27
+ label,
27
28
  value = false,
28
29
  readOnly,
29
30
  testId,
@@ -78,6 +79,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
78
79
  return (
79
80
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
80
81
  <FormControl required={required} error={status === 'error'}>
82
+ {!hideLabel && <FormLabel component='legend'>{label}</FormLabel>}
81
83
  <FormGroup>
82
84
  <FormControlLabel
83
85
  control={theCheckbox}
@@ -94,4 +96,3 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
94
96
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
95
97
  );
96
98
  }
97
-
@@ -1,4 +1,3 @@
1
- import { useState, useEffect } from 'react';
2
1
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
2
 
4
3
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils.js';
@@ -49,14 +48,9 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
49
48
  const propName = (pConn.getStateProps() as any).value;
50
49
  const helperTextToDisplay = validatemessage || helperText;
51
50
 
52
- const [theCurrDec, setCurrDec] = useState('.');
53
- const [theCurrSep, setCurrSep] = useState(',');
54
-
55
- useEffect(() => {
56
- const theSymbols = getCurrencyCharacters(currencyISOCode);
57
- setCurrDec(theSymbols.theDecimalIndicator);
58
- setCurrSep(theSymbols.theDigitGroupSeparator);
59
- }, [currencyISOCode]);
51
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
52
+ const theCurrDec = theSymbols.theDecimalIndicator;
53
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
60
54
 
61
55
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
62
56
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -1,11 +1,9 @@
1
- import { useState, useEffect } from 'react';
2
1
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
2
 
4
- import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
- import { format } from "@pega/react-sdk-components/lib/components/helpers/formatters";
6
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
4
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
-
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';
9
7
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils.js';
10
8
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
11
9
 
@@ -52,17 +50,11 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
52
50
  'data-test-id': testId
53
51
  };
54
52
 
55
- const [theCurrSym, setCurrSym] = useState('$');
56
- const [theCurrDec, setCurrDec] = useState('.');
57
- const [theCurrSep, setCurrSep] = useState(',');
58
-
59
- useEffect(() => {
60
- // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
61
- const theSymbols = getCurrencyCharacters(currencyISOCode);
62
- setCurrSym(theSymbols.theCurrencySymbol);
63
- setCurrDec(theSymbols.theDecimalIndicator);
64
- setCurrSep(theSymbols.theDigitGroupSeparator);
65
- }, [currencyISOCode]);
53
+ // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
54
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
55
+ const theCurrSym = theSymbols.theCurrencySymbol;
56
+ const theCurrDec = theSymbols.theDecimalIndicator;
57
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
66
58
 
67
59
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
68
60
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -10,6 +10,20 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
10
10
  excludeStories: /.*Data$/
11
11
  };
12
12
 
13
+ window.PCore = {
14
+ ...window.PCore,
15
+ getEnvironmentInfo: (): any => {
16
+ return {
17
+ getUseLocale: () => {
18
+ return 'en-GB';
19
+ },
20
+ getLocale: () => {
21
+ return 'en-GB';
22
+ }
23
+ };
24
+ }
25
+ };
26
+
13
27
  export default meta;
14
28
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
15
29
 
@@ -22,10 +36,16 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
22
36
  fieldMetadata,
23
37
  getPConnect: () => {
24
38
  return {
39
+ getComponentName: () => {
40
+ return 'Percentage';
41
+ },
25
42
  getActionsApi: () => {
26
43
  return {
27
44
  updateFieldValue: (propName, theValue) => {
28
45
  setValue(theValue);
46
+ },
47
+ triggerFieldChange: (propName, theValue) => {
48
+ setValue(theValue);
29
49
  }
30
50
  };
31
51
  },
@@ -1,69 +1,57 @@
1
- import { TextField } from '@material-ui/core';
2
- import { makeStyles } from '@material-ui/core/styles';
1
+ import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
2
 
4
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
4
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+ import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils.js';
6
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
7
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
6
8
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
7
9
 
8
- // Inspired by https://stackoverflow.com/questions/50823182/material-ui-remove-up-down-arrow-dials-from-textview
9
- const useStyles = makeStyles((/* theme */) => ({
10
- input: {
11
- '& input[type=number]': {
12
- '-moz-appearance': 'textfield'
13
- },
14
- '& input[type=number]::-webkit-outer-spin-button': {
15
- '-webkit-appearance': 'none',
16
- margin: 0
17
- },
18
- '& input[type=number]::-webkit-inner-spin-button': {
19
- '-webkit-appearance': 'none',
20
- margin: 0
21
- }
22
- }
23
- }));
24
-
25
10
  interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
26
11
  // If any, enter additional props that only exist on this componentName
12
+ currencyISOCode: string;
27
13
  }
28
14
 
29
15
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
30
16
  export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
31
17
  // Get emitted components from map (so we can get any override that may exist)
32
- const TextInput = getComponentFromMap('TextInput');
33
18
  const FieldValueList = getComponentFromMap('FieldValueList');
34
19
 
35
- const classes = useStyles();
36
-
37
20
  const {
21
+ getPConnect,
38
22
  label,
39
23
  required,
40
24
  disabled,
41
25
  value = '',
42
26
  validatemessage,
43
27
  status,
44
- onChange,
45
- onBlur,
28
+ // onChange,
29
+ // onBlur,
46
30
  readOnly,
31
+ currencyISOCode = 'USD',
47
32
  testId,
48
33
  helperText,
49
34
  displayMode,
50
35
  hideLabel,
51
36
  placeholder
52
37
  } = props;
38
+
39
+ const pConn = getPConnect();
40
+ const actions = pConn.getActionsApi();
41
+ const propName = (pConn.getStateProps() as any).value;
53
42
  const helperTextToDisplay = validatemessage || helperText;
54
43
 
44
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
45
+ const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
46
+
55
47
  // console.log(`Percentage: label: ${label} value: ${value}`);
56
48
 
57
49
  if (displayMode === 'LABELS_LEFT') {
58
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
50
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
59
51
  }
60
52
 
61
53
  if (displayMode === 'STACKED_LARGE_VAL') {
62
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
63
- }
64
-
65
- if (readOnly) {
66
- return <TextInput {...props} />;
54
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
67
55
  }
68
56
 
69
57
  let testProp = {};
@@ -72,10 +60,17 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
72
60
  'data-test-id': testId
73
61
  };
74
62
 
63
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
64
+ const theCurrDec = theSymbols.theDecimalIndicator;
65
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
66
+
67
+ function PercentageOnBlur(event, inValue) {
68
+ handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
69
+ }
70
+
75
71
  return (
76
72
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
77
- <TextField
78
- className={classes.input}
73
+ <CurrencyTextField
79
74
  fullWidth
80
75
  variant={readOnly ? 'standard' : 'outlined'}
81
76
  helperText={helperTextToDisplay}
@@ -83,18 +78,24 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
83
78
  size='small'
84
79
  required={required}
85
80
  disabled={disabled}
86
- onChange={onChange}
87
- onBlur={!readOnly ? onBlur : undefined}
81
+ readOnly={!!readOnly}
88
82
  error={status === 'error'}
89
83
  label={label}
90
84
  value={value}
91
- type='number'
85
+ type='text'
86
+ outputFormat='number'
87
+ textAlign='left'
92
88
  {{! pick new delimiters for mustache }}
93
89
  {{=<% %>=}}
94
- inputProps={{ ...testProp }}
90
+ InputProps={{
91
+ inputProps: { ...testProp }
92
+ }}
95
93
  <%={{ }}=%> {{! revert delimiters for mustache }}
94
+ currencySymbol=''
95
+ decimalCharacter={theCurrDec}
96
+ digitGroupSeparator={theCurrSep}
97
+ onBlur={!readOnly ? PercentageOnBlur : undefined}
96
98
  />
97
99
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
98
100
  );
99
101
  }
100
-
@@ -151,9 +151,9 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
151
151
  const theKey = `CaseHistory-${index}`;
152
152
  theDataRows.push(
153
153
  <TableRow key={theKey}>
154
- <StyledTableCell>{dataRow[0] ? dataRow[0] : '---'}</StyledTableCell>
155
- <StyledTableCell>{dataRow[1] ? dataRow[1] : '---'}</StyledTableCell>
156
- <StyledTableCell>{dataRow[2] ? dataRow[2] : '---'}</StyledTableCell>
154
+ <StyledTableCell>{dataRow[0] ? dataRow[0] as any : '---'}</StyledTableCell>
155
+ <StyledTableCell>{dataRow[1] ? dataRow[1] as any : '---'}</StyledTableCell>
156
+ <StyledTableCell>{dataRow[2] ? dataRow[2] as any : '---'}</StyledTableCell>
157
157
  </TableRow>
158
158
  );
159
159
  });
@@ -11,6 +11,13 @@ window.PCore = {
11
11
  return new Promise(resolve => {
12
12
  resolve(operatorDetails);
13
13
  });
14
+ },
15
+ };
16
+ },
17
+ getLocaleUtils: (): any => {
18
+ return {
19
+ getLocaleValue: val => {
20
+ return val;
14
21
  }
15
22
  };
16
23
  }
@@ -50,6 +50,27 @@ export const getPrettierFormattedString = async (content) => {
50
50
  }
51
51
  }
52
52
 
53
+ //
54
+ // some components reference have a slightly different case/spelling than the component name, class, etc.
55
+ //
56
+ export const getSpecialCase = (componentKey, framework) => {
57
+
58
+ switch (framework) {
59
+ case 'SDK-React':
60
+ switch(componentKey) {
61
+ case "ToDo":
62
+ return "Todo";
63
+ }
64
+ break;
65
+ case 'SDK-Angular':
66
+ break;
67
+ case 'SDK-WebComponents' :
68
+ break;
69
+ }
70
+
71
+ return componentKey;
72
+ }
73
+
53
74
  export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTOM) => {
54
75
 
55
76
  const framework = await getFramework();
@@ -73,7 +94,7 @@ export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTO
73
94
  importComponent = "./".concat(importComponent).split(path.sep).join("/");
74
95
 
75
96
  let importFull = "import ".concat(componentName).concat(" from '").concat(importComponent).concat("/';");
76
- let mapFull = "\"".concat(componentNameNoPrefix).concat("\" : " ).concat(componentName).concat(",");
97
+ let mapFull = "\"".concat(getSpecialCase(componentNameNoPrefix, framework)).concat("\" : " ).concat(componentName).concat(",");
77
98
 
78
99
  if (mapData.indexOf(importComponent.concat("/")) < 0) {
79
100
  // not present so we can add
@@ -141,7 +162,7 @@ export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTO
141
162
  importComponentAng = "./".concat(importComponentAng).split(path.sep).join("/");
142
163
 
143
164
  let importFullAng = "import { ".concat(componentComponentNameAng).concat(" } from '").concat(importComponentAng).concat(".component';");
144
- let mapFullAng = "\"".concat(originalComponentName).concat("\" : " ).concat(componentComponentNameAng).concat(",");
165
+ let mapFullAng = "\"".concat(getSpecialCase(originalComponentName, framework)).concat("\" : " ).concat(componentComponentNameAng).concat(",");
145
166
 
146
167
  if (mapDataAng.indexOf(importComponentAng.concat(".component")) < 0) {
147
168
  // not present so we can add
@@ -222,8 +243,8 @@ export const deleteFromComponentMap = async (componentKey, category = CATEGORY_C
222
243
 
223
244
 
224
245
  let importFull = "import ".concat(componentName).concat(" from '").concat(importComponent).concat("/';");
225
- let mapFull = "\"".concat(componentNameNoPrefix).concat("\" : " ).concat(componentName).concat(",");
226
- let mapFullPretty = componentNameNoPrefix.concat(": ").concat(componentName);
246
+ let mapFull = "\"".concat(getSpecialCase(componentNameNoPrefix, framework)).concat("\" : " ).concat(componentName).concat(",");
247
+ let mapFullPretty = getSpecialCase(componentNameNoPrefix, framework).concat(": ").concat(componentName);
227
248
 
228
249
  if (mapData.indexOf(importFull) >= 0) {
229
250
 
@@ -267,9 +288,9 @@ export const deleteFromComponentMap = async (componentKey, category = CATEGORY_C
267
288
 
268
289
 
269
290
  let importFullAng = "import { ".concat(componentComponentNameAng).concat(" } from '").concat(importComponentAng).concat(".component';");
270
- let mapFullAng = "\"".concat(originalComponentName).concat("\" : " ).concat(componentComponentNameAng).concat(",");
291
+ let mapFullAng = "\"".concat(getSpecialCase(originalComponentName, framework)).concat("\" : " ).concat(componentComponentNameAng).concat(",");
271
292
 
272
- let mapFullAngPretty = originalComponentName.concat(": ").concat(componentComponentNameAng);
293
+ let mapFullAngPretty = getSpecialCase(originalComponentName, framework).concat(": ").concat(componentComponentNameAng);
273
294
 
274
295
  if (mapDataAng.indexOf(importFullAng) >= 0) {
275
296
 
@@ -332,7 +353,7 @@ export const renameComponentInMap = async (oldComponentKey, newComponentKey) =>
332
353
  mapData = mapData.replaceAll( '"' + oldComponentNameNoPrefix + '"' , '"' + newComponentNameNoPrefix + '"');
333
354
 
334
355
  // pretty
335
- mapData = mapData.replaceAll( oldComponentNameNoPrefix + ':' , newComponentNameNoPrefix + ':');
356
+ mapData = mapData.replaceAll( getSpecialCase(oldComponentNameNoPrefix, framework) + ':' , getSpecialCase(newComponentNameNoPrefix, framework) + ':');
336
357
 
337
358
  // prettier
338
359
  mapData = await getPrettierFormattedString(mapData);
@@ -369,7 +390,7 @@ export const renameComponentInMap = async (oldComponentKey, newComponentKey) =>
369
390
  mapDataAng = mapDataAng.replaceAll( oldComponentNameAng + 'Component' , newComponentNameAng + 'Component');
370
391
 
371
392
  // pretty
372
- mapDataAng = mapDataAng.replaceAll( oldComponentNameNoPrefixAng + ':' , newComponentNameNoPrefixAng + ':');
393
+ mapDataAng = mapDataAng.replaceAll( getSpecialCase(oldComponentNameNoPrefixAng, framework) + ':' , getSpecialCase(newComponentNameNoPrefixAng, framework) + ':');
373
394
 
374
395
  // prettier
375
396
  mapDataAng = await getPrettierFormattedString(mapDataAng);
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from 'react';
2
- import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText } from '@material-ui/core';
2
+ import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@material-ui/core';
3
3
 
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
@@ -20,6 +20,7 @@ export default function CheckboxComponent(props: CheckboxProps) {
20
20
 
21
21
  const {
22
22
  getPConnect,
23
+ label,
23
24
  value = false,
24
25
  readOnly,
25
26
  testId,
@@ -73,6 +74,7 @@ export default function CheckboxComponent(props: CheckboxProps) {
73
74
 
74
75
  return (
75
76
  <FormControl required={required} error={status === 'error'}>
77
+ {!hideLabel && <FormLabel component='legend'>{label}</FormLabel>}
76
78
  <FormGroup>
77
79
  <FormControlLabel
78
80
  control={theCheckbox}
@@ -1,14 +1,14 @@
1
- import { useState, useEffect } from 'react';
2
1
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
2
 
4
- import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
- import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
6
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
4
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
-
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';
9
7
  import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
10
8
 
11
- // Using control from: https://github.com/unicef/material-ui-currency-textfield
9
+ /* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
10
+ 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
@@ -48,17 +48,11 @@ export default function Currency(props: CurrrencyProps) {
48
48
  'data-test-id': testId
49
49
  };
50
50
 
51
- const [theCurrSym, setCurrSym] = useState('$');
52
- const [theCurrDec, setCurrDec] = useState('.');
53
- const [theCurrSep, setCurrSep] = useState(',');
54
-
55
- useEffect(() => {
56
- // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
57
- const theSymbols = getCurrencyCharacters(currencyISOCode);
58
- setCurrSym(theSymbols.theCurrencySymbol);
59
- setCurrDec(theSymbols.theDecimalIndicator);
60
- setCurrSep(theSymbols.theDigitGroupSeparator);
61
- }, [currencyISOCode]);
51
+ // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
52
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
53
+ const theCurrSym = theSymbols.theCurrencySymbol;
54
+ const theCurrDec = theSymbols.theDecimalIndicator;
55
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
62
56
 
63
57
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
64
58
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -1,4 +1,3 @@
1
- import { useState, useEffect } from 'react';
2
1
  import CurrencyTextField from '@unicef/material-ui-currency-textfield';
3
2
 
4
3
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
@@ -7,7 +6,9 @@ import { format } from '@pega/react-sdk-components/lib/components/helpers/format
7
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
7
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
8
 
10
- // Using control from: https://github.com/unicef/material-ui-currency-textfield
9
+ /* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
10
+ as per the locale.
11
+ */
11
12
 
12
13
  interface DecimalProps extends PConnFieldProps {
13
14
  // If any, enter additional props that only exist on Decimal here
@@ -45,14 +46,9 @@ export default function Decimal(props: DecimalProps) {
45
46
  const propName = (pConn.getStateProps() as any).value;
46
47
  const helperTextToDisplay = validatemessage || helperText;
47
48
 
48
- const [theCurrDec, setCurrDec] = useState('.');
49
- const [theCurrSep, setCurrSep] = useState(',');
50
-
51
- useEffect(() => {
52
- const theSymbols = getCurrencyCharacters(currencyISOCode);
53
- setCurrDec(theSymbols.theDecimalIndicator);
54
- setCurrSep(theSymbols.theDigitGroupSeparator);
55
- }, [currencyISOCode]);
49
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
50
+ const theCurrDec = theSymbols.theDecimalIndicator;
51
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
56
52
 
57
53
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
58
54
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -29,6 +29,8 @@ export default function Group(props: GroupProps) {
29
29
  );
30
30
  }, [children, type, isReadOnly]);
31
31
 
32
+ if (!children) return null;
33
+
32
34
  return (
33
35
  <FieldGroup name={showHeading ? heading : undefined} collapsible={collapsible} instructions={instructions}>
34
36
  {content}