@pega/dx-component-builder-sdk 0.242.15 → 0.242.16

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 (140) hide show
  1. package/README.md +3 -3
  2. package/package.json +1 -1
  3. package/src/constants.js +39 -6
  4. package/src/tasks/create/templates/Constellation/field/Date/demo.stories.tsx.mustache +0 -16
  5. package/src/tasks/create/templates/Constellation/field/DateTime/demo.stories.tsx.mustache +0 -17
  6. package/src/tasks/create/templates/Constellation/field/Decimal/demo.stories.tsx.mustache +0 -1
  7. package/src/tasks/create/templates/Constellation/field/Decimal-Currency/demo.stories.tsx.mustache +0 -1
  8. package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/demo.stories.tsx.mustache +0 -1
  9. package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/mock.ts.mustache +1 -0
  10. package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/demo.stories.tsx.mustache +9 -20
  11. package/src/tasks/create/templates/Constellation/field/Picklist/demo.stories.tsx.mustache +0 -1
  12. package/src/tasks/create/templates/Constellation/field/Picklist-Autocomplete/demo.stories.tsx.mustache +0 -1
  13. package/src/tasks/create/templates/Constellation/field/Picklist-RadioButtons/demo.stories.tsx.mustache +0 -1
  14. package/src/tasks/create/templates/Constellation/field/Picklist-RadioButtons/index.tsx.mustache +3 -5
  15. package/src/tasks/create/templates/Constellation/field/Text/demo.stories.tsx.mustache +0 -1
  16. package/src/tasks/create/templates/Constellation/field/Text-Email/demo.stories.tsx.mustache +0 -1
  17. package/src/tasks/create/templates/Constellation/field/Text-Email/mock.ts.mustache +1 -0
  18. package/src/tasks/create/templates/Constellation/field/Text-Input/demo.stories.tsx.mustache +0 -1
  19. package/src/tasks/create/templates/Constellation/field/Text-Paragraph/demo.stories.tsx.mustache +0 -1
  20. package/src/tasks/create/templates/Constellation/field/Text-Phone/demo.stories.tsx.mustache +1 -2
  21. package/src/tasks/create/templates/Constellation/field/Text-URL/demo.stories.tsx.mustache +0 -1
  22. package/src/tasks/create/templates/Constellation/field/TimeOfDay/demo.stories.tsx.mustache +0 -1
  23. package/src/tasks/create/templates/Constellation/template/DETAILS/demo.stories.tsx.mustache +10 -0
  24. package/src/tasks/create/templates/Constellation/template/PAGE/demo.stories.tsx.mustache +0 -13
  25. package/src/tasks/create/templates/Constellation/widget/CASE/demo.stories.tsx.mustache +10 -32
  26. package/src/tasks/create/templates/Constellation/widget/CASE/index.tsx.mustache +2 -2
  27. package/src/tasks/create/templates/Constellation/widget/PAGE/demo.stories.tsx.mustache +10 -21
  28. package/src/tasks/create/templates/Constellation/widget/PAGE-CASE/demo.stories.tsx.mustache +10 -22
  29. package/src/tasks/create/templates/SDK-React/field/Date/demo.stories.tsx.mustache +0 -21
  30. package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +5 -1
  31. package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.tsx.mustache +0 -21
  32. package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +13 -5
  33. package/src/tasks/create/templates/SDK-React/field/Decimal/demo.stories.tsx.mustache +0 -14
  34. package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +6 -1
  35. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/demo.stories.tsx.mustache +0 -14
  36. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +6 -1
  37. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/demo.stories.tsx.mustache +0 -14
  38. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +5 -1
  39. package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/demo.stories.tsx.mustache +2 -6
  40. package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/index.tsx.mustache +1 -1
  41. package/src/tasks/create/templates/SDK-React/field/Integer/demo.stories.tsx.mustache +3 -0
  42. package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +25 -20
  43. package/src/tasks/create/templates/SDK-React/field/Picklist-RadioButtons/index.tsx.mustache +1 -4
  44. package/src/tasks/create/templates/SDK-React/field/Text/demo.stories.tsx.mustache +3 -0
  45. package/src/tasks/create/templates/SDK-React/field/Text-Email/demo.stories.tsx.mustache +3 -0
  46. package/src/tasks/create/templates/SDK-React/field/Text-Input/demo.stories.tsx.mustache +3 -0
  47. package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/demo.stories.tsx.mustache +3 -0
  48. package/src/tasks/create/templates/SDK-React/field/Text-Phone/demo.stories.tsx.mustache +3 -0
  49. package/src/tasks/create/templates/SDK-React/field/Text-URL/demo.stories.tsx.mustache +3 -0
  50. package/src/tasks/create/templates/SDK-React/field/TimeOfDay/index.tsx.mustache +1 -1
  51. package/src/tasks/create/templates/SDK-React/template/DETAILS/demo.stories.tsx.mustache +8 -28
  52. package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +7 -2
  53. package/src/tasks/create/templates/SDK-React/template/DETAILS-region/demo.stories.tsx.mustache +8 -28
  54. package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +7 -2
  55. package/src/tasks/create/templates/SDK-React/template/FORM/demo.stories.tsx.mustache +10 -16
  56. package/src/tasks/create/templates/SDK-React/template/FORM-region/index.tsx.mustache +5 -5
  57. package/src/tasks/create/templates/SDK-React/widget/CASE/demo.stories.tsx.mustache +10 -20
  58. package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +2 -1
  59. package/src/tasks/create/templates/SDK-React/widget/PAGE/demo.stories.tsx.mustache +9 -19
  60. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.tsx.mustache +10 -20
  61. package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyRadioButtons/index.tsx +3 -5
  62. package/tests/assets/sdk-r/components/create/custom-sdk/field/Pega_DXIL_MyTestText/demo.stories.tsx +3 -0
  63. package/tests/assets/sdk-r/components/create/override-sdk/designSystemExtension/FieldValueList/FieldValueList.tsx +2 -2
  64. package/tests/assets/sdk-r/components/create/override-sdk/field/Phone/Phone.tsx +5 -5
  65. package/tests/assets/sdk-r/components/create/override-sdk/infra/FlowContainer/FlowContainer.tsx +360 -0
  66. package/tests/assets/sdk-r/components/create/override-sdk/infra/FlowContainer/helpers.ts +138 -0
  67. package/tests/assets/sdk-r/components/create/override-sdk/infra/FlowContainer/index.tsx +1 -0
  68. package/tests/assets/sdk-r/components/create/override-sdk/infra/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +68 -0
  69. package/tests/assets/sdk-r/components/create/override-sdk/infra/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  70. package/tests/assets/sdk-r/components/create/override-sdk/infra/ModalViewContainer/ModalViewContainer.tsx +345 -0
  71. package/tests/assets/sdk-r/components/create/override-sdk/infra/ModalViewContainer/index.tsx +1 -0
  72. package/tests/assets/sdk-r/components/create/override-sdk/infra/NavBar/NavBar.css +1 -0
  73. package/tests/assets/sdk-r/components/create/override-sdk/infra/Reference/Reference.tsx +52 -0
  74. package/tests/assets/sdk-r/components/create/override-sdk/infra/Reference/index.tsx +1 -0
  75. package/tests/assets/sdk-r/components/create/override-sdk/infra/Region/Region.tsx +17 -0
  76. package/tests/assets/sdk-r/components/create/override-sdk/infra/Region/index.tsx +1 -0
  77. package/tests/assets/sdk-r/components/create/override-sdk/infra/RootContainer/RootContainer.tsx +240 -0
  78. package/tests/assets/sdk-r/components/create/override-sdk/infra/RootContainer/index.tsx +1 -0
  79. package/tests/assets/sdk-r/components/create/override-sdk/infra/SimpleView/SimpleView.tsx +48 -0
  80. package/tests/assets/sdk-r/components/create/override-sdk/infra/SimpleView/helper.ts +125 -0
  81. package/tests/assets/sdk-r/components/create/override-sdk/infra/SimpleView/index.tsx +1 -0
  82. package/tests/assets/sdk-r/components/create/override-sdk/infra/ViewContainer/ViewContainer.tsx +201 -0
  83. package/tests/assets/sdk-r/components/create/override-sdk/infra/ViewContainer/index.tsx +1 -0
  84. package/tests/assets/sdk-r/components/create/override-sdk/template/DynamicTabs/DynamicTabs.tsx +80 -0
  85. package/tests/assets/sdk-r/components/create/override-sdk/template/DynamicTabs/config.json +36 -0
  86. package/tests/assets/sdk-r/components/create/override-sdk/template/DynamicTabs/index.tsx +1 -0
  87. package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/ListView.tsx +29 -28
  88. package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +13 -5
  89. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyRadiobuttons/index.tsx +3 -5
  90. package/tests/assets/sdk-r/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/index.tsx +2 -2
  91. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/index.tsx +6 -1
  92. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDate/demo.stories.tsx +3 -0
  93. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDate/index.tsx +5 -1
  94. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/demo.stories.tsx +3 -0
  95. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/index.tsx +13 -5
  96. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDecimal/index.tsx +6 -1
  97. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyEmail/demo.stories.tsx +3 -0
  98. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyIconButtonURL/index.tsx +1 -1
  99. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyInteger/demo.stories.tsx +3 -0
  100. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyParagraph/demo.stories.tsx +3 -0
  101. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/index.tsx +5 -1
  102. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPhone/demo.stories.tsx +3 -0
  103. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPhone/index.tsx +5 -5
  104. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPicklist/index.tsx +25 -20
  105. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyRadiobuttons/index.tsx +1 -4
  106. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyText/demo.stories.tsx +3 -0
  107. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTextInput/demo.stories.tsx +3 -0
  108. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTimeOfDay/index.tsx +1 -1
  109. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyURL/demo.stories.tsx +3 -0
  110. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyDetails/index.tsx +7 -2
  111. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnDetails/index.tsx +7 -2
  112. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +28 -13
  113. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnForm/index.tsx +5 -5
  114. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyCaseWidget/index.tsx +2 -1
  115. package/tests/assets/sdk-r/components/createAll/override-sdk/designSystemExtension/FieldValueList/FieldValueList.tsx +2 -2
  116. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Phone/Phone.tsx +5 -5
  117. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/FlowContainer/FlowContainer.tsx +360 -0
  118. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/FlowContainer/helpers.ts +138 -0
  119. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/FlowContainer/index.tsx +1 -0
  120. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +68 -0
  121. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  122. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ModalViewContainer/ModalViewContainer.tsx +345 -0
  123. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ModalViewContainer/index.tsx +1 -0
  124. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/NavBar/NavBar.css +1 -0
  125. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Reference/Reference.tsx +52 -0
  126. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Reference/index.tsx +1 -0
  127. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Region/Region.tsx +17 -0
  128. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Region/index.tsx +1 -0
  129. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/RootContainer/RootContainer.tsx +240 -0
  130. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/RootContainer/index.tsx +1 -0
  131. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/SimpleView/SimpleView.tsx +48 -0
  132. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/SimpleView/helper.ts +125 -0
  133. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/SimpleView/index.tsx +1 -0
  134. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ViewContainer/ViewContainer.tsx +201 -0
  135. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/ViewContainer/index.tsx +1 -0
  136. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DynamicTabs/DynamicTabs.tsx +80 -0
  137. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DynamicTabs/config.json +36 -0
  138. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DynamicTabs/index.tsx +1 -0
  139. package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/ListView.tsx +29 -28
  140. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +13 -5
