@pega/dx-component-builder-sdk 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.
Files changed (118) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +3 -2
  3. package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +3 -9
  4. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +7 -15
  5. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +38 -37
  6. package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +3 -3
  7. package/src/tasks/map/map.js +29 -8
  8. package/tests/assets/sdk-r/components/create/override-sdk/field/Checkbox/Checkbox.tsx +3 -1
  9. package/tests/assets/sdk-r/components/create/override-sdk/field/Currency/Currency.tsx +7 -15
  10. package/tests/assets/sdk-r/components/create/override-sdk/field/DateTime/config-ext.json +8 -8
  11. package/tests/assets/sdk-r/components/create/override-sdk/field/Decimal/Decimal.tsx +3 -9
  12. package/tests/assets/sdk-r/components/create/override-sdk/field/Decimal/config-ext.json +8 -8
  13. package/tests/assets/sdk-r/components/create/override-sdk/field/Dropdown/config-ext.json +8 -8
  14. package/tests/assets/sdk-r/components/create/override-sdk/field/Email/config-ext.json +8 -8
  15. package/tests/assets/sdk-r/components/create/override-sdk/field/Group/Group.tsx +2 -0
  16. package/tests/assets/sdk-r/components/create/override-sdk/field/Group/config-ext.json +7 -7
  17. package/tests/assets/sdk-r/components/create/override-sdk/field/Integer/config-ext.json +8 -8
  18. package/tests/assets/sdk-r/components/create/override-sdk/field/Percentage/Percentage.tsx +38 -36
  19. package/tests/assets/sdk-r/components/create/override-sdk/field/Percentage/config-ext.json +8 -8
  20. package/tests/assets/sdk-r/components/create/override-sdk/field/RadioButtons/config-ext.json +8 -8
  21. package/tests/assets/sdk-r/components/create/override-sdk/field/SemanticLink/config-ext.json +8 -8
  22. package/tests/assets/sdk-r/components/create/override-sdk/field/TextArea/config-ext.json +8 -8
  23. package/tests/assets/sdk-r/components/create/override-sdk/field/TextContent/config-ext.json +8 -8
  24. package/tests/assets/sdk-r/components/create/override-sdk/field/TextInput/config-ext.json +8 -8
  25. package/tests/assets/sdk-r/components/create/override-sdk/field/Time/config-ext.json +8 -8
  26. package/tests/assets/sdk-r/components/create/override-sdk/field/URL/config-ext.json +8 -8
  27. package/tests/assets/sdk-r/components/create/override-sdk/field/UserReference/config-ext.json +8 -8
  28. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseSummary/config-ext.json +8 -8
  29. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseView/config-ext.json +8 -8
  30. package/tests/assets/sdk-r/components/create/override-sdk/template/Confirmation/config-ext.json +11 -11
  31. package/tests/assets/sdk-r/components/create/override-sdk/template/DataReference/config-ext.json +9 -9
  32. package/tests/assets/sdk-r/components/create/override-sdk/template/DefaultForm/config-ext.json +8 -8
  33. package/tests/assets/sdk-r/components/create/override-sdk/template/DetailsSubTabs/config-ext.json +8 -8
  34. package/tests/assets/sdk-r/components/create/override-sdk/template/DetailsThreeColumn/config-ext.json +8 -8
  35. package/tests/assets/sdk-r/components/create/override-sdk/template/DetailsTwoColumn/config-ext.json +8 -8
  36. package/tests/assets/sdk-r/components/create/override-sdk/template/ListPage/config-ext.json +7 -7
  37. package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/config-ext.json +8 -8
  38. package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/utils.ts +3 -1
  39. package/tests/assets/sdk-r/components/create/override-sdk/template/NarrowWideDetails/config-ext.json +8 -8
  40. package/tests/assets/sdk-r/components/create/override-sdk/template/NarrowWideForm/config-ext.json +8 -8
  41. package/tests/assets/sdk-r/components/create/override-sdk/template/NarrowWidePage/config-ext.json +8 -8
  42. package/tests/assets/sdk-r/components/create/override-sdk/template/OneColumn/config-ext.json +8 -8
  43. package/tests/assets/sdk-r/components/create/override-sdk/template/OneColumnPage/config-ext.json +8 -8
  44. package/tests/assets/sdk-r/components/create/override-sdk/template/OneColumnTab/config-ext.json +8 -8
  45. package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTable/config-ext.json +8 -8
  46. package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +19 -1
  47. package/tests/assets/sdk-r/components/create/override-sdk/template/SubTabs/config-ext.json +8 -8
  48. package/tests/assets/sdk-r/components/create/override-sdk/template/TwoColumn/config-ext.json +8 -8
  49. package/tests/assets/sdk-r/components/create/override-sdk/template/TwoColumnPage/config-ext.json +8 -8
  50. package/tests/assets/sdk-r/components/create/override-sdk/template/TwoColumnTab/config-ext.json +8 -8
  51. package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrowDetails/config-ext.json +8 -8
  52. package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrowForm/config-ext.json +8 -8
  53. package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrowPage/config-ext.json +8 -8
  54. package/tests/assets/sdk-r/components/create/override-sdk/widget/AppAnnouncement/config-ext.json +8 -8
  55. package/tests/assets/sdk-r/components/create/override-sdk/widget/Attachment/Attachment.tsx +5 -1
  56. package/tests/assets/sdk-r/components/create/override-sdk/widget/CaseHistory/config-ext.json +8 -8
  57. package/tests/assets/sdk-r/components/create/override-sdk/widget/FileUtility/config-ext.json +8 -8
  58. package/tests/assets/sdk-r/components/create/override-sdk/widget/Followers/config-ext.json +8 -8
  59. package/tests/assets/sdk-r/components/create/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
  60. package/tests/assets/sdk-r/components/create/override-sdk/widget/ToDo/config-ext.json +8 -8
  61. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyBoolean/index.tsx +3 -2
  62. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/index.tsx +7 -15
  63. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDecimal/index.tsx +3 -9
  64. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/index.tsx +38 -37
  65. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyCaseWidget/index.tsx +3 -3
  66. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Checkbox/Checkbox.tsx +3 -1
  67. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Currency/Currency.tsx +7 -15
  68. package/tests/assets/sdk-r/components/createAll/override-sdk/field/DateTime/config-ext.json +8 -8
  69. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Decimal/Decimal.tsx +3 -9
  70. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Decimal/config-ext.json +8 -8
  71. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Dropdown/config-ext.json +8 -8
  72. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Email/config-ext.json +8 -8
  73. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/Group.tsx +2 -0
  74. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/config-ext.json +7 -7
  75. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Integer/config-ext.json +8 -8
  76. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Percentage/Percentage.tsx +38 -36
  77. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Percentage/config-ext.json +8 -8
  78. package/tests/assets/sdk-r/components/createAll/override-sdk/field/RadioButtons/config-ext.json +8 -8
  79. package/tests/assets/sdk-r/components/createAll/override-sdk/field/SemanticLink/config-ext.json +8 -8
  80. package/tests/assets/sdk-r/components/createAll/override-sdk/field/TextArea/config-ext.json +8 -8
  81. package/tests/assets/sdk-r/components/createAll/override-sdk/field/TextContent/config-ext.json +8 -8
  82. package/tests/assets/sdk-r/components/createAll/override-sdk/field/TextInput/config-ext.json +8 -8
  83. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Time/config-ext.json +8 -8
  84. package/tests/assets/sdk-r/components/createAll/override-sdk/field/URL/config-ext.json +8 -8
  85. package/tests/assets/sdk-r/components/createAll/override-sdk/field/UserReference/config-ext.json +8 -8
  86. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseSummary/config-ext.json +8 -8
  87. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseView/config-ext.json +8 -8
  88. package/tests/assets/sdk-r/components/createAll/override-sdk/template/Confirmation/config-ext.json +11 -11
  89. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DataReference/config-ext.json +9 -9
  90. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DefaultForm/config-ext.json +8 -8
  91. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DetailsSubTabs/config-ext.json +8 -8
  92. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DetailsThreeColumn/config-ext.json +8 -8
  93. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DetailsTwoColumn/config-ext.json +8 -8
  94. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListPage/config-ext.json +7 -7
  95. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/config-ext.json +8 -8
  96. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/utils.ts +3 -1
  97. package/tests/assets/sdk-r/components/createAll/override-sdk/template/NarrowWideDetails/config-ext.json +8 -8
  98. package/tests/assets/sdk-r/components/createAll/override-sdk/template/NarrowWideForm/config-ext.json +8 -8
  99. package/tests/assets/sdk-r/components/createAll/override-sdk/template/NarrowWidePage/config-ext.json +8 -8
  100. package/tests/assets/sdk-r/components/createAll/override-sdk/template/OneColumn/config-ext.json +8 -8
  101. package/tests/assets/sdk-r/components/createAll/override-sdk/template/OneColumnPage/config-ext.json +8 -8
  102. package/tests/assets/sdk-r/components/createAll/override-sdk/template/OneColumnTab/config-ext.json +8 -8
  103. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTable/config-ext.json +8 -8
  104. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +19 -1
  105. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SubTabs/config-ext.json +8 -8
  106. package/tests/assets/sdk-r/components/createAll/override-sdk/template/TwoColumn/config-ext.json +8 -8
  107. package/tests/assets/sdk-r/components/createAll/override-sdk/template/TwoColumnPage/config-ext.json +8 -8
  108. package/tests/assets/sdk-r/components/createAll/override-sdk/template/TwoColumnTab/config-ext.json +8 -8
  109. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrowDetails/config-ext.json +8 -8
  110. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrowForm/config-ext.json +8 -8
  111. package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrowPage/config-ext.json +8 -8
  112. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/AppAnnouncement/config-ext.json +8 -8
  113. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/Attachment/Attachment.tsx +5 -1
  114. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/CaseHistory/config-ext.json +8 -8
  115. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/FileUtility/config-ext.json +8 -8
  116. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/Followers/config-ext.json +8 -8
  117. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/QuickCreate/QuickCreate.tsx +52 -25
  118. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/ToDo/config-ext.json +8 -8
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.18",
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);
@@ -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
  });