@@ -4,27 +4,6 @@ import type { Meta, StoryObj } from '@storybook/react';
4
4
  import {{COMPONENT_CLASS_NAME}} from './index';
5
5
  import { configProps, stateProps } from './mock';
6
6
 
7
- window.PCore = {
8
- ...window.PCore,
9
- getEnvironmentInfo: (): any => {
10
- return {
11
- getUseLocale: () => {
12
- return 'en-GB';
13
- },
14
- getLocale: () => {
15
- return 'en-GB';
16
- }
17
- };
18
- },
19
- getLocaleUtils: (): any => {
20
- return {
21
- getLocaleValue: value => {
22
- return value;
23
- }
24
- };
25
- }
26
- };
27
-
28
7
  const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
29
8
  title: '{{COMPONENT_CLASS_NAME}}',
30
9
  component: {{COMPONENT_CLASS_NAME}},
@@ -1,9 +1,9 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
3
3
  import { LocalizationProvider } from '@mui/x-date-pickers';
4
4
  import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
5
5
  import dayjs, { Dayjs } from 'dayjs';
6
-
6
+ import DateFormatter from '@pega/react-sdk-components/lib/components/helpers/formatters/Date';
7
7
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
8
8
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
9
9
  import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
@@ -26,7 +26,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
26
26
 
27
27
  const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel } = props;
28
28
 
29
- const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(value) : null);
29
+ const environmentInfo = PCore.getEnvironmentInfo();
30
+ const timezone = environmentInfo && environmentInfo.getTimeZone();
31
+
32
+ const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(DateFormatter.convertToTimezone(value, { timezone })) : null);
30
33
 
31
34
  const pConn = getPConnect();
32
35
  const actions = pConn.getActionsApi();
@@ -41,6 +44,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
41
44
  dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
42
45
  dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
43
46
 
47
+ useEffect(() => {
48
+ setDateValue(dayjs(DateFormatter.convertToTimezone(value, { timezone })));
49
+ }, [value]);
50
+
44
51
  if (displayMode === 'DISPLAY_ONLY') {
45
52
  const formattedDateTime = format(props.value, 'datetime', {
46
53
  format: `${dateFormatInfo.dateFormatString} hh:mm a`
@@ -67,8 +74,9 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
67
74
  };
68
75
 
69
76
  const handleChange = date => {
70
- setDateValue(date);
71
- const changeValue = date && date.isValid() ? date.toISOString() : null;
77
+ const timeZoneDateTime = dayjs.tz(date.format('YYYY-MM-DDTHH:mm:ss'), timezone);
78
+ const changeValue = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';
79
+ setDateValue(timeZoneDateTime);
72
80
  handleEvent(actions, 'changeNblur', propName, changeValue);
73
81
  };
74
82
 
@@ -4,20 +4,6 @@ import type { Meta, StoryObj } from '@storybook/react';
4
4
  import {{COMPONENT_CLASS_NAME}} from './index';
5
5
  import { configProps, fieldMetadata } from './mock';
6
6
 
7
- window.PCore = {
8
- ...window.PCore,
9
- getEnvironmentInfo: (): any => {
10
- return {
11
- getUseLocale: () => {
12
- return 'en-GB';
13
- },
14
- getLocale: () => {
15
- return 'en-GB';
16
- }
17
- };
18
- }
19
- };
20
-
21
7
  const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
22
8
  title: '{{COMPONENT_CLASS_NAME}}',
23
9
  component: {{COMPONENT_CLASS_NAME}},
@@ -1,6 +1,6 @@
1
1
  import { NumericFormat } from 'react-number-format';
2
2
  import { TextField } from '@mui/material';
3
- import { useState } from 'react';
3
+ import { useEffect, useState } from 'react';
4
4
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
6
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
@@ -63,6 +63,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
63
63
 
64
64
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
65
65
 
66
+ useEffect(() => {
67
+ setValues(value.toString());
68
+ }, [value]);
69
+
66
70
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
67
71
 
68
72
  if (readOnly) {
@@ -115,6 +119,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
115
119
  }}
116
120
  onBlur={!readOnly ? decimalOnBlur : undefined}
117
121
  prefix={readOnly && formatter === 'Currency' ? theCurrSym : ''}
122
+ suffix={readOnly && formatter === 'Percentage' ? '%' : ''}
118
123
  decimalSeparator={theCurrDec}
119
124
  thousandSeparator={showGroupSeparators ? theCurrSep : ''}
120
125
  decimalScale={readOnly && formatter === 'Currency' ? undefined : decimalPrecision}
@@ -4,20 +4,6 @@ import type { Meta, StoryObj } from '@storybook/react';
4
4
  import {{COMPONENT_CLASS_NAME}} from './index';
5
5
  import { configProps, fieldMetadata } from './mock';
6
6
 
7
- window.PCore = {
8
- ...window.PCore,
9
- getEnvironmentInfo: (): any => {
10
- return {
11
- getUseLocale: () => {
12
- return 'en-GB';
13
- },
14
- getLocale: () => {
15
- return 'en-GB';
16
- }
17
- };
18
- }
19
- };
20
-
21
7
  const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
22
8
  title: '{{COMPONENT_CLASS_NAME}}',
23
9
  component: {{COMPONENT_CLASS_NAME}},
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { NumericFormat } from 'react-number-format';
3
3
  import { TextField } from '@mui/material';
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
@@ -55,6 +55,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
55
55
  'data-test-id': testId
56
56
  };