@@ -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(getSpecialCalse(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,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 './currency-utils';
10
8
 
11
9
  // Using control from: https://github.com/unicef/material-ui-currency-textfield
@@ -48,17 +46,11 @@ export default function Currency(props: CurrrencyProps) {
48
46
  'data-test-id': testId
49
47
  };
50
48
 
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]);
49
+ // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
50
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
51
+ const theCurrSym = theSymbols.theCurrencySymbol;
52
+ const theCurrDec = theSymbols.theDecimalIndicator;
53
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
62
54
 
63
55
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
64
56
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "DateTime",
3
- "name": "DateTime",
4
- "label": "Date & time",
5
- "description": "Date & time",
6
- "type": "Field",
7
- "subtype": "DateTime",
8
- "properties": []
9
- }
2
+ "componentKey": "DateTime",
3
+ "name": "DateTime",
4
+ "label": "Date & time",
5
+ "description": "Date & time",
6
+ "type": "Field",
7
+ "subtype": "DateTime",
8
+ "properties": []
9
+ }
@@ -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';
@@ -45,14 +44,9 @@ export default function Decimal(props: DecimalProps) {
45
44
  const propName = (pConn.getStateProps() as any).value;
46
45
  const helperTextToDisplay = validatemessage || helperText;
47
46
 
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]);
47
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
48
+ const theCurrDec = theSymbols.theDecimalIndicator;
49
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
56
50
 
57
51
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
58
52
  const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "Decimal",
3
- "name": "Decimal",
4
- "label": "Decimal",
5
- "description": "Decimal",
6
- "type": "Field",
7
- "subtype": "Decimal",
8
- "properties": []
9
- }
2
+ "componentKey": "Decimal",
3
+ "name": "Decimal",
4
+ "label": "Decimal",
5
+ "description": "Decimal",
6
+ "type": "Field",
7
+ "subtype": "Decimal",
8
+ "properties": []
9
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "Dropdown",
3
- "name": "Dropdown",
4
- "label": "Dropdown",
5
- "description": "Picklist",
6
- "type": "Field",
7
- "subtype": "Picklist",
8
- "properties": []
9
- }
2
+ "componentKey": "Dropdown",
3
+ "name": "Dropdown",
4
+ "label": "Dropdown",
5
+ "description": "Picklist",
6
+ "type": "Field",
7
+ "subtype": "Picklist",
8
+ "properties": []
9
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "Email",
3
- "name": "Email",
4
- "label": "Email",
5
- "description": "Email",
6
- "type": "Field",
7
- "subtype": "Text-Email",
8
- "properties": []
9
- }
2
+ "componentKey": "Email",
3
+ "name": "Email",
4
+ "label": "Email",
5
+ "description": "Email",
6
+ "type": "Field",
7
+ "subtype": "Text-Email",
8
+ "properties": []
9
+ }
@@ -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}
@@ -1,8 +1,8 @@
1
1
  {
2
- "componentKey": "Group",
3
- "name": "Group",
4
- "label": "Field Group",
5
- "description": "Field Group",
6
- "type": "Group",
7
- "properties": []
8
- }
2
+ "componentKey": "Group",
3
+ "name": "Group",
4
+ "label": "Field Group",
5
+ "description": "Field Group",
6
+ "type": "Group",
7
+ "properties": []
8
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "componentKey": "Integer",
3
- "name": "Integer",
4
- "label": "Integer",
5
- "description": "Integer",
6
- "type": "Field",
7
- "subtype": "Integer",
8
- "properties": []
9
- }
2
+ "componentKey": "Integer",
3
+ "name": "Integer",
4
+ "label": "Integer",
5
+ "description": "Integer",
6
+ "type": "Field",
7
+ "subtype": "Integer",
8
+ "properties": []
9
+ }