57
57
 
58
+ useEffect(() => {
59
+ setValues(value.toString());
60
+ }, [value]);
61
+
58
62
  // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
59
63
  const theSymbols = getCurrencyCharacters(currencyISOCode);
60
64
  const theCurrSym = theSymbols.theCurrencySymbol;
@@ -93,6 +97,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
93
97
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
94
98
  <NumericFormat
95
99
  valueIsNumericString
100
+ variant={readOnly ? 'standard' : 'outlined'}
96
101
  label={label}
97
102
  helperText={helperTextToDisplay}
98
103
  placeholder={placeholder ?? ''}
@@ -10,20 +10,6 @@ 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
-
27
13
  export default meta;
28
14
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
29
15
 
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { NumericFormat } from 'react-number-format';
3
3
  import { TextField } from '@mui/material';
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
@@ -56,6 +56,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
56
56
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
57
57
  const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
58
58
 
59
+ useEffect(() => {
60
+ setValues(value.toString());
61
+ }, [value]);
62
+
59
63
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
60
64
 
61
65
  if (readOnly) {
@@ -12,10 +12,6 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
12
12
  export default meta;
13
13
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
14
14
 
15
- if (!window.PCore) {
16
- window.PCore = {} as any;
17
- }
18
-
19
15
  const statelistData = {
20
16
  data: [
21
17
  {
@@ -33,7 +29,7 @@ const statelistData = {
33
29
  ]
34
30
  };
35
31
 
36
- window.PCore.getDataPageUtils = (() => {
32
+ window.PCore.getDataPageUtils = (): any => {
37
33
  return {
38
34
  getDataAsync: () => {
39
35
  return new Promise(resolve => {
@@ -41,7 +37,7 @@ window.PCore.getDataPageUtils = (() => {
41
37
  });
42
38
  }
43
39
  };
44
- }) as any;
40
+ };
45
41
 
46
42
  export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
47
43
  const props = {
@@ -127,7 +127,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
127
127
  </Tooltip>
128
128
  {
129
129
  // eslint-disable-next-line jsx-a11y/control-has-associated-label
130
- <a href={validUrl} style={{ display: 'flex' }}>
130
+ <a href={validUrl} target='_blank' style={{ display: 'flex' }} rel='noreferrer'>
131
131
  <LanguageIcon />
132
132
  </a>
133
133
  }
@@ -26,6 +26,9 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
26
26
  return {
27
27
  updateFieldValue: (propName, theValue) => {
28
28
  setValue(theValue);
29
+ },
30
+ triggerFieldChange: (propName, theValue) => {
31
+ setValue(theValue);
29
32
  }
30
33
  };
31
34
  },
@@ -143,7 +143,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
143
143
  }, [theDatasource]);
144
144
 
145
145
  useEffect(() => {
146
- if (!displayMode && listType !== 'associated' && typeof datasource === 'string') {
146
+ if (listType !== 'associated' && typeof datasource === 'string') {
147
147
  getDataPage(datasource, parameters, context).then((results: any) => {
148
148
  const optionsData: any[] = [];
149
149
  const displayColumn = getDisplayFieldsMetaData(columns);
@@ -171,25 +171,31 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
171
171
 
172
172
  let readOnlyProp = {};
173
173
 
174
- if (displayMode === 'DISPLAY_ONLY') {
175
- return (
176
- <FieldValueList
177
- name={hideLabel ? '' : label}
178
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
179
- value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
180
- />
181
- );
182
- }
174
+ const displayFn = (displayM, val) => {
175
+ if (displayM === 'DISPLAY_ONLY') {
176
+ return (
177
+ <FieldValueList
178
+ name={hideLabel ? '' : label}
179
+ value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
180
+ />
181
+ );
182
+ }
183
+
184
+ if (displayM === 'STACKED_LARGE_VAL') {
185
+ return (
186
+ <FieldValueList
187
+ name={hideLabel ? '' : label}
188
+ value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
189
+ variant='stacked'
190
+ />
191
+ );
192
+ }
193
+
194
+ return null;
195
+ };
183
196
 
184
- if (displayMode === 'STACKED_LARGE_VAL') {
185
- return (
186
- <FieldValueList
187
- name={hideLabel ? '' : label}
188
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
189
- value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
190
- variant='stacked'
191
- />
192
- );
197
+ if (displayMode) {
198
+ return displayFn(displayMode, options.find(option => option.key === value)?.value || value);
193
199
  }
194
200
 
195
201
  if (readOnly) {
@@ -234,7 +240,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
234
240
  >
235
241
  {options.map((option: any) => (
236
242
  <MenuItem key={option.key} value={option.key}>
237
- {/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}
238
243
  {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
239
244
  </MenuItem>
240
245
  ))}
@@ -70,7 +70,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
70
70
  return (
71
71
  <FieldValueList
72
72
  name={hideLabel ? '' : label}
73
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
74
73
  value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
75
74
  />
76
75
  );
@@ -80,7 +79,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
80
79
  return (
81
80
  <FieldValueList
82
81
  name={hideLabel ? '' : label}
83
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
84
82
  value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
85
83
  variant='stacked'
86
84
  />
@@ -97,7 +95,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
97
95
 
98
96
  return (
99
97
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
100
- <FormControl error={status === 'error'} required={required}>
98
+ <FormControl variant='standard' error={status === 'error'} required={required}>
101
99
  <FormLabel component='legend'>{label}</FormLabel>
102
100
  <RadioGroup value={theSelectedButton} onChange={handleChange} onBlur={!readOnly ? handleBlur : undefined} row={inline}>
103
101
  {theOptions.map(theOption => {
@@ -108,7 +106,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
108
106
  label={thePConn.getLocalizedValue(
109
107
  theOption.value,
110
108
  localePath,
111
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
112
109
  thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
113
110
  )}
114
111
  control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
@@ -26,6 +26,9 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
26
26
  return {
27
27
  updateFieldValue: (propName, theValue) => {
28
28
  setValue(theValue);
29
+ },
30
+ triggerFieldChange: (propName, theValue) => {
31
+ setValue(theValue);
29
32
  }
30
33
  };
31
34
  },
@@ -25,6 +25,9 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
25
25
  return {
26
26
  updateFieldValue: (propName, theValue) => {
27
27
  setValue(theValue);
28
+ },
29
+ triggerFieldChange: (propName, theValue) => {
30
+ setValue(theValue);
28
31
  }
29
32
  };
30
33
  },
@@ -27,6 +27,9 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
27
27
  return {
28
28
  updateFieldValue: (propName, theValue) => {
29
29
  setValue(theValue);
30
+ },
31
+ triggerFieldChange: (propName, theValue) => {
32
+ setValue(theValue);
30
33
  }
31
34
  };
32
35
  },
@@ -27,6 +27,9 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
27
27
  return {
28
28
  updateFieldValue: (propName, theValue) => {
29
29
  setValue(theValue);
30
+ },
31
+ triggerFieldChange: (propName, theValue) => {
32
+ setValue(theValue);
30
33
  }
31
34
  };
32
35
  },
@@ -25,6 +25,9 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
25
25
  return {
26
26
  updateFieldValue: (propName, theValue) => {
27
27
  setValue(theValue);
28
+ },
29
+ triggerFieldChange: (propName, theValue) => {
30
+ setValue(theValue);
28
31
  }
29
32
  };
30
33
  },
@@ -25,6 +25,9 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
25
25
  return {
26
26
  updateFieldValue: (propName, theValue) => {
27
27
  setValue(theValue);
28
+ },
29
+ triggerFieldChange: (propName, theValue) => {
30
+ setValue(theValue);
28
31
  }
29
32
  };
30
33
  },
@@ -47,7 +47,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
47
47
  };
48
48
 
49
49
  const handleChange = date => {
50
- const theValue = date && date.isValid() ? date.format('HH:mm') : null;
50
+ const theValue = date && date.isValid() ? date.format('HH:mm:ss') : null;
51
51
  handleEvent(actions, 'changeNblur', propName, theValue);
52
52
  };
53
53
 
@@ -15,34 +15,14 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
15
15
  export default meta;
16
16
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
17
17
 
18
- window.PCore = {
19
- ...window.PCore,
20
- getUserApi: (): any => {
21
- return {
22
- getOperatorDetails: () => {
23
- return new Promise(resolve => {
24
- resolve(operatorDetails);
25
- });
26
- }
27
- };
28
- },
29
- getLocaleUtils: (): any => {
30
- return {
31
- getLocaleValue: value => {
32
- return value;
33
- }
34
- };
35
- },
36
- getEnvironmentInfo: (): any => {
37
- return {
38
- getUseLocale: () => {
39
- return 'en-GB';
40
- },
41
- getLocale: () => {
42
- return 'en-GB';
43
- }
44
- };
45
- }
18
+ window.PCore.getUserApi = (): any => {
19
+ return {
20
+ getOperatorDetails: () => {
21
+ return new Promise(resolve => {
22
+ resolve(operatorDetails);
23
+ });
24
+ }
25
+ };
46
26
  };
47
27
 
48
28
  export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
@@ -9,6 +9,8 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
9
9
 
10
10
  interface {{COMPONENT_CLASS_NAME}}Props extends PConnProps {
11
11
  // If any, enter additional props that only exist on this component
12
+ label: string;
13
+ showLabel: boolean;
12
14
  showHighlightedData: boolean;
13
15
  }
14
16
  // Duplicated runtime code from React SDK
@@ -17,8 +19,11 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
17
19
  // Get emitted components from map (so we can get any override that may exist)
18
20
  const FieldGroup = getComponentFromMap('FieldGroup');
19
21
 
20
- const { getPConnect, showHighlightedData } = props;
22
+ const { label, showLabel, getPConnect, showHighlightedData } = props;
21
23
 
24
+ // Get the inherited props from the parent to determine label settings
25
+ const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
26
+
22
27
  // Set display mode prop and re-create the children so this part of the dom tree renders
23
28
  // in a readonly (display) mode instead of a editable
24
29
  getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
@@ -52,7 +57,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
52
57
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
53
58
  {{! pick new delimiters for mustache }}
54
59
  {{=<% %>=}}
55
- <FieldGroup>
60
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
56
61
  {showHighlightedData && highlightedDataArr.length > 0 && (
57
62
  <Grid container spacing={1} style={{ padding: '0 0 1em' }}>
58
63
  {highlightedDataArr.map((child, i) => (
@@ -3,34 +3,14 @@ import type { Meta, StoryObj } from '@storybook/react';
3
3
  import {{COMPONENT_CLASS_NAME}} from './index';
4
4
  import operatorDetails, { pyReviewRaw } from './mock';
5
5
 
6
- window.PCore = {
7
- ...window.PCore,
8
- getUserApi: (): any => {
9
- return {
10
- getOperatorDetails: () => {
11
- return new Promise(resolve => {
12
- resolve(operatorDetails);
13
- });
14
- }
15
- };
16
- },
17
- getLocaleUtils: (): any => {
18
- return {
19
- getLocaleValue: value => {
20
- return value;
21
- }
22
- };
23
- },
24
- getEnvironmentInfo: (): any => {
25
- return {
26
- getUseLocale: () => {
27
- return 'en-US';
28
- },
29
- getLocale: () => {
30
- return 'en-GB';
31
- }
32
- };
33
- }
6
+ window.PCore.getUserApi = (): any => {
7
+ return {
8
+ getOperatorDetails: () => {
9
+ return new Promise(resolve => {
10
+ resolve(operatorDetails);
11
+ });
12
+ }
13
+ };
34
14
  };
35
15
 
36
16
  const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
@@ -9,6 +9,8 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
9
9
 
10
10
  interface {{COMPONENT_CLASS_NAME}}Props extends PConnProps {
11
11
  // If any, enter additional props that only exist on this component
12
+ showLabel: boolean;
13
+ label: string;
12
14
  showHighlightedData: boolean;
13
15
  }
14
16
  // Duplicated runtime code from React SDK
@@ -17,7 +19,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
17
19
  // Get emitted components from map (so we can get any override that may exist)
18
20
  const FieldGroup = getComponentFromMap('FieldGroup');
19
21
 
20
- const { getPConnect, showHighlightedData = false } = props;
22
+ const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
23
+
24
+ // Get the inherited props from the parent to determine label settings
25
+ const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
21
26
 
22
27
  // Set display mode prop and re-create the children so this part of the dom tree renders
23
28
  // in a readonly (display) mode instead of a editable
@@ -52,7 +57,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
52
57
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
53
58
  {{! pick new delimiters for mustache }}
54
59
  {{=<% %>=}}
55
- <FieldGroup>
60
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
56
61
  {showHighlightedData && highlightedDataArr.length > 0 && (
57
62
  <Grid container spacing={1} style={{ padding: '0 0 1em' }}>
58
63
  {highlightedDataArr.map((child, i) => (
@@ -4,22 +4,16 @@ import type { Meta, StoryObj } from '@storybook/react';
4
4
 
5
5
  import {{COMPONENT_CLASS_NAME}} from './index';
6
6
 
7
- window.PCore = {
8
- ...window.PCore,
9
- getErrorHandler: (): any => {
10
- return {
11
- getGenericFailedMessage() {
12
- /* nothing */
13
- }
14
- };
15
- },
16
- getConstants: (): any => {
17
- return {
18
- CASE_INFO: {
19
- INSTRUCTIONS: ''
20
- }
21
- };
22
- }
7
+ window.PCore.getErrorHandler = (): any => {
8
+ return {
9
+ getOperatorDetails: () => {
10
+ return {
11
+ getGenericFailedMessage() {
12
+ /* nothing */
13
+ }
14
+ };
15
+ }
16
+ };
23
17
  };
24
18
 
25
19
  const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
@@ -1,5 +1,5 @@
1
1
  import { PropsWithChildren, ReactElement } from 'react';
2
- import { Grid } from '@mui/material';
2
+ import { Grid, GridSize } from '@mui/material';
3
3
  import makeStyles from '@mui/styles/makeStyles';
4
4
 
5
5
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
@@ -35,8 +35,8 @@ export default function {{COMPONENT_CLASS_NAME}}(props: PropsWithChildren<{{COMP
35
35
  // Calculate the size
36
36
  // Default to assume the 2 columns are evenly split. However, override if templateCol
37
37
  // (example value: "1fr 1fr")
38
- let aSize = 6;
39
- let bSize = 6;
38
+ let aSize: GridSize = 6;
39
+ let bSize: GridSize = 6;
40
40
 
41
41
  const colAArray = templateCol
42
42
  .replaceAll(/[a-z]+/g, '')
@@ -44,8 +44,8 @@ export default function {{COMPONENT_CLASS_NAME}}(props: PropsWithChildren<{{COMP
44
44
  .map(itm => Number(itm));
45
45
  const totalCols = colAArray.reduce((v, itm) => itm + v, 0);
46
46
  const ratio = 12 / totalCols;
47
- aSize = (ratio * colAArray[0]) as number;
48
- bSize = (ratio * colAArray[1]) as number;
47
+ aSize = (ratio * colAArray[0]) as GridSize;
48
+ bSize = (ratio * colAArray[1]) as GridSize;
49
49
 
50
50
  return (
51
51
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